@junbyeol/tiptap-editor 0.1.3 → 1.0.12

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 (117) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +71 -164
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.mjs +28925 -26754
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/style.css +1 -1
  7. package/dist/types/components/custom/blockquote-popover.d.ts +6 -0
  8. package/dist/types/components/custom/font-size-dropdown-menu/font-size-dropdown-menu.d.ts +9 -0
  9. package/dist/types/components/custom/font-size-dropdown-menu/index.d.ts +1 -0
  10. package/dist/types/components/custom/hr-style-popover.d.ts +6 -0
  11. package/dist/types/components/custom/image-bubble-menu/image-bubble-menu.d.ts +5 -0
  12. package/dist/types/components/custom/image-bubble-menu/image-ratio-popover.d.ts +6 -0
  13. package/dist/types/components/custom/image-bubble-menu/index.d.ts +1 -0
  14. package/dist/types/components/custom/insert-table-popover.d.ts +6 -0
  15. package/dist/types/components/custom/list-style-popover.d.ts +6 -0
  16. package/dist/types/components/custom/table-bubble-menu/index.d.ts +1 -0
  17. package/dist/types/components/custom/table-bubble-menu/table-bubble-menu.d.ts +5 -0
  18. package/dist/types/components/custom/table-cell-background-color-popover.d.ts +6 -0
  19. package/dist/types/components/custom/text-style-dropdown-menu/index.d.ts +4 -0
  20. package/dist/types/components/custom/text-style-dropdown-menu/text-style-button.d.ts +14 -0
  21. package/dist/types/components/custom/text-style-dropdown-menu/text-style-dropdown-menu.d.ts +20 -0
  22. package/dist/types/components/custom/text-style-dropdown-menu/use-text-style-dropdown-menu.d.ts +26 -0
  23. package/dist/types/components/custom/text-style-dropdown-menu/use-text-style.d.ts +71 -0
  24. package/dist/types/components/custom/uploadable-dropdown-menu/index.d.ts +2 -0
  25. package/dist/types/components/custom/uploadable-dropdown-menu/uploadable-button.d.ts +17 -0
  26. package/dist/types/components/custom/uploadable-dropdown-menu/uploadable-dropdown-menu.d.ts +19 -0
  27. package/dist/types/components/tiptap-icons/align-center-icon.d.ts +1 -1
  28. package/dist/types/components/tiptap-icons/align-justify-icon.d.ts +1 -1
  29. package/dist/types/components/tiptap-icons/align-left-icon.d.ts +1 -1
  30. package/dist/types/components/tiptap-icons/align-right-icon.d.ts +1 -1
  31. package/dist/types/components/tiptap-icons/bold-icon.d.ts +1 -1
  32. package/dist/types/components/tiptap-icons/check-icon.d.ts +3 -0
  33. package/dist/types/components/tiptap-icons/chevron-down-icon.d.ts +1 -1
  34. package/dist/types/components/tiptap-icons/code2-icon.d.ts +1 -1
  35. package/dist/types/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
  36. package/dist/types/components/tiptap-icons/double-quotes-icon.d.ts +3 -0
  37. package/dist/types/components/tiptap-icons/external-link-icon.d.ts +3 -0
  38. package/dist/types/components/tiptap-icons/heading-five-icon.d.ts +1 -1
  39. package/dist/types/components/tiptap-icons/heading-four-icon.d.ts +1 -1
  40. package/dist/types/components/tiptap-icons/heading-icon.d.ts +1 -1
  41. package/dist/types/components/tiptap-icons/heading-one-icon.d.ts +1 -1
  42. package/dist/types/components/tiptap-icons/heading-six-icon.d.ts +1 -1
  43. package/dist/types/components/tiptap-icons/heading-three-icon.d.ts +1 -1
  44. package/dist/types/components/tiptap-icons/heading-two-icon.d.ts +1 -1
  45. package/dist/types/components/tiptap-icons/image-align-center.d.ts +3 -0
  46. package/dist/types/components/tiptap-icons/image-align-left.d.ts +3 -0
  47. package/dist/types/components/tiptap-icons/image-align-right.d.ts +3 -0
  48. package/dist/types/components/tiptap-icons/image-caption.d.ts +3 -0
  49. package/dist/types/components/tiptap-icons/image-ratio.d.ts +3 -0
  50. package/dist/types/components/tiptap-icons/italic-icon.d.ts +1 -1
  51. package/dist/types/components/tiptap-icons/link-icon.d.ts +3 -0
  52. package/dist/types/components/tiptap-icons/list-icon.d.ts +1 -1
  53. package/dist/types/components/tiptap-icons/list-ordered-icon.d.ts +1 -1
  54. package/dist/types/components/tiptap-icons/list-todo-icon.d.ts +1 -1
  55. package/dist/types/components/tiptap-icons/paragraph-icon.d.ts +3 -0
  56. package/dist/types/components/tiptap-icons/redo2-icon.d.ts +1 -1
  57. package/dist/types/components/tiptap-icons/separator-icon.d.ts +3 -0
  58. package/dist/types/components/tiptap-icons/strike-icon.d.ts +1 -1
  59. package/dist/types/components/tiptap-icons/subscript-icon.d.ts +1 -1
  60. package/dist/types/components/tiptap-icons/superscript-icon.d.ts +1 -1
  61. package/dist/types/components/tiptap-icons/table-icon.d.ts +3 -0
  62. package/dist/types/components/tiptap-icons/trash-icon.d.ts +3 -0
  63. package/dist/types/components/tiptap-icons/underline-icon.d.ts +1 -1
  64. package/dist/types/components/tiptap-icons/undo2-icon.d.ts +1 -1
  65. package/dist/types/components/tiptap-icons/uploadable-file-icon.d.ts +3 -0
  66. package/dist/types/components/tiptap-icons/uploadable-icon.d.ts +3 -0
  67. package/dist/types/components/tiptap-icons/uploadable-image-icon.d.ts +3 -0
  68. package/dist/types/components/tiptap-ui/heading-button/heading-button.d.ts +1 -1
  69. package/dist/types/components/tiptap-ui/heading-button/use-heading.d.ts +7 -7
  70. package/dist/types/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +1 -1
  71. package/dist/types/components/tiptap-ui/link-popover/index.d.ts +2 -0
  72. package/dist/types/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
  73. package/dist/types/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
  74. package/dist/types/components/tiptap-ui/list-button/list-button.d.ts +1 -1
  75. package/dist/types/components/tiptap-ui/list-button/use-list.d.ts +4 -4
  76. package/dist/types/components/tiptap-ui/mark-button/mark-button.d.ts +1 -1
  77. package/dist/types/components/tiptap-ui/mark-button/use-mark.d.ts +8 -8
  78. package/dist/types/components/tiptap-ui/text-align-button/text-align-button.d.ts +1 -1
  79. package/dist/types/components/tiptap-ui/text-align-button/use-text-align.d.ts +5 -5
  80. package/dist/types/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +1 -1
  81. package/dist/types/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +3 -3
  82. package/dist/types/components/tiptap-ui-primitive/button/button.d.ts +0 -3
  83. package/dist/types/components/tiptap-ui-primitive/button-group/button-group.d.ts +10 -0
  84. package/dist/types/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
  85. package/dist/types/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +2 -2
  86. package/dist/types/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  87. package/dist/types/components/tiptap-ui-primitive/input/input.d.ts +2 -0
  88. package/dist/types/components/tiptap-ui-primitive/popover/popover.d.ts +3 -3
  89. package/dist/types/components/tiptap-ui-primitive/separator/separator.d.ts +2 -3
  90. package/dist/types/components/tiptap-ui-primitive/spacer/spacer.d.ts +1 -1
  91. package/dist/types/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +1 -1
  92. package/dist/types/hooks/use-tiptap-editor.d.ts +1 -12
  93. package/dist/types/lib/index.d.ts +3 -3
  94. package/dist/types/lib/tiptap-utils.d.ts +6 -1
  95. package/dist/types/tiptap/contexts/FileHandlerContext.d.ts +7 -0
  96. package/dist/types/tiptap/extensions/BasicKit.d.ts +2 -0
  97. package/dist/types/tiptap/extensions/BlockquoteKit.d.ts +2 -0
  98. package/dist/types/tiptap/extensions/DefaultFileAttachmentComponent.d.ts +2 -0
  99. package/dist/types/tiptap/extensions/FigcaptionKit.d.ts +2 -0
  100. package/dist/types/tiptap/extensions/FigureKit.d.ts +16 -0
  101. package/dist/types/tiptap/extensions/FileAttachment.d.ts +13 -0
  102. package/dist/types/tiptap/extensions/FontSizeKit.d.ts +10 -0
  103. package/dist/types/tiptap/extensions/HrKit.d.ts +11 -0
  104. package/dist/types/tiptap/extensions/ImageKit.d.ts +1 -0
  105. package/dist/types/tiptap/extensions/Paragraph.d.ts +2 -0
  106. package/dist/types/tiptap/extensions/index.d.ts +8 -0
  107. package/dist/types/tiptap/extensions/table/index.d.ts +1 -0
  108. package/dist/types/tiptap/extensions/table/table-grip-menu.d.ts +13 -0
  109. package/dist/types/tiptap/extensions/table/table-kit.d.ts +3 -0
  110. package/dist/types/tiptap/extensions/table/table-row-column-utils.d.ts +16 -0
  111. package/dist/types/tiptap/extensions/table/table-view.d.ts +52 -0
  112. package/dist/types/tiptap/hooks/useFileHandler.d.ts +32 -0
  113. package/dist/types/tiptap/index.d.ts +10 -6
  114. package/dist/types/tiptap/menubar.d.ts +3 -2
  115. package/package.json +40 -14
  116. package/dist/types/tiptap/extensions/default-file-attachment.d.ts +0 -2
  117. package/dist/types/tiptap/extensions/file-attachment.d.ts +0 -13
package/dist/index.cjs CHANGED
@@ -1,186 +1,93 @@
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,` {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),ot=require("@tiptap/react"),x=require("react"),Q=require("@tiptap/pm/state"),ne=require("@tiptap/pm/tables"),_c=require("react-dom"),w=require("@tiptap/core"),no=require("@tiptap/core/jsx-runtime"),Ch=require("@tiptap/pm/model"),nt=require("@tiptap/pm/view"),ri=require("@tiptap/pm/gapcursor"),wh=require("@tiptap/pm/dropcursor"),Cn=require("@tiptap/pm/history"),Za=require("react-dom/client"),Sc=require("@tiptap/react/menus");function Nc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=Nc(x),Pi=Nc(_c),Ac=x.createContext(null);function xh(){return x.useContext(Ac)}function Tc(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Tc(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Rc(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Tc(e))&&(r&&(r+=" "),r+=t);return r}const _h={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function ke(...e){return Rc(e)}function Sh(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const Nh=(e,t,n=!0)=>{if(t){const r=e.toLowerCase();return _h[r]||(n?e.toUpperCase():e)}return n?e.charAt(0).toUpperCase()+e.slice(1):e},Di=e=>{const{shortcutKeys:t,delimiter:n="+",capitalize:r=!0}=e;return t?t.split(n).map(o=>o.trim()).map(o=>Nh(o,Sh(),r)):[]},Bi=(e,t)=>t?.schema?t.schema.spec.marks.get(e)!==void 0:!1,Ah=(e,t)=>t?.schema?t.schema.spec.nodes.get(e)!==void 0:!1;function Mc(e,t){if(!e||!e.extensionManager)return!1;const n=Array.isArray(t)?t:[t],r=n.some(o=>e.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 Ko(e,t=[],n=!1){if(!e||!e.state.selection)return!1;const{selection:r}=e.state;if(r.empty)return!1;if(r instanceof Q.NodeSelection){const o=r.node;return o?t.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(t.includes(i.type.name))return!0}}return!1}function Th(e,t=[]){if(!e||t.length===0)return!1;const{state:n}=e,{selection:r}=n,o=new Set(t);if(r instanceof Q.NodeSelection){const s=r.node?.type?.name;return!!s&&o.has(s)}if(r instanceof Q.TextSelection||r instanceof Q.AllSelection){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}const Rh=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Mh(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!e||e.replace(Rh,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function kh(e,t,n){try{const r=new URL(e,t);if(Mh(r.href,n))return r.href}catch{}return"#"}function Hi({decorative:e,orientation:t="vertical",className:n,...r}){const s=e?{role:"none"}:{"aria-orientation":t==="vertical"?t:void 0,role:"separator"};return u.jsx("div",{className:ke("tiptap-separator",n),"data-orientation":t,...s,...r})}function Oh({editor:e,containerRef:t,query:n,items:r,onSelect:o,onClose:s,orientation:i="vertical",autoSelectFirstItem:a=!0}){const[c,l]=x.useState(a?0:-1);return x.useEffect(()=>{const d=h=>{if(!r.length)return!1;const p=()=>l(g=>g===-1?0:(g+1)%r.length),m=()=>l(g=>g===-1?r.length-1:(g-1+r.length)%r.length);switch(h.key){case"ArrowUp":return i==="horizontal"?!1:(h.preventDefault(),m(),!0);case"ArrowDown":return i==="horizontal"?!1:(h.preventDefault(),p(),!0);case"ArrowLeft":return i==="vertical"?!1:(h.preventDefault(),m(),!0);case"ArrowRight":return i==="vertical"?!1:(h.preventDefault(),p(),!0);case"Tab":return h.preventDefault(),h.shiftKey?m():p(),!0;case"Home":return h.preventDefault(),l(0),!0;case"End":return h.preventDefault(),l(r.length-1),!0;case"Enter":return h.isComposing?!1:(h.preventDefault(),c!==-1&&r[c]&&o?.(r[c]),!0);case"Escape":return h.preventDefault(),s?.(),!0;default:return!1}};let f=null;if(e?f=e.view.dom:t?.current&&(f=t.current),f)return f.addEventListener("keydown",d,!0),()=>{f?.removeEventListener("keydown",d,!0)}},[e,t,r,c,o,s,i]),x.useEffect(()=>{n&&l(a?0:-1)},[n,a]),{selectedIndex:r.length?c:void 0,setSelectedIndex:l}}const qa=(e,t)=>{typeof e=="function"?e(t):e&&typeof e=="object"&&"current"in e&&(e.current=t)},Ih=(e,t)=>{const n=x.useRef(null);return x.useCallback(r=>{e&&"current"in e&&(e.current=r),n.current&&qa(n.current,null),n.current=t,t&&qa(t,r)},[e,t])},Lh=e=>{const[t,n]=x.useState([]),r=x.useCallback(()=>e.current?Array.from(e.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[e]);x.useEffect(()=>{const s=e.current;if(!s)return;const i=()=>n(r());i();const a=new MutationObserver(i);return a.observe(s,{childList:!0,subtree:!0}),()=>a.disconnect()},[r,e]);const{selectedIndex:o}=Oh({containerRef:e,items:t,orientation:"horizontal",onSelect:s=>s.click(),autoSelectFirstItem:!1});x.useEffect(()=>{const s=e.current;if(!s)return;const i=c=>{const l=c.target;s.contains(l)&&l.setAttribute("data-focus-visible","true")},a=c=>{const l=c.target;s.contains(l)&&l.removeAttribute("data-focus-visible")};return s.addEventListener("focus",i,!0),s.addEventListener("blur",a,!0),()=>{s.removeEventListener("focus",i,!0),s.removeEventListener("blur",a,!0)}},[e]),x.useEffect(()=>{o!==void 0&&t[o]&&t[o].focus()},[o,t])},Wo=x.forwardRef(({children:e,className:t,variant:n="fixed",...r},o)=>{const s=x.useRef(null),i=Ih(s,o);return Lh(s),u.jsx("div",{ref:i,role:"toolbar","aria-label":"toolbar","data-variant":n,className:ke("tiptap-toolbar",t),...r,children:e})});Wo.displayName="Toolbar";const Go=x.forwardRef(({children:e,className:t,...n},r)=>u.jsx("div",{ref:r,role:"group",className:ke("tiptap-toolbar-group",t),...n,children:e}));Go.displayName="ToolbarGroup";const ht=x.forwardRef(({...e},t)=>u.jsx(Hi,{ref:t,orientation:"vertical",decorative:!0,...e}));ht.displayName="ToolbarSeparator";function ae(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function Ya(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Zo(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ya(o,t);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():Ya(e[o],null)}}}}function Oe(...e){return y.useCallback(Zo(...e),e)}function Rn(e,t=[]){let n=[];function r(s,i){const a=y.createContext(i),c=n.length;n=[...n,i];const l=f=>{const{scope:h,children:p,...m}=f,g=h?.[e]?.[c]||a,b=y.useMemo(()=>m,Object.values(m));return u.jsx(g.Provider,{value:b,children:p})};l.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||a,m=y.useContext(p);if(m)return m;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[l,d]}const o=()=>{const s=n.map(i=>y.createContext(i));return function(a){const c=a?.[e]||s;return y.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Ph(o,...t)]}function Ph(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:c,scopeName:l})=>{const f=c(s)[`__scope${l}`];return{...a,...f}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function tr(e){const t=Dh(e),n=y.forwardRef((r,o)=>{const{children:s,...i}=r,a=y.Children.toArray(s),c=a.find(Hh);if(c){const l=c.props.children,d=a.map(f=>f===c?y.Children.count(l)>1?y.Children.only(null):y.isValidElement(l)?l.props.children:null:f);return u.jsx(t,{...i,ref:o,children:y.isValidElement(l)?y.cloneElement(l,void 0,d):null})}return u.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Dh(e){const t=y.forwardRef((n,r)=>{const{children:o,...s}=n;if(y.isValidElement(o)){const i=$h(o),a=Fh(s,o.props);return o.type!==y.Fragment&&(a.ref=r?Zo(r,i):i),y.cloneElement(o,a)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bh=Symbol("radix.slottable");function Hh(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bh}function Fh(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function $h(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Re=Uh.reduce((e,t)=>{const n=tr(`Primitive.${t}`),r=y.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function kc(e,t){e&&Pi.flushSync(()=>e.dispatchEvent(t))}function vt(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}function jh(e,t=globalThis?.document){const n=vt(e);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var zh="DismissableLayer",oi="dismissableLayer.update",Vh="dismissableLayer.pointerDownOutside",Kh="dismissableLayer.focusOutside",Xa,Oc=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fi=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,l=y.useContext(Oc),[d,f]=y.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=y.useState({}),m=Oe(t,R=>f(R)),g=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(b),E=d?g.indexOf(d):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,S=E>=v,N=Zh(R=>{const O=R.target,D=[...l.branches].some(j=>j.contains(O));!S||D||(o?.(R),i?.(R),R.defaultPrevented||a?.())},h),A=qh(R=>{const O=R.target;[...l.branches].some(j=>j.contains(O))||(s?.(R),i?.(R),R.defaultPrevented||a?.())},h);return jh(R=>{E===l.layers.size-1&&(r?.(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},h),y.useEffect(()=>{if(d)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Xa=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),Ja(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Xa)}},[d,h,n,l]),y.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),Ja())},[d,l]),y.useEffect(()=>{const R=()=>p({});return document.addEventListener(oi,R),()=>document.removeEventListener(oi,R)},[]),u.jsx(Re.div,{...c,ref:m,style:{pointerEvents:_?S?"auto":"none":void 0,...e.style},onFocusCapture:ae(e.onFocusCapture,A.onFocusCapture),onBlurCapture:ae(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ae(e.onPointerDownCapture,N.onPointerDownCapture)})});Fi.displayName=zh;var Wh="DismissableLayerBranch",Gh=y.forwardRef((e,t)=>{const n=y.useContext(Oc),r=y.useRef(null),o=Oe(t,r);return y.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(Re.div,{...e,ref:o})});Gh.displayName=Wh;function Zh(e,t=globalThis?.document){const n=vt(e),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Ic(Vh,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function qh(e,t=globalThis?.document){const n=vt(e),r=y.useRef(!1);return y.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ic(Kh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ja(){const e=new CustomEvent(oi);document.dispatchEvent(e)}function Ic(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?kc(o,s):o.dispatchEvent(s)}var Es=0;function Lc(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Qa()),document.body.insertAdjacentElement("beforeend",e[1]??Qa()),Es++,()=>{Es===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Es--}},[])}function Qa(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Cs="focusScope.autoFocusOnMount",ws="focusScope.autoFocusOnUnmount",el={bubbles:!1,cancelable:!0},Yh="FocusScope",$i=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=y.useState(null),l=vt(o),d=vt(s),f=y.useRef(null),h=Oe(t,g=>c(g)),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let g=function(_){if(p.paused||!a)return;const S=_.target;a.contains(S)?f.current=S:Ot(f.current,{select:!0})},b=function(_){if(p.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||Ot(f.current,{select:!0}))},v=function(_){if(document.activeElement===document.body)for(const N of _)N.removedNodes.length>0&&Ot(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const E=new MutationObserver(v);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),E.disconnect()}}},[r,a,p.paused]),y.useEffect(()=>{if(a){nl.add(p);const g=document.activeElement;if(!a.contains(g)){const v=new CustomEvent(Cs,el);a.addEventListener(Cs,l),a.dispatchEvent(v),v.defaultPrevented||(Xh(ng(Pc(a)),{select:!0}),document.activeElement===g&&Ot(a))}return()=>{a.removeEventListener(Cs,l),setTimeout(()=>{const v=new CustomEvent(ws,el);a.addEventListener(ws,d),a.dispatchEvent(v),v.defaultPrevented||Ot(g??document.body,{select:!0}),a.removeEventListener(ws,d),nl.remove(p)},0)}}},[a,l,d,p]);const m=y.useCallback(g=>{if(!n&&!r||p.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(b&&v){const E=g.currentTarget,[_,S]=Jh(E);_&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&Ot(_,{select:!0})):g.shiftKey&&v===_&&(g.preventDefault(),n&&Ot(S,{select:!0})):v===E&&g.preventDefault()}},[n,r,p.paused]);return u.jsx(Re.div,{tabIndex:-1,...i,ref:h,onKeyDown:m})});$i.displayName=Yh;function Xh(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ot(r,{select:t}),document.activeElement!==n)return}function Jh(e){const t=Pc(e),n=tl(t,e),r=tl(t.reverse(),e);return[n,r]}function Pc(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function tl(e,t){for(const n of e)if(!Qh(n,{upTo:t}))return n}function Qh(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function eg(e){return e instanceof HTMLInputElement&&"select"in e}function Ot(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&eg(e)&&t&&e.select()}}var nl=tg();function tg(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=rl(e,t),e.unshift(t)},remove(t){e=rl(e,t),e[0]?.resume()}}}function rl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ng(e){return e.filter(t=>t.tagName!=="A")}var Ht=globalThis?.document?y.useLayoutEffect:()=>{},rg=y[" useId ".trim().toString()]||(()=>{}),og=0;function _n(e){const[t,n]=y.useState(rg());return Ht(()=>{n(r=>r??String(og++))},[e]),e||(t?`radix-${t}`:"")}const sg=["top","right","bottom","left"],Ft=Math.min,Ge=Math.max,ro=Math.round,Sr=Math.floor,bt=e=>({x:e,y:e}),ig={left:"right",right:"left",bottom:"top",top:"bottom"};function si(e,t,n){return Ge(e,Ft(t,n))}function St(e,t){return typeof e=="function"?e(t):e}function Nt(e){return e.split("-")[0]}function Mn(e){return e.split("-")[1]}function Ui(e){return e==="x"?"y":"x"}function ji(e){return e==="y"?"height":"width"}function gt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zi(e){return Ui(gt(e))}function ag(e,t,n){n===void 0&&(n=!1);const r=Mn(e),o=zi(e),s=ji(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=oo(i)),[i,oo(i)]}function lg(e){const t=oo(e);return[ii(e),t,ii(t)]}function ii(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ol=["left","right"],sl=["right","left"],cg=["top","bottom"],ug=["bottom","top"];function dg(e,t,n){switch(e){case"top":case"bottom":return n?t?sl:ol:t?ol:sl;case"left":case"right":return t?cg:ug;default:return[]}}function fg(e,t,n,r){const o=Mn(e);let s=dg(Nt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ii)))),s}function oo(e){const t=Nt(e);return ig[t]+e.slice(t.length)}function pg(e){return{top:0,right:0,bottom:0,left:0,...e}}function Dc(e){return typeof e!="number"?pg(e):{top:e,right:e,bottom:e,left:e}}function so(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function il(e,t,n){let{reference:r,floating:o}=e;const s=gt(t),i=zi(t),a=ji(i),c=Nt(t),l=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Mn(t)){case"start":p[i]-=h*(n&&l?-1:1);break;case"end":p[i]+=h*(n&&l?-1:1);break}return p}async function hg(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=St(t,e),m=Dc(p),b=a[h?f==="floating"?"reference":"floating":f],v=so(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),E=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},N=so(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:_,strategy:c}):E);return{top:(v.top-N.top+m.top)/S.y,bottom:(N.bottom-v.bottom+m.bottom)/S.y,left:(v.left-N.left+m.left)/S.x,right:(N.right-v.right+m.right)/S.x}}const gg=50,mg=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:hg},c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=il(l,r,c),h=r,p=0;const m={};for(let g=0;g<s.length;g++){const b=s[g];if(!b)continue;const{name:v,fn:E}=b,{x:_,y:S,data:N,reset:A}=await E({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});d=_??d,f=S??f,m[v]={...m[v],...N},A&&p<gg&&(p++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(l=A.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):A.rects),{x:d,y:f}=il(l,h,c)),g=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}},bg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:d=0}=St(e,t)||{};if(l==null)return{};const f=Dc(d),h={x:n,y:r},p=zi(o),m=ji(p),g=await i.getDimensions(l),b=p==="y",v=b?"top":"left",E=b?"bottom":"right",_=b?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[p]-h[p]-s.floating[m],N=h[p]-s.reference[p],A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let R=A?A[_]:0;(!R||!await(i.isElement==null?void 0:i.isElement(A)))&&(R=a.floating[_]||s.floating[m]);const O=S/2-N/2,D=R/2-g[m]/2-1,j=Ft(f[v],D),Y=Ft(f[E],D),J=j,X=R-g[m]-Y,I=R/2-g[m]/2+O,$=si(J,I,X),U=!c.arrow&&Mn(o)!=null&&I!==$&&s.reference[m]/2-(I<J?j:Y)-g[m]/2<0,H=U?I<J?I-J:I-X:0;return{[p]:h[p]+H,data:{[p]:$,centerOffset:I-$-H,...U&&{alignmentOffset:H}},reset:U}}}),vg=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...b}=St(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Nt(o),E=gt(a),_=Nt(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(l.floating)),N=h||(_||!g?[oo(a)]:lg(a)),A=m!=="none";!h&&A&&N.push(...fg(a,g,m,S));const R=[a,...N],O=await c.detectOverflow(t,b),D=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&D.push(O[v]),f){const I=ag(o,i,S);D.push(O[I[0]],O[I[1]])}if(j=[...j,{placement:o,overflows:D}],!D.every(I=>I<=0)){var Y,J;const I=(((Y=s.flip)==null?void 0:Y.index)||0)+1,$=R[I];if($&&(!(f==="alignment"?E!==gt($):!1)||j.every(T=>gt(T.placement)===E?T.overflows[0]>0:!0)))return{data:{index:I,overflows:j},reset:{placement:$}};let U=(J=j.filter(H=>H.overflows[0]<=0).sort((H,T)=>H.overflows[1]-T.overflows[1])[0])==null?void 0:J.placement;if(!U)switch(p){case"bestFit":{var X;const H=(X=j.filter(T=>{if(A){const k=gt(T.placement);return k===E||k==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(k=>k>0).reduce((k,K)=>k+K,0)]).sort((T,k)=>T[1]-k[1])[0])==null?void 0:X[0];H&&(U=H);break}case"initialPlacement":U=a;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function al(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ll(e){return sg.some(t=>e[t]>=0)}const yg=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=St(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=al(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ll(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=al(i,n.floating);return{data:{escapedOffsets:a,escaped:ll(a)}}}default:return{}}}}},Bc=new Set(["left","top"]);async function Eg(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Nt(n),a=Mn(n),c=gt(n)==="y",l=Bc.has(i)?-1:1,d=s&&c?-1:1,f=St(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),c?{x:p*d,y:h*l}:{x:h*l,y:p*d}}const Cg=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await Eg(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},wg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:v=>{let{x:E,y:_}=v;return{x:E,y:_}}},...l}=St(e,t),d={x:n,y:r},f=await s.detectOverflow(t,l),h=gt(Nt(o)),p=Ui(h);let m=d[p],g=d[h];if(i){const v=p==="y"?"top":"left",E=p==="y"?"bottom":"right",_=m+f[v],S=m-f[E];m=si(_,m,S)}if(a){const v=h==="y"?"top":"left",E=h==="y"?"bottom":"right",_=g+f[v],S=g-f[E];g=si(_,g,S)}const b=c.fn({...t,[p]:m,[h]:g});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:i,[h]:a}}}}}},xg=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=St(e,t),d={x:n,y:r},f=gt(o),h=Ui(f);let p=d[h],m=d[f];const g=St(a,t),b=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const _=h==="y"?"height":"width",S=s.reference[h]-s.floating[_]+b.mainAxis,N=s.reference[h]+s.reference[_]-b.mainAxis;p<S?p=S:p>N&&(p=N)}if(l){var v,E;const _=h==="y"?"width":"height",S=Bc.has(Nt(o)),N=s.reference[f]-s.floating[_]+(S&&((v=i.offset)==null?void 0:v[f])||0)+(S?0:b.crossAxis),A=s.reference[f]+s.reference[_]+(S?0:((E=i.offset)==null?void 0:E[f])||0)-(S?b.crossAxis:0);m<N?m=N:m>A&&(m=A)}return{[h]:p,[f]:m}}}},_g=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...l}=St(e,t),d=await i.detectOverflow(t,l),f=Nt(o),h=Mn(o),p=gt(o)==="y",{width:m,height:g}=s.floating;let b,v;f==="top"||f==="bottom"?(b=f,v=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(v=f,b=h==="end"?"top":"bottom");const E=g-d.top-d.bottom,_=m-d.left-d.right,S=Ft(g-d[b],E),N=Ft(m-d[v],_),A=!t.middlewareData.shift;let R=S,O=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=E),A&&!h){const j=Ge(d.left,0),Y=Ge(d.right,0),J=Ge(d.top,0),X=Ge(d.bottom,0);p?O=m-2*(j!==0||Y!==0?j+Y:Ge(d.left,d.right)):R=g-2*(J!==0||X!==0?J+X:Ge(d.top,d.bottom))}await c({...t,availableWidth:O,availableHeight:R});const D=await i.getDimensions(a.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function qo(){return typeof window<"u"}function kn(e){return Vi(e)?(e.nodeName||"").toLowerCase():"#document"}function Ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yt(e){var t;return(t=(Vi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vi(e){return qo()?e instanceof Node||e instanceof Ve(e).Node:!1}function be(e){return qo()?e instanceof Element||e instanceof Ve(e).Element:!1}function et(e){return qo()?e instanceof HTMLElement||e instanceof Ve(e).HTMLElement:!1}function ai(e){return!qo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ve(e).ShadowRoot}function ur(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Sg(e){return/^(table|td|th)$/.test(kn(e))}function Yo(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ng=/transform|translate|scale|rotate|perspective|filter/,Ag=/paint|layout|strict|content/,Xt=e=>!!e&&e!=="none";let xs;function Ki(e){const t=be(e)?Qe(e):e;return Xt(t.transform)||Xt(t.translate)||Xt(t.scale)||Xt(t.rotate)||Xt(t.perspective)||!Xo()&&(Xt(t.backdropFilter)||Xt(t.filter))||Ng.test(t.willChange||"")||Ag.test(t.contain||"")}function Tg(e){let t=At(e);for(;et(t)&&!_t(t);){if(Ki(t))return t;if(Yo(t))return null;t=At(t)}return null}function Xo(){return xs==null&&(xs=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xs}function _t(e){return/^(html|body|#document)$/.test(kn(e))}function Qe(e){return Ve(e).getComputedStyle(e)}function Jo(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function At(e){if(kn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ai(e)&&e.host||yt(e);return ai(t)?t.host:t}function Hc(e){const t=At(e);return _t(t)?e.ownerDocument?e.ownerDocument.body:e.body:et(t)&&ur(t)?t:Hc(t)}function Bt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Hc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ve(o);if(s){const a=li(i);return t.concat(i,i.visualViewport||[],ur(o)?o:[],a&&n?Bt(a):[])}else return t.concat(o,Bt(o,[],n))}function li(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fc(e){const t=Qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=et(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=ro(n)!==s||ro(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Wi(e){return be(e)?e:e.contextElement}function wn(e){const t=Wi(e);if(!et(t))return bt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Fc(t);let i=(s?ro(n.width):n.width)/r,a=(s?ro(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Rg=bt(0);function $c(e){const t=Ve(e);return!Xo()||!t.visualViewport?Rg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mg(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ve(e)?!1:t}function nn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wi(e);let i=bt(1);t&&(r?be(r)&&(i=wn(r)):i=wn(e));const a=Mg(s,n,r)?$c(s):bt(0);let c=(o.left+a.x)/i.x,l=(o.top+a.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const h=Ve(s),p=r&&be(r)?Ve(r):r;let m=h,g=li(m);for(;g&&r&&p!==m;){const b=wn(g),v=g.getBoundingClientRect(),E=Qe(g),_=v.left+(g.clientLeft+parseFloat(E.paddingLeft))*b.x,S=v.top+(g.clientTop+parseFloat(E.paddingTop))*b.y;c*=b.x,l*=b.y,d*=b.x,f*=b.y,c+=_,l+=S,m=Ve(g),g=li(m)}}return so({width:d,height:f,x:c,y:l})}function Qo(e,t){const n=Jo(e).scrollLeft;return t?t.left+n:nn(yt(e)).left+n}function Uc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Qo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function kg(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=yt(r),a=t?Yo(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=bt(1);const d=bt(0),f=et(r);if((f||!f&&!s)&&((kn(r)!=="body"||ur(i))&&(c=Jo(r)),f)){const p=nn(r);l=wn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=i&&!f&&!s?Uc(i,c):bt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+h.x,y:n.y*l.y-c.scrollTop*l.y+d.y+h.y}}function Og(e){return Array.from(e.getClientRects())}function Ig(e){const t=yt(e),n=Jo(e),r=e.ownerDocument.body,o=Ge(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ge(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Qo(e);const a=-n.scrollTop;return Qe(r).direction==="rtl"&&(i+=Ge(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const cl=25;function Lg(e,t){const n=Ve(e),r=yt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=Xo();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const l=Qo(r);if(l<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=cl&&(s-=m)}else l<=cl&&(s+=l);return{width:s,height:i,x:a,y:c}}function Pg(e,t){const n=nn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=et(e)?wn(e):bt(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,l=r*s.y;return{width:i,height:a,x:c,y:l}}function ul(e,t,n){let r;if(t==="viewport")r=Lg(e,n);else if(t==="document")r=Ig(yt(e));else if(be(t))r=Pg(t,n);else{const o=$c(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return so(r)}function jc(e,t){const n=At(e);return n===t||!be(n)||_t(n)?!1:Qe(n).position==="fixed"||jc(n,t)}function Dg(e,t){const n=t.get(e);if(n)return n;let r=Bt(e,[],!1).filter(a=>be(a)&&kn(a)!=="body"),o=null;const s=Qe(e).position==="fixed";let i=s?At(e):e;for(;be(i)&&!_t(i);){const a=Qe(i),c=Ki(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ur(i)&&!c&&jc(e,i))?r=r.filter(d=>d!==i):o=a,i=At(i)}return t.set(e,r),r}function Bg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Yo(t)?[]:Dg(t,this._c):[].concat(n),r],a=ul(t,i[0],o);let c=a.top,l=a.right,d=a.bottom,f=a.left;for(let h=1;h<i.length;h++){const p=ul(t,i[h],o);c=Ge(p.top,c),l=Ft(p.right,l),d=Ft(p.bottom,d),f=Ge(p.left,f)}return{width:l-f,height:d-c,x:f,y:c}}function Hg(e){const{width:t,height:n}=Fc(e);return{width:t,height:n}}function Fg(e,t,n){const r=et(t),o=yt(t),s=n==="fixed",i=nn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=bt(0);function l(){c.x=Qo(o)}if(r||!r&&!s)if((kn(t)!=="body"||ur(o))&&(a=Jo(t)),r){const p=nn(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const d=o&&!r&&!s?Uc(o,a):bt(0),f=i.left+a.scrollLeft-c.x-d.x,h=i.top+a.scrollTop-c.y-d.y;return{x:f,y:h,width:i.width,height:i.height}}function _s(e){return Qe(e).position==="static"}function dl(e,t){if(!et(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yt(e)===n&&(n=n.ownerDocument.body),n}function zc(e,t){const n=Ve(e);if(Yo(e))return n;if(!et(e)){let o=At(e);for(;o&&!_t(o);){if(be(o)&&!_s(o))return o;o=At(o)}return n}let r=dl(e,t);for(;r&&Sg(r)&&_s(r);)r=dl(r,t);return r&&_t(r)&&_s(r)&&!Ki(r)?n:r||Tg(e)||n}const $g=async function(e){const t=this.getOffsetParent||zc,n=this.getDimensions,r=await n(e.floating);return{reference:Fg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ug(e){return Qe(e).direction==="rtl"}const jg={convertOffsetParentRelativeRectToViewportRelativeRect:kg,getDocumentElement:yt,getClippingRect:Bg,getOffsetParent:zc,getElementRects:$g,getClientRects:Og,getDimensions:Hg,getScale:wn,isElement:be,isRTL:Ug};function Vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zg(e,t){let n=null,r;const o=yt(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=l;if(a||t(),!h||!p)return;const m=Sr(f),g=Sr(o.clientWidth-(d+h)),b=Sr(o.clientHeight-(f+p)),v=Sr(d),_={rootMargin:-m+"px "+-g+"px "+-b+"px "+-v+"px",threshold:Ge(0,Ft(1,c))||1};let S=!0;function N(A){const R=A[0].intersectionRatio;if(R!==c){if(!S)return i();R?i(!1,R):r=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!Vc(l,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(N,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(N,_)}n.observe(e)}return i(!0),s}function Kc(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,l=Wi(e),d=o||s?[...l?Bt(l):[],...t?Bt(t):[]]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const f=l&&a?zg(l,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(v=>{let[E]=v;E&&E.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,g=c?nn(e):null;c&&b();function b(){const v=nn(e);g&&!Vc(g,v)&&n(),g=v,m=requestAnimationFrame(b)}return n(),()=>{var v;d.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),f?.(),(v=p)==null||v.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const Vg=Cg,Kg=wg,Wg=vg,Gg=_g,Zg=yg,fl=bg,qg=xg,Yg=(e,t,n)=>{const r=new Map,o={platform:jg,...n},s={...o.platform,_c:r};return mg(e,t,{...o,platform:s})};var Xg=typeof document<"u",Jg=function(){},Wr=Xg?x.useLayoutEffect:Jg;function io(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!io(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!io(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Wc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pl(e,t){const n=Wc(e);return Math.round(t*n)/n}function Ss(e){const t=y.useRef(e);return Wr(()=>{t.current=e}),t}function Gc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[d,f]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=y.useState(r);io(h,r)||p(r);const[m,g]=y.useState(null),[b,v]=y.useState(null),E=y.useCallback(T=>{T!==A.current&&(A.current=T,g(T))},[]),_=y.useCallback(T=>{T!==R.current&&(R.current=T,v(T))},[]),S=s||m,N=i||b,A=y.useRef(null),R=y.useRef(null),O=y.useRef(d),D=c!=null,j=Ss(c),Y=Ss(o),J=Ss(l),X=y.useCallback(()=>{if(!A.current||!R.current)return;const T={placement:t,strategy:n,middleware:h};Y.current&&(T.platform=Y.current),Yg(A.current,R.current,T).then(k=>{const K={...k,isPositioned:J.current!==!1};I.current&&!io(O.current,K)&&(O.current=K,Pi.flushSync(()=>{f(K)}))})},[h,t,n,Y,J]);Wr(()=>{l===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[l]);const I=y.useRef(!1);Wr(()=>(I.current=!0,()=>{I.current=!1}),[]),Wr(()=>{if(S&&(A.current=S),N&&(R.current=N),S&&N){if(j.current)return j.current(S,N,X);X()}},[S,N,X,j,D]);const $=y.useMemo(()=>({reference:A,floating:R,setReference:E,setFloating:_}),[E,_]),U=y.useMemo(()=>({reference:S,floating:N}),[S,N]),H=y.useMemo(()=>{const T={position:n,left:0,top:0};if(!U.floating)return T;const k=pl(U.floating,d.x),K=pl(U.floating,d.y);return a?{...T,transform:"translate("+k+"px, "+K+"px)",...Wc(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:K}},[n,a,U.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:X,refs:$,elements:U,floatingStyles:H}),[d,X,$,U,H])}const Qg=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?fl({element:r.current,padding:o}).fn(n):{}:r?fl({element:r,padding:o}).fn(n):{}}}},Zc=(e,t)=>{const n=Vg(e);return{name:n.name,fn:n.fn,options:[e,t]}},qc=(e,t)=>{const n=Kg(e);return{name:n.name,fn:n.fn,options:[e,t]}},em=(e,t)=>({fn:qg(e).fn,options:[e,t]}),Yc=(e,t)=>{const n=Wg(e);return{name:n.name,fn:n.fn,options:[e,t]}},tm=(e,t)=>{const n=Gg(e);return{name:n.name,fn:n.fn,options:[e,t]}},nm=(e,t)=>{const n=Zg(e);return{name:n.name,fn:n.fn,options:[e,t]}},rm=(e,t)=>{const n=Qg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var om="Arrow",Xc=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return u.jsx(Re.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xc.displayName=om;var sm=Xc;function im(e){const[t,n]=y.useState(void 0);return Ht(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;i=l.inlineSize,a=l.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Gi="Popper",[Jc,es]=Rn(Gi),[am,Qc]=Jc(Gi),eu=e=>{const{__scopePopper:t,children:n}=e,[r,o]=y.useState(null);return u.jsx(am,{scope:t,anchor:r,onAnchorChange:o,children:n})};eu.displayName=Gi;var tu="PopperAnchor",nu=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Qc(tu,n),i=y.useRef(null),a=Oe(t,i),c=y.useRef(null);return y.useEffect(()=>{const l=c.current;c.current=r?.current||i.current,l!==c.current&&s.onAnchorChange(c.current)}),r?null:u.jsx(Re.div,{...o,ref:a})});nu.displayName=tu;var Zi="PopperContent",[lm,cm]=Jc(Zi),ru=y.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...g}=e,b=Qc(Zi,n),[v,E]=y.useState(null),_=Oe(t,ue=>E(ue)),[S,N]=y.useState(null),A=im(S),R=A?.width??0,O=A?.height??0,D=r+(s!=="center"?"-"+s:""),j=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},Y=Array.isArray(l)?l:[l],J=Y.length>0,X={padding:j,boundary:Y.filter(dm),altBoundary:J},{refs:I,floatingStyles:$,placement:U,isPositioned:H,middlewareData:T}=Gc({strategy:"fixed",placement:D,whileElementsMounted:(...ue)=>Kc(...ue,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[Zc({mainAxis:o+O,alignmentAxis:i}),c&&qc({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?em():void 0,...X}),c&&Yc({...X}),tm({...X,apply:({elements:ue,rects:Ze,availableWidth:an,availableHeight:st})=>{const{width:Wt,height:Gt}=Ze.reference,it=ue.floating.style;it.setProperty("--radix-popper-available-width",`${an}px`),it.setProperty("--radix-popper-available-height",`${st}px`),it.setProperty("--radix-popper-anchor-width",`${Wt}px`),it.setProperty("--radix-popper-anchor-height",`${Gt}px`)}}),S&&rm({element:S,padding:a}),fm({arrowWidth:R,arrowHeight:O}),h&&nm({strategy:"referenceHidden",...X})]}),[k,K]=iu(U),oe=vt(m);Ht(()=>{H&&oe?.()},[H,oe]);const Z=T.arrow?.x,ce=T.arrow?.y,Ke=T.arrow?.centerOffset!==0,[he,ye]=y.useState();return Ht(()=>{v&&ye(window.getComputedStyle(v).zIndex)},[v]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:H?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(lm,{scope:n,placedSide:k,onArrowChange:N,arrowX:Z,arrowY:ce,shouldHideArrow:Ke,children:u.jsx(Re.div,{"data-side":k,"data-align":K,...g,ref:_,style:{...g.style,animation:H?void 0:"none"}})})})});ru.displayName=Zi;var ou="PopperArrow",um={top:"bottom",right:"left",bottom:"top",left:"right"},su=y.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=cm(ou,r),i=um[s.placedSide];return u.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:u.jsx(sm,{...o,ref:n,style:{...o.style,display:"block"}})})});su.displayName=ou;function dm(e){return e!==null}var fm=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[l,d]=iu(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+c/2;let m="",g="";return l==="bottom"?(m=i?f:`${h}px`,g=`${-c}px`):l==="top"?(m=i?f:`${h}px`,g=`${r.floating.height+c}px`):l==="right"?(m=`${-c}px`,g=i?f:`${p}px`):l==="left"&&(m=`${r.floating.width+c}px`,g=i?f:`${p}px`),{data:{x:m,y:g}}}});function iu(e){const[t,n="center"]=e.split("-");return[t,n]}var qi=eu,Yi=nu,au=ru,lu=su,pm="Portal",Xi=y.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=y.useState(!1);Ht(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?_c.createPortal(u.jsx(Re.div,{...r,ref:t}),i):null});Xi.displayName=pm;function hm(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var on=e=>{const{present:t,children:n}=e,r=gm(t),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Oe(r.ref,mm(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:s}):null};on.displayName="Presence";function gm(e){const[t,n]=y.useState(),r=y.useRef(null),o=y.useRef(e),s=y.useRef("none"),i=e?"mounted":"unmounted",[a,c]=hm(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const l=Nr(r.current);s.current=a==="mounted"?l:"none"},[a]),Ht(()=>{const l=r.current,d=o.current;if(d!==e){const h=s.current,p=Nr(l);e?c("MOUNT"):p==="none"||l?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ht(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,f=p=>{const g=Nr(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&g&&(c("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(s.current=Nr(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:y.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Nr(e){return e?.animationName||"none"}function mm(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bm=y[" useInsertionEffect ".trim().toString()]||Ht;function ts({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=vm({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=y.useRef(e!==void 0);y.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"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.`),d.current=a},[a,r])}const l=y.useCallback(d=>{if(a){const f=ym(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[a,e,s,i]);return[c,l]}function vm({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),o=y.useRef(n),s=y.useRef(t);return bm(()=>{s.current=t},[t]),y.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function ym(e){return typeof e=="function"}var Em=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},dn=new WeakMap,Ar=new WeakMap,Tr={},Ns=0,cu=function(e){return e&&(e.host||cu(e.parentNode))},Cm=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=cu(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},wm=function(e,t,n,r){var o=Cm(t,Array.isArray(e)?e:[e]);Tr[n]||(Tr[n]=new WeakMap);var s=Tr[n],i=[],a=new Set,c=new Set(o),l=function(f){!f||a.has(f)||(a.add(f),l(f.parentNode))};o.forEach(l);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))d(h);else try{var p=h.getAttribute(r),m=p!==null&&p!=="false",g=(dn.get(h)||0)+1,b=(s.get(h)||0)+1;dn.set(h,g),s.set(h,b),i.push(h),g===1&&m&&Ar.set(h,!0),b===1&&h.setAttribute(n,"true"),m||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return d(t),a.clear(),Ns++,function(){i.forEach(function(f){var h=dn.get(f)-1,p=s.get(f)-1;dn.set(f,h),s.set(f,p),h||(Ar.has(f)||f.removeAttribute(r),Ar.delete(f)),p||f.removeAttribute(n)}),Ns--,Ns||(dn=new WeakMap,dn=new WeakMap,Ar=new WeakMap,Tr={})}},uu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Em(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),wm(r,o,n,"aria-hidden")):function(){return null}},ft=function(){return ft=Object.assign||function(t){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)&&(t[s]=n[s])}return t},ft.apply(this,arguments)};function du(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function xm(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Gr="right-scroll-bar-position",Zr="width-before-scroll-bar",_m="with-scroll-bars-hidden",Sm="--removed-body-scroll-bar-size";function As(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Nm(e,t){var n=x.useState(function(){return{value:e,callback:t,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=t,n.facade}var Am=typeof window<"u"?y.useLayoutEffect:y.useEffect,hl=new WeakMap;function Tm(e,t){var n=Nm(null,function(r){return e.forEach(function(o){return As(o,r)})});return Am(function(){var r=hl.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||As(a,null)}),s.forEach(function(a){o.has(a)||As(a,i)})}hl.set(n,e)},[e]),n}function Rm(e){return e}function Mm(e,t){t===void 0&&(t=Rm);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]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(d){i.push(d),l()},filter:function(d){return i=i.filter(d),n}}}};return o}function km(e){e===void 0&&(e={});var t=Mm(null);return t.options=ft({async:!0,ssr:!1},e),t}var fu=function(e){var t=e.sideCar,n=du(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,ft({},n))};fu.isSideCarExport=!0;function Om(e,t){return e.useMedium(t),fu}var pu=km(),Ts=function(){},ns=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:Ts,onWheelCapture:Ts,onTouchMoveCapture:Ts}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,m=e.noIsolation,g=e.inert,b=e.allowPinchZoom,v=e.as,E=v===void 0?"div":v,_=e.gapMode,S=du(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=h,A=Tm([n,t]),R=ft(ft({},S),o);return y.createElement(y.Fragment,null,d&&y.createElement(N,{sideCar:pu,removeScrollBar:l,shards:f,noRelative:p,noIsolation:m,inert:g,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:_}),i?y.cloneElement(y.Children.only(a),ft(ft({},R),{ref:A})):y.createElement(E,ft({},R,{className:c,ref:A}),a))});ns.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ns.classNames={fullWidth:Zr,zeroRight:Gr};var Im=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Lm(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Im();return t&&e.setAttribute("nonce",t),e}function Pm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Dm(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Bm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Lm())&&(Pm(t,n),Dm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Hm=function(){var e=Bm();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},hu=function(){var e=Hm(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Fm={left:0,top:0,right:0,gap:0},Rs=function(e){return parseInt(e||"",10)||0},$m=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Rs(n),Rs(r),Rs(o)]},Um=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Fm;var t=$m(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},jm=hu(),xn="data-scroll-locked",zm=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
2
+ .`.concat(_m,` {
144
3
  overflow: hidden `).concat(r,`;
145
- padding-right: `).concat(l,"px ").concat(r,`;
4
+ padding-right: `).concat(a,"px ").concat(r,`;
146
5
  }
147
- body[`).concat(Jn,`] {
6
+ body[`).concat(xn,`] {
148
7
  overflow: hidden `).concat(r,`;
149
8
  overscroll-behavior: contain;
150
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
9
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
151
10
  padding-left: `.concat(o,`px;
152
11
  padding-top: `).concat(s,`px;
153
12
  padding-right: `).concat(i,`px;
154
13
  margin-left:0;
155
14
  margin-top:0;
156
- margin-right: `).concat(l,"px ").concat(r,`;
157
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
15
+ margin-right: `).concat(a,"px ").concat(r,`;
16
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
158
17
  }
159
18
 
160
- .`).concat(Ko,` {
161
- right: `).concat(l,"px ").concat(r,`;
19
+ .`).concat(Gr,` {
20
+ right: `).concat(a,"px ").concat(r,`;
162
21
  }
163
22
 
164
- .`).concat(qo,` {
165
- margin-right: `).concat(l,"px ").concat(r,`;
23
+ .`).concat(Zr,` {
24
+ margin-right: `).concat(a,"px ").concat(r,`;
166
25
  }
167
26
 
168
- .`).concat(Ko," .").concat(Ko,` {
27
+ .`).concat(Gr," .").concat(Gr,` {
169
28
  right: 0 `).concat(r,`;
170
29
  }
171
30
 
172
- .`).concat(qo," .").concat(qo,` {
31
+ .`).concat(Zr," .").concat(Zr,` {
173
32
  margin-right: 0 `).concat(r,`;
174
33
  }
175
34
 
176
- body[`).concat(Jn,`] {
177
- `).concat(WT,": ").concat(l,`px;
35
+ body[`).concat(xn,`] {
36
+ `).concat(Sm,": ").concat(a,`px;
178
37
  }
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=({defaultValue:t="",onChange:e,minHeight:n,maxHeight:r,uploadFile:o,onFileInsert:s,onFileError:i,allowNonImageFile:l=!1,FileAttachmentComponent:a=P0})=>{const c=E.useRef(e),u=E.useRef(o),d=E.useRef(s),f=E.useRef(i),h=E.useRef(a);E.useEffect(()=>{c.current=e},[e]),E.useEffect(()=>{u.current=o},[o]),E.useEffect(()=>{d.current=s},[s]),E.useEffect(()=>{f.current=i},[i]),E.useEffect(()=>{h.current=a},[a]);const p=E.useCallback(async C=>u.current?await u.current(C):await A5(C),[]),m=E.useCallback((C,w,x,S)=>{if(C){if(N5(w)){C.chain().insertContentAt(S,{type:"image",attrs:{src:x}}).focus().run();return}C.chain().insertContentAt(S,{type:"fileAttachment",attrs:{name:w.name,mimeType:w.type,url:x,size:w.size}}).focus().run()}},[]),g=Vw({extensions:[LS,R0,O0,N0,a5.configure({types:["heading","paragraph"]}),xm,T5,D0(h),w5.configure({table:{resizable:!0}}),I0.extend({addAttributes(){return{...this.parent?.(),backgroundColor:{default:null,renderHTML:C=>C.backgroundColor?{style:`background-color: ${C.backgroundColor}`}:{},parseHTML:C=>C.style.backgroundColor.replace(/['"]+/g,"")}}}}),E5.configure({allowedMimeTypes:l?void 0:R5,onDrop:async(C,w,x)=>{for(const S of w){const M=await p(S);d.current?.(S),m(C,S,M,x)}},onPaste:async(C,w,x)=>{if(x){f.current?.(new Error("외부에서 복사해온 파일을 바로 붙여넣기할 수 없습니다"));return}for(const S of w){const M=await p(S);d.current?.(S),m(C,S,M,C.state.selection.anchor)}}})],content:t,onUpdate:({editor:C})=>{c.current?.(C.getHTML())}}),y=E.useMemo(()=>({editor:g}),[g]);return b.jsx(I5,{minHeight:n,maxHeight:r,children:b.jsxs(li.Provider,{value:y,children:[b.jsx(t5,{editor:g}),b.jsx(Kp,{editor:g})]})})},I5=({children:t,minHeight:e,maxHeight:n})=>b.jsx("div",{className:"tiptap-wrapper",style:{"--tiptap-min-height":e,"--tiptap-max-height":n},children:t});exports.DefaultFileAttachmentComponent=P0;exports.TiptapEditor=O5;exports.createFileAttachmentExtension=D0;
38
+ `)},gl=function(){var e=parseInt(document.body.getAttribute(xn)||"0",10);return isFinite(e)?e:0},Vm=function(){y.useEffect(function(){return document.body.setAttribute(xn,(gl()+1).toString()),function(){var e=gl()-1;e<=0?document.body.removeAttribute(xn):document.body.setAttribute(xn,e.toString())}},[])},Km=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Vm();var s=y.useMemo(function(){return Um(o)},[o]);return y.createElement(jm,{styles:zm(s,!t,o,n?"":"!important")})},ci=!1;if(typeof window<"u")try{var Rr=Object.defineProperty({},"passive",{get:function(){return ci=!0,!0}});window.addEventListener("test",Rr,Rr),window.removeEventListener("test",Rr,Rr)}catch{ci=!1}var fn=ci?{passive:!1}:!1,Wm=function(e){return e.tagName==="TEXTAREA"},gu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Wm(e)&&n[t]==="visible")},Gm=function(e){return gu(e,"overflowY")},Zm=function(e){return gu(e,"overflowX")},ml=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=mu(e,r);if(o){var s=bu(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qm=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ym=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},mu=function(e,t){return e==="v"?Gm(t):Zm(t)},bu=function(e,t){return e==="v"?qm(t):Ym(t)},Xm=function(e,t){return e==="h"&&t==="rtl"?-1:1},Jm=function(e,t,n,r,o){var s=Xm(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),l=!1,d=i>0,f=0,h=0;do{if(!a)break;var p=bu(e,a),m=p[0],g=p[1],b=p[2],v=g-b-s*m;(m||v)&&mu(e,a)&&(f+=v,h+=m);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(l=!0),l},Mr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bl=function(e){return[e.deltaX,e.deltaY]},vl=function(e){return e&&"current"in e?e.current:e},Qm=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e1=function(e){return`
39
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
40
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
+ `)},t1=0,pn=[];function n1(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(t1++)[0],s=y.useState(hu)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var g=xm([e.lockRef.current],(e.shards||[]).map(vl),!0).filter(Boolean);return g.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=y.useCallback(function(g,b){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var v=Mr(g),E=n.current,_="deltaX"in g?g.deltaX:E[0]-v[0],S="deltaY"in g?g.deltaY:E[1]-v[1],N,A=g.target,R=Math.abs(_)>Math.abs(S)?"h":"v";if("touches"in g&&R==="h"&&A.type==="range")return!1;var O=window.getSelection(),D=O&&O.anchorNode,j=D?D===A||D.contains(A):!1;if(j)return!1;var Y=ml(R,A);if(!Y)return!0;if(Y?N=R:(N=R==="v"?"h":"v",Y=ml(R,A)),!Y)return!1;if(!r.current&&"changedTouches"in g&&(_||S)&&(r.current=N),!N)return!0;var J=r.current||N;return Jm(J,b,g,J==="h"?_:S)},[]),c=y.useCallback(function(g){var b=g;if(!(!pn.length||pn[pn.length-1]!==s)){var v="deltaY"in b?bl(b):Mr(b),E=t.current.filter(function(N){return N.name===b.type&&(N.target===b.target||b.target===N.shadowParent)&&Qm(N.delta,v)})[0];if(E&&E.should){b.cancelable&&b.preventDefault();return}if(!E){var _=(i.current.shards||[]).map(vl).filter(Boolean).filter(function(N){return N.contains(b.target)}),S=_.length>0?a(b,_[0]):!i.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),l=y.useCallback(function(g,b,v,E){var _={name:g,delta:b,target:v,should:E,shadowParent:r1(v)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(S){return S!==_})},1)},[]),d=y.useCallback(function(g){n.current=Mr(g),r.current=void 0},[]),f=y.useCallback(function(g){l(g.type,bl(g),g.target,a(g,e.lockRef.current))},[]),h=y.useCallback(function(g){l(g.type,Mr(g),g.target,a(g,e.lockRef.current))},[]);y.useEffect(function(){return pn.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,fn),document.addEventListener("touchmove",c,fn),document.addEventListener("touchstart",d,fn),function(){pn=pn.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,fn),document.removeEventListener("touchmove",c,fn),document.removeEventListener("touchstart",d,fn)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(s,{styles:e1(o)}):null,p?y.createElement(Km,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function r1(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const o1=Om(pu,n1);var Ji=y.forwardRef(function(e,t){return y.createElement(ns,ft({},e,{ref:t,sideCar:o1}))});Ji.classNames=ns.classNames;var rs="Popover",[vu]=Rn(rs,[es]),dr=es(),[s1,Ut]=vu(rs),yu=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,a=dr(t),c=y.useRef(null),[l,d]=y.useState(!1),[f,h]=ts({prop:r,defaultProp:o??!1,onChange:s,caller:rs});return u.jsx(qi,{...a,children:u.jsx(s1,{scope:t,contentId:_n(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:y.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:l,onCustomAnchorAdd:y.useCallback(()=>d(!0),[]),onCustomAnchorRemove:y.useCallback(()=>d(!1),[]),modal:i,children:n})})};yu.displayName=rs;var Eu="PopoverAnchor",i1=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ut(Eu,n),s=dr(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return y.useEffect(()=>(i(),()=>a()),[i,a]),u.jsx(Yi,{...s,...r,ref:t})});i1.displayName=Eu;var Cu="PopoverTrigger",wu=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ut(Cu,n),s=dr(n),i=Oe(t,o.triggerRef),a=u.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Au(o.open),...r,ref:i,onClick:ae(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:u.jsx(Yi,{asChild:!0,...s,children:a})});wu.displayName=Cu;var Qi="PopoverPortal",[a1,l1]=vu(Qi,{forceMount:void 0}),xu=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=Ut(Qi,t);return u.jsx(a1,{scope:t,forceMount:n,children:u.jsx(on,{present:n||s.open,children:u.jsx(Xi,{asChild:!0,container:o,children:r})})})};xu.displayName=Qi;var Sn="PopoverContent",_u=y.forwardRef((e,t)=>{const n=l1(Sn,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=Ut(Sn,e.__scopePopover);return u.jsx(on,{present:r||s.open,children:s.modal?u.jsx(u1,{...o,ref:t}):u.jsx(d1,{...o,ref:t})})});_u.displayName=Sn;var c1=tr("PopoverContent.RemoveScroll"),u1=y.forwardRef((e,t)=>{const n=Ut(Sn,e.__scopePopover),r=y.useRef(null),o=Oe(t,r),s=y.useRef(!1);return y.useEffect(()=>{const i=r.current;if(i)return uu(i)},[]),u.jsx(Ji,{as:c1,allowPinchZoom:!0,children:u.jsx(Su,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ae(e.onCloseAutoFocus,i=>{i.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:ae(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,l=a.button===2||c;s.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:ae(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),d1=y.forwardRef((e,t)=>{const n=Ut(Sn,e.__scopePopover),r=y.useRef(!1),o=y.useRef(!1);return u.jsx(Su,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.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()}})}),Su=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:d,...f}=e,h=Ut(Sn,n),p=dr(n);return Lc(),u.jsx($i,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(Fi,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),children:u.jsx(au,{"data-state":Au(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.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)"}})})})}),Nu="PopoverClose",f1=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ut(Nu,n);return u.jsx(Re.button,{type:"button",...r,ref:t,onClick:ae(e.onClick,()=>o.onOpenChange(!1))})});f1.displayName=Nu;var p1="PopoverArrow",h1=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=dr(n);return u.jsx(lu,{...o,...r,ref:t})});h1.displayName=p1;function Au(e){return e?"open":"closed"}var g1=yu,m1=wu,b1=xu,v1=_u;function jt({...e}){return u.jsx(g1,{...e})}function zt({...e}){return u.jsx(m1,{...e})}function Vt({className:e,align:t="center",sideOffset:n=4,...r}){return u.jsx(b1,{children:u.jsx(v1,{align:t,sideOffset:n,className:ke("tiptap-popover",e),...r})})}var y1=["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] *)"],ui=y1.join(","),Tu=typeof Element>"u",nr=Tu?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ao=!Tu&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},lo=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):lo(t.parentNode));return i},E1=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},C1=function(t,n,r){if(lo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(ui));return n&&nr.call(t,ui)&&o.unshift(t),o=o.filter(r),o},di=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!lo(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),c=a.length?a:i.children,l=di(c,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var d=nr.call(i,ui);d&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),h=!lo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&h){var p=di(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},Ru=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Mu=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||E1(t))&&!Ru(t)?0:t.tabIndex},w1=function(t,n){var r=Mu(t);return r<0&&n&&!Ru(t)?0:r},x1=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},ku=function(t){return t.tagName==="INPUT"},_1=function(t){return ku(t)&&t.type==="hidden"},S1=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},N1=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},A1=function(t){if(!t.name)return!0;var n=t.form||ao(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.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=N1(o,t.form);return!s||s===t},T1=function(t){return ku(t)&&t.type==="radio"},R1=function(t){return T1(t)&&!A1(t)},M1=function(t){var n,r=t&&ao(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,a,c;for(s=!!((i=o)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(c=t.ownerDocument)!==null&&c!==void 0&&c.contains(t));!s&&o;){var l,d,f;r=ao(o),o=(l=r)===null||l===void 0?void 0:l.host,s=!!((d=o)!==null&&d!==void 0&&(f=d.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},yl=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},k1=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=nr.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(nr.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var l=t.parentElement,d=ao(t);if(l&&!l.shadowRoot&&o(l)===!0)return yl(t);t.assignedSlot?t=t.assignedSlot:!l&&d!==t.ownerDocument?t=d.host:t=l}t=c}if(M1(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return yl(t);return!1},O1=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.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 nr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},I1=function(t,n){return!(n.disabled||_1(n)||k1(n,t)||S1(n)||O1(n))},El=function(t,n){return!(R1(n)||Mu(n)<0||!I1(t,n))},L1=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ou=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,c=w1(a,i),l=i?Ou(o.candidates):a;c===0?i?n.push.apply(n,l):n.push(a):r.push({documentOrder:s,tabIndex:c,item:o,isScope:i,content:l})}),r.sort(x1).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Iu=function(t,n){n=n||{};var r;return n.getShadowRoot?r=di([t],n.includeContainer,{filter:El.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:L1}):r=C1(t,n.includeContainer,El.bind(null,n)),Ou(r)};function P1(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function D1(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function Lu(){return/apple/i.test(navigator.vendor)}function B1(){return P1().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function H1(){return D1().includes("jsdom/")}const Cl="data-floating-ui-focusable",F1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fi(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Nn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ai(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function hn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Ms(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function $1(e){return e.matches("html,body")}function mt(e){return e?.ownerDocument||document}function U1(e){return et(e)&&e.matches(F1)}function j1(e){if(!e||H1())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function z1(e){return e?e.hasAttribute(Cl)?e:e.querySelector("["+Cl+"]")||e:null}function qr(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...qr(e,o.id,n)])}function V1(e){return"nativeEvent"in e}function pi(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var K1=typeof document<"u",W1=function(){},rt=K1?x.useLayoutEffect:W1;const G1={...y};function kr(e){const t=y.useRef(e);return rt(()=>{t.current=e}),t}const Z1=G1.useInsertionEffect,q1=Z1||(e=>e());function pt(e){const t=y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return q1(()=>{t.current=e}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const Pu=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Du(e,t){const n=Iu(e,Pu()),r=n.length;if(r===0)return;const o=fi(mt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Y1(e){return Du(mt(e).body,1)||e}function X1(e){return Du(mt(e).body,-1)||e}function ks(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Nn(n,r)}function J1(e){Iu(e,Pu()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function wl(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Bu(e){const t=y.useRef(void 0),n=y.useCallback(r=>{const o=e.map(s=>{if(s!=null){if(typeof s=="function"){const i=s,a=i(r);return typeof a=="function"?a:()=>{i(null)}}return s.current=r,()=>{s.current=null}}});return()=>{o.forEach(s=>s?.())}},e);return y.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const Q1="data-floating-ui-focusable",xl="active",_l="selected",eb={...y};let Sl=!1,tb=0;const Nl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+tb++;function nb(){const[e,t]=y.useState(()=>Sl?Nl():void 0);return rt(()=>{e==null&&t(Nl())},[]),y.useEffect(()=>{Sl=!0},[]),e}const rb=eb.useId,ea=rb||nb;let hi;process.env.NODE_ENV!=="production"&&(hi=new Set);function ob(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=hi)!=null&&e.has(o))){var s;(s=hi)==null||s.add(o),console.error(o)}}function sb(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const ib=y.createContext(null),ab=y.createContext(null),ta=()=>{var e;return((e=y.useContext(ib))==null?void 0:e.id)||null},na=()=>y.useContext(ab);function fr(e){return"data-floating-ui-"+e}function Ye(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Al=fr("safe-polygon");function Os(e,t,n){if(n&&!pi(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function Is(e){return typeof e=="function"?e():e}function lb(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:a=!0,delay:c=0,handleClose:l=null,mouseOnly:d=!1,restMs:f=0,move:h=!0}=t,p=na(),m=ta(),g=kr(l),b=kr(c),v=kr(n),E=kr(f),_=y.useRef(),S=y.useRef(-1),N=y.useRef(),A=y.useRef(-1),R=y.useRef(!0),O=y.useRef(!1),D=y.useRef(()=>{}),j=y.useRef(!1),Y=pt(()=>{var H;const T=(H=o.current.openEvent)==null?void 0:H.type;return T?.includes("mouse")&&T!=="mousedown"});y.useEffect(()=>{if(!a)return;function H(T){let{open:k}=T;k||(Ye(S),Ye(A),R.current=!0,j.current=!1)}return s.on("openchange",H),()=>{s.off("openchange",H)}},[a,s]),y.useEffect(()=>{if(!a||!g.current||!n)return;function H(k){Y()&&r(!1,k,"hover")}const T=mt(i.floating).documentElement;return T.addEventListener("mouseleave",H),()=>{T.removeEventListener("mouseleave",H)}},[i.floating,n,r,a,g,Y]);const J=y.useCallback(function(H,T,k){T===void 0&&(T=!0),k===void 0&&(k="hover");const K=Os(b.current,"close",_.current);K&&!N.current?(Ye(S),S.current=window.setTimeout(()=>r(!1,H,k),K)):T&&(Ye(S),r(!1,H,k))},[b,r]),X=pt(()=>{D.current(),N.current=void 0}),I=pt(()=>{if(O.current){const H=mt(i.floating).body;H.style.pointerEvents="",H.removeAttribute(Al),O.current=!1}}),$=pt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);y.useEffect(()=>{if(!a)return;function H(Z){if(Ye(S),R.current=!1,d&&!pi(_.current)||Is(E.current)>0&&!Os(b.current,"open"))return;const ce=Os(b.current,"open",_.current);ce?S.current=window.setTimeout(()=>{v.current||r(!0,Z,"hover")},ce):n||r(!0,Z,"hover")}function T(Z){if($()){I();return}D.current();const ce=mt(i.floating);if(Ye(A),j.current=!1,g.current&&o.current.floatingContext){n||Ye(S),N.current=g.current({...o.current.floatingContext,tree:p,x:Z.clientX,y:Z.clientY,onClose(){I(),X(),$()||J(Z,!0,"safe-polygon")}});const he=N.current;ce.addEventListener("mousemove",he),D.current=()=>{ce.removeEventListener("mousemove",he)};return}(_.current!=="touch"||!Nn(i.floating,Z.relatedTarget))&&J(Z)}function k(Z){$()||o.current.floatingContext&&(g.current==null||g.current({...o.current.floatingContext,tree:p,x:Z.clientX,y:Z.clientY,onClose(){I(),X(),$()||J(Z)}})(Z))}function K(){Ye(S)}function oe(Z){$()||J(Z,!1)}if(be(i.domReference)){const Z=i.domReference,ce=i.floating;return n&&Z.addEventListener("mouseleave",k),h&&Z.addEventListener("mousemove",H,{once:!0}),Z.addEventListener("mouseenter",H),Z.addEventListener("mouseleave",T),ce&&(ce.addEventListener("mouseleave",k),ce.addEventListener("mouseenter",K),ce.addEventListener("mouseleave",oe)),()=>{n&&Z.removeEventListener("mouseleave",k),h&&Z.removeEventListener("mousemove",H),Z.removeEventListener("mouseenter",H),Z.removeEventListener("mouseleave",T),ce&&(ce.removeEventListener("mouseleave",k),ce.removeEventListener("mouseenter",K),ce.removeEventListener("mouseleave",oe))}}},[i,a,e,d,h,J,X,I,r,n,v,p,b,g,o,$,E]),rt(()=>{var H;if(a&&n&&(H=g.current)!=null&&(H=H.__options)!=null&&H.blockPointerEvents&&Y()){O.current=!0;const k=i.floating;if(be(i.domReference)&&k){var T;const K=mt(i.floating).body;K.setAttribute(Al,"");const oe=i.domReference,Z=p==null||(T=p.nodesRef.current.find(ce=>ce.id===m))==null||(T=T.context)==null?void 0:T.elements.floating;return Z&&(Z.style.pointerEvents=""),K.style.pointerEvents="none",oe.style.pointerEvents="auto",k.style.pointerEvents="auto",()=>{K.style.pointerEvents="",oe.style.pointerEvents="",k.style.pointerEvents=""}}}},[a,n,m,i,p,g,Y]),rt(()=>{n||(_.current=void 0,j.current=!1,X(),I())},[n,X,I]),y.useEffect(()=>()=>{X(),Ye(S),Ye(A),I()},[a,i.domReference,X,I]);const U=y.useMemo(()=>{function H(T){_.current=T.pointerType}return{onPointerDown:H,onPointerEnter:H,onMouseMove(T){const{nativeEvent:k}=T;function K(){!R.current&&!v.current&&r(!0,k,"hover")}d&&!pi(_.current)||n||Is(E.current)===0||j.current&&T.movementX**2+T.movementY**2<2||(Ye(A),_.current==="touch"?K():(j.current=!0,A.current=window.setTimeout(K,Is(E.current))))}}},[d,r,n,v,E]);return y.useMemo(()=>a?{reference:U}:{},[a,U])}const Tl=()=>{},cb=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Tl,setState:Tl,isInstantPhase:!1});function ub(e){const{children:t,delay:n,timeoutMs:r=0}=e,[o,s]=y.useReducer((c,l)=>({...c,...l}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),i=y.useRef(null),a=y.useCallback(c=>{s({currentId:c})},[]);return rt(()=>{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]),u.jsx(cb.Provider,{value:y.useMemo(()=>({...o,setState:s,setCurrentId:a}),[o,a]),children:t})}const db={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},Rl=y.forwardRef(function(t,n){const[r,o]=y.useState();rt(()=>{Lu()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[fr("focus-guard")]:"",style:db};return u.jsx("span",{...t,...s})}),fb={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Hu=y.createContext(null),Ml=fr("portal");function pb(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ea(),o=gb(),[s,i]=y.useState(null),a=y.useRef(null);return rt(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),rt(()=>{if(!r||a.current)return;const c=t?document.getElementById(t):null;if(!c)return;const l=document.createElement("div");l.id=r,l.setAttribute(Ml,""),c.appendChild(l),a.current=l,i(l)},[t,r]),rt(()=>{if(n===null||!r||a.current)return;let c=n||o?.portalNode;c&&!Vi(c)&&(c=c.current),c=c||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,c.appendChild(l));const d=document.createElement("div");d.id=r,d.setAttribute(Ml,""),c=l||c,c.appendChild(d),a.current=d,i(d)},[t,n,r,o]),s}function hb(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=pb({id:n,root:r}),[i,a]=y.useState(null),c=y.useRef(null),l=y.useRef(null),d=y.useRef(null),f=y.useRef(null),h=i?.modal,p=i?.open,m=!!i&&!i.modal&&i.open&&o&&!!(r||s);return y.useEffect(()=>{if(!s||!o||h)return;function g(b){s&&ks(b)&&(b.type==="focusin"?wl:J1)(s)}return s.addEventListener("focusin",g,!0),s.addEventListener("focusout",g,!0),()=>{s.removeEventListener("focusin",g,!0),s.removeEventListener("focusout",g,!0)}},[s,o,h]),y.useEffect(()=>{s&&(p||wl(s))},[p,s]),u.jsxs(Hu.Provider,{value:y.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:d,afterInsideRef:f,portalNode:s,setFocusManagerState:a}),[o,s]),children:[m&&s&&u.jsx(Rl,{"data-type":"outside",ref:c,onFocus:g=>{if(ks(g,s)){var b;(b=d.current)==null||b.focus()}else{const v=i?i.domReference:null,E=X1(v);E?.focus()}}}),m&&s&&u.jsx("span",{"aria-owns":s.id,style:fb}),s&&Pi.createPortal(t,s),m&&s&&u.jsx(Rl,{"data-type":"outside",ref:l,onFocus:g=>{if(ks(g,s)){var b;(b=f.current)==null||b.focus()}else{const v=i?i.domReference:null,E=Y1(v);E?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const gb=()=>y.useContext(Hu),mb={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},bb={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},kl=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function vb(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:l="pointerdown",referencePress:d=!1,referencePressEvent:f="pointerdown",ancestorScroll:h=!1,bubbles:p,capture:m}=t,g=na(),b=pt(typeof c=="function"?c:()=>!1),v=typeof c=="function"?b:c,E=y.useRef(!1),{escapeKey:_,outsidePress:S}=kl(p),{escapeKey:N,outsidePress:A}=kl(m),R=y.useRef(!1),O=pt(I=>{var $;if(!n||!i||!a||I.key!=="Escape"||R.current)return;const U=($=s.current.floatingContext)==null?void 0:$.nodeId,H=g?qr(g.nodesRef.current,U):[];if(!_&&(I.stopPropagation(),H.length>0)){let T=!0;if(H.forEach(k=>{var K;if((K=k.context)!=null&&K.open&&!k.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,V1(I)?I.nativeEvent:I,"escape-key")}),D=pt(I=>{var $;const U=()=>{var H;O(I),(H=hn(I))==null||H.removeEventListener("keydown",U)};($=hn(I))==null||$.addEventListener("keydown",U)}),j=pt(I=>{var $;const U=s.current.insideReactTree;s.current.insideReactTree=!1;const H=E.current;if(E.current=!1,l==="click"&&H||U||typeof v=="function"&&!v(I))return;const T=hn(I),k="["+fr("inert")+"]",K=mt(o.floating).querySelectorAll(k);let oe=be(T)?T:null;for(;oe&&!_t(oe);){const he=At(oe);if(_t(he)||!be(he))break;oe=he}if(K.length&&be(T)&&!$1(T)&&!Nn(T,o.floating)&&Array.from(K).every(he=>!Nn(oe,he)))return;if(et(T)&&X){const he=_t(T),ye=Qe(T),ue=/auto|scroll/,Ze=he||ue.test(ye.overflowX),an=he||ue.test(ye.overflowY),st=Ze&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Wt=an&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Gt=ye.direction==="rtl",it=Wt&&(Gt?I.offsetX<=T.offsetWidth-T.clientWidth:I.offsetX>T.clientWidth),Ln=st&&I.offsetY>T.clientHeight;if(it||Ln)return}const Z=($=s.current.floatingContext)==null?void 0:$.nodeId,ce=g&&qr(g.nodesRef.current,Z).some(he=>{var ye;return Ms(I,(ye=he.context)==null?void 0:ye.elements.floating)});if(Ms(I,o.floating)||Ms(I,o.domReference)||ce)return;const Ke=g?qr(g.nodesRef.current,Z):[];if(Ke.length>0){let he=!0;if(Ke.forEach(ye=>{var ue;if((ue=ye.context)!=null&&ue.open&&!ye.context.dataRef.current.__outsidePressBubbles){he=!1;return}}),!he)return}r(!1,I,"outside-press")}),Y=pt(I=>{var $;const U=()=>{var H;j(I),(H=hn(I))==null||H.removeEventListener(l,U)};($=hn(I))==null||$.addEventListener(l,U)});y.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=_,s.current.__outsidePressBubbles=S;let I=-1;function $(K){r(!1,K,"ancestor-scroll")}function U(){window.clearTimeout(I),R.current=!0}function H(){I=window.setTimeout(()=>{R.current=!1},Xo()?5:0)}const T=mt(o.floating);a&&(T.addEventListener("keydown",N?D:O,N),T.addEventListener("compositionstart",U),T.addEventListener("compositionend",H)),v&&T.addEventListener(l,A?Y:j,A);let k=[];return h&&(be(o.domReference)&&(k=Bt(o.domReference)),be(o.floating)&&(k=k.concat(Bt(o.floating))),!be(o.reference)&&o.reference&&o.reference.contextElement&&(k=k.concat(Bt(o.reference.contextElement)))),k=k.filter(K=>{var oe;return K!==((oe=T.defaultView)==null?void 0:oe.visualViewport)}),k.forEach(K=>{K.addEventListener("scroll",$,{passive:!0})}),()=>{a&&(T.removeEventListener("keydown",N?D:O,N),T.removeEventListener("compositionstart",U),T.removeEventListener("compositionend",H)),v&&T.removeEventListener(l,A?Y:j,A),k.forEach(K=>{K.removeEventListener("scroll",$)}),window.clearTimeout(I)}},[s,o,a,v,l,n,r,h,i,_,S,O,N,D,j,A,Y]),y.useEffect(()=>{s.current.insideReactTree=!1},[s,v,l]);const J=y.useMemo(()=>({onKeyDown:O,...d&&{[mb[f]]:I=>{r(!1,I.nativeEvent,"reference-press")},...f!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[O,r,d,f]),X=y.useMemo(()=>{function I($){$.button===0&&(E.current=!0)}return{onKeyDown:O,onMouseDown:I,onMouseUp:I,[bb[l]]:()=>{s.current.insideReactTree=!0}}},[O,l,s]);return y.useMemo(()=>i?{reference:J,floating:X}:{},[i,J,X])}function yb(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ea(),s=y.useRef({}),[i]=y.useState(()=>sb()),a=ta()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!be(p)&&ob("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[c,l]=y.useState(r.reference),d=pt((p,m,g)=>{s.current.openEvent=p?m:void 0,i.emit("openchange",{open:p,event:m,reason:g,nested:a}),n?.(p,m,g)}),f=y.useMemo(()=>({setPositionReference:l}),[]),h=y.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return y.useMemo(()=>({dataRef:s,open:t,onOpenChange:d,elements:h,events:i,floatingId:o,refs:f}),[t,d,h,i,o,f])}function Eb(e){e===void 0&&(e={});const{nodeId:t}=e,n=yb({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=y.useState(null),[a,c]=y.useState(null),d=o?.domReference||s,f=y.useRef(null),h=na();rt(()=>{d&&(f.current=d)},[d]);const p=Gc({...e,elements:{...o,...a&&{reference:a}}}),m=y.useCallback(_=>{const S=be(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(S),p.refs.setReference(S)},[p.refs]),g=y.useCallback(_=>{(be(_)||_===null)&&(f.current=_,i(_)),(be(p.refs.reference.current)||p.refs.reference.current===null||_!==null&&!be(_))&&p.refs.setReference(_)},[p.refs]),b=y.useMemo(()=>({...p.refs,setReference:g,setPositionReference:m,domReference:f}),[p.refs,g,m]),v=y.useMemo(()=>({...p.elements,domReference:d}),[p.elements,d]),E=y.useMemo(()=>({...p,...r,refs:b,elements:v,nodeId:t}),[p,b,v,t,r]);return rt(()=>{r.dataRef.current.floatingContext=E;const _=h?.nodesRef.current.find(S=>S.id===t);_&&(_.context=E)}),y.useMemo(()=>({...p,context:E,refs:b,elements:v}),[p,b,v,E])}function Ls(){return B1()&&Lu()}function Cb(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:a=!0,visibleOnly:c=!0}=t,l=y.useRef(!1),d=y.useRef(-1),f=y.useRef(!0);y.useEffect(()=>{if(!a)return;const p=Ve(i.domReference);function m(){!n&&et(i.domReference)&&i.domReference===fi(mt(i.domReference))&&(l.current=!0)}function g(){f.current=!0}function b(){f.current=!1}return p.addEventListener("blur",m),Ls()&&(p.addEventListener("keydown",g,!0),p.addEventListener("pointerdown",b,!0)),()=>{p.removeEventListener("blur",m),Ls()&&(p.removeEventListener("keydown",g,!0),p.removeEventListener("pointerdown",b,!0))}},[i.domReference,n,a]),y.useEffect(()=>{if(!a)return;function p(m){let{reason:g}=m;(g==="reference-press"||g==="escape-key")&&(l.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,a]),y.useEffect(()=>()=>{Ye(d)},[]);const h=y.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(p){if(l.current)return;const m=hn(p.nativeEvent);if(c&&be(m)){if(Ls()&&!p.relatedTarget){if(!f.current&&!U1(m))return}else if(!j1(m))return}r(!0,p.nativeEvent,"focus")},onBlur(p){l.current=!1;const m=p.relatedTarget,g=p.nativeEvent,b=be(m)&&m.hasAttribute(fr("focus-guard"))&&m.getAttribute("data-type")==="outside";d.current=window.setTimeout(()=>{var v;const E=fi(i.domReference?i.domReference.ownerDocument:document);!m&&E===i.domReference||Nn((v=s.current.floatingContext)==null?void 0:v.refs.floating.current,E)||Nn(i.domReference,E)||b||r(!1,g,"focus")})}}),[s,i.domReference,r,c]);return y.useMemo(()=>a?{reference:h}:{},[a,h])}function Ps(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[xl]:i,[_l]:a,...c}=e;s=c}return{...n==="floating"&&{tabIndex:-1,[Q1]:""},...s,...t.map(i=>{const a=i?i[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((i,a)=>(a&&Object.entries(a).forEach(c=>{let[l,d]=c;if(!(o&&[xl,_l].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof d=="function"){var f;(f=r.get(l))==null||f.push(d),i[l]=function(){for(var h,p=arguments.length,m=new Array(p),g=0;g<p;g++)m[g]=arguments[g];return(h=r.get(l))==null?void 0:h.map(b=>b(...m)).find(b=>b!==void 0)}}}else i[l]=d}),i),{})}}function wb(e){e===void 0&&(e=[]);const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=y.useCallback(a=>Ps(a,e,"reference"),t),s=y.useCallback(a=>Ps(a,e,"floating"),n),i=y.useCallback(a=>Ps(a,e,"item"),r);return y.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const xb=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function _b(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:a=!0,role:c="dialog"}=t,l=ea(),d=((n=s.domReference)==null?void 0:n.id)||l,f=y.useMemo(()=>{var E;return((E=z1(s.floating))==null?void 0:E.id)||i},[s.floating,i]),h=(r=xb.get(c))!=null?r:c,m=ta()!=null,g=y.useMemo(()=>h==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":h==="alertdialog"?"dialog":h,"aria-controls":o?f:void 0,...h==="listbox"&&{role:"combobox"},...h==="menu"&&{id:d},...h==="menu"&&m&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[h,f,m,o,d,c]),b=y.useMemo(()=>{const E={id:f,...h&&{role:h}};return h==="tooltip"||c==="label"?E:{...E,...h==="menu"&&{"aria-labelledby":d}}},[h,f,d,c]),v=y.useCallback(E=>{let{active:_,selected:S}=E;const N={role:"option",..._&&{id:f+"-fui-option"}};switch(c){case"select":case"combobox":return{...N,"aria-selected":S}}return{}},[f,c]);return y.useMemo(()=>a?{reference:g,floating:b,item:v}:{},[a,g,b,v])}function Sb({initialOpen:e=!1,placement:t="top",open:n,onOpenChange:r,delay:o=600,closeDelay:s=0}={}){const[i,a]=x.useState(e),c=n??i,l=r??a,d=Eb({placement:t,open:c,onOpenChange:l,whileElementsMounted:Kc,middleware:[Zc(4),Yc({crossAxis:t.includes("-"),fallbackAxisSideDirection:"start",padding:4}),qc({padding:4})]}),f=d.context,h=lb(f,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:s}}),p=Cb(f,{enabled:n==null}),m=vb(f),g=_b(f,{role:"tooltip"}),b=wb([h,p,m,g]);return x.useMemo(()=>({open:c,setOpen:l,...b,...d}),[c,l,b,d])}const gi=x.createContext(null);function Fu(){const e=x.useContext(gi);if(e==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return e}function $u({children:e,...t}){const n=Sb(t);return t.useDelayGroup?u.jsx(ub,{delay:{open:t.delay??0,close:t.closeDelay??0},timeoutMs:t.timeout,children:u.jsx(gi.Provider,{value:n,children:e})}):u.jsx(gi.Provider,{value:n,children:e})}const Uu=x.forwardRef(function({children:t,asChild:n=!1,...r},o){const s=Fu(),i=x.isValidElement(t)?parseInt(x.version,10)>=19?t.props.ref:t.ref:void 0,a=Bu([s.refs.setReference,o,i]);if(n&&x.isValidElement(t)){const c={"data-tooltip-state":s.open?"open":"closed"};return x.cloneElement(t,s.getReferenceProps({ref:a,...r,...typeof t.props=="object"?t.props:{},...c}))}return u.jsx("button",{ref:a,"data-tooltip-state":s.open?"open":"closed",type:"button",...s.getReferenceProps(r),children:t})}),ju=x.forwardRef(function({style:t,children:n,portal:r=!0,portalProps:o={},...s},i){const a=Fu(),c=Bu([a.refs.setFloating,i]);if(!a.open)return null;const l=u.jsx("div",{ref:c,style:{...a.floatingStyles,...t},...a.getFloatingProps(s),className:"tiptap-tooltip",children:n});return r?u.jsx(hb,{...o,children:l}):l});$u.displayName="Tooltip";Uu.displayName="TooltipTrigger";ju.displayName="TooltipContent";const Nb=({shortcuts:e})=>e.length===0?null:u.jsx("div",{children:e.map((t,n)=>u.jsxs(x.Fragment,{children:[n>0&&u.jsx("kbd",{children:"+"}),u.jsx("kbd",{children:t})]},n))}),V=x.forwardRef(({className:e,children:t,tooltip:n,showTooltip:r=!0,shortcutKeys:o,variant:s,size:i,type:a="button",...c},l)=>{const d=x.useMemo(()=>Di({shortcutKeys:o}),[o]);return!n||!r?u.jsx("button",{"data-slot":"tiptap-button",className:ke("tiptap-button",e),ref:l,"data-style":s,"data-size":i,type:a,...c,children:t}):u.jsxs($u,{delay:200,children:[u.jsx(Uu,{"data-slot":"tiptap-button",className:ke("tiptap-button",e),ref:l,"data-style":s,"data-size":i,...c,children:t}),u.jsxs(ju,{children:[n,u.jsx(Nb,{shortcuts:d})]})]})});V.displayName="Button";const Fe=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ke("tiptap-card",e),...t}));Fe.displayName="Card";const Ab=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ke("tiptap-card-header",e),...t}));Ab.displayName="CardHeader";const $e=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ke("tiptap-card-body",e),...t}));$e.displayName="CardBody";const Be=x.forwardRef(({className:e,orientation:t="vertical",...n},r)=>u.jsx("div",{ref:r,"data-orientation":t,className:ke("tiptap-card-item-group",e),...n}));Be.displayName="CardItemGroup";const Gn=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ke("tiptap-card-group-label",e),...t}));Gn.displayName="CardGroupLabel";const Tb=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ke("tiptap-card-footer",e),...t}));Tb.displayName="CardFooter";function Rb(e){const n=e.storage.pages;return!n||!("activeEditor"in n)?null:n.activeEditor??null}function Ue(e){const t=xh(),n=e??t,[r,o]=x.useState(null);return x.useEffect(()=>{if(!n){o(null);return}const i=()=>o(Rb(n));return i(),n.on("update",i),n.on("selectionUpdate",i),()=>{n.off("update",i),n.off("selectionUpdate",i)}},[n]),x.useEffect(()=>{if(!r)return;const i=()=>o(null);return r.on("destroy",i),()=>{r.off("destroy",i)}},[r]),ot.useEditorState({editor:r??n,selector(i){return!i.editor||i.editor.isDestroyed||!i.editor.extensionManager?{editor:null,editorState:void 0,canCommand:void 0}:{editor:i.editor,editorState:i.editor.state,canCommand:i.editor.can}}})??{editor:null}}const Mb=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),kb=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"})),zu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.createElement("path",{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z"})),Vu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),Ku=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),Wu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.createElement("path",{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H14C13.4477 21 13 20.5523 13 20V4C13 3.44772 13.4477 3 14 3H20ZM19 5H15V19H19V5ZM6 7C8.76142 7 11 9.23858 11 12C11 14.7614 8.76142 17 6 17C3.23858 17 1 14.7614 1 12C1 9.23858 3.23858 7 6 7ZM7 9H5V10.999L3 11V13L5 12.999V15H7V12.999L9 13V11L7 10.999V9Z"})),Gu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),Zu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),qu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.createElement("path",{d:"M20 13C20.5523 13 21 13.4477 21 14V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V14C3 13.4477 3.44772 13 4 13H20ZM19 15H5V19H19V15ZM12 1C14.7614 1 17 3.23858 17 6C17 8.76142 14.7614 11 12 11C9.23858 11 7 8.76142 7 6C7 3.23858 9.23858 1 12 1ZM13 3H11V4.999L9 5V7L11 6.999V9H13V6.999L15 7V5L13 4.999V3Z"})),Yu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.createElement("path",{d:"M21 3C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H21ZM7 5H4V19H7V5ZM20 5H9V19H20V5Z"})),Xu=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.createElement("path",{d:"M21 3C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H21ZM4 10V19H20V10H4ZM4 8H20V5H4V8Z"})),Ob=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),Ju=({color:e="currentColor",size:t=24,className:n,...r})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...r,className:"remixicon "+(n||"")},x.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"})),Dt=[{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"}],ra=3,Or=({textColorHex:e,backgroundColorHex:t,className:n=""})=>{const r=e??"#374151",o=t??"#ffffff",s=e??"#e5e7eb";return u.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"})},Qu="color-text-popover-recent",Ib=()=>{try{const e=localStorage.getItem(Qu);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.slice(0,ra):[]}catch{return[]}},Lb=e=>{try{localStorage.setItem(Qu,JSON.stringify(e.slice(0,ra)))}catch{}},ed=x.forwardRef(({editor:e,...t},n)=>{const{editor:r}=Ue(e),[o,s]=x.useState(Ib),i=ot.useEditorState({editor:r??null,selector:p=>{if(!p.editor)return{color:null,backgroundColor:null};const m=p.editor.getAttributes("textStyle");return{color:m.color??null,backgroundColor:m.backgroundColor??null}}}),a=i?.color??null,c=i?.backgroundColor??null,l=x.useCallback((p,m)=>{s(g=>{const b=[{textColor:p,backgroundColor:m},...g.filter(v=>!(v.textColor===p&&v.backgroundColor===m))].slice(0,ra);return Lb(b),b})},[]),d=x.useCallback(p=>{if(!r)return;p===null?r.chain().focus().unsetColor().run():r.chain().focus().setColor(p).run();const m=r.getAttributes("textStyle").backgroundColor??null;l(p,m)},[r,l]),f=x.useCallback(p=>{if(!r)return;p===null?r.chain().focus().unsetBackgroundColor().run():r.chain().focus().setBackgroundColor(p).run();const m=r.getAttributes("textStyle").color??null;l(m,p)},[r,l]),h=x.useCallback(p=>{r&&(p.textColor!==null?r.chain().focus().setColor(p.textColor).run():r.chain().focus().unsetColor().run(),p.backgroundColor!==null?r.chain().focus().setBackgroundColor(p.backgroundColor).run():r.chain().focus().unsetBackgroundColor().run(),l(p.textColor,p.backgroundColor))},[r,l]);return u.jsxs(jt,{children:[u.jsx(zt,{asChild:!0,children:u.jsxs(V,{ref:n,"data-style":"ghost",role:"button",tooltip:"글자 색상",...t,children:[u.jsx(Or,{textColorHex:a,backgroundColorHex:c,className:"tiptap-color-trigger-icon"}),u.jsx(Mb,{className:"tiptap-color-trigger-chevron","aria-hidden":!0})]})}),u.jsx(Vt,{align:"start",children:u.jsx(Fe,{children:u.jsxs($e,{children:[u.jsx(Gn,{children:"Recently Used"}),u.jsx(Be,{orientation:"horizontal",children:o.map((p,m)=>u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>h(p),"aria-label":`Apply recent color combination ${m+1}`,className:"tiptap-color-recent-button",children:u.jsx(Or,{textColorHex:p.textColor,backgroundColorHex:p.backgroundColor})},`${p.textColor??""}-${p.backgroundColor??""}-${m}`))}),u.jsx(Gn,{children:"Text Color"}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(0,5).map((p,m)=>{const g=m===0,b=g?null:p.contrastColor,v=a===b||g&&a===null;return u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>d(b),"aria-label":`Text color: ${p.name}`,"aria-pressed":v,className:"tiptap-color-text-button",children:u.jsx(Or,{textColorHex:b,backgroundColorHex:"#ffffff"})},p.name)})}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(5,10).map(p=>{const m=p.contrastColor,g=a===m;return u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>d(m),"aria-label":`Text color: ${p.name}`,"aria-pressed":g,className:"tiptap-color-text-button",children:u.jsx(Or,{textColorHex:m,backgroundColorHex:"#ffffff"})},p.name)})}),u.jsx(Gn,{children:"Highlight Color"}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(0,5).map((p,m)=>{const g=m===0,b=g?null:p.color,v=c===b||g&&c===null;return u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>f(b),"aria-label":`Highlight color: ${p.name}`,"aria-pressed":v,className:"tiptap-color-highlight-button",children:u.jsx("span",{style:{display:"inline-block",width:"1.5rem",height:"1.5rem",borderRadius:"50%",backgroundColor:b??"#ffffff",border:`1px solid ${b?p.contrastColor:"#e5e7eb"}`},"aria-hidden":!0})},p.name)})}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(5,10).map(p=>{const m=p.color,g=c===m;return u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>f(m),"aria-label":`Highlight color: ${p.name}`,"aria-pressed":g,className:"tiptap-color-highlight-button",children:u.jsx("span",{style:{display:"inline-block",width:"1.5rem",height:"1.5rem",borderRadius:"50%",backgroundColor:m??"#ffffff",border:`1px solid ${m?p.contrastColor:"#e5e7eb"}`},"aria-hidden":!0})},p.name)})})]})})})]})});ed.displayName="ColorTextPopover";const td=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"})]}));td.displayName="HeadingOneIcon";const nd=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"})]}));nd.displayName="HeadingTwoIcon";const rd=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));rd.displayName="HeadingThreeIcon";const Yr=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M12 6V21H10V16C6.68629 16 4 13.3137 4 10C4 6.68629 6.68629 4 10 4H20V6H17V21H15V6H12ZM10 6C7.79086 6 6 7.79086 6 10C6 12.2091 7.79086 14 10 14V6Z"})}));Yr.displayName="ParagraphIcon";const Pb=["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"],$t={heading1:{value:"heading1",label:"제목 1",nodeType:"heading",attrs:{level:1},Icon:td},heading2:{value:"heading2",label:"제목 2",nodeType:"heading",attrs:{level:2},Icon:nd},heading3:{value:"heading3",label:"제목 3",nodeType:"heading",attrs:{level:3},Icon:rd},paragraphLarge:{value:"paragraphLarge",label:"본문 큼",nodeType:"paragraph",attrs:{size:"large"},Icon:Yr},paragraphNormal:{value:"paragraphNormal",label:"본문 보통",nodeType:"paragraph",attrs:{size:"normal"},Icon:Yr},paragraphSmall:{value:"paragraphSmall",label:"본문 작음",nodeType:"paragraph",attrs:{size:"small"},Icon:Yr}},co=Object.keys($t);function Db(e){const{nodeType:t,attrs:n}=$t[e];if(t==="heading"){const{level:o}=n;return{Tag:`h${o}`,attrs:{}}}const{size:r}=n;return{Tag:"p",attrs:{"data-size":r}}}function os(e,t){if(!e||!e.isEditable)return!1;const{nodeType:n,attrs:r}=$t[t];return e.isActive(n,r)}function ss(e,t){if(!e||!e.isEditable)return!1;const{nodeType:n,attrs:r}=$t[t];return!Ah(n,e)||Ko(e,["image"])||!Th(e,Pb)?!1:os(e,t)?!0:e.can().setNode(n,r)}function Bb(e,t){if(!e||!ss(e,t))return!1;if(os(e,t))return!0;const{nodeType:n,attrs:r}=$t[t];return e.chain().focus().setNode(n,r).run()}function od(e){const{editor:t,hideWhenUnavailable:n}=e;return t?n?t.isEditable?t.isActive("code")?!0:co.some(r=>ss(t,r)):!1:!0:!1}function Hb(e){const{editor:t,value:n,hideWhenUnavailable:r=!1,onApplied:o}=e,{editor:s}=Ue(t),[i,a]=x.useState(!0),c=ss(s,n),l=os(s,n);x.useEffect(()=>{if(!s)return;const h=()=>{a(od({editor:s,hideWhenUnavailable:r}))};return h(),s.on("selectionUpdate",h),()=>{s.off("selectionUpdate",h)}},[s,r]);const d=x.useCallback(()=>{if(!s)return!1;const h=Bb(s,n);return h&&o?.(),h},[s,n,o]),f=$t[n];return{isVisible:i,isActive:l,canApply:c,handleApply:d,label:f.label,Icon:f.Icon}}const sd=x.forwardRef(({editor:e,value:t,text:n,hideWhenUnavailable:r=!1,onApplied:o,onClick:s,children:i,...a},c)=>{const{editor:l}=Ue(e),{isVisible:d,canApply:f,isActive:h,handleApply:p,label:m}=Hb({editor:l,value:t,hideWhenUnavailable:r,onApplied:o}),g=x.useCallback(E=>{s?.(E),!E.defaultPrevented&&p()},[p,s]);if(!d)return null;const{Tag:b,attrs:v}=Db(t);return u.jsx(V,{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:g,...a,ref:c,children:i??u.jsx(b,{...v,className:"tiptap-button-text",children:n??m})})});sd.displayName="TextStyleButton";const pr=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.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"})}));pr.displayName="ChevronDownIcon";const Fb="paragraphNormal";function $b(e,t=co){if(!(!e||!e.isEditable))return t.find(n=>os(e,n))}function Ub(e){const{editor:t,hideWhenUnavailable:n=!1}=e||{},{editor:r}=Ue(t),[o,s]=x.useState(!0),i=$b(r)??Fb,a=$t[i],c=co.some(l=>ss(r,l));return x.useEffect(()=>{if(!r)return;const l=()=>{s(od({editor:r,hideWhenUnavailable:n}))};return l(),r.on("selectionUpdate",l),()=>{r.off("selectionUpdate",l)}},[r,n]),{isVisible:o,activeValue:i,canApply:c,label:a.label,Icon:a.Icon,options:co.map(l=>$t[l])}}const Ol=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Il=Rc,jb=(e,t)=>n=>{var r;if(t?.variants==null)return Il(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(l=>{const d=n?.[l],f=s?.[l];if(d===null)return null;const h=Ol(d)||Ol(f);return o[l][h]}),a=n&&Object.entries(n).reduce((l,d)=>{let[f,h]=d;return h===void 0||(l[f]=h),l},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,b]=m;return Array.isArray(b)?b.includes({...s,...a}[g]):{...s,...a}[g]===b})?[...l,f,h]:l},[]);return Il(e,i,c,n?.class,n?.className)},zb=jb("tiptap-button-group",{variants:{orientation:{horizontal:"tiptap-button-group-horizontal",vertical:"tiptap-button-group-vertical"}},defaultVariants:{orientation:"horizontal"}});function Qt({className:e,orientation:t,...n}){return u.jsx("div",{role:"group","data-slot":"tiptap-button-group","data-orientation":t,className:ke(zb({orientation:t}),e),...n})}function id(e){const t=e+"CollectionProvider",[n,r]=Rn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:b,children:v}=g,E=x.useRef(null),_=x.useRef(new Map).current;return u.jsx(o,{scope:b,itemMap:_,collectionRef:E,children:v})};i.displayName=t;const a=e+"CollectionSlot",c=tr(a),l=x.forwardRef((g,b)=>{const{scope:v,children:E}=g,_=s(a,v),S=Oe(b,_.collectionRef);return u.jsx(c,{ref:S,children:E})});l.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=tr(d),p=x.forwardRef((g,b)=>{const{scope:v,children:E,..._}=g,S=x.useRef(null),N=Oe(b,S),A=s(d,v);return x.useEffect(()=>(A.itemMap.set(S,{ref:S,..._}),()=>{A.itemMap.delete(S)})),u.jsx(h,{[f]:"",ref:N,children:E})});p.displayName=d;function m(g){const b=s(e+"CollectionConsumer",g);return x.useCallback(()=>{const E=b.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${f}]`));return Array.from(b.itemMap.values()).sort((A,R)=>_.indexOf(A.ref.current)-_.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:l,ItemSlot:p},m,r]}var Vb=y.createContext(void 0);function ad(e){const t=y.useContext(Vb);return e||t||"ltr"}var Ds="rovingFocusGroup.onEntryFocus",Kb={bubbles:!1,cancelable:!0},hr="RovingFocusGroup",[mi,ld,Wb]=id(hr),[Gb,cd]=Rn(hr,[Wb]),[Zb,qb]=Gb(hr),ud=y.forwardRef((e,t)=>u.jsx(mi.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(mi.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Yb,{...e,ref:t})})}));ud.displayName=hr;var Yb=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,h=y.useRef(null),p=Oe(t,h),m=ad(s),[g,b]=ts({prop:i,defaultProp:a??null,onChange:c,caller:hr}),[v,E]=y.useState(!1),_=vt(l),S=ld(n),N=y.useRef(!1),[A,R]=y.useState(0);return y.useEffect(()=>{const O=h.current;if(O)return O.addEventListener(Ds,_),()=>O.removeEventListener(Ds,_)},[_]),u.jsx(Zb,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:g,onItemFocus:y.useCallback(O=>b(O),[b]),onItemShiftTab:y.useCallback(()=>E(!0),[]),onFocusableItemAdd:y.useCallback(()=>R(O=>O+1),[]),onFocusableItemRemove:y.useCallback(()=>R(O=>O-1),[]),children:u.jsx(Re.div,{tabIndex:v||A===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ae(e.onMouseDown,()=>{N.current=!0}),onFocus:ae(e.onFocus,O=>{const D=!N.current;if(O.target===O.currentTarget&&D&&!v){const j=new CustomEvent(Ds,Kb);if(O.currentTarget.dispatchEvent(j),!j.defaultPrevented){const Y=S().filter(U=>U.focusable),J=Y.find(U=>U.active),X=Y.find(U=>U.id===g),$=[J,X,...Y].filter(Boolean).map(U=>U.ref.current);pd($,d)}}N.current=!1}),onBlur:ae(e.onBlur,()=>E(!1))})})}),dd="RovingFocusGroupItem",fd=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=_n(),l=s||c,d=qb(dd,n),f=d.currentTabStopId===l,h=ld(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:g}=d;return y.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),u.jsx(mi.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:u.jsx(Re.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ae(e.onMouseDown,b=>{r?d.onItemFocus(l):b.preventDefault()}),onFocus:ae(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:ae(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){d.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=Qb(b,d.orientation,d.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let _=h().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")_.reverse();else if(v==="prev"||v==="next"){v==="prev"&&_.reverse();const S=_.indexOf(b.currentTarget);_=d.loop?e0(_,S+1):_.slice(S+1)}setTimeout(()=>pd(_))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:g!=null}):i})})});fd.displayName=dd;var Xb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Jb(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Qb(e,t,n){const r=Jb(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Xb[r]}function pd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function e0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var t0=ud,n0=fd,bi=["Enter"," "],r0=["ArrowDown","PageUp","Home"],hd=["ArrowUp","PageDown","End"],o0=[...r0,...hd],s0={ltr:[...bi,"ArrowRight"],rtl:[...bi,"ArrowLeft"]},i0={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gr="Menu",[rr,a0,l0]=id(gr),[sn,gd]=Rn(gr,[l0,es,cd]),mr=es(),md=cd(),[bd,Kt]=sn(gr),[c0,br]=sn(gr),vd=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=mr(t),[c,l]=y.useState(null),d=y.useRef(!1),f=vt(s),h=ad(o);return y.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),u.jsx(qi,{...a,children:u.jsx(bd,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:l,children:u.jsx(c0,{scope:t,onClose:y.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:i,children:r})})})};vd.displayName=gr;var u0="MenuAnchor",oa=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=mr(n);return u.jsx(Yi,{...o,...r,ref:t})});oa.displayName=u0;var sa="MenuPortal",[d0,yd]=sn(sa,{forceMount:void 0}),Ed=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Kt(sa,t);return u.jsx(d0,{scope:t,forceMount:n,children:u.jsx(on,{present:n||s.open,children:u.jsx(Xi,{asChild:!0,container:o,children:r})})})};Ed.displayName=sa;var Je="MenuContent",[f0,ia]=sn(Je),Cd=y.forwardRef((e,t)=>{const n=yd(Je,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Kt(Je,e.__scopeMenu),i=br(Je,e.__scopeMenu);return u.jsx(rr.Provider,{scope:e.__scopeMenu,children:u.jsx(on,{present:r||s.open,children:u.jsx(rr.Slot,{scope:e.__scopeMenu,children:i.modal?u.jsx(p0,{...o,ref:t}):u.jsx(h0,{...o,ref:t})})})})}),p0=y.forwardRef((e,t)=>{const n=Kt(Je,e.__scopeMenu),r=y.useRef(null),o=Oe(t,r);return y.useEffect(()=>{const s=r.current;if(s)return uu(s)},[]),u.jsx(aa,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ae(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),h0=y.forwardRef((e,t)=>{const n=Kt(Je,e.__scopeMenu);return u.jsx(aa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),g0=tr("MenuContent.ScrollLock"),aa=y.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...g}=e,b=Kt(Je,n),v=br(Je,n),E=mr(n),_=md(n),S=a0(n),[N,A]=y.useState(null),R=y.useRef(null),O=Oe(t,R,b.onContentChange),D=y.useRef(0),j=y.useRef(""),Y=y.useRef(0),J=y.useRef(null),X=y.useRef("right"),I=y.useRef(0),$=m?Ji:y.Fragment,U=m?{as:g0,allowPinchZoom:!0}:void 0,H=k=>{const K=j.current+k,oe=S().filter(ue=>!ue.disabled),Z=document.activeElement,ce=oe.find(ue=>ue.ref.current===Z)?.textValue,Ke=oe.map(ue=>ue.textValue),he=A0(Ke,K,ce),ye=oe.find(ue=>ue.textValue===he)?.ref.current;(function ue(Ze){j.current=Ze,window.clearTimeout(D.current),Ze!==""&&(D.current=window.setTimeout(()=>ue(""),1e3))})(K),ye&&setTimeout(()=>ye.focus())};y.useEffect(()=>()=>window.clearTimeout(D.current),[]),Lc();const T=y.useCallback(k=>X.current===J.current?.side&&R0(k,J.current?.area),[]);return u.jsx(f0,{scope:n,searchRef:j,onItemEnter:y.useCallback(k=>{T(k)&&k.preventDefault()},[T]),onItemLeave:y.useCallback(k=>{T(k)||(R.current?.focus(),A(null))},[T]),onTriggerLeave:y.useCallback(k=>{T(k)&&k.preventDefault()},[T]),pointerGraceTimerRef:Y,onPointerGraceIntentChange:y.useCallback(k=>{J.current=k},[]),children:u.jsx($,{...U,children:u.jsx($i,{asChild:!0,trapped:o,onMountAutoFocus:ae(s,k=>{k.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:u.jsx(Fi,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:u.jsx(t0,{asChild:!0,..._,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:A,onEntryFocus:ae(c,k=>{v.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(au,{role:"menu","aria-orientation":"vertical","data-state":Hd(b.open),"data-radix-menu-content":"",dir:v.dir,...E,...g,ref:O,style:{outline:"none",...g.style},onKeyDown:ae(g.onKeyDown,k=>{const oe=k.target.closest("[data-radix-menu-content]")===k.currentTarget,Z=k.ctrlKey||k.altKey||k.metaKey,ce=k.key.length===1;oe&&(k.key==="Tab"&&k.preventDefault(),!Z&&ce&&H(k.key));const Ke=R.current;if(k.target!==Ke||!o0.includes(k.key))return;k.preventDefault();const ye=S().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);hd.includes(k.key)&&ye.reverse(),S0(ye)}),onBlur:ae(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(D.current),j.current="")}),onPointerMove:ae(e.onPointerMove,or(k=>{const K=k.target,oe=I.current!==k.clientX;if(k.currentTarget.contains(K)&&oe){const Z=k.clientX>I.current?"right":"left";X.current=Z,I.current=k.clientX}}))})})})})})})});Cd.displayName=Je;var m0="MenuGroup",la=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Re.div,{role:"group",...r,ref:t})});la.displayName=m0;var b0="MenuLabel",wd=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Re.div,{...r,ref:t})});wd.displayName=b0;var uo="MenuItem",Ll="menu.itemSelect",is=y.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=y.useRef(null),i=br(uo,e.__scopeMenu),a=ia(uo,e.__scopeMenu),c=Oe(t,s),l=y.useRef(!1),d=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(Ll,{bubbles:!0,cancelable:!0});f.addEventListener(Ll,p=>r?.(p),{once:!0}),kc(f,h),h.defaultPrevented?l.current=!1:i.onClose()}};return u.jsx(xd,{...o,ref:c,disabled:n,onClick:ae(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),l.current=!0},onPointerUp:ae(e.onPointerUp,f=>{l.current||f.currentTarget?.click()}),onKeyDown:ae(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||bi.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});is.displayName=uo;var xd=y.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=ia(uo,n),a=md(n),c=y.useRef(null),l=Oe(t,c),[d,f]=y.useState(!1),[h,p]=y.useState("");return y.useEffect(()=>{const m=c.current;m&&p((m.textContent??"").trim())},[s.children]),u.jsx(rr.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:u.jsx(n0,{asChild:!0,...a,focusable:!r,children:u.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:l,onPointerMove:ae(e.onPointerMove,or(m=>{r?i.onItemLeave(m):(i.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ae(e.onPointerLeave,or(m=>i.onItemLeave(m))),onFocus:ae(e.onFocus,()=>f(!0)),onBlur:ae(e.onBlur,()=>f(!1))})})})}),v0="MenuCheckboxItem",_d=y.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return u.jsx(Rd,{scope:e.__scopeMenu,checked:n,children:u.jsx(is,{role:"menuitemcheckbox","aria-checked":fo(n)?"mixed":n,...o,ref:t,"data-state":da(n),onSelect:ae(o.onSelect,()=>r?.(fo(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_d.displayName=v0;var Sd="MenuRadioGroup",[y0,E0]=sn(Sd,{value:void 0,onValueChange:()=>{}}),Nd=y.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=vt(r);return u.jsx(y0,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(la,{...o,ref:t})})});Nd.displayName=Sd;var Ad="MenuRadioItem",Td=y.forwardRef((e,t)=>{const{value:n,...r}=e,o=E0(Ad,e.__scopeMenu),s=n===o.value;return u.jsx(Rd,{scope:e.__scopeMenu,checked:s,children:u.jsx(is,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":da(s),onSelect:ae(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Td.displayName=Ad;var ca="MenuItemIndicator",[Rd,C0]=sn(ca,{checked:!1}),Md=y.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=C0(ca,n);return u.jsx(on,{present:r||fo(s.checked)||s.checked===!0,children:u.jsx(Re.span,{...o,ref:t,"data-state":da(s.checked)})})});Md.displayName=ca;var w0="MenuSeparator",kd=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});kd.displayName=w0;var x0="MenuArrow",Od=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=mr(n);return u.jsx(lu,{...o,...r,ref:t})});Od.displayName=x0;var ua="MenuSub",[_0,Id]=sn(ua),Ld=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:o}=e,s=Kt(ua,t),i=mr(t),[a,c]=y.useState(null),[l,d]=y.useState(null),f=vt(o);return y.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),u.jsx(qi,{...i,children:u.jsx(bd,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:d,children:u.jsx(_0,{scope:t,contentId:_n(),triggerId:_n(),trigger:a,onTriggerChange:c,children:n})})})};Ld.displayName=ua;var Hn="MenuSubTrigger",Pd=y.forwardRef((e,t)=>{const n=Kt(Hn,e.__scopeMenu),r=br(Hn,e.__scopeMenu),o=Id(Hn,e.__scopeMenu),s=ia(Hn,e.__scopeMenu),i=y.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},d=y.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return y.useEffect(()=>d,[d]),y.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),u.jsx(oa,{asChild:!0,...l,children:u.jsx(xd,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Hd(n.open),...e,ref:Zo(t,o.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ae(e.onPointerMove,or(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:ae(e.onPointerLeave,or(f=>{d();const h=n.content?.getBoundingClientRect();if(h){const p=n.content?.dataset.side,m=p==="right",g=m?-5:5,b=h[m?"left":"right"],v=h[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+g,y:f.clientY},{x:b,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:b,y:h.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ae(e.onKeyDown,f=>{const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||s0[r.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});Pd.displayName=Hn;var Dd="MenuSubContent",Bd=y.forwardRef((e,t)=>{const n=yd(Je,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Kt(Je,e.__scopeMenu),i=br(Je,e.__scopeMenu),a=Id(Dd,e.__scopeMenu),c=y.useRef(null),l=Oe(t,c);return u.jsx(rr.Provider,{scope:e.__scopeMenu,children:u.jsx(on,{present:r||s.open,children:u.jsx(rr.Slot,{scope:e.__scopeMenu,children:u.jsx(aa,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:l,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{i.isUsingKeyboardRef.current&&c.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ae(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ae(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ae(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),h=i0[i.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),a.trigger?.focus(),d.preventDefault())})})})})})});Bd.displayName=Dd;function Hd(e){return e?"open":"closed"}function fo(e){return e==="indeterminate"}function da(e){return fo(e)?"indeterminate":e?"checked":"unchecked"}function S0(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function N0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function A0(e,t,n){const o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=N0(e,Math.max(s,0));o.length===1&&(i=i.filter(l=>l!==n));const c=i.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function T0(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],l=a.x,d=a.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-l)*(r-d)/(h-d)+l&&(o=!o)}return o}function R0(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return T0(n,t)}function or(e){return t=>t.pointerType==="mouse"?e(t):void 0}var M0=vd,k0=oa,O0=Ed,I0=Cd,L0=la,P0=wd,D0=is,B0=_d,H0=Nd,F0=Td,$0=Md,U0=kd,j0=Od,z0=Ld,V0=Pd,K0=Bd,as="DropdownMenu",[W0]=Rn(as,[gd]),Ie=gd(),[G0,Fd]=W0(as),$d=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Ie(t),l=y.useRef(null),[d,f]=ts({prop:o,defaultProp:s??!1,onChange:i,caller:as});return u.jsx(G0,{scope:t,triggerId:_n(),triggerRef:l,contentId:_n(),open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),modal:a,children:u.jsx(M0,{...c,open:d,onOpenChange:f,dir:r,modal:a,children:n})})};$d.displayName=as;var Ud="DropdownMenuTrigger",jd=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=Fd(Ud,n),i=Ie(n);return u.jsx(k0,{asChild:!0,...i,children:u.jsx(Re.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:Zo(t,s.triggerRef),onPointerDown:ae(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ae(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});jd.displayName=Ud;var Z0="DropdownMenuPortal",zd=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ie(t);return u.jsx(O0,{...r,...n})};zd.displayName=Z0;var Vd="DropdownMenuContent",Kd=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Fd(Vd,n),s=Ie(n),i=y.useRef(!1);return u.jsx(I0,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:ae(e.onCloseAutoFocus,a=>{i.current||o.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ae(e.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,d=c.button===2||l;(!o.modal||d)&&(i.current=!0)}),style:{...e.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)"}})});Kd.displayName=Vd;var q0="DropdownMenuGroup",Y0=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(L0,{...o,...r,ref:t})});Y0.displayName=q0;var X0="DropdownMenuLabel",J0=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(P0,{...o,...r,ref:t})});J0.displayName=X0;var Q0="DropdownMenuItem",Wd=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(D0,{...o,...r,ref:t})});Wd.displayName=Q0;var ev="DropdownMenuCheckboxItem",tv=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(B0,{...o,...r,ref:t})});tv.displayName=ev;var nv="DropdownMenuRadioGroup",rv=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(H0,{...o,...r,ref:t})});rv.displayName=nv;var ov="DropdownMenuRadioItem",sv=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(F0,{...o,...r,ref:t})});sv.displayName=ov;var iv="DropdownMenuItemIndicator",av=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx($0,{...o,...r,ref:t})});av.displayName=iv;var lv="DropdownMenuSeparator",cv=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(U0,{...o,...r,ref:t})});cv.displayName=lv;var uv="DropdownMenuArrow",dv=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(j0,{...o,...r,ref:t})});dv.displayName=uv;var fv=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:o,defaultOpen:s}=e,i=Ie(t),[a,c]=ts({prop:r,defaultProp:s??!1,onChange:o,caller:"DropdownMenuSub"});return u.jsx(z0,{...i,open:a,onOpenChange:c,children:n})},pv="DropdownMenuSubTrigger",Gd=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(V0,{...o,...r,ref:t})});Gd.displayName=pv;var hv="DropdownMenuSubContent",Zd=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ie(n);return u.jsx(K0,{...o,...r,ref:t,style:{...e.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)"}})});Zd.displayName=hv;var gv=$d,qd=jd,mv=zd,Yd=Kd,bv=Wd,vv=fv,yv=Gd,Xd=Zd;function vr({...e}){return u.jsx(gv,{modal:!1,...e})}function Jd({...e}){return u.jsx(mv,{...e})}const On=x.forwardRef(({...e},t)=>u.jsx(qd,{ref:t,...e}));On.displayName=qd.displayName;const Ev=vv,je=bv,Cv=yv,Qd=x.forwardRef(({className:e,portal:t=!0,...n},r)=>{const o=u.jsx(Xd,{ref:r,className:ke("tiptap-dropdown-menu",e),...n});return t?u.jsx(Jd,{...typeof t=="object"?t:{},children:o}):o});Qd.displayName=Xd.displayName;const In=x.forwardRef(({className:e,sideOffset:t=4,portal:n=!1,...r},o)=>{const s=u.jsx(Yd,{ref:o,sideOffset:t,onCloseAutoFocus:i=>i.preventDefault(),className:ke("tiptap-dropdown-menu",e),...r});return n?u.jsx(Jd,{...typeof n=="object"?n:{},children:s}):s});In.displayName=Yd.displayName;const ef=x.forwardRef(({editor:e,hideWhenUnavailable:t=!1,portal:n=!1,onOpenChange:r,children:o,...s},i)=>{const{editor:a}=Ue(e),[c,l]=x.useState(!1),{isVisible:d,canApply:f,label:h,Icon:p,options:m}=Ub({editor:a,hideWhenUnavailable:t}),g=x.useCallback(b=>{!a||!f||(l(b),r?.(b))},[f,a,r]);return d?u.jsxs(vr,{modal:!0,open:c,onOpenChange:g,children:[u.jsx(On,{asChild:!0,children:u.jsx(V,{type:"button",variant:"ghost",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":h,tooltip:"문단 모양",...s,ref:i,children:o||u.jsxs(u.Fragment,{children:[u.jsx(p,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:h}),u.jsx(pr,{className:"tiptap-button-dropdown-small"})]})})}),u.jsx(In,{align:"start",portal:n,children:u.jsx(Fe,{className:"tiptap",children:u.jsx($e,{children:u.jsx(Qt,{children:m.map(b=>u.jsx(je,{asChild:!0,children:u.jsx(sd,{editor:a,value:b.value,text:b.label,showTooltip:!1})},b.value))})})})})]}):null});ef.displayName="TextStyleDropdownMenu";const wv=[10,11,12,13,14,16,18,20,24,28,36],tf=x.forwardRef(({editor:e,portal:t=!1,onOpenChange:n,children:r,...o},s)=>{const{editor:i}=Ue(e),[a,c]=x.useState(!1),l=ot.useEditorState({editor:i,selector:({editor:m})=>m?m.getAttributes("textStyle").fontSize??null:null}),d=!!i,f=x.useCallback(m=>{d&&(c(m),n?.(m))},[d,n]),h=x.useCallback(()=>{i?.chain().focus().unsetFontSize().run()},[i]),p=x.useCallback(m=>{i&&(l===m?i.chain().focus().unsetFontSize().run():i.chain().focus().setFontSize(String(m)).run())},[i,l]);return i?u.jsxs(vr,{modal:!0,open:a,onOpenChange:f,children:[u.jsx(On,{asChild:!0,children:u.jsx(V,{type:"button",variant:"ghost",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":"글자 크기",tooltip:"글자 크기",...o,ref:s,children:r??u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"tiptap-button-text",children:l??"-"}),u.jsx(pr,{className:"tiptap-button-dropdown-small"})]})})}),u.jsx(In,{align:"start",portal:t,children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsxs(Qt,{children:[u.jsx(je,{asChild:!0,onSelect:h,children:u.jsx(V,{type:"button",variant:"ghost","data-active-state":l===null?"on":"off","aria-pressed":l===null,children:u.jsx("span",{className:"tiptap-button-text",children:"기본값"})})}),wv.map(m=>u.jsx(je,{asChild:!0,onSelect:()=>p(m),children:u.jsx(V,{type:"button",variant:"ghost","data-active-state":l===m?"on":"off","aria-pressed":l===m,children:u.jsx("span",{className:"tiptap-button-text",children:m})})},m))]})})})})]}):null});tf.displayName="FontSizeDropdownMenu";const fa=x.forwardRef(({variant:e,size:t="default",appearance:n="default",trimText:r=!1,className:o,children:s,...i},a)=>u.jsx("div",{ref:a,className:`tiptap-badge ${o||""}`,"data-style":e,"data-size":t,"data-appearance":n,"data-text-trim":r?"on":"off",...i,children:s}));fa.displayName="Badge";function xv({align:e,shortcutKeys:t=sf[e]}){return u.jsx(fa,{children:Di({shortcutKeys:t})})}const Fn=x.forwardRef(({editor:e,align:t,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:s=!1,onClick:i,icon:a,children:c,...l},d)=>{const{editor:f}=Ue(e),{isVisible:h,handleTextAlign:p,label:m,canAlign:g,isActive:b,Icon:v,shortcutKeys:E}=Mv({editor:f,align:t,hideWhenUnavailable:r,onAligned:o}),_=x.useCallback(N=>{i?.(N),!N.defaultPrevented&&p()},[p,i]);if(!h)return null;const S=a??v;return u.jsx(V,{type:"button",disabled:!g,variant:"ghost","data-active-state":b?"on":"off","data-disabled":!g,role:"button",tabIndex:-1,"aria-label":m,"aria-pressed":b,tooltip:m,onClick:_,...l,ref:d,children:c??u.jsxs(u.Fragment,{children:[u.jsx(S,{className:"tiptap-button-icon"}),n&&u.jsx("span",{className:"tiptap-button-text",children:n}),s&&u.jsx(xv,{align:t,shortcutKeys:E})]})})});Fn.displayName="TextAlignButton";const nf=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));nf.displayName="AlignCenterIcon";const ls=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));ls.displayName="AlignJustifyIcon";const rf=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));rf.displayName="AlignLeftIcon";const of=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));of.displayName="AlignRightIcon";const sf={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},_v={left:rf,center:nf,right:of,justify:ls},Sv={left:"왼쪽 정렬",center:"중앙 정렬",right:"오른쪽 정렬",justify:"양쪽 정렬"};function pa(e,t){return!e||!e.isEditable||!Mc(e,"textAlign")||Ko(e,["image","horizontalRule"])?!1:e.can().setTextAlign(t)}function Nv(e){return"setTextAlign"in e}function Av(e,t){return!e||!e.isEditable?!1:e.isActive({textAlign:t})}function Tv(e,t){if(!e||!e.isEditable||!pa(e,t))return!1;const n=e.chain().focus();return Nv(n)?n.setTextAlign(t).run():!1}function Rv(e){const{editor:t,hideWhenUnavailable:n,align:r}=e;return t?n?!t.isEditable||!Mc(t,"textAlign")?!1:t.isActive("code")?!0:pa(t,r):!0:!1}function Mv(e){const{editor:t,align:n,hideWhenUnavailable:r=!1,onAligned:o}=e,{editor:s}=Ue(t),[i,a]=x.useState(!0),c=pa(s,n),l=Av(s,n);x.useEffect(()=>{if(!s)return;const f=()=>{a(Rv({editor:s,align:n,hideWhenUnavailable:r}))};return f(),s.on("selectionUpdate",f),()=>{s.off("selectionUpdate",f)}},[s,r,n]);const d=x.useCallback(()=>{if(!s)return!1;const f=Tv(s,n);return f&&o?.(),f},[s,n,o]);return{isVisible:i,isActive:l,handleTextAlign:d,canAlign:c,label:Sv[n],shortcutKeys:sf[n],Icon:_v[n]}}function kv({type:e,shortcutKeys:t=hf[e]}){return u.jsx(fa,{children:Di({shortcutKeys:t})})}const It=x.forwardRef(({editor:e,type:t,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:s=!1,onClick:i,children:a,...c},l)=>{const{editor:d}=Ue(e),{isVisible:f,handleMark:h,label:p,canToggle:m,isActive:g,Icon:b,shortcutKeys:v}=Bv({editor:d,type:t,hideWhenUnavailable:r,onToggled:o}),E=x.useCallback(_=>{i?.(_),!_.defaultPrevented&&h()},[h,i]);return f?u.jsx(V,{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:E,...c,ref:l,children:a??u.jsxs(u.Fragment,{children:[u.jsx(b,{className:"tiptap-button-icon"}),n&&u.jsx("span",{className:"tiptap-button-text",children:n}),s&&u.jsx(kv,{type:t,shortcutKeys:v})]})}):null});It.displayName="MarkButton";const af=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.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"})}));af.displayName="BoldIcon";const lf=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));lf.displayName="Code2Icon";const cf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.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"})}));cf.displayName="ItalicIcon";const uf=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"})]}));uf.displayName="StrikeIcon";const df=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));df.displayName="SubscriptIcon";const ff=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"})]}));ff.displayName="SuperscriptIcon";const pf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.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"})}));pf.displayName="UnderlineIcon";const Ov={bold:af,italic:cf,underline:pf,strike:uf,code:lf,superscript:ff,subscript:df},hf={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function ha(e,t){return!e||!e.isEditable||!Bi(t,e)||Ko(e,["image"])?!1:e.can().toggleMark(t)}function Iv(e,t){return!e||!e.isEditable?!1:e.isActive(t)}function Lv(e,t){return!e||!e.isEditable||!ha(e,t)?!1:e.chain().focus().toggleMark(t).run()}function Pv(e){const{editor:t,type:n,hideWhenUnavailable:r}=e;return t?r?!t.isEditable||!Bi(n,t)?!1:t.isActive("code")?!0:ha(t,n):!0:!1}function Dv(e){return{bold:"굵게",italic:"기울임꼴",strike:"취소선",code:"코드",underline:"밑줄",superscript:"위첨자",subscript:"아래첨자"}[e]}function Bv(e){const{editor:t,type:n,hideWhenUnavailable:r=!1,onToggled:o}=e,{editor:s}=Ue(t),[i,a]=x.useState(!0),c=ha(s,n),l=Iv(s,n);x.useEffect(()=>{if(!s)return;const f=()=>{a(Pv({editor:s,type:n,hideWhenUnavailable:r}))};return f(),s.on("selectionUpdate",f),()=>{s.off("selectionUpdate",f)}},[s,n,r]);const d=x.useCallback(()=>{if(!s)return!1;const f=Lv(s,n);return f&&o?.(),f},[s,n,o]);return{isVisible:i,isActive:l,handleMark:d,canToggle:c,label:Dv(n),shortcutKeys:hf[n],Icon:Ov[n]}}function Hv(e="max",t=768){const[n,r]=x.useState(void 0);return x.useEffect(()=>{const o=e==="min"?`(min-width: ${t}px)`:`(max-width: ${t-1}px)`,s=window.matchMedia(o),i=a=>r(a.matches);return r(s.matches),s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[e,t]),!!n}const gf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));gf.displayName="CornerDownLeftIcon";const mf=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),u.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));mf.displayName="ExternalLinkIcon";const ga=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),u.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));ga.displayName="LinkIcon";const bf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));bf.displayName="TrashIcon";function vf({className:e,type:t,...n}){return u.jsx("input",{type:t,"data-slot":"tiptap-input",className:ke("tiptap-input",e),...n})}const yf=x.forwardRef(({className:e,children:t,...n},r)=>u.jsx(V,{type:"button",className:e,variant:"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"링크",ref:r,...n,children:t||u.jsx(ga,{className:"tiptap-button-icon"})}));yf.displayName="LinkButton";const Fv=({url:e,setUrl:t,setLink:n,removeLink:r,openLink:o,isActive:s})=>{const i=Hv(),a=c=>{c.key==="Enter"&&(c.preventDefault(),n())};return u.jsx(Fe,{style:{...i?{boxShadow:"none",border:0}:{}},children:u.jsx($e,{style:{...i?{padding:0}:{}},children:u.jsxs(Be,{orientation:"horizontal",children:[u.jsx(vf,{type:"url",placeholder:"Paste a link...",value:e,onChange:c=>t(c.target.value),onKeyDown:a,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",className:"tiptap-link-input"}),u.jsx(Qt,{children:u.jsx(V,{type:"button",onClick:n,title:"Apply link",disabled:!e&&!s,variant:"ghost",children:u.jsx(gf,{className:"tiptap-button-icon"})})}),u.jsx(Hi,{}),u.jsxs(Qt,{children:[u.jsx(Qt,{children:u.jsx(V,{type:"button",onClick:o,title:"Open in new window",disabled:!e&&!s,variant:"ghost",children:u.jsx(mf,{className:"tiptap-button-icon"})})}),u.jsx(Qt,{children:u.jsx(V,{type:"button",onClick:r,title:"Remove link",disabled:!e&&!s,variant:"ghost",children:u.jsx(bf,{className:"tiptap-button-icon"})})})]})]})})})},Ef=x.forwardRef(({editor:e,hideWhenUnavailable:t=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:s,children:i,...a},c)=>{const{editor:l}=Ue(e),[d,f]=x.useState(!1),{isVisible:h,canSet:p,isActive:m,url:g,setUrl:b,setLink:v,removeLink:E,openLink:_,label:S,Icon:N}=zv({editor:l,hideWhenUnavailable:t,onSetLink:n}),A=x.useCallback(D=>{f(D),r?.(D)},[r]),R=x.useCallback(()=>{v(),f(!1)},[v]),O=x.useCallback(D=>{s?.(D),!D.defaultPrevented&&f(!d)},[s,d]);return x.useEffect(()=>{o&&m&&f(!0)},[o,m]),h?u.jsxs(jt,{open:d,onOpenChange:A,children:[u.jsx(zt,{asChild:!0,children:u.jsx(yf,{disabled:!p,"data-active-state":m?"on":"off","data-disabled":!p,"aria-label":S,"aria-pressed":m,onClick:O,...a,ref:c,children:i??u.jsx(N,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{collisionPadding:4,children:u.jsx(Fv,{url:g,setUrl:b,setLink:R,removeLink:E,openLink:_,isActive:m})})]}):null});Ef.displayName="LinkPopover";function Cf(e){if(!e||!e.isEditable||Ko(e,["image"],!0))return!1;try{return e.can().setMark("link")}catch{return!1}}function wf(e){return!e||!e.isEditable?!1:e.isActive("link")}function $v(e){const{editor:t,hideWhenUnavailable:n}=e;if(!t||!t.isEditable)return!1;const r=Bi("link",t);return n?r?t.isActive("code")?!0:Cf(t):!1:!0}function Uv(e){const{editor:t,onSetLink:n}=e,[r,o]=x.useState(null);x.useEffect(()=>{if(!t)return;const{href:c}=t.getAttributes("link");wf(t)&&r===null&&o(c||"")},[t,r]),x.useEffect(()=>{if(!t)return;const c=()=>{const{href:l}=t.getAttributes("link");o(l||"")};return t.on("selectionUpdate",c),()=>{t.off("selectionUpdate",c)}},[t]);const s=x.useCallback(()=>{if(!r||!t)return;const{selection:c}=t.state,l=c.empty;let d=t.chain().focus();d=d.extendMarkRange("link").setLink({href:r}),l&&(d=d.insertContent({type:"text",text:r})),d.run(),o(null),n?.()},[t,n,r]),i=x.useCallback(()=>{t&&(t.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[t]),a=x.useCallback((c="_blank",l="noopener,noreferrer")=>{if(!r)return;const d=kh(r,window.location.href);d!=="#"&&window.open(d,c,l)},[r]);return{url:r||"",setUrl:o,setLink:s,removeLink:i,openLink:a}}function jv(e){const{editor:t,hideWhenUnavailable:n=!1}=e,r=Cf(t),o=wf(t),[s,i]=x.useState(!0);return x.useEffect(()=>{if(!t)return;const a=()=>{i($v({editor:t,hideWhenUnavailable:n}))};return a(),t.on("selectionUpdate",a),()=>{t.off("selectionUpdate",a)}},[t,n]),{isVisible:s,canSet:r,isActive:o}}function zv(e){const{editor:t,hideWhenUnavailable:n=!1,onSetLink:r}=e||{},{editor:o}=Ue(t),{isVisible:s,canSet:i,isActive:a}=jv({editor:o,hideWhenUnavailable:n}),c=Uv({editor:o,onSetLink:r});return{isVisible:s,canSet:i,isActive:a,label:"Link",Icon:ga,...c}}const xf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M4 5V19H20V7H11.5858L9.58579 5H4ZM12.4142 5H21C21.5523 5 22 5.44772 22 6V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H10.4142L12.4142 5ZM10 10.5C10 11.3284 9.32843 12 8.5 12C7.67157 12 7 11.3284 7 10.5C7 9.67157 7.67157 9 8.5 9C9.32843 9 10 9.67157 10 10.5ZM18 17L14 11L7 17H18Z"})}));xf.displayName="UploadableIcon";const _f=x.createContext(null);function Sf(){const e=x.useContext(_f);if(!e)throw new Error("useFileHandlerContext는 FileHandlerContext.Provider 안에서만 사용할 수 있습니다.");return e}const Nf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M14 13.5V8C14 5.79086 12.2091 4 10 4C7.79086 4 6 5.79086 6 8V13.5C6 17.0899 8.91015 20 12.5 20C16.0899 20 19 17.0899 19 13.5V4H21V13.5C21 18.1944 17.1944 22 12.5 22C7.80558 22 4 18.1944 4 13.5V8C4 4.68629 6.68629 2 10 2C13.3137 2 16 4.68629 16 8V13.5C16 15.433 14.433 17 12.5 17C10.567 17 9 15.433 9 13.5V8H11V13.5C11 14.3284 11.6716 15 12.5 15C13.3284 15 14 14.3284 14 13.5Z"})}));Nf.displayName="UploadableFileIcon";const Af=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M15 8V4H5V20H19V8H15ZM3 2.9918C3 2.44405 3.44749 2 3.9985 2H16L20.9997 7L21 20.9925C21 21.5489 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5447 3 21.0082V2.9918ZM11 9.5C11 10.3284 10.3284 11 9.5 11C8.67157 11 8 10.3284 8 9.5C8 8.67157 8.67157 8 9.5 8C10.3284 8 11 8.67157 11 9.5ZM17.5 17L13.5 10L8 17H17.5Z"})}));Af.displayName="UploadableImageIcon";const vi=x.forwardRef(({editor:e,uploadType:t,text:n,onClick:r,externalInputRef:o,...s},i)=>{const{editor:a}=Ue(e),{resolveFileUrl:c,insertFile:l}=Sf(),d=x.useRef(null),f=o??d,h=x.useCallback(v=>{r?.(v),!v.defaultPrevented&&f.current?.click()},[r,f]),p=x.useCallback(async v=>{if(!a)return;const E=Array.from(v.target.files??[]);if(E.length===0)return;const _=a.state.selection.anchor,S=[];for(const N of E)S.push({file:N,url:await c(N)});for(const{file:N,url:A}of[...S].reverse())A&&l(a,N,A,_);v.target.value=""},[a,c,l]),m=t==="image"?"image/*":"*/*",g=t==="image"?"이미지 업로드":"파일 업로드",b=t==="image"?Af:Nf;return u.jsxs(u.Fragment,{children:[u.jsxs(V,{type:"button",variant:"ghost",role:"button",tabIndex:-1,"aria-label":g,tooltip:g,onClick:h,...s,ref:i,children:[u.jsx(b,{className:"tiptap-button-icon"}),n&&u.jsx("span",{className:"tiptap-button-text",children:n})]}),!o&&u.jsx("input",{ref:d,type:"file",accept:m,multiple:!0,style:{display:"none"},onChange:p})]})});vi.displayName="UploadableButton";const Tf=x.forwardRef(({editor:e,portal:t=!1,onOpenChange:n,...r},o)=>{const{editor:s}=Ue(e),{resolveFileUrl:i,insertFile:a}=Sf(),[c,l]=x.useState(!1),d=x.useRef(null),f=x.useRef(null),h=x.useCallback(m=>{s&&(l(m),n?.(m))},[s,n]),p=x.useCallback(async m=>{if(!s)return;const g=Array.from(m.target.files??[]);if(g.length===0)return;const b=s.state.selection.anchor,v=[];for(const E of g)v.push({file:E,url:await i(E)});for(const{file:E,url:_}of[...v].reverse())_&&a(s,E,_,b);m.target.value=""},[s,i,a]);return u.jsxs(u.Fragment,{children:[u.jsxs(vr,{modal:!0,open:c,onOpenChange:h,children:[u.jsx(On,{asChild:!0,children:u.jsxs(V,{type:"button",variant:"ghost",role:"button",tabIndex:-1,"aria-label":"첨부",tooltip:"첨부",...r,ref:o,children:[u.jsx(xf,{className:"tiptap-button-icon"}),u.jsx(pr,{className:"tiptap-button-dropdown-small"})]})}),u.jsx(In,{align:"start",portal:t,children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsxs(Qt,{children:[u.jsx(je,{asChild:!0,children:u.jsx(vi,{editor:s,uploadType:"image",text:"사진",externalInputRef:d})}),u.jsx(je,{asChild:!0,children:u.jsx(vi,{editor:s,uploadType:"file",text:"파일",externalInputRef:f})})]})})})})]}),u.jsx("input",{ref:d,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:p}),u.jsx("input",{ref:f,type:"file",accept:"*/*",multiple:!0,style:{display:"none"},onChange:p})]})});Tf.displayName="UploadableDropdownMenu";const Rf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M21 3C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H21ZM11 13H4V19H11V13ZM20 13H13V19H20V13ZM11 5H4V11H11V5ZM20 5H13V11H20V5Z"})}));Rf.displayName="TableIcon";const Vv=10,Kv=10;function Wv({editor:e}){const[t,n]=x.useState(null),r=(i,a)=>{e.chain().focus().insertTable({rows:i,cols:a,withHeaderRow:!1}).run()},o=t?.row??0,s=t?.col??0;return u.jsxs(jt,{children:[u.jsx(zt,{asChild:!0,children:u.jsx(V,{"data-style":"ghost",tooltip:"표 삽입",children:u.jsx(Rf,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{align:"start",children:u.jsx(Fe,{children:u.jsxs($e,{children:[u.jsx("div",{className:"tiptap-table-picker-grid",onMouseLeave:()=>n(null),children:Array.from({length:Vv},(i,a)=>Array.from({length:Kv},(c,l)=>{const d=a+1,f=l+1,h=d<=o&&f<=s;return u.jsx("div",{className:`tiptap-table-picker-cell${h?" is-selected":""}`,onMouseEnter:()=>n({row:d,col:f}),onClick:()=>r(d,f)},`${d}-${f}`)}))}),u.jsx("p",{className:"tiptap-table-picker-label",children:o>0&&s>0?`${o} × ${s}`:" "})]})})})]})}const yi=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"}),u.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"}),u.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"}),u.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"})]}));yi.displayName="ListIcon";const Mf=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.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"}),u.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"}),u.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"}),u.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"}),u.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"}),u.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"})]}));Mf.displayName="ListOrderedIcon";function Gv({editor:e}){const[t,n]=x.useState(!1),r=ot.useEditorState({editor:e,selector:({editor:s})=>({bulletList:s.isActive("bulletList"),orderedList:s.isActive("orderedList"),paragraph:s.isActive("paragraph")})}),o=s=>{s(),n(!1)};return u.jsxs(jt,{open:t,onOpenChange:n,children:[u.jsx(zt,{asChild:!0,children:u.jsx(V,{"data-style":"ghost",tooltip:"목록",children:u.jsx(yi,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{align:"start",children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsxs(Be,{orientation:"horizontal",children:[u.jsx(V,{"data-style":"ghost",tooltip:"글머리 기호 목록","aria-pressed":r.bulletList,onClick:()=>o(()=>e.chain().focus().toggleBulletList().run()),children:u.jsx(yi,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"번호 매기기 목록","aria-pressed":r.orderedList,onClick:()=>o(()=>e.chain().focus().toggleOrderedList().run()),children:u.jsx(Mf,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"단락","aria-pressed":r.paragraph,onClick:()=>o(()=>e.chain().focus().clearNodes().run()),children:u.jsx(ls,{className:"tiptap-button-icon"})})]})})})})]})}const kf=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M2 11H4V13H2V11ZM6 11H18V13H6V11ZM20 11H22V13H20V11Z"})}));kf.displayName="SeparatorIcon";const Ir={flex:1,height:"1px",background:"var(--tt-gray-light-a-400)"},Pl={fontSize:"0.65rem",color:"var(--tt-gray-light-a-600)"};function Zv({style:e}){switch(e){case"thin":return u.jsx("span",{style:{display:"block",width:"80%",height:"1px",background:"var(--tt-gray-light-a-400)"}});case"thick":return u.jsx("span",{style:{display:"block",width:"80%",height:"3px",background:"var(--tt-gray-light-a-700)"}});case"dashed":return u.jsx("span",{style:{display:"block",width:"80%",borderTop:"1px dashed var(--tt-gray-light-a-400)"}});case"short":return u.jsx("span",{style:{display:"block",width:"30%",height:"1px",background:"var(--tt-gray-light-a-400)"}});case"dots":return u.jsx("span",{style:{letterSpacing:"0.4em",fontSize:"1rem",color:"var(--tt-gray-light-a-600)"},children:"· · ·"});case"diamond":return u.jsxs("span",{style:{display:"flex",alignItems:"center",width:"80%",gap:"6px"},children:[u.jsx("span",{style:Ir}),u.jsx("span",{style:Pl,children:"◆"}),u.jsx("span",{style:Ir})]});case"circle":return u.jsxs("span",{style:{display:"flex",alignItems:"center",width:"80%",gap:"6px"},children:[u.jsx("span",{style:Ir}),u.jsx("span",{style:{...Pl,fontSize:"0.75rem"},children:"○"}),u.jsx("span",{style:Ir})]})}}const qv=["thin","thick","dashed","short","dots","diamond","circle"];function Yv({editor:e}){const[t,n]=x.useState(!1),r=o=>{e.chain().focus().setHr({style:o}).run(),n(!1)};return u.jsxs(jt,{open:t,onOpenChange:n,children:[u.jsx(zt,{asChild:!0,children:u.jsx(V,{"data-style":"ghost",tooltip:"구분선 삽입",children:u.jsx(kf,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{align:"start",children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsx(Be,{orientation:"vertical",children:qv.map(o=>u.jsx(V,{"data-style":"ghost",className:"tiptap-hr-style-button",onClick:()=>r(o),children:u.jsx(Zv,{style:o})},o))})})})})]})}const ma=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M4.58341 17.3211C3.55316 16.2274 3 15 3 13.0103C3 9.51086 5.45651 6.37366 9.03059 4.82318L9.92328 6.20079C6.58804 8.00539 5.93618 10.346 5.67564 11.822C6.21263 11.5443 6.91558 11.4466 7.60471 11.5105C9.40908 11.6778 10.8312 13.159 10.8312 15C10.8312 16.933 9.26416 18.5 7.33116 18.5C6.2581 18.5 5.23196 18.0095 4.58341 17.3211ZM14.5834 17.3211C13.5532 16.2274 13 15 13 13.0103C13 9.51086 15.4565 6.37366 19.0306 4.82318L19.9233 6.20079C16.588 8.00539 15.9362 10.346 15.6756 11.822C16.2126 11.5443 16.9156 11.4466 17.6047 11.5105C19.4091 11.6778 20.8312 13.159 20.8312 15C20.8312 16.933 19.2642 18.5 17.3312 18.5C16.2581 18.5 15.232 18.0095 14.5834 17.3211Z"})}));ma.displayName="DoubleQuotesIcon";const Dl={height:"2px",borderRadius:"2px",background:"var(--tt-gray-light-a-300)"};function Xv({style:e}){if(e==="quote")return u.jsx("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",width:"80%"},children:u.jsx(ma,{style:{width:"14px",height:"14px",color:"var(--tt-gray-light-a-500)"}})});if(e==="bar")return u.jsxs("span",{style:{display:"flex",gap:"2px",width:"80%",alignItems:"center"},children:[u.jsx("span",{style:{height:"12px",width:"2px",borderRadius:"2px",background:"var(--tt-gray-light-a-500)",flexShrink:0}}),u.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:"4px",flex:1,alignItems:"flex-start"},children:[u.jsx("span",{style:{...Dl,width:"100%"}}),u.jsx("span",{style:{...Dl,width:"70%"}})]})]});if(e==="box")return u.jsx("span",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"80%",border:"1px dotted var(--tt-gray-light-a-400)",borderRadius:"3px",padding:"6px 8px",backgroundColor:"var(--tt-gray-light-a-100)"}})}function Jv({editor:e}){const[t,n]=x.useState(!1),r=ot.useEditorState({editor:e,selector:({editor:i})=>({quote:i.isActive("blockquote",{style:"quote"}),bar:i.isActive("blockquote",{style:"bar"}),box:i.isActive("blockquote",{style:"box"})})}),o=i=>{r[i]?e.chain().focus().toggleBlockquote().run():e.isActive("blockquote")?e.chain().focus().updateAttributes("blockquote",{style:i}).run():e.chain().focus().toggleBlockquote().updateAttributes("blockquote",{style:i}).run(),n(!1)},s=()=>{e.chain().focus().clearNodes().run(),n(!1)};return u.jsxs(jt,{open:t,onOpenChange:n,children:[u.jsx(zt,{asChild:!0,children:u.jsx(V,{"data-style":"ghost",tooltip:"인용구 삽입",children:u.jsx(ma,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{align:"start",children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsxs(Be,{orientation:"vertical",children:[["quote","bar","box"].map(i=>u.jsx(V,{"data-style":"ghost",className:"tiptap-hr-style-button","aria-pressed":r[i],onClick:()=>o(i),children:u.jsx(Xv,{style:i})},i)),u.jsx(V,{"data-style":"ghost",className:"tiptap-hr-style-button",onClick:s,children:u.jsx(ls,{className:"tiptap-button-icon"})})]})})})})]})}const Bs={basic:"기본 모드",expert:"전문가 모드"};function Qv({mode:e,onModeChange:t}){return u.jsxs(vr,{children:[u.jsx(On,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",children:[Bs[e],u.jsx(pr,{})]})}),u.jsx(In,{portal:!1,children:u.jsx(Fe,{children:u.jsx($e,{children:Object.keys(Bs).map(n=>u.jsx(je,{"data-active-state":e===n?"on":"off",onSelect:()=>t(n),asChild:!0,children:u.jsx(V,{"data-style":"ghost","data-active-state":e===n?"on":"off",children:Bs[n]})},n))})})})]})}function e2({editor:e}){const[t,n]=x.useState("basic");return u.jsx(Wo,{className:"my-toolbar",children:u.jsxs(Go,{children:[u.jsx(Tf,{editor:e,portal:!1}),t==="basic"?u.jsx(u.Fragment,{children:u.jsx(ef,{editor:e,portal:!1})}):u.jsx(u.Fragment,{children:u.jsx(tf,{editor:e,portal:!1})}),u.jsx(ht,{}),u.jsx(It,{type:"bold"}),u.jsx(It,{type:"italic"}),u.jsx(It,{type:"strike"}),u.jsx(It,{type:"superscript"}),u.jsx(It,{type:"subscript"}),u.jsx(It,{type:"underline"}),u.jsx(It,{type:"code"}),u.jsx(Ef,{}),u.jsx(ed,{editor:e}),u.jsx(ht,{}),u.jsx(Fn,{editor:e,align:"left"}),u.jsx(Fn,{editor:e,align:"center"}),u.jsx(Fn,{editor:e,align:"right"}),u.jsx(Fn,{editor:e,align:"justify"}),u.jsx(ht,{}),u.jsx(Wv,{editor:e}),u.jsx(Gv,{editor:e}),u.jsx(Yv,{editor:e}),u.jsx(Jv,{editor:e}),u.jsx(ht,{}),u.jsx(Qv,{mode:t,onModeChange:n})]})})}var t2=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:o})=>new Q.Plugin({key:e||new Q.PluginKey("fileHandler"),props:{handleDrop(s,i){var a,c;if(!r||(a=i.dataTransfer)!=null&&a.types.includes("application/x-prosemirror-slice")||!((c=i.dataTransfer)!=null&&c.files.length))return!1;const l=s.posAtCoords({left:i.clientX,top:i.clientY});let d=Array.from(i.dataTransfer.files);return o&&(d=d.filter(f=>o.includes(f.type))),d.length===0?!1:(i.preventDefault(),i.stopPropagation(),r(t,d,l?.pos||0),!0)},handlePaste(s,i){var a;if(!n||!((a=i.clipboardData)!=null&&a.files.length))return!1;let c=Array.from(i.clipboardData.files);const l=i.clipboardData.getData("text/html");return o&&(c=c.filter(d=>o.includes(d.type))),!(c.length===0||(i.preventDefault(),i.stopPropagation(),n(t,c,l),l.length>0))}}}),n2=w.Extension.create({name:"fileHandler",addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0}},addProseMirrorPlugins(){return[t2({key:new Q.PluginKey(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste})]}}),r2=n2,o2=w.Node.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
42
+
43
+ `):""}),s2=o2,i2=w.Node.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),a2=i2,Lr="&nbsp;",Hs=" ",l2=w.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",w.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const r=t.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Lr||n[0].text===Lr||n[0].raw===Hs||n[0].text===Hs)&&r.length===1&&r[0].type==="text"&&(r[0].text===Lr||r[0].text===Hs)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{var r,o;if(!e)return"";const s=Array.isArray(e.content)?e.content:[];if(s.length===0){const i=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((o=n?.previousNode)==null?void 0:o.type)==="paragraph"&&i.length===0?Lr:""}return t.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),c2=l2;const u2=c2.extend({addAttributes(){return{...this.parent?.(),size:{default:"normal",parseHTML:e=>e.getAttribute("data-size")||"normal",renderHTML:e=>({"data-size":e.size})}}}});var d2=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,f2=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,p2=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,h2=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,g2=w.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return no.jsx("strong",{...w.mergeAttributes(this.options.HTMLAttributes,e),children:no.jsx("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[w.markInputRule({find:d2,type:this.type}),w.markInputRule({find:p2,type:this.type})]},addPasteRules(){return[w.markPasteRule({find:f2,type:this.type}),w.markPasteRule({find:h2,type:this.type})]}}),m2=g2,b2=e=>{const t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},v2=e=>{const t=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},y2=w.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",w.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[w.markInputRule({find:b2,type:this.type})]},addPasteRules(){return[w.markPasteRule({find:v2,type:this.type})]}}),E2=y2,C2=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,w2=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,x2=w.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||w.getStyleProperty(e,"background-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",w.mergeAttributes(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){const o=/^(==)([^=]+)(==)/.exec(e);if(o){const s=o[2].trim(),i=n.inlineTokens(s);return{type:"highlight",raw:o[0],text:s,tokens:i}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[w.markInputRule({find:C2,type:this.type})]},addPasteRules(){return[w.markPasteRule({find:w2,type:this.type})]}}),_2=x2,S2=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,N2=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,A2=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,T2=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,R2=w.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",w.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[w.markInputRule({find:S2,type:this.type}),w.markInputRule({find:A2,type:this.type})]},addPasteRules(){return[w.markPasteRule({find:N2,type:this.type}),w.markPasteRule({find:T2,type:this.type})]}}),M2=R2;const k2="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",O2="ελ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",Ei="numeric",Ci="ascii",wi="alpha",Zn="asciinumeric",$n="alphanumeric",xi="domain",Of="emoji",I2="scheme",L2="slashscheme",Fs="whitespace";function P2(e,t){return e in t||(t[e]=[]),t[e]}function en(e,t,n){t[Ei]&&(t[Zn]=!0,t[$n]=!0),t[Ci]&&(t[Zn]=!0,t[wi]=!0),t[Zn]&&(t[$n]=!0),t[wi]&&(t[$n]=!0),t[$n]&&(t[xi]=!0),t[Of]&&(t[xi]=!0);for(const r in t){const o=P2(r,n);o.indexOf(e)<0&&o.push(e)}}function D2(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function ze(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}ze.groups={};ze.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const o=t.jr[r][0],s=t.jr[r][1];if(s&&o.test(e))return s}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){r=r||ze.groups;let o;return t&&t.j?o=t:(o=new ze(t),n&&r&&en(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const s=e.length;if(!s)return o;for(let i=0;i<s-1;i++)o=o.tt(e[i]);return o.tt(e[s-1],t,n,r)},tt(e,t,n,r){r=r||ze.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const s=t;let i,a=o.go(e);if(a?(i=new ze,Object.assign(i.j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new ze,s){if(r)if(i.t&&typeof i.t=="string"){const c=Object.assign(D2(i.t,r),n);en(s,c,r)}else n&&en(s,n,r);i.t=s}return o.j[e]=i,i}};const ie=(e,t,n,r,o)=>e.ta(t,n,r,o),Ee=(e,t,n,r,o)=>e.tr(t,n,r,o),Bl=(e,t,n,r,o)=>e.ts(t,n,r,o),L=(e,t,n,r,o)=>e.tt(t,n,r,o),xt="WORD",_i="UWORD",If="ASCIINUMERICAL",Lf="ALPHANUMERICAL",sr="LOCALHOST",Si="TLD",Ni="UTLD",Xr="SCHEME",gn="SLASH_SCHEME",ba="NUM",Ai="WS",va="NL",qn="OPENBRACE",Yn="CLOSEBRACE",po="OPENBRACKET",ho="CLOSEBRACKET",go="OPENPAREN",mo="CLOSEPAREN",bo="OPENANGLEBRACKET",vo="CLOSEANGLEBRACKET",yo="FULLWIDTHLEFTPAREN",Eo="FULLWIDTHRIGHTPAREN",Co="LEFTCORNERBRACKET",wo="RIGHTCORNERBRACKET",xo="LEFTWHITECORNERBRACKET",_o="RIGHTWHITECORNERBRACKET",So="FULLWIDTHLESSTHAN",No="FULLWIDTHGREATERTHAN",Ao="AMPERSAND",To="APOSTROPHE",Ro="ASTERISK",Pt="AT",Mo="BACKSLASH",ko="BACKTICK",Oo="CARET",tn="COLON",ya="COMMA",Io="DOLLAR",ut="DOT",Lo="EQUALS",Ea="EXCLAMATION",Xe="HYPHEN",Xn="PERCENT",Po="PIPE",Do="PLUS",Bo="POUND",Jn="QUERY",Ca="QUOTE",Pf="FULLWIDTHMIDDLEDOT",wa="SEMI",dt="SLASH",Qn="TILDE",Ho="UNDERSCORE",Df="EMOJI",Fo="SYM";var Bf=Object.freeze({__proto__:null,ALPHANUMERICAL:Lf,AMPERSAND:Ao,APOSTROPHE:To,ASCIINUMERICAL:If,ASTERISK:Ro,AT:Pt,BACKSLASH:Mo,BACKTICK:ko,CARET:Oo,CLOSEANGLEBRACKET:vo,CLOSEBRACE:Yn,CLOSEBRACKET:ho,CLOSEPAREN:mo,COLON:tn,COMMA:ya,DOLLAR:Io,DOT:ut,EMOJI:Df,EQUALS:Lo,EXCLAMATION:Ea,FULLWIDTHGREATERTHAN:No,FULLWIDTHLEFTPAREN:yo,FULLWIDTHLESSTHAN:So,FULLWIDTHMIDDLEDOT:Pf,FULLWIDTHRIGHTPAREN:Eo,HYPHEN:Xe,LEFTCORNERBRACKET:Co,LEFTWHITECORNERBRACKET:xo,LOCALHOST:sr,NL:va,NUM:ba,OPENANGLEBRACKET:bo,OPENBRACE:qn,OPENBRACKET:po,OPENPAREN:go,PERCENT:Xn,PIPE:Po,PLUS:Do,POUND:Bo,QUERY:Jn,QUOTE:Ca,RIGHTCORNERBRACKET:wo,RIGHTWHITECORNERBRACKET:_o,SCHEME:Xr,SEMI:wa,SLASH:dt,SLASH_SCHEME:gn,SYM:Fo,TILDE:Qn,TLD:Si,UNDERSCORE:Ho,UTLD:Ni,UWORD:_i,WORD:xt,WS:Ai});const Ct=/[a-z]/,Dn=new RegExp("\\p{L}","u"),$s=new RegExp("\\p{Emoji}","u"),wt=/\d/,Us=/\s/,Hl="\r",js=`
44
+ `,B2="️",H2="‍",zs="";let Pr=null,Dr=null;function F2(e=[]){const t={};ze.groups=t;const n=new ze;Pr==null&&(Pr=Fl(k2)),Dr==null&&(Dr=Fl(O2)),L(n,"'",To),L(n,"{",qn),L(n,"}",Yn),L(n,"[",po),L(n,"]",ho),L(n,"(",go),L(n,")",mo),L(n,"<",bo),L(n,">",vo),L(n,"(",yo),L(n,")",Eo),L(n,"「",Co),L(n,"」",wo),L(n,"『",xo),L(n,"』",_o),L(n,"<",So),L(n,">",No),L(n,"&",Ao),L(n,"*",Ro),L(n,"@",Pt),L(n,"`",ko),L(n,"^",Oo),L(n,":",tn),L(n,",",ya),L(n,"$",Io),L(n,".",ut),L(n,"=",Lo),L(n,"!",Ea),L(n,"-",Xe),L(n,"%",Xn),L(n,"|",Po),L(n,"+",Do),L(n,"#",Bo),L(n,"?",Jn),L(n,'"',Ca),L(n,"/",dt),L(n,";",wa),L(n,"~",Qn),L(n,"_",Ho),L(n,"\\",Mo),L(n,"・",Pf);const r=Ee(n,wt,ba,{[Ei]:!0});Ee(r,wt,r);const o=Ee(r,Ct,If,{[Zn]:!0}),s=Ee(r,Dn,Lf,{[$n]:!0}),i=Ee(n,Ct,xt,{[Ci]:!0});Ee(i,wt,o),Ee(i,Ct,i),Ee(o,wt,o),Ee(o,Ct,o);const a=Ee(n,Dn,_i,{[wi]:!0});Ee(a,Ct),Ee(a,wt,s),Ee(a,Dn,a),Ee(s,wt,s),Ee(s,Ct),Ee(s,Dn,s);const c=L(n,js,va,{[Fs]:!0}),l=L(n,Hl,Ai,{[Fs]:!0}),d=Ee(n,Us,Ai,{[Fs]:!0});L(n,zs,d),L(l,js,c),L(l,zs,d),Ee(l,Us,d),L(d,Hl),L(d,js),Ee(d,Us,d),L(d,zs,d);const f=Ee(n,$s,Df,{[Of]:!0});L(f,"#"),Ee(f,$s,f),L(f,B2,f);const h=L(f,H2);L(h,"#"),Ee(h,$s,f);const p=[[Ct,i],[wt,o]],m=[[Ct,null],[Dn,a],[wt,s]];for(let g=0;g<Pr.length;g++)kt(n,Pr[g],Si,xt,p);for(let g=0;g<Dr.length;g++)kt(n,Dr[g],Ni,_i,m);en(Si,{tld:!0,ascii:!0},t),en(Ni,{utld:!0,alpha:!0},t),kt(n,"file",Xr,xt,p),kt(n,"mailto",Xr,xt,p),kt(n,"http",gn,xt,p),kt(n,"https",gn,xt,p),kt(n,"ftp",gn,xt,p),kt(n,"ftps",gn,xt,p),en(Xr,{scheme:!0,ascii:!0},t),en(gn,{slashscheme:!0,ascii:!0},t),e=e.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<e.length;g++){const b=e[g][0],E=e[g][1]?{[I2]:!0}:{[L2]:!0};b.indexOf("-")>=0?E[xi]=!0:Ct.test(b)?wt.test(b)?E[Zn]=!0:E[Ci]=!0:E[Ei]=!0,Bl(n,b,b,E)}return Bl(n,"localhost",sr,{ascii:!0}),n.jd=new ze(Fo),{start:n,tokens:Object.assign({groups:t},Bf)}}function Hf(e,t){const n=$2(t.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let s=0,i=0;for(;i<r;){let a=e,c=null,l=0,d=null,f=-1,h=-1;for(;i<r&&(c=a.go(n[i]));)a=c,a.accepts()?(f=0,h=0,d=a):f>=0&&(f+=n[i].length,h++),l+=n[i].length,s+=n[i].length,i++;s-=f,i-=h,l-=f,o.push({t:d.t,v:t.slice(s-l,s),s:s-l,e:s})}return o}function $2(e){const t=[],n=e.length;let r=0;for(;r<n;){let o=e.charCodeAt(r),s,i=o<55296||o>56319||r+1===n||(s=e.charCodeAt(r+1))<56320||s>57343?e[r]:e.slice(r,r+2);t.push(i),r+=i.length}return t}function kt(e,t,n,r,o){let s;const i=t.length;for(let a=0;a<i-1;a++){const c=t[a];e.j[c]?s=e.j[c]:(s=new ze(r),s.jr=o.slice(),e.j[c]=s),e=s}return s=new ze(n),s.jr=o.slice(),e.j[t[i-1]]=s,s}function Fl(e){const t=[],n=[];let r=0,o="0123456789";for(;r<e.length;){let s=0;for(;o.indexOf(e[r+s])>=0;)s++;if(s>0){t.push(n.join(""));for(let i=parseInt(e.substring(r,r+s),10);i>0;i--)n.pop();r+=s}else n.push(e[r]),r++}return t}const ir={defaultProtocol:"http",events:null,format:$l,formatHref:$l,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function xa(e,t=null){let n=Object.assign({},ir);e&&(n=Object.assign(n,e instanceof xa?e.o:e));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}xa.prototype={o:ir,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let o=this.o[e];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:ir[e],typeof o=="function"&&r&&(o=o(t,n))):typeof o=="function"&&r&&(o=o(t,n.t,n)),o)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function $l(e){return e}function Ff(e,t){this.t="token",this.v=e,this.tk=t}Ff.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=ir.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),s=this.toFormattedString(e),i={},a=e.get("className",n,t),c=e.get("target",n,t),l=e.get("rel",n,t),d=e.getObj("attributes",n,t),f=e.getObj("events",n,t);return i.href=r,a&&(i.class=a),c&&(i.target=c),l&&(i.rel=l),d&&Object.assign(i,d),{tagName:o,attributes:i,content:s,eventListeners:f}}};function cs(e,t){class n extends Ff{constructor(o,s){super(o,s),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const U2=cs("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ul=cs("text"),j2=cs("nl"),Br=cs("url",{isLink:!0,toHref(e=ir.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==sr&&e[1].t===tn}}),qe=e=>new ze(e);function z2({groups:e}){const t=e.domain.concat([Ao,Ro,Pt,Mo,ko,Oo,Io,Lo,Xe,ba,Xn,Po,Do,Bo,dt,Fo,Qn,Ho]),n=[To,tn,ya,ut,Ea,Xn,Jn,Ca,wa,bo,vo,qn,Yn,ho,po,go,mo,yo,Eo,Co,wo,xo,_o,So,No],r=[Ao,To,Ro,Mo,ko,Oo,Io,Lo,Xe,qn,Yn,Xn,Po,Do,Bo,Jn,dt,Fo,Qn,Ho],o=qe(),s=L(o,Qn);ie(s,r,s),ie(s,e.domain,s);const i=qe(),a=qe(),c=qe();ie(o,e.domain,i),ie(o,e.scheme,a),ie(o,e.slashscheme,c),ie(i,r,s),ie(i,e.domain,i);const l=L(i,Pt);L(s,Pt,l),L(a,Pt,l),L(c,Pt,l);const d=L(s,ut);ie(d,r,s),ie(d,e.domain,s);const f=qe();ie(l,e.domain,f),ie(f,e.domain,f);const h=L(f,ut);ie(h,e.domain,f);const p=qe(U2);ie(h,e.tld,p),ie(h,e.utld,p),L(l,sr,p);const m=L(f,Xe);L(m,Xe,m),ie(m,e.domain,f),ie(p,e.domain,f),L(p,ut,h),L(p,Xe,m);const g=L(i,Xe),b=L(i,ut);L(g,Xe,g),ie(g,e.domain,i),ie(b,r,s),ie(b,e.domain,i);const v=qe(Br);ie(b,e.tld,v),ie(b,e.utld,v),ie(v,e.domain,i),ie(v,r,s),L(v,ut,b),L(v,Xe,g),L(v,Pt,l);const E=L(v,tn),_=qe(Br);ie(E,e.numeric,_);const S=qe(Br),N=qe();ie(S,t,S),ie(S,n,N),ie(N,t,S),ie(N,n,N),L(v,dt,S),L(_,dt,S);const A=L(a,tn),R=L(c,tn),O=L(R,dt),D=L(O,dt);ie(a,e.domain,i),L(a,ut,b),L(a,Xe,g),ie(c,e.domain,i),L(c,ut,b),L(c,Xe,g),ie(A,e.domain,S),L(A,dt,S),L(A,Jn,S),ie(D,e.domain,S),ie(D,t,S),L(D,dt,S);const j=[[qn,Yn],[po,ho],[go,mo],[bo,vo],[yo,Eo],[Co,wo],[xo,_o],[So,No]];for(let Y=0;Y<j.length;Y++){const[J,X]=j[Y],I=L(S,J);L(N,J,I);const $=qe(Br);ie(I,t,$);const U=qe();ie(I,n,U),L(I,X,S),ie($,t,$),ie($,n,U),ie(U,t,$),ie(U,n,U),L($,X,S),L(U,X,S)}return L(o,sr,v),L(o,va,j2),{start:o,tokens:Bf}}function V2(e,t,n){let r=n.length,o=0,s=[],i=[];for(;o<r;){let a=e,c=null,l=null,d=0,f=null,h=-1;for(;o<r&&!(c=a.go(n[o].t));)i.push(n[o++]);for(;o<r&&(l=c||a.go(n[o].t));)c=null,a=l,a.accepts()?(h=0,f=a):h>=0&&h++,o++,d++;if(h<0)o-=d,o<r&&(i.push(n[o]),o++);else{i.length>0&&(s.push(Vs(Ul,t,i)),i=[]),o-=h,d-=h;const p=f.t,m=n.slice(o-d,o);s.push(Vs(p,t,m))}}return i.length>0&&s.push(Vs(Ul,t,i)),s}function Vs(e,t,n){const r=n[0].s,o=n[n.length-1].e,s=t.slice(r,o);return new e(s,n)}const K2=typeof console<"u"&&console&&console.warn||(()=>{}),W2="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ve={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function G2(){return ze.groups={},ve.scanner=null,ve.parser=null,ve.tokenQueue=[],ve.pluginQueue=[],ve.customSchemes=[],ve.initialized=!1,ve}function jl(e,t=!1){if(ve.initialized&&K2(`linkifyjs: already initialized - will not register custom scheme "${e}" ${W2}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
45
+ 1. Must only contain digits, lowercase ASCII letters or "-"
46
+ 2. Cannot start or end with "-"
47
+ 3. "-" cannot repeat`);ve.customSchemes.push([e,t])}function Z2(){ve.scanner=F2(ve.customSchemes);for(let e=0;e<ve.tokenQueue.length;e++)ve.tokenQueue[e][1]({scanner:ve.scanner});ve.parser=z2(ve.scanner.tokens);for(let e=0;e<ve.pluginQueue.length;e++)ve.pluginQueue[e][1]({scanner:ve.scanner,parser:ve.parser});return ve.initialized=!0,ve}function _a(e){return ve.initialized||Z2(),V2(ve.parser.start,e,Hf(ve.scanner.start,e))}_a.scan=Hf;function $f(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new xa(n),o=_a(e),s=[];for(let i=0;i<o.length;i++){const a=o[i];a.isLink&&(!t||a.t===t)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Sa="[\0-   ᠎ -\u2029  ]",q2=new RegExp(Sa),Y2=new RegExp(`${Sa}$`),X2=new RegExp(Sa,"g");function J2(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Q2(e){return new Q.Plugin({key:new Q.PluginKey("autolink"),appendTransaction:(t,n,r)=>{const o=t.some(l=>l.docChanged)&&!n.doc.eq(r.doc),s=t.some(l=>l.getMeta("preventAutolink"));if(!o||s)return;const{tr:i}=r,a=w.combineTransactionSteps(n.doc,[...t]);if(w.getChangedRanges(a).forEach(({newRange:l})=>{const d=w.findChildrenInRange(r.doc,l,p=>p.isTextblock);let f,h;if(d.length>1)f=d[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(l.from,l.to," "," ");if(!Y2.test(p))return;f=d[0],h=r.doc.textBetween(f.pos,l.to,void 0," ")}if(f&&h){const p=h.split(q2).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const b=_a(m).map(v=>v.toObject(e.defaultProtocol));if(!J2(b))return!1;b.filter(v=>v.isLink).map(v=>({...v,from:g+v.start+1,to:g+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>e.validate(v.value)).filter(v=>e.shouldAutoLink(v.value)).forEach(v=>{w.getMarksBetween(v.from,v.to,r.doc).some(E=>E.mark.type===e.type)||i.addMark(v.from,v.to,e.type.create({href:v.href}))})}}),!!i.steps.length)return i}})}function ey(e){return new Q.Plugin({key:new Q.PluginKey("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,s;if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const c=r.target;if(!c)return!1;const l=e.editor.view.dom;i=c.closest("a"),i&&!l.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const c=w.getAttributes(t.state,e.type.name),l=(o=i.href)!=null?o:c.href,d=(s=i.target)!=null?s:c.target;l&&(window.open(l,d),a=!0)}return a}}})}function ty(e){return new Q.Plugin({key:new Q.PluginKey("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:s}=t,{selection:i}=s,{empty:a}=i;if(a)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const l=$f(c,{defaultProtocol:e.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!l||o!==void 0&&!o(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Jt(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!e||e.replace(X2,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var ny=w.Mark.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(e=>{if(typeof e=="string"){jl(e);return}jl(e.scheme,e.optionalSlashes)})},onDestroy(){G2()},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:(e,t)=>!!Jt(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const o=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.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:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!Jt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Jt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",w.mergeAttributes(this.options.HTMLAttributes,e),0]:["a",w.mergeAttributes(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,s;const i=(r=(n=e.attrs)==null?void 0:n.href)!=null?r:"",a=(s=(o=e.attrs)==null?void 0:o.title)!=null?s:"",c=t.renderChildren(e);return a?`[${c}](${i} "${a}")`:`[${c}](${i})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Jt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Jt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[w.markPasteRule({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=$f(e).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!Jt(i,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>{this.options.shouldAutoLink(s.value)&&t.push({text:s.value,data:{href:s.href},index:s.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Q2({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Jt(o,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(ey({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(ty({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),ry=ny,oy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,iy=w.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",w.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[w.markInputRule({find:oy,type:this.type})]},addPasteRules(){return[w.markPasteRule({find:sy,type:this.type})]}}),ay=iy,ly=w.Mark.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(e){return e!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:e}){return["sub",w.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),cy=ly,uy=w.Mark.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(e){return e!=="super"?!1:null}}]},renderHTML({HTMLAttributes:e}){return["sup",w.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),dy=uy,fy=w.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",w.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!o)return;const s=o[2].trim();return{type:"underline",raw:o[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),py=fy;function Uf(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),s=t.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=Uf(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function jf(e,t,n,r){for(let o=e.childCount,s=t.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=e.child(--o),a=t.child(--s),c=i.nodeSize;if(i==a){n-=c,r-=c;continue}if(!i.sameMarkup(a))return{a:n,b:r};if(i.isText&&i.text!=a.text){let l=0,d=Math.min(i.text.length,a.text.length);for(;l<d&&i.text[i.text.length-l-1]==a.text[a.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(i.content.size||a.content.size){let l=jf(i.content,a.content,n-1,r-1);if(l)return l}n-=c,r-=c}}var Tt=class Pe{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,s){for(let i=0,a=0;a<n;i++){let c=this.content[i],l=a+c.nodeSize;if(l>t&&r(c,o+a,s||null,i)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,t-d),Math.min(c.content.size,n-d),r,o+d)}a=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let s="",i=!0;return this.nodesBetween(t,n,(a,c)=>{let l=a.isText?a.text.slice(Math.max(t,c)-c,n-c):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&r&&(i?i=!1:s+=r),s+=l},0),s}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.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<t.content.length;s++)o.push(t.content[s]);return new Pe(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let s=0,i=0;i<n;s++){let a=this.content[s],c=i+a.nodeSize;c>t&&((i<t||c>n)&&(a.isText?a=a.cut(Math.max(0,t-i),Math.min(a.text.length,n-i)):a=a.cut(Math.max(0,t-i-1),Math.min(a.content.size,n-i-1))),r.push(a),o+=a.nodeSize),i=c}return new Pe(r,o)}cutByIndex(t,n){return t==n?Pe.empty:t==0&&n==this.content.length?this:new Pe(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new Pe(o,s)}addToStart(t){return new Pe([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Pe(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return Uf(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return jf(this,t,n,r)}findIndex(t){if(t==0)return Hr(0,t);if(t==this.size)return Hr(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),s=r+o.nodeSize;if(s>=t)return s==t?Hr(n+1,s):Hr(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Pe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return Pe.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Pe.empty;let n,r=0;for(let o=0;o<t.length;o++){let s=t[o];r+=s.nodeSize,o&&s.isText&&t[o-1].sameMarkup(s)?(n||(n=t.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Pe(n||t,r)}static from(t){if(!t)return Pe.empty;if(t instanceof Pe)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Pe([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Tt.empty=new Tt([],0);var Ks={index:0,offset:0};function Hr(e,t){return Ks.index=e,Ks.offset=t,Ks}var hy=class extends Error{},_e=class mn{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Vf(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new mn(r,this.openStart,this.openEnd)}removeBetween(t,n){return new mn(zf(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return mn.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 mn(Tt.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let s=t.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=t.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new mn(t,r,o)}};_e.empty=new _e(Tt.empty,0,0);function zf(e,t,n){let{index:r,offset:o}=e.findIndex(t),s=e.maybeChild(r),{index:i,offset:a}=e.findIndex(n);if(o==t||s.isText){if(a!=n&&!e.child(i).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return e.replaceChild(r,s.copy(zf(s.content,t-o-1,n-o-1)))}function Vf(e,t,n,r,o,s){let{index:i,offset:a}=e.findIndex(t),c=e.maybeChild(i);if(a==t||c.isText)return s&&r<=0&&o<=0&&!s.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Vf(c.content,t-a-1,n,i==0?r-1:0,i==e.childCount-1?o-1:0,c);return l&&e.replaceChild(i,c.copy(l))}var Kf=65535,Wf=Math.pow(2,16);function gy(e,t){return e+t*Wf}function zl(e){return e&Kf}function my(e){return(e-(e&Kf))/Wf}var Gf=1,Zf=2,Jr=4,qf=8,Vl=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&qf)>0}get deletedBefore(){return(this.delInfo&(Gf|Jr))>0}get deletedAfter(){return(this.delInfo&(Zf|Jr))>0}get deletedAcross(){return(this.delInfo&Jr)>0}},rn=class bn{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&bn.empty)return bn.empty}recover(t){let n=0,r=zl(t);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+my(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?o:0);if(c>t)break;let l=this.ranges[a+s],d=this.ranges[a+i],f=c+l;if(t<=f){let h=l?t==c?-1:t==f?1:n:n,p=c+o+(h<0?0:d);if(r)return p;let m=t==(n<0?c:f)?null:gy(a/3,t-c),g=t==c?Zf:t==f?Gf:Jr;return(n<0?t!=c:t!=f)&&(g|=qf),new Vl(p,g,m)}o+=d-l}return r?t+o:new Vl(t+o,0,null)}touches(t,n){let r=0,o=zl(n),s=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>t)break;let l=this.ranges[a+s],d=c+l;if(t<=d&&a==o*3)return!0;r+=this.ranges[a+i]-l}return!1}forEach(t){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],a=i-(this.inverted?s:0),c=i+(this.inverted?0:s),l=this.ranges[o+n],d=this.ranges[o+r];t(a,a+l,c,c+d),s+=d-l}}invert(){return new bn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?bn.empty:new bn(t<0?[0,-t,0]:[0,0,t])}};rn.empty=new rn([]);var Ws=Object.create(null),Le=class{getMap(){return rn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ws[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ws)throw new RangeError("Duplicate use of step JSON ID "+e);return Ws[e]=t,t.prototype.jsonID=e,t}},He=class Un{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Un(t,null)}static fail(t){return new Un(null,t)}static fromReplace(t,n,r,o){try{return Un.ok(t.replace(n,r,o))}catch(s){if(s instanceof hy)return Un.fail(s.message);throw s}}};function Na(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let s=e.child(o);s.content.size&&(s=s.copy(Na(s.content,t,s))),s.isInline&&(s=t(s,n,o)),r.push(s)}return Tt.fromArray(r)}var Yf=class jn extends Le{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new _e(Na(n.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return He.fromReplace(t,this.from,this.to,s)}invert(){return new Xf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new jn(n.pos,r.pos,this.mark)}merge(t){return t instanceof jn&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new jn(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new jn(n.from,n.to,t.markFromJSON(n.mark))}};Le.jsonID("addMark",Yf);var Xf=class zn extends Le{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new _e(Na(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return He.fromReplace(t,this.from,this.to,r)}invert(){return new Yf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new zn(n.pos,r.pos,this.mark)}merge(t){return t instanceof zn&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new zn(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zn(n.from,n.to,t.markFromJSON(n.mark))}};Le.jsonID("removeMark",Xf);var Jf=class Vn extends Le{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return He.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return He.fromReplace(t,this.pos,this.pos+1,new _e(Tt.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.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 Vn(this.pos,n.marks[o]);return new Vn(this.pos,this.mark)}}return new Qf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Vn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vn(n.pos,t.markFromJSON(n.mark))}};Le.jsonID("addNodeMark",Jf);var Qf=class Ti extends Le{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return He.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return He.fromReplace(t,this.pos,this.pos+1,new _e(Tt.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Jf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ti(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ti(n.pos,t.markFromJSON(n.mark))}};Le.jsonID("removeNodeMark",Qf);var Aa=class Lt extends Le{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&Ri(t,this.from,this.to)?He.fail("Structure replace would overwrite content"):He.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new rn([this.from,this.to-this.from,this.slice.size])}invert(t){return new Lt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&Lt.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Lt(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Lt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?_e.empty:new _e(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Lt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?_e.empty:new _e(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Lt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Lt(n.from,n.to,_e.fromJSON(t,n.slice),!!n.structure)}};Aa.MAP_BIAS=1;Le.jsonID("replace",Aa);var ep=class Qr extends Le{constructor(t,n,r,o,s,i,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=a}apply(t){if(this.structure&&(Ri(t,this.from,this.gapFrom)||Ri(t,this.gapTo,this.to)))return He.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return He.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?He.fromReplace(t,this.from,this.to,r):He.fail("Content does not fit in gap")}getMap(){return new rn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Qr(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new Qr(n.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 Qr(n.from,n.to,n.gapFrom,n.gapTo,_e.fromJSON(t,n.slice),n.insert,!!n.structure)}};Le.jsonID("replaceAround",ep);function Ri(e,t,n){let r=e.resolve(t),o=n-t,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}var by=class eo extends Le{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return He.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 He.fromReplace(t,this.pos,this.pos+1,new _e(Tt.from(o),0,n.isLeaf?0:1))}getMap(){return rn.empty}invert(t){return new eo(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new eo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new eo(n.pos,n.attr,n.value)}};Le.jsonID("attr",by);var vy=class Mi extends Le{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return He.ok(r)}getMap(){return rn.empty}invert(t){return new Mi(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Mi(n.attr,n.value)}};Le.jsonID("docAttr",vy);var ar=class extends Error{};ar=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};ar.prototype=Object.create(Error.prototype);ar.prototype.constructor=ar;ar.prototype.name="TransformError";var Gs=Object.create(null),Ae=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new yy(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=_e.empty){let n=t.content.lastChild,r=null;for(let i=0;i<t.openEnd;i++)r=n,n=n.lastChild;let o=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:a,$to:c}=s[i],l=e.mapping.slice(o);e.replaceRange(l.map(a.pos),l.map(c.pos),i?_e.empty:t),i==0&&Gl(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:s,$to:i}=r[o],a=e.mapping.slice(n),c=a.map(s.pos),l=a.map(i.pos);o?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),Gl(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new An(e):vn(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let s=t<0?vn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):vn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new er(e.node(0))}static atStart(e){return vn(e,e,0,0,1)||new er(e)}static atEnd(e){return vn(e,e,e.content.size,e.childCount,-1)||new er(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Gs[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Gs)throw new RangeError("Duplicate use of selection JSON ID "+e);return Gs[e]=t,t.prototype.jsonID=e,t}getBookmark(){return An.between(this.$anchor,this.$head).getBookmark()}};Ae.prototype.visible=!0;var yy=class{constructor(e,t){this.$from=e,this.$to=t}},Kl=!1;function Wl(e){!Kl&&!e.parent.inlineContent&&(Kl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var An=class Kn extends Ae{constructor(t,n=t){Wl(t),Wl(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ae.near(r);let o=t.resolve(n.map(this.anchor));return new Kn(o.parent.inlineContent?o:r,r)}replace(t,n=_e.empty){if(super.replace(t,n),n==_e.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Kn&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new tp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Kn(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let o=t.resolve(n);return new this(o,r==n?o:t.resolve(r))}static between(t,n,r){let o=t.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let s=Ae.findFrom(n,r,!0)||Ae.findFrom(n,-r,!0);if(s)n=s.$head;else return Ae.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(Ae.findFrom(t,-r,!0)||Ae.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new Kn(t,n)}};Ae.jsonID("text",An);var tp=class np{constructor(t,n){this.anchor=t,this.head=n}map(t){return new np(t.map(this.anchor),t.map(this.head))}resolve(t){return An.between(t.resolve(this.anchor),t.resolve(this.head))}},Tn=class Wn extends Ae{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),s=t.resolve(o);return r?Ae.near(s):new Wn(s)}content(){return new _e(Tt.from(this.node),0,0)}eq(t){return t instanceof Wn&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ey(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Wn(t.resolve(n.anchor))}static create(t,n){return new Wn(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}};Tn.prototype.visible=!1;Ae.jsonID("node",Tn);var Ey=class rp{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new tp(r,r):new rp(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Tn.isSelectable(r)?new Tn(n):Ae.near(n)}},er=class to extends Ae{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=_e.empty){if(n==_e.empty){t.delete(0,t.doc.content.size);let r=Ae.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new to(t)}map(t){return new to(t)}eq(t){return t instanceof to}getBookmark(){return Cy}};Ae.jsonID("all",er);var Cy={map(){return this},resolve(e){return new er(e)}};function vn(e,t,n,r,o,s=!1){if(t.inlineContent)return An.create(e,n);for(let i=r-(o>0?0:1);o>0?i<t.childCount:i>=0;i+=o){let a=t.child(i);if(a.isAtom){if(!s&&Tn.isSelectable(a))return Tn.create(e,n-(o<0?a.nodeSize:0))}else{let c=vn(e,a,n+o,o<0?a.childCount:0,o,s);if(c)return c}n+=a.nodeSize*o}return null}function Gl(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof Aa||o instanceof ep))return;let s=e.mapping.maps[r],i;s.forEach((a,c,l,d)=>{i==null&&(i=d)}),e.setSelection(Ae.near(e.doc.resolve(i),n))}function Zl(e,t){return!t||!e?e:e.bind(t)}var Fr=class{constructor(e,t,n){this.name=e,this.init=Zl(t.init,n),this.apply=Zl(t.apply,n)}};new Fr("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Fr("selection",{init(e,t){return e.selection||Ae.atStart(t.doc)},apply(e){return e.selection}}),new Fr("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Fr("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var wy=(e,t)=>{var n;const{state:r,view:o}=e,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const a=i.depth-1,c=i.node(a),l=i.index(a);if(l===0)return!1;if(c.type===t)return e.commands.lift(t.name);const d=c.child(l-1);if(d.type!==t||!((n=d.lastChild)!=null&&n.isTextblock))return!1;const f=i.before(),p=f-1-1,{tr:m}=r;return m.delete(f,i.after()).insert(p,i.parent.content),m.setSelection(An.create(m.doc,p)),o.dispatch(m.scrollIntoView()),!0},xy=/^\s*>\s$/,_y=w.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return no.jsx("blockquote",{...w.mergeAttributes(this.options.HTMLAttributes,e),children:no.jsx("slot",{})})},parseMarkdown:(e,t)=>{var n;const r=(n=t.parseBlockChildren)!=null?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",r=[];return e.content.forEach((o,s)=>{var i,a;const d=((a=(i=t.renderChild)==null?void 0:i.call(t,o,s))!=null?a:t.renderChildren([o])).split(`
48
+ `).map(f=>f.trim()===""?n:`${n} ${f}`);r.push(d.join(`
49
+ `))}),r.join(`
50
+ ${n}
51
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>wy(this.editor,this.type)}},addInputRules(){return[w.wrappingInputRule({find:xy,type:this.type})]}}),Sy=_y;const Ny=Sy.extend({addAttributes(){return{...this.parent?.(),style:{default:"bar",parseHTML:e=>e.getAttribute("data-style")??"bar",renderHTML:e=>({"data-style":e.style})}}}});var Ay=Object.defineProperty,Ty=(e,t)=>{for(var n in t)Ay(e,n,{get:t[n],enumerable:!0})},Ry="listItem",ql="textStyle",Yl=/^\s*([-+*])\s$/,My=w.Node.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:e}){return["ul",w.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
52
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ry,this.editor.getAttributes(ql)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=w.wrappingInputRule({find:Yl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=w.wrappingInputRule({find:Yl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ql),editor:this.editor})),[e]}}),ky=(e,t,n)=>{const{selection:r}=e;if(!r.empty)return null;const{$from:o}=r;if(!o.parent.isTextblock||o.parentOffset!==o.parent.content.size)return null;let s=-1;for(let p=o.depth;p>0;p-=1)if(o.node(p).type.name===t){s=p;break}if(s<0)return null;const i=o.node(s),a=o.index(s);if(a+1>=i.childCount)return null;const c=i.child(a+1);if(!n.includes(c.type.name))return null;const l=e.schema.nodes[t];let d=!1;if(c.forEach(p=>{p.type===l&&p.childCount>1&&(d=!0)}),!d)return null;const f=e.doc.resolve(o.after()).nodeAfter;if(!f||!n.includes(f.type.name))return null;const h=[];return f.forEach(p=>{h.push(p)}),h.length===0?null:{listItemDepth:s,nestedList:f,nestedListPos:o.after(),insertPos:o.after(s),items:h}},Oy=(e,t,n,r)=>{const o=ky(e,n,r);if(!o)return!1;const{selection:s}=e,{nestedList:i,nestedListPos:a,insertPos:c,items:l}=o,d=e.tr;d.delete(a,a+i.nodeSize);const f=d.mapping.map(c);return d.insert(f,Ch.Fragment.from(l)),d.setSelection(s.map(d.doc,d.mapping)),t&&t(d),!0},Iy=(e,t,n)=>Oy(e.state,e.view.dispatch,t,n),op=(e,t)=>w.Extension.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>Iy(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}});function Ly(e){var t,n;const r=(t=e.tokens)==null?void 0:t[0];return!!(e.text&&((n=e.tokens)==null?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===e.text)}function Py(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:"text",raw:e,text:e}])}var Dy=w.Node.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",w.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n;if(e.type!=="list_item")return[];const r=(n=t.parseBlockChildren)!=null?n:t.parseChildren;let o=[];if(e.tokens&&e.tokens.length>0){if(Ly(e))return{type:"listItem",content:[{type:"paragraph",content:Py(e.text||"",t)}]};if(e.tokens.some(i=>i.type==="paragraph"))o=r(e.tokens);else{const i=e.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(o=[{type:"paragraph",content:t.parseInline(i.tokens)}],e.tokens.length>1){const c=e.tokens.slice(1),l=r(c);o.push(...l)}}else o=r(e.tokens)}}return o.length===0&&(o=[{type:"paragraph",content:[]}]),{type:"listItem",content:o}},renderMarkdown:(e,t,n)=>w.renderNestedMarkdownContent(e,t,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),addExtensions(){return[op(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),By={};Ty(By,{findListItemPos:()=>us,getNextListDepth:()=>Ta,handleBackspace:()=>ki,handleDelete:()=>Oi,hasListBefore:()=>sp,hasListItemAfter:()=>Hy,hasListItemBefore:()=>Fy,listItemHasSubList:()=>$y,nextListIsDeeper:()=>ip,nextListIsHigher:()=>ap});var us=(e,t)=>{const{$from:n}=t.selection,r=w.getNodeType(e,t.schema);let o=null,s=n.depth,i=n.pos,a=null;for(;s>0&&a===null;)o=n.node(s),o.type===r?a=s:(s-=1,i-=1);return a===null?null:{$pos:t.doc.resolve(i),depth:a}},Ta=(e,t)=>{const n=us(e,t);if(!n)return!1;const[,r]=w.getNodeAtPosition(t,e,n.$pos.pos+4);return r},sp=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),s=e.doc.resolve(o).node();return!(!s||!n.includes(s.type.name))},ki=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!w.isNodeActive(e.state,t)&&sp(e.state,t,n)){const{$anchor:r}=e.state.selection,o=e.state.doc.resolve(r.before()-1),s=[];o.node().descendants((c,l)=>{c.type.name===t&&s.push({node:c,pos:l})});const i=s.at(-1);if(!i)return!1;const a=e.state.doc.resolve(o.start()+i.pos+1);return e.chain().cut({from:r.start()-1,to:r.end()+1},a.end()).joinForward().run()}return!w.isNodeActive(e.state,t)||!w.isAtStartOfNode(e.state)?!1:e.chain().liftListItem(t).run()},ip=(e,t)=>{const n=Ta(e,t),r=us(e,t);return!r||!n?!1:n>r.depth},ap=(e,t)=>{const n=Ta(e,t),r=us(e,t);return!r||!n?!1:n<r.depth},Oi=(e,t)=>{if(!w.isNodeActive(e.state,t)||!w.isAtEndOfNode(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:ip(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():ap(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Hy=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==e)},Fy=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==e)},$y=(e,t,n)=>{if(!n)return!1;const r=w.getNodeType(e,t.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},Uy=w.Extension.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&Oi(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&Oi(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&ki(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&ki(e,n,r)&&(t=!0)}),t}}}}),Xl=/^(\s*)(\d+)\.\s+(.*)$/,jy=/^\s/;function zy(e){const t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function Vy(e){const t=[],n=[];let r=!1;return e.forEach(o=>{if(r){n.push(o);return}if(o.trim()===""){r=!0,n.push(o);return}if(t.length>0&&zy(o)){r=!0,n.push(o);return}t.push(o)}),{paragraphLines:t,blockLines:n}}function Ky(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],s=o.match(Xl);if(!s)break;const[,i,a,c]=s,l=i.length,d=[c];let f=n+1;const h=[o];let p=!1;for(;f<e.length;){const m=e[f];if(m.match(Xl))break;if(m.trim()==="")h.push(m),d.push(""),p=!0,f+=1;else if(m.match(jy))h.push(m),d.push(m.slice(l+2)),f+=1;else{if(p)break;h.push(m),d.push(m),f+=1}}t.push({indent:l,number:parseInt(a,10),content:d.join(`
53
+ `).trim(),contentLines:d,raw:h.join(`
54
+ `)}),r=f,n=f}return[t,r]}function lp(e,t,n){const r=[];let o=0;for(;o<e.length;){const s=e[o];if(s.indent===t){const{paragraphLines:i,blockLines:a}=Vy(s.contentLines),c=i.join(`
55
+ `).trim(),l=[];c&&l.push({type:"paragraph",raw:c,tokens:n.inlineTokens(c)});const d=a.join(`
56
+ `).trim();if(d){const p=n.blockTokens(d);l.push(...p)}let f=o+1;const h=[];for(;f<e.length&&e[f].indent>t;)h.push(e[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=lp(h,p,n);l.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
57
+ `)})}r.push({type:"list_item",raw:s.raw,tokens:l}),o=f}else o+=1}return r}function Wy(e,t){return e.map(n=>{if(n.type!=="list_item")return t.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(...t.parseChildren([o]));else if(o.type==="text"&&o.tokens){const s=t.parseChildren([o]);r.push({type:"paragraph",content:s})}else{const s=t.parseChildren([o]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var Gy="listItem",Jl="textStyle",Ql=/^(\d+)\.\s$/,Zy=w.Node.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",w.mergeAttributes(this.options.HTMLAttributes,n),0]:["ol",w.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const n=e.start||1,r=e.items?Wy(e.items,t):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
58
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t?.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split(`
59
+ `),[s,i]=Ky(o);if(s.length===0)return;const a=lp(s,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:o.slice(0,i).join(`
60
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Gy,this.editor.getAttributes(Jl)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=w.wrappingInputRule({find:Ql,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=w.wrappingInputRule({find:Ql,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Jl)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),qy=/^\s*(\[([( |x])?\])\s$/,Yy=w.Node.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:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",w.mergeAttributes(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const o=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return w.renderNestedMarkdownContent(e,t,o)},addExtensions(){return this.options.nested?[op(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),l=f=>{var h,p;a.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,f,a.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};l(e),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{o.setAttribute(f,h)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,s.append(a,i),o.append(s,c),Object.entries(t).forEach(([f,h])=>{o.setAttribute(f,h)});let d=new Set(Object.keys(t));return{dom:o,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,l(f);const h=r.extensionManager.attributes,p=w.getRenderedAttributes(f,h),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return d.forEach(b=>{m.has(b)||(b in g?o.setAttribute(b,g[b]):o.removeAttribute(b))}),Object.entries(p).forEach(([b,v])=>{v==null?b in g?o.setAttribute(b,g[b]):o.removeAttribute(b):o.setAttribute(b,v)}),d=m,!0}}}},addInputRules(){return[w.wrappingInputRule({find:qy,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Xy=w.Node.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:e}){return["ul",w.mergeAttributes(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
61
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const r=s=>{const i=w.parseIndentedBlocks(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(s)},o=w.parseIndentedBlocks(e,{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:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Jy=w.Extension.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(My.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Dy.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Uy.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Zy.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Yy.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Xy.configure(this.options.taskList)),e}}),Zs=4,Qy=/^```([a-z]+)?[\s\n]$/,eE=/^~~~([a-z]+)?[\s\n]$/,tE=w.Node.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Zs,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((t=e.firstElementChild)==null?void 0:t.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:e,HTMLAttributes:t}){return["pre",w.mergeAttributes(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return((n=e.raw)==null?void 0:n.startsWith("```"))===!1&&((r=e.raw)==null?void 0:r.startsWith("~~~"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=((n=e.attrs)==null?void 0:n.language)||"";return e.content?r=[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join(`
62
+ `):r=`\`\`\`${o}
63
+
64
+ \`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Zs,{state:r}=e,{selection:o}=r,{$from:s,empty:i}=o;if(s.parent.type!==this.type)return!1;const a=" ".repeat(n);return i?e.commands.insertContent(a):e.commands.command(({tr:c})=>{const{from:l,to:d}=o,p=r.doc.textBetween(l,d,`
65
+ `,`
66
+ `).split(`
67
+ `).map(m=>a+m).join(`
68
+ `);return c.replaceWith(l,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:Zs,{state:r}=e,{selection:o}=r,{$from:s,empty:i}=o;return s.parent.type!==this.type?!1:i?e.commands.command(({tr:a})=>{var c;const{pos:l}=s,d=s.start(),f=s.end(),p=r.doc.textBetween(d,f,`
69
+ `,`
70
+ `).split(`
71
+ `);let m=0,g=0;const b=l-d;for(let A=0;A<p.length;A+=1){if(g+p[A].length>=b){m=A;break}g+=p[A].length+1}const E=((c=p[m].match(/^ */))==null?void 0:c[0])||"",_=Math.min(E.length,n);if(_===0)return!0;let S=d;for(let A=0;A<m;A+=1)S+=p[A].length+1;return a.delete(S,S+_),l-S<=_&&a.setSelection(Q.TextSelection.create(a.doc,S)),!0}):e.commands.command(({tr:a})=>{const{from:c,to:l}=o,h=r.doc.textBetween(c,l,`
72
+ `,`
73
+ `).split(`
74
+ `).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",b=Math.min(g.length,n);return p.slice(b)}).join(`
75
+ `);return a.replaceWith(c,l,r.schema.text(h)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$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(`
76
+
77
+ `);return!s||!i?!1:e.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?e.commands.command(({tr:l})=>(l.setSelection(Q.Selection.near(r.resolve(a))),!0)):e.commands.exitCode()}}},addInputRules(){return[w.textblockTypeInputRule({find:Qy,type:this.type,getAttributes:e=>({language:e[1]})}),w.textblockTypeInputRule({find:eE,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Q.Plugin({key:new Q.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!n||!s)return!1;const{tr:i,schema:a}=e.state,c=a.text(n.replace(/\r\n?/g,`
78
+ `));return i.replaceSelectionWith(this.type.create({language:s},c)),i.selection.$from.parent.type!==this.type&&i.setSelection(Q.TextSelection.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),e.dispatch(i),!0}}})]}});function nE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qs,ec;function rE(){if(ec)return qs;ec=1;function e(C){return C instanceof Map?C.clear=C.delete=C.set=function(){throw new Error("map is read-only")}:C instanceof Set&&(C.add=C.clear=C.delete=function(){throw new Error("set is read-only")}),Object.freeze(C),Object.getOwnPropertyNames(C).forEach(M=>{const B=C[M],te=typeof B;(te==="object"||te==="function")&&!Object.isFrozen(B)&&e(B)}),C}class t{constructor(M){M.data===void 0&&(M.data={}),this.data=M.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(C){return C.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(C,...M){const B=Object.create(null);for(const te in C)B[te]=C[te];return M.forEach(function(te){for(const Ce in te)B[Ce]=te[Ce]}),B}const o="</span>",s=C=>!!C.scope,i=(C,{prefix:M})=>{if(C.startsWith("language:"))return C.replace("language:","language-");if(C.includes(".")){const B=C.split(".");return[`${M}${B.shift()}`,...B.map((te,Ce)=>`${te}${"_".repeat(Ce+1)}`)].join(" ")}return`${M}${C}`};class a{constructor(M,B){this.buffer="",this.classPrefix=B.classPrefix,M.walk(this)}addText(M){this.buffer+=n(M)}openNode(M){if(!s(M))return;const B=i(M.scope,{prefix:this.classPrefix});this.span(B)}closeNode(M){s(M)&&(this.buffer+=o)}value(){return this.buffer}span(M){this.buffer+=`<span class="${M}">`}}const c=(C={})=>{const M={children:[]};return Object.assign(M,C),M};class l{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(M){this.top.children.push(M)}openNode(M){const B=c({scope:M});this.add(B),this.stack.push(B)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(M){return this.constructor._walk(M,this.rootNode)}static _walk(M,B){return typeof B=="string"?M.addText(B):B.children&&(M.openNode(B),B.children.forEach(te=>this._walk(M,te)),M.closeNode(B)),M}static _collapse(M){typeof M!="string"&&M.children&&(M.children.every(B=>typeof B=="string")?M.children=[M.children.join("")]:M.children.forEach(B=>{l._collapse(B)}))}}class d extends l{constructor(M){super(),this.options=M}addText(M){M!==""&&this.add(M)}startScope(M){this.openNode(M)}endScope(){this.closeNode()}__addSublanguage(M,B){const te=M.root;B&&(te.scope=`language:${B}`),this.add(te)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(C){return C?typeof C=="string"?C:C.source:null}function h(C){return g("(?=",C,")")}function p(C){return g("(?:",C,")*")}function m(C){return g("(?:",C,")?")}function g(...C){return C.map(B=>f(B)).join("")}function b(C){const M=C[C.length-1];return typeof M=="object"&&M.constructor===Object?(C.splice(C.length-1,1),M):{}}function v(...C){return"("+(b(C).capture?"":"?:")+C.map(te=>f(te)).join("|")+")"}function E(C){return new RegExp(C.toString()+"|").exec("").length-1}function _(C,M){const B=C&&C.exec(M);return B&&B.index===0}const S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function N(C,{joinWith:M}){let B=0;return C.map(te=>{B+=1;const Ce=B;let we=f(te),W="";for(;we.length>0;){const z=S.exec(we);if(!z){W+=we;break}W+=we.substring(0,z.index),we=we.substring(z.index+z[0].length),z[0][0]==="\\"&&z[1]?W+="\\"+String(Number(z[1])+Ce):(W+=z[0],z[0]==="("&&B++)}return W}).map(te=>`(${te})`).join(M)}const A=/\b\B/,R="[a-zA-Z]\\w*",O="[a-zA-Z_]\\w*",D="\\b\\d+(\\.\\d+)?",j="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Y="\\b(0b[01]+)",J="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",X=(C={})=>{const M=/^#![ ]*\//;return C.binary&&(C.begin=g(M,/.*\b/,C.binary,/\b.*/)),r({scope:"meta",begin:M,end:/$/,relevance:0,"on:begin":(B,te)=>{B.index!==0&&te.ignoreMatch()}},C)},I={begin:"\\\\[\\s\\S]",relevance:0},$={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[I]},U={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[I]},H={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},T=function(C,M,B={}){const te=r({scope:"comment",begin:C,end:M,contains:[]},B);te.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Ce=v("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return te.contains.push({begin:g(/[ ]+/,"(",Ce,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),te},k=T("//","$"),K=T("/\\*","\\*/"),oe=T("#","$"),Z={scope:"number",begin:D,relevance:0},ce={scope:"number",begin:j,relevance:0},Ke={scope:"number",begin:Y,relevance:0},he={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[I,{begin:/\[/,end:/\]/,relevance:0,contains:[I]}]},ye={scope:"title",begin:R,relevance:0},ue={scope:"title",begin:O,relevance:0},Ze={begin:"\\.\\s*"+O,relevance:0};var st=Object.freeze({__proto__:null,APOS_STRING_MODE:$,BACKSLASH_ESCAPE:I,BINARY_NUMBER_MODE:Ke,BINARY_NUMBER_RE:Y,COMMENT:T,C_BLOCK_COMMENT_MODE:K,C_LINE_COMMENT_MODE:k,C_NUMBER_MODE:ce,C_NUMBER_RE:j,END_SAME_AS_BEGIN:function(C){return Object.assign(C,{"on:begin":(M,B)=>{B.data._beginMatch=M[1]},"on:end":(M,B)=>{B.data._beginMatch!==M[1]&&B.ignoreMatch()}})},HASH_COMMENT_MODE:oe,IDENT_RE:R,MATCH_NOTHING_RE:A,METHOD_GUARD:Ze,NUMBER_MODE:Z,NUMBER_RE:D,PHRASAL_WORDS_MODE:H,QUOTE_STRING_MODE:U,REGEXP_MODE:he,RE_STARTERS_RE:J,SHEBANG:X,TITLE_MODE:ye,UNDERSCORE_IDENT_RE:O,UNDERSCORE_TITLE_MODE:ue});function Wt(C,M){C.input[C.index-1]==="."&&M.ignoreMatch()}function Gt(C,M){C.className!==void 0&&(C.scope=C.className,delete C.className)}function it(C,M){M&&C.beginKeywords&&(C.begin="\\b("+C.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",C.__beforeBegin=Wt,C.keywords=C.keywords||C.beginKeywords,delete C.beginKeywords,C.relevance===void 0&&(C.relevance=0))}function Ln(C,M){Array.isArray(C.illegal)&&(C.illegal=v(...C.illegal))}function ds(C,M){if(C.match){if(C.begin||C.end)throw new Error("begin & end are not supported with match");C.begin=C.match,delete C.match}}function fe(C,M){C.relevance===void 0&&(C.relevance=1)}const ln=(C,M)=>{if(!C.beforeMatch)return;if(C.starts)throw new Error("beforeMatch cannot be used with starts");const B=Object.assign({},C);Object.keys(C).forEach(te=>{delete C[te]}),C.keywords=B.keywords,C.begin=g(B.beforeMatch,h(B.begin)),C.starts={relevance:0,contains:[Object.assign(B,{endsParent:!0})]},C.relevance=0,delete B.beforeMatch},Zt=["of","and","for","in","not","or","if","then","parent","list","value"],fs="keyword";function Oa(C,M,B=fs){const te=Object.create(null);return typeof C=="string"?Ce(B,C.split(" ")):Array.isArray(C)?Ce(B,C):Object.keys(C).forEach(function(we){Object.assign(te,Oa(C[we],M,we))}),te;function Ce(we,W){M&&(W=W.map(z=>z.toLowerCase())),W.forEach(function(z){const ee=z.split("|");te[ee[0]]=[we,Wp(ee[0],ee[1])]})}}function Wp(C,M){return M?Number(M):Gp(C)?0:1}function Gp(C){return Zt.includes(C.toLowerCase())}const Ia={},qt=C=>{console.error(C)},La=(C,...M)=>{console.log(`WARN: ${C}`,...M)},cn=(C,M)=>{Ia[`${C}/${M}`]||(console.log(`Deprecated as of ${C}. ${M}`),Ia[`${C}/${M}`]=!0)},yr=new Error;function Pa(C,M,{key:B}){let te=0;const Ce=C[B],we={},W={};for(let z=1;z<=M.length;z++)W[z+te]=Ce[z],we[z+te]=!0,te+=E(M[z-1]);C[B]=W,C[B]._emit=we,C[B]._multi=!0}function Zp(C){if(Array.isArray(C.begin)){if(C.skip||C.excludeBegin||C.returnBegin)throw qt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),yr;if(typeof C.beginScope!="object"||C.beginScope===null)throw qt("beginScope must be object"),yr;Pa(C,C.begin,{key:"beginScope"}),C.begin=N(C.begin,{joinWith:""})}}function qp(C){if(Array.isArray(C.end)){if(C.skip||C.excludeEnd||C.returnEnd)throw qt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),yr;if(typeof C.endScope!="object"||C.endScope===null)throw qt("endScope must be object"),yr;Pa(C,C.end,{key:"endScope"}),C.end=N(C.end,{joinWith:""})}}function Yp(C){C.scope&&typeof C.scope=="object"&&C.scope!==null&&(C.beginScope=C.scope,delete C.scope)}function Xp(C){Yp(C),typeof C.beginScope=="string"&&(C.beginScope={_wrap:C.beginScope}),typeof C.endScope=="string"&&(C.endScope={_wrap:C.endScope}),Zp(C),qp(C)}function Jp(C){function M(W,z){return new RegExp(f(W),"m"+(C.case_insensitive?"i":"")+(C.unicodeRegex?"u":"")+(z?"g":""))}class B{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(z,ee){ee.position=this.position++,this.matchIndexes[this.matchAt]=ee,this.regexes.push([ee,z]),this.matchAt+=E(z)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const z=this.regexes.map(ee=>ee[1]);this.matcherRe=M(N(z,{joinWith:"|"}),!0),this.lastIndex=0}exec(z){this.matcherRe.lastIndex=this.lastIndex;const ee=this.matcherRe.exec(z);if(!ee)return null;const Ne=ee.findIndex((Pn,hs)=>hs>0&&Pn!==void 0),xe=this.matchIndexes[Ne];return ee.splice(0,Ne),Object.assign(ee,xe)}}class te{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(z){if(this.multiRegexes[z])return this.multiRegexes[z];const ee=new B;return this.rules.slice(z).forEach(([Ne,xe])=>ee.addRule(Ne,xe)),ee.compile(),this.multiRegexes[z]=ee,ee}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(z,ee){this.rules.push([z,ee]),ee.type==="begin"&&this.count++}exec(z){const ee=this.getMatcher(this.regexIndex);ee.lastIndex=this.lastIndex;let Ne=ee.exec(z);if(this.resumingScanAtSamePosition()&&!(Ne&&Ne.index===this.lastIndex)){const xe=this.getMatcher(0);xe.lastIndex=this.lastIndex+1,Ne=xe.exec(z)}return Ne&&(this.regexIndex+=Ne.position+1,this.regexIndex===this.count&&this.considerAll()),Ne}}function Ce(W){const z=new te;return W.contains.forEach(ee=>z.addRule(ee.begin,{rule:ee,type:"begin"})),W.terminatorEnd&&z.addRule(W.terminatorEnd,{type:"end"}),W.illegal&&z.addRule(W.illegal,{type:"illegal"}),z}function we(W,z){const ee=W;if(W.isCompiled)return ee;[Gt,ds,Xp,ln].forEach(xe=>xe(W,z)),C.compilerExtensions.forEach(xe=>xe(W,z)),W.__beforeBegin=null,[it,Ln,fe].forEach(xe=>xe(W,z)),W.isCompiled=!0;let Ne=null;return typeof W.keywords=="object"&&W.keywords.$pattern&&(W.keywords=Object.assign({},W.keywords),Ne=W.keywords.$pattern,delete W.keywords.$pattern),Ne=Ne||/\w+/,W.keywords&&(W.keywords=Oa(W.keywords,C.case_insensitive)),ee.keywordPatternRe=M(Ne,!0),z&&(W.begin||(W.begin=/\B|\b/),ee.beginRe=M(ee.begin),!W.end&&!W.endsWithParent&&(W.end=/\B|\b/),W.end&&(ee.endRe=M(ee.end)),ee.terminatorEnd=f(ee.end)||"",W.endsWithParent&&z.terminatorEnd&&(ee.terminatorEnd+=(W.end?"|":"")+z.terminatorEnd)),W.illegal&&(ee.illegalRe=M(W.illegal)),W.contains||(W.contains=[]),W.contains=[].concat(...W.contains.map(function(xe){return Qp(xe==="self"?W:xe)})),W.contains.forEach(function(xe){we(xe,ee)}),W.starts&&we(W.starts,z),ee.matcher=Ce(ee),ee}if(C.compilerExtensions||(C.compilerExtensions=[]),C.contains&&C.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return C.classNameAliases=r(C.classNameAliases||{}),we(C)}function Da(C){return C?C.endsWithParent||Da(C.starts):!1}function Qp(C){return C.variants&&!C.cachedVariants&&(C.cachedVariants=C.variants.map(function(M){return r(C,{variants:null},M)})),C.cachedVariants?C.cachedVariants:Da(C)?r(C,{starts:C.starts?r(C.starts):null}):Object.isFrozen(C)?r(C):C}var eh="11.11.1";class th extends Error{constructor(M,B){super(M),this.name="HTMLInjectionError",this.html=B}}const ps=n,Ba=r,Ha=Symbol("nomatch"),nh=7,Fa=function(C){const M=Object.create(null),B=Object.create(null),te=[];let Ce=!0;const we="Could not find the language '{}', did you forget to load/include a language module?",W={disableAutodetect:!0,name:"Plain text",contains:[]};let z={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function ee(P){return z.noHighlightRe.test(P)}function Ne(P){let q=P.className+" ";q+=P.parentNode?P.parentNode.className:"";const le=z.languageDetectRe.exec(q);if(le){const ge=Rt(le[1]);return ge||(La(we.replace("{}",le[1])),La("Falling back to no-highlight mode for this block.",P)),ge?le[1]:"no-highlight"}return q.split(/\s+/).find(ge=>ee(ge)||Rt(ge))}function xe(P,q,le){let ge="",Se="";typeof q=="object"?(ge=P,le=q.ignoreIllegals,Se=q.language):(cn("10.7.0","highlight(lang, code, ...args) has been deprecated."),cn("10.7.0",`Please use highlight(code, options) instead.
79
+ https://github.com/highlightjs/highlight.js/issues/2277`),Se=P,ge=q),le===void 0&&(le=!0);const tt={code:ge,language:Se};Cr("before:highlight",tt);const Mt=tt.result?tt.result:Pn(tt.language,tt.code,le);return Mt.code=tt.code,Cr("after:highlight",Mt),Mt}function Pn(P,q,le,ge){const Se=Object.create(null);function tt(F,G){return F.keywords[G]}function Mt(){if(!re.keywords){Te.addText(me);return}let F=0;re.keywordPatternRe.lastIndex=0;let G=re.keywordPatternRe.exec(me),se="";for(;G;){se+=me.substring(F,G.index);const de=lt.case_insensitive?G[0].toLowerCase():G[0],Me=tt(re,de);if(Me){const[Et,yh]=Me;if(Te.addText(se),se="",Se[de]=(Se[de]||0)+1,Se[de]<=nh&&(_r+=yh),Et.startsWith("_"))se+=G[0];else{const Eh=lt.classNameAliases[Et]||Et;at(G[0],Eh)}}else se+=G[0];F=re.keywordPatternRe.lastIndex,G=re.keywordPatternRe.exec(me)}se+=me.substring(F),Te.addText(se)}function wr(){if(me==="")return;let F=null;if(typeof re.subLanguage=="string"){if(!M[re.subLanguage]){Te.addText(me);return}F=Pn(re.subLanguage,me,!0,Ga[re.subLanguage]),Ga[re.subLanguage]=F._top}else F=gs(me,re.subLanguage.length?re.subLanguage:null);re.relevance>0&&(_r+=F.relevance),Te.__addSublanguage(F._emitter,F.language)}function We(){re.subLanguage!=null?wr():Mt(),me=""}function at(F,G){F!==""&&(Te.startScope(G),Te.addText(F),Te.endScope())}function za(F,G){let se=1;const de=G.length-1;for(;se<=de;){if(!F._emit[se]){se++;continue}const Me=lt.classNameAliases[F[se]]||F[se],Et=G[se];Me?at(Et,Me):(me=Et,Mt(),me=""),se++}}function Va(F,G){return F.scope&&typeof F.scope=="string"&&Te.openNode(lt.classNameAliases[F.scope]||F.scope),F.beginScope&&(F.beginScope._wrap?(at(me,lt.classNameAliases[F.beginScope._wrap]||F.beginScope._wrap),me=""):F.beginScope._multi&&(za(F.beginScope,G),me="")),re=Object.create(F,{parent:{value:re}}),re}function Ka(F,G,se){let de=_(F.endRe,se);if(de){if(F["on:end"]){const Me=new t(F);F["on:end"](G,Me),Me.isMatchIgnored&&(de=!1)}if(de){for(;F.endsParent&&F.parent;)F=F.parent;return F}}if(F.endsWithParent)return Ka(F.parent,G,se)}function hh(F){return re.matcher.regexIndex===0?(me+=F[0],1):(ys=!0,0)}function gh(F){const G=F[0],se=F.rule,de=new t(se),Me=[se.__beforeBegin,se["on:begin"]];for(const Et of Me)if(Et&&(Et(F,de),de.isMatchIgnored))return hh(G);return se.skip?me+=G:(se.excludeBegin&&(me+=G),We(),!se.returnBegin&&!se.excludeBegin&&(me=G)),Va(se,F),se.returnBegin?0:G.length}function mh(F){const G=F[0],se=q.substring(F.index),de=Ka(re,F,se);if(!de)return Ha;const Me=re;re.endScope&&re.endScope._wrap?(We(),at(G,re.endScope._wrap)):re.endScope&&re.endScope._multi?(We(),za(re.endScope,F)):Me.skip?me+=G:(Me.returnEnd||Me.excludeEnd||(me+=G),We(),Me.excludeEnd&&(me=G));do re.scope&&Te.closeNode(),!re.skip&&!re.subLanguage&&(_r+=re.relevance),re=re.parent;while(re!==de.parent);return de.starts&&Va(de.starts,F),Me.returnEnd?0:G.length}function bh(){const F=[];for(let G=re;G!==lt;G=G.parent)G.scope&&F.unshift(G.scope);F.forEach(G=>Te.openNode(G))}let xr={};function Wa(F,G){const se=G&&G[0];if(me+=F,se==null)return We(),0;if(xr.type==="begin"&&G.type==="end"&&xr.index===G.index&&se===""){if(me+=q.slice(G.index,G.index+1),!Ce){const de=new Error(`0 width match regex (${P})`);throw de.languageName=P,de.badRule=xr.rule,de}return 1}if(xr=G,G.type==="begin")return gh(G);if(G.type==="illegal"&&!le){const de=new Error('Illegal lexeme "'+se+'" for mode "'+(re.scope||"<unnamed>")+'"');throw de.mode=re,de}else if(G.type==="end"){const de=mh(G);if(de!==Ha)return de}if(G.type==="illegal"&&se==="")return me+=`
80
+ `,1;if(vs>1e5&&vs>G.index*3)throw new Error("potential infinite loop, way more iterations than matches");return me+=se,se.length}const lt=Rt(P);if(!lt)throw qt(we.replace("{}",P)),new Error('Unknown language: "'+P+'"');const vh=Jp(lt);let bs="",re=ge||vh;const Ga={},Te=new z.__emitter(z);bh();let me="",_r=0,Yt=0,vs=0,ys=!1;try{if(lt.__emitTokens)lt.__emitTokens(q,Te);else{for(re.matcher.considerAll();;){vs++,ys?ys=!1:re.matcher.considerAll(),re.matcher.lastIndex=Yt;const F=re.matcher.exec(q);if(!F)break;const G=q.substring(Yt,F.index),se=Wa(G,F);Yt=F.index+se}Wa(q.substring(Yt))}return Te.finalize(),bs=Te.toHTML(),{language:P,value:bs,relevance:_r,illegal:!1,_emitter:Te,_top:re}}catch(F){if(F.message&&F.message.includes("Illegal"))return{language:P,value:ps(q),illegal:!0,relevance:0,_illegalBy:{message:F.message,index:Yt,context:q.slice(Yt-100,Yt+100),mode:F.mode,resultSoFar:bs},_emitter:Te};if(Ce)return{language:P,value:ps(q),illegal:!1,relevance:0,errorRaised:F,_emitter:Te,_top:re};throw F}}function hs(P){const q={value:ps(P),illegal:!1,relevance:0,_top:W,_emitter:new z.__emitter(z)};return q._emitter.addText(P),q}function gs(P,q){q=q||z.languages||Object.keys(M);const le=hs(P),ge=q.filter(Rt).filter(ja).map(We=>Pn(We,P,!1));ge.unshift(le);const Se=ge.sort((We,at)=>{if(We.relevance!==at.relevance)return at.relevance-We.relevance;if(We.language&&at.language){if(Rt(We.language).supersetOf===at.language)return 1;if(Rt(at.language).supersetOf===We.language)return-1}return 0}),[tt,Mt]=Se,wr=tt;return wr.secondBest=Mt,wr}function rh(P,q,le){const ge=q&&B[q]||le;P.classList.add("hljs"),P.classList.add(`language-${ge}`)}function ms(P){let q=null;const le=Ne(P);if(ee(le))return;if(Cr("before:highlightElement",{el:P,language:le}),P.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",P);return}if(P.children.length>0&&(z.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(P)),z.throwUnescapedHTML))throw new th("One of your code blocks includes unescaped HTML.",P.innerHTML);q=P;const ge=q.textContent,Se=le?xe(ge,{language:le,ignoreIllegals:!0}):gs(ge);P.innerHTML=Se.value,P.dataset.highlighted="yes",rh(P,le,Se.language),P.result={language:Se.language,re:Se.relevance,relevance:Se.relevance},Se.secondBest&&(P.secondBest={language:Se.secondBest.language,relevance:Se.secondBest.relevance}),Cr("after:highlightElement",{el:P,result:Se,text:ge})}function oh(P){z=Ba(z,P)}const sh=()=>{Er(),cn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ih(){Er(),cn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let $a=!1;function Er(){function P(){Er()}if(document.readyState==="loading"){$a||window.addEventListener("DOMContentLoaded",P,!1),$a=!0;return}document.querySelectorAll(z.cssSelector).forEach(ms)}function ah(P,q){let le=null;try{le=q(C)}catch(ge){if(qt("Language definition for '{}' could not be registered.".replace("{}",P)),Ce)qt(ge);else throw ge;le=W}le.name||(le.name=P),M[P]=le,le.rawDefinition=q.bind(null,C),le.aliases&&Ua(le.aliases,{languageName:P})}function lh(P){delete M[P];for(const q of Object.keys(B))B[q]===P&&delete B[q]}function ch(){return Object.keys(M)}function Rt(P){return P=(P||"").toLowerCase(),M[P]||M[B[P]]}function Ua(P,{languageName:q}){typeof P=="string"&&(P=[P]),P.forEach(le=>{B[le.toLowerCase()]=q})}function ja(P){const q=Rt(P);return q&&!q.disableAutodetect}function uh(P){P["before:highlightBlock"]&&!P["before:highlightElement"]&&(P["before:highlightElement"]=q=>{P["before:highlightBlock"](Object.assign({block:q.el},q))}),P["after:highlightBlock"]&&!P["after:highlightElement"]&&(P["after:highlightElement"]=q=>{P["after:highlightBlock"](Object.assign({block:q.el},q))})}function dh(P){uh(P),te.push(P)}function fh(P){const q=te.indexOf(P);q!==-1&&te.splice(q,1)}function Cr(P,q){const le=P;te.forEach(function(ge){ge[le]&&ge[le](q)})}function ph(P){return cn("10.7.0","highlightBlock will be removed entirely in v12.0"),cn("10.7.0","Please use highlightElement now."),ms(P)}Object.assign(C,{highlight:xe,highlightAuto:gs,highlightAll:Er,highlightElement:ms,highlightBlock:ph,configure:oh,initHighlighting:sh,initHighlightingOnLoad:ih,registerLanguage:ah,unregisterLanguage:lh,listLanguages:ch,getLanguage:Rt,registerAliases:Ua,autoDetection:ja,inherit:Ba,addPlugin:dh,removePlugin:fh}),C.debugMode=function(){Ce=!1},C.safeMode=function(){Ce=!0},C.versionString=eh,C.regex={concat:g,lookahead:h,either:v,optional:m,anyNumberOfTimes:p};for(const P in st)typeof st[P]=="object"&&e(st[P]);return Object.assign(C,st),C},un=Fa({});return un.newInstance=()=>Fa({}),qs=un,un.HighlightJS=un,un.default=un,qs}var oE=rE();const cp=nE(oE);function up(e,t=[]){return e.flatMap(n=>{const r=[...t,...n.properties?n.properties.className:[]];return n.children?up(n.children,r):{text:n.value,classes:r}})}function tc(e){return e.value||e.children||[]}function sE(e){return!!cp.getLanguage(e)}function nc({doc:e,name:t,lowlight:n,defaultLanguage:r}){const o=[];return w.findChildren(e,s=>s.type.name===t).forEach(s=>{var i;let a=s.pos+1;const c=s.node.attrs.language||r,l=n.listLanguages(),d=c&&(l.includes(c)||sE(c)||(i=n.registered)!=null&&i.call(n,c))?tc(n.highlight(c,s.node.textContent)):tc(n.highlightAuto(s.node.textContent));up(d).forEach(f=>{const h=a+f.text.length;if(f.classes.length){const p=nt.Decoration.inline(a,h,{class:f.classes.join(" ")});o.push(p)}a=h})}),nt.DecorationSet.create(e,o)}function iE(e){return typeof e=="function"}function aE({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(o=>iE(t[o])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Q.Plugin({key:new Q.PluginKey("lowlight"),state:{init:(o,{doc:s})=>nc({doc:s,name:e,lowlight:t,defaultLanguage:n}),apply:(o,s,i,a)=>{const c=i.selection.$head.parent.type.name,l=a.selection.$head.parent.type.name,d=w.findChildren(i.doc,h=>h.type.name===e),f=w.findChildren(a.doc,h=>h.type.name===e);return o.docChanged&&([c,l].includes(e)||f.length!==d.length||o.steps.some(h=>h.from!==void 0&&h.to!==void 0&&d.some(p=>p.pos>=h.from&&p.pos+p.node.nodeSize<=h.to)))?nc({doc:o.doc,name:e,lowlight:t,defaultLanguage:n}):s.map(o.mapping,o.doc)}},props:{decorations(o){return r.getState(o)}}});return r}var lE=tE.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...((e=this.parent)==null?void 0:e.call(this))||[],aE({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),cE=lE;function uE(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},p=t.optional(o)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],v=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],S={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:v},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},A=[N,f,a,n,e.C_BLOCK_COMMENT_MODE,d,l],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:A.concat([{begin:/\(/,end:/\)/,keywords:S,contains:A.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+i+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[l,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,l,d,a,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,l,d,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:S,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,O,N,A,[f,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:S,contains:["self",a]},{begin:e.IDENT_RE+"::",keywords:S},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function dE(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=uE(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function fE(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),i={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,o]};o.contains.push(a);const c={match:/\\"/},l={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],b=["true","false"],v={match:/(\/[a-z._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],_=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],S=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],N=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:b,built_in:[...E,..._,"set","shopt",...S,...N]},contains:[p,e.SHEBANG(),m,f,s,i,v,a,c,l,d,n]}}function pE(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",i="("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},p=t.optional(o)+e.IDENT_RE+"\\s*\\(",b={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},v=[f,a,n,e.C_BLOCK_COMMENT_MODE,d,l],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:v.concat([{begin:/\(/,end:/\)/,keywords:b,contains:v.concat(["self"]),relevance:0}]),relevance:0},_={begin:"("+i+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,l,d,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,l,d,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(E,_,v,[f,{begin:e.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:l,keywords:b}}}function hE(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},p=t.optional(o)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],v=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],S={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:v},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},A=[N,f,a,n,e.C_BLOCK_COMMENT_MODE,d,l],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:A.concat([{begin:/\(/,end:/\)/,keywords:S,contains:A.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+i+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[l,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,l,d,a,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,l,d,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:S,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,O,N,A,[f,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:S,contains:["self",a]},{begin:e.IDENT_RE+"::",keywords:S},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function gE(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],o=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],i={keyword:o.concat(s),built_in:t,literal:r},a=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},l={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:i},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},b=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[b,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const v={variants:[l,g,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},_=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",S={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:i,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},v,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+_+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:i,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,relevance:0,contains:[v,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},S]}}const mE=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),bE=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],vE=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],yE=[...bE,...vE],EE=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),CE=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),wE=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),xE=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _E(e){const t=e.regex,n=mE(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",s=/@-?\w[\w]*(-\w+)*/,i="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+i,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+CE.join("|")+")"},{begin:":(:)?("+wE.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+xE.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:EE.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+yE.join("|")+")\\b"}]}}function SE(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function NE(e){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function AE(e){const t=e.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(n,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function TE(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const o={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},i={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,s,o,i,n,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,l=/"(\\"|[^"])*"/,d=/'[^']*'/,f=t.either(c,l,d),h=t.concat(f,"(\\s*\\.\\s*",f,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:h,className:"attr",starts:{end:/$/,contains:[r,a,s,o,i,n]}}]}}var yn="[0-9](_*[0-9])*",$r=`\\.(${yn})`,Ur="[0-9a-fA-F](_*[0-9a-fA-F])*",rc={className:"number",variants:[{begin:`(\\b(${yn})((${$r})|\\.)?|(${$r}))[eE][+-]?(${yn})[fFdD]?\\b`},{begin:`\\b(${yn})((${$r})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${$r})[fFdD]?\\b`},{begin:`\\b(${yn})[fFdD]\\b`},{begin:`\\b0[xX]((${Ur})\\.?|(${Ur})?\\.(${Ur}))[pP][+-]?(${yn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Ur})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function dp(e,t,n){return n===-1?"":e.replace(t,r=>dp(e,t,n-1))}function RE(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+dp("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},l={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,rc,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},rc,l]}}const oc="[A-Za-z$_][0-9A-Za-z$_]*",ME=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],kE=["true","false","null","undefined","NaN","Infinity"],fp=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],pp=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],hp=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],OE=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],IE=[].concat(hp,fp,pp);function LE(e){const t=e.regex,n=(T,{after:k})=>{const K="</"+T[0].slice(1);return T.input.indexOf(K,k)!==-1},r=oc,o={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(T,k)=>{const K=T[0].length+T.index,oe=T.input[K];if(oe==="<"||oe===","){k.ignoreMatch();return}oe===">"&&(n(T,{after:K})||k.ignoreMatch());let Z;const ce=T.input.substring(K);if(Z=ce.match(/^\s*=/)){k.ignoreMatch();return}if((Z=ce.match(/^\s+extends\s+/))&&Z.index===0){k.ignoreMatch();return}}},a={$pattern:oc,keyword:ME,literal:kE,built_in:IE,"variable.language":OE},c="[0-9](_?[0-9])*",l=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},_=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},f];h.contains=_.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(_)});const S=[].concat(E,h.contains),N=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(S)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},R={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},O={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...fp,...pp]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[A],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function J(T){return t.concat("(?!",T.join("|"),")")}const X={match:t.concat(/\b/,J([...hp,"super","import"].map(T=>`${T}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},U="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(U)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:O},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,E,{match:/\$\d+/},f,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},H,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:U,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:s},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},X,Y,R,$,{match:/\$[(.]/}]}}function PE(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var En="[0-9](_*[0-9])*",jr=`\\.(${En})`,zr="[0-9a-fA-F](_*[0-9a-fA-F])*",DE={className:"number",variants:[{begin:`(\\b(${En})((${jr})|\\.)?|(${jr}))[eE][+-]?(${En})[fFdD]?\\b`},{begin:`\\b(${En})((${jr})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${jr})[fFdD]?\\b`},{begin:`\\b(${En})[fFdD]\\b`},{begin:`\\b0[xX]((${zr})\\.?|(${zr})?\\.(${zr}))[pP][+-]?(${En})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${zr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function BE(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},i={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,o]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,o]}]};o.contains.push(i);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(i,{className:"string"}),"self"]}]},l=DE,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,a,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,a,c,i,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,c]},i,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
81
+ `},l]}}const HE=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),FE=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],$E=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],UE=[...FE,...$E],jE=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),gp=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),mp=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),zE=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),VE=gp.concat(mp).sort().reverse();function KE(e){const t=HE(e),n=VE,r="and or not only",o="[\\w-]+",s="("+o+"|@\\{"+o+"\\})",i=[],a=[],c=function(_){return{className:"string",begin:"~?"+_+".*?"+_}},l=function(_,S,N){return{className:_,begin:S,relevance:N}},d={$pattern:/[a-z-]+/,keyword:r,attribute:jE.join(" ")},f={begin:"\\(",end:"\\)",contains:a,keywords:d,relevance:0};a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,l("variable","@@?"+o,10),l("variable","@\\{"+o+"\\}"),l("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=a.concat({begin:/\{/,end:/\}/,contains:i}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},m={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+zE.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:a,relevance:0}},b={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:h}},v={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,l("keyword","all\\b"),l("variable","@\\{"+o+"\\}"),{begin:"\\b("+UE.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,l("selector-tag",s,0),l("selector-id","#"+s),l("selector-class","\\."+s,0),l("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+gp.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+mp.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},E={begin:o+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[v]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,b,E,m,v,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function WE(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},o=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:o}].concat(o)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function GE(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},o={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},i={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,o,s,i]}}function ZE(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},l={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(l,{contains:[]}),h=e.inherit(d,{contains:[]});l.contains.push(h),d.contains.push(f);let p=[n,c];return[l,d,f,h].forEach(v=>{v.contains=v.contains.concat(p)}),p=p.concat(l,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,s,l,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},o,r,c,i,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function qE(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function YE(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},i={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},l={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,s,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(g,b,v="\\1")=>{const E=v==="\\1"?v:t.concat(v,b);return t.concat(t.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,v,r)},p=(g,b,v)=>t.concat(t.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,v,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),i,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},l,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,a,l]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=m,i.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:m}}function XE(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),o=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),i={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(I,$)=>{$.data._beginMatch=I[1]||I[2]},"on:end":(I,$)=>{$.data._beginMatch!==I[1]&&$.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
82
+ ]`,m={scope:"string",variants:[d,l,f,h]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],v=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],S={keyword:v,literal:(I=>{const $=[];return I.forEach(U=>{$.push(U),U.toLowerCase()===U?$.push(U.toUpperCase()):$.push(U.toLowerCase())}),$})(b),built_in:E},N=I=>I.map($=>$.replace(/\|\d+$/,"")),A={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",N(E).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},R=t.concat(r,"\\b(?!\\()"),O={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),R],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,t.concat(/::/,t.lookahead(/(?!class\b)/)),R],scope:{1:"title.class",3:"variable.constant"}},{match:[o,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},D={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},j={relevance:0,begin:/\(/,end:/\)/,keywords:S,contains:[D,i,O,e.C_BLOCK_COMMENT_MODE,m,g,A]},Y={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",N(v).join("\\b|"),"|",N(E).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[j]};j.contains.push(Y);const J=[D,O,e.C_BLOCK_COMMENT_MODE,m,g,A],X={begin:t.concat(/#\[\s*\\?/,t.either(o,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...J]},...J,{scope:"meta",variants:[{match:o},{match:s}]}]};return{case_insensitive:!1,keywords:S,contains:[X,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},i,Y,O,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},A,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:S,contains:["self",X,i,O,e.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,g]}}function JE(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function QE(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function eC(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},l={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,l]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,l]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,l]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,l]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},b={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},v={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",c,g,f,e.HASH_COMMENT_MODE]}]};return l.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[v]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,v,f]}]}}function tC(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function nC(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),o=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[o,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:o},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function rC(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),o=t.concat(r,/(::\w+)*/),i={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[a]}),e.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:i},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:i}]},A=[f,{variants:[{match:[/class\s+/,o,/\s+<\s+/,o]},{match:[/\b(class|module)\s+/,o]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:i},{match:[/(include|extend)\s+/,o],scope:{2:"title.class"},keywords:i},{relevance:0,match:[o,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:i},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,l),relevance:0}].concat(c,l);d.contains=A,g.contains=A;const j=[{begin:/^\s*=>/,starts:{end:"$",contains:A}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:i,contains:A}}];return l.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:i,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(j).concat(l).concat(A)}}function oC(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),o=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,o,t.lookahead(/\s*\(/))},i="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],l=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:a,literal:c,built_in:l},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+i},{begin:"\\b0o([0-7_]+)"+i},{begin:"\\b0x([A-Fa-f0-9_]+)"+i},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+i}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:l,type:d}},{className:"punctuation",begin:"->"},s]}}const sC=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),iC=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],aC=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],lC=[...iC,...aC],cC=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),uC=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),dC=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),fC=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function pC(e){const t=sC(e),n=dC,r=uC,o="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+lC.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+fC.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:o,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:cC.join(" ")},contains:[{begin:o,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function hC(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function gC(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},o={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],i=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...l,...c].filter(N=>!d.includes(N)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},v={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function E(N){return t.concat(/\b/,t.either(...N.map(A=>A.replace(/\s+/,"\\s+"))),/\b/)}const _={scope:"keyword",match:E(h),relevance:0};function S(N,{exceptions:A,when:R}={}){const O=R;return A=A||[],N.map(D=>D.match(/\|\d+$/)||A.includes(D)?D:O(D)?`${D}|0`:D)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:S(m,{when:N=>N.length<3}),literal:s,type:a,built_in:f},contains:[{scope:"type",match:E(i)},_,v,g,r,o,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,b]}}function bp(e){return e?typeof e=="string"?e:e.source:null}function Bn(e){return pe("(?=",e,")")}function pe(...e){return e.map(n=>bp(n)).join("")}function mC(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function De(...e){return"("+(mC(e).capture?"":"?:")+e.map(r=>bp(r)).join("|")+")"}const Ra=e=>pe(/\b/,e,/\w$/.test(e)?/\b/:/\B/),bC=["Protocol","Type"].map(Ra),sc=["init","self"].map(Ra),vC=["Any","Self"],Ys=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],ic=["false","nil","true"],yC=["assignment","associativity","higherThan","left","lowerThan","none","right"],EC=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],ac=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],vp=De(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),yp=De(vp,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Xs=pe(vp,yp,"*"),Ep=De(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),$o=De(Ep,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ct=pe(Ep,$o,"*"),Vr=pe(/[A-Z]/,$o,"*"),CC=["attached","autoclosure",pe(/convention\(/,De("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",pe(/objc\(/,ct,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],wC=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function xC(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],o={match:[/\./,De(...bC,...sc)],className:{2:"keyword"}},s={match:pe(/\./,De(...Ys)),relevance:0},i=Ys.filter(fe=>typeof fe=="string").concat(["_|0"]),a=Ys.filter(fe=>typeof fe!="string").concat(vC).map(Ra),c={variants:[{className:"keyword",match:De(...a,...sc)}]},l={$pattern:De(/\b\w+/,/#\w+/),keyword:i.concat(EC),literal:ic},d=[o,s,c],f={match:pe(/\./,De(...ac)),relevance:0},h={className:"built_in",match:pe(/\b/,De(...ac),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:Xs},{match:`\\.(\\.|${yp})+`}]},b=[m,g],v="([0-9]_*)+",E="([0-9a-fA-F]_*)+",_={className:"number",relevance:0,variants:[{match:`\\b(${v})(\\.(${v}))?([eE][+-]?(${v}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${v}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},S=(fe="")=>({className:"subst",variants:[{match:pe(/\\/,fe,/[0\\tnr"']/)},{match:pe(/\\/,fe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(fe="")=>({className:"subst",match:pe(/\\/,fe,/[\t ]*(?:[\r\n]|\r\n)/)}),A=(fe="")=>({className:"subst",label:"interpol",begin:pe(/\\/,fe,/\(/),end:/\)/}),R=(fe="")=>({begin:pe(fe,/"""/),end:pe(/"""/,fe),contains:[S(fe),N(fe),A(fe)]}),O=(fe="")=>({begin:pe(fe,/"/),end:pe(/"/,fe),contains:[S(fe),A(fe)]}),D={className:"string",variants:[R(),R("#"),R("##"),R("###"),O(),O("#"),O("##"),O("###")]},j=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],Y={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:j},J=fe=>{const ln=pe(fe,/\//),Zt=pe(/\//,fe);return{begin:ln,end:Zt,contains:[...j,{scope:"comment",begin:`#(?!.*${Zt})`,end:/$/}]}},X={scope:"regexp",variants:[J("###"),J("##"),J("#"),Y]},I={match:pe(/`/,ct,/`/)},$={className:"variable",match:/\$\d+/},U={className:"variable",match:`\\$${$o}+`},H=[I,$,U],T={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:wC,contains:[...b,_,D]}]}},k={scope:"keyword",match:pe(/@/,De(...CC),Bn(De(/\(/,/\s+/)))},K={scope:"meta",match:pe(/@/,ct)},oe=[T,k,K],Z={match:Bn(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:pe(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,$o,"+")},{className:"type",match:Vr,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:pe(/\s+&\s+/,Bn(Vr)),relevance:0}]},ce={begin:/</,end:/>/,keywords:l,contains:[...r,...d,...oe,m,Z]};Z.contains.push(ce);const Ke={match:pe(ct,/\s*:/),keywords:"_|0",relevance:0},he={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",Ke,...r,X,...d,...p,...b,_,D,...H,...oe,Z]},ye={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,Z]},ue={begin:De(Bn(pe(ct,/\s*:/)),Bn(pe(ct,/\s+/,ct,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ct}]},Ze={begin:/\(/,end:/\)/,keywords:l,contains:[ue,...r,...d,...b,_,D,...oe,Z,he],endsParent:!0,illegal:/["']/},an={match:[/(func|macro)/,/\s+/,De(I.match,ct,Xs)],className:{1:"keyword",3:"title.function"},contains:[ye,Ze,t],illegal:[/\[/,/%/]},st={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ye,Ze,t],illegal:/\[|%/},Wt={match:[/operator/,/\s+/,Xs],className:{1:"keyword",3:"title"}},Gt={begin:[/precedencegroup/,/\s+/,Vr],className:{1:"keyword",3:"title"},contains:[Z],keywords:[...yC,...ic],end:/}/},it={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ln={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ds={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ct,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:l,contains:[ye,...d,{begin:/:/,end:/\{/,keywords:l,contains:[{scope:"title.class.inherited",match:Vr},...d],relevance:0}]};for(const fe of D.variants){const ln=fe.contains.find(fs=>fs.label==="interpol");ln.keywords=l;const Zt=[...d,...p,...b,_,D,...H];ln.contains=[...Zt,{begin:/\(/,end:/\)/,contains:["self",...Zt]}]}return{name:"Swift",keywords:l,contains:[...r,an,st,it,Ln,ds,Wt,Gt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},X,...d,...p,...b,_,D,...H,...oe,Z,he]}}const Uo="[A-Za-z$_][0-9A-Za-z$_]*",Cp=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],wp=["true","false","null","undefined","NaN","Infinity"],xp=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],_p=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sp=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Np=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ap=[].concat(Sp,xp,_p);function _C(e){const t=e.regex,n=(T,{after:k})=>{const K="</"+T[0].slice(1);return T.input.indexOf(K,k)!==-1},r=Uo,o={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(T,k)=>{const K=T[0].length+T.index,oe=T.input[K];if(oe==="<"||oe===","){k.ignoreMatch();return}oe===">"&&(n(T,{after:K})||k.ignoreMatch());let Z;const ce=T.input.substring(K);if(Z=ce.match(/^\s*=/)){k.ignoreMatch();return}if((Z=ce.match(/^\s+extends\s+/))&&Z.index===0){k.ignoreMatch();return}}},a={$pattern:Uo,keyword:Cp,literal:wp,built_in:Ap,"variable.language":Np},c="[0-9](_?[0-9])*",l=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},_=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},f];h.contains=_.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(_)});const S=[].concat(E,h.contains),N=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(S)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},R={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},O={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...xp,..._p]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[A],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function J(T){return t.concat("(?!",T.join("|"),")")}const X={match:t.concat(/\b/,J([...Sp,"super","import"].map(T=>`${T}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},U="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(U)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:O},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,E,{match:/\$\d+/},f,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},H,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:U,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:s},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},X,Y,R,$,{match:/\$[(.]/}]}}function SC(e){const t=e.regex,n=_C(e),r=Uo,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],l={$pattern:Uo,keyword:Cp.concat(c),literal:wp,built_in:Ap.concat(o),"variable.language":Np},d={className:"meta",begin:"@"+r},f=(g,b,v)=>{const E=g.contains.findIndex(_=>_.label===b);if(E===-1)throw new Error("can not find mode to replace");g.contains.splice(E,1,v)};Object.assign(n.keywords,l),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,s,i,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",a);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function NC(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,o),/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,i,/ *#/)},{begin:t.concat(/# */,t.either(s,o),/ +/,t.either(i,a),/ *#/)}]},l={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,c,l,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function AC(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],o={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},i={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},l={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,i,o,e.QUOTE_STRING_MODE,c,l,a]}}function TC(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,o={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=e.inherit(s,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[o]},{begin:/'/,end:/'/,contains:[o]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,c,a,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,i,c,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},o,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function RC(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},o={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},i={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,o]},a=e.inherit(i,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},b=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,g,s,i],v=[...b];return v.pop(),v.push(a),p.contains=v,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const MC={arduino:dE,bash:fE,c:pE,cpp:hE,csharp:gE,css:_E,diff:SE,go:NE,graphql:AE,ini:TE,java:RE,javascript:LE,json:PE,kotlin:BE,less:KE,lua:WE,makefile:GE,markdown:ZE,objectivec:qE,perl:YE,php:XE,"php-template":JE,plaintext:QE,python:eC,"python-repl":tC,r:nC,ruby:rC,rust:oC,scss:pC,shell:hC,sql:gC,swift:xC,typescript:SC,vbnet:NC,wasm:AC,xml:TC,yaml:RC},lc={},kC="hljs-";function OC(e){const t=cp.newInstance();return e&&s(e),{highlight:n,highlightAuto:r,listLanguages:o,register:s,registerAlias:i,registered:a};function n(c,l,d){const f=d||lc,h=typeof f.prefix=="string"?f.prefix:kC;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:IC,classPrefix:h});const p=t.highlight(l,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function r(c,l){const f=(l||lc).subset||o();let h=-1,p=0,m;for(;++h<f.length;){const g=f[h];if(!t.getLanguage(g))continue;const b=n(g,c,l);b.data&&b.data.relevance!==void 0&&b.data.relevance>p&&(p=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function o(){return t.listLanguages()}function s(c,l){if(typeof c=="string")t.registerLanguage(c,l);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function i(c,l){if(typeof c=="string")t.registerAliases(typeof l=="string"?l:[...l],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function a(c){return!!t.getLanguage(c)}}class IC{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],o=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:o}):r.children.push(...o)}openNode(t){const n=this,r=t.split(".").map(function(i,a){return a?i+"_".repeat(a):n.options.classPrefix+i}),o=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};o.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}var jo=(e,t)=>t.view.domAtPos(e).node.offsetParent!==null,LC=(e,t,n)=>{for(let r=e.depth;r>0;r-=1){const o=e.node(r),s=t(o),i=jo(e.start(r),n);if(s&&i)return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:o}}},cc=(e,t)=>{const{state:n,view:r,extensionManager:o}=e,{schema:s,selection:i}=n,{empty:a,$anchor:c}=i,l=!!o.extensions.find(v=>v.name==="gapCursor");if(!a||c.parent.type!==s.nodes.detailsSummary||!l||t==="right"&&c.parentOffset!==c.parent.nodeSize-2)return!1;const d=w.findParentNode(v=>v.type===s.nodes.details)(i);if(!d)return!1;const f=w.findChildren(d.node,v=>v.type===s.nodes.detailsContent);if(!f.length||jo(d.start+f[0].pos+1,e))return!1;const p=n.doc.resolve(d.pos+d.node.nodeSize),m=ri.GapCursor.findFrom(p,1,!1);if(!m)return!1;const{tr:g}=n,b=new ri.GapCursor(m);return g.setSelection(b),g.scrollIntoView(),r.dispatch(g),!0},PC=w.Node.create({name:"details",content:"detailsSummary detailsContent",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{persist:!1,openClassName:"is-open",HTMLAttributes:{},renderToggleButton:({element:e,isOpen:t})=>{e.setAttribute("aria-label",t?"Collapse details content":"Expand details content")}}},addAttributes(){return this.options.persist?{open:{default:!1,parseHTML:e=>e.hasAttribute("open"),renderHTML:({open:e})=>e?{open:""}:{}}}:[]},parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:e}){return["details",w.mergeAttributes(this.options.HTMLAttributes,e),0]},...w.createBlockMarkdownSpec({nodeName:"details",content:"block"}),addNodeView(){return({editor:e,getPos:t,node:n,HTMLAttributes:r})=>{const o=document.createElement("div"),s=w.mergeAttributes(this.options.HTMLAttributes,r,{"data-type":this.name});Object.entries(s).forEach(([d,f])=>o.setAttribute(d,f));const i=document.createElement("button");i.type="button";const a=d=>{this.options.renderToggleButton({element:i,...d})};o.append(i);const c=document.createElement("div");o.append(c);const l=d=>{const{setToValue:f,node:h=n}=d||{};if(f!==void 0)if(f){if(o.classList.contains(this.options.openClassName))return;o.classList.add(this.options.openClassName)}else{if(!o.classList.contains(this.options.openClassName))return;o.classList.remove(this.options.openClassName)}else o.classList.toggle(this.options.openClassName);const p=o.classList.contains(this.options.openClassName);a({isOpen:p,node:h});const m=new Event("toggleDetailsContent"),g=c.querySelector(':scope > div[data-type="detailsContent"]');g?.dispatchEvent(m)};return a({isOpen:!!n.attrs.open,node:n}),n.attrs.open&&setTimeout(()=>l()),i.addEventListener("click",()=>{if(l(),!this.options.persist){e.commands.focus(void 0,{scrollIntoView:!1});return}if(e.isEditable&&typeof t=="function"){const{from:d,to:f}=e.state.selection;e.chain().command(({tr:h})=>{const p=t();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return m?.type!==this.type?!1:(h.setNodeMarkup(p,void 0,{open:!m.attrs.open}),!0)}).setTextSelection({from:d,to:f}).focus(void 0,{scrollIntoView:!1}).run()}}),{dom:o,contentDOM:c,ignoreMutation(d){if(d.type==="selection")return!1;const f=d.target,h=o.contains(f);return i.contains(f)||!h||o===f},update:d=>d.type!==this.type?!1:(d.attrs.open!==void 0?l({setToValue:d.attrs.open,node:d}):a({isOpen:o.classList.contains(this.options.openClassName),node:d}),!0)}}},addCommands(){return{setDetails:()=>({state:e,chain:t})=>{var n;const{schema:r,selection:o}=e,{$from:s,$to:i}=o,a=s.blockRange(i);if(!a)return!1;const c=e.doc.slice(a.start,a.end);if(!r.nodes.detailsContent.contentMatch.matchFragment(c.content))return!1;const d=((n=c.toJSON())==null?void 0:n.content)||[];return t().insertContentAt({from:a.start,to:a.end},{type:this.name,content:[{type:"detailsSummary"},{type:"detailsContent",content:d}]}).setTextSelection(a.start+2).run()},unsetDetails:()=>({state:e,chain:t})=>{const{selection:n,schema:r}=e,o=w.findParentNode(v=>v.type===this.type)(n);if(!o)return!1;const s=w.findChildren(o.node,v=>v.type===r.nodes.detailsSummary),i=w.findChildren(o.node,v=>v.type===r.nodes.detailsContent);if(!s.length||!i.length)return!1;const a=s[0],c=i[0],l=o.pos,d=e.doc.resolve(l),f=l+o.node.nodeSize,h={from:l,to:f},p=c.node.content.toJSON()||[],m=d.parent.type.contentMatch.defaultType,b=[m?.create(null,a.node.content).toJSON(),...p];return t().insertContentAt(h,b).setTextSelection(l+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{const{schema:e,selection:t}=this.editor.state,{empty:n,$anchor:r}=t;return!n||r.parent.type!==e.nodes.detailsSummary?!1:r.parentOffset!==0?this.editor.commands.command(({tr:o})=>{const s=r.pos-1,i=r.pos;return o.delete(s,i),!0}):this.editor.commands.unsetDetails()},Enter:({editor:e})=>{const{state:t,view:n}=e,{schema:r,selection:o}=t,{$head:s}=o;if(s.parent.type!==r.nodes.detailsSummary)return!1;const i=jo(s.after()+1,e),a=i?t.doc.nodeAt(s.after()):s.node(-2);if(!a)return!1;const c=i?0:s.indexAfter(-1),l=w.defaultBlockAt(a.contentMatchAt(c));if(!l||!a.canReplaceWith(c,c,l))return!1;const d=l.createAndFill();if(!d)return!1;const f=i?s.after()+1:s.after(-1),h=t.tr.replaceWith(f,f,d),p=h.doc.resolve(f),m=Q.Selection.near(p,1);return h.setSelection(m),h.scrollIntoView(),n.dispatch(h),!0},ArrowRight:({editor:e})=>cc(e,"right"),ArrowDown:({editor:e})=>cc(e,"down")}},addProseMirrorPlugins(){return[new Q.Plugin({key:new Q.PluginKey("detailsSelection"),appendTransaction:(e,t,n)=>{const{editor:r,type:o}=this;if(r.view.composing||!e.some(v=>v.selectionSet)||!t.selection.empty||!n.selection.empty||!w.isActive(n,o.name))return;const{$from:c}=n.selection;if(jo(c.pos,r))return;const d=LC(c,v=>v.type===o,r);if(!d)return;const f=w.findChildren(d.node,v=>v.type===n.schema.nodes.detailsSummary);if(!f.length)return;const h=f[0],m=(t.selection.from<n.selection.from?"forward":"backward")==="forward"?d.start+h.pos:d.pos+h.pos+h.node.nodeSize,g=Q.TextSelection.create(n.doc,m);return n.tr.setSelection(g)}})]}}),DC=w.Node.create({name:"detailsContent",content:"block+",defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:e}){return["div",w.mergeAttributes(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addNodeView(){return({HTMLAttributes:e})=>{const t=document.createElement("div"),n=w.mergeAttributes(this.options.HTMLAttributes,e,{"data-type":this.name,hidden:"hidden"});return Object.entries(n).forEach(([r,o])=>t.setAttribute(r,o)),t.addEventListener("toggleDetailsContent",()=>{t.toggleAttribute("hidden")}),{dom:t,contentDOM:t,ignoreMutation(r){return r.type==="selection"?!1:!t.contains(r.target)||t===r.target},update:r=>r.type===this.type}}},addKeyboardShortcuts(){return{Enter:({editor:e})=>{const{state:t,view:n}=e,{selection:r}=t,{$from:o,empty:s}=r,i=w.findParentNode(Y=>Y.type===this.type)(r);if(!s||!i||!i.node.childCount)return!1;const a=o.index(i.depth),{childCount:c}=i.node;if(!(c===a+1))return!1;const d=i.node.type.contentMatch.defaultType,f=d?.createAndFill();if(!f)return!1;const h=t.doc.resolve(i.pos+1),p=c-1,m=i.node.child(p),g=h.posAtIndex(p,i.depth);if(!m.eq(f))return!1;const v=o.node(-3);if(!v)return!1;const E=o.indexAfter(-3),_=w.defaultBlockAt(v.contentMatchAt(E));if(!_||!v.canReplaceWith(E,E,_))return!1;const S=_.createAndFill();if(!S)return!1;const{tr:N}=t,A=o.after(-2);N.replaceWith(A,A,S);const R=N.doc.resolve(A),O=Q.Selection.near(R,1);N.setSelection(O);const D=g,j=g+m.nodeSize;return N.delete(D,j),N.scrollIntoView(),n.dispatch(N),!0}}},...w.createBlockMarkdownSpec({nodeName:"detailsContent"})}),BC=w.Node.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:e}){return["summary",w.mergeAttributes(this.options.HTMLAttributes,e),0]},...w.createBlockMarkdownSpec({nodeName:"detailsSummary",content:"inline"})}),HC=w.Node.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,w.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>w.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),FC=HC,$C=w.Node.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",w.mergeAttributes(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!w.canInsertNode(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return w.isNodeSelection(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:s,tr:i,dispatch:a})=>{if(a){const{$to:c}=i.selection,l=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?i.setSelection(Q.TextSelection.create(i.doc,c.pos+1)):c.nodeAfter.isBlock?i.setSelection(Q.NodeSelection.create(i.doc,c.pos)):i.setSelection(Q.TextSelection.create(i.doc,c.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=d?.create();f&&(i.insert(l,f),i.setSelection(Q.TextSelection.create(i.doc,l+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[w.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),UC=$C;const jC=UC.extend({addAttributes(){return{style:{default:"thin",parseHTML:e=>e.getAttribute("data-style")??"thin",renderHTML:e=>({"data-style":e.style})}}},addCommands(){return{...this.parent?.(),setHr:e=>({chain:t})=>t().insertContent({type:this.name,attrs:e??{}}).command(({tr:n,dispatch:r})=>{if(r){const{$to:o}=n.selection,s=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?n.setSelection(Q.TextSelection.create(n.doc,o.pos+1)):n.setSelection(Q.NodeSelection.create(n.doc,s+1));else{const i=o.parent.type.createAndFill();i&&(n.insert(s,i),n.setSelection(Q.TextSelection.create(n.doc,s+1)))}}return!0}).scrollIntoView().run()}}});var zC=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,VC=w.Node.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:e}){return["img",w.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,o,s,i;const a=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",c=(o=(r=e.attrs)==null?void 0:r.alt)!=null?o:"",l=(i=(s=e.attrs)==null?void 0:s.title)!=null?i:"";return l?`![${c}](${a} "${l}")`:`![${c}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:o,getPos:s,HTMLAttributes:i,editor:a})=>{const c=document.createElement("img");c.draggable=!1;const l=w.mergeAttributes(this.options.HTMLAttributes,i);Object.entries(l).forEach(([h,p])=>{if(p!=null)switch(h){case"width":case"height":break;default:c.setAttribute(h,p);break}}),l.src!==null&&(c.src=l.src);const d=new w.ResizableNodeView({element:c,editor:a,node:o,getPos:s,onResize:(h,p)=>{c.style.width=`${h}px`,c.style.height=`${p}px`},onCommit:(h,p)=>{const m=s();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:h,height:p}).run()},onUpdate:(h,p,m)=>h.type===o.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),f=d.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",c.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},d}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[w.nodeInputRule({find:zC,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),KC=VC;const WC=KC.extend({addNodeView(){const e=this.parent?.();return e?t=>{const n=e(t);if(!n)return n;let r=t.node.attrs.width,o=t.node.attrs.height;const s=n.update?.bind(n);return n.update=(i,a,c)=>{const l=s?.(i,a,c)??!0;if(l!==!1){const{width:d,height:f}=i.attrs;if(d!==r||f!==o){const h=n.dom.querySelector("img");h&&(d?h.style.width=`${d}px`:h.style.removeProperty("width"),f?h.style.height=`${f}px`:h.style.removeProperty("height")),r=d,o=f}}return l},n}:null}}),GC=w.Node.create({name:"figure",group:"block",content:"image+ figcaption?",draggable:!0,addAttributes(){return{align:{default:"center",parseHTML:e=>e.getAttribute("data-align")??"center",renderHTML:e=>({"data-align":e.align})}}},parseHTML(){return[{tag:"figure"}]},renderHTML({HTMLAttributes:e}){return["figure",w.mergeAttributes(e),0]},addNodeView(){return({node:e})=>{const t=document.createElement("figure"),n=r=>{t.setAttribute("data-align",r.attrs.align);let o=0;r.forEach(s=>{s.type.name==="image"&&o++}),t.dataset.count=String(o)};return n(e),{dom:t,contentDOM:t,update(r){return r.type.name!=="figure"?!1:(n(r),!0)}}}},addCommands(){return{insertFigure:e=>({chain:t})=>t().insertContent({type:this.name,attrs:{align:e.align??"center"},content:[{type:"image",attrs:{src:e.src,alt:e.alt??""}}]}).run(),setFigureAlign:e=>({state:t,dispatch:n})=>{const r=w.findParentNode(o=>o.type.name===this.name)(t.selection);return r?(n&&n(t.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,align:e})),!0):!1},toggleFigcaption:()=>({state:e,dispatch:t})=>{const n=w.findParentNode(i=>i.type.name===this.name)(e.selection);if(!n)return!1;const{node:r,pos:o}=n,s=r.lastChild?.type.name==="figcaption";if(t){const i=e.tr;if(s){const a=r.lastChild,c=o+r.nodeSize-a.nodeSize-1;i.delete(c,c+a.nodeSize)}else{const a=o+r.nodeSize-1,c=e.schema.nodes.figcaption.createAndFill();i.insert(a,c),i.setSelection(Q.TextSelection.create(i.doc,a+1))}t(i)}return!0}}}}),ZC=w.Node.create({name:"figcaption",content:"inline*",defining:!0,parseHTML(){return[{tag:"figcaption"}]},renderHTML({HTMLAttributes:e}){return["figcaption",w.mergeAttributes(e),0]}});var qC=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,YC=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,Ma=e=>e.match(qC),uc=(e,t)=>t?"https://www.youtube-nocookie.com/embed/videoseries?list=":e?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",XC=e=>{const{url:t,allowFullscreen:n,autoplay:r,ccLanguage:o,ccLoadPolicy:s,controls:i,disableKBcontrols:a,enableIFrameApi:c,endTime:l,interfaceLanguage:d,ivLoadPolicy:f,loop:h,modestBranding:p,nocookie:m,origin:g,playlist:b,progressBarColor:v,startAt:E,rel:_}=e;if(!Ma(t))return null;if(t.includes("/embed/"))return t;if(t.includes("youtu.be")){const O=t.split("/").pop();return O?`${uc(m)}${O}`:null}const N=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(t);if(!N||!N[2])return null;let A=`${uc(m,N[1]==="list")}${N[2]}`;const R=[];return n===!1&&R.push("fs=0"),r&&R.push("autoplay=1"),o&&R.push(`cc_lang_pref=${o}`),s&&R.push("cc_load_policy=1"),i||R.push("controls=0"),a&&R.push("disablekb=1"),c&&R.push("enablejsapi=1"),l&&R.push(`end=${l}`),d&&R.push(`hl=${d}`),f&&R.push(`iv_load_policy=${f}`),h&&R.push("loop=1"),p&&R.push("modestbranding=1"),g&&R.push(`origin=${g}`),b&&R.push(`playlist=${b}`),E&&R.push(`start=${E}`),v&&R.push(`color=${v}`),_!==void 0&&R.push(`rel=${_}`),R.length&&(A+=`${N[1]==="list"?"&":"?"}${R.join("&")}`),A},JC=e=>{let t;try{t=new URL(e)}catch{return null}const n=t.hostname.replace(/^www\./,"");if(n!=="youtube.com"&&n!=="youtube-nocookie.com")return null;let r=null;if(t.pathname==="/embed/videoseries"){const i=t.searchParams.get("list");if(!i)return null;r=`https://www.youtube.com/playlist?list=${i}`}else{const i=t.pathname.match(/^\/embed\/([\w-]+)$/);if(!i?.[1])return null;r=`https://www.youtube.com/watch?v=${i[1]}`}if(!Ma(r))return null;const o={src:r},s=t.searchParams.get("start");if(s){const i=Number.parseInt(s,10);Number.isNaN(i)||(o.start=i)}return o},dc=e=>{if(!e)return null;const t=Number.parseInt(e,10);return Number.isNaN(t)?null:t},fc=e=>{const t=e.getAttribute("src");if(!t)return null;const n=JC(t);return n||{src:t}},QC=w.Node.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null,parseHTML:e=>{var t;return(t=fc(e))==null?void 0:t.src}},start:{default:0,parseHTML:e=>{var t;return(t=fc(e))==null?void 0:t.start}},width:{default:this.options.width,parseHTML:e=>dc(e.getAttribute("width"))},height:{default:this.options.height,parseHTML:e=>dc(e.getAttribute("height"))}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:e=>({commands:t})=>Ma(e.src)?t.insertContent({type:this.name,attrs:e}):!1}},addPasteRules(){return this.options.addPasteHandler?[w.nodePasteRule({find:YC,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){const t=XC({url:e.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:e.start||0,rel:this.options.rel});return e.src=t,["div",{"data-youtube-video":""},["iframe",w.mergeAttributes(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},e)]]},...w.createAtomBlockMarkdownSpec({nodeName:"youtube",allowedAttributes:["src","width","height","start"]})}),ew=QC,tw=20,Tp=(e,t=0)=>{const n=[];return!e.children.length||t>tw||Array.from(e.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...Tp(r,t+1))}),n},nw=e=>{if(!e.children.length)return;const t=Tp(e);t&&t.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}`)})},rw=w.Mark.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&nw(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",w.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.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))||e.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),ow=w.Extension.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=(t=w.getStyleProperty(e,"background-color"))!=null?t:e.style.backgroundColor;return n?.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),sw=w.Extension.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=(t=w.getStyleProperty(e,"color"))!=null?t:e.style.color;return n?.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),iw=w.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>{var t;return(t=w.getStyleProperty(e,"font-family"))!=null?t:e.style.fontFamily},renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),aw=w.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>{var t;return(t=w.getStyleProperty(e,"font-size"))!=null?t:e.style.fontSize},renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),lw=w.Extension.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>{var t;return(t=w.getStyleProperty(e,"line-height"))!=null?t:e.style.lineHeight},renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),cw=w.Extension.create({name:"textStyleKit",addExtensions(){const e=[];return this.options.backgroundColor!==!1&&e.push(ow.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(sw.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(iw.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(aw.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(lw.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(rw.configure(this.options.textStyle)),e}});const uw=w.Extension.create({name:"fontSize",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontSize:{default:null,parseHTML:e=>{const t=e.style.fontSize;return t?parseInt(t,10):null},renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}px`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).run()}}});w.Extension.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Q.Plugin({key:new Q.PluginKey("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit,s=this.options.autoTrim;if(o==null||o===0||s===!1){e=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const a=i-o,c=0,l=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,l);return e=!0,d}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:t.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!t.getMeta("paste"))return!1;const a=t.selection.$head.pos,c=s-r,l=a-c,d=a;return t.deleteRange(l,d),!(this.storage.characters({node:t.doc})>r)}})]}});var dw=w.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[wh.dropCursor(this.options)]}});w.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Q.Plugin({key:new Q.PluginKey("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,s=[];if(!n||!r)return nt.DecorationSet.create(e,[]);let i=0;this.options.mode==="deepest"&&e.descendants((c,l)=>{if(c.isText)return;if(!(o>=l&&o<=l+c.nodeSize-1))return!1;i+=1});let a=0;return e.descendants((c,l)=>{if(c.isText||!(o>=l&&o<=l+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(nt.Decoration.node(l,l+c.nodeSize,{class:this.options.className}))}),nt.DecorationSet.create(e,s)}}})]}});var fw=w.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[ri.gapCursor()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=w.callOrReturn(w.getExtensionField(e,"allowGapCursor",n)))!=null?t:null}}}),Rp="placeholder",lr=new Q.PluginKey("tiptap__placeholder"),pc=200;function hc(e){const{editor:t,placeholder:n,dataAttribute:r,pos:o,node:s,isEmptyDoc:i,hasAnchor:a,classes:{emptyNode:c,emptyEditor:l}}=e,d=[c];return i&&d.push(l),nt.Decoration.node(o,o+s.nodeSize,{class:d.join(" "),[r]:typeof n=="function"?n({editor:t,node:s,pos:o,hasAnchor:a}):n})}function gc(e,t){return typeof e=="function"?e(t):e}function pw({editor:e,options:t,dataAttribute:n,doc:r,selection:o}){var s,i;if(!(e.isEditable||!t.showOnlyWhenEditable))return null;const{anchor:c}=o,l=[],d=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){const h=r.resolve(c),p=h.depth>0?h.node(1):h.nodeAfter,m=h.depth>0?h.before(1):c;if(p&&p.type.isTextblock&&w.isNodeEmpty(p)){const g=c>=m&&c<=m+p.nodeSize;l.push(hc({editor:e,isEmptyDoc:d,dataAttribute:n,hasAnchor:g,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:gc(t.emptyNodeClass,{editor:e,node:p,pos:m,hasAnchor:g})},node:p,pos:m}))}}else{const h=lr.getState(e.state),p=(s=h?.topPos)!=null?s:0,m=(i=h?.bottomPos)!=null?i:r.content.size;r.nodesBetween(p,m,(g,b)=>{const v=c>=b&&c<=b+g.nodeSize,E=!g.isLeaf&&w.isNodeEmpty(g);return g.type.isTextblock&&(v||!t.showOnlyCurrent)&&E&&l.push(hc({editor:e,isEmptyDoc:d,dataAttribute:n,hasAnchor:v,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:gc(t.emptyNodeClass,{editor:e,node:g,pos:b,hasAnchor:v})},node:g,pos:b})),t.includeChildren})}return nt.DecorationSet.create(r,l)}function hw(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function gw(e){const t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function mw(e){let t=e;for(;t;){if(gw(t))return t;const n=t.parentElement;if(!n){const r=t.getRootNode();if(r instanceof ShadowRoot){t=r.host;continue}return window}t=n}return window}function bw(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function vw({doc:e,view:t,scrollContainer:n}){const r=t.dom.getBoundingClientRect(),o=n?bw(n):{top:0,bottom:window.innerHeight},s=Math.max(r.top,o.top)-pc,i=Math.min(r.bottom,o.bottom)+pc;if(s>=i)return{top:0,bottom:e.content.size};const c=getComputedStyle(t.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,l=t.posAtCoords({left:c,top:s+2}),d=t.posAtCoords({left:c,top:i-2});return{top:l?l.pos:0,bottom:d?d.pos:e.content.size}}var yw={init(){return{topPos:null,bottomPos:null}},apply(e,t){const n=e.getMeta(lr);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos!==null?e.mapping.map(t.topPos):null,bottomPos:t.bottomPos!==null?e.mapping.map(t.bottomPos):null}:t}};function Ew(e){const t=mw(e.dom),n=()=>{const a=vw({view:e,doc:e.state.doc,scrollContainer:t}),c=lr.getState(e.state);if(c?.topPos===a.top&&c?.bottomPos===a.bottom)return;const l=e.state.tr.setMeta(lr,{positions:a});e.dispatch(l)};let r=null,o=0;const s=150,i=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const a=performance.now();a-o>=s?(o=a,n()):i()}))};return t.addEventListener("scroll",i,{passive:!0}),n(),{update(a,c){e.state.doc.content.size!==c.doc.content.size&&i()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener("scroll",i)}}}function Cw({editor:e,options:t}){const n=t.dataAttribute?`data-${hw(t.dataAttribute)}`:`data-${Rp}`;return new Q.Plugin({key:lr,state:yw,view:Ew,props:{decorations:({doc:r,selection:o})=>pw({editor:e,options:t,dataAttribute:n,doc:r,selection:o})}})}w.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Rp,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Cw({editor:this.editor,options:this.options})]}});var ww=`.ProseMirror:not(.ProseMirror-focused) *::selection {
83
+ background: transparent;
84
+ }
85
+
86
+ .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
87
+ background: transparent;
88
+ }`;w.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<"u"&&w.createStyleTag(ww,e.options.injectNonce,"selection"),[new Q.Plugin({key:new Q.PluginKey("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||w.isNodeSelection(n.selection)||e.view.dragging?null:nt.DecorationSet.create(n.doc,[nt.Decoration.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});var xw="skipTrailingNode";function mc({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}w.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Q.PluginKey(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new Q.Plugin({key:t,appendTransaction:(o,s,i)=>{const{doc:a,tr:c,schema:l}=i,d=t.getState(i),f=a.content.size,h=l.nodes[n];if(!o.some(p=>p.getMeta(xw))&&d)return c.insert(f,h.create())},state:{init:(o,s)=>{const i=s.tr.doc.lastChild;return!mc({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const i=o.doc.lastChild;return!mc({node:i,types:r})}}})]}});w.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Cn.undo(e,t),redo:()=>({state:e,dispatch:t})=>Cn.redo(e,t)}},addProseMirrorPlugins(){return[Cn.history(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()}}});var Mp="placeholder",cr=new Q.PluginKey("tiptap__placeholder"),bc=200;function vc(e){const{editor:t,placeholder:n,dataAttribute:r,pos:o,node:s,isEmptyDoc:i,hasAnchor:a,classes:{emptyNode:c,emptyEditor:l}}=e,d=[c];return i&&d.push(l),nt.Decoration.node(o,o+s.nodeSize,{class:d.join(" "),[r]:typeof n=="function"?n({editor:t,node:s,pos:o,hasAnchor:a}):n})}function yc(e,t){return typeof e=="function"?e(t):e}function _w({editor:e,options:t,dataAttribute:n,doc:r,selection:o}){var s,i;if(!(e.isEditable||!t.showOnlyWhenEditable))return null;const{anchor:c}=o,l=[],d=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){const h=r.resolve(c),p=h.depth>0?h.node(1):h.nodeAfter,m=h.depth>0?h.before(1):c;if(p&&p.type.isTextblock&&w.isNodeEmpty(p)){const g=c>=m&&c<=m+p.nodeSize;l.push(vc({editor:e,isEmptyDoc:d,dataAttribute:n,hasAnchor:g,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:yc(t.emptyNodeClass,{editor:e,node:p,pos:m,hasAnchor:g})},node:p,pos:m}))}}else{const h=cr.getState(e.state),p=(s=h?.topPos)!=null?s:0,m=(i=h?.bottomPos)!=null?i:r.content.size;r.nodesBetween(p,m,(g,b)=>{const v=c>=b&&c<=b+g.nodeSize,E=!g.isLeaf&&w.isNodeEmpty(g);return g.type.isTextblock&&(v||!t.showOnlyCurrent)&&E&&l.push(vc({editor:e,isEmptyDoc:d,dataAttribute:n,hasAnchor:v,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:yc(t.emptyNodeClass,{editor:e,node:g,pos:b,hasAnchor:v})},node:g,pos:b})),t.includeChildren})}return nt.DecorationSet.create(r,l)}function Sw(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Nw(e){const t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function Aw(e){let t=e;for(;t;){if(Nw(t))return t;const n=t.parentElement;if(!n){const r=t.getRootNode();if(r instanceof ShadowRoot){t=r.host;continue}return window}t=n}return window}function Tw(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function Rw({doc:e,view:t,scrollContainer:n}){const r=t.dom.getBoundingClientRect(),o=n?Tw(n):{top:0,bottom:window.innerHeight},s=Math.max(r.top,o.top)-bc,i=Math.min(r.bottom,o.bottom)+bc;if(s>=i)return{top:0,bottom:e.content.size};const c=getComputedStyle(t.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,l=t.posAtCoords({left:c,top:s+2}),d=t.posAtCoords({left:c,top:i-2});return{top:l?l.pos:0,bottom:d?d.pos:e.content.size}}var Mw={init(){return{topPos:null,bottomPos:null}},apply(e,t){const n=e.getMeta(cr);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos!==null?e.mapping.map(t.topPos):null,bottomPos:t.bottomPos!==null?e.mapping.map(t.bottomPos):null}:t}};function kw(e){const t=Aw(e.dom),n=()=>{const a=Rw({view:e,doc:e.state.doc,scrollContainer:t}),c=cr.getState(e.state);if(c?.topPos===a.top&&c?.bottomPos===a.bottom)return;const l=e.state.tr.setMeta(cr,{positions:a});e.dispatch(l)};let r=null,o=0;const s=150,i=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const a=performance.now();a-o>=s?(o=a,n()):i()}))};return t.addEventListener("scroll",i,{passive:!0}),n(),{update(a,c){e.state.doc.content.size!==c.doc.content.size&&i()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener("scroll",i)}}}function Ow({editor:e,options:t}){const n=t.dataAttribute?`data-${Sw(t.dataAttribute)}`:`data-${Mp}`;return new Q.Plugin({key:cr,state:Mw,view:kw,props:{decorations:({doc:r,selection:o})=>_w({editor:e,options:t,dataAttribute:n,doc:r,selection:o})}})}var Iw=w.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Mp,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ow({editor:this.editor,options:this.options})]}}),Lw=w.Extension.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:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!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")}}}),Pw=Lw,Dw="skipTrailingNode";function Ec({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Bw=w.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Q.PluginKey(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new Q.Plugin({key:t,appendTransaction:(o,s,i)=>{const{doc:a,tr:c,schema:l}=i,d=t.getState(i),f=a.content.size,h=l.nodes[n];if(!o.some(p=>p.getMeta(Dw))&&d)return c.insert(f,h.create())},state:{init:(o,s)=>{const i=s.tr.doc.lastChild;return!Ec({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const i=o.doc.lastChild;return!Ec({node:i,types:r})}}})]}}),Hw=e=>w.textInputRule({find:/--$/,replace:e??"—"}),Fw=e=>w.textInputRule({find:/\.\.\.$/,replace:e??"…"}),Js=e=>w.textInputRule({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:e??"“"}),Qs=e=>w.textInputRule({find:/"$/,replace:e??"”"}),ei=e=>w.textInputRule({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:e??"‘"}),ti=e=>w.textInputRule({find:/'$/,replace:e??"’"}),$w=e=>w.textInputRule({find:/<-$/,replace:e??"←"}),Uw=e=>w.textInputRule({find:/->$/,replace:e??"→"}),jw=e=>w.textInputRule({find:/\(c\)$/,replace:e??"©"}),zw=e=>w.textInputRule({find:/\(tm\)$/,replace:e??"™"}),Vw=e=>w.textInputRule({find:/\(sm\)$/,replace:e??"℠"}),Kw=e=>w.textInputRule({find:/\(r\)$/,replace:e??"®"}),Ww=e=>w.textInputRule({find:/(?:^|\s)(1\/2)\s$/,replace:e??"½"}),Gw=e=>w.textInputRule({find:/\+\/-$/,replace:e??"±"}),Zw=e=>w.textInputRule({find:/!=$/,replace:e??"≠"}),qw=e=>w.textInputRule({find:/<<$/,replace:e??"«"}),Yw=e=>w.textInputRule({find:/>>$/,replace:e??"»"}),Xw=e=>w.textInputRule({find:/\d+\s?([*x])\s?\d+$/,replace:e??"×"}),Jw=e=>w.textInputRule({find:/\^2$/,replace:e??"²"}),Qw=e=>w.textInputRule({find:/\^3$/,replace:e??"³"}),ex=e=>w.textInputRule({find:/(?:^|\s)(1\/4)\s$/,replace:e??"¼"}),tx=e=>w.textInputRule({find:/(?:^|\s)(3\/4)\s$/,replace:e??"¾"}),nx=w.Extension.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){var e,t;const n=[];this.options.emDash!==!1&&n.push(Hw(this.options.emDash)),this.options.ellipsis!==!1&&n.push(Fw(this.options.ellipsis));const r=this.editor.options.textDirection==="rtl";if((e=this.options.doubleQuotes)!=null&&e.rtl){const{open:o,close:s}=this.options.doubleQuotes.rtl;n.push(Js(o)),n.push(Qs(s))}else r?(n.push(Js("”")),n.push(Qs("“"))):(this.options.openDoubleQuote!==!1&&n.push(Js(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(Qs(this.options.closeDoubleQuote)));if((t=this.options.singleQuotes)!=null&&t.rtl){const{open:o,close:s}=this.options.singleQuotes.rtl;n.push(ei(o)),n.push(ti(s))}else r?(n.push(ei("’")),n.push(ti("‘"))):(this.options.openSingleQuote!==!1&&n.push(ei(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(ti(this.options.closeSingleQuote)));return this.options.leftArrow!==!1&&n.push($w(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(Uw(this.options.rightArrow)),this.options.copyright!==!1&&n.push(jw(this.options.copyright)),this.options.trademark!==!1&&n.push(zw(this.options.trademark)),this.options.servicemark!==!1&&n.push(Vw(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(Kw(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(Ww(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(Gw(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(Zw(this.options.notEqual)),this.options.laquo!==!1&&n.push(qw(this.options.laquo)),this.options.raquo!==!1&&n.push(Yw(this.options.raquo)),this.options.multiplication!==!1&&n.push(Xw(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(Jw(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(Qw(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(ex(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(tx(this.options.threeQuarters)),n}}),rx=nx,ox=w.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Cn.undo(e,t),redo:()=>({state:e,dispatch:t})=>Cn.redo(e,t)}},addProseMirrorPlugins(){return[Cn.history(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()}}});const sx=OC(MC),ix=[s2,u2,a2],ax=[...ix,Ny,cE.configure({lowlight:sx}),PC,DC,BC,FC,jC,GC,ZC,ew,WC.configure({allowBase64:!0,resize:{enabled:!0,directions:["top-left","top-right","bottom-left","bottom-right"],minWidth:50,minHeight:50,alwaysPreserveAspectRatio:!0}})],lx=[m2,E2,_2,M2,ry,ay,cy,dy,py],cx=[Jy,cw.configure({fontSize:!1}),uw,fw,dw,Iw,Pw.configure({types:["heading","paragraph"]}),Bw.configure({node:"paragraph",notAfter:["paragraph"]}),rx,ox],ux=w.Extension.create({name:"basicKit",addExtensions(){return[...ax,...lx,...cx]}}),ka=({name:e,url:t})=>u.jsxs("a",{href:t,download:e,className:"file-attachment",tabIndex:0,"aria-label":`${e} 다운로드`,children:[u.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:u.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),u.jsx("span",{className:"file-attachment__name",children:e})]}),kp=w.Node.create({name:"fileAttachment",group:"block",atom:!0,addOptions(){return{component:ka}},addAttributes(){return{name:{default:""},mimeType:{default:""},url:{default:""},size:{default:0}}},parseHTML(){return[{tag:'div[data-type="file-attachment"]'}]},renderHTML({HTMLAttributes:e}){return["div",w.mergeAttributes(e,{"data-type":"file-attachment"})]},addNodeView(){const e=this.options.component;return ot.ReactNodeViewRenderer(({node:t})=>u.jsx(ot.NodeViewWrapper,{children:u.jsx(e,{...t.attrs})}))}}),Op=w.Extension.create({name:"fileAttachmentKit",addOptions(){return{component:ka}},addExtensions(){return[kp.configure({component:this.options.component})]}});function zo(e){return e==="left"||e==="right"||e==="center"?e:null}function dx(e){const t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase();return zo(t||n)}function fx(e){return zo(e?.align)}function Ip(){return{default:null,parseHTML:e=>dx(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var Lp=w.Node.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,n;const r=e.getAttribute("colwidth"),o=r?r.split(",").map(s=>parseInt(s,10)):null;if(!o){const s=(t=e.closest("table"))==null?void 0:t.querySelectorAll("colgroup > col"),i=Array.from(((n=e.parentElement)==null?void 0:n.children)||[]).indexOf(e);if(i&&i>-1&&s&&s[i]){const a=s[i].getAttribute("width");return a?[parseInt(a,10)]:null}}return o}},align:Ip()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",w.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Pp=w.Node.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}},align:Ip()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",w.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Dp=w.Node.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",w.mergeAttributes(this.options.HTMLAttributes,e),0]}});function Ii(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function Cc(e,t,n,r,o,s){var i;let a=0,c=!0,l=t.firstChild;const d=e.firstChild;if(d!==null)for(let h=0,p=0;h<d.childCount;h+=1){const{colspan:m,colwidth:g}=d.child(h).attrs;for(let b=0;b<m;b+=1,p+=1){const v=o===p?s:g&&g[b],E=v?`${v}px`:"";if(a+=v||r,v||(c=!1),l){if(l.style.width!==E){const[_,S]=Ii(r,v);l.style.setProperty(_,S)}l=l.nextSibling}else{const _=document.createElement("col"),[S,N]=Ii(r,v);_.style.setProperty(S,N),t.appendChild(_)}}}for(;l;){const h=l.nextSibling;(i=l.parentNode)==null||i.removeChild(l),l=h}const f=e.attrs.style&&typeof e.attrs.style=="string"&&/\bwidth\s*:/i.test(e.attrs.style);c&&!f?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var px=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[o,s]of Object.entries(r))s!=null&&(o==="style"?this.table.style.cssText=String(s):this.table.setAttribute(o,String(s)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Cc(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Cc(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){const t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type==="attributes"||e.type==="childList"||e.type==="characterData"))}};function hx(e,t,n,r){let o=0,s=!0;const i=[],a=e.firstChild;if(!a)return{};for(let f=0,h=0;f<a.childCount;f+=1){const{colspan:p,colwidth:m}=a.child(f).attrs;for(let g=0;g<p;g+=1,h+=1){const b=n===h?r:m&&m[g];o+=b||t,b||(s=!1);const[v,E]=Ii(t,b);i.push(["col",{style:`${v}: ${E}`}])}}const c=s?`${o}px`:"",l=s?"":`${o}px`;return{colgroup:["colgroup",{},...i],tableWidth:c,tableMinWidth:l}}function wc(e,t){return e.createAndFill()}function gx(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function mx(e,t,n,r,o){const s=gx(e),i=[],a=[];for(let l=0;l<n;l+=1){const d=wc(s.cell);if(d&&a.push(d),r){const f=wc(s.header_cell);f&&i.push(f)}}const c=[];for(let l=0;l<t;l+=1)c.push(s.row.createChecked(null,r&&l===0?i:a));return s.table.createChecked(null,c)}function bx(e){return e instanceof ne.CellSelection}var Kr=({editor:e})=>{const{selection:t}=e.state;if(!bx(t))return!1;let n=0;const r=w.findParentNodeClosestToPos(t.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===t.ranges.length?(e.commands.deleteTable(),!0):!1},vx="";function yx(e){return(e||"").replace(/\s+/g," ").trim()}function Ex(e,t,n={}){var r;const o=(r=n.cellLineSeparator)!=null?r:vx;if(!e||!e.content||e.content.length===0)return"";const s=[];e.content.forEach(g=>{const b=[];g.content&&g.content.forEach(v=>{let E="";v.content&&Array.isArray(v.content)&&v.content.length>1?E=v.content.map(R=>t.renderChildren(R)).join(o):E=v.content?t.renderChildren(v.content):"";const _=yx(E),S=v.type==="tableHeader",N=fx(v.attrs);b.push({text:_,isHeader:S,align:N})}),s.push(b)});const i=s.reduce((g,b)=>Math.max(g,b.length),0);if(i===0)return"";const a=Array.from({length:i}).fill(0);s.forEach(g=>{var b;for(let v=0;v<i;v+=1){const _=(((b=g[v])==null?void 0:b.text)||"").length;_>a[v]&&(a[v]=_),a[v]<3&&(a[v]=3)}});const c=(g,b)=>g+" ".repeat(Math.max(0,b-g.length)),l=s[0],d=l.some(g=>g.isHeader),f=Array.from({length:i}).fill(null);s.forEach(g=>{var b;for(let v=0;v<i;v+=1)!f[v]&&((b=g[v])!=null&&b.align)&&(f[v]=g[v].align)});let h=`
89
+ `;const p=Array.from({length:i}).map((g,b)=>d&&l[b]&&l[b].text||"");return h+=`| ${p.map((g,b)=>c(g,a[b])).join(" | ")} |
90
+ `,h+=`| ${a.map((g,b)=>{const v=Math.max(3,g),E=f[b];return E==="left"?`:${"-".repeat(v)}`:E==="right"?`${"-".repeat(v)}:`:E==="center"?`:${"-".repeat(v)}:`:"-".repeat(v)}).join(" | ")} |
91
+ `,(d?s.slice(1):s).forEach(g=>{h+=`| ${Array.from({length:i}).fill(0).map((b,v)=>c(g[v]&&g[v].text||"",a[v])).join(" | ")} |
92
+ `}),h}var Cx=Ex,Bp=w.Node.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:px,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=hx(e,this.options.cellMinWidth),s=t.style;function i(){return s||(r?`width: ${r}`:`min-width: ${o}`)}const a=["table",w.mergeAttributes(this.options.HTMLAttributes,t,{style:i()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},a]:a},parseMarkdown:(e,t)=>{const n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){const o=[];e.header.forEach((s,i)=>{var a;const c=zo((a=r[i])!=null?a:s.align),l=c?{align:c}:{};o.push(t.createNode("tableHeader",l,[{type:"paragraph",content:t.parseInline(s.tokens)}]))}),n.push(t.createNode("tableRow",{},o))}return e.rows&&e.rows.forEach(o=>{const s=[];o.forEach((i,a)=>{var c;const l=zo((c=r[a])!=null?c:i.align),d=l?{align:l}:{};s.push(t.createNode("tableCell",d,[{type:"paragraph",content:t.parseInline(i.tokens)}]))}),n.push(t.createNode("tableRow",{},s))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>Cx(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const i=mx(s.schema,e,t,n);if(o){const a=r.selection.from+1;r.replaceSelectionWith(i).scrollIntoView().setSelection(Q.TextSelection.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>ne.addColumnBefore(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>ne.addColumnAfter(e,t),deleteColumn:()=>({state:e,dispatch:t})=>ne.deleteColumn(e,t),addRowBefore:()=>({state:e,dispatch:t})=>ne.addRowBefore(e,t),addRowAfter:()=>({state:e,dispatch:t})=>ne.addRowAfter(e,t),deleteRow:()=>({state:e,dispatch:t})=>ne.deleteRow(e,t),deleteTable:()=>({state:e,dispatch:t})=>ne.deleteTable(e,t),mergeCells:()=>({state:e,dispatch:t})=>ne.mergeCells(e,t),splitCell:()=>({state:e,dispatch:t})=>ne.splitCell(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>ne.toggleHeader("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>ne.toggleHeader("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>ne.toggleHeaderCell(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>ne.mergeCells(e,t)?!0:ne.splitCell(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>ne.setCellAttr(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>ne.goToNextCell(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>ne.goToNextCell(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&ne.fixTables(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const r=ne.CellSelection.create(t.doc,e.anchorCell,e.headCell);t.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:Kr,"Mod-Backspace":Kr,Delete:Kr,"Mod-Delete":Kr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[ne.columnResizing({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],ne.tableEditing({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:n,view:r,HTMLAttributes:o})=>{const s=w.mergeAttributes(this.options.HTMLAttributes,o);return new t(n,this.options.cellMinWidth,r,s)}},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:w.callOrReturn(w.getExtensionField(e,"tableRole",t))}}});w.Extension.create({name:"tableKit",addExtensions(){const e=[];return this.options.table!==!1&&e.push(Bp.configure(this.options.table)),this.options.tableCell!==!1&&e.push(Lp.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(Pp.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(Dp.configure(this.options.tableRow)),e}});const Vo=({backgroundColorHex:e,borderColorHex:t,className:n=""})=>{const r=e??"#ffffff",o=t??"#e5e7eb";return u.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})},wx=x.forwardRef(({editor:e,...t},n)=>{const{editor:r}=Ue(e),o=x.useCallback(s=>{r&&r.chain().focus().setCellAttribute("backgroundColor",s).run()},[r]);return u.jsxs(jt,{children:[u.jsx(zt,{asChild:!0,children:u.jsx(V,{ref:n,"data-style":"ghost",tooltip:"셀 배경색 변경",...t,children:u.jsx(Ju,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{align:"start",children:u.jsx(Fe,{children:u.jsxs($e,{children:[u.jsx(Gn,{children:"Background Color"}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(0,5).map((s,i)=>u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>o(s.color),"aria-label":`Background color: ${s.name}`,className:"tiptap-background-color-button",children:u.jsx(Vo,{backgroundColorHex:s.color,borderColorHex:s.contrastColor})},`${s.color}-${i}`))}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(5,10).map((s,i)=>u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>o(s.color),"aria-label":`Background color: ${s.name}`,className:"tiptap-background-color-button",children:u.jsx(Vo,{backgroundColorHex:s.color,borderColorHex:s.contrastColor})},`${s.color}-${i}`))})]})})})]})});function xx(e,t,n){const r=e.posAtCoords({left:t,top:n});if(!r)return null;const o=e.state.doc.resolve(r.pos),s=ne.cellAround(o)??ne.cellNear(o);if(!s||s.depth<1)return null;const i=s.node(-1);if(i.type.spec.tableRole!=="table")return null;const a=s.start(-1),c=ne.TableMap.get(i),l=c.findCell(s.pos-a);return{map:c,tableStart:a,row:l.top,col:l.left}}function _x(e,{map:t,tableStart:n},r){if(r<0||r>=t.height)return;const o=e.state.doc.resolve(n+t.map[r*t.width]),s=e.state.doc.resolve(n+t.map[r*t.width+t.width-1]),i=ne.CellSelection.rowSelection(o,s);e.dispatch(e.state.tr.setSelection(i)),e.focus()}function Sx(e,{map:t,tableStart:n},r){if(r<0||r>=t.width)return;const o=e.state.doc.resolve(n+t.map[r]),s=e.state.doc.resolve(n+t.map[(t.height-1)*t.width+r]),i=ne.CellSelection.colSelection(o,s);e.dispatch(e.state.tr.setSelection(i)),e.focus()}function Nx(e,{tableStart:t},n,r){n!==r&&(ne.moveTableRow({from:n,to:r,pos:t+1})(e.state,e.dispatch),e.focus())}function Ax(e,{tableStart:t},n,r){n!==r&&(ne.moveTableColumn({from:n,to:r,pos:t+1})(e.state,e.dispatch),e.focus())}function Tx(e,t,n){const r=e.posAtDOM(n,0),o=ne.TableMap.get(t),s=e.state.tr;ne.addRow(s,{left:0,right:o.width,top:0,bottom:o.height,tableStart:r,map:o,table:t},o.height),e.dispatch(s),e.focus()}function Rx(e,t,n){const r=e.posAtDOM(n,0),o=ne.TableMap.get(t),s=e.state.tr;ne.addColumn(s,{left:0,right:o.width,top:0,bottom:o.height,tableStart:r,map:o,table:t},o.width),e.dispatch(s),e.focus()}const Li=x.forwardRef(({view:e,target:t,getHovered:n,onOpenChange:r,onGripMouseDown:o},s)=>{const[i,a]=x.useState(!1),c=x.useRef(null),l=p=>{a(p),r?.(p)},d=p=>{t==="row"?_x(e,p,p.row):Sx(e,p,p.col)};x.useImperativeHandle(s,()=>({open:()=>{const p=n();p&&(c.current=p,d(p),l(!0))}}));const f=p=>{l(!1);const m=c.current;m&&d(m),p(e.state,e.dispatch),e.focus()},h=p=>{l(!1);const m=c.current;m&&(d(m),ne.setCellAttr("backgroundColor",p)(e.state,e.dispatch),e.focus())};return u.jsxs(vr,{open:i,onOpenChange:l,children:[u.jsx(On,{asChild:!0,children:u.jsx("button",{type:"button",className:"table-grip-handle","aria-label":t==="row"?"행 메뉴 열기":"열 메뉴 열기",onMouseDown:p=>{p.preventDefault(),o?.(p)}})}),u.jsx(In,{portal:!0,side:t==="row"?"right":"bottom",align:"start",children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsxs(Be,{orientation:"vertical",children:[t==="row"?u.jsxs(u.Fragment,{children:[u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.addRowBefore),children:[u.jsx(qu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"위에 행 추가"})]})}),u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.addRowAfter),children:[u.jsx(Zu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"아래에 행 추가"})]})}),u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.toggleHeaderRow),children:[u.jsx(Xu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"헤더 행 토글"})]})})]}):u.jsxs(u.Fragment,{children:[u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.addColumnBefore),children:[u.jsx(Wu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"왼쪽에 열 추가"})]})}),u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.addColumnAfter),children:[u.jsx(Gu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"오른쪽에 열 추가"})]})}),u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.toggleHeaderColumn),children:[u.jsx(Yu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"헤더 열 토글"})]})})]}),u.jsxs(Ev,{children:[u.jsx(Cv,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",children:[u.jsx(Ju,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"배경색"}),u.jsx(kb,{className:"tiptap-button-dropdown-small"})]})}),u.jsx(Qd,{portal:!0,children:u.jsx(Fe,{children:u.jsxs($e,{children:[u.jsx(Be,{orientation:"horizontal",children:Dt.slice(0,5).map(p=>u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>h(p.color),"aria-label":`Background color: ${p.name}`,children:u.jsx(Vo,{backgroundColorHex:p.color,borderColorHex:p.contrastColor})},p.name))}),u.jsx(Be,{orientation:"horizontal",children:Dt.slice(5,10).map(p=>u.jsx(V,{"data-style":"ghost",type:"button",onClick:()=>h(p.color),"aria-label":`Background color: ${p.name}`,children:u.jsx(Vo,{backgroundColorHex:p.color,borderColorHex:p.contrastColor})},p.name))})]})})})]}),u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(t==="row"?ne.deleteRow:ne.deleteColumn),children:[t==="row"?u.jsx(Ku,{className:"tiptap-button-icon"}):u.jsx(Vu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:t==="row"?"행 삭제":"열 삭제"})]})}),u.jsx(je,{asChild:!0,children:u.jsxs(V,{"data-style":"ghost",className:"tiptap-table-grip-menu-item",onClick:()=>f(ne.deleteTable),children:[u.jsx(zu,{className:"tiptap-button-icon"}),u.jsx("span",{className:"tiptap-button-text",children:"표 삭제"})]})})]})})})})]})});Li.displayName="TableGripMenu";const Mx=4;class kx extends ne.TableView{view;controls;rowHandle;columnHandle;addRowButton;addColumnButton;dropIndicator;rowHandleRoot;columnHandleRoot;rowMenuRef;columnMenuRef;hovered=null;rowMenuOpen=!1;columnMenuOpen=!1;dragState=null;constructor(t,n,r){super(t,n),this.view=r,this.controls=document.createElement("div"),this.controls.className="table-controls",this.controls.contentEditable="false",this.rowHandle=document.createElement("div"),this.rowHandle.className="table-row-handle",this.columnHandle=document.createElement("div"),this.columnHandle.className="table-column-handle",this.dropIndicator=document.createElement("div"),this.dropIndicator.className="table-drop-indicator",this.addRowButton=document.createElement("button"),this.addRowButton.type="button",this.addRowButton.className="table-add-row-button",this.addRowButton.setAttribute("aria-label","아래에 행 추가"),this.addRowButton.textContent="+",this.addRowButton.addEventListener("mousedown",this.handleAddRow),this.addColumnButton=document.createElement("button"),this.addColumnButton.type="button",this.addColumnButton.className="table-add-column-button",this.addColumnButton.setAttribute("aria-label","오른쪽에 열 추가"),this.addColumnButton.textContent="+",this.addColumnButton.addEventListener("mousedown",this.handleAddColumn),this.controls.append(this.rowHandle,this.columnHandle,this.dropIndicator,this.addRowButton,this.addColumnButton),this.dom.append(this.controls),this.rowMenuRef=x.createRef(),this.columnMenuRef=x.createRef(),this.rowHandleRoot=Za.createRoot(this.rowHandle),this.columnHandleRoot=Za.createRoot(this.columnHandle),this.rowHandleRoot.render(u.jsx(Li,{ref:this.rowMenuRef,view:this.view,target:"row",getHovered:()=>this.hovered,onOpenChange:this.handleRowMenuOpenChange,onGripMouseDown:o=>this.startDrag("row",o)})),this.columnHandleRoot.render(u.jsx(Li,{ref:this.columnMenuRef,view:this.view,target:"column",getHovered:()=>this.hovered,onOpenChange:this.handleColumnMenuOpenChange,onGripMouseDown:o=>this.startDrag("column",o)})),this.dom.addEventListener("mouseover",this.handleMouseOver),this.dom.addEventListener("mouseleave",this.handleMouseLeave)}handleMouseOver=t=>{if(this.dragState)return;const r=t.target.closest("td, th");if(!r||!this.table.contains(r))return;const o=r.getBoundingClientRect(),s=xx(this.view,o.left+o.width/2,o.top+o.height/2);s&&(this.hovered=s,this.positionHandles(s))};handleMouseLeave=()=>{this.rowMenuOpen||this.columnMenuOpen||this.dragState||(this.hovered=null,this.rowHandle.classList.remove("is-visible"),this.columnHandle.classList.remove("is-visible"))};handleRowMenuOpenChange=t=>{this.rowMenuOpen=t,!t&&!this.hovered&&this.rowHandle.classList.remove("is-visible")};handleColumnMenuOpenChange=t=>{this.columnMenuOpen=t,!t&&!this.hovered&&this.columnHandle.classList.remove("is-visible")};handleAddRow=t=>{t.preventDefault(),Tx(this.view,this.node,this.contentDOM)};handleAddColumn=t=>{t.preventDefault(),Rx(this.view,this.node,this.contentDOM)};startDrag=(t,n)=>{const r=this.hovered;if(!r)return;const o=t==="row"?r.row:r.col;this.dragState={target:t,startIndex:o,targetIndex:o,startX:n.clientX,startY:n.clientY,hasMoved:!1,hovered:r},document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd)};handleDragMove=t=>{const n=this.dragState;if(n){if(!n.hasMoved){const r=t.clientX-n.startX,o=t.clientY-n.startY;if(Math.hypot(r,o)<Mx)return;n.hasMoved=!0,document.body.style.cursor=n.target==="row"?"row-resize":"col-resize"}n.targetIndex=n.target==="row"?this.findClosestRowIndex(t.clientY):this.findClosestColumnIndex(t.clientX),this.updateDropIndicator(n)}};handleDragEnd=()=>{const t=this.dragState;if(t){if(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd),document.body.style.cursor="",this.dropIndicator.classList.remove("is-visible"),this.dragState=null,!t.hasMoved){t.target==="row"?this.rowMenuRef.current?.open():this.columnMenuRef.current?.open();return}t.target==="row"?Nx(this.view,t.hovered,t.startIndex,t.targetIndex):Ax(this.view,t.hovered,t.startIndex,t.targetIndex)}};findClosestRowIndex(t){const n=this.table.rows;let r=0,o=1/0;for(let s=0;s<n.length;s++){const i=n[s].getBoundingClientRect(),a=Math.abs(t-(i.top+i.height/2));a<o&&(o=a,r=s)}return r}findClosestColumnIndex(t){const n=this.getColumnBoundaries();let r=0,o=1/0;for(let s=0;s<n.length-1;s++){const i=(n[s]+n[s+1])/2,a=Math.abs(t-i);a<o&&(o=a,r=s)}return r}getColumnBoundaries(){const t=this.table.rows[0],n=[];let r=0;for(let s=0;s<t.cells.length;s++){const i=t.cells[s],a=i.getBoundingClientRect(),c=a.width/i.colSpan;for(let l=0;l<i.colSpan;l++)n[r]=a.left+c*l,r++}const o=t.cells[t.cells.length-1];return n[r]=o?o.getBoundingClientRect().right:0,n}updateDropIndicator(t){if(t.targetIndex===t.startIndex){this.dropIndicator.classList.remove("is-visible");return}const n=this.dom.getBoundingClientRect(),r=this.table.getBoundingClientRect();if(t.target==="row"){const o=this.table.rows[t.targetIndex];if(!o)return;const s=o.getBoundingClientRect(),i=t.targetIndex<t.startIndex?s.top:s.bottom;this.dropIndicator.style.top=`${i-n.top}px`,this.dropIndicator.style.left=`${r.left-n.left}px`,this.dropIndicator.style.width=`${r.width}px`,this.dropIndicator.style.height="",this.dropIndicator.className="table-drop-indicator table-drop-indicator--row is-visible"}else{const o=this.getColumnBoundaries(),s=t.targetIndex<t.startIndex?o[t.targetIndex]:o[t.targetIndex+1];this.dropIndicator.style.left=`${s-n.left}px`,this.dropIndicator.style.top=`${r.top-n.top}px`,this.dropIndicator.style.height=`${r.height}px`,this.dropIndicator.style.width="",this.dropIndicator.className="table-drop-indicator table-drop-indicator--column is-visible"}}positionHandles({row:t,col:n}){const r=this.dom.getBoundingClientRect(),o=this.table.rows[t];if(!o)return;const s=o.getBoundingClientRect();this.rowHandle.style.top=`${s.top-r.top}px`,this.rowHandle.style.height=`${s.height}px`,this.rowHandle.classList.add("is-visible");const i=o.cells[this.cellIndexAtColumn(o,n)];if(!i)return;const a=i.getBoundingClientRect();this.columnHandle.style.left=`${a.left-r.left}px`,this.columnHandle.style.width=`${a.width}px`,this.columnHandle.classList.add("is-visible")}cellIndexAtColumn(t,n){let r=0;for(let o=0;o<t.cells.length;o++){if(r>n)return o-1;if(r===n)return o;r+=t.cells[o].colSpan}return t.cells.length-1}ignoreMutation(t){return this.controls.contains(t.target)?!0:super.ignoreMutation(t)}destroy(){this.dom.removeEventListener("mouseover",this.handleMouseOver),this.dom.removeEventListener("mouseleave",this.handleMouseLeave),document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd),document.body.style.cursor="",this.addRowButton.removeEventListener("mousedown",this.handleAddRow),this.addColumnButton.removeEventListener("mousedown",this.handleAddColumn),this.rowHandleRoot.unmount(),this.columnHandleRoot.unmount()}}const Ox=Lp.extend({addAttributes(){return{...this.parent?.(),backgroundColor:{default:null,renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{},parseHTML:e=>e.style.backgroundColor.replace(/['"]+/g,"")}}}}),Ix=w.Extension.create({name:"tableKit",addExtensions(){return[Bp.configure({resizable:!0,View:kx}),Ox,Pp,Dp]}}),Lx=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)}),Px=e=>e.type.startsWith("image/"),Dx=["image/png","image/jpeg","image/gif","image/webp"],Bx=({uploadFile:e,onUploadStart:t,onUploadSuccess:n,onUploadError:r,allowNonImageFile:o=!1})=>{const s=x.useRef(e),i=x.useRef(t),a=x.useRef(n),c=x.useRef(r);x.useEffect(()=>{s.current=e},[e]),x.useEffect(()=>{i.current=t},[t]),x.useEffect(()=>{a.current=n},[n]),x.useEffect(()=>{c.current=r},[r]);const l=x.useCallback(async m=>{i.current?.(m);try{return s.current?await s.current(m):await Lx(m)}catch(g){return c.current?.(g instanceof Error?g:new Error("Upload failed"),m),null}},[]),d=x.useCallback((m,g,b,v)=>{if(m){if(Px(g)){m.chain().insertContentAt(v,{type:"figure",attrs:{align:"center"},content:[{type:"image",attrs:{src:b}}]}).focus().run(),a.current?.(g);return}m.chain().insertContentAt(v,{type:"fileAttachment",attrs:{name:g.name,mimeType:g.type,url:b,size:g.size}}).focus().run(),a.current?.(g)}},[]),f=x.useCallback(async(m,g,b)=>{for(const v of g.reverse()){const E=await l(v);if(!E)return;d(m,v,E,b)}},[l,d]),h=x.useCallback(async(m,g,b)=>{if(b)return;const v=m.state.selection.anchor,E=[];for(const _ of g)E.push({file:_,url:await l(_)});for(const{file:_,url:S}of[...E].reverse())S&&d(m,_,S,v)},[l,d]),p=x.useMemo(()=>o?void 0:Dx,[o]);return{handleDrop:f,handlePaste:h,allowedMimeTypes:p,resolveFileUrl:l,insertFile:d}},Hx=({editor:e})=>{const t=ot.useEditorState({editor:e,selector:({editor:n})=>({addRowBefore:n.can().addRowBefore(),addRowAfter:n.can().addRowAfter(),deleteRow:n.can().deleteRow(),addColumnBefore:n.can().addColumnBefore(),addColumnAfter:n.can().addColumnAfter(),deleteColumn:n.can().deleteColumn(),toggleHeaderRow:n.can().toggleHeaderRow(),toggleHeaderColumn:n.can().toggleHeaderColumn(),mergeOrSplit:n.can().mergeOrSplit()})});return u.jsx(Sc.BubbleMenu,{editor:e,pluginKey:"tableBubbleMenu",shouldShow:({editor:n})=>n.isActive("table"),options:{placement:"top"},children:u.jsx(Wo,{variant:"floating",children:u.jsxs(Go,{children:[u.jsx(V,{"data-style":"ghost",tooltip:"위에 행 추가",onClick:()=>e.chain().focus().addRowBefore().run(),disabled:!t.addRowBefore,children:u.jsx(qu,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"아래에 행 추가",onClick:()=>e.chain().focus().addRowAfter().run(),disabled:!t.addRowAfter,children:u.jsx(Zu,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"행 삭제",onClick:()=>e.chain().focus().deleteRow().run(),disabled:!t.deleteRow,children:u.jsx(Ku,{className:"tiptap-button-icon"})}),u.jsx(ht,{}),u.jsx(V,{"data-style":"ghost",tooltip:"왼쪽에 열 추가",onClick:()=>e.chain().focus().addColumnBefore().run(),disabled:!t.addColumnBefore,children:u.jsx(Wu,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"오른쪽에 열 추가",onClick:()=>e.chain().focus().addColumnAfter().run(),disabled:!t.addColumnAfter,children:u.jsx(Gu,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"열 삭제",onClick:()=>e.chain().focus().deleteColumn().run(),disabled:!t.deleteColumn,children:u.jsx(Vu,{className:"tiptap-button-icon"})}),u.jsx(ht,{}),u.jsx(V,{"data-style":"ghost",tooltip:"헤더 행 토글",onClick:()=>e.chain().focus().toggleHeaderRow().run(),disabled:!t.toggleHeaderRow,children:u.jsx(Xu,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"헤더 열 토글",onClick:()=>e.chain().focus().toggleHeaderColumn().run(),disabled:!t.toggleHeaderColumn,children:u.jsx(Yu,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"셀 병합/분할",onClick:()=>e.chain().focus().mergeOrSplit().run(),disabled:!t.mergeOrSplit,children:u.jsx(Ob,{className:"tiptap-button-icon"})}),u.jsx(wx,{editor:e}),u.jsx(ht,{}),u.jsx(V,{"data-style":"ghost",tooltip:"표 삭제",onClick:()=>e.chain().focus().deleteTable().run(),children:u.jsx(zu,{className:"tiptap-button-icon"})})]})})})},Hp=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M4 2C4 1.44772 3.55228 1 3 1C2.44772 1 2 1.44772 2 2V22C2 22.5523 2.44772 23 3 23C3.55228 23 4 22.5523 4 22V2Z",fill:"currentColor"}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4C8.34315 4 7 5.34315 7 7V17C7 18.6569 8.34315 20 10 20H19C20.6569 20 22 18.6569 22 17V7C22 5.34315 20.6569 4 19 4H10ZM9 7C9 6.44772 9.44772 6 10 6H19C19.5523 6 20 6.44772 20 7V17C20 17.5523 19.5523 18 19 18H10C9.44772 18 9 17.5523 9 17V7Z",fill:"currentColor"})]}));Hp.displayName="ImageAlignLeftIcon";const Fp=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{d:"M12 1C12.5523 1 13 1.44772 13 2V22C13 22.5523 12.5523 23 12 23C11.4477 23 11 22.5523 11 22V2C11 1.44772 11.4477 1 12 1Z",fill:"currentColor"}),u.jsx("path",{d:"M2 7C2 5.34315 3.34315 4 5 4H7C7.55228 4 8 4.44772 8 5C8 5.55228 7.55228 6 7 6H5C4.44772 6 4 6.44772 4 7V17C4 17.5523 4.44772 18 5 18H7C7.55228 18 8 18.4477 8 19C8 19.5523 7.55228 20 7 20H5C3.34315 20 2 18.6569 2 17V7Z",fill:"currentColor"}),u.jsx("path",{d:"M19 4C20.6569 4 22 5.34315 22 7V17C22 18.6569 20.6569 20 19 20H17C16.4477 20 16 19.5523 16 19C16 18.4477 16.4477 18 17 18H19C19.5523 18 20 17.5523 20 17V7C20 6.44772 19.5523 6 19 6H17C16.4477 6 16 5.55228 16 5C16 4.44772 16.4477 4 17 4H19Z",fill:"currentColor"})]}));Fp.displayName="ImageAlignCenterIcon";const $p=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 1C21.5523 1 22 1.44772 22 2V22C22 22.5523 21.5523 23 21 23C20.4477 23 20 22.5523 20 22V2C20 1.44772 20.4477 1 21 1Z",fill:"currentColor"}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 7C2 5.34315 3.34315 4 5 4H14C15.6569 4 17 5.34315 17 7V17C17 18.6569 15.6569 20 14 20H5C3.34315 20 2 18.6569 2 17V7ZM5 6C4.44772 6 4 6.44772 4 7V17C4 17.5523 4.44772 18 5 18H14C14.5523 18 15 17.5523 15 17V7C15 6.44772 14.5523 6 14 6H5Z",fill:"currentColor"})]}));$p.displayName="ImageAlignRightIcon";const Up=x.memo(({className:e,...t})=>u.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 22C7 21.4477 7.44772 21 8 21H16C16.5523 21 17 21.4477 17 22C17 22.5523 16.5523 23 16 23H8C7.44772 23 7 22.5523 7 22Z",fill:"currentColor"}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 18C3 17.4477 3.44772 17 4 17H20C20.5523 17 21 17.4477 21 18C21 18.5523 20.5523 19 20 19H4C3.44772 19 3 18.5523 3 18Z",fill:"currentColor"}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5C3 3.34315 4.34315 2 6 2H18C19.6569 2 21 3.34315 21 5V11C21 12.6569 19.6569 14 18 14H6C4.34315 14 3 12.6569 3 11V5ZM6 4C5.44772 4 5 4.44772 5 5V11C5 11.5523 5.44772 12 6 12H18C18.5523 12 19 11.5523 19 11V5C19 4.44772 18.5523 4 18 4H6Z",fill:"currentColor"})]}));Up.displayName="ImageCaption";const jp=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M21 3C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H21ZM20 5H4V19H20V5ZM13 17V15H16V12H18V17H13ZM11 7V9H8V12H6V7H11Z"})}));jp.displayName="ImageRatioIcon";const zp=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.jsx("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})}));zp.displayName="CheckIcon";const Vp=x.memo(({className:e,...t})=>u.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:u.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"})}));Vp.displayName="Undo2Icon";const Fx=w.findParentNode(e=>e.type.name==="figure");function Kp(e){const t=Fx(e.state.selection);if(!t)return null;const n=t.pos+1,r=e.state.doc.nodeAt(n),o=e.view.nodeDOM(n),s=o instanceof HTMLElement?o.querySelector("img"):null;return{imagePos:n,imageNode:r,img:s}}function $x(e){const t=Kp(e);if(!t)return{width:0,height:0};const n=t.imageNode?.attrs.width,r=t.imageNode?.attrs.height;if(n&&r)return{width:n,height:r};const{img:o}=t;return o?{width:Math.round(o.offsetWidth||o.naturalWidth),height:Math.round(o.offsetHeight||o.naturalHeight)}:{width:0,height:0}}function Ux({editor:e}){const[t,n]=x.useState(!1),[r,o]=x.useState(""),[s,i]=x.useState(""),[a,c]=x.useState({width:0,height:0}),l=O=>{O&&(c($x(e)),o(""),i("")),n(O)},d=Number(r),f=Number(s),h=r!==""&&!isNaN(d)&&d>0,p=!h&&s!==""&&!isNaN(f)&&f>0,m=a.height>0?a.width/a.height:1,g=h?Math.round(d/m):null,b=p?Math.round(f*m):null,v=h?d:p?b:null,E=h?g:p?f:null,_=v!==null&&E!==null&&v>0&&E>0,S=()=>{if(!_)return;const O=Kp(e);if(!O)return;const{imagePos:D,img:j}=O;j&&(j.style.width=`${v}px`,j.style.height=`${E}px`),e.chain().setNodeSelection(D).updateAttributes("image",{width:v,height:E}).focus().run(),n(!1)},N=()=>{o(""),i("")},A=O=>{O.key==="Enter"&&(O.preventDefault(),S())},R=O=>D=>{O(D.target.value.replace(/[^0-9]/g,""))};return u.jsxs(jt,{open:t,onOpenChange:l,children:[u.jsx(zt,{asChild:!0,children:u.jsx(V,{"data-style":"ghost",tooltip:"이미지 크기 조절","data-active-state":t?"on":"off","aria-pressed":t,children:u.jsx(jp,{className:"tiptap-button-icon"})})}),u.jsx(Vt,{align:"center",side:"bottom",sideOffset:8,children:u.jsx(Fe,{children:u.jsx($e,{children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",width:"160px"},children:[u.jsx(xc,{label:"W",value:p?String(b??""):r,placeholder:String(a.width||""),disabled:p,onChange:R(o),onKeyDown:A}),u.jsx(xc,{label:"H",value:h?String(g??""):s,placeholder:String(a.height||""),disabled:h,onChange:R(i),onKeyDown:A}),u.jsx(Hi,{orientation:"horizontal",decorative:!0}),u.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"2px"},children:[u.jsx(V,{"data-style":"ghost",tooltip:"적용 (Enter)",disabled:!_,"data-disabled":!_,onClick:S,children:u.jsx(zp,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"초기화",onClick:N,children:u.jsx(Vp,{className:"tiptap-button-icon"})})]})]})})})})]})}function xc({label:e,value:t,placeholder:n,disabled:r,onChange:o,onKeyDown:s}){return u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[u.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--tt-gray-light-a-600)",width:"10px",flexShrink:0},children:e}),u.jsx(vf,{type:"text",inputMode:"numeric",value:t,placeholder:n,disabled:r,onChange:o,onKeyDown:s,style:{flex:1,minWidth:0}})]})}const ni=w.findParentNode(e=>e.type.name==="figure"),jx=({editor:e})=>{const t=ot.useEditorState({editor:e,selector:({editor:o})=>{const s=ni(o.state.selection);return s?{align:s.node.attrs.align??"center",hasFigcaption:s.node.lastChild?.type.name==="figcaption"}:{align:"center",hasFigcaption:!1}}}),n=o=>{t.align!==o&&e.chain().focus().setFigureAlign(o).run()},r=()=>{e.chain().focus().toggleFigcaption().run()};return u.jsx(Sc.BubbleMenu,{editor:e,pluginKey:"imageBubbleMenu",shouldShow:({state:o})=>!!ni(o.selection),options:{placement:"bottom"},getReferencedVirtualElement:()=>{const o=ni(e.state.selection);if(!o)return null;const s=e.view.nodeDOM(o.pos);return s instanceof HTMLElement?{getBoundingClientRect:()=>s.getBoundingClientRect()}:null},children:u.jsx(Wo,{variant:"floating",children:u.jsxs(Go,{children:[u.jsx(Ux,{editor:e}),u.jsx(ht,{}),u.jsx(V,{"data-style":"ghost",tooltip:"왼쪽 정렬","data-active-state":t.align==="left"?"on":"off","aria-pressed":t.align==="left",onClick:()=>n("left"),children:u.jsx(Hp,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"가운데 정렬","data-active-state":t.align==="center"?"on":"off","aria-pressed":t.align==="center",onClick:()=>n("center"),children:u.jsx(Fp,{className:"tiptap-button-icon"})}),u.jsx(V,{"data-style":"ghost",tooltip:"오른쪽 정렬","data-active-state":t.align==="right"?"on":"off","aria-pressed":t.align==="right",onClick:()=>n("right"),children:u.jsx($p,{className:"tiptap-button-icon"})}),u.jsx(ht,{}),u.jsx(V,{"data-style":"ghost",tooltip:"캡션","data-active-state":t.hasFigcaption?"on":"off","aria-pressed":t.hasFigcaption,onClick:r,children:u.jsx(Up,{className:"tiptap-button-icon"})})]})})})},zx=({defaultValue:e="",onChange:t,minHeight:n,maxHeight:r,uploadFile:o,onUploadStart:s,onUploadSuccess:i,onUploadError:a,allowNonImageFile:c,FileAttachmentComponent:l})=>{const{handleDrop:d,handlePaste:f,allowedMimeTypes:h,resolveFileUrl:p,insertFile:m}=Bx({uploadFile:o,onUploadStart:s,onUploadSuccess:i,onUploadError:a,allowNonImageFile:c}),g=x.useMemo(()=>({resolveFileUrl:p,insertFile:m}),[p,m]),b=x.useRef(t);x.useEffect(()=>{b.current=t},[t]);const v=ot.useEditor({extensions:[ux,Ix,Op.configure({...l&&{component:l}}),r2.configure({allowedMimeTypes:h,onDrop:d,onPaste:f})],content:e,onUpdate:({editor:E})=>{b.current?.(E.getHTML())},editorProps:{attributes:{class:"tiptap tiptap-editor"},transformPastedHTML:E=>{const _=new DOMParser().parseFromString(E,"text/html");return _.querySelectorAll("img").forEach(S=>S.remove()),_.body.innerHTML}}});return u.jsx(Vx,{minHeight:n,maxHeight:r,children:u.jsx(Ac.Provider,{value:v,children:u.jsxs(_f.Provider,{value:g,children:[u.jsx(e2,{editor:v}),u.jsx(ot.EditorContent,{editor:v}),v&&u.jsx(Hx,{editor:v}),v&&u.jsx(jx,{editor:v})]})})})},Vx=({children:e,minHeight:t,maxHeight:n})=>u.jsx("div",{className:"tiptap-wrapper",style:{"--tiptap-min-height":t,"--tiptap-max-height":n},children:e});exports.DefaultFileAttachmentComponent=ka;exports.FileAttachment=Op;exports.FileAttachmentNode=kp;exports.TiptapEditor=zx;
93
+ //# sourceMappingURL=index.cjs.map