@fileverse-dev/ddoc 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/README.md +30 -0
  2. package/dist/App.d.ts +2 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.es.js +26234 -0
  5. package/dist/index.umd.js +356 -0
  6. package/dist/main.d.ts +1 -0
  7. package/dist/packages/ddoc/color-selector.d.ts +14 -0
  8. package/dist/packages/ddoc/common/button.d.ts +20 -0
  9. package/dist/packages/ddoc/common/cutsom-tooltip.d.ts +8 -0
  10. package/dist/packages/ddoc/common/dropdown.d.ts +12 -0
  11. package/dist/packages/ddoc/common/icon.d.ts +8 -0
  12. package/dist/packages/ddoc/common/spinner.d.ts +6 -0
  13. package/dist/packages/ddoc/common/surface.d.ts +7 -0
  14. package/dist/packages/ddoc/common/toolbar.d.ts +28 -0
  15. package/dist/packages/ddoc/common/types.d.ts +19 -0
  16. package/dist/packages/ddoc/ddoc-editor.d.ts +4 -0
  17. package/dist/packages/ddoc/editor-bubble-menu.d.ts +12 -0
  18. package/dist/packages/ddoc/editor-toolbar.d.ts +6 -0
  19. package/dist/packages/ddoc/editor-utils.d.ts +56 -0
  20. package/dist/packages/ddoc/extensions/action-button/action-button-node-view.d.ts +3 -0
  21. package/dist/packages/ddoc/extensions/action-button/action-button.d.ts +16 -0
  22. package/dist/packages/ddoc/extensions/action-button/index.d.ts +1 -0
  23. package/dist/packages/ddoc/extensions/action-button/modal.d.ts +8 -0
  24. package/dist/packages/ddoc/extensions/custom-keymap.d.ts +14 -0
  25. package/dist/packages/ddoc/extensions/d-block/dblock-node-view.d.ts +4 -0
  26. package/dist/packages/ddoc/extensions/d-block/dblock.d.ts +19 -0
  27. package/dist/packages/ddoc/extensions/d-block/index.d.ts +1 -0
  28. package/dist/packages/ddoc/extensions/default-extension.d.ts +5 -0
  29. package/dist/packages/ddoc/extensions/doc.d.ts +3 -0
  30. package/dist/packages/ddoc/extensions/document/document.d.ts +2 -0
  31. package/dist/packages/ddoc/extensions/document/index.d.ts +1 -0
  32. package/dist/packages/ddoc/extensions/horizontal-rule.d.ts +2 -0
  33. package/dist/packages/ddoc/extensions/iframe/iframe.d.ts +27 -0
  34. package/dist/packages/ddoc/extensions/iframe/index.d.ts +1 -0
  35. package/dist/packages/ddoc/extensions/multi-column/column-selection.d.ts +17 -0
  36. package/dist/packages/ddoc/extensions/multi-column/column.d.ts +4 -0
  37. package/dist/packages/ddoc/extensions/multi-column/columns.d.ts +18 -0
  38. package/dist/packages/ddoc/extensions/multi-column/index.d.ts +11 -0
  39. package/dist/packages/ddoc/extensions/multi-column/menus/columns-menu.d.ts +4 -0
  40. package/dist/packages/ddoc/extensions/multi-column/menus/index.d.ts +1 -0
  41. package/dist/packages/ddoc/extensions/multi-column/utils.d.ts +22 -0
  42. package/dist/packages/ddoc/extensions/resizable-media/index.d.ts +1 -0
  43. package/dist/packages/ddoc/extensions/resizable-media/media-paste-drop-plugin/index.d.ts +1 -0
  44. package/dist/packages/ddoc/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts +12 -0
  45. package/dist/packages/ddoc/extensions/resizable-media/resizable-media-node-view.d.ts +3 -0
  46. package/dist/packages/ddoc/extensions/resizable-media/resizable-media.d.ts +27 -0
  47. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/index.d.ts +5 -0
  48. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/table-view.d.ts +18 -0
  49. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/table.d.ts +56 -0
  50. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/create-cell.d.ts +3 -0
  51. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/create-table.d.ts +3 -0
  52. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/delete-table-when-all-cells-selected.d.ts +3 -0
  53. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/get-table-node-types.d.ts +5 -0
  54. package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/is-cell-selection.d.ts +3 -0
  55. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-cell/index.d.ts +4 -0
  56. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-cell/table-cell-node-view.d.ts +4 -0
  57. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-cell/table-cell.d.ts +6 -0
  58. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-header/index.d.ts +4 -0
  59. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-header/table-header.d.ts +6 -0
  60. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-row/index.d.ts +4 -0
  61. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-row/table-row-node-view.d.ts +17 -0
  62. package/dist/packages/ddoc/extensions/supercharged-table/extension-table-row/table-row.d.ts +7 -0
  63. package/dist/packages/ddoc/extensions/supercharged-table/index.d.ts +5 -0
  64. package/dist/packages/ddoc/extensions/supercharged-table/supercharged-table-kit.d.ts +3 -0
  65. package/dist/packages/ddoc/extensions/trailing-node/index.d.ts +1 -0
  66. package/dist/packages/ddoc/extensions/trailing-node/trailing-node.d.ts +12 -0
  67. package/dist/packages/ddoc/extensions/twitter-embed/embedded-tweet.d.ts +18 -0
  68. package/dist/packages/ddoc/extensions/twitter-embed/index.d.ts +1 -0
  69. package/dist/packages/ddoc/extensions/twitter-embed/tweet-component-node-view.d.ts +3 -0
  70. package/dist/packages/ddoc/hooks/use-content-item-actions.d.ts +10 -0
  71. package/dist/packages/ddoc/hooks/use-editing-context.d.ts +10 -0
  72. package/dist/packages/ddoc/hooks/use-visibility.d.ts +21 -0
  73. package/dist/packages/ddoc/navbar/navbar.d.ts +6 -0
  74. package/dist/packages/ddoc/node-selector.d.ts +10 -0
  75. package/dist/packages/ddoc/props.d.ts +27 -0
  76. package/dist/packages/ddoc/slash-comand.d.ts +5 -0
  77. package/dist/packages/ddoc/utils/debounce.d.ts +1 -0
  78. package/dist/packages/ddoc/utils/get-render-container.d.ts +4 -0
  79. package/dist/packages/ddoc/utils/upload-images.d.ts +8 -0
  80. package/dist/style.css +1 -0
  81. package/dist/vite.svg +1 -0
  82. package/package.json +81 -0
@@ -0,0 +1,356 @@
1
+ (function(et,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],b):(et=typeof globalThis<"u"?globalThis:et||self,b(et.dpage={},et.React,et.ReactDOM))})(this,function(et,b,vt){"use strict";var xT=Object.defineProperty;var kT=(et,b,vt)=>b in et?xT(et,b,{enumerable:!0,configurable:!0,writable:!0,value:vt}):et[b]=vt;var bn=(et,b,vt)=>(kT(et,typeof b!="symbol"?b+"":b,vt),vt);function Kc(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const q=Kc(b),gg=Kc(vt);function Jc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ul={exports:{}},mo={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Zc;function yg(){if(Zc)return mo;Zc=1;var n=b,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(l,a,c){var u,d={},f=null,h=null;c!==void 0&&(f=""+c),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(h=a.ref);for(u in a)r.call(a,u)&&!i.hasOwnProperty(u)&&(d[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)d[u]===void 0&&(d[u]=a[u]);return{$$typeof:e,type:l,key:f,ref:h,props:d,_owner:o.current}}return mo.Fragment=t,mo.jsx=s,mo.jsxs=s,mo}var go={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Gc;function vg(){return Gc||(Gc=1,process.env.NODE_ENV!=="production"&&function(){var n=b,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function g(x){if(x===null||typeof x!="object")return null;var L=p&&x[p]||x[m];return typeof L=="function"?L:null}var y=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(x){{for(var L=arguments.length,j=new Array(L>1?L-1:0),Y=1;Y<L;Y++)j[Y-1]=arguments[Y];C("error",x,j)}}function C(x,L,j){{var Y=y.ReactDebugCurrentFrame,ce=Y.getStackAddendum();ce!==""&&(L+="%s",j=j.concat([ce]));var he=j.map(function(ie){return String(ie)});he.unshift("Warning: "+L),Function.prototype.apply.call(console[x],console,he)}}var v=!1,E=!1,S=!1,O=!1,D=!1,A;A=Symbol.for("react.module.reference");function P(x){return!!(typeof x=="string"||typeof x=="function"||x===r||x===i||D||x===o||x===c||x===u||O||x===h||v||E||S||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===s||x.$$typeof===l||x.$$typeof===a||x.$$typeof===A||x.getModuleId!==void 0))}function H(x,L,j){var Y=x.displayName;if(Y)return Y;var ce=L.displayName||L.name||"";return ce!==""?j+"("+ce+")":j}function N(x){return x.displayName||"Context"}function $(x){if(x==null)return null;if(typeof x.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case r:return"Fragment";case t:return"Portal";case i:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var L=x;return N(L)+".Consumer";case s:var j=x;return N(j._context)+".Provider";case a:return H(x,x.render,"ForwardRef");case d:var Y=x.displayName||null;return Y!==null?Y:$(x.type)||"Memo";case f:{var ce=x,he=ce._payload,ie=ce._init;try{return $(ie(he))}catch{return null}}}return null}var R=Object.assign,I=0,U,z,G,se,le,He,Te;function ht(){}ht.__reactDisabledLog=!0;function pt(){{if(I===0){U=console.log,z=console.info,G=console.warn,se=console.error,le=console.group,He=console.groupCollapsed,Te=console.groupEnd;var x={configurable:!0,enumerable:!0,value:ht,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}I++}}function Re(){{if(I--,I===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},x,{value:U}),info:R({},x,{value:z}),warn:R({},x,{value:G}),error:R({},x,{value:se}),group:R({},x,{value:le}),groupCollapsed:R({},x,{value:He}),groupEnd:R({},x,{value:Te})})}I<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Se=y.ReactCurrentDispatcher,mt;function _e(x,L,j){{if(mt===void 0)try{throw Error()}catch(ce){var Y=ce.stack.trim().match(/\n( *(at )?)/);mt=Y&&Y[1]||""}return`
18
+ `+mt+x}}var Je=!1,Ze;{var Qt=typeof WeakMap=="function"?WeakMap:Map;Ze=new Qt}function hn(x,L){if(!x||Je)return"";{var j=Ze.get(x);if(j!==void 0)return j}var Y;Je=!0;var ce=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var he;he=Se.current,Se.current=null,pt();try{if(L){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(lt){Y=lt}Reflect.construct(x,[],ie)}else{try{ie.call()}catch(lt){Y=lt}x.call(ie.prototype)}}else{try{throw Error()}catch(lt){Y=lt}x()}}catch(lt){if(lt&&Y&&typeof lt.stack=="string"){for(var te=lt.stack.split(`
19
+ `),Qe=Y.stack.split(`
20
+ `),xe=te.length-1,Ee=Qe.length-1;xe>=1&&Ee>=0&&te[xe]!==Qe[Ee];)Ee--;for(;xe>=1&&Ee>=0;xe--,Ee--)if(te[xe]!==Qe[Ee]){if(xe!==1||Ee!==1)do if(xe--,Ee--,Ee<0||te[xe]!==Qe[Ee]){var Tt=`
21
+ `+te[xe].replace(" at new "," at ");return x.displayName&&Tt.includes("<anonymous>")&&(Tt=Tt.replace("<anonymous>",x.displayName)),typeof x=="function"&&Ze.set(x,Tt),Tt}while(xe>=1&&Ee>=0);break}}}finally{Je=!1,Se.current=he,Re(),Error.prepareStackTrace=ce}var po=x?x.displayName||x.name:"",xr=po?_e(po):"";return typeof x=="function"&&Ze.set(x,xr),xr}function pn(x,L,j){return hn(x,!1)}function qn(x){var L=x.prototype;return!!(L&&L.isReactComponent)}function Ge(x,L,j){if(x==null)return"";if(typeof x=="function")return hn(x,qn(x));if(typeof x=="string")return _e(x);switch(x){case c:return _e("Suspense");case u:return _e("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case a:return pn(x.render);case d:return Ge(x.type,L,j);case f:{var Y=x,ce=Y._payload,he=Y._init;try{return Ge(he(ce),L,j)}catch{}}}return""}var st=Object.prototype.hasOwnProperty,en={},mn=y.ReactDebugCurrentFrame;function Rt(x){if(x){var L=x._owner,j=Ge(x.type,x._source,L?L.type:null);mn.setExtraStackFrame(j)}else mn.setExtraStackFrame(null)}function gt(x,L,j,Y,ce){{var he=Function.call.bind(st);for(var ie in x)if(he(x,ie)){var te=void 0;try{if(typeof x[ie]!="function"){var Qe=Error((Y||"React class")+": "+j+" type `"+ie+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[ie]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Qe.name="Invariant Violation",Qe}te=x[ie](L,ie,Y,j,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(xe){te=xe}te&&!(te instanceof Error)&&(Rt(ce),k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",j,ie,typeof te),Rt(null)),te instanceof Error&&!(te.message in en)&&(en[te.message]=!0,Rt(ce),k("Failed %s type: %s",j,te.message),Rt(null))}}}var Ye=Array.isArray;function gn(x){return Ye(x)}function yn(x){{var L=typeof Symbol=="function"&&Symbol.toStringTag,j=L&&x[Symbol.toStringTag]||x.constructor.name||"Object";return j}}function yr(x){try{return vr(x),!1}catch{return!0}}function vr(x){return""+x}function br(x){if(yr(x))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",yn(x)),vr(x)}var tn=y.ReactCurrentOwner,ao={key:!0,ref:!0,__self:!0,__source:!0},al,cl,si;si={};function jc(x){if(st.call(x,"ref")){var L=Object.getOwnPropertyDescriptor(x,"ref").get;if(L&&L.isReactWarning)return!1}return x.ref!==void 0}function zc(x){if(st.call(x,"key")){var L=Object.getOwnPropertyDescriptor(x,"key").get;if(L&&L.isReactWarning)return!1}return x.key!==void 0}function T(x,L){if(typeof x.ref=="string"&&tn.current&&L&&tn.current.stateNode!==L){var j=$(tn.current.type);si[j]||(k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',$(tn.current.type),x.ref),si[j]=!0)}}function _(x,L){{var j=function(){al||(al=!0,k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",L))};j.isReactWarning=!0,Object.defineProperty(x,"key",{get:j,configurable:!0})}}function Z(x,L){{var j=function(){cl||(cl=!0,k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",L))};j.isReactWarning=!0,Object.defineProperty(x,"ref",{get:j,configurable:!0})}}var ae=function(x,L,j,Y,ce,he,ie){var te={$$typeof:e,type:x,key:L,ref:j,props:ie,_owner:he};return te._store={},Object.defineProperty(te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ce}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function re(x,L,j,Y,ce){{var he,ie={},te=null,Qe=null;j!==void 0&&(br(j),te=""+j),zc(L)&&(br(L.key),te=""+L.key),jc(L)&&(Qe=L.ref,T(L,ce));for(he in L)st.call(L,he)&&!ao.hasOwnProperty(he)&&(ie[he]=L[he]);if(x&&x.defaultProps){var xe=x.defaultProps;for(he in xe)ie[he]===void 0&&(ie[he]=xe[he])}if(te||Qe){var Ee=typeof x=="function"?x.displayName||x.name||"Unknown":x;te&&_(ie,Ee),Qe&&Z(ie,Ee)}return ae(x,te,Qe,ce,Y,tn.current,ie)}}var Me=y.ReactCurrentOwner,Xe=y.ReactDebugCurrentFrame;function yt(x){if(x){var L=x._owner,j=Ge(x.type,x._source,L?L.type:null);Xe.setExtraStackFrame(j)}else Xe.setExtraStackFrame(null)}var co;co=!1;function It(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function uo(){{if(Me.current){var x=$(Me.current.type);if(x)return`
22
+
23
+ Check the render method of \``+x+"`."}return""}}function fo(x){return""}var vn={};function Vc(x){{var L=uo();if(!L){var j=typeof x=="string"?x:x.displayName||x.name;j&&(L=`
24
+
25
+ Check the top-level render call using <`+j+">.")}return L}}function ho(x,L){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var j=Vc(L);if(vn[j])return;vn[j]=!0;var Y="";x&&x._owner&&x._owner!==Me.current&&(Y=" It was passed a child from "+$(x._owner.type)+"."),yt(x),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',j,Y),yt(null)}}function wr(x,L){{if(typeof x!="object")return;if(gn(x))for(var j=0;j<x.length;j++){var Y=x[j];It(Y)&&ho(Y,L)}else if(It(x))x._store&&(x._store.validated=!0);else if(x){var ce=g(x);if(typeof ce=="function"&&ce!==x.entries)for(var he=ce.call(x),ie;!(ie=he.next()).done;)It(ie.value)&&ho(ie.value,L)}}}function hT(x){{var L=x.type;if(L==null||typeof L=="string")return;var j;if(typeof L=="function")j=L.propTypes;else if(typeof L=="object"&&(L.$$typeof===a||L.$$typeof===d))j=L.propTypes;else return;if(j){var Y=$(L);gt(j,x.props,"prop",Y,x)}else if(L.PropTypes!==void 0&&!co){co=!0;var ce=$(L);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ce||"Unknown")}typeof L.getDefaultProps=="function"&&!L.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pT(x){{for(var L=Object.keys(x.props),j=0;j<L.length;j++){var Y=L[j];if(Y!=="children"&&Y!=="key"){yt(x),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),yt(null);break}}x.ref!==null&&(yt(x),k("Invalid attribute `ref` supplied to `React.Fragment`."),yt(null))}}var hg={};function pg(x,L,j,Y,ce,he){{var ie=P(x);if(!ie){var te="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(te+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Qe=fo();Qe?te+=Qe:te+=uo();var xe;x===null?xe="null":gn(x)?xe="array":x!==void 0&&x.$$typeof===e?(xe="<"+($(x.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):xe=typeof x,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",xe,te)}var Ee=re(x,L,j,ce,he);if(Ee==null)return Ee;if(ie){var Tt=L.children;if(Tt!==void 0)if(Y)if(gn(Tt)){for(var po=0;po<Tt.length;po++)wr(Tt[po],x);Object.freeze&&Object.freeze(Tt)}else k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else wr(Tt,x)}if(st.call(L,"key")){var xr=$(x),lt=Object.keys(L).filter(function(wT){return wT!=="key"}),_c=lt.length>0?"{key: someKey, "+lt.join(": ..., ")+": ...}":"{key: someKey}";if(!hg[xr+_c]){var bT=lt.length>0?"{"+lt.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,_c,xr,bT,xr),hg[xr+_c]=!0}}return x===r?pT(Ee):hT(Ee),Ee}}function mT(x,L,j){return pg(x,L,j,!0)}function gT(x,L,j){return pg(x,L,j,!1)}var yT=gT,vT=mT;go.Fragment=r,go.jsx=yT,go.jsxs=vT}()),go}process.env.NODE_ENV==="production"?ul.exports=yg():ul.exports=vg();var w=ul.exports;const bg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA9fSURBVHgB7Z0LmFRlGcf/75nZ2ZnZXZA7BOyFS7BiKYhAGZYpGSlqaKWCyZNWmima5VOWPZh000zxbiZikFgaPeI1NUsMVFxBBQQV2AVWQK7K7s7MzuW8vd8Zgb3NMrs75zZ7fs9z5lzmzMyZ73++9/u+9/u+9xBcDlcjiECoH5IoRZLLAd8x0LgShKFg9JZTjpKlWPZ9sk/Gh0i2WD4B1Mv2Plnvl+VDeeMdOb4Omr4R9bwN0dgOGo8EXAzBZfDfRagJ4WMB7Rwwj5cjlSLKQPknBcglLMIS9kgSrZGdV5Di57Et+gadjBhchCsE5trQEDRq35Cc+RXZO0kuOwx7iMjvrwTTCyjkv9Dg6DY4HMcKbJheKr4Y0M+XnDpOLjUEJ8HcCKIqua4HENOWUmXdXjgQRwnMVWJm+wcnIUU/kMQ7W8xkEO4gJtf6FHz6bVQW+x8chCMEZpZytSZ4oZSrl8juRFn8cC+vSbLei/KGh0hV5mzGVoH5A4SRCM+SzcskKY5BPkFYK8sd2B1ZJDXxCGzCNoG5JjxVRL1eNifBJZW9TqBy8Gr5d7+g8sgzsAHLE5bfLToWQf4VdJyJ7kNclmclteeI0KthIZYJzLv7lqAucpX84uWyOwDdERZnioa7kAjOo5H7DsACLBGYt4bHS469Tf7gifBQqb4cpH2fyurXwWQ0mIjUjjWuDl2JlDQhPHEPo9JC15ertOE55mpgWg7mdf2KEa6/X37iPHhkQvnDF6IxPJtG76mDCZgisNSQx0r2fUS+/tPwyAJ6H4HkNBrc+C5yTM4FFrMjzR56Qjb7wiN7mOqg0dlUXv8ickhO7T9vDp0rqxfgidtxiEvA+lLeHJ6GHJIzgXlT0QzxHy+SKy2CR2cpEpu6lGuCM5hzY127LLC6EK4uvlLqyyIuCuHRdVhbgOrQD5EDunyXGDlX4wVwdweBMyF9BpXHHkYX6JLARnkhJgUeZtEoJnImDYs+hk7SaYG5tvjLSKSWemWu2XCDvJxKFdFX0Qk6JTBXB0YDBdLvyT3gYQV7Rakpnemo6HAly+g0YP8TnriW0kfayY8Y3sEO0iGBlW8Z9ZF5cjeNgIfF8KdRVP+njvquO2SijY4D0C3wasw2wrOlPL4927OzFpjfLx4DPy+XrZ7wsJNd8OF0Ko1UZXNyVtmdN6AEfv0+T1xH0F/1rfMGqQtlQXb2PBC+Sl69/lynoPqTCyJXZ3PqEU10uusPasCY64fZ3L0wiWQKtlA5Qto5X/AhZ6jhP0SnUUXDW+2ddmSBq8OPyyovBsgVHR1BJApbOPNUHx6/P+eu+qVUETmrvRParQ1zTeFUsfdT821Q66xzfQgUWPOnNmxiLFtpmtk4kzcWTqURjRmH5GYU2BiUHvfNzfmsPQdwy88D6H2UNQI/+nTKTIEBn+96rsJLmQbXZ87ByfBMeR0LF7L/I0Ysnvn9HbsZjXGYxqD+lpq8SeirZodE7m7rzTYFNjqbq3GFvLrSOJ/5vUa8vV5vdfxg+Ttpesy0oYyfGkBY868Q/DmsTx0BpdFlotl9RGhlKtrOwTVFF0k3vmvnCtXVMw7UAz2KCYEm9Zq+Zg5HkPtpz36W34T1qHldxuS92IKWb2Uw0Xwp8oAl9wUw6ThThx0fYnMt47On2Tj5n7SLJRcvklycbHq4lcC8tWQyUqmJyAOChYSisDWlTLFdMQcOwlIWbyv5nNivl5sebp2D9eRst0z2u3tRAq+/3XoK7pbt6fXcOxIYaFKFp6QI+P1PAwg5ZxSaX7S7TNaZBeaqkr7g5OlwCf99RTeaIZl49iXzmie9ehLm/ohFYAdlBqbpKvQFVRwOFNM8B/fSp0nudUvYhENcfqEfJ3/emmrrgTrG968zsY3VNQpB4e80bTI1F1jji+FCJo314ZyvWiPwrr2MAme7fs6XpbXAvClYKqvxcCDbP2TUfNC6rK3dkT62dTtjxSodZnFcJSEccolLgHG8CjtFQ6K1avdwDvZpM+VNRw5c//29Sdy+IHPAuZ//wTyTWRgAViwJYtwY1/h8Qkho35D1rWrnsMBMU2B/UJh26duLMGSgdQm9fpN5VsFUWAWMayIwv69yrj7B6c2jqy/247rLrSkAG8R1P+HsKDZtcfZN3yaEk1TIR/omUmk3D4XG2xge0CP3hNPxPA+aaJ8yz/az5NkUrv1d6/J05670+tb5Scx/NAmzePDmQkw+wRrXpgWcI8uqtMCMzzvBOqs2Znsmcc8+lgWmYddoD1NgnKBWfiM+JDkrytzUL/lw83XWNTZnXRNH1RqXVqgywaiUzoegH4NCAxF31oz8o3oAY0ZaZyqL8rH2QeiP7aF+fiNSOqwdlvNeNWPx0tZl6ap16Vy0ZoOOG+aZF2h9uni9PjMqb8raTASUtlIGayOsbv++X61jzm2ZBVz7HstinsDDS6k7CKwiBZT7kZLy16YKVtkQwvnTrJvm9MS/U1j3Xp6Vte0h2qrUrYRNjCzT8NtrrSsdtn+oi8DoPmhcqclL9wwM2h0gDNXEb9kbHvkJo7fUNKgXPPITpl6qKpnVNEQPF0JcpAS2boi2h9X4lcD5+rwED5gcENzDfjQ44Nk+mdi7n1G7k9VcqTZRx9W4LDVlxKNNWJpJsGnOe/v8aXESo0+JoWJyFDOuiiPVwgGli6azb4hj1JdjGPHFGO58yLx+YheTVCa6Hg5DiXftbxNGzkyKbqpj4rllze/DF1ekcIeIGokxPpZ+5J/dFEfNNi8nt6BeBOaP4DBUra+xsblYeosc3Ngo5zWpHqqzNa890BzGfimDycQxEp1DCXfzdYFDAh53tIZTTmxeHzz1Cz6cNcV36PwrLipA6afsbxDE5Mb7x9NJPPZ0ylheW21j54aGfX5RWT0Ddxwcxg8v8uOkiRrqG4BjK8mYKdgUNV558e0BvLWeEZDto0c6o0GgipXzrnTM1Jadfrn935Hq6FlwIJ8d3b5oSvSJxzmrGa+mtZw71QetxaWPO8aG8kPnDaq70PSnb3UnBvQh/OWPhVaGcMgMaWulwz+1pdXt5hBU/20kSkYZa+RTQrNtY9VkrTZVABS/RWMI4on0olBlr+PQ9I1+BGkL4lCX6bg5c+dLWfbmO3xYzE9e2jLKSuDePYFlfw8agVDMZv/HjHFnHA7Z4MAGWhx+bPUjHt0NhHfKgaFwGEMHaVi2MnsHxhA5f0A/68rkbTvaltUhtYK92BHdqaVng9MGOJBrL+2Yrb3gLD98FpU2R/Ug7HszhNTmcLNl64oQfE4of5nW0ngk0smhc1axh61G1aIvnZGdyGPHaPjetywMTkUwbiaNmi/klEo98Qq1+mRuEh6TQuRncCC3Xh8wotI9mGFOkkrQ44/R8Nd5hejdK/epq6LT3nRv4pATpSEKJBLpdrijSfHzapUWeGXkLUwIR0Rkx43xDxYC828KYPppPtz2YBJVa1L4+ED6+KhhmhGfY+Z0v2nRblIi8N+edGR/THtEsC36htowBFbzSLkay2Tzq3AoZ5ziMxaFikMZKEibRLNR5emPv1uAwS0mnqsbqrjIqWMleCWdnI6006SA4+dEascK3JSgheZROSy+eYYP48a4aGwE0wsHNw8LnMSj0hL+tZjpELop6zfqGNQvva3K2pTrLLNBI1hfeHDnkMA0MlrLNeFV6MbPZrj6xtadBI6vTLWEUEXDY1sP7jZvg+hYLCd0W4GHlRIK/K17rRzqyW2bFD3QdLe5wBR5ABy+RUTuls8BvvvGQpx2kovHIbJUrOJas6fBNvs3hleL6Z/wcCtPUWXd3qYHWruJUql7xCadizx+fN1PfpfAzfcfdpx8sCNfxnLp81oeaS3igdgr6BN+DXlc2dq5i40lz3iNhsVebnmwlcDKQc3V9Gcx6Hkr8NxrCjBlcmu/dcUQN0/y0O9t62jbZri8YSGqw9c4LfpOrigbTJhwbB5N6iCsRVnsobbealNg9fQO3gx1R9wBE7s3392s4w/3Wzdg/d3qvBw3zeKkupMyzFDJXJEqiMxHKnyBESTNJFSH+U9+49jg2m5hNUI9F6Lt52JlFpiGIso1qbnibn8aOWbUcM0YFmsXw8vyxDwzEtBSv6DBOyKZTulWD6fMOzQspbL2H0555FvZT9fL64fwcBbq8bJx3HCk044oMA1teFu+7C54OI27aGRk1ZFOyq4w2hWZJ8Z8OTycwnLsCs7L5sSsm0C8KXyC3A5PQj1D3sNG6GMk6UQaWZ/VjJSsq5M0PPK6yPxreNiJOA30X2YrrqJj7YXy6J3Q+RF42MVCPCQadIAOe6l4HYoRDlXJR0fBwzoYG6XcPZ4m7TvQkY91yg3JNeGx8oNq3G0feJgP0QE0JibSqHiHZ6B0yqVD5ZHVIvMZsjTAw2Qkjf2pr3dGXEWnfXZUEX1VcvEsqFF8HubBdAENib2ITtIlpywNiz4GnVz5QEsXkBTTPJOGRZaiC3TZ607DG/4qt9ls44I8cofGP0JZw8PoIjnp62WW79lcdIFc1CJ4dJVGybnfofKui6vIaWc+bwlPk3byYvnaInh0hgbJLbOMoi9H5Hy0Bm8qOkVy8hLZ7AGPjrBHUm+aUXnNIaYMx+HqwGiw7wkxNSPgkQX0HojPSzc/c4spQxuoQtps8agKrvYgvMpX+5AUaY2h8WaIqzBt7AqNRh3KI5dIfr5G2ssdcq91Cxi7jdbHguhMGr2nDiZhyUBg3lI8Brp+H7rxzMVm6FiBAsym0ojpsVEsG+nNu/uWoC5ylfzi5bLbPZ/VpIbZaLgLieA8GrnPEqtm+VD+Tzoq5sjmVDgw+JqJiEeKfkkVDW/BQmybqyFCf02EvlE2x9p5HSajXECvyHquVKKegQ3YmrBchTD6hGdKMlyRd9NkGGvFHN+Dgp4L2hu3bDaOyDk8R5LiouC3pVJ/qexOhHuRDgJILxs9oOZ3qSlAsBnHmUbeHJwsQs+WKztddoNwAyz+Y42WQE/dg32xV9UMTTgEx5Z9XFvSB3piGlLaJZKA450XVoKjknyr5LoeBvefTxU1MTgQV1RueFOwFKRdKK7PU8XzM8G2iHwEFQ1wmfSBP4dC/VEaEq2Fw3Fd7ZX/I2Z7aOh4+GiKXP7n5MhnJNH7yj/JbZNLTewi7JTfWC89PFXinFiCVZE3VVRAuAjXN08k6QswKDRQqjel0LUR0PQxSNHRUm0bkH42stZLzlJPWFVT+pv+36RUhhpA+n45rJ48s80QU02mJr1G5N2K4QN2EznT9GbL/wFLC+Kh6JIF9QAAAABJRU5ErkJggg==",wg=({metaData:n,setMetaData:e})=>w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx("img",{src:bg,alt:"Fileverse",className:"w-10 h-10 object-cover mr-2 rounded-lg cursor-pointer"}),w.jsx("input",{className:"custom-input w-[50%] mx-2 focus:outline-none",type:"text",placeholder:"Untitled",defaultValue:n.plugin.title||"",onChange:t=>e({...n,plugin:{...n.plugin,title:t.target.value}})})]});function Ie(n){this.content=n}Ie.prototype={constructor:Ie,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new Ie(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ie(t)},addToStart:function(n,e){return new Ie([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ie(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new Ie(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ie.from(n),n.size?new Ie(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ie.from(n),n.size?new Ie(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ie.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Ie.from=function(n){if(n instanceof Ie)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ie(e)};function Yc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=Yc(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Xc(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Xc(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class M{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-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&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new M(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new M(r,o)}cutByIndex(e,t){return e==t?M.empty:e==0&&t==this.content.length?this:new M(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new M(o,i)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Yc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xc(this,e,t,r)}findIndex(e,t=-1){if(e==0)return li(0,e);if(e==this.size)return li(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?li(r+1,s):li(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return M.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new M(t||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const dl={index:0,offset:0};function li(n,e){return dl.index=n,dl.offset=e,dl}function ai(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ai(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ai(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let de=class Wc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ai(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Wc.none;if(e instanceof Wc)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};de.none=[];class ci extends Error{}class B{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=eu(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Qc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return B.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(M.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new B(e,r,o)}}B.empty=new B(M.empty,0,0);function Qc(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Qc(i.content,e-o-1,t-o-1)))}function eu(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=eu(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function xg(n,e,t){if(t.openStart>n.depth)throw new ci("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ci("Inconsistent open depths");return tu(n,e,t,0)}function tu(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=tu(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Kn(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=kg(t,n);return Kn(i,ru(n,s,l,e,r))}else return Kn(i,ui(n,e,r))}function nu(n,e){if(!e.type.compatibleContent(n.type))throw new ci("Cannot join "+e.type.name+" onto "+n.type.name)}function fl(n,e,t){let r=n.node(t);return nu(r,e.node(t)),r}function Un(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function yo(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Un(n.nodeAfter,r),i++));for(let l=i;l<s;l++)Un(o.child(l),r);e&&e.depth==t&&e.textOffset&&Un(e.nodeBefore,r)}function Kn(n,e){return n.type.checkContent(e),n.copy(e)}function ru(n,e,t,r,o){let i=n.depth>o&&fl(n,e,o+1),s=r.depth>o&&fl(t,r,o+1),l=[];return yo(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(nu(i,s),Un(Kn(i,ru(n,e,t,r,o+1)),l)):(i&&Un(Kn(i,ui(n,e,o+1)),l),yo(e,t,o,l),s&&Un(Kn(s,ui(t,r,o+1)),l)),yo(r,null,o,l),new M(l)}function ui(n,e,t){let r=[];if(yo(null,n,t,r),n.depth>t){let o=fl(n,e,t+1);Un(Kn(o,ui(n,e,t+1)),r)}return yo(e,null,t,r),new M(r)}function kg(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(M.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class vo{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return de.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new di(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new vo(t,r,i)}static resolveCached(e,t){for(let o=0;o<hl.length;o++){let i=hl[o];if(i.pos==t&&i.doc==e)return i}let r=hl[pl]=vo.resolve(e,t);return pl=(pl+1)%Cg,r}}let hl=[],pl=0,Cg=12;class di{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Sg=Object.create(null);let Jn=class qc{constructor(e,t,r,o=de.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||M.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,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,t,r,o){return this.content.textBetween(e,t,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,t,r){return this.type==e&&ai(this.attrs,t||e.defaultAttrs||Sg)&&de.sameSet(this.marks,r||de.none)}copy(e=null){return e==this.content?this:new qc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new qc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return B.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new B(c,o.depth-s,i.depth-s)}replace(e,t,r){return xg(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return vo.resolveCached(this,e)}resolveNoCache(e){return vo.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.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()+")"),ou(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=M.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.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);let e=de.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!de.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=M.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Jn.prototype.text=void 0;class fi extends Jn{constructor(e,t,r,o){if(super(e,t,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):ou(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new fi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new fi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ou(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Zn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Eg(e,t);if(r.next==null)return Zn.empty;let o=iu(r);r.next&&r.err("Unexpected trailing text");let i=Lg(Dg(o));return Pg(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return M.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
31
+ `)}}Zn.empty=new Zn(!0);class Eg{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function iu(n){let e=[];do e.push(Ag(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ag(n){let e=[];do e.push(Tg(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Tg(n){let e=Ng(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Mg(n,e);else break;return e}function su(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Mg(n,e){let t=su(n),r=t;return n.eat(",")&&(n.next!="}"?r=su(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Og(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.groups.indexOf(e)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Ng(n){if(n.eat("(")){let e=iu(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Og(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Dg(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function lu(n,e){return e-n}function au(n,e){let t=[];return r(e),t.sort(lu);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Lg(n){let e=Object.create(null);return t(au(n,0));function t(r){let o=[];r.forEach(s=>{n[s].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]);au(n,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Zn(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(lu);i.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return i}}function Pg(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function uu(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let i=n[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function du(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new Rg(n[t]);return e}let fu=class mg{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=du(r.attrs),this.defaultAttrs=cu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Zn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:uu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Jn(this,this.computeAttrs(e),M.from(t),de.setFrom(r))}createChecked(e=null,t,r){return t=M.from(t),this.checkContent(t),new Jn(this,this.computeAttrs(e),t,de.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=M.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(M.empty,!0);return i?new Jn(this,e,t.append(i),de.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:de.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,s)=>r[i]=new mg(i,t,s));let o=t.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 i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Rg{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class hi{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=du(o.attrs),this.excluded=null;let i=cu(this.attrs);this.instance=i?new de(this,i):null}create(e=null){return!e&&this.instance?this.instance:new de(this,uu(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new hi(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class Ig{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Ie.from(e.nodes),t.marks=Ie.from(e.marks||{}),this.nodes=fu.compile(this.spec.nodes,this),this.marks=hi.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 i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Zn.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?hu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:hu(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof fu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new fi(r,r.defaultAttrs,e,de.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Jn.fromJSON(this,e)}markFromJSON(e){return de.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function hu(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Fg(n){return n.tag!=null}function $g(n){return n.style!=null}class kr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{Fg(r)?this.tags.push(r):$g(r)&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new yu(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new yu(this,t,!0);return r.addAll(e,t.from,t.to),B.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(jg(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=vu(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=vu(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new kr(e,kr.schemaRules(e)))}}const pu={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},Bg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},mu={ol:!0,ul:!0},pi=1,mi=2,bo=4;function gu(n,e,t){return e!=null?(e?pi:0)|(e==="full"?mi:0):n&&n.whitespace=="pre"?pi|mi:t&~bo}class gi{constructor(e,t,r,o,i,s,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=l,this.content=[],this.activeMarks=de.none,this.stashMarks=[],this.match=s||(l&bo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(M.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&pi)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=M.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let o=r[t];(this.type?this.type.allowsMarkType(o.type):zg(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class yu{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let o=t.topNode,i,s=gu(null,t.preserveWhitespace,0)|(r?bo:0);o?i=new gi(o.type,o.attrs,de.none,de.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new gi(null,null,de.none,de.none,!0,null,s):i=new gi(e.schema.topNodeType,null,de.none,de.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.style;if(!r||!r.length)return t();let o=this.readStyles(e.style);if(!o)return;let[i,s]=o,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);t();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&mi||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&pi)r.options&mi?t=t.replace(/\r\n?/g,`
32
+ `):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&i.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),o;mu.hasOwnProperty(r)&&this.parser.normalizeLists&&Hg(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,t));if(i?i.ignore:Bg.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let s,l=this.top,a=this.needsBlock;if(pu.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
+ `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=de.none,r=de.none;for(let o=0,i=e.length;o<i;o++){let s=e.item(o);for(let l=void 0;;){let a=this.parser.matchStyle(s,e.getPropertyValue(s),this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{a.clearMark(c)&&(r=c.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)l=a;else break}}return[t,r]}addElementByRule(e,t,r){let o,i,s;t.node?(i=this.parser.schema.nodes[t.node],i.isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):o=this.enter(i,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}o&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,t,r){let o=t||0;for(let i=t?e.childNodes[t]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let t,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,r=i,!s.length)||i.solid)break}if(!t)return!1;this.sync(r);for(let o=0;o<t.length;o++)this.enterInner(t[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let o=0;o<e.marks.length;o++)(!t.type||t.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let o=this.findPlace(e.create(t));return o&&this.enterInner(e,t,!0,r),o}enterInner(e,t=null,r=!1,o){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=gu(e,o,i.options);i.options&bo&&i.content.length==0&&(s|=bo),this.nodes.push(new gi(e,t,i.activeMarks,i.pendingMarks,r,null,s)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=Vg(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let s=o.popFromStashMark(e);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==t)break}}}function Hg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&mu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function jg(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function vu(n){let e={};for(let t in n)e[t]=n[t];return e}function zg(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}function Vg(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class Ft{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ml(t).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=Ft.renderSpec(ml(t),this.nodes[e.type.name](e));if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Ft.renderSpec(ml(r),o(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));let s,l=r?e.createElementNS(r,o):e.createElement(o),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let d=u.indexOf(" ");d>0?l.setAttributeNS(u.slice(0,d),u.slice(d+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;u<t.length;u++){let d=t[u];if(d===0){if(u<t.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=Ft.renderSpec(e,d,r);if(l.appendChild(f),h){if(s)throw new RangeError("Multiple content holes");s=h}}}return{dom:l,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ft(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=bu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return bu(e.marks)}}function bu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ml(n){return n.document||window.document}const wu=65535,xu=Math.pow(2,16);function _g(n,e){return n+e*xu}function ku(n){return n&wu}function Wg(n){return(n-(n&wu))/xu}const Cu=1,Su=2,yi=4,Eu=8;class gl{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Eu)>0}get deletedBefore(){return(this.delInfo&(Cu|yi))>0}get deletedAfter(){return(this.delInfo&(Su|yi))>0}get deletedAcross(){return(this.delInfo&yi)>0}}class at{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&at.empty)return at.empty}recover(e){let t=0,r=ku(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Wg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,i=this.inverted?2:1,s=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+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+o+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:_g(l/3,e-a),m=e==a?Su:e==d?Cu:yi;return(t<0?e!=a:e!=d)&&(m|=Eu),new gl(h,m,p)}o+=u-c}return r?e+o:new gl(e+o,0,null)}touches(e,t){let r=0,o=ku(t),i=this.inverted?2:1,s=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+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+t],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new at(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?at.empty:new at(e<0?[0,-e,0]:[0,0,e])}}at.empty=new at([]);class Cr{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new Cr(this.maps,this.mirror,e,t)}copy(){return new Cr(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new Cr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new gl(e,o,null)}}const yl=Object.create(null);class je{getMap(){return at.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=yl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in yl)throw new RangeError("Duplicate use of step JSON ID "+e);return yl[e]=t,t.prototype.jsonID=e,t}}class ke{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ke(e,null)}static fail(e){return new ke(null,e)}static fromReplace(e,t,r,o){try{return ke.ok(e.replace(t,r,o))}catch(i){if(i instanceof ci)return ke.fail(i.message);throw i}}}function vl(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(vl(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return M.fromArray(r)}class wn extends je{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new B(vl(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return ke.fromReplace(e,this.from,this.to,i)}invert(){return new $t(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new wn(t.pos,r.pos,this.mark)}merge(e){return e instanceof wn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new wn(t.from,t.to,e.markFromJSON(t.mark))}}je.jsonID("addMark",wn);class $t extends je{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new B(vl(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return ke.fromReplace(e,this.from,this.to,r)}invert(){return new wn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new $t(t.pos,r.pos,this.mark)}merge(e){return e instanceof $t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new $t(t.from,t.to,e.markFromJSON(t.mark))}}je.jsonID("removeMark",$t);class xn extends je{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ke.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ke.fromReplace(e,this.pos,this.pos+1,new B(M.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new xn(this.pos,t.marks[o]);return new xn(this.pos,this.mark)}}return new Sr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xn(t.pos,e.markFromJSON(t.mark))}}je.jsonID("addNodeMark",xn);class Sr extends je{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ke.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ke.fromReplace(e,this.pos,this.pos+1,new B(M.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new xn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sr(t.pos,e.markFromJSON(t.mark))}}je.jsonID("removeNodeMark",Sr);class Oe extends je{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&bl(e,this.from,this.to)?ke.fail("Structure replace would overwrite content"):ke.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new at([this.from,this.to-this.from,this.slice.size])}invert(e){return new Oe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Oe(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Oe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Oe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Oe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Oe(t.from,t.to,B.fromJSON(e,t.slice),!!t.structure)}}je.jsonID("replace",Oe);class Ne extends je{constructor(e,t,r,o,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(bl(e,this.from,this.gapFrom)||bl(e,this.gapTo,this.to)))return ke.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ke.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ke.fromReplace(e,this.from,this.to,r):ke.fail("Content does not fit in gap")}getMap(){return new at([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ne(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new Ne(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ne(t.from,t.to,t.gapFrom,t.gapTo,B.fromJSON(e,t.slice),t.insert,!!t.structure)}}je.jsonID("replaceAround",Ne);function bl(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function qg(n,e,t,r){let o=[],i=[],s,l;n.doc.nodesBetween(e,t,(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,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=h:o.push(s=new $t(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new wn(f,h,r))}}),o.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Ug(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof hi){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);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==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>n.step(new $t(s.from,s.to,s.style)))}function Au(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Oe(l,u,B.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new $t(l,u,c.marks[f]));if(o&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new B(M.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new Oe(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(M.empty,!0);n.replace(l,l,new B(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Kg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Er(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(i,s,t))return r;if(r==0||o.type.spec.isolating||!Kg(o,i,s))break}return null}function Jg(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=M.empty,d=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=M.from(r.node(p).copy(u)),d++):a--;let f=M.empty,h=0;for(let p=i,m=!1;p>t;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=M.from(o.node(p).copy(f)),h++):c++;n.step(new Ne(a,c,s,l,new B(u.append(f),d,h),u.size-d,!0))}function wl(n,e,t=null,r=n){let o=Zg(n,e),i=o&&Gg(r,e);return i?o.map(Tu).concat({type:e,attrs:t}).concat(i.map(Tu)):null}function Tu(n){return{type:n,attrs:null}}function Zg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function Gg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Yg(n,e,t){let r=M.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].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=M.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new Ne(o,i,o,i,new B(r,0,0),t.length,!0))}function Xg(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&t0(n.doc,n.mapping.slice(i).map(l),r)){let a=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!h?a=!1:!f&&h&&(a=!0)}a===!1&&e0(n,s,l,i),Au(n,n.mapping.slice(i).map(l,1),r,void 0,a===null);let c=n.mapping.slice(i),u=c.map(l,1),d=c.map(l+s.nodeSize,1);return n.step(new Ne(u,d,u+1,d-1,new B(M.from(r.create(o,null,s.marks)),0,0),1,!0)),a===!0&&Qg(n,s,l,i),!1}})}function Qg(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function e0(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
34
+ `))}})}function t0(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function n0(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ne(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new B(M.from(s),0,0),1,!0))}function Ar(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=t-2;c>i;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(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function r0(n,e,t=1,r){let o=n.doc.resolve(e),i=M.empty,s=M.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=M.from(o.node(l).copy(i));let u=r&&r[c];s=M.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}n.step(new Oe(e,e,new B(i.append(s),t,t),!0))}function kn(n,e){let t=n.resolve(e),r=t.index();return Mu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Mu(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function vi(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):t>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Mu(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function o0(n,e,t){let r=new Oe(e-t,e+t,B.empty,!0);n.step(r)}function i0(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Ou(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==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(s+1):r.after(s+1)}return null}function bi(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return Nu(o,i,r)?new Oe(e,t,r):new s0(o,i,r).fit()}function Nu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class s0{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=M.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(),t=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 i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new B(i,s,l);return e>-1?new Ne(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Oe(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=xl(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(M.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=xl(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new B(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=xl(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new B(wo(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new B(wo(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(s.content.size-s.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(Du(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=xo(this.placed,t,M.from(u)),this.frontier[t].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?B.empty:new B(wo(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new B(wo(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!kl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=kl(e,t,o,r,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=kl(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=xo(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=xo(this.placed,this.depth,M.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(M.empty,!0);t.childCount&&(this.placed=xo(this.placed,this.frontier.length,t))}}function wo(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(wo(n.firstChild.content,e-1,t)))}function xo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(xo(n.lastChild.content,e-1,t)))}function xl(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Du(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Du(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),n.copy(r)}function kl(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!l0(t,i.content,s)?l:null}function l0(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function a0(n){return n.spec.defining||n.spec.definingForContent}function c0(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(Nu(o,i,r))return n.step(new Oe(e,t,r));let s=Pu(o,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.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;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.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=a0(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<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let k=o.node(g-1),C=o.index(g-1);if(k.canReplaceWith(C,C,p.type,p.marks))return n.replace(o.before(g),y?i.after(g):t,new B(Lu(r.content,0,r.openStart,h),h,r.openEnd))}}let d=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),t=i.after(h))}}function Lu(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Lu(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(M.empty,!0))}return n}function u0(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=i0(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new B(M.from(r),0,0))}function d0(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=Pu(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.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 n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function Pu(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class Tr extends je{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ke.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return ke.fromReplace(e,this.pos,this.pos+1,new B(M.from(o),0,t.isLeaf?0:1))}getMap(){return at.empty}invert(e){return new Tr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Tr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Tr(t.pos,t.attr,t.value)}}je.jsonID("attr",Tr);class ko extends je{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ke.ok(r)}getMap(){return at.empty}invert(e){return new ko(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ko(t.attr,t.value)}}je.jsonID("docAttr",ko);let Mr=class extends Error{};Mr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Mr.prototype=Object.create(Error.prototype),Mr.prototype.constructor=Mr,Mr.prototype.name="TransformError";class Cl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Cr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Mr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=B.empty){let o=bi(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new B(M.from(r),0,0))}delete(e,t){return this.replace(e,t,B.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return c0(this,e,t,r),this}replaceRangeWith(e,t,r){return u0(this,e,t,r),this}deleteRange(e,t){return d0(this,e,t),this}lift(e,t){return Jg(this,e,t),this}join(e,t=1){return o0(this,e,t),this}wrap(e,t){return Yg(this,e,t),this}setBlockType(e,t=e,r,o=null){return Xg(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return n0(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Tr(e,t,r)),this}setDocAttribute(e,t){return this.step(new ko(e,t)),this}addNodeMark(e,t){return this.step(new xn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof de)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Sr(e,t)),this}split(e,t=1,r){return r0(this,e,t,r),this}addMark(e,t,r){return qg(this,e,t,r),this}removeMark(e,t,r){return Ug(this,e,t,r),this}clearIncompatible(e,t,r){return Au(this,e,t,r),this}}const Sl=Object.create(null);class J{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new El(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=B.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?B.empty:t),l==0&&Fu(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Fu(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new K(e):Or(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?Or(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Or(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Mt(e.node(0))}static atStart(e){return Or(e,e,0,0,1)||new Mt(e)}static atEnd(e){return Or(e,e,e.content.size,e.childCount,-1)||new Mt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Sl[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Sl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Sl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return K.between(this.$anchor,this.$head).getBookmark()}}J.prototype.visible=!0;class El{constructor(e,t){this.$from=e,this.$to=t}}let Ru=!1;function Iu(n){!Ru&&!n.parent.inlineContent&&(Ru=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class K extends J{constructor(e,t=e){Iu(e),Iu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return J.near(r);let o=e.resolve(t.map(this.anchor));return new K(o.parent.inlineContent?o:r,r)}replace(e,t=B.empty){if(super.replace(e,t),t==B.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof K&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new K(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=J.findFrom(t,r,!0)||J.findFrom(t,-r,!0);if(i)t=i.$head;else return J.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(J.findFrom(e,-r,!0)||J.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new K(e,t)}}J.jsonID("text",K);class wi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new wi(e.map(this.anchor),e.map(this.head))}resolve(e){return K.between(e.resolve(this.anchor),e.resolve(this.head))}}class W extends J{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?J.near(i):new W(i)}content(){return new B(M.from(this.node),0,0)}eq(e){return e instanceof W&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Al(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new W(e.resolve(t.anchor))}static create(e,t){return new W(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}W.prototype.visible=!1,J.jsonID("node",W);class Al{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new wi(r,r):new Al(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&W.isSelectable(r)?new W(t):J.near(t)}}class Mt extends J{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=B.empty){if(t==B.empty){e.delete(0,e.doc.content.size);let r=J.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Mt(e)}map(e){return new Mt(e)}eq(e){return e instanceof Mt}getBookmark(){return f0}}J.jsonID("all",Mt);const f0={map(){return this},resolve(n){return new Mt(n)}};function Or(n,e,t,r,o,i=!1){if(e.inlineContent)return K.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&W.isSelectable(l))return W.create(n,t-(o<0?l.nodeSize:0))}else{let a=Or(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function Fu(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof Oe||o instanceof Ne))return;let i=n.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(J.near(n.doc.resolve(s),t))}const $u=1,xi=2,Bu=4;class h0 extends Cl{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|$u)&~xi,this.storedMarks=null,this}get selectionSet(){return(this.updated&$u)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xi,this}ensureMarks(e){return de.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&xi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~xi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||de.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),this.selection.empty||this.setSelection(J.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Bu,this}get scrolledIntoView(){return(this.updated&Bu)>0}}function Hu(n,e){return!e||!n?n:n.bind(e)}class Co{constructor(e,t,r){this.name=e,this.init=Hu(t.init,r),this.apply=Hu(t.apply,r)}}const p0=[new Co("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Co("selection",{init(n,e){return n.selection||J.atStart(e.doc)},apply(n){return n.selection}}),new Co("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Co("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Tl{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=p0.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Co(r.key,r.spec.state,r))})}}class Nr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let 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 t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Nr(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new h0(this)}static create(e){let t=new Tl(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Nr(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Tl(this.schema,e.plugins),r=t.fields,o=new Nr(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Tl(e.schema,e.plugins),i=new Nr(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Jn.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=J.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function ju(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=ju(o,e,{})),t[r]=o}return t}class ge{constructor(e){this.spec=e,this.props={},e.props&&ju(e.props,this,this.props),this.key=e.key?e.key.key:zu("plugin")}getState(e){return e[this.key]}}const Ml=Object.create(null);function zu(n){return n in Ml?n+"$"+ ++Ml[n]:(Ml[n]=0,n+"$")}class Ce{constructor(e="key"){this.key=zu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Fe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},So=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ol=null;const nn=function(n,e,t){let r=Ol||(Ol=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},m0=function(){Ol=null},Gn=function(n,e,t,r){return t&&(Vu(n,e,t,r,-1)||Vu(n,e,t,r,1))},g0=/^(img|br|input|textarea|hr)$/i;function Vu(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Bt(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Eo(n)||g0.test(n.nodeName)||n.contentEditable=="false")return!1;e=Fe(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?Bt(n):0}else return!1}}function Bt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function y0(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Bt(n)}else if(n.parentNode&&!Eo(n))e=Fe(n),n=n.parentNode;else return null}}function v0(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Eo(n))e=Fe(n)+1,n=n.parentNode;else return null}}function b0(n,e,t){for(let r=e==0,o=e==Bt(n);r||o;){if(n==t)return!0;let i=Fe(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==Bt(n)}}function Eo(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ki=function(n){return n.focusNode&&Gn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Yn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function w0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function x0(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Ht=typeof navigator<"u"?navigator:null,_u=typeof document<"u"?document:null,Cn=Ht&&Ht.userAgent||"",Nl=/Edge\/(\d+)/.exec(Cn),Wu=/MSIE \d/.exec(Cn),Dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Cn),tt=!!(Wu||Dl||Nl),Sn=Wu?document.documentMode:Dl?+Dl[1]:Nl?+Nl[1]:0,Ot=!tt&&/gecko\/(\d+)/i.test(Cn);Ot&&+(/Firefox\/(\d+)/.exec(Cn)||[0,0])[1];const Ll=!tt&&/Chrome\/(\d+)/.exec(Cn),We=!!Ll,k0=Ll?+Ll[1]:0,qe=!tt&&!!Ht&&/Apple Computer/.test(Ht.vendor),Dr=qe&&(/Mobile\/\w+/.test(Cn)||!!Ht&&Ht.maxTouchPoints>2),bt=Dr||(Ht?/Mac/.test(Ht.platform):!1),C0=Ht?/Win/.test(Ht.platform):!1,Nt=/Android \d/.test(Cn),Ao=!!_u&&"webkitFontSmoothing"in _u.documentElement.style,S0=Ao?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function E0(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function rn(n,e){return typeof n=="number"?n:n[e]}function A0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function qu(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;s=So(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?E0(i):A0(l),u=0,d=0;if(e.top<c.top+rn(r,"top")?d=-(c.top-e.top+rn(o,"top")):e.bottom>c.bottom-rn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+rn(o,"top")-c.top:e.bottom-c.bottom+rn(o,"bottom")),e.left<c.left+rn(r,"left")?u=-(c.left-e.left+rn(o,"left")):e.right>c.right-rn(r,"right")&&(u=e.right-c.right+rn(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function T0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Uu(n.dom)}}function Uu(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=So(r));return e}function M0({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Ku(t,r==0?0:r-e)}function Ku(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Lr=null;function O0(n){if(n.setActive)return n.setActive();if(Lr)return n.focus(Lr);let e=Uu(n);n.focus(Lr==null?{get preventScroll(){return Lr={preventScroll:!0},!0}}:void 0),Lr||(Lr=!1,Ku(e,0))}function Ju(n,e){let t,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=nn(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),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){t=u,r=m,o=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=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});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!t&&a&&(t=a,o=c,r=0),t&&t.nodeType==3?N0(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:Ju(t,o)}function N0(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let i=En(r,1);if(i.top!=i.bottom&&Pl(e,i))return{node:n,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function Pl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function D0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function L0(n,e,t){let{node:r,offset:o}=Ju(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function P0(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!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}i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Zu(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Pl(e,c))return Zu(s,e,c)}}if((i=(i+1)%r)==o)break}return n}function R0(n,e){let t=n.dom.ownerDocument,r,o=0,i=x0(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!Pl(e,c)||(s=Zu(n.dom,e,c),!s))return null}if(qe)for(let c=s;r&&c;c=So(c))c.draggable&&(r=void 0);if(s=D0(s,e),r){if(Ot&&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;Ao&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=P0(n,r,o,e))}l==null&&(l=L0(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Gu(n){return n.top<n.bottom||n.left<n.right}function En(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Gu(r))return r}return Array.prototype.find.call(t,Gu)||n.getBoundingClientRect()}const I0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Yu(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=Ao||Ot;if(r.nodeType==3)if(s&&(I0.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=En(nn(r,o,o),t);if(Ot&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=En(nn(r,o-1,o-1),-1);if(c.top==a.top){let u=En(nn(r,o,o+1),-1);if(u.top!=a.top)return To(u,u.left<c.left)}}return a}else{let a=o,c=o,u=t<0?1:-1;return t<0&&!o?(c++,u=-1):t>=0&&o==r.nodeValue.length?(a--,u=1):t<0?a--:c++,To(En(nn(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==Bt(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Rl(a.getBoundingClientRect(),!1)}if(i==null&&o<Bt(r)){let a=r.childNodes[o];if(a.nodeType==1)return Rl(a.getBoundingClientRect(),!0)}return Rl(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==Bt(r))){let a=r.childNodes[o-1],c=a.nodeType==3?nn(a,Bt(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return To(En(c,1),!1)}if(i==null&&o<Bt(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?nn(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return To(En(c,-1),!0)}return To(En(r.nodeType==3?nn(r):r,-t),t>=0)}function To(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Rl(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Xu(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function F0(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Xu(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Yu(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=nn(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&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const $0=/[\u0590-\u08ac]/;function B0(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return!$0.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:Xu(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.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})}let Qu=null,ed=null,td=!1;function H0(n,e,t){return Qu==e&&ed==t?td:(Qu=e,ed=t,td=t=="up"||t=="down"?F0(n,e,t):B0(n,e,t))}const wt=0,nd=1,Xn=2,jt=3;class Mo{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=wt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];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,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>Fe(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(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof id){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof rd&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Fe(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Fe(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;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=Fe(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=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)){i=Fe(d.dom);break}t+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let f=0,h=0;f<this.children.length;f++){let p=this.children[f],m=h+p.size;if(i>h&&s<m)return p.setSelection(e-h-p.border,t-h-p.border,r,o);h=m}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),u=!1;if((Ot||qe)&&e==t){let{node:f,offset:h}=l;if(f.nodeType==3){if(u=!!(h&&f.nodeValue[h-1]==`
35
+ `),u&&h==f.nodeValue.length)for(let p=f,m;p;p=p.parentNode){if(m=p.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:Fe(m)+1});break}let g=p.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let p=f.childNodes[h-1];u=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(Ot&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||u&&qe)&&Gn(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Gn(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((c.extend||e==t)&&!u){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),d=!0}catch{}}if(!d){if(e>t){let h=l;l=a,a=h}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+i.border,a=s-i.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Xn:nd,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=jt:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Xn:jt}r=s}this.dirty=Xn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Xn:nd;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class rd extends Mo{constructor(e,t,r,o){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==wt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class j0 extends Mo{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Qn extends Mo{constructor(e,t,r,o){super(e,[],r,o),this.mark=t}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=Ft.renderSpec(document,t.type.spec.toDOM(t,r))),new Qn(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=wt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=wt}}slice(e,t,r){let o=Qn.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=$l(i,t,s,r)),e>0&&(i=$l(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}}class An extends Mo{constructor(e,t,r,o,i,s,l,a,c){super(e,[],i,s),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,t,r,o,i,s){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Ft.renderSpec(document,t.type.spec.toDOM(t)));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=ad(u,r,t),c?a=new z0(e,t,r,o,u,d||null,f,c,i,s+1):t.isText?new Ci(e,t,r,o,u,f,i):new An(e,t,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,t,r){return this.dirty==wt&&e.eq(this.node)&&Fl(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new _0(this,s&&s.node,e);U0(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?de.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=a.findIndexWithChild(i.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),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Xn)&&(s&&this.protectLocalComposition(e,s),sd(this.contentDOM,this.children,e),Dr&&K0(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof K)||r<t||o>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=J0(this.node.content,s,r-t,o-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new j0(this,i,t,o);e.input.compositionNodes.push(s),this.children=$l(this.children,r,r+o.length,e,s)}update(e,t,r,o){return this.dirty==jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=wt}updateOuterDeco(e){if(Fl(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ld(this.dom,this.nodeDOM,Il(this.outerDeco,this.node,t),Il(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function od(n,e,t,r,o){ad(r,e,n);let i=new An(void 0,n,e,t,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Ci extends An{constructor(e,t,r,o,i,s,l){super(e,t,r,o,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==jt||this.dirty!=wt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=wt||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=wt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new Ci(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=jt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class id extends Mo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==wt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class z0 extends An{constructor(e,t,r,o,i,s,l,a,c,u){super(e,t,r,o,i,s,l,c,u),this.spec=a}update(e,t,r,o){if(this.dirty==jt)return!1;if(this.spec.update){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,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 sd(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=cd(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(l,r);if(s instanceof Qn){let a=r?r.previousSibling:n.lastChild;sd(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=cd(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const Oo=function(n){n&&(this.nodeName=n)};Oo.prototype=Object.create(null);const er=[new Oo];function Il(n,e,t){if(n.length==0)return er;let r=t?er[0]:new Oo,o=[r];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&o.push(r=new Oo(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&o.length==1&&o.push(r=new Oo(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 ld(n,e,t,r){if(t==er&&r==er)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=er[0]),o=a}V0(o,l||er[0],s)}return o}function V0(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function ad(n,e,t){return ld(n,n,er,Il(e,t,n.nodeType!=1))}function Fl(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function cd(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class _0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=W0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=wt,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Qn.create(this.top,e[i],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,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,t,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,o,i){let s=this.top.children[o];return s.dirty==jt&&s.dom==s.contentDOM&&(s.dirty=Xn),s.update(e,t,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=t}}updateNextNode(e,t,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof An){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)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!=jt&&Fl(t,a.outerDeco));if(!f&&a.update(e,t,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,o,s)))return this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Xn,d.updateChildren(o,s+1),d.dirty=wt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let l=An.create(this.top,t,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,o,i){let s=An.create(this.top,e,t,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,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 i=new rd(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Qn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ci)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((qe||We)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new id(this.top,[],r,null);t!=this.top?t.children.push(o):t.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 W0(n,e){let t=e,r=t.children.length,o=n.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Qn)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function q0(n,e){return n.type.side-e.type.side}function U0(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let g=o[s++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(q0);for(let g=0;g<d.length;g++)t(d[g],c,!!a)}else t(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<n.childCount)h=c,f=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let g=p;s<o.length&&o[s].from<g&&(g=o[s].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<p&&(a=f.cut(g-i),f=f.cut(0,g-i),p=g,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function K0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function J0(n,e,t,r){for(let o=0,i=0;o<n.childCount&&i<=r;){let s=n.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<n.childCount;){let c=n.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=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>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function $l(n,e,t,r,o){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,u=l+=a.size;c>=t||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>t&&i.push(a.slice(t-c,a.size,r)))}return i}function Bl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(ki(t)){for(a=l;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&W.isSelectable(u)&&o.parent&&!(u.isInline&&b0(t.focusNode,t.focusOffset,o.dom))){let d=o.posBefore;c=new W(s==d?l:r.resolve(d))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;a=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=jl(n,a,l,u)}return c}function ud(n){return n.editable?n.hasFocus():yd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function on(n,e=!1){let t=n.state.selection;if(pd(n,t),!!ud(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&We){let r=n.domSelectionRange(),o=n.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Gn(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)G0(n);else{let{anchor:r,head:o}=t,i,s;dd&&!(t instanceof K)&&(t.$from.parent.inlineContent||(i=fd(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=fd(n,t.to))),n.docView.setSelection(r,o,n.root,e),dd&&(i&&hd(i),s&&hd(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Z0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const dd=qe||We&&k0<63;function fd(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(qe&&o&&o.contentEditable=="false")return Hl(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Hl(o);if(i)return Hl(i)}}function Hl(n){return n.contentEditable="true",qe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function hd(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Z0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ud(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function G0(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,o=r.nodeName=="IMG";o?t.setEnd(r.parentNode,Fe(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&tt&&Sn<=11&&(r.disabled=!0,r.disabled=!1)}function pd(n,e){if(e instanceof W){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(md(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else md(n)}function md(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function jl(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||K.between(e,t,r)}function gd(n){return n.editable&&!n.hasFocus()?!1:yd(n)}function yd(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Y0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Gn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function zl(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&J.findFrom(i,e)}function Tn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function vd(n,e,t){let r=n.state.selection;if(r instanceof K)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Tn(n,new K(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=zl(n.state,e);return o&&o instanceof W?Tn(n,o):!1}else if(!(bt&&t.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?W.isSelectable(i)?Tn(n,new W(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):Ao?Tn(n,new K(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof W&&r.node.isInline)return Tn(n,new K(e>0?r.$to:r.$from));{let o=zl(n.state,e);return o?Tn(n,o):!1}}}function Si(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function No(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Pr(n,e){return e<0?X0(n):Q0(n)}function X0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(Ot&&t.nodeType==1&&r<Si(t)&&No(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(No(l,-1))o=t,i=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(bd(t))break;{let l=t.previousSibling;for(;l&&No(l,-1);)o=t.parentNode,i=Fe(l),l=l.previousSibling;if(l)t=l,r=Si(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Vl(n,t,r):o&&Vl(n,o,i)}function Q0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=Si(t),i,s;for(;;)if(r<o){if(t.nodeType!=1)break;let l=t.childNodes[r];if(No(l,1))i=t,s=++r;else break}else{if(bd(t))break;{let l=t.nextSibling;for(;l&&No(l,1);)i=l.parentNode,s=Fe(l)+1,l=l.nextSibling;if(l)t=l,r=0,o=Si(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}i&&Vl(n,i,s)}function bd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function ey(n,e){for(;n&&e==n.childNodes.length&&!Eo(n);)e=Fe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function ty(n,e){for(;n&&!e&&!Eo(n);)e=Fe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Vl(n,e,t){if(e.nodeType!=3){let i,s;(s=ey(e,t))?(e=s,t=0):(i=ty(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(ki(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&on(n)},50)}function wd(n,e){let t=n.state.doc.resolve(e);if(!(We||C0)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function xd(n,e,t){let r=n.state.selection;if(r instanceof K&&!r.empty||t.indexOf("s")>-1||bt&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=zl(n.state,e);if(s&&s instanceof W)return Tn(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof Mt?J.near(s,e):J.findFrom(s,e);return l?Tn(n,l):!1}return!1}function kd(n,e){if(!(n.state.selection instanceof K))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Cd(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function ny(n){if(!qe||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Cd(n,r,"true"),setTimeout(()=>Cd(n,r,"false"),20)}return!1}function ry(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function oy(n,e){let t=e.keyCode,r=ry(e);if(t==8||bt&&t==72&&r=="c")return kd(n,-1)||Pr(n,-1);if(t==46&&!e.shiftKey||bt&&t==68&&r=="c")return kd(n,1)||Pr(n,1);if(t==13||t==27)return!0;if(t==37||bt&&t==66&&r=="c"){let o=t==37?wd(n,n.state.selection.from)=="ltr"?-1:1:-1;return vd(n,o,r)||Pr(n,o)}else if(t==39||bt&&t==70&&r=="c"){let o=t==39?wd(n,n.state.selection.from)=="ltr"?1:-1:1;return vd(n,o,r)||Pr(n,o)}else{if(t==38||bt&&t==80&&r=="c")return xd(n,-1,r)||Pr(n,-1);if(t==40||bt&&t==78&&r=="c")return ny(n)||xd(n,1,r)||Pr(n,1);if(r==(bt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Sd(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||Ft.fromSchema(n.state.schema),l=Ld(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Nd[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} ${i}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
36
+
37
+ `);return{dom:a,text:f,slice:e}}function Ed(n,e,t,r,o){let i=o.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return e?new B(M.from(n.state.schema.text(e.replace(/\r\n?/g,`
38
+ `))),0,0):B.empty;let d=n.someProp("clipboardTextParser",f=>f(e,o,r,n));if(d)l=d;else{let f=o.marks(),{schema:h}=n.state,p=Ft.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),s=ly(t),Ao&&ay(s);let c=s&&s.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=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||kr.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!iy.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=cy(Od(l,+u[1],+u[2]),u[4]);else if(l=B.maxOpen(sy(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=Od(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const iy=/^(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 sy(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&Td(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Md(s[s.length-1],i.length));let u=Ad(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return M.from(s)}return n}function Ad(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,M.from(n));return n}function Td(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let i=Td(n,e,t,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(M.from(Ad(t,n,o+1))))}}function Md(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Md(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(M.empty,!0);return n.copy(t.append(r))}function _l(n,e,t,r,o,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),o<r-1&&(l=_l(l,e,t,r,o+1,i)),o>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(M.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Od(n,e,t){return e<n.openStart&&(n=new B(_l(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new B(_l(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Nd={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 Dd=null;function Ld(){return Dd||(Dd=document.implementation.createHTMLDocument("title"))}function ly(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ld().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&Nd[r[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=n,o)for(let i=0;i<o.length;i++)t=t.querySelector(o[i])||t;return t}function ay(n){let e=n.querySelectorAll(We?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function cy(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:i,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=M.from(a.create(r[l+1],o)),i++,s++}return new B(o,i,s)}const Ue={},Ke={},uy={touchstart:!0,touchmove:!0};class dy{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function fy(n){for(let e in Ue){let t=Ue[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{py(n,r)&&!ql(n,r)&&(n.editable||!(r.type in Ke))&&t(n,r)},uy[e]?{passive:!0}:void 0)}qe&&n.dom.addEventListener("input",()=>null),Wl(n)}function Mn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function hy(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Wl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>ql(n,r))})}function ql(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function py(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function my(n,e){!ql(n,e)&&Ue[e.type]&&(n.editable||!(e.type in Ke))&&Ue[e.type](n,e)}Ke.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Rd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Nt&&We&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Dr&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,Yn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||oy(n,t)?t.preventDefault():Mn(n,"key")},Ke.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Ke.keypress=(n,e)=>{let t=e;if(Rd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||bt&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof K)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",i=>i(n,r.$from.pos,r.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function Ei(n){return{left:n.clientX,top:n.clientY}}function gy(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Ul(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),o,!0):l(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function Rr(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function yy(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&W.isSelectable(r)?(Rr(n,new W(t)),!0):!1}function vy(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof W&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(W.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(Rr(n,W.create(n.state.doc,o)),!0):!1}function by(n,e,t,r,o){return Ul(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?vy(n,t):yy(n,t))}function wy(n,e,t,r){return Ul(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function xy(n,e,t,r){return Ul(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||ky(n,t,r)}function ky(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Rr(n,K.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Rr(n,K.create(r,l+1,l+1+s.content.size));else if(W.isSelectable(s))Rr(n,W.create(r,l));else continue;return!0}}function Kl(n){return Ai(n)}const Pd=bt?"metaKey":"ctrlKey";Ue.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Kl(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&gy(t,n.input.lastClick)&&!t[Pd]&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i};let s=n.posAtCoords(Ei(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Cy(n,s,t,!!r)):(i=="doubleClick"?wy:xy)(n,s.pos,s.inside,t)?t.preventDefault():Mn(n,"pointer"))};class Cy{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Pd],this.allowDefault=r.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof W&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ot&&!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)),Mn(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(()=>on(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ei(e))),this.updateAllowDefault(e),this.allowDefault||!t?Mn(this.view,"pointer"):by(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||qe&&this.mightDrag&&!this.mightDrag.node.isAtom||We&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Rr(this.view,J.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Mn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Mn(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)}}Ue.touchstart=n=>{n.input.lastTouch=Date.now(),Kl(n),Mn(n,"pointer")},Ue.touchmove=n=>{n.input.lastTouch=Date.now(),Mn(n,"pointer")},Ue.contextmenu=n=>Kl(n);function Rd(n,e){return n.composing?!0:qe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Sy=Nt?5e3:-1;Ke.compositionstart=Ke.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ai(n,!0),n.markCursor=null;else if(Ai(n),Ot&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){n.domSelection().collapse(s,s.nodeValue.length);break}else o=s,i=-1}}n.input.composing=!0}Id(n,Sy)},Ke.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Id(n,20))};function Id(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ai(n),e))}function Fd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Ay());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Ey(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=y0(e.focusNode,e.focusOffset),r=v0(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let i=t.pmViewDesc;if(!(!i||!i.isText(t.nodeValue)))return r}}return t||r}function Ay(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ai(n,e=!1){if(!(Nt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Fd(n),e||n.docView&&n.docView.dirty){let t=Bl(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function Ty(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Do=tt&&Sn<15||Dr&&S0<604;Ue.copy=Ke.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=Do?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Sd(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Ty(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function My(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Oy(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Lo(n,r.value,null,o,e):Lo(n,r.textContent,r.innerHTML,o,e)},50)}function Lo(n,e,t,r,o){let i=Ed(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||B.empty)))return!0;if(!i)return!1;let s=My(i),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $d(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ke.paste=(n,e)=>{let t=e;if(n.composing&&!Nt)return;let r=Do?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Lo(n,$d(r),r.getData("text/html"),o,t)?t.preventDefault():Oy(n,t)};class Bd{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Hd=bt?"altKey":"ctrlKey";Ue.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(Ei(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof W?o.to-1:o.to))){if(r&&r.mightDrag)s=W.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=W.create(n.state.doc,d.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:u}=Sd(n,l);t.dataTransfer.clearData(),t.dataTransfer.setData(Do?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Do||t.dataTransfer.setData("text/plain",c),n.dragging=new Bd(u,!t[Hd],s)},Ue.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Ke.dragover=Ke.dragenter=(n,e)=>e.preventDefault(),Ke.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(Ei(t));if(!o)return;let i=n.state.doc.resolve(o.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=Ed(n,$d(t.dataTransfer),Do?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&!t[Hd]);if(n.someProp("handleDrop",p=>p(n,t,s||B.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?Ou(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&W.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new W(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,k)=>p=k),c.setSelection(jl(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))},Ue.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&on(n)},20))},Ue.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},Ue.beforeinput=(n,e)=>{if(We&&Nt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Yn(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in Ke)Ue[n]=Ke[n];function Po(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Ti{constructor(e,t){this.toDOM=e,this.spec=t||tr,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new $e(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ti&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Po(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class On{constructor(e,t){this.attrs=e,this.spec=t||tr}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new $e(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof On&&Po(this.attrs,e.attrs)&&Po(this.spec,e.spec)}static is(e){return e.type instanceof On}destroy(){}}class Jl{constructor(e,t){this.attrs=e,this.spec=t||tr}map(e,t,r,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let s=e.mapResult(t.to+o,-1);return s.deleted||s.pos<=i.pos?null:new $e(i.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:o}=e.content.findIndex(t.from),i;return o==t.from&&!(i=e.child(r)).isText&&o+i.nodeSize==t.to}eq(e){return this==e||e instanceof Jl&&Po(this.attrs,e.attrs)&&Po(this.spec,e.spec)}destroy(){}}class $e{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new $e(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new $e(e,e,new Ti(t,r))}static inline(e,t,r,o){return new $e(e,t,new On(r,o))}static node(e,t,r,o){return new $e(e,t,new Jl(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof On}get widget(){return this.type instanceof Ti}}const Ir=[],tr={};class me{constructor(e,t){this.local=e.length?e:Ir,this.children=t.length?t:Ir}static create(e,t){return t.length?Mi(t,e,0,tr):ze}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,o+l,i)}}map(e,t,r){return this==ze||e.maps.length==0?this:this.mapInner(e,t,0,0,r||tr)}mapInner(e,t,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Ny(this.children,s||[],e,t,r,o,i):s?new me(s.sort(nr),Ir):ze}add(e,t){return t.length?this==ze?me.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=zd(t,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Mi(u,l,c+1,tr)),i+=3}});let s=jd(i?Vd(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new me(s.length?this.local.concat(s).sort(nr):this.local,o||this.children)}remove(e){return e.length==0||this==ze?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=ze?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new me(o,r):ze}forChild(e,t){if(this==ze)return this;if(t.isLeaf)return me.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 i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof On){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new me(o.sort(nr),Ir);return r?new Nn([l,r]):l}return r||ze}eq(e){if(this==e)return!0;if(!(e instanceof me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Zl(this.localsInner(e))}localsInner(e){if(this==ze)return Ir;if(e.inlineContent||!this.local.some(On.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof On||t.push(this.local[r]);return t}}me.empty=new me([],[]),me.removeOverlap=Zl;const ze=me.empty;class Nn{constructor(e){this.members=e}map(e,t){const r=this.members.map(o=>o.map(e,t,tr));return Nn.from(r)}forChild(e,t){if(t.isLeaf)return me.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=ze&&(i instanceof Nn?r=r.concat(i.members):r.push(i))}return Nn.from(r)}eq(e){if(!(e instanceof Nn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?Zl(r?t:t.sort(nr)):Ir}static from(e){switch(e.length){case 0:return ze;case 1:return e[0];default:return new Nn(e.every(t=>t instanceof me)?e:e.reduce((t,r)=>t.concat(r instanceof me?r:r.members),[]))}}}function Ny(n,e,t,r,o,i,s){let l=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let y=0;y<l.length;y+=3){let k=l[y+1];if(k<0||f>k+u-d)continue;let C=l[y]+u-d;h>=C?l[y+1]=f<=C?-2:-1:f>=u&&g&&(l[y]+=g,l[y+1]+=g)}d+=g}),u=t.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=t.map(n[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-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(t,g,u+1,n[c]+i+1,s);y!=ze?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Dy(l,n,e,t,o,i,s),u=Mi(c,r,0,s);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 me(e.sort(nr),l)}function jd(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new $e(o.from+e,o.to+e,o.type))}return t}function Dy(n,e,t,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?t.push(d):s.onRemove&&s.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<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function zd(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<r&&((o||(o=[])).push(s),n[i]=null);return o}function Vd(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Mi(n,e,t,r){let o=[],i=!1;e.forEach((l,a)=>{let c=zd(n,l,a+t);if(c){i=!0;let u=Mi(c,l,t+a+1,r);u!=ze&&o.push(a,a+l.nodeSize,u)}});let s=jd(i?Vd(n):n,-t).sort(nr);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new me(s,o):ze}function nr(n,e){return n.from-e.from||n.to-e.to}function Zl(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,r.to),_d(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),_d(e,o,r.copy(i.from,r.to)));break}}}return e}function _d(n,e,t){for(;e<n.length&&nr(t,n[e])>0;)e++;n.splice(e,0,t)}function Gl(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ze&&e.push(r)}),n.cursorWrapper&&e.push(me.create(n.state.doc,[n.cursorWrapper.deco])),Nn.from(e)}const Ly={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Py=tt&&Sn<=11;class Ry{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 Iy{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ry,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);tt&&Sn<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Py&&(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,Ly)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(gd(this.view)){if(this.suppressingSelectionUpdates)return on(this.view);if(tt&&Sn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=So(i))t.add(i);for(let i=e.anchorNode;i;i=So(i))if(t.has(i)){r=i;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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&gd(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Ot&&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||By(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ki(r)&&(c=Bl(e))&&c.eq(J.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,on(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),Fy(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||on(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++)t.push(e.addedNodes[u]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(tt&&Sn<=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)&&(i=f)}let s=o&&o.parentNode==e.target?Fe(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Fe(i):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}:{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Wd=new WeakMap,qd=!1;function Fy(n){if(!Wd.has(n)&&(Wd.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ot,qd)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."),qd=!0}}function Ud(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Gn(s.node,s.offset,o,i)&&([t,r,o,i]=[o,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:i}}function $y(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return Ud(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Ud(n,t):null}function By(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Hy(n,e,t){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],ki(a)||c.push({node:a.focusNode,offset:a.focusOffset})),We&&n.input.lastKeyCode===8)for(let g=i;g>o;g--){let y=r.childNodes[g-1],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){i=g;break}if(!k||k.size)break}let d=n.state.doc,f=n.someProp("domParser")||kr.fromSchema(n.state.schema),h=d.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:jy,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+s,head:y+s}}return{doc:m,sel:p,from:s,to:l}}function jy(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(qe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||qe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const zy=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Vy(n,e,t,r,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,P=Bl(n,A);if(P&&!n.state.selection.eq(P)){if(We&&Nt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",N=>N(n,Yn(13,"Enter"))))return;let H=n.state.tr.setSelection(P);A=="pointer"?H.setMeta("pointer",!0):A=="key"&&H.scrollIntoView(),i&&H.setMeta("composition",i),n.dispatch(H)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=Hy(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let p=qy(d.content,c.doc.content,c.from,f,h);if((Dr&&n.input.lastIOSEnter>Date.now()-225||Nt)&&o.some(A=>A.nodeType==1&&!zy.test(A.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",A=>A(n,Yn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof K&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let A=Kd(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let P=n.state.tr.setSelection(A);i&&P.setMeta("composition",i),n.dispatch(P)}}return}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof K&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),tt&&Sn<=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),k=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,C;if((Dr&&n.input.lastIOSEnter>Date.now()-225&&(!k||o.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(C=J.findFrom(c.doc.resolve(m.pos+1),1,!0))&&C.head==g.pos)&&n.someProp("handleKeyDown",A=>A(n,Yn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Wy(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",A=>A(n,Yn(8,"Backspace")))){Nt&&We&&n.domObserver.suppressSelectionUpdates();return}We&&Nt&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),Nt&&!k&&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(()=>{n.someProp("handleKeyDown",function(A){return A(n,Yn(13,"Enter"))})},20));let v=p.start,E=p.endA,S,O,D;if(k){if(m.pos==g.pos)tt&&Sn<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>on(n),20)),S=n.state.tr.delete(v,E),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(D=_y(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))S=n.state.tr,D.type=="add"?S.addMark(v,E,D.mark):S.removeMark(v,E,D.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",P=>P(n,v,E,A)))return;S=n.state.tr.insertText(A,v,E)}}if(S||(S=n.state.tr.replace(v,E,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let A=Kd(n,S.doc,c.sel);A&&!(We&&Nt&&n.composing&&A.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(A.head==v||A.head==S.mapping.map(E)-1)||tt&&A.empty&&A.head==v)&&S.setSelection(A)}O&&S.ensureMarks(O),i&&S.setMeta("composition",i),n.dispatch(S.scrollIntoView())}function Kd(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:jl(n,e.resolve(t.anchor),e.resolve(t.head))}function _y(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="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(M.from(c).eq(n))return{mark:l,type:s}}function Wy(n,e,t,r,o){if(t-e<=o.pos-r.pos||Yl(r,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(Yl(i,!0,!0));return!s.parent.isTextblock||s.pos>t||Yl(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Yl(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function qy(n,e,t,r,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&n.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&Jd(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<n.size&&Jd(n.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Jd(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Uy{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new dy,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Qd),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=Yd(this),Gd(this),this.nodeViews=Xd(this),this.docView=od(this.state.doc,Zd(this),Gl(this),this.dom,this),this.domObserver=new Iy(this,(r,o,i,s)=>Vy(this,r,o,i,s)),this.domObserver.start(),fy(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Wl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Qd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Fd(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Xd(this);Jy(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Wl(this),this.editable=Yd(this),Gd(this);let a=Gl(this),c=Zd(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&T0(this);if(s){this.domObserver.stop();let h=d&&(tt||We)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Ky(o.selection,e.selection);if(d){let p=We?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ey(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=od(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Y0(this))?on(this,h):(pd(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&&M0(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof W){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&qu(this,t.getBoundingClientRect(),e)}else qu(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Bd(e.slice,e.move,o<0?void 0:W.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=t?t(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){if(tt){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&&O0(this.dom),on(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return R0(this,e)}coordsAtPos(e,t=1){return Yu(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return H0(this,t||this.state,e)}pasteHTML(e,t){return Lo(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Lo(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(hy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,m0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return my(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return qe&&this.root.nodeType===11&&w0(this.dom.ownerDocument)==this.dom&&$y(this,e)||e}domSelection(){return this.root.getSelection()}}function Zd(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[$e.node(0,n.state.doc.content.size,e)]}function Gd(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:$e.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Yd(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ky(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Xd(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Jy(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function Qd(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Dn={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:"'"},Oi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Zy=typeof navigator<"u"&&/Mac/.test(navigator.platform),Gy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Be=0;Be<10;Be++)Dn[48+Be]=Dn[96+Be]=String(Be);for(var Be=1;Be<=24;Be++)Dn[Be+111]="F"+Be;for(var Be=65;Be<=90;Be++)Dn[Be]=String.fromCharCode(Be+32),Oi[Be]=String.fromCharCode(Be);for(var Xl in Dn)Oi.hasOwnProperty(Xl)||(Oi[Xl]=Dn[Xl]);function Yy(n){var e=Zy&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Gy&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Oi:Dn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Xy=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Qy(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!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))i=!0;else if(/^mod$/i.test(a))Xy?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function e1(n){let e=Object.create(null);for(let t in n)e[Qy(t)]=n[t];return e}function Ql(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function t1(n){return new ge({props:{handleKeyDown:ea(n)}})}function ea(n){let e=e1(n);return function(t,r){let o=Yy(r),i,s=e[Ql(o,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Ql(o,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=Dn[r.keyCode])&&i!=o){let l=e[Ql(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const n1=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function ef(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const r1=(n,e,t)=>{let r=ef(n,t);if(!r)return!1;let o=ta(r);if(!o){let s=r.blockRange(),l=s&&Er(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&of(n,o,e))return!0;if(r.parent.content.size==0&&(Fr(i,"end")||W.isSelectable(i))){let s=bi(n.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Fr(i,"end")?J.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):W.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},o1=(n,e,t)=>{let r=ef(n,t);if(!r)return!1;let o=ta(r);return o?tf(n,o,e):!1},i1=(n,e,t)=>{let r=nf(n,t);if(!r)return!1;let o=na(r);return o?tf(n,o,e):!1};function tf(n,e,t){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,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=bi(n.doc,i,a,B.empty);if(!c||c.from!=i||c instanceof Oe&&c.slice.size>=a-i)return!1;if(t){let u=n.tr.step(c);u.setSelection(K.create(u.doc,i)),t(u.scrollIntoView())}return!0}function Fr(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const s1=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=ta(r)}let s=i&&i.nodeBefore;return!s||!W.isSelectable(s)?!1:(e&&e(n.tr.setSelection(W.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function ta(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function nf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const l1=(n,e,t)=>{let r=nf(n,t);if(!r)return!1;let o=na(r);if(!o)return!1;let i=o.nodeAfter;if(of(n,o,e))return!0;if(r.parent.content.size==0&&(Fr(i,"start")||W.isSelectable(i))){let s=bi(n.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Fr(i,"start")?J.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):W.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},a1=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=na(r)}let s=i&&i.nodeAfter;return!s||!W.isSelectable(s)?!1:(e&&e(n.tr.setSelection(W.create(n.doc,i.pos)).scrollIntoView()),!0)};function na(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const c1=(n,e)=>{let t=n.selection,r=t instanceof W,o;if(r){if(t.node.isTextblock||!kn(n.doc,t.from))return!1;o=t.from}else if(o=vi(n.doc,t.from,-1),o==null)return!1;if(e){let i=n.tr.join(o);r&&i.setSelection(W.create(i.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},u1=(n,e)=>{let t=n.selection,r;if(t instanceof W){if(t.node.isTextblock||!kn(n.doc,t.to))return!1;r=t.to}else if(r=vi(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},d1=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&&Er(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},f1=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
39
+ `).scrollIntoView()),!0)};function rf(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const h1=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=rf(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(J.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},p1=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof Mt||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=rf(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(K.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},m1=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Ar(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&Er(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)},g1=(n,e)=>{let{$from:t,to:r}=n.selection,o,i=t.sharedDepth(r);return i==0?!1:(o=t.before(i),e&&e(n.tr.setSelection(W.create(n.doc,o))),!0)};function y1(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||kn(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function of(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(y1(n,e,t))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(t){let d=e.pos+o.nodeSize,f=M.empty;for(let m=i.length-1;m>=0;m--)f=M.from(i[m].create(null,f));f=M.from(r.copy(f));let h=n.tr.step(new Ne(e.pos-1,d,e.pos,d,new B(f,1,0),i.length,!0)),p=d+2*i.length;kn(h.doc,p)&&h.join(p),t(h.scrollIntoView())}return!0}let a=J.findFrom(e,1),c=a&&a.$from.blockRange(a.$to),u=c&&Er(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(l&&Fr(o,"start",!0)&&Fr(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let h=o,p=1;for(;!h.isTextblock;h=h.firstChild)p++;if(d.canReplace(d.childCount,d.childCount,h.content)){if(t){let m=M.empty;for(let y=f.length-1;y>=0;y--)m=M.from(f[y].copy(m));let g=n.tr.step(new Ne(e.pos-f.length,e.pos+o.nodeSize,e.pos+p,e.pos+o.nodeSize-p,new B(m,f.length,0),0,!0));t(g.scrollIntoView())}return!0}}return!1}function sf(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(K.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}const v1=sf(-1),b1=sf(1);function w1(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=s&&wl(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function lf(n,e=null){return function(t,r){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let u=t.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function x1(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=t.doc.resolve(s.start-2);a=new di(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new di(o,t.doc.resolve(i.end(s.depth)),s.depth)),l=!0}let c=wl(a,n,e,s);return c?(r&&r(k1(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function k1(n,e,t,r,o){let i=M.empty;for(let u=t.length-1;u>=0;u--)i=M.from(t[u].type.create(t[u].attrs,i));n.step(new Ne(e.start-(r?2:0),e.end,e.start,e.end,new B(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==o&&(s=u+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ar(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function C1(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?S1(e,t,n,i):E1(e,t,i):!0:!1}}function S1(n,e,t,r){let o=n.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ne(i-1,s,i,s,new B(M.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new di(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=Er(r);if(l==null)return!1;o.lift(r,l);let a=o.mapping.map(i,-1)-1;return kn(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function E1(n,e,t){let r=n.tr,o=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?M.empty:M.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Ne(d-(l?1:0),f+(a?1:0),d+1,f-1,new B((l?M.empty:M.from(o.copy(M.empty))).append(a?M.empty:M.from(o.copy(M.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function A1(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=M.from(c?n.create():null),d=new B(M.from(n.create(null,M.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;t(e.tr.step(new Ne(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Ni(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:o}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,i=t.storedMarks,t}}}class Di{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:o}=t,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,t),y=h(...m)(g);return l.push(y),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(e,t=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:Ni({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}class T1{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(o=>o!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function V(n,e,t){return n.config[e]===void 0&&n.parent?V(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?V(n.parent,e,t):null}):n.config[e]}function Li(n){const e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function af(n){const e=[],{nodeExtensions:t,markExtensions:r}=Li(n),o=[...t,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=V(s,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=V(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function De(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function ee(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?i.split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function ra(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ee(t,r),{})}function cf(n){return typeof n=="function"}function X(n,e=void 0,...t){return cf(n)?e?n.bind(e)(...t):n(...t):n}function M1(n={}){return Object.keys(n).length===0&&n.constructor===Object}function O1(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function uf(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):O1(t.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function df(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&M1(t)?!1:t!=null))}function N1(n,e){var t;const r=af(n),{nodeExtensions:o,markExtensions:i}=Li(n),s=(t=o.find(c=>V(c,"topNode")))===null||t===void 0?void 0:t.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=n.reduce((y,k)=>{const C=V(k,"extendNodeSchema",d);return{...y,...C?C(c):{}}},{}),h=df({...f,content:X(V(c,"content",d)),marks:X(V(c,"marks",d)),group:X(V(c,"group",d)),inline:X(V(c,"inline",d)),atom:X(V(c,"atom",d)),selectable:X(V(c,"selectable",d)),draggable:X(V(c,"draggable",d)),code:X(V(c,"code",d)),defining:X(V(c,"defining",d)),isolating:X(V(c,"isolating",d)),attrs:Object.fromEntries(u.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))}),p=X(V(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>uf(y,u)));const m=V(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:ra(y,u)}));const g=V(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,y)=>{const k=V(y,"extendMarkSchema",d);return{...g,...k?k(c):{}}},{}),h=df({...f,inclusive:X(V(c,"inclusive",d)),excludes:X(V(c,"excludes",d)),group:X(V(c,"group",d)),spanning:X(V(c,"spanning",d)),code:X(V(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))}),p=X(V(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>uf(g,u)));const m=V(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:ra(g,u)})),[c.name,h]}));return new Ig({topNode:s,nodes:l,marks:a})}function oa(n,e){return e.nodes[n]||e.marks[n]||null}function ff(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const D1=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";t+=u.slice(0,Math.max(0,r-i))}),t};function ia(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Ro{constructor(e){this.find=e.find,this.handler=e.handler}}const L1=(n,e)=>{if(ia(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Pi(n){var e;const{editor:t,from:r,to:o,text:i,rules:s,plugin:l}=n,{view:a}=t;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===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=D1(c)+i;return s.forEach(f=>{if(u)return;const h=L1(d,f.find);if(!h)return;const p=a.state.tr,m=Ni({state:a.state,transaction:p}),g={from:r-(h[0].length-i.length),to:o},{commands:y,chain:k,can:C}=new Di({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:k,can:C})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),u=!0)}),u}function P1(n){const{editor:e,rules:t}=n,r=new ge({state:{init(){return null},apply(o,i){const s=o.getMeta(r);if(s)return s;const l=o.getMeta("applyInputRules");return!!l&&setTimeout(()=>{const{from:c,text:u}=l,d=c+u.length;Pi({editor:e,from:c,to:d,text:u,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return Pi({editor:e,from:i,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&Pi({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?Pi({editor:e,from:s.pos,to:s.pos,text:`
40
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function R1(n){return typeof n=="number"}class I1{constructor(e){this.find=e.find,this.handler=e.handler}}const F1=(n,e,t)=>{if(ia(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=n,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function $1(n){const{editor:e,state:t,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Di({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,o,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(o,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"");F1(y,i.find,s).forEach(C=>{if(C.index===void 0)return;const v=m+C.index+1,E=v+C[0].length,S={from:t.tr.mapping.map(v),to:t.tr.mapping.map(E)},O=i.handler({state:t,range:S,match:C,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(O)})}),d.every(h=>h!==null)}const B1=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function H1(n){const{editor:e,rules:t}=n;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null;const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=Ni({state:u,transaction:m});if(!(!$1({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m};return t.map(u=>new ge({view(d){const f=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(d,f)=>(i=r===d.dom.parentElement,l=f,!1),paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,o=!!(p!=null&&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"&&!i,y=p.getMeta("applyPasteRules"),k=!!y;if(!m&&!g&&!k)return;if(k){const{from:E,text:S}=y,O=E+S.length,D=B1(S);return a({rule:u,state:h,from:E,to:{b:O},pasteEvt:D})}const C=f.doc.content.findDiffStart(h.doc.content),v=f.doc.content.findDiffEnd(h.doc.content);if(!(!R1(C)||!v||C===v.b))return a({rule:u,state:h,from:C,to:v,pasteEvt:s})}}))}function j1(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class $r{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=$r.resolve(e),this.schema=N1(this.extensions,t),this.setupExtensions()}static resolve(e){const t=$r.sort($r.flatten(e)),r=j1(t.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},o=V(t,"addExtensions",r);return o?[t,...this.flatten(o())]:t}).flat(10)}static sort(e){return e.sort((r,o)=>{const i=V(r,"priority")||100,s=V(o,"priority")||100;return i>s?-1:i<s?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:oa(t.name,this.schema)},o=V(t,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){const{editor:e}=this,t=$r.sort([...this.extensions].reverse()),r=[],o=[],i=t.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:oa(s.name,this.schema)},a=[],c=V(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&s.config.exitable&&(u.ArrowRight=()=>nt.handleExit({editor:e,mark:s})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));u={...u,...m}}const d=t1(u);a.push(d);const f=V(s,"addInputRules",l);ff(s,e.options.enableInputRules)&&f&&r.push(...f());const h=V(s,"addPasteRules",l);ff(s,e.options.enablePasteRules)&&h&&o.push(...h());const p=V(s,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[P1({editor:e,rules:r}),...H1({editor:e,rules:o}),...i]}get attributes(){return af(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Li(this.extensions);return Object.fromEntries(t.filter(r=>!!V(r,"addNodeView")).map(r=>{const o=this.attributes.filter(a=>a.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:De(r.name,this.schema)},s=V(r,"addNodeView",i);if(!s)return[];const l=(a,c,u,d)=>{const f=ra(a,o);return s()({editor:e,node:a,getPos:u,decorations:d,HTMLAttributes:f,extension:r})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:oa(e.name,this.schema)};e.type==="mark"&&(!((t=X(V(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const o=V(e,"onBeforeCreate",r),i=V(e,"onCreate",r),s=V(e,"onUpdate",r),l=V(e,"onSelectionUpdate",r),a=V(e,"onTransaction",r),c=V(e,"onFocus",r),u=V(e,"onBlur",r),d=V(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),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)})}}function z1(n){return Object.prototype.toString.call(n).slice(8,-1)}function sa(n){return z1(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Ri(n,e){const t={...n};return sa(n)&&sa(e)&&Object.keys(e).forEach(r=>{sa(e[r])?r in n?t[r]=Ri(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class ve{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=X(V(this,"addOptions",{name:this.name}))),this.storage=X(V(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ve(e)}configure(e={}){const t=this.extend();return t.parent=this.parent,t.options=Ri(this.options,e),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new ve({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=X(V(t,"addOptions",{name:t.name})),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}}function hf(n,e,t){const{from:r,to:o}=e,{blockSeparator:i=`
41
+
42
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const h=s==null?void 0:s[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==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function pf(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const V1=ve.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ge({key:new Ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=pf(t);return hf(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),_1=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),W1=(n=!1)=>({commands:e})=>e.setContent("",n),q1=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.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=Er(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},U1=n=>e=>n(e),K1=()=>({state:n,dispatch:e})=>p1(n,e),J1=(n,e)=>({editor:t,tr:r})=>{const{state:o}=t,i=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new K(r.doc.resolve(s-1))),!0},Z1=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const o=n.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const l=o.before(i),a=o.after(i);n.delete(l,a).scrollIntoView()}return!0}return!1},G1=n=>({tr:e,state:t,dispatch:r})=>{const o=De(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Y1=n=>({tr:e,dispatch:t})=>{const{from:r,to:o}=n;return t&&e.delete(r,o),!0},X1=()=>({state:n,dispatch:e})=>n1(n,e),Q1=()=>({commands:n})=>n.keyboardShortcut("Enter"),ev=()=>({state:n,dispatch:e})=>h1(n,e);function Ii(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:ia(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function la(n,e,t={}){return n.find(r=>r.type===e&&Ii(r.attrs,t))}function tv(n,e,t={}){return!!la(n,e,t)}function aa(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const o=la([...r.node.marks],e,t);if(!o)return;let i=r.index,s=n.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(la([...r.node.marks],e,t);i>0&&o.isInSet(n.parent.child(i-1).marks);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&tv([...n.parent.child(l).marks],e,t);)a+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Ln(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const nv=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const i=Ln(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:u}=l;if(o){const d=aa(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=K.create(s,d.from,d.to);t.setSelection(f)}}return!0},rv=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ca(n){return n instanceof K}function sn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function mf(n,e=null){if(!e)return null;const t=J.atStart(n),r=J.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const o=t.from,i=r.to;return e==="all"?K.create(n,sn(0,o,i),sn(n.content.size,o,i)):K.create(n,sn(e,o,i),sn(e,o,i))}function Fi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const ov=(n=null,e={})=>({editor:t,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{Fi()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!ca(t.state.selection))return s(),!0;const l=mf(o.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},iv=(n,e)=>t=>n.every((r,o)=>e(r,{...t,index:o})),sv=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),gf=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&gf(r)}return n};function yf(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return gf(t)}function $i(n,e,t){t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{return Array.isArray(n)&&n.length>0?M.fromArray(n.map(s=>e.nodeFromJSON(s))):e.nodeFromJSON(n)}catch(i){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),$i("",e,t)}if(o){const i=kr.fromSchema(e);return t.slice?i.parseSlice(yf(n),t.parseOptions).content:i.parse(yf(n),t.parseOptions)}return $i("",e,t)}function lv(n,e,t){const r=n.steps.length-1;if(r<e)return;const o=n.steps[r];if(!(o instanceof Oe||o instanceof Ne))return;const i=n.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),n.setSelection(J.near(n.doc.resolve(s),t))}const av=n=>n.toString().startsWith("<"),cv=(n,e,t)=>({tr:r,dispatch:o,editor:i})=>{if(o){t={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};const s=$i(e,i.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(s.toString()==="<>")return!0;let{from:l,to:a}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},c=!0,u=!0;if((av(s)?s:[s]).forEach(h=>{h.check(),c=c?h.isText&&h.marks.length===0:!1,u=u?h.isBlock:!1}),l===a&&u){const{parent:h}=r.doc.resolve(l);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(l-=1,a+=1)}let f;c?(Array.isArray(e)?f=e.map(h=>h.text||"").join(""):typeof e=="object"&&e&&e.text?f=e.text:f=e,r.insertText(f,l,a)):(f=s,r.replaceWith(l,a,f)),t.updateSelection&&lv(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:f}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:f})}return!0},uv=()=>({state:n,dispatch:e})=>c1(n,e),dv=()=>({state:n,dispatch:e})=>u1(n,e),fv=()=>({state:n,dispatch:e})=>r1(n,e),hv=()=>({state:n,dispatch:e})=>l1(n,e),pv=()=>({tr:n,state:e,dispatch:t})=>{try{const r=vi(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},mv=()=>({state:n,dispatch:e,tr:t})=>{try{const r=vi(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},gv=()=>({state:n,dispatch:e})=>o1(n,e),yv=()=>({state:n,dispatch:e})=>i1(n,e);function vf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function vv(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!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))i=!0;else if(/^mod$/i.test(a))Fi()||vf()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),o&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}const bv=n=>({editor:e,view:t,tr:r,dispatch:o})=>{const i=vv(n).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function Io(n,e,t={}){const{from:r,to:o,empty:i}=n.selection,s=e?De(e,n.schema):null,l=[];n.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=>s?s.name===d.node.type.name:!0).filter(d=>Ii(d.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const wv=(n,e={})=>({state:t,dispatch:r})=>{const o=De(n,t.schema);return Io(t,o,e)?d1(t,r):!1},xv=()=>({state:n,dispatch:e})=>m1(n,e),kv=n=>({state:e,dispatch:t})=>{const r=De(n,e.schema);return C1(r)(e,t)},Cv=()=>({state:n,dispatch:e})=>f1(n,e);function Bi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function bf(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}const Sv=(n,e)=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null;const l=Bi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(i=De(n,r.schema)),l==="mark"&&(s=Ln(n,r.schema)),o&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{i&&i===c.type&&t.setNodeMarkup(u,void 0,bf(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&t.addMark(u,u+c.nodeSize,s.create(bf(d.attrs,e)))})})}),!0):!1},Ev=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Av=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),Tv=()=>({state:n,dispatch:e})=>s1(n,e),Mv=()=>({state:n,dispatch:e})=>a1(n,e),Ov=()=>({state:n,dispatch:e})=>g1(n,e),Nv=()=>({state:n,dispatch:e})=>b1(n,e),Dv=()=>({state:n,dispatch:e})=>v1(n,e);function wf(n,e,t={}){return $i(n,e,{slice:!1,parseOptions:t})}const Lv=(n,e=!1,t={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,l=wf(n,o.schema,t);return i&&r.replaceWith(0,s.content.size,l).setMeta("preventUpdate",!e),!0};function Fo(n,e){const t=Ln(e,n.schema),{from:r,to:o,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Pv(n,e){const t=new Cl(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}function Rv(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Iv(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(o,i)=>{t(o)&&r.push({node:o,pos:i})}),r}function ua(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function da(n){return e=>ua(e.$from,n)}function Fv(n,e){const t=Ft.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}function $v(n,e){const t={from:0,to:n.content.size};return hf(n,t,e)}function Bv(n,e){const t=De(e,n.schema),{from:r,to:o}=n.selection,i=[];n.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function xf(n,e){const t=Bi(typeof e=="string"?e:e.name,n.schema);return t==="node"?Bv(n,e):t==="mark"?Fo(n,e):{}}function Hv(n,e=JSON.stringify){const t={};return n.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function jv(n){const e=Hv(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,s)=>s!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function zv(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).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}})})}),jv(r)}function fa(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(o=>{const i=t.resolve(n-1),s=aa(i,o.type);s&&r.push({mark:o,...s})}):t.nodesBetween(n,e,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function Hi(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const o=n.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function ha(n,e,t={}){const{empty:r,ranges:o}=n.selection,i=e?Ln(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Ii(d.attrs,t,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),k=Math.min(p,g+m.nodeSize),C=k-y;s+=C,l.push(...m.marks.map(v=>({mark:v,from:y,to:k})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Ii(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Vv(n,e,t={}){if(!e)return Io(n,null,t)||ha(n,null,t);const r=Bi(e,n.schema);return r==="node"?Io(n,e,t):r==="mark"?ha(n,e,t):!1}function kf(n,e){const{nodeExtensions:t}=Li(e),r=t.find(s=>s.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=X(V(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function _v(n){var e;const t=(e=n.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=n.toJSON();return JSON.stringify(t)===JSON.stringify(r)}function Cf(n){return n instanceof W}function Wv(n,e,t){const o=n.state.doc.content.size,i=sn(e,0,o),s=sn(t,0,o),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h=f-d,p=u-c,y={top:c,bottom:u,left:d,right:f,width:h,height:p,x:d,y:c};return{...y,toJSON:()=>y}}function qv(n,e,t){var r;const{selection:o}=e;let i=null;if(ca(o)&&(i=o.$cursor),i){const l=(r=n.storedMarks)!==null&&r!==void 0?r:i.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}const Uv=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=Ln(n,r.schema);if(o)if(s){const c=Fo(r,a);t.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&&t.addMark(p,m,a.create({...y.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return qv(r,t,a)},Kv=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Jv=(n,e={})=>({state:t,dispatch:r,chain:o})=>{const i=De(n,t.schema);return i.isTextblock?o().command(({commands:s})=>lf(i,e)(t)?!0:s.clearNodes()).command(({state:s})=>lf(i,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Zv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,o=sn(n,0,r.content.size),i=W.create(r,o);e.setSelection(i)}return!0},Gv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:o,to:i}=typeof n=="number"?{from:n,to:n}:n,s=K.atStart(r).from,l=K.atEnd(r).to,a=sn(o,s,l),c=sn(i,s,l),u=K.create(r,a,c);e.setSelection(u)}return!0},Yv=n=>({state:e,dispatch:t})=>{const r=De(n,e.schema);return A1(r)(e,t)};function Sf(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(o=>e==null?void 0:e.includes(o.type.name));n.tr.ensureMarks(r)}}const Xv=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=Hi(c,l.node().type.name,l.node().attrs);if(i instanceof W&&i.node.isBlock)return!l.parentOffset||!Ar(s,l.pos)?!1:(r&&(n&&Sf(t,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const d=a.parentOffset===a.parent.content.size;i instanceof K&&e.deleteSelection();const f=l.depth===0?void 0:Rv(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ar(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ar(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),p&&(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)}n&&Sf(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Qv=n=>({tr:e,state:t,dispatch:r,editor:o})=>{var i;const s=De(n,t.schema),{$from:l,$to:a}=t.selection,c=t.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==s)return!1;const d=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let g=M.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let O=l.depth-y;O>=l.depth-3;O-=1)g=M.from(l.node(O).copy(g));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C=Hi(d,l.node().type.name,l.node().attrs),v=((i=s.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(C))||void 0;g=g.append(M.from(s.createAndFill(null,v)||void 0));const E=l.before(l.depth-(y-1));e.replace(E,l.after(-k),new B(g,4-y,0));let S=-1;e.doc.nodesBetween(E,e.doc.content.size,(O,D)=>{if(S>-1)return!1;O.isTextblock&&O.content.size===0&&(S=D+1)}),S>-1&&e.setSelection(K.near(e.doc.resolve(S))),e.scrollIntoView()}return!0}const f=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,h=Hi(d,u.type.name,u.attrs),p=Hi(d,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const m=f?[{type:s,attrs:h},{type:f,attrs:p}]:[{type:s,attrs:h}];if(!Ar(e.doc,l.pos,2))return!1;if(r){const{selection:g,storedMarks:y}=t,{splittableMarks:k}=o.extensionManager,C=y||g.$to.parentOffset&&g.$from.marks();if(e.split(l.pos,2,m).scrollIntoView(),!C||!r)return!0;const v=C.filter(E=>k.includes(E.type.name));e.ensureMarks(v)}return!0},pa=(n,e)=>{const t=da(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&kn(n.doc,t.pos)&&n.join(t.pos),!0},ma=(n,e)=>{const t=da(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===(o==null?void 0:o.type)&&kn(n.doc,r)&&n.join(r),!0};var eb=Object.freeze({__proto__:null,blur:_1,clearContent:W1,clearNodes:q1,command:U1,createParagraphNear:K1,cut:J1,deleteCurrentNode:Z1,deleteNode:G1,deleteRange:Y1,deleteSelection:X1,enter:Q1,exitCode:ev,extendMarkRange:nv,first:rv,focus:ov,forEach:iv,insertContent:sv,insertContentAt:cv,joinUp:uv,joinDown:dv,joinBackward:fv,joinForward:hv,joinItemBackward:pv,joinItemForward:mv,joinTextblockBackward:gv,joinTextblockForward:yv,keyboardShortcut:bv,lift:wv,liftEmptyBlock:xv,liftListItem:kv,newlineInCode:Cv,resetAttributes:Sv,scrollIntoView:Ev,selectAll:Av,selectNodeBackward:Tv,selectNodeForward:Mv,selectParentNode:Ov,selectTextblockEnd:Nv,selectTextblockStart:Dv,setContent:Lv,setMark:Uv,setMeta:Kv,setNode:Jv,setNodeSelection:Zv,setTextSelection:Gv,sinkListItem:Yv,splitBlock:Xv,splitListItem:Qv,toggleList:(n,e,t,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=De(n,s.schema),p=De(e,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:k}=m,C=y.blockRange(k),v=g||m.$to.parentOffset&&m.$from.marks();if(!C)return!1;const E=da(S=>kf(S.type.name,d))(m);if(C.depth>=1&&E&&C.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(kf(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>pa(i,h)).command(()=>ma(i,h)).run()}return!t||!v||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>pa(i,h)).command(()=>ma(i,h)).run():a().command(()=>{const S=u().wrapInList(h,r),O=v.filter(D=>f.includes(D.type.name));return i.ensureMarks(O),S?!0:c.clearNodes()}).wrapInList(h,r).command(()=>pa(i,h)).command(()=>ma(i,h)).run()},toggleMark:(n,e={},t={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=t,s=Ln(n,r.schema);return ha(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},toggleNode:(n,e,t={})=>({state:r,commands:o})=>{const i=De(n,r.schema),s=De(e,r.schema);return Io(r,i,t)?o.setNode(s):o.setNode(i,t)},toggleWrap:(n,e={})=>({state:t,commands:r})=>{const o=De(n,t.schema);return Io(t,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const o=t[r];let i;if(o.spec.isInputRules&&(i=o.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},unsetMark:(n,e={})=>({tr:t,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Ln(n,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:h}=l;const p=(i=c.marks().find(g=>g.type===a))===null||i===void 0?void 0:i.attrs,m=aa(c,a,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,a)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},updateAttributes:(n,e={})=>({tr:t,state:r,dispatch:o})=>{let i=null,s=null;const l=Bi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(i=De(n,r.schema)),l==="mark"&&(s=Ln(n,r.schema)),o&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{i&&i===d.type&&t.setNodeMarkup(f,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(h=>{if(s===h.type){const p=Math.max(f,c),m=Math.min(f+d.nodeSize,u);t.addMark(p,m,s.create({...h.attrs,...e}))}})})}),!0):!1},wrapIn:(n,e={})=>({state:t,dispatch:r})=>{const o=De(n,t.schema);return w1(o,e)(t,r)},wrapInList:(n,e={})=>({state:t,dispatch:r})=>{const o=De(n,t.schema);return x1(o,e)(t,r)}});const tb=ve.create({name:"commands",addCommands(){return{...eb}}}),nb=ve.create({name:"editable",addProseMirrorPlugins(){return[new ge({key:new Ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rb=ve.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ge({key:new Ce("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ob=ve.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.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:J.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Fi()||vf()?i:o},addProseMirrorPlugins(){return[new ge({key:new Ce("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(p=>p.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:o,from:i,to:s}=e.selection,l=J.atStart(e.doc).from,a=J.atEnd(e.doc).to;if(o||!(i===l&&s===a)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const d=t.tr,f=Ni({state:t,transaction:d}),{commands:h}=new Di({editor:this.editor,state:f});if(h.clearNodes(),!!d.steps.length)return d}})]}}),ib=ve.create({name:"tabindex",addProseMirrorPlugins(){return[new ge({key:new Ce("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class rr{constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,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!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new rr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new rr(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 rr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const o=t.isBlock&&!t.isTextblock,i=this.pos+r+1,s=this.resolvedPos.doc.resolve(i);if(!o&&s.depth<=this.depth)return;const l=new rr(s,this.editor,o,o?t:null);o&&(l.actualDepth=this.depth+1),e.push(new rr(s,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){const i=o.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==t[a])break}}else r=o;o=o.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(t);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(a=>t[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,t,r))))}),o}setAttribute(e){const t=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(t.from).run()}}const sb=`.ProseMirror {
43
+ position: relative;
44
+ }
45
+
46
+ .ProseMirror {
47
+ word-wrap: break-word;
48
+ white-space: pre-wrap;
49
+ white-space: break-spaces;
50
+ -webkit-font-variant-ligatures: none;
51
+ font-variant-ligatures: none;
52
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
53
+ }
54
+
55
+ .ProseMirror [contenteditable="false"] {
56
+ white-space: normal;
57
+ }
58
+
59
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
60
+ white-space: pre-wrap;
61
+ }
62
+
63
+ .ProseMirror pre {
64
+ white-space: pre-wrap;
65
+ }
66
+
67
+ img.ProseMirror-separator {
68
+ display: inline !important;
69
+ border: none !important;
70
+ margin: 0 !important;
71
+ width: 1px !important;
72
+ height: 1px !important;
73
+ }
74
+
75
+ .ProseMirror-gapcursor {
76
+ display: none;
77
+ pointer-events: none;
78
+ position: absolute;
79
+ margin: 0;
80
+ }
81
+
82
+ .ProseMirror-gapcursor:after {
83
+ content: "";
84
+ display: block;
85
+ position: absolute;
86
+ top: -2px;
87
+ width: 20px;
88
+ border-top: 1px solid black;
89
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
90
+ }
91
+
92
+ @keyframes ProseMirror-cursor-blink {
93
+ to {
94
+ visibility: hidden;
95
+ }
96
+ }
97
+
98
+ .ProseMirror-hideselection *::selection {
99
+ background: transparent;
100
+ }
101
+
102
+ .ProseMirror-hideselection *::-moz-selection {
103
+ background: transparent;
104
+ }
105
+
106
+ .ProseMirror-hideselection * {
107
+ caret-color: transparent;
108
+ }
109
+
110
+ .ProseMirror-focused .ProseMirror-gapcursor {
111
+ display: block;
112
+ }
113
+
114
+ .tippy-box[data-animation=fade][data-state=hidden] {
115
+ opacity: 0
116
+ }`;function lb(n,e,t){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=n,document.getElementsByTagName("head")[0].appendChild(o),o}let ab=class extends T1{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}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&&document&&(this.css=lb(sb,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const r=cf(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(t))});this.view.updateState(r)}createExtensionManager(){var e,t;const o=[...this.options.enableCoreExtensions?[nb,V1.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),tb,rb,ob,ib]:[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new $r(o,this)}createCommandManager(){this.commandManager=new Di({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=wf(this.options.content,this.schema,this.options.parseOptions),t=mf(e,this.options.autofocus);this.view=new Uy(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Nr.create({doc:e,selection:t||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return xf(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return Vv(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Fv(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
117
+
118
+ `,textSerializers:r={}}=e||{};return $v(this.state.doc,{blockSeparator:t,textSerializers:{...pf(this.schema),...r}})}get isEmpty(){return _v(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new rr(t,this)}get $doc(){return this.$pos(0)}};function or(n){return new Ro({find:n.find,handler:({state:e,range:t,match:r})=>{const o=X(n.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=t.from+l.indexOf(s),u=c+s.length;if(fa(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<t.to&&i.delete(u,t.to),c>t.from&&i.delete(t.from+a,c);const f=t.from+a+s.length;i.addMark(t.from+a,f,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function ga(n){return new Ro({find:n.find,handler:({state:e,range:t,match:r})=>{const o=X(n.getAttributes,void 0,r)||{},{tr:i}=e,s=t.from;let l=t.to;const a=n.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else r[0]&&i.insert(s-1,n.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l));i.scrollIntoView()}})}function ya(n){return new Ro({find:n.find,handler:({state:e,range:t,match:r})=>{const o=e.doc.resolve(t.from),i=X(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)}})}function Br(n){return new Ro({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{const i=X(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&wl(a,n.type,i);if(!c)return null;if(s.wrap(a,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&kn(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)}})}class nt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=X(V(this,"addOptions",{name:this.name}))),this.storage=X(V(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new nt(e)}configure(e={}){const t=this.extend();return t.options=Ri(this.options,e),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new nt({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=X(V(t,"addOptions",{name:t.name})),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const a=s.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}}let pe=class Uc{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=X(V(this,"addOptions",{name:this.name}))),this.storage=X(V(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Uc(e)}configure(e={}){const t=this.extend();return t.options=Ri(this.options,e),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Uc({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=X(V(t,"addOptions",{name:t.name})),t.storage=X(V(t,"addStorage",{name:t.name,options:t.options})),t}};function cb(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}class ub{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,o,i,s,l,a;const{view:c}=this.editor,u=e.target,d=u.nodeType===3?(t=u.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(u)||!d)return;let f=0,h=0;if(this.dom!==d){const g=this.dom.getBoundingClientRect(),y=d.getBoundingClientRect(),k=(o=e.offsetX)!==null&&o!==void 0?o:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,C=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=y.x-g.x+k,h=y.y-g.y+C}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);const p=W.create(c.state.doc,this.getPos()),m=c.state.tr.setSelection(p);c.dispatch(m)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;const i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=W.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!u&&d&&i&&e.preventDefault(),u&&i&&!c)return e.preventDefault(),!1;if(u&&a&&!c&&m){const g=r.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||f||h||p||m&&d)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(Fi()||cb())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const r=this.getPos();return t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0})}deleteNode(){const e=this.getPos(),t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}}function Pn(n){return new I1({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{const i=X(n.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const u=a.search(/\S/),d=t.from+a.indexOf(l),f=d+l.length;if(fa(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;f<t.to&&s.delete(f,t.to),d>t.from&&s.delete(t.from+u,d),c=t.from+u+l.length,s.addMark(t.from+u,c,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function db(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var rt="top",xt="bottom",kt="right",ot="left",va="auto",$o=[rt,xt,kt,ot],Hr="start",Bo="end",fb="clippingParents",Ef="viewport",Ho="popper",hb="reference",Af=$o.reduce(function(n,e){return n.concat([e+"-"+Hr,e+"-"+Bo])},[]),Tf=[].concat($o,[va]).reduce(function(n,e){return n.concat([e,e+"-"+Hr,e+"-"+Bo])},[]),pb="beforeRead",mb="read",gb="afterRead",yb="beforeMain",vb="main",bb="afterMain",wb="beforeWrite",xb="write",kb="afterWrite",Cb=[pb,mb,gb,yb,vb,bb,wb,xb,kb];function zt(n){return n?(n.nodeName||"").toLowerCase():null}function ct(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function ir(n){var e=ct(n).Element;return n instanceof e||n instanceof Element}function Ct(n){var e=ct(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function ba(n){if(typeof ShadowRoot>"u")return!1;var e=ct(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function Sb(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},o=e.attributes[t]||{},i=e.elements[t];!Ct(i)||!zt(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var l=o[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function Eb(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),l=s.reduce(function(a,c){return a[c]="",a},{});!Ct(o)||!zt(o)||(Object.assign(o.style,l),Object.keys(i).forEach(function(a){o.removeAttribute(a)}))})}}const Mf={name:"applyStyles",enabled:!0,phase:"write",fn:Sb,effect:Eb,requires:["computeStyles"]};function Vt(n){return n.split("-")[0]}var sr=Math.max,ji=Math.min,jr=Math.round;function wa(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Of(){return!/^((?!chrome|android).)*safari/i.test(wa())}function zr(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),o=1,i=1;e&&Ct(n)&&(o=n.offsetWidth>0&&jr(r.width)/n.offsetWidth||1,i=n.offsetHeight>0&&jr(r.height)/n.offsetHeight||1);var s=ir(n)?ct(n):window,l=s.visualViewport,a=!Of()&&t,c=(r.left+(a&&l?l.offsetLeft:0))/o,u=(r.top+(a&&l?l.offsetTop:0))/i,d=r.width/o,f=r.height/i;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function xa(n){var e=zr(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function Nf(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&ba(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ln(n){return ct(n).getComputedStyle(n)}function Ab(n){return["table","td","th"].indexOf(zt(n))>=0}function Rn(n){return((ir(n)?n.ownerDocument:n.document)||window.document).documentElement}function zi(n){return zt(n)==="html"?n:n.assignedSlot||n.parentNode||(ba(n)?n.host:null)||Rn(n)}function Df(n){return!Ct(n)||ln(n).position==="fixed"?null:n.offsetParent}function Tb(n){var e=/firefox/i.test(wa()),t=/Trident/i.test(wa());if(t&&Ct(n)){var r=ln(n);if(r.position==="fixed")return null}var o=zi(n);for(ba(o)&&(o=o.host);Ct(o)&&["html","body"].indexOf(zt(o))<0;){var i=ln(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function jo(n){for(var e=ct(n),t=Df(n);t&&Ab(t)&&ln(t).position==="static";)t=Df(t);return t&&(zt(t)==="html"||zt(t)==="body"&&ln(t).position==="static")?e:t||Tb(n)||e}function ka(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function zo(n,e,t){return sr(n,ji(e,t))}function Mb(n,e,t){var r=zo(n,e,t);return r>t?t:r}function Lf(){return{top:0,right:0,bottom:0,left:0}}function Pf(n){return Object.assign({},Lf(),n)}function Rf(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var Ob=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Pf(typeof e!="number"?e:Rf(e,$o))};function Nb(n){var e,t=n.state,r=n.name,o=n.options,i=t.elements.arrow,s=t.modifiersData.popperOffsets,l=Vt(t.placement),a=ka(l),c=[ot,kt].indexOf(l)>=0,u=c?"height":"width";if(!(!i||!s)){var d=Ob(o.padding,t),f=xa(i),h=a==="y"?rt:ot,p=a==="y"?xt:kt,m=t.rects.reference[u]+t.rects.reference[a]-s[a]-t.rects.popper[u],g=s[a]-t.rects.reference[a],y=jo(i),k=y?a==="y"?y.clientHeight||0:y.clientWidth||0:0,C=m/2-g/2,v=d[h],E=k-f[u]-d[p],S=k/2-f[u]/2+C,O=zo(v,S,E),D=a;t.modifiersData[r]=(e={},e[D]=O,e.centerOffset=O-S,e)}}function Db(n){var e=n.state,t=n.options,r=t.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||Nf(e.elements.popper,o)&&(e.elements.arrow=o))}const Lb={name:"arrow",enabled:!0,phase:"main",fn:Nb,effect:Db,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Vr(n){return n.split("-")[1]}var Pb={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Rb(n,e){var t=n.x,r=n.y,o=e.devicePixelRatio||1;return{x:jr(t*o)/o||0,y:jr(r*o)/o||0}}function If(n){var e,t=n.popper,r=n.popperRect,o=n.placement,i=n.variation,s=n.offsets,l=n.position,a=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,d=n.isFixed,f=s.x,h=f===void 0?0:f,p=s.y,m=p===void 0?0:p,g=typeof u=="function"?u({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var y=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),C=ot,v=rt,E=window;if(c){var S=jo(t),O="clientHeight",D="clientWidth";if(S===ct(t)&&(S=Rn(t),ln(S).position!=="static"&&l==="absolute"&&(O="scrollHeight",D="scrollWidth")),S=S,o===rt||(o===ot||o===kt)&&i===Bo){v=xt;var A=d&&S===E&&E.visualViewport?E.visualViewport.height:S[O];m-=A-r.height,m*=a?1:-1}if(o===ot||(o===rt||o===xt)&&i===Bo){C=kt;var P=d&&S===E&&E.visualViewport?E.visualViewport.width:S[D];h-=P-r.width,h*=a?1:-1}}var H=Object.assign({position:l},c&&Pb),N=u===!0?Rb({x:h,y:m},ct(t)):{x:h,y:m};if(h=N.x,m=N.y,a){var $;return Object.assign({},H,($={},$[v]=k?"0":"",$[C]=y?"0":"",$.transform=(E.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",$))}return Object.assign({},H,(e={},e[v]=k?m+"px":"",e[C]=y?h+"px":"",e.transform="",e))}function Ib(n){var e=n.state,t=n.options,r=t.gpuAcceleration,o=r===void 0?!0:r,i=t.adaptive,s=i===void 0?!0:i,l=t.roundOffsets,a=l===void 0?!0:l,c={placement:Vt(e.placement),variation:Vr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,If(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,If(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Fb={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Ib,data:{}};var Vi={passive:!0};function $b(n){var e=n.state,t=n.instance,r=n.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,l=s===void 0?!0:s,a=ct(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",t.update,Vi)}),l&&a.addEventListener("resize",t.update,Vi),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",t.update,Vi)}),l&&a.removeEventListener("resize",t.update,Vi)}}const Bb={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:$b,data:{}};var Hb={left:"right",right:"left",bottom:"top",top:"bottom"};function _i(n){return n.replace(/left|right|bottom|top/g,function(e){return Hb[e]})}var jb={start:"end",end:"start"};function Ff(n){return n.replace(/start|end/g,function(e){return jb[e]})}function Ca(n){var e=ct(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function Sa(n){return zr(Rn(n)).left+Ca(n).scrollLeft}function zb(n,e){var t=ct(n),r=Rn(n),o=t.visualViewport,i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;var c=Of();(c||!c&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:i,height:s,x:l+Sa(n),y:a}}function Vb(n){var e,t=Rn(n),r=Ca(n),o=(e=n.ownerDocument)==null?void 0:e.body,i=sr(t.scrollWidth,t.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=sr(t.scrollHeight,t.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Sa(n),a=-r.scrollTop;return ln(o||t).direction==="rtl"&&(l+=sr(t.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:l,y:a}}function Ea(n){var e=ln(n),t=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+o+r)}function $f(n){return["html","body","#document"].indexOf(zt(n))>=0?n.ownerDocument.body:Ct(n)&&Ea(n)?n:$f(zi(n))}function Vo(n,e){var t;e===void 0&&(e=[]);var r=$f(n),o=r===((t=n.ownerDocument)==null?void 0:t.body),i=ct(r),s=o?[i].concat(i.visualViewport||[],Ea(r)?r:[]):r,l=e.concat(s);return o?l:l.concat(Vo(zi(s)))}function Aa(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function _b(n,e){var t=zr(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Bf(n,e,t){return e===Ef?Aa(zb(n,t)):ir(e)?_b(e,t):Aa(Vb(Rn(n)))}function Wb(n){var e=Vo(zi(n)),t=["absolute","fixed"].indexOf(ln(n).position)>=0,r=t&&Ct(n)?jo(n):n;return ir(r)?e.filter(function(o){return ir(o)&&Nf(o,r)&&zt(o)!=="body"}):[]}function qb(n,e,t,r){var o=e==="clippingParents"?Wb(n):[].concat(e),i=[].concat(o,[t]),s=i[0],l=i.reduce(function(a,c){var u=Bf(n,c,r);return a.top=sr(u.top,a.top),a.right=ji(u.right,a.right),a.bottom=ji(u.bottom,a.bottom),a.left=sr(u.left,a.left),a},Bf(n,s,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function Hf(n){var e=n.reference,t=n.element,r=n.placement,o=r?Vt(r):null,i=r?Vr(r):null,s=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(o){case rt:a={x:s,y:e.y-t.height};break;case xt:a={x:s,y:e.y+e.height};break;case kt:a={x:e.x+e.width,y:l};break;case ot:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var c=o?ka(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case Hr:a[c]=a[c]-(e[u]/2-t[u]/2);break;case Bo:a[c]=a[c]+(e[u]/2-t[u]/2);break}}return a}function _o(n,e){e===void 0&&(e={});var t=e,r=t.placement,o=r===void 0?n.placement:r,i=t.strategy,s=i===void 0?n.strategy:i,l=t.boundary,a=l===void 0?fb:l,c=t.rootBoundary,u=c===void 0?Ef:c,d=t.elementContext,f=d===void 0?Ho:d,h=t.altBoundary,p=h===void 0?!1:h,m=t.padding,g=m===void 0?0:m,y=Pf(typeof g!="number"?g:Rf(g,$o)),k=f===Ho?hb:Ho,C=n.rects.popper,v=n.elements[p?k:f],E=qb(ir(v)?v:v.contextElement||Rn(n.elements.popper),a,u,s),S=zr(n.elements.reference),O=Hf({reference:S,element:C,strategy:"absolute",placement:o}),D=Aa(Object.assign({},C,O)),A=f===Ho?D:S,P={top:E.top-A.top+y.top,bottom:A.bottom-E.bottom+y.bottom,left:E.left-A.left+y.left,right:A.right-E.right+y.right},H=n.modifiersData.offset;if(f===Ho&&H){var N=H[o];Object.keys(P).forEach(function($){var R=[kt,xt].indexOf($)>=0?1:-1,I=[rt,xt].indexOf($)>=0?"y":"x";P[$]+=N[I]*R})}return P}function Ub(n,e){e===void 0&&(e={});var t=e,r=t.placement,o=t.boundary,i=t.rootBoundary,s=t.padding,l=t.flipVariations,a=t.allowedAutoPlacements,c=a===void 0?Tf:a,u=Vr(r),d=u?l?Af:Af.filter(function(p){return Vr(p)===u}):$o,f=d.filter(function(p){return c.indexOf(p)>=0});f.length===0&&(f=d);var h=f.reduce(function(p,m){return p[m]=_o(n,{placement:m,boundary:o,rootBoundary:i,padding:s})[Vt(m)],p},{});return Object.keys(h).sort(function(p,m){return h[p]-h[m]})}function Kb(n){if(Vt(n)===va)return[];var e=_i(n);return[Ff(n),e,Ff(e)]}function Jb(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var o=t.mainAxis,i=o===void 0?!0:o,s=t.altAxis,l=s===void 0?!0:s,a=t.fallbackPlacements,c=t.padding,u=t.boundary,d=t.rootBoundary,f=t.altBoundary,h=t.flipVariations,p=h===void 0?!0:h,m=t.allowedAutoPlacements,g=e.options.placement,y=Vt(g),k=y===g,C=a||(k||!p?[_i(g)]:Kb(g)),v=[g].concat(C).reduce(function(pt,Re){return pt.concat(Vt(Re)===va?Ub(e,{placement:Re,boundary:u,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:m}):Re)},[]),E=e.rects.reference,S=e.rects.popper,O=new Map,D=!0,A=v[0],P=0;P<v.length;P++){var H=v[P],N=Vt(H),$=Vr(H)===Hr,R=[rt,xt].indexOf(N)>=0,I=R?"width":"height",U=_o(e,{placement:H,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),z=R?$?kt:ot:$?xt:rt;E[I]>S[I]&&(z=_i(z));var G=_i(z),se=[];if(i&&se.push(U[N]<=0),l&&se.push(U[z]<=0,U[G]<=0),se.every(function(pt){return pt})){A=H,D=!1;break}O.set(H,se)}if(D)for(var le=p?3:1,He=function(Re){var Se=v.find(function(mt){var _e=O.get(mt);if(_e)return _e.slice(0,Re).every(function(Je){return Je})});if(Se)return A=Se,"break"},Te=le;Te>0;Te--){var ht=He(Te);if(ht==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0)}}const Zb={name:"flip",enabled:!0,phase:"main",fn:Jb,requiresIfExists:["offset"],data:{_skip:!1}};function jf(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function zf(n){return[rt,kt,xt,ot].some(function(e){return n[e]>=0})}function Gb(n){var e=n.state,t=n.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=_o(e,{elementContext:"reference"}),l=_o(e,{altBoundary:!0}),a=jf(s,r),c=jf(l,o,i),u=zf(a),d=zf(c);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const Yb={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Gb};function Xb(n,e,t){var r=Vt(n),o=[ot,rt].indexOf(r)>=0?-1:1,i=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,s=i[0],l=i[1];return s=s||0,l=(l||0)*o,[ot,kt].indexOf(r)>=0?{x:l,y:s}:{x:s,y:l}}function Qb(n){var e=n.state,t=n.options,r=n.name,o=t.offset,i=o===void 0?[0,0]:o,s=Tf.reduce(function(u,d){return u[d]=Xb(d,e.rects,i),u},{}),l=s[e.placement],a=l.x,c=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}const e2={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Qb};function t2(n){var e=n.state,t=n.name;e.modifiersData[t]=Hf({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const n2={name:"popperOffsets",enabled:!0,phase:"read",fn:t2,data:{}};function r2(n){return n==="x"?"y":"x"}function o2(n){var e=n.state,t=n.options,r=n.name,o=t.mainAxis,i=o===void 0?!0:o,s=t.altAxis,l=s===void 0?!1:s,a=t.boundary,c=t.rootBoundary,u=t.altBoundary,d=t.padding,f=t.tether,h=f===void 0?!0:f,p=t.tetherOffset,m=p===void 0?0:p,g=_o(e,{boundary:a,rootBoundary:c,padding:d,altBoundary:u}),y=Vt(e.placement),k=Vr(e.placement),C=!k,v=ka(y),E=r2(v),S=e.modifiersData.popperOffsets,O=e.rects.reference,D=e.rects.popper,A=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,P=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),H=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,N={x:0,y:0};if(S){if(i){var $,R=v==="y"?rt:ot,I=v==="y"?xt:kt,U=v==="y"?"height":"width",z=S[v],G=z+g[R],se=z-g[I],le=h?-D[U]/2:0,He=k===Hr?O[U]:D[U],Te=k===Hr?-D[U]:-O[U],ht=e.elements.arrow,pt=h&&ht?xa(ht):{width:0,height:0},Re=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Lf(),Se=Re[R],mt=Re[I],_e=zo(0,O[U],pt[U]),Je=C?O[U]/2-le-_e-Se-P.mainAxis:He-_e-Se-P.mainAxis,Ze=C?-O[U]/2+le+_e+mt+P.mainAxis:Te+_e+mt+P.mainAxis,Qt=e.elements.arrow&&jo(e.elements.arrow),hn=Qt?v==="y"?Qt.clientTop||0:Qt.clientLeft||0:0,pn=($=H==null?void 0:H[v])!=null?$:0,qn=z+Je-pn-hn,Ge=z+Ze-pn,st=zo(h?ji(G,qn):G,z,h?sr(se,Ge):se);S[v]=st,N[v]=st-z}if(l){var en,mn=v==="x"?rt:ot,Rt=v==="x"?xt:kt,gt=S[E],Ye=E==="y"?"height":"width",gn=gt+g[mn],yn=gt-g[Rt],yr=[rt,ot].indexOf(y)!==-1,vr=(en=H==null?void 0:H[E])!=null?en:0,br=yr?gn:gt-O[Ye]-D[Ye]-vr+P.altAxis,tn=yr?gt+O[Ye]+D[Ye]-vr-P.altAxis:yn,ao=h&&yr?Mb(br,gt,tn):zo(h?br:gn,gt,h?tn:yn);S[E]=ao,N[E]=ao-gt}e.modifiersData[r]=N}}const i2={name:"preventOverflow",enabled:!0,phase:"main",fn:o2,requiresIfExists:["offset"]};function s2(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function l2(n){return n===ct(n)||!Ct(n)?Ca(n):s2(n)}function a2(n){var e=n.getBoundingClientRect(),t=jr(e.width)/n.offsetWidth||1,r=jr(e.height)/n.offsetHeight||1;return t!==1||r!==1}function c2(n,e,t){t===void 0&&(t=!1);var r=Ct(e),o=Ct(e)&&a2(e),i=Rn(e),s=zr(n,o,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!t)&&((zt(e)!=="body"||Ea(i))&&(l=l2(e)),Ct(e)?(a=zr(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):i&&(a.x=Sa(i))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function u2(n){var e=new Map,t=new Set,r=[];n.forEach(function(i){e.set(i.name,i)});function o(i){t.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!t.has(l)){var a=e.get(l);a&&o(a)}}),r.push(i)}return n.forEach(function(i){t.has(i.name)||o(i)}),r}function d2(n){var e=u2(n);return Cb.reduce(function(t,r){return t.concat(e.filter(function(o){return o.phase===r}))},[])}function f2(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function h2(n){var e=n.reduce(function(t,r){var o=t[r.name];return t[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var Vf={placement:"bottom",modifiers:[],strategy:"absolute"};function _f(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function p2(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,r=t===void 0?[]:t,o=e.defaultOptions,i=o===void 0?Vf:o;return function(l,a,c){c===void 0&&(c=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Vf,i),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(y){var k=typeof y=="function"?y(u.options):y;m(),u.options=Object.assign({},i,u.options,k),u.scrollParents={reference:ir(l)?Vo(l):l.contextElement?Vo(l.contextElement):[],popper:Vo(a)};var C=d2(h2([].concat(r,u.options.modifiers)));return u.orderedModifiers=C.filter(function(v){return v.enabled}),p(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,k=y.reference,C=y.popper;if(_f(k,C)){u.rects={reference:c2(k,jo(C),u.options.strategy==="fixed"),popper:xa(C)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(P){return u.modifiersData[P.name]=Object.assign({},P.data)});for(var v=0;v<u.orderedModifiers.length;v++){if(u.reset===!0){u.reset=!1,v=-1;continue}var E=u.orderedModifiers[v],S=E.fn,O=E.options,D=O===void 0?{}:O,A=E.name;typeof S=="function"&&(u=S({state:u,options:D,name:A,instance:h})||u)}}}},update:f2(function(){return new Promise(function(g){h.forceUpdate(),g(u)})}),destroy:function(){m(),f=!0}};if(!_f(l,a))return h;h.setOptions(c).then(function(g){!f&&c.onFirstUpdate&&c.onFirstUpdate(g)});function p(){u.orderedModifiers.forEach(function(g){var y=g.name,k=g.options,C=k===void 0?{}:k,v=g.effect;if(typeof v=="function"){var E=v({state:u,name:y,instance:h,options:C}),S=function(){};d.push(E||S)}})}function m(){d.forEach(function(g){return g()}),d=[]}return h}}var m2=[Bb,n2,Fb,Mf,e2,Zb,i2,Lb,Yb],g2=p2({defaultModifiers:m2}),y2="tippy-box",Wf="tippy-content",v2="tippy-backdrop",qf="tippy-arrow",Uf="tippy-svg-arrow",lr={passive:!0,capture:!0},Kf=function(){return document.body};function b2(n,e){return{}.hasOwnProperty.call(n,e)}function Ta(n,e,t){if(Array.isArray(n)){var r=n[e];return r??(Array.isArray(t)?t[e]:t)}return n}function Ma(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Jf(n,e){return typeof n=="function"?n.apply(void 0,e):n}function Zf(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function w2(n,e){var t=Object.assign({},n);return e.forEach(function(r){delete t[r]}),t}function x2(n){return n.split(/\s+/).filter(Boolean)}function _r(n){return[].concat(n)}function Gf(n,e){n.indexOf(e)===-1&&n.push(e)}function k2(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function C2(n){return n.split("-")[0]}function Wi(n){return[].slice.call(n)}function Yf(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function Wo(){return document.createElement("div")}function qo(n){return["Element","Fragment"].some(function(e){return Ma(n,e)})}function S2(n){return Ma(n,"NodeList")}function E2(n){return Ma(n,"MouseEvent")}function A2(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function T2(n){return qo(n)?[n]:S2(n)?Wi(n):Array.isArray(n)?n:Wi(document.querySelectorAll(n))}function Oa(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Xf(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function M2(n){var e,t=_r(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function O2(n,e){var t=e.clientX,r=e.clientY;return n.every(function(o){var i=o.popperRect,s=o.popperState,l=o.props,a=l.interactiveBorder,c=C2(s.placement),u=s.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,p=c==="left"?u.right.x:0,m=i.top-r+d>a,g=r-i.bottom-f>a,y=i.left-t+h>a,k=t-i.right-p>a;return m||g||y||k})}function Na(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){n[r](o,t)})}function Qf(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var _t={isTouch:!1},eh=0;function N2(){_t.isTouch||(_t.isTouch=!0,window.performance&&document.addEventListener("mousemove",th))}function th(){var n=performance.now();n-eh<20&&(_t.isTouch=!1,document.removeEventListener("mousemove",th)),eh=n}function D2(){var n=document.activeElement;if(A2(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function L2(){document.addEventListener("touchstart",N2,lr),window.addEventListener("blur",D2)}var P2=typeof window<"u"&&typeof document<"u",R2=P2?!!window.msCrypto:!1;function Wr(n){var e=n==="destroy"?"n already-":" ";return[n+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function nh(n){var e=/[ \t]{2,}/g,t=/^[ \t]*/gm;return n.replace(e," ").replace(t,"").trim()}function I2(n){return nh(`
119
+ %ctippy.js
120
+
121
+ %c`+nh(n)+`
122
+
123
+ %c👷‍ This is a development-only message. It will be removed in production.
124
+ `)}function rh(n){return[I2(n),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Uo;process.env.NODE_ENV!=="production"&&F2();function F2(){Uo=new Set}function an(n,e){if(n&&!Uo.has(e)){var t;Uo.add(e),(t=console).warn.apply(t,rh(e))}}function Da(n,e){if(n&&!Uo.has(e)){var t;Uo.add(e),(t=console).error.apply(t,rh(e))}}function $2(n){var e=!n,t=Object.prototype.toString.call(n)==="[object Object]"&&!n.addEventListener;Da(e,["tippy() was passed","`"+String(n)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Da(t,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var oh={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},B2={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},ut=Object.assign({appendTo:Kf,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},oh,B2),H2=Object.keys(ut),j2=function(e){process.env.NODE_ENV!=="production"&&lh(e,[]);var t=Object.keys(e);t.forEach(function(r){ut[r]=e[r]})};function ih(n){var e=n.plugins||[],t=e.reduce(function(r,o){var i=o.name,s=o.defaultValue;if(i){var l;r[i]=n[i]!==void 0?n[i]:(l=ut[i])!=null?l:s}return r},{});return Object.assign({},n,t)}function z2(n,e){var t=e?Object.keys(ih(Object.assign({},ut,{plugins:e}))):H2,r=t.reduce(function(o,i){var s=(n.getAttribute("data-tippy-"+i)||"").trim();if(!s)return o;if(i==="content")o[i]=s;else try{o[i]=JSON.parse(s)}catch{o[i]=s}return o},{});return r}function sh(n,e){var t=Object.assign({},e,{content:Jf(e.content,[n])},e.ignoreAttributes?{}:z2(n,e.plugins));return t.aria=Object.assign({},ut.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}function lh(n,e){n===void 0&&(n={}),e===void 0&&(e=[]);var t=Object.keys(n);t.forEach(function(r){var o=w2(ut,Object.keys(oh)),i=!b2(o,r);i&&(i=e.filter(function(s){return s.name===r}).length===0),an(i,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
125
+
126
+ `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
127
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var V2=function(){return"innerHTML"};function La(n,e){n[V2()]=e}function ah(n){var e=Wo();return n===!0?e.className=qf:(e.className=Uf,qo(n)?e.appendChild(n):La(e,n)),e}function ch(n,e){qo(e.content)?(La(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?La(n,e.content):n.textContent=e.content)}function Pa(n){var e=n.firstElementChild,t=Wi(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(Wf)}),arrow:t.find(function(r){return r.classList.contains(qf)||r.classList.contains(Uf)}),backdrop:t.find(function(r){return r.classList.contains(v2)})}}function uh(n){var e=Wo(),t=Wo();t.className=y2,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Wo();r.className=Wf,r.setAttribute("data-state","hidden"),ch(r,n.props),e.appendChild(t),t.appendChild(r),o(n.props,n.props);function o(i,s){var l=Pa(e),a=l.box,c=l.content,u=l.arrow;s.theme?a.setAttribute("data-theme",s.theme):a.removeAttribute("data-theme"),typeof s.animation=="string"?a.setAttribute("data-animation",s.animation):a.removeAttribute("data-animation"),s.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?a.setAttribute("role",s.role):a.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&ch(c,n.props),s.arrow?u?i.arrow!==s.arrow&&(a.removeChild(u),a.appendChild(ah(s.arrow))):a.appendChild(ah(s.arrow)):u&&a.removeChild(u)}return{popper:e,onUpdate:o}}uh.$$tippy=!0;var _2=1,qi=[],Ra=[];function W2(n,e){var t=sh(n,Object.assign({},ut,ih(Yf(e)))),r,o,i,s=!1,l=!1,a=!1,c=!1,u,d,f,h=[],p=Zf(qn,t.interactiveDebounce),m,g=_2++,y=null,k=k2(t.plugins),C={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:n,popper:Wo(),popperInstance:y,props:t,state:C,plugins:k,clearDelayTimeouts:br,setProps:tn,setContent:ao,show:al,hide:cl,hideWithInteractivity:si,enable:yr,disable:vr,unmount:jc,destroy:zc};if(!t.render)return process.env.NODE_ENV!=="production"&&Da(!0,"render() function has not been supplied."),v;var E=t.render(v),S=E.popper,O=E.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+v.id,v.popper=S,n._tippy=v,S._tippy=v;var D=k.map(function(T){return T.fn(v)}),A=n.hasAttribute("aria-expanded");return Qt(),le(),z(),G("onCreate",[v]),t.showOnCreate&&gn(),S.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&R().addEventListener("mousemove",p)}),v;function P(){var T=v.props.touch;return Array.isArray(T)?T:[T,0]}function H(){return P()[0]==="hold"}function N(){var T;return!!((T=v.props.render)!=null&&T.$$tippy)}function $(){return m||n}function R(){var T=$().parentNode;return T?M2(T):document}function I(){return Pa(S)}function U(T){return v.state.isMounted&&!v.state.isVisible||_t.isTouch||u&&u.type==="focus"?0:Ta(v.props.delay,T?0:1,ut.delay)}function z(T){T===void 0&&(T=!1),S.style.pointerEvents=v.props.interactive&&!T?"":"none",S.style.zIndex=""+v.props.zIndex}function G(T,_,Z){if(Z===void 0&&(Z=!0),D.forEach(function(re){re[T]&&re[T].apply(re,_)}),Z){var ae;(ae=v.props)[T].apply(ae,_)}}function se(){var T=v.props.aria;if(T.content){var _="aria-"+T.content,Z=S.id,ae=_r(v.props.triggerTarget||n);ae.forEach(function(re){var Me=re.getAttribute(_);if(v.state.isVisible)re.setAttribute(_,Me?Me+" "+Z:Z);else{var Xe=Me&&Me.replace(Z,"").trim();Xe?re.setAttribute(_,Xe):re.removeAttribute(_)}})}}function le(){if(!(A||!v.props.aria.expanded)){var T=_r(v.props.triggerTarget||n);T.forEach(function(_){v.props.interactive?_.setAttribute("aria-expanded",v.state.isVisible&&_===$()?"true":"false"):_.removeAttribute("aria-expanded")})}}function He(){R().removeEventListener("mousemove",p),qi=qi.filter(function(T){return T!==p})}function Te(T){if(!(_t.isTouch&&(a||T.type==="mousedown"))){var _=T.composedPath&&T.composedPath()[0]||T.target;if(!(v.props.interactive&&Qf(S,_))){if(_r(v.props.triggerTarget||n).some(function(Z){return Qf(Z,_)})){if(_t.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else G("onClickOutside",[v,T]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),l=!0,setTimeout(function(){l=!1}),v.state.isMounted||Se())}}}function ht(){a=!0}function pt(){a=!1}function Re(){var T=R();T.addEventListener("mousedown",Te,!0),T.addEventListener("touchend",Te,lr),T.addEventListener("touchstart",pt,lr),T.addEventListener("touchmove",ht,lr)}function Se(){var T=R();T.removeEventListener("mousedown",Te,!0),T.removeEventListener("touchend",Te,lr),T.removeEventListener("touchstart",pt,lr),T.removeEventListener("touchmove",ht,lr)}function mt(T,_){Je(T,function(){!v.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&_()})}function _e(T,_){Je(T,_)}function Je(T,_){var Z=I().box;function ae(re){re.target===Z&&(Na(Z,"remove",ae),_())}if(T===0)return _();Na(Z,"remove",d),Na(Z,"add",ae),d=ae}function Ze(T,_,Z){Z===void 0&&(Z=!1);var ae=_r(v.props.triggerTarget||n);ae.forEach(function(re){re.addEventListener(T,_,Z),h.push({node:re,eventType:T,handler:_,options:Z})})}function Qt(){H()&&(Ze("touchstart",pn,{passive:!0}),Ze("touchend",Ge,{passive:!0})),x2(v.props.trigger).forEach(function(T){if(T!=="manual")switch(Ze(T,pn),T){case"mouseenter":Ze("mouseleave",Ge);break;case"focus":Ze(R2?"focusout":"blur",st);break;case"focusin":Ze("focusout",st);break}})}function hn(){h.forEach(function(T){var _=T.node,Z=T.eventType,ae=T.handler,re=T.options;_.removeEventListener(Z,ae,re)}),h=[]}function pn(T){var _,Z=!1;if(!(!v.state.isEnabled||en(T)||l)){var ae=((_=u)==null?void 0:_.type)==="focus";u=T,m=T.currentTarget,le(),!v.state.isVisible&&E2(T)&&qi.forEach(function(re){return re(T)}),T.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?Z=!0:gn(T),T.type==="click"&&(s=!Z),Z&&!ae&&yn(T)}}function qn(T){var _=T.target,Z=$().contains(_)||S.contains(_);if(!(T.type==="mousemove"&&Z)){var ae=Ye().concat(S).map(function(re){var Me,Xe=re._tippy,yt=(Me=Xe.popperInstance)==null?void 0:Me.state;return yt?{popperRect:re.getBoundingClientRect(),popperState:yt,props:t}:null}).filter(Boolean);O2(ae,T)&&(He(),yn(T))}}function Ge(T){var _=en(T)||v.props.trigger.indexOf("click")>=0&&s;if(!_){if(v.props.interactive){v.hideWithInteractivity(T);return}yn(T)}}function st(T){v.props.trigger.indexOf("focusin")<0&&T.target!==$()||v.props.interactive&&T.relatedTarget&&S.contains(T.relatedTarget)||yn(T)}function en(T){return _t.isTouch?H()!==T.type.indexOf("touch")>=0:!1}function mn(){Rt();var T=v.props,_=T.popperOptions,Z=T.placement,ae=T.offset,re=T.getReferenceClientRect,Me=T.moveTransition,Xe=N()?Pa(S).arrow:null,yt=re?{getBoundingClientRect:re,contextElement:re.contextElement||$()}:n,co={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(fo){var vn=fo.state;if(N()){var Vc=I(),ho=Vc.box;["placement","reference-hidden","escaped"].forEach(function(wr){wr==="placement"?ho.setAttribute("data-placement",vn.placement):vn.attributes.popper["data-popper-"+wr]?ho.setAttribute("data-"+wr,""):ho.removeAttribute("data-"+wr)}),vn.attributes.popper={}}}},It=[{name:"offset",options:{offset:ae}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Me}},co];N()&&Xe&&It.push({name:"arrow",options:{element:Xe,padding:3}}),It.push.apply(It,(_==null?void 0:_.modifiers)||[]),v.popperInstance=g2(yt,S,Object.assign({},_,{placement:Z,onFirstUpdate:f,modifiers:It}))}function Rt(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function gt(){var T=v.props.appendTo,_,Z=$();v.props.interactive&&T===Kf||T==="parent"?_=Z.parentNode:_=Jf(T,[Z]),_.contains(S)||_.appendChild(S),v.state.isMounted=!0,mn(),process.env.NODE_ENV!=="production"&&an(v.props.interactive&&T===ut.appendTo&&Z.nextElementSibling!==S,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
128
+
129
+ `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
130
+
131
+ `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
132
+
133
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Ye(){return Wi(S.querySelectorAll("[data-tippy-root]"))}function gn(T){v.clearDelayTimeouts(),T&&G("onTrigger",[v,T]),Re();var _=U(!0),Z=P(),ae=Z[0],re=Z[1];_t.isTouch&&ae==="hold"&&re&&(_=re),_?r=setTimeout(function(){v.show()},_):v.show()}function yn(T){if(v.clearDelayTimeouts(),G("onUntrigger",[v,T]),!v.state.isVisible){Se();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(T.type)>=0&&s)){var _=U(!1);_?o=setTimeout(function(){v.state.isVisible&&v.hide()},_):i=requestAnimationFrame(function(){v.hide()})}}function yr(){v.state.isEnabled=!0}function vr(){v.hide(),v.state.isEnabled=!1}function br(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)}function tn(T){if(process.env.NODE_ENV!=="production"&&an(v.state.isDestroyed,Wr("setProps")),!v.state.isDestroyed){G("onBeforeUpdate",[v,T]),hn();var _=v.props,Z=sh(n,Object.assign({},_,Yf(T),{ignoreAttributes:!0}));v.props=Z,Qt(),_.interactiveDebounce!==Z.interactiveDebounce&&(He(),p=Zf(qn,Z.interactiveDebounce)),_.triggerTarget&&!Z.triggerTarget?_r(_.triggerTarget).forEach(function(ae){ae.removeAttribute("aria-expanded")}):Z.triggerTarget&&n.removeAttribute("aria-expanded"),le(),z(),O&&O(_,Z),v.popperInstance&&(mn(),Ye().forEach(function(ae){requestAnimationFrame(ae._tippy.popperInstance.forceUpdate)})),G("onAfterUpdate",[v,T])}}function ao(T){v.setProps({content:T})}function al(){process.env.NODE_ENV!=="production"&&an(v.state.isDestroyed,Wr("show"));var T=v.state.isVisible,_=v.state.isDestroyed,Z=!v.state.isEnabled,ae=_t.isTouch&&!v.props.touch,re=Ta(v.props.duration,0,ut.duration);if(!(T||_||Z||ae)&&!$().hasAttribute("disabled")&&(G("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,N()&&(S.style.visibility="visible"),z(),Re(),v.state.isMounted||(S.style.transition="none"),N()){var Me=I(),Xe=Me.box,yt=Me.content;Oa([Xe,yt],0)}f=function(){var It;if(!(!v.state.isVisible||c)){if(c=!0,S.offsetHeight,S.style.transition=v.props.moveTransition,N()&&v.props.animation){var uo=I(),fo=uo.box,vn=uo.content;Oa([fo,vn],re),Xf([fo,vn],"visible")}se(),le(),Gf(Ra,v),(It=v.popperInstance)==null||It.forceUpdate(),G("onMount",[v]),v.props.animation&&N()&&_e(re,function(){v.state.isShown=!0,G("onShown",[v])})}},gt()}}function cl(){process.env.NODE_ENV!=="production"&&an(v.state.isDestroyed,Wr("hide"));var T=!v.state.isVisible,_=v.state.isDestroyed,Z=!v.state.isEnabled,ae=Ta(v.props.duration,1,ut.duration);if(!(T||_||Z)&&(G("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,s=!1,N()&&(S.style.visibility="hidden"),He(),Se(),z(!0),N()){var re=I(),Me=re.box,Xe=re.content;v.props.animation&&(Oa([Me,Xe],ae),Xf([Me,Xe],"hidden"))}se(),le(),v.props.animation?N()&&mt(ae,v.unmount):v.unmount()}}function si(T){process.env.NODE_ENV!=="production"&&an(v.state.isDestroyed,Wr("hideWithInteractivity")),R().addEventListener("mousemove",p),Gf(qi,p),p(T)}function jc(){process.env.NODE_ENV!=="production"&&an(v.state.isDestroyed,Wr("unmount")),v.state.isVisible&&v.hide(),v.state.isMounted&&(Rt(),Ye().forEach(function(T){T._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),Ra=Ra.filter(function(T){return T!==v}),v.state.isMounted=!1,G("onHidden",[v]))}function zc(){process.env.NODE_ENV!=="production"&&an(v.state.isDestroyed,Wr("destroy")),!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),hn(),delete n._tippy,v.state.isDestroyed=!0,G("onDestroy",[v]))}}function ar(n,e){e===void 0&&(e={});var t=ut.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&($2(n),lh(e,t)),L2();var r=Object.assign({},e,{plugins:t}),o=T2(n);if(process.env.NODE_ENV!=="production"){var i=qo(r.content),s=o.length>1;an(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
134
+
135
+ `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
136
+
137
+ `,`1) content: element.innerHTML
138
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=o.reduce(function(a,c){var u=c&&W2(c,r);return u&&a.push(u),a},[]);return qo(n)?l[0]:l}ar.defaultProps=ut,ar.setDefaultProps=j2,ar.currentInput=_t,Object.assign({},Mf,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});var q2={name:"sticky",defaultValue:!1,fn:function(e){var t=e.reference,r=e.popper;function o(){return e.popperInstance?e.popperInstance.state.elements.reference:t}function i(c){return e.props.sticky===!0||e.props.sticky===c}var s=null,l=null;function a(){var c=i("reference")?o().getBoundingClientRect():null,u=i("popper")?r.getBoundingClientRect():null;(c&&dh(s,c)||u&&dh(l,u))&&e.popperInstance&&e.popperInstance.update(),s=c,l=u,e.state.isMounted&&requestAnimationFrame(a)}return{onMount:function(){e.props.sticky&&a()}}}};function dh(n,e){return n&&e?n.top!==e.top||n.right!==e.right||n.bottom!==e.bottom||n.left!==e.left:!0}ar.setDefaultProps({render:uh});class U2{constructor({editor:e,element:t,view:r,tippyOptions:o={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:l,state:a,from:c,to:u})=>{const{doc:d,selection:f}=a,{empty:h}=f,p=!d.textBetween(c,u).length&&ca(a.selection),m=this.element.contains(document.activeElement);return!(!(l.hasFocus()||m)||h||p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(l.relatedTarget))||this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,a)=>{const c=!(a!=null&&a.selection.eq(l.state.selection)),u=!(a!=null&&a.doc.eq(l.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,u,a)},this.updateDelay))},this.updateHandler=(l,a,c,u)=>{var d,f,h;const{state:p,composing:m}=l,{selection:g}=p;if(m||!a&&!c)return;this.createTooltip();const{ranges:k}=g,C=Math.min(...k.map(S=>S.$from.pos)),v=Math.max(...k.map(S=>S.$to.pos));if(!((d=this.shouldShow)===null||d===void 0?void 0:d.call(this,{editor:this.editor,view:l,state:p,oldState:u,from:C,to:v}))){this.hide();return}(f=this.tippy)===null||f===void 0||f.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(Cf(p.selection)){let S=l.nodeDOM(C);const O=S.dataset.nodeViewWrapper?S:S.querySelector("[data-node-view-wrapper]");if(O&&(S=O.firstChild),S)return S.getBoundingClientRect()}return Wv(l,C,v)})}),this.show()},this.editor=e,this.element=t,this.view=r,this.updateDelay=i,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=ar(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:r}=e,o=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),s=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const fh=n=>new ge({key:typeof n.pluginKey=="string"?new Ce(n.pluginKey):n.pluginKey,view:e=>new U2({view:e,...n})});ve.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[fh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});const K2=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},J2=({renderers:n})=>b.createElement(b.Fragment,null,Object.entries(n).map(([e,t])=>vt.createPortal(t.reactElement,t.element,e)));class Z2 extends b.Component{constructor(e){super(e),this.editorContentRef=b.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?vt.flushSync(e):e()}setRenderer(e,t){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:t}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:t})=>{const r={...t};return delete r[e],{renderers:r}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,innerRef:t,...r}=this.props;return b.createElement(b.Fragment,null,b.createElement("div",{ref:K2(t,this.editorContentRef),...r}),b.createElement(J2,{renderers:this.state.renderers}))}}const G2=b.forwardRef((n,e)=>{const t=b.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return b.createElement(Z2,{key:t,innerRef:e,...n})}),Y2=b.memo(G2);class X2 extends ab{constructor(){super(...arguments),this.contentComponent=null}}const Q2=(n={},e=[])=>{const t=b.useRef(null),[,r]=b.useState({}),{onBeforeCreate:o,onBlur:i,onCreate:s,onDestroy:l,onFocus:a,onSelectionUpdate:c,onTransaction:u,onUpdate:d}=n,f=b.useRef(o),h=b.useRef(i),p=b.useRef(s),m=b.useRef(l),g=b.useRef(a),y=b.useRef(c),k=b.useRef(u),C=b.useRef(d);return b.useEffect(()=>{t.current&&(o&&(t.current.off("beforeCreate",f.current),t.current.on("beforeCreate",o),f.current=o),i&&(t.current.off("blur",h.current),t.current.on("blur",i),h.current=i),s&&(t.current.off("create",p.current),t.current.on("create",s),p.current=s),l&&(t.current.off("destroy",m.current),t.current.on("destroy",l),m.current=l),a&&(t.current.off("focus",g.current),t.current.on("focus",a),g.current=a),c&&(t.current.off("selectionUpdate",y.current),t.current.on("selectionUpdate",c),y.current=c),u&&(t.current.off("transaction",k.current),t.current.on("transaction",u),k.current=u),d&&(t.current.off("update",C.current),t.current.on("update",d),C.current=d))},[o,i,s,l,a,c,u,d,t.current]),b.useEffect(()=>{let v=!0;const E=new X2(n);return t.current=E,t.current.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{v&&r({})})})}),()=>{v=!1,E.destroy()}},e),t.current},hh=b.createContext({editor:null});hh.Consumer;const ew=()=>b.useContext(hh),ph=n=>{const[e,t]=b.useState(null),{editor:r}=ew();return b.useEffect(()=>{var o;if(!e||!((o=n.editor)===null||o===void 0)&&o.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:i="bubbleMenu",editor:s,tippyOptions:l={},updateDelay:a,shouldShow:c=null}=n,u=s||r;if(!u){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const d=fh({updateDelay:a,editor:u,element:e,pluginKey:i,shouldShow:c,tippyOptions:l});return u.registerPlugin(d),()=>u.unregisterPlugin(i)},[n.editor,r,e]),b.createElement("div",{ref:t,className:n.className,style:{visibility:"hidden"}},n.children)},mh=b.createContext({onDragStart:void 0}),gh=()=>b.useContext(mh),yh=n=>{const e=n.as||"div",{nodeViewContentRef:t}=gh();return b.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},Ko=b.forwardRef((n,e)=>{const{onDragStart:t}=gh(),r=n.as||"div";return b.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function tw(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function nw(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class vh{constructor(e,{editor:t,props:r={},as:o="div",className:i="",attrs:s}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(o),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),s&&Object.keys(s).forEach(l=>{this.element.setAttribute(l,s[l])}),this.render()}render(){var e,t;const r=this.component,o=this.props;(tw(r)||nw(r))&&(o.ref=i=>{this.ref=i}),this.reactElement=b.createElement(r,{...o}),(t=(e=this.editor)===null||e===void 0?void 0:e.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e,t;(t=(e=this.editor)===null||e===void 0?void 0:e.contentComponent)===null||t===void 0||t.removeRenderer(this.id)}}class rw extends ub{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(i={})=>this.updateAttributes(i),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const i=s=>s.charAt(0).toUpperCase()+s.substring(1);this.component.displayName=i(this.extension.name)}const t=i=>{const s=this.component,l=this.onDragStart.bind(this),a=c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)};return b.createElement(b.Fragment,null,b.createElement(mh.Provider,{value:{onDragStart:l,nodeViewContentRef:a}},b.createElement(s,{...i})))};t.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit");let r=this.node.isInline?"span":"div";this.options.as&&(r=this.options.as);const{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new vh(t,{editor:this.editor,props:e,as:r,className:`node-${this.node.type.name} ${o}`.trim(),attrs:this.options.attrs})}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.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(){const{from:e,to:t}=this.editor.state.selection;if(e<=this.getPos()&&t>=this.getPos()+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t){const r=o=>{this.renderer.updateProps(o)};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations;return this.node=e,this.decorations=t,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,updateProps:()=>r({node:e,decorations:t})})}return e===this.node&&this.decorations===t||(this.node=e,this.decorations=t,r({node:e,decorations:t})),!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}}function cr(n,e){return t=>t.editor.contentComponent?new rw(n,t,e):{}}const ow=/^\s*>\s$/,iw=pe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Br({find:ow,type:this.type})]}}),sw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,lw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,aw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,cw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,uw=nt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[or({find:sw,type:this.type}),or({find:aw,type:this.type})]},addPasteRules(){return[Pn({find:lw,type:this.type}),Pn({find:cw,type:this.type})]}}),dw=pe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ee(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),bh=nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Fo(n,this.type);return Object.entries(t).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}}),wh=/^\s*([-+*])\s$/,fw=pe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(dw.name,this.editor.getAttributes(bh.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Br({find:wh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Br({find:wh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(bh.name),editor:this.editor})),[n]}}),hw=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,pw=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,mw=nt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[or({find:hw,type:this.type})]},addPasteRules(){return[Pn({find:pw,type:this.type})]}}),gw=/^```([a-z]+)?[\s\n]$/,yw=/^~~~([a-z]+)?[\s\n]$/,vw=pe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,i=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ee(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
139
+
140
+ `);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:i}=t;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0||r.nodeAt(l)?!1:n.commands.exitCode()}}},addInputRules(){return[ya({find:gw,type:this.type,getAttributes:n=>({language:n[1]})}),ya({find:yw,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ge({key:new Ce("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!t||!i)return!1;const{tr:s}=n.state;return n.state.selection.from===n.state.doc.nodeSize-(1+n.state.selection.$to.depth*2)?s.insert(n.state.selection.from-1,this.type.create({language:i})):s.replaceSelectionWith(this.type.create({language:i})),s.setSelection(K.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.insertText(t.replace(/\r\n?/g,`
141
+ `)),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),xh=pe.create({name:"doc",topNode:!0,content:"block+"});function bw(n={}){return new ge({view(e){return new ww(e,n)}})}class ww{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=l?u.bottom:u.top;l&&a&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=o.getBoundingClientRect();i=l.left-o.scrollLeft,s=l.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ou(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const kh=ve.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[bw(this.options)]}});class be extends J{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return be.valid(r)?new be(r):J.near(r)}content(){return B.empty}eq(e){return e instanceof be&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new be(e.resolve(t.pos))}getBookmark(){return new Ia(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!xw(e)||!kw(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&be.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(be.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!W.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(be.valid(l))return l}return null}}}be.prototype.visible=!1,be.findFrom=be.findGapCursorFrom,J.jsonID("gapcursor",be);class Ia{constructor(e){this.pos=e}map(e){return new Ia(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return be.valid(t)?new be(t):J.near(t)}}function xw(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function kw(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Cw(){return new ge({props:{decorations:Tw,createSelectionBetween(n,e,t){return e.pos==t.pos&&be.valid(t)?new be(t):null},handleClick:Ew,handleKeyDown:Sw,handleDOMEvents:{beforeinput:Aw}}})}const Sw=ea({ArrowLeft:Ui("horiz",-1),ArrowRight:Ui("horiz",1),ArrowUp:Ui("vert",-1),ArrowDown:Ui("vert",1)});function Ui(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof K){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=be.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new be(c))),!0):!1}}function Ew(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!be.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&W.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new be(r))),!0)}function Aw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof be))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=M.empty;for(let s=r.length-1;s>=0;s--)o=M.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new B(o,0,0));return i.setSelection(K.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function Tw(n){if(!(n.selection instanceof be))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",me.create(n.doc,[$e.widget(n.selection.head,e,{key:"gapcursor"})])}const Ch=ve.create({name:"gapCursor",addProseMirrorPlugins(){return[Cw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=X(V(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Mw=pe.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ee(this.options.HTMLAttributes,n)]},renderText(){return`
142
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:i}=t;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){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()}}}),Ow=pe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,ee(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>ya({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Ki=200,Le=function(){};Le.prototype.append=function(e){return e.length?(e=Le.from(e),!this.length&&e||e.length<Ki&&this.leafAppend(e)||this.length<Ki&&e.leafPrepend(this)||this.appendInner(e)):this},Le.prototype.prepend=function(e){return e.length?Le.from(e).append(this):this},Le.prototype.appendInner=function(e){return new Nw(this,e)},Le.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Le.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Le.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Le.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Le.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o},Le.from=function(e){return e instanceof Le?e:e&&e.length?new Sh(e):Le.empty};var Sh=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ki)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ki)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Le);Le.empty=new Sh([]);var Nw=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},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}(Le);const Dw=500;class Dt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Wt(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Wt(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new Dt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=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 Wt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),t&&(s++,t=void 0),o||(a=f)}let c=s-r.depth;return c>Pw&&(l=Lw(l,c),s-=c),new Dt(l.append(i),s)}remapping(e,t){let r=new Cr;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Dt(this.items.append(e.map(t=>new Wt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=t;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(i.slice(a+1,h));g&&l++,r.push(new Wt(p,m,g))}else r.push(new Wt(p))},o);let c=[];for(let f=t;f<s;f++)c.push(new Wt(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Dt(u,l);return d.emptyItemCount()>Dw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&i++;let d=new Wt(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Dt(Le.from(o.reverse()),i)}}Dt.empty=new Dt(Le.empty,0);function Lw(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class Wt{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Wt(t.getMap().invert(),t,this.selection)}}}class In{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Pw=20;function Rw(n,e,t,r){let o=t.getMeta(ur),i;if(o)return o.historyState;t.getMeta($w)&&(n=new In(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(ur))return s.getMeta(ur).redo?new In(n.done.addTransform(t,void 0,r,Ji(e)),n.undone,Eh(t.mapping.maps[t.steps.length-1]),n.prevTime,n.prevComposition):new In(n.done,n.undone.addTransform(t,void 0,r,Ji(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Iw(t,n.prevRanges)),c=s?Fa(n.prevRanges,t.mapping):Eh(t.mapping.maps[t.steps.length-1]);return new In(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Ji(e)),Dt.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new In(n.done.rebased(t,i),n.undone.rebased(t,i),Fa(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new In(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Fa(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Iw(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function Eh(n){let e=[];return n.forEach((t,r,o,i)=>e.push(o,i)),e}function Fa(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),i=e.map(n[r+1],-1);o<=i&&t.push(o,i)}return t}function Fw(n,e,t){let r=Ji(e),o=ur.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new In(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(ur,{redo:t,historyState:a})}let $a=!1,Ah=null;function Ji(n){let e=n.plugins;if(Ah!=e){$a=!1,Ah=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){$a=!0;break}}return $a}const ur=new Ce("history"),$w=new Ce("closeHistory");function Bw(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ge({key:ur,state:{init(){return new In(Dt.empty,Dt.empty,null,0,-1)},apply(e,t,r){return Rw(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Mh:r=="historyRedo"?Oh:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Th(n,e){return(t,r)=>{let o=ur.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=Fw(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Mh=Th(!1,!0),Oh=Th(!0,!0),Hw=ve.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Mh(n,e),redo:()=>({state:n,dispatch:e})=>Oh(n,e)}},addProseMirrorPlugins(){return[Bw(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()}}}),Nh=pe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ee(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{$to:t}=e.selection,r=n();return t.parentOffset===0?r.insertContentAt(Math.max(t.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:o,dispatch:i})=>{var s;if(i){const{$to:l}=o.selection,a=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(K.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(W.create(o.doc,l.pos)):o.setSelection(K.create(o.doc,l.pos));else{const c=(s=l.parent.type.contentMatch.defaultType)===null||s===void 0?void 0:s.create();c&&(o.insert(a,c),o.setSelection(K.create(o.doc,a+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ga({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),jw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Vw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,_w=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ww=nt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[or({find:jw,type:this.type}),or({find:Vw,type:this.type})]},addPasteRules(){return[Pn({find:zw,type:this.type}),Pn({find:_w,type:this.type})]}}),qw=pe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ee(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Uw=pe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ee(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Dh=nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Fo(n,this.type);return Object.entries(t).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}}),Lh=/^(\d+)\.\s$/,Kw=pe.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ee(this.options.HTMLAttributes,t),0]:["ol",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Uw.name,this.editor.getAttributes(Dh.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Br({find:Lh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Br({find:Lh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Dh.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Jw=pe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Zw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Gw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Yw=nt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[or({find:Zw,type:this.type})]},addPasteRules(){return[Pn({find:Gw,type:this.type})]}}),Xw=pe.create({name:"text",group:"inline"}),Qw=ve.create({name:"starterKit",addExtensions(){var n,e,t,r,o,i,s,l,a,c,u,d,f,h,p,m,g,y;const k=[];return this.options.blockquote!==!1&&k.push(iw.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&k.push(uw.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&k.push(fw.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&k.push(mw.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&k.push(vw.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&k.push(xh.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&k.push(kh.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&k.push(Ch.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&k.push(Mw.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&k.push(Ow.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&k.push(Hw.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&k.push(Nh.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&k.push(Ww.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&k.push(qw.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&k.push(Kw.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&k.push(Jw.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&k.push(Yw.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&k.push(Xw.configure((y=this.options)===null||y===void 0?void 0:y.text)),k}}),ex=nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Fo(n,this.type);return Object.entries(t).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}}),tx=ve.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>{var e;return(e=n.style.fontFamily)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily.split(",").map(e=>CSS.escape(e.trim())).join(", ")}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),nx=ve.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},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")}}}),rx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ox="ελ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",qr=(n,e)=>{for(const t in e)n[t]=e[t];return n},Ba="numeric",Ha="ascii",ja="alpha",Zi="asciinumeric",Gi="alphanumeric",za="domain",Ph="emoji",ix="scheme",sx="slashscheme",Rh="whitespace";function lx(n,e){return n in e||(e[n]=[]),e[n]}function dr(n,e,t){e[Ba]&&(e[Zi]=!0,e[Gi]=!0),e[Ha]&&(e[Zi]=!0,e[ja]=!0),e[Zi]&&(e[Gi]=!0),e[ja]&&(e[Gi]=!0),e[Gi]&&(e[za]=!0),e[Ph]&&(e[za]=!0);for(const r in e){const o=lx(r,t);o.indexOf(n)<0&&o.push(n)}}function ax(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function it(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}it.groups={},it.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(n))return i}return e.jd},has(n,e){return e===void 0&&(e=!1),e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let o=0;o<n.length;o++)this.tt(n[o],e,t,r)},tr(n,e,t,r){r=r||it.groups;let o;return e&&e.j?o=e:(o=new it(e),t&&r&&dr(e,t,r)),this.jr.push([n,o]),o},ts(n,e,t,r){let o=this;const i=n.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(n[s]);return o.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||it.groups;const o=this;if(e&&e.j)return o.j[n]=e,e;const i=e;let s,l=o.go(n);if(l?(s=new it,qr(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new it,i){if(r)if(s.t&&typeof s.t=="string"){const a=qr(ax(s.t,r),t);dr(i,a,r)}else t&&dr(i,t,r);s.t=i}return o.j[n]=s,s}};const Q=(n,e,t,r,o)=>n.ta(e,t,r,o),St=(n,e,t,r,o)=>n.tr(e,t,r,o),Ih=(n,e,t,r,o)=>n.ts(e,t,r,o),F=(n,e,t,r,o)=>n.tt(e,t,r,o),cn="WORD",Va="UWORD",Jo="LOCALHOST",_a="TLD",Wa="UTLD",Yi="SCHEME",Ur="SLASH_SCHEME",qa="NUM",Fh="WS",Ua="NL",Zo="OPENBRACE",Go="CLOSEBRACE",Xi="OPENBRACKET",Qi="CLOSEBRACKET",es="OPENPAREN",ts="CLOSEPAREN",ns="OPENANGLEBRACKET",rs="CLOSEANGLEBRACKET",is="FULLWIDTHLEFTPAREN",ss="FULLWIDTHRIGHTPAREN",ls="LEFTCORNERBRACKET",as="RIGHTCORNERBRACKET",cs="LEFTWHITECORNERBRACKET",us="RIGHTWHITECORNERBRACKET",ds="FULLWIDTHLESSTHAN",fs="FULLWIDTHGREATERTHAN",hs="AMPERSAND",ps="APOSTROPHE",ms="ASTERISK",Fn="AT",gs="BACKSLASH",ys="BACKTICK",vs="CARET",$n="COLON",Ka="COMMA",bs="DOLLAR",qt="DOT",ws="EQUALS",Ja="EXCLAMATION",Ut="HYPHEN",xs="PERCENT",ks="PIPE",Cs="PLUS",Ss="POUND",Es="QUERY",Za="QUOTE",Ga="SEMI",Kt="SLASH",Yo="TILDE",As="UNDERSCORE",$h="EMOJI",Ts="SYM";var Bh=Object.freeze({__proto__:null,WORD:cn,UWORD:Va,LOCALHOST:Jo,TLD:_a,UTLD:Wa,SCHEME:Yi,SLASH_SCHEME:Ur,NUM:qa,WS:Fh,NL:Ua,OPENBRACE:Zo,CLOSEBRACE:Go,OPENBRACKET:Xi,CLOSEBRACKET:Qi,OPENPAREN:es,CLOSEPAREN:ts,OPENANGLEBRACKET:ns,CLOSEANGLEBRACKET:rs,FULLWIDTHLEFTPAREN:is,FULLWIDTHRIGHTPAREN:ss,LEFTCORNERBRACKET:ls,RIGHTCORNERBRACKET:as,LEFTWHITECORNERBRACKET:cs,RIGHTWHITECORNERBRACKET:us,FULLWIDTHLESSTHAN:ds,FULLWIDTHGREATERTHAN:fs,AMPERSAND:hs,APOSTROPHE:ps,ASTERISK:ms,AT:Fn,BACKSLASH:gs,BACKTICK:ys,CARET:vs,COLON:$n,COMMA:Ka,DOLLAR:bs,DOT:qt,EQUALS:ws,EXCLAMATION:Ja,HYPHEN:Ut,PERCENT:xs,PIPE:ks,PLUS:Cs,POUND:Ss,QUERY:Es,QUOTE:Za,SEMI:Ga,SLASH:Kt,TILDE:Yo,UNDERSCORE:As,EMOJI:$h,SYM:Ts});const Kr=/[a-z]/,Ya=new RegExp("\\p{L}","u"),Xa=new RegExp("\\p{Emoji}","u"),Qa=/\d/,Hh=/\s/,jh=`
143
+ `,cx="️",ux="‍";let Ms=null,Os=null;function dx(n){n===void 0&&(n=[]);const e={};it.groups=e;const t=new it;Ms==null&&(Ms=zh(rx)),Os==null&&(Os=zh(ox)),F(t,"'",ps),F(t,"{",Zo),F(t,"}",Go),F(t,"[",Xi),F(t,"]",Qi),F(t,"(",es),F(t,")",ts),F(t,"<",ns),F(t,">",rs),F(t,"(",is),F(t,")",ss),F(t,"「",ls),F(t,"」",as),F(t,"『",cs),F(t,"』",us),F(t,"<",ds),F(t,">",fs),F(t,"&",hs),F(t,"*",ms),F(t,"@",Fn),F(t,"`",ys),F(t,"^",vs),F(t,":",$n),F(t,",",Ka),F(t,"$",bs),F(t,".",qt),F(t,"=",ws),F(t,"!",Ja),F(t,"-",Ut),F(t,"%",xs),F(t,"|",ks),F(t,"+",Cs),F(t,"#",Ss),F(t,"?",Es),F(t,'"',Za),F(t,"/",Kt),F(t,";",Ga),F(t,"~",Yo),F(t,"_",As),F(t,"\\",gs);const r=St(t,Qa,qa,{[Ba]:!0});St(r,Qa,r);const o=St(t,Kr,cn,{[Ha]:!0});St(o,Kr,o);const i=St(t,Ya,Va,{[ja]:!0});St(i,Kr),St(i,Ya,i);const s=St(t,Hh,Fh,{[Rh]:!0});F(t,jh,Ua,{[Rh]:!0}),F(s,jh),St(s,Hh,s);const l=St(t,Xa,$h,{[Ph]:!0});St(l,Xa,l),F(l,cx,l);const a=F(l,ux);St(a,Xa,l);const c=[[Kr,o]],u=[[Kr,null],[Ya,i]];for(let d=0;d<Ms.length;d++)Bn(t,Ms[d],_a,cn,c);for(let d=0;d<Os.length;d++)Bn(t,Os[d],Wa,Va,u);dr(_a,{tld:!0,ascii:!0},e),dr(Wa,{utld:!0,alpha:!0},e),Bn(t,"file",Yi,cn,c),Bn(t,"mailto",Yi,cn,c),Bn(t,"http",Ur,cn,c),Bn(t,"https",Ur,cn,c),Bn(t,"ftp",Ur,cn,c),Bn(t,"ftps",Ur,cn,c),dr(Yi,{scheme:!0,ascii:!0},e),dr(Ur,{slashscheme:!0,ascii:!0},e),n=n.sort((d,f)=>d[0]>f[0]?1:-1);for(let d=0;d<n.length;d++){const f=n[d][0],p=n[d][1]?{[ix]:!0}:{[sx]:!0};f.indexOf("-")>=0?p[za]=!0:Kr.test(f)?Qa.test(f)?p[Zi]=!0:p[Ha]=!0:p[Ba]=!0,Ih(t,f,f,p)}return Ih(t,"localhost",Jo,{ascii:!0}),t.jd=new it(Ts),{start:t,tokens:qr({groups:e},Bh)}}function fx(n,e){const t=hx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,o=[];let i=0,s=0;for(;s<r;){let l=n,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(t[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=t[s].length,f++),c+=t[s].length,i+=t[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function hx(n){const e=[],t=n.length;let r=0;for(;r<t;){let o=n.charCodeAt(r),i,s=o<55296||o>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function Bn(n,e,t,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?i=n.j[a]:(i=new it(r),i.jr=o.slice(),n.j[a]=i),n=i}return i=new it(t),i.jr=o.slice(),n.j[e[s-1]]=i,i}function zh(n){const e=[],t=[];let r=0,o="0123456789";for(;r<n.length;){let i=0;for(;o.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+i),10);s>0;s--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Xo={defaultProtocol:"http",events:null,format:Vh,formatHref:Vh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ec(n,e){e===void 0&&(e=null);let t=qr({},Xo);n&&(t=qr(t,n instanceof ec?n.o:n));const r=t.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=o}ec.prototype={o:Xo,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let o=this.o[n];return o&&(typeof o=="object"?(o=t.t in o?o[t.t]:Xo[n],typeof o=="function"&&r&&(o=o(e,t))):typeof o=="function"&&r&&(o=o(e,t.t,t)),o)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Vh(n){return n}function _h(n,e){this.t="token",this.v=n,this.tk=e}_h.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=Xo.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&qr(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function Ns(n,e){class t extends _h{constructor(o,i){super(o,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Wh=Ns("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),qh=Ns("text"),px=Ns("nl"),Ds=Ns("url",{isLink:!0,toHref(n){return n===void 0&&(n=Xo.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Jo&&n[1].t===$n}}),Et=n=>new it(n);function mx(n){let{groups:e}=n;const t=e.domain.concat([hs,ms,Fn,gs,ys,vs,bs,ws,Ut,qa,xs,ks,Cs,Ss,Kt,Ts,Yo,As]),r=[ps,$n,Ka,qt,Ja,Es,Za,Ga,ns,rs,Zo,Go,Qi,Xi,es,ts,is,ss,ls,as,cs,us,ds,fs],o=[hs,ps,ms,gs,ys,vs,bs,ws,Ut,Zo,Go,xs,ks,Cs,Ss,Es,Kt,Ts,Yo,As],i=Et(),s=F(i,Yo);Q(s,o,s),Q(s,e.domain,s);const l=Et(),a=Et(),c=Et();Q(i,e.domain,l),Q(i,e.scheme,a),Q(i,e.slashscheme,c),Q(l,o,s),Q(l,e.domain,l);const u=F(l,Fn);F(s,Fn,u),F(a,Fn,u),F(c,Fn,u);const d=F(s,qt);Q(d,o,s),Q(d,e.domain,s);const f=Et();Q(u,e.domain,f),Q(f,e.domain,f);const h=F(f,qt);Q(h,e.domain,f);const p=Et(Wh);Q(h,e.tld,p),Q(h,e.utld,p),F(u,Jo,p);const m=F(f,Ut);Q(m,e.domain,f),Q(p,e.domain,f),F(p,qt,h),F(p,Ut,m);const g=F(p,$n);Q(g,e.numeric,Wh);const y=F(l,Ut),k=F(l,qt);Q(y,e.domain,l),Q(k,o,s),Q(k,e.domain,l);const C=Et(Ds);Q(k,e.tld,C),Q(k,e.utld,C),Q(C,e.domain,l),Q(C,o,s),F(C,qt,k),F(C,Ut,y),F(C,Fn,u);const v=F(C,$n),E=Et(Ds);Q(v,e.numeric,E);const S=Et(Ds),O=Et();Q(S,t,S),Q(S,r,O),Q(O,t,S),Q(O,r,O),F(C,Kt,S),F(E,Kt,S);const D=F(a,$n),A=F(c,$n),P=F(A,Kt),H=F(P,Kt);Q(a,e.domain,l),F(a,qt,k),F(a,Ut,y),Q(c,e.domain,l),F(c,qt,k),F(c,Ut,y),Q(D,e.domain,S),F(D,Kt,S),Q(H,e.domain,S),Q(H,t,S),F(H,Kt,S);const N=[[Zo,Go],[Xi,Qi],[es,ts],[ns,rs],[is,ss],[ls,as],[cs,us],[ds,fs]];for(let $=0;$<N.length;$++){const[R,I]=N[$],U=F(S,R);F(O,R,U),F(U,I,S);const z=Et(Ds);Q(U,t,z);const G=Et();Q(U,r),Q(z,t,z),Q(z,r,G),Q(G,t,z),Q(G,r,G),F(z,I,S),F(G,I,S)}return F(i,Jo,C),F(i,Ua,px),{start:i,tokens:Bh}}function gx(n,e,t){let r=t.length,o=0,i=[],s=[];for(;o<r;){let l=n,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(t[o].t));)s.push(t[o++]);for(;o<r&&(c=a||l.go(t[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(t[o]),o++);else{s.length>0&&(i.push(tc(qh,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=t.slice(o-u,o);i.push(tc(h,e,p))}}return s.length>0&&i.push(tc(qh,e,s)),i}function tc(n,e,t){const r=t[0].s,o=t[t.length-1].e,i=e.slice(r,o);return new n(i,t)}const yx=typeof console<"u"&&console&&console.warn||(()=>{}),vx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ye={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function bx(){it.groups={},ye.scanner=null,ye.parser=null,ye.tokenQueue=[],ye.pluginQueue=[],ye.customSchemes=[],ye.initialized=!1}function Uh(n,e){if(e===void 0&&(e=!1),ye.initialized&&yx(`linkifyjs: already initialized - will not register custom scheme "${n}" ${vx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
144
+ 1. Must only contain digits, lowercase ASCII letters or "-"
145
+ 2. Cannot start or end with "-"
146
+ 3. "-" cannot repeat`);ye.customSchemes.push([n,e])}function wx(){ye.scanner=dx(ye.customSchemes);for(let n=0;n<ye.tokenQueue.length;n++)ye.tokenQueue[n][1]({scanner:ye.scanner});ye.parser=mx(ye.scanner.tokens);for(let n=0;n<ye.pluginQueue.length;n++)ye.pluginQueue[n][1]({scanner:ye.scanner,parser:ye.parser});ye.initialized=!0}function Kh(n){return ye.initialized||wx(),gx(ye.parser.start,n,fx(ye.scanner.start,n))}function Jh(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ec(t),o=Kh(n),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}function xx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function kx(n){return new ge({key:new Ce("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=Pv(t.doc,[...e]);if(zv(l).forEach(({newRange:c})=>{const u=Iv(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," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")),d&&f){const h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=Kh(p).map(y=>y.toObject());if(!xx(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=>n.validate?n.validate(y.value):!0).forEach(y=>{fa(y.from,y.to,r.doc).some(k=>k.mark.type===n.type)||s.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function Cx(n){return new ge({key:new Ce("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,i;if(n.whenNotEditable&&e.editable||r.button!==0)return!1;let s=r.target;const l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;const a=xf(e.state,n.type.name),c=r.target,u=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:a.href,d=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&u?(window.open(u,d),!0):!1}}})}function Sx(n){return new ge({key:new Ce("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=Jh(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const Ex=nt.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){Uh(n);return}Uh(n.scheme,n.optionalSlashes)})},onDestroy(){bx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",ee(this.options.HTMLAttributes,{...n,href:""}),0]:["a",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Pn({find:n=>{const e=[];if(n){const t=Jh(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(kx({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(Cx({type:this.type,whenNotEditable:this.options.openOnClick==="whenNotEditable"})),this.options.linkOnPaste&&n.push(Sx({editor:this.editor,type:this.type})),n}}),Ax=ve.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ge({key:new Ce("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,i=[];if(!r)return null;const{firstChild:s}=n.content,l=s&&s.type.isLeaf,a=s&&s.isAtom,c=this.options.considerAnyAsEmpty?!0:s&&s.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&s&&c&&s.nodeSize<=2&&(!l||!a);return n.descendants((d,f)=>{const h=o>=f&&o<=f+d.nodeSize,p=!d.isLeaf&&!d.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const g=$e.node(f,f+d.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:d,pos:f,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),me.create(n,i)}}})]}}),Tx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Mx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Ox=nt.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[or({find:Tx,type:this.type})]},addPasteRules(){return[Pn({find:Mx,type:this.type})]}}),Nx=pe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ee(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Dx=/^\s*(\[([( |x])?\])\s$/,Lx=pe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ee(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");return i.contentEditable="false",l.type="checkbox",l.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=t(),h=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{o.setAttribute(c,u)}),o.dataset.checked=n.attrs.checked,n.attrs.checked&&l.setAttribute("checked","checked"),i.append(l,s),o.append(i,a),Object.entries(e).forEach(([c,u])=>{o.setAttribute(c,u)}),{dom:o,contentDOM:a,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,c.attrs.checked?l.setAttribute("checked","checked"):l.removeAttribute("checked"),!0)}}},addInputRules(){return[Br({find:Dx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Px=nt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ee(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Rx(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:o,startOfLine:i,$position:s}=n,l=db(t),a=new RegExp(`\\s${l}$`),c=i?"^":"",u=r?new RegExp(`${c}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${c}(?:^)?${l}[^\\s${l}]*`,"gm"),d=((e=s.nodeBefore)===null||e===void 0?void 0:e.isText)&&s.nodeBefore.text;if(!d)return null;const f=s.pos-d.length,h=Array.from(d.matchAll(u)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${o==null?void 0:o.join("")}\0]?$`).test(p);if(o!==null&&!m)return null;const g=f+h.index;let y=g+h[0].length;return r&&a.test(d.slice(y-1,y+1))&&(h[0]+=" ",y+=1),g<s.pos&&y>=s.pos?{range:{from:g,to:y},query:h[0].slice(t.length),text:h[0]}:null}const Ix=new Ce("suggestion");function Fx({pluginKey:n=Ix,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:o=[" "],startOfLine:i=!1,decorationTag:s="span",decorationClass:l="suggestion",command:a=()=>null,items:c=()=>[],render:u=()=>({}),allow:d=()=>!0,findSuggestionMatch:f=Rx}){let h;const p=u==null?void 0:u(),m=new ge({key:n,view(){return{update:async(g,y)=>{var k,C,v,E,S,O,D;const A=(k=this.key)===null||k===void 0?void 0:k.getState(y),P=(C=this.key)===null||C===void 0?void 0:C.getState(g.state),H=A.active&&P.active&&A.range.from!==P.range.from,N=!A.active&&P.active,$=A.active&&!P.active,R=!N&&!$&&A.query!==P.query,I=N||H,U=R&&!H,z=$||H;if(!I&&!U&&!z)return;const G=z&&!I?A:P,se=g.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);h={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:le=>a({editor:e,range:G.range,props:le}),decorationNode:se,clientRect:se?()=>{var le;const{decorationId:He}=(le=this.key)===null||le===void 0?void 0:le.getState(e.state),Te=g.dom.querySelector(`[data-decoration-id="${He}"]`);return(Te==null?void 0:Te.getBoundingClientRect())||null}:null},I&&((v=p==null?void 0:p.onBeforeStart)===null||v===void 0||v.call(p,h)),U&&((E=p==null?void 0:p.onBeforeUpdate)===null||E===void 0||E.call(p,h)),(U||I)&&(h.items=await c({editor:e,query:G.query})),z&&((S=p==null?void 0:p.onExit)===null||S===void 0||S.call(p,h)),U&&((O=p==null?void 0:p.onUpdate)===null||O===void 0||O.call(p,h)),I&&((D=p==null?void 0:p.onStart)===null||D===void 0||D.call(p,h))},destroy:()=>{var g;h&&((g=p==null?void 0:p.onExit)===null||g===void 0||g.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,k,C){const{isEditable:v}=e,{composing:E}=e.view,{selection:S}=g,{empty:O,from:D}=S,A={...y};if(A.composing=E,v&&(O||e.view.composing)){(D<y.range.from||D>y.range.to)&&!E&&!y.composing&&(A.active=!1);const P=f({char:t,allowSpaces:r,allowedPrefixes:o,startOfLine:i,$position:S.$from}),H=`id_${Math.floor(Math.random()*4294967295)}`;P&&d({editor:e,state:C,range:P.range})?(A.active=!0,A.decorationId=y.decorationId?y.decorationId:H,A.range=P.range,A.query=P.query,A.text=P.text):A.active=!1}else A.active=!1;return A.active||(A.decorationId=null,A.range={from:0,to:0},A.query=null,A.text=null),A}},props:{handleKeyDown(g,y){var k;const{active:C,range:v}=m.getState(g.state);return C&&((k=p==null?void 0:p.onKeyDown)===null||k===void 0?void 0:k.call(p,{view:g,event:y,range:v}))||!1},decorations(g){const{active:y,range:k,decorationId:C}=m.getState(g);return y?me.create(g.doc,[$e.inline(k.from,k.to,{nodeName:s,class:l,"data-decoration-id":C})]):null}}});return m}/**
147
+ * @license lucide-react v0.379.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const $x=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Zh=(...n)=>n.filter((e,t,r)=>!!e&&r.indexOf(e)===t).join(" ");/**
152
+ * @license lucide-react v0.379.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */var Bx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
157
+ * @license lucide-react v0.379.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const Hx=b.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...l},a)=>b.createElement("svg",{ref:a,...Bx,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:Zh("lucide",o),...l},[...s.map(([c,u])=>b.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
162
+ * @license lucide-react v0.379.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const ue=(n,e)=>{const t=b.forwardRef(({className:r,...o},i)=>b.createElement(Hx,{ref:i,iconNode:e,className:Zh(`lucide-${$x(n)}`,r),...o}));return t.displayName=`${n}`,t};/**
167
+ * @license lucide-react v0.379.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Gh=ue("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
172
+ * @license lucide-react v0.379.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const Ls=ue("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
177
+ * @license lucide-react v0.379.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const nc=ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
182
+ * @license lucide-react v0.379.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const jx=ue("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
187
+ * @license lucide-react v0.379.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const Yh=ue("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
192
+ * @license lucide-react v0.379.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const Xh=ue("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
197
+ * @license lucide-react v0.379.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const zx=ue("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
202
+ * @license lucide-react v0.379.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const Vx=ue("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
207
+ * @license lucide-react v0.379.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const _x=ue("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/**
212
+ * @license lucide-react v0.379.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const Wx=ue("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
217
+ * @license lucide-react v0.379.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const Qh=ue("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
222
+ * @license lucide-react v0.379.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const ep=ue("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
227
+ * @license lucide-react v0.379.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const tp=ue("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
232
+ * @license lucide-react v0.379.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const qx=ue("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
237
+ * @license lucide-react v0.379.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const rc=ue("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
242
+ * @license lucide-react v0.379.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const Ux=ue("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
247
+ * @license lucide-react v0.379.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const Kx=ue("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
252
+ * @license lucide-react v0.379.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const Jx=ue("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
257
+ * @license lucide-react v0.379.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const Zx=ue("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
262
+ * @license lucide-react v0.379.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const Gx=ue("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
267
+ * @license lucide-react v0.379.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const Yx=ue("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/**
272
+ * @license lucide-react v0.379.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const np=ue("SquareCheckBig",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]]);/**
277
+ * @license lucide-react v0.379.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const Xx=ue("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
282
+ * @license lucide-react v0.379.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const Qx=ue("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/**
287
+ * @license lucide-react v0.379.0 - ISC
288
+ *
289
+ * This source code is licensed under the ISC license.
290
+ * See the LICENSE file in the root directory of this source tree.
291
+ */const rp=ue("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/**
292
+ * @license lucide-react v0.379.0 - ISC
293
+ *
294
+ * This source code is licensed under the ISC license.
295
+ * See the LICENSE file in the root directory of this source tree.
296
+ */const op=ue("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/**
297
+ * @license lucide-react v0.379.0 - ISC
298
+ *
299
+ * This source code is licensed under the ISC license.
300
+ * See the LICENSE file in the root directory of this source tree.
301
+ */const ek=ue("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
302
+ * @license lucide-react v0.379.0 - ISC
303
+ *
304
+ * This source code is licensed under the ISC license.
305
+ * See the LICENSE file in the root directory of this source tree.
306
+ */const ip=ue("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/**
307
+ * @license lucide-react v0.379.0 - ISC
308
+ *
309
+ * This source code is licensed under the ISC license.
310
+ * See the LICENSE file in the root directory of this source tree.
311
+ */const sp=ue("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]),Ps=new Ce("upload-image"),tk=()=>new ge({key:Ps,state:{init(){return me.empty},apply(n,e){e=e.map(n.mapping,n.doc);const t=n.getMeta(this);if(t&&t.add){const{id:r,pos:o,src:i}=t.add,s=document.createElement("div");s.setAttribute("class","img-placeholder");const l=document.createElement("img");l.setAttribute("class","rounded-lg border border-stone-200"),l.src=i,s.appendChild(l);const a=$e.widget(o+1,s,{id:r});e=e.add(n.doc,[a])}else t&&t.remove&&(e=e.remove(e.find(void 0,void 0,r=>r.id==t.remove.id)));return e}},props:{decorations(n){return this.getState(n)}}});function nk(n,e){const r=Ps.getState(n).find(null,null,o=>o.id==e);return r.length?r[0].from:null}function lp(n,e,t){if(n.type.includes("image/")){if(n.size>1024*1024){console.log("failed");return}}else{console.log("file is not an image");return}const r={},o=e.state.tr;o.selection.empty||o.deleteSelection();const i=new FileReader;i.readAsDataURL(n),i.onload=()=>{o.setMeta(Ps,{add:{id:r,pos:t,src:i.result}}),e.dispatch(o)},rk(n).then(s=>{const{schema:l}=e.state,a=nk(e.state,r);if(a==null)return;const c=typeof s=="object"?i.result:s,u=l.nodes.resizableMedia.create({src:c,"media-type":"img"}),d=e.state.tr.replaceWith(a-2,a+u.nodeSize,u).setMeta(Ps,{remove:{id:r}});e.dispatch(d)})}const rk=n=>new Promise(e=>{const t=new FileReader;t.readAsDataURL(n),t.onload=()=>e(t.result)}),ok=async n=>{const e=new FileReader;if(e.readAsDataURL(n),n.size>1024*1024)throw e.abort(),console.log("should be less than 1 mb"),new Error("Image too large");return await new Promise(r=>{e.onload=()=>{r(e.result)}})},ik=ve.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Fx({editor:this.editor,...this.options.suggestion})]}}),sk=({query:n})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:w.jsx(op,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:w.jsx(np,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:w.jsx(Qh,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:w.jsx(ep,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:w.jsx(tp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:w.jsx(Ux,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:w.jsx(rc,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:w.jsx(Kx,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:w.jsx(rp,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:w.jsx(Yh,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:w.jsx(Xx,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:w.jsx(qx,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const r=document.createElement("input");r.type="file",r.accept="image/*",r.onchange=async()=>{var o;if((o=r.files)!=null&&o.length){const i=r.files[0],s=e.view.state.selection.from;lp(i,e.view,s)}},r.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:w.jsx(sp,{}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:w.jsx(ip,{}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:w.jsx(Xh,{}),image:"",command:({editor:e})=>{e.chain().focus().setColumns(2).focus(e.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:w.jsx(zx,{}),image:"",command:({editor:e})=>{e.chain().focus().setColumns(3).focus(e.state.selection.head-1).run()}}].filter(e=>{if(typeof n=="string"&&n.length>0){const t=n.toLowerCase();return e.title.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.searchTerms&&e.searchTerms.some(r=>r.includes(t))}return!0}),lk=(n,e)=>{const t=n.offsetHeight,r=e?e.offsetHeight:0,o=e.offsetTop,i=o+r;o<n.scrollTop?n.scrollTop-=n.scrollTop-o+5:i>t+n.scrollTop&&(n.scrollTop+=i-t-n.scrollTop+5)},ak=({items:n,command:e,editor:t})=>{const[r,o]=b.useState(0),i=b.useCallback(l=>{const a=n[l];a&&(a.title==="Continue writing"||e(a))},[e,t,n]);b.useEffect(()=>{const l=["ArrowUp","ArrowDown","Enter"],a=c=>{if(l.includes(c.key))return c.preventDefault(),c.key==="ArrowUp"?(o((r+n.length-1)%n.length),!0):c.key==="ArrowDown"?(o((r+1)%n.length),!0):c.key==="Enter"?(i(r),!0):!1};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[n,r,o,i]),b.useEffect(()=>{o(0)},[n]);const s=b.useRef(null);return b.useLayoutEffect(()=>{const l=s==null?void 0:s.current,a=l==null?void 0:l.children[r];a&&l&&lk(l,a)},[r]),n.length>0?w.jsx("div",{id:"slash-command",ref:s,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:n.map((l,a)=>w.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${a===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>i(a),children:[w.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:l.icon}),w.jsxs("div",{children:[w.jsx("p",{className:"font-medium",children:l.title}),w.jsx("p",{className:"text-xs text-neutral-500",children:l.description})]})]},a))}):null},ck=()=>{let n=null,e=null;return{onStart:t=>{n=new vh(ak,{props:t,editor:t.editor}),e=ar("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:t=>{n==null||n.updateProps(t),e&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown:t=>{var r;return t.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=n==null?void 0:n.ref)==null?void 0:r.onKeyDown(t)},onExit:()=>{e==null||e[0].destroy(),n==null||n.destroy()}}},uk=ik.configure({suggestion:{items:sk,render:ck}}),dk=Nh.extend({renderHTML(){return["div",ee(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),ap=pe.create({name:"column",content:"dBlock+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:n=>n.getAttribute("data-position"),renderHTML:n=>({"data-position":n.position})}}},renderHTML({HTMLAttributes:n}){return["div",ee(n,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}}),fk=(n,e)=>Array.from({length:n},(t,r)=>e(r)),Rs=({type:n,content:e})=>e?{type:n,content:e}:{type:n},hk=({content:n})=>Rs({type:"paragraph",content:n}),cp=({content:n})=>Rs({type:"dBlock",content:n}),up=({content:n})=>Rs({type:"column",content:n}),dp=({content:n})=>Rs({type:"columns",content:n}),fp=n=>{const e=[cp({content:[hk({})]})];return fk(n,()=>up({content:e}))},hp=(n,e)=>{for(let t=n.depth;t>0;t--){const r=n.node(t),o=t>0?n.before(t):0,i=n.start(t);if(e({node:r,pos:o,start:i}))return{start:i,depth:t,node:r,pos:o}}throw Error("no ancestor found")};class Is extends J{constructor(t){const{$from:r,$to:o}=t;super(r,o);bn(this,"_$from");bn(this,"_$to");this._$from=r,this._$to=o}get $from(){return this._$from}get $to(){return this._$to}map(){return this}content(){return this.$from.doc.slice(this.from,this.to,!0)}eq(t){return t instanceof Is&&t.anchor==this.anchor}toJSON(){return{type:"column",from:this.from,to:this.to}}expandSelection(t){var a;const r=({pos:c,node:u})=>u.type.name===ap.name?!0:t.resolve(c).depth<=0,{pos:o}=hp(this.$from,r);this._$from=t.resolve(o);const{pos:i,node:s}=hp(this.$to,r);this._$to=t.resolve(i+s.nodeSize),((a=this.getFirstNode())==null?void 0:a.type.name)===Fs.name&&(this._$from=t.resolve(this.$from.pos+2),this._$to=t.resolve(this.$to.pos+2));const l=this;l.$anchor=this._$from,l.$head=this._$to,l.ranges=[new El(this._$from,this._$to)]}static create(t,r,o){const i=t.resolve(r),s=t.resolve(o),l=new K(i,s);return new Is(l)}getFirstNode(){return this.content().content.firstChild}}var fr=(n=>(n.AlignLeft="align-left",n.AlignRight="align-right",n.AlignCenter="align-center",n))(fr||{});const Fs=pe.create({name:"columns",group:"columns",content:"column{2,}",defining:!0,draggable:!0,isolating:!0,addAttributes(){return{layout:{default:"align-center"}}},addCommands(){return{unsetColumns:()=>({tr:n,dispatch:e})=>{try{if(!e)return;const t=n.selection.$from,o=ua(t,({node:a})=>!this.options.nestedColumns&&a.type==this.type?!0:a.type==this.type);if(o===void 0)return;let i=[];o.node.descendants((a,c,u)=>{(u==null?void 0:u.type.name)===Fs.name&&i.push(a)}),i=i.reverse().filter(a=>a.content.size>0);const s=n.doc.resolve(o.pos),l=new W(s);return n=n.setSelection(l),i.forEach(a=>n=n.insert(o.pos,a)),n=n.deleteSelection(),e(n)}catch(t){console.error(t)}},setColumns:(n,e=!1)=>({tr:t,dispatch:r})=>{try{const{doc:o,selection:i}=t;if(!r){console.log("no dispatch");return}const s=new Is(i);s.expandSelection(o);const{openStart:l,openEnd:a}=s.content();if(l!==a){console.warn("failed depth check");return}let c;if(e){const h=s.content().toJSON(),p=up(h),m=fp(n-1);c=dp({content:[p,...m]})}else{const h=fp(n);c=dp({content:h})}const u=o.type.schema.nodeFromJSON(cp({content:[c]}));if(u===null)return;const d=s.$anchor.parent.type;if(!(h=>!(!h.contentMatch.matchType(this.type)||!this.options.nestedColumns&&h.name===Fs.name))(d)){console.warn("content not allowed");return}return t=t.setSelection(s),t=t.replaceSelectionWith(u,!1),r(t)}catch(o){console.error(o)}},setLayout:n=>({commands:e})=>e.updateAttributes("columns",{layout:n})}},renderHTML({HTMLAttributes:n}){return["div",{"data-type":"columns",class:`layout-${n.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]}}),pk=ve.create({name:"columnExtension",addExtensions(){const n=[];return this.options.column!==!1&&n.push(ap),this.options.columns!==!1&&n.push(Fs),n}}),mk=ve.create({name:"CustomKeymap",addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:n,commands:e})=>{const{state:t}=n,{tr:r}=t,o=r.selection.$from.start(),i=r.selection.$to.end();return e.setTextSelection({from:o,to:i})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:n})=>{const{state:e}=n,{tr:t}=e,r=t.selection.from,o=t.selection.to,i=t.selection.$from.start(),s=t.selection.$to.end();return r>i||o<s?(n.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),gk=ve.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),pp="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_224_2464'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_224_2464)'%3e%3cpath%20d='M3%2021V19H21V21H3ZM7%2017V15H17V17H7ZM3%2013V11H21V13H3ZM7%209V7H17V9H7ZM3%205V3H21V5H3Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",oc="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_337_2575'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_337_2575)'%3e%3cpath%20d='M3%2021V19H21V21H3ZM3%2017V15H15V17H3ZM3%2013V11H21V13H3ZM3%209V7H15V9H3ZM3%205V3H21V5H3Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",mp="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_224_2470'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_224_2470)'%3e%3cpath%20d='M3%205V3H21V5H3ZM9%209V7H21V9H9ZM3%2013V11H21V13H3ZM9%2017V15H21V17H9ZM3%2021V19H21V21H3Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",gp=[{tooltip:"Align left",action:n=>n({dataAlign:"start",dataFloat:null}),icon:oc,isActive:n=>n.dataAlign==="start"},{tooltip:"Align center",action:n=>n({dataAlign:"center",dataFloat:null}),icon:pp,isActive:n=>n.dataAlign==="center"},{tooltip:"Align right",action:n=>n({dataAlign:"end",dataFloat:null}),icon:mp,isActive:n=>n.dataAlign==="end"},{tooltip:"Delete",icon:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M19%204h-3.5l-1-1h-5l-1%201H5v2h14M6%2019a2%202%200%200%200%202%202h8a2%202%200%200%200%202-2V7H6v12Z'/%3e%3c/svg%3e",delete:n=>n()}];var yp={exports:{}};/*!
312
+ Copyright (c) 2018 Jed Watson.
313
+ Licensed under the MIT License (MIT), see
314
+ http://jedwatson.github.io/classnames
315
+ */(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var i="",s=0;s<arguments.length;s++){var l=arguments[s];l&&(i=o(i,r(l)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return t.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var l in i)e.call(i,l)&&i[l]&&(s=o(s,l));return s}function o(i,s){return s?i?i+" "+s:i+s:i}n.exports?(t.default=t,n.exports=t):window.classNames=t})()})(yp);var yk=yp.exports;const fe=Jc(yk),vp=b.createContext(null),$s=()=>b.useContext(vp),vk=({children:n,isPreviewMode:e})=>w.jsx(vp.Provider,{value:e,children:n});let Jr;const bp=({node:n,updateAttributes:e,deleteNode:t})=>{const r=$s(),[o,i]=b.useState(),[s,l]=b.useState(0),[a,c]=b.useState(0),[u,d]=b.useState({}),f=b.useRef(null),[h,p]=b.useState(!1),m=()=>{const N={};gp.forEach(({tooltip:$,isActive:R})=>{N[$]=!!(R!=null&&R(n.attrs))}),d(N)},g=()=>{const N=document.querySelector(".ProseMirror");if(N&&c(N==null?void 0:N.clientWidth),!!f.current){if(o==="video"){const $=f.current;$.addEventListener("loadeddata",function(){l($.videoWidth/$.videoHeight),S("left",0)})}else if(o==="iframe"){const $=f.current;$.onload=()=>{l($.offsetWidth/$.offsetHeight),S("left",0)}}else f.current.onload=()=>{l(f.current.naturalWidth/f.current.naturalHeight)};setTimeout(()=>m(),200)}},y=N=>{Jr=N};b.useEffect(()=>{g()},[]);const k=({width:N,height:$})=>N<200||$<200,C=N=>{setTimeout(()=>O(N))},v=N=>{Jr=N.clientX,setTimeout(()=>{document.addEventListener("mousemove",C),document.addEventListener("mouseup",E)}),p(!0)},E=()=>{Jr=-1,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",E),p(!1)},S=(N,$)=>{var U,z;if(!f.current){console.error("Media ref is undefined|null",{resizableImg:f.current});return}const R={width:(U=f.current)==null?void 0:U.width,height:(z=f.current)==null?void 0:z.height},I={width:-1,height:-1};N==="left"?I.width=R.width-Math.abs($):(typeof R.width=="string"&&(R.width=Number(R.width)),I.width=R.width+Math.abs($)),I.width>a&&(I.width=a),o==="iframe"?I.height=I.width/(16/9):I.height=I.width/s,!k(I)&&e(I)},O=N=>{if(Jr===-1)return;const{clientX:$}=N,R=Jr-$;if(R===0)return;const I=R>0?"left":"right";setTimeout(()=>{S(I,Math.abs(R)),Jr=$})},[D,A]=b.useState(),[P,H]=b.useState();return b.useEffect(()=>{i(n.attrs["media-type"]),m(),A(n.attrs.dataFloat),H(n.attrs.dataAlign)},[n.attrs]),w.jsx(Ko,{as:"article",className:fe("media-node-view not-prose transition-all ease-in-out w-full",D&&`f-${n.attrs.dataFloat}`,P&&`justify-${n.attrs.dataAlign}`),children:w.jsxs("div",{className:"w-fit flex relative group transition-all ease-in-out",children:[o==="img"&&w.jsx("img",{src:n.attrs.src,ref:f,className:"rounded-lg",alt:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),o==="video"&&w.jsx("video",{ref:f,className:"rounded-lg",controls:!0,width:n.attrs.width,height:n.attrs.height,children:w.jsx("source",{src:n.attrs.src})}),o==="iframe"&&w.jsx("iframe",{ref:f,className:fe("rounded-lg max-w-full",h&&"pointer-events-none"),src:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),!r&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"horizontal-resize-handle group-hover:bg-black group-hover:border-2 group-hover:border-white/80",title:"Resize",onClick:({clientX:N})=>y(N),onMouseDown:v,onMouseUp:E}),w.jsx("section",{className:"media-control-buttons opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:gp.map(N=>w.jsx("div",{className:"tooltip","data-tip":N.tooltip,children:w.jsx("button",{type:"button",className:fe("btn rounded-none h-8 px-2",u[N.tooltip]&&"active"),onClick:()=>{var $;return N.tooltip==="Delete"?t():($=N.action)==null?void 0:$.call(N,e)},children:w.jsx("img",{src:N.icon,className:"w-4"})})}))})]})]})})},bk=pe.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},"media-type":{default:"iframe"},alt:{default:null},title:{default:null},width:{default:this.options.width},height:{default:this.options.height},dataAlign:{default:"left"},dataFloat:{default:null}}},addNodeView(){return cr(bp)},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",ee(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,dispatch:t})=>{const{selection:r}=e,o=this.type.create(n);return t&&e.replaceRangeWith(r.from-1,r.to,o),!0}}}});var wk="https://platform.twitter.com/widgets.js",ic="createTweet",xk=function(e){var t=b.useRef(null),r=b.useState(!0),o=r[0],i=r[1];return b.useEffect(function(){var s=!0,l=require("scriptjs");return l(wk,"twitter-embed",function(){if(!window.twttr){console.error("Failure to load window.twttr, aborting load");return}if(s){if(!window.twttr.widgets[ic]){console.error("Method "+ic+" is not present anymore in twttr.widget api");return}window.twttr.widgets[ic](e.tweetId,t==null?void 0:t.current,e.options).then(function(a){i(!1),e.onLoad&&e.onLoad(a)})}}),function(){s=!1}},[]),b.createElement(b.Fragment,null,o&&b.createElement(b.Fragment,null,e.placeholder),b.createElement("div",{ref:t}))};const wp=({height:n,width:e})=>w.jsx("span",{className:"flex items-center justify-center ",children:w.jsx("span",{className:`${e?`w-${e}`:"w-8"} ${n?`h-${n}`:"h-8"} border-4 border-t-4 border-t-[#ccc] border-gray-500 rounded-full animate-spin`})}),kk=({node:n,editor:e})=>{const[t,r]=b.useState(!0);return b.useEffect(()=>{e==null||e.chain().focus()},[]),w.jsx(Ko,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:w.jsxs("div",{className:"w-full max-w-sm",children:[t&&w.jsx(wp,{width:5,height:5}),w.jsx(xk,{tweetId:n.attrs.tweetId,onLoad:()=>r(!1)})]})})},Ck=pe.create({name:"embeddedTweet",group:"block",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:""}}},addAttributes(){return{tweetId:{default:null},align:{default:"center"}}},parseHTML(){return[{tag:"div[data-tweet-id]"}]},renderHTML({HTMLAttributes:n}){return["div",ee(this.options.HTMLAttributes,n)]},addNodeView(){return cr(kk)},addCommands(){return{setTweetEmbed:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{tweetId:n.tweetId,align:"center"},content:[]})}}}),Sk=n=>new ge({key:new Ce("media-paste-drop"),props:{handlePaste(e,t){var o;return Array.from(((o=t.clipboardData)==null?void 0:o.items)||[]).forEach(i=>{const s=i.getAsFile();if(((s==null?void 0:s.type.indexOf("image"))===0||(s==null?void 0:s.type.indexOf("video"))===0)&&(t.preventDefault(),s&&s.size>1024*1024))throw new Error("Image too large")}),!1},handleDrop(e,t){var l;if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const o=Array.from(((l=t.dataTransfer)==null?void 0:l.files)??[]).filter(({type:a})=>/image|video/i.test(a));if(o.length===0)return!1;t.preventDefault();const{schema:i}=e.state,s=e.posAtCoords({left:t.clientX,top:t.clientY});return s?(o.forEach(async a=>{const c=new FileReader;if(n){const u=i.nodes.resizableMedia.create({src:await n(a),"media-type":a.type.includes("image")?"img":"video"}),d=e.state.tr.insert(s.pos,u);e.dispatch(d)}else c.onload=u=>{var h;const d=i.nodes.resizableMedia.create({src:(h=u.target)==null?void 0:h.result,"media-type":a.type.includes("image")?"img":"video"}),f=e.state.tr.insert(s.pos,d);e.dispatch(f)},c.readAsDataURL(a)}),!0):!1}}}),Ek=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Ak=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,Tk=pe.create({name:"resizableMedia",addOptions(){return{HTMLAttributes:{class:"rounded-lg border border-stone-200"},uploadFn:async()=>""}},inline:!1,group:"block",draggable:!0,addAttributes(){return{src:{default:null},"media-type":{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},dataAlign:{default:"left"},dataFloat:{default:null}}},selectable:!0,parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:n=>({src:n.getAttribute("src"),"media-type":"img"})},{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),"media-type":"video"})}]},renderHTML({HTMLAttributes:n}){const{"media-type":e}=n;return e==="img"?["img",ee(this.options.HTMLAttributes,n)]:e==="video"?["video",{controls:"true",style:"width: 100%",...n},["source",n]]:(e||console.error("TiptapMediaExtension-renderHTML method: Media Type not set, going default with image"),["img",ee(this.options.HTMLAttributes,n)])},addCommands(){return{setMedia:n=>({commands:e})=>{const{"media-type":t}=n;return t==="img"?e.insertContent({type:this.name,attrs:n}):t==="video"?e.insertContent({type:this.name,attrs:{...n,controls:"true"}}):(t||console.error("TiptapMediaExtension-setMedia: Media Type not set, going default with image"),e.insertContent({type:this.name,attrs:n}))}}},addNodeView(){return cr(bp)},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{selection:e}=n.state;if(e.empty)return!1;const t=e.$to.pos;return n.commands.insertContentAt(t,{type:"dBlock",content:[{type:"paragraph"}]})}}},addInputRules(){return[ga({find:Ek,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r,"media-type":"img"}}}),ga({find:Ak,type:this.type,getAttributes:n=>{const[,,e]=n;return{src:e,"media-type":"video"}}})]},addProseMirrorPlugins(){return[Sk(this.options.uploadFn),tk()]}});function xp(n,e){let t;return(...o)=>{clearTimeout(t),t=setTimeout(()=>n(...o),e)}}function Ae(){return Ae=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ae.apply(null,arguments)}function Hn(n,e,{checkForDefaultPrevented:t=!0}={}){return function(o){if(n==null||n(o),t===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}function Mk(n,e){typeof n=="function"?n(e):n!=null&&(n.current=e)}function kp(...n){return e=>n.forEach(t=>Mk(t,e))}function hr(...n){return b.useCallback(kp(...n),n)}function Cp(n,e=[]){let t=[];function r(i,s){const l=b.createContext(s),a=t.length;t=[...t,s];function c(d){const{scope:f,children:h,...p}=d,m=(f==null?void 0:f[n][a])||l,g=b.useMemo(()=>p,Object.values(p));return b.createElement(m.Provider,{value:g},h)}function u(d,f){const h=(f==null?void 0:f[n][a])||l,p=b.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=t.map(s=>b.createContext(s));return function(l){const a=(l==null?void 0:l[n])||i;return b.useMemo(()=>({[`__scope${n}`]:{...l,[n]:a}}),[l,a])}};return o.scopeName=n,[r,Ok(o,...e)]}function Ok(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(i)[`__scope${c}`];return{...l,...d}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return t.scopeName=e.scopeName,t}const sc=b.forwardRef((n,e)=>{const{children:t,...r}=n,o=b.Children.toArray(t),i=o.find(Dk);if(i){const s=i.props.children,l=o.map(a=>a===i?b.Children.count(s)>1?b.Children.only(null):b.isValidElement(s)?s.props.children:null:a);return b.createElement(lc,Ae({},r,{ref:e}),b.isValidElement(s)?b.cloneElement(s,void 0,l):null)}return b.createElement(lc,Ae({},r,{ref:e}),t)});sc.displayName="Slot";const lc=b.forwardRef((n,e)=>{const{children:t,...r}=n;return b.isValidElement(t)?b.cloneElement(t,{...Lk(r,t.props),ref:e?kp(e,t.ref):t.ref}):b.Children.count(t)>1?b.Children.only(null):null});lc.displayName="SlotClone";const Nk=({children:n})=>b.createElement(b.Fragment,null,n);function Dk(n){return b.isValidElement(n)&&n.type===Nk}function Lk(n,e){const t={...e};for(const r in e){const o=n[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?t[r]=(...l)=>{i(...l),o(...l)}:o&&(t[r]=o):r==="style"?t[r]={...o,...i}:r==="className"&&(t[r]=[o,i].filter(Boolean).join(" "))}return{...n,...t}}const pr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((n,e)=>{const t=b.forwardRef((r,o)=>{const{asChild:i,...s}=r,l=i?sc:e;return b.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),b.createElement(l,Ae({},s,{ref:o}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function Pk(n,e){n&&vt.flushSync(()=>n.dispatchEvent(e))}function jn(n){const e=b.useRef(n);return b.useEffect(()=>{e.current=n}),b.useMemo(()=>(...t)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...t)},[])}function Rk(n,e=globalThis==null?void 0:globalThis.document){const t=jn(n);b.useEffect(()=>{const r=o=>{o.key==="Escape"&&t(o)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[t,e])}const ac="dismissableLayer.update",Ik="dismissableLayer.pointerDownOutside",Fk="dismissableLayer.focusOutside";let Sp;const $k=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bk=b.forwardRef((n,e)=>{var t;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:a,...c}=n,u=b.useContext($k),[d,f]=b.useState(null),h=(t=d==null?void 0:d.ownerDocument)!==null&&t!==void 0?t:globalThis==null?void 0:globalThis.document,[,p]=b.useState({}),m=hr(e,D=>f(D)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),k=g.indexOf(y),C=d?g.indexOf(d):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,E=C>=k,S=Hk(D=>{const A=D.target,P=[...u.branches].some(H=>H.contains(A));!E||P||(i==null||i(D),l==null||l(D),D.defaultPrevented||a==null||a())},h),O=jk(D=>{const A=D.target;[...u.branches].some(H=>H.contains(A))||(s==null||s(D),l==null||l(D),D.defaultPrevented||a==null||a())},h);return Rk(D=>{C===u.layers.size-1&&(o==null||o(D),!D.defaultPrevented&&a&&(D.preventDefault(),a()))},h),b.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Sp=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ep(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Sp)}},[d,h,r,u]),b.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ep())},[d,u]),b.useEffect(()=>{const D=()=>p({});return document.addEventListener(ac,D),()=>document.removeEventListener(ac,D)},[]),b.createElement(pr.div,Ae({},c,{ref:m,style:{pointerEvents:v?E?"auto":"none":void 0,...n.style},onFocusCapture:Hn(n.onFocusCapture,O.onFocusCapture),onBlurCapture:Hn(n.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Hn(n.onPointerDownCapture,S.onPointerDownCapture)}))});function Hk(n,e=globalThis==null?void 0:globalThis.document){const t=jn(n),r=b.useRef(!1),o=b.useRef(()=>{});return b.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){Ap(Ik,t,a,{discrete:!0})};const a={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=c,e.addEventListener("click",o.current,{once:!0})):c()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,t]),{onPointerDownCapture:()=>r.current=!0}}function jk(n,e=globalThis==null?void 0:globalThis.document){const t=jn(n),r=b.useRef(!1);return b.useEffect(()=>{const o=i=>{i.target&&!r.current&&Ap(Fk,t,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ep(){const n=new CustomEvent(ac);document.dispatchEvent(n)}function Ap(n,e,t,{discrete:r}){const o=t.originalEvent.target,i=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&o.addEventListener(n,e,{once:!0}),r?Pk(o,i):o.dispatchEvent(i)}let cc=0;function zk(){b.useEffect(()=>{var n,e;const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(n=t[0])!==null&&n!==void 0?n:Tp()),document.body.insertAdjacentElement("beforeend",(e=t[1])!==null&&e!==void 0?e:Tp()),cc++,()=>{cc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),cc--}},[])}function Tp(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",n}const uc="focusScope.autoFocusOnMount",dc="focusScope.autoFocusOnUnmount",Mp={bubbles:!1,cancelable:!0},Vk=b.forwardRef((n,e)=>{const{loop:t=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=n,[l,a]=b.useState(null),c=jn(o),u=jn(i),d=b.useRef(null),f=hr(e,m=>a(m)),h=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let m=function(C){if(h.paused||!l)return;const v=C.target;l.contains(v)?d.current=v:zn(d.current,{select:!0})},g=function(C){if(h.paused||!l)return;const v=C.relatedTarget;v!==null&&(l.contains(v)||zn(d.current,{select:!0}))},y=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&zn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const k=new MutationObserver(y);return l&&k.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),k.disconnect()}}},[r,l,h.paused]),b.useEffect(()=>{if(l){Dp.add(h);const m=document.activeElement;if(!l.contains(m)){const y=new CustomEvent(uc,Mp);l.addEventListener(uc,c),l.dispatchEvent(y),y.defaultPrevented||(_k(Jk(Op(l)),{select:!0}),document.activeElement===m&&zn(l))}return()=>{l.removeEventListener(uc,c),setTimeout(()=>{const y=new CustomEvent(dc,Mp);l.addEventListener(dc,u),l.dispatchEvent(y),y.defaultPrevented||zn(m??document.body,{select:!0}),l.removeEventListener(dc,u),Dp.remove(h)},0)}}},[l,c,u,h]);const p=b.useCallback(m=>{if(!t&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){const k=m.currentTarget,[C,v]=Wk(k);C&&v?!m.shiftKey&&y===v?(m.preventDefault(),t&&zn(C,{select:!0})):m.shiftKey&&y===C&&(m.preventDefault(),t&&zn(v,{select:!0})):y===k&&m.preventDefault()}},[t,r,h.paused]);return b.createElement(pr.div,Ae({tabIndex:-1},s,{ref:f,onKeyDown:p}))});function _k(n,{select:e=!1}={}){const t=document.activeElement;for(const r of n)if(zn(r,{select:e}),document.activeElement!==t)return}function Wk(n){const e=Op(n),t=Np(e,n),r=Np(e.reverse(),n);return[t,r]}function Op(n){const e=[],t=document.createTreeWalker(n,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(;t.nextNode();)e.push(t.currentNode);return e}function Np(n,e){for(const t of n)if(!qk(t,{upTo:e}))return t}function qk(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function Uk(n){return n instanceof HTMLInputElement&&"select"in n}function zn(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&Uk(n)&&e&&n.select()}}const Dp=Kk();function Kk(){let n=[];return{add(e){const t=n[0];e!==t&&(t==null||t.pause()),n=Lp(n,e),n.unshift(e)},remove(e){var t;n=Lp(n,e),(t=n[0])===null||t===void 0||t.resume()}}}function Lp(n,e){const t=[...n],r=t.indexOf(e);return r!==-1&&t.splice(r,1),t}function Jk(n){return n.filter(e=>e.tagName!=="A")}const Zr=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},Zk=q.useId||(()=>{});let Gk=0;function Yk(n){const[e,t]=q.useState(Zk());return Zr(()=>{n||t(r=>r??String(Gk++))},[n]),n||(e?`radix-${e}`:"")}const Xk=["top","right","bottom","left"],Jt=Math.min,dt=Math.max,Bs=Math.round,Hs=Math.floor,Vn=n=>({x:n,y:n}),Qk={left:"right",right:"left",bottom:"top",top:"bottom"},eC={start:"end",end:"start"};function fc(n,e,t){return dt(n,Jt(e,t))}function un(n,e){return typeof n=="function"?n(e):n}function dn(n){return n.split("-")[0]}function Gr(n){return n.split("-")[1]}function hc(n){return n==="x"?"y":"x"}function pc(n){return n==="y"?"height":"width"}function Yr(n){return["top","bottom"].includes(dn(n))?"y":"x"}function mc(n){return hc(Yr(n))}function tC(n,e,t){t===void 0&&(t=!1);const r=Gr(n),o=mc(n),i=pc(o);let s=o==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=js(s)),[s,js(s)]}function nC(n){const e=js(n);return[gc(n),e,gc(e)]}function gc(n){return n.replace(/start|end/g,e=>eC[e])}function rC(n,e,t){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(n){case"top":case"bottom":return t?e?o:r:e?r:o;case"left":case"right":return e?i:s;default:return[]}}function oC(n,e,t,r){const o=Gr(n);let i=rC(dn(n),t==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(gc)))),i}function js(n){return n.replace(/left|right|bottom|top/g,e=>Qk[e])}function iC(n){return{top:0,right:0,bottom:0,left:0,...n}}function Pp(n){return typeof n!="number"?iC(n):{top:n,right:n,bottom:n,left:n}}function zs(n){const{x:e,y:t,width:r,height:o}=n;return{width:r,height:o,top:t,left:e,right:e+r,bottom:t+o,x:e,y:t}}function Rp(n,e,t){let{reference:r,floating:o}=n;const i=Yr(e),s=mc(e),l=pc(s),a=dn(e),c=i==="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(Gr(e)){case"start":h[s]-=f*(t&&c?-1:1);break;case"end":h[s]+=f*(t&&c?-1:1);break}return h}const sC=async(n,e,t)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=t,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:n,floating:e,strategy:o}),{x:u,y:d}=Rp(c,r,a),f=r,h={},p=0;for(let m=0;m<l.length;m++){const{name:g,fn:y}=l[m],{x:k,y:C,data:v,reset:E}=await y({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:n,floating:e}});u=k??u,d=C??d,h={...h,[g]:{...h[g],...v}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:o}):E.rects),{x:u,y:d}=Rp(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function Qo(n,e){var t;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=un(e,n),p=Pp(h),g=l[f?d==="floating"?"reference":"floating":d],y=zs(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(g)))==null||t?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),k=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),v=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},E=zs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:C,strategy:a}):k);return{top:(y.top-E.top+p.top)/v.y,bottom:(E.bottom-y.bottom+p.bottom)/v.y,left:(y.left-E.left+p.left)/v.x,right:(E.right-y.right+p.right)/v.x}}const lC=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=un(n,e)||{};if(c==null)return{};const d=Pp(u),f={x:t,y:r},h=mc(o),p=pc(h),m=await s.getDimensions(c),g=h==="y",y=g?"top":"left",k=g?"bottom":"right",C=g?"clientHeight":"clientWidth",v=i.reference[p]+i.reference[h]-f[h]-i.floating[p],E=f[h]-i.reference[h],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let O=S?S[C]:0;(!O||!await(s.isElement==null?void 0:s.isElement(S)))&&(O=l.floating[C]||i.floating[p]);const D=v/2-E/2,A=O/2-m[p]/2-1,P=Jt(d[y],A),H=Jt(d[k],A),N=P,$=O-m[p]-H,R=O/2-m[p]/2+D,I=fc(N,R,$),U=!a.arrow&&Gr(o)!=null&&R!==I&&i.reference[p]/2-(R<N?P:H)-m[p]/2<0,z=U?R<N?R-N:R-$:0;return{[h]:f[h]+z,data:{[h]:I,centerOffset:R-I-z,...U&&{alignmentOffset:z}},reset:U}}}),aC=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:o,middlewareData:i,rects:s,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}=un(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const y=dn(o),k=dn(l)===l,C=await(a.isRTL==null?void 0:a.isRTL(c.floating)),v=f||(k||!m?[js(l)]:nC(l));!f&&p!=="none"&&v.push(...oC(l,m,p,C));const E=[l,...v],S=await Qo(e,g),O=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&O.push(S[y]),d){const N=tC(o,s,C);O.push(S[N[0]],S[N[1]])}if(D=[...D,{placement:o,overflows:O}],!O.every(N=>N<=0)){var A,P;const N=(((A=i.flip)==null?void 0:A.index)||0)+1,$=E[N];if($)return{data:{index:N,overflows:D},reset:{placement:$}};let R=(P=D.filter(I=>I.overflows[0]<=0).sort((I,U)=>I.overflows[1]-U.overflows[1])[0])==null?void 0:P.placement;if(!R)switch(h){case"bestFit":{var H;const I=(H=D.map(U=>[U.placement,U.overflows.filter(z=>z>0).reduce((z,G)=>z+G,0)]).sort((U,z)=>U[1]-z[1])[0])==null?void 0:H[0];I&&(R=I);break}case"initialPlacement":R=l;break}if(o!==R)return{reset:{placement:R}}}return{}}}};function Ip(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Fp(n){return Xk.some(e=>n[e]>=0)}const cC=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...o}=un(n,e);switch(r){case"referenceHidden":{const i=await Qo(e,{...o,elementContext:"reference"}),s=Ip(i,t.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Fp(s)}}}case"escaped":{const i=await Qo(e,{...o,altBoundary:!0}),s=Ip(i,t.floating);return{data:{escapedOffsets:s,escaped:Fp(s)}}}default:return{}}}}};async function uC(n,e){const{placement:t,platform:r,elements:o}=n,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=dn(t),l=Gr(t),a=Yr(t)==="y",c=["left","top"].includes(s)?-1:1,u=i&&a?-1:1,d=un(e,n);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};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 dC=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await uC(e,n);return s===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},fC=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:g=>{let{x:y,y:k}=g;return{x:y,y:k}}},...a}=un(n,e),c={x:t,y:r},u=await Qo(e,a),d=Yr(dn(o)),f=hc(d);let h=c[f],p=c[d];if(i){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",k=h+u[g],C=h-u[y];h=fc(k,h,C)}if(s){const g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",k=p+u[g],C=p-u[y];p=fc(k,p,C)}const m=l.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-t,y:m.y-r}}}}},hC=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=un(n,e),u={x:t,y:r},d=Yr(o),f=hc(d);let h=u[f],p=u[d];const m=un(l,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const C=f==="y"?"height":"width",v=i.reference[f]-i.floating[C]+g.mainAxis,E=i.reference[f]+i.reference[C]-g.mainAxis;h<v?h=v:h>E&&(h=E)}if(c){var y,k;const C=f==="y"?"width":"height",v=["top","left"].includes(dn(o)),E=i.reference[d]-i.floating[C]+(v&&((y=s.offset)==null?void 0:y[d])||0)+(v?0:g.crossAxis),S=i.reference[d]+i.reference[C]+(v?0:((k=s.offset)==null?void 0:k[d])||0)-(v?g.crossAxis:0);p<E?p=E:p>S&&(p=S)}return{[f]:h,[d]:p}}}},pC=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:o,elements:i}=e,{apply:s=()=>{},...l}=un(n,e),a=await Qo(e,l),c=dn(t),u=Gr(t),d=Yr(t)==="y",{width:f,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");const g=h-a.top-a.bottom,y=f-a.left-a.right,k=Jt(h-a[p],g),C=Jt(f-a[m],y),v=!e.middlewareData.shift;let E=k,S=C;if(d?S=u||v?Jt(C,y):y:E=u||v?Jt(k,g):g,v&&!u){const D=dt(a.left,0),A=dt(a.right,0),P=dt(a.top,0),H=dt(a.bottom,0);d?S=f-2*(D!==0||A!==0?D+A:dt(a.left,a.right)):E=h-2*(P!==0||H!==0?P+H:dt(a.top,a.bottom))}await s({...e,availableWidth:S,availableHeight:E});const O=await o.getDimensions(i.floating);return f!==O.width||h!==O.height?{reset:{rects:!0}}:{}}}};function Xr(n){return $p(n)?(n.nodeName||"").toLowerCase():"#document"}function ft(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function fn(n){var e;return(e=($p(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function $p(n){return n instanceof Node||n instanceof ft(n).Node}function Zt(n){return n instanceof Element||n instanceof ft(n).Element}function Gt(n){return n instanceof HTMLElement||n instanceof ft(n).HTMLElement}function Bp(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ft(n).ShadowRoot}function ei(n){const{overflow:e,overflowX:t,overflowY:r,display:o}=Lt(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(o)}function mC(n){return["table","td","th"].includes(Xr(n))}function yc(n){const e=vc(),t=Lt(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function gC(n){let e=_n(n);for(;Gt(e)&&!Qr(e);){if(yc(e))return e;e=_n(e)}return null}function vc(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Qr(n){return["html","body","#document"].includes(Xr(n))}function Lt(n){return ft(n).getComputedStyle(n)}function Vs(n){return Zt(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function _n(n){if(Xr(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Bp(n)&&n.host||fn(n);return Bp(e)?e.host:e}function Hp(n){const e=_n(n);return Qr(e)?n.ownerDocument?n.ownerDocument.body:n.body:Gt(e)&&ei(e)?e:Hp(e)}function ti(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const o=Hp(n),i=o===((r=n.ownerDocument)==null?void 0:r.body),s=ft(o);return i?e.concat(s,s.visualViewport||[],ei(o)?o:[],s.frameElement&&t?ti(s.frameElement):[]):e.concat(o,ti(o,[],t))}function jp(n){const e=Lt(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Gt(n),i=o?n.offsetWidth:t,s=o?n.offsetHeight:r,l=Bs(t)!==i||Bs(r)!==s;return l&&(t=i,r=s),{width:t,height:r,$:l}}function bc(n){return Zt(n)?n:n.contextElement}function eo(n){const e=bc(n);if(!Gt(e))return Vn(1);const t=e.getBoundingClientRect(),{width:r,height:o,$:i}=jp(e);let s=(i?Bs(t.width):t.width)/r,l=(i?Bs(t.height):t.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const yC=Vn(0);function zp(n){const e=ft(n);return!vc()||!e.visualViewport?yC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vC(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==ft(n)?!1:e}function mr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const o=n.getBoundingClientRect(),i=bc(n);let s=Vn(1);e&&(r?Zt(r)&&(s=eo(r)):s=eo(n));const l=vC(i,t,r)?zp(i):Vn(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=ft(i),h=r&&Zt(r)?ft(r):r;let p=f,m=p.frameElement;for(;m&&r&&h!==p;){const g=eo(m),y=m.getBoundingClientRect(),k=Lt(m),C=y.left+(m.clientLeft+parseFloat(k.paddingLeft))*g.x,v=y.top+(m.clientTop+parseFloat(k.paddingTop))*g.y;a*=g.x,c*=g.y,u*=g.x,d*=g.y,a+=C,c+=v,p=ft(m),m=p.frameElement}}return zs({width:u,height:d,x:a,y:c})}const bC=[":popover-open",":modal"];function wc(n){return bC.some(e=>{try{return n.matches(e)}catch{return!1}})}function wC(n){let{elements:e,rect:t,offsetParent:r,strategy:o}=n;const i=o==="fixed",s=fn(r),l=e?wc(e.floating):!1;if(r===s||l&&i)return t;let a={scrollLeft:0,scrollTop:0},c=Vn(1);const u=Vn(0),d=Gt(r);if((d||!d&&!i)&&((Xr(r)!=="body"||ei(s))&&(a=Vs(r)),Gt(r))){const f=mr(r);c=eo(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+u.x,y:t.y*c.y-a.scrollTop*c.y+u.y}}function xC(n){return Array.from(n.getClientRects())}function Vp(n){return mr(fn(n)).left+Vs(n).scrollLeft}function kC(n){const e=fn(n),t=Vs(n),r=n.ownerDocument.body,o=dt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=dt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-t.scrollLeft+Vp(n);const l=-t.scrollTop;return Lt(r).direction==="rtl"&&(s+=dt(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function CC(n,e){const t=ft(n),r=fn(n),o=t.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const c=vc();(!c||c&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:i,height:s,x:l,y:a}}function SC(n,e){const t=mr(n,!0,e==="fixed"),r=t.top+n.clientTop,o=t.left+n.clientLeft,i=Gt(n)?eo(n):Vn(1),s=n.clientWidth*i.x,l=n.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function _p(n,e,t){let r;if(e==="viewport")r=CC(n,t);else if(e==="document")r=kC(fn(n));else if(Zt(e))r=SC(e,t);else{const o=zp(n);r={...e,x:e.x-o.x,y:e.y-o.y}}return zs(r)}function Wp(n,e){const t=_n(n);return t===e||!Zt(t)||Qr(t)?!1:Lt(t).position==="fixed"||Wp(t,e)}function EC(n,e){const t=e.get(n);if(t)return t;let r=ti(n,[],!1).filter(l=>Zt(l)&&Xr(l)!=="body"),o=null;const i=Lt(n).position==="fixed";let s=i?_n(n):n;for(;Zt(s)&&!Qr(s);){const l=Lt(s),a=yc(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ei(s)&&!a&&Wp(n,s))?r=r.filter(u=>u!==s):o=l,s=_n(s)}return e.set(n,r),r}function AC(n){let{element:e,boundary:t,rootBoundary:r,strategy:o}=n;const s=[...t==="clippingAncestors"?wc(e)?[]:EC(e,this._c):[].concat(t),r],l=s[0],a=s.reduce((c,u)=>{const d=_p(e,u,o);return c.top=dt(d.top,c.top),c.right=Jt(d.right,c.right),c.bottom=Jt(d.bottom,c.bottom),c.left=dt(d.left,c.left),c},_p(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function TC(n){const{width:e,height:t}=jp(n);return{width:e,height:t}}function MC(n,e,t){const r=Gt(e),o=fn(e),i=t==="fixed",s=mr(n,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=Vn(0);if(r||!r&&!i)if((Xr(e)!=="body"||ei(o))&&(l=Vs(e)),r){const d=mr(e,!0,i,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else o&&(a.x=Vp(o));const c=s.left+l.scrollLeft-a.x,u=s.top+l.scrollTop-a.y;return{x:c,y:u,width:s.width,height:s.height}}function xc(n){return Lt(n).position==="static"}function qp(n,e){return!Gt(n)||Lt(n).position==="fixed"?null:e?e(n):n.offsetParent}function Up(n,e){const t=ft(n);if(wc(n))return t;if(!Gt(n)){let o=_n(n);for(;o&&!Qr(o);){if(Zt(o)&&!xc(o))return o;o=_n(o)}return t}let r=qp(n,e);for(;r&&mC(r)&&xc(r);)r=qp(r,e);return r&&Qr(r)&&xc(r)&&!yc(r)?t:r||gC(n)||t}const OC=async function(n){const e=this.getOffsetParent||Up,t=this.getDimensions,r=await t(n.floating);return{reference:MC(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NC(n){return Lt(n).direction==="rtl"}const DC={convertOffsetParentRelativeRectToViewportRelativeRect:wC,getDocumentElement:fn,getClippingRect:AC,getOffsetParent:Up,getElementRects:OC,getClientRects:xC,getDimensions:TC,getScale:eo,isElement:Zt,isRTL:NC};function LC(n,e){let t=null,r;const o=fn(n);function i(){var l;clearTimeout(r),(l=t)==null||l.disconnect(),t=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const{left:c,top:u,width:d,height:f}=n.getBoundingClientRect();if(l||e(),!d||!f)return;const h=Hs(u),p=Hs(o.clientWidth-(c+d)),m=Hs(o.clientHeight-(u+f)),g=Hs(c),k={rootMargin:-h+"px "+-p+"px "+-m+"px "+-g+"px",threshold:dt(0,Jt(1,a))||1};let C=!0;function v(E){const S=E[0].intersectionRatio;if(S!==a){if(!C)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}C=!1}try{t=new IntersectionObserver(v,{...k,root:o.ownerDocument})}catch{t=new IntersectionObserver(v,k)}t.observe(n)}return s(!0),i}function PC(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=bc(n),u=o||i?[...c?ti(c):[],...ti(e)]:[];u.forEach(y=>{o&&y.addEventListener("scroll",t,{passive:!0}),i&&y.addEventListener("resize",t)});const d=c&&l?LC(c,t):null;let f=-1,h=null;s&&(h=new ResizeObserver(y=>{let[k]=y;k&&k.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=h)==null||C.observe(e)})),t()}),c&&!a&&h.observe(c),h.observe(e));let p,m=a?mr(n):null;a&&g();function g(){const y=mr(n);m&&(y.x!==m.x||y.y!==m.y||y.width!==m.width||y.height!==m.height)&&t(),m=y,p=requestAnimationFrame(g)}return t(),()=>{var y;u.forEach(k=>{o&&k.removeEventListener("scroll",t),i&&k.removeEventListener("resize",t)}),d==null||d(),(y=h)==null||y.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const RC=dC,IC=fC,FC=aC,$C=pC,BC=cC,Kp=lC,HC=hC,jC=(n,e,t)=>{const r=new Map,o={platform:DC,...t},i={...o.platform,_c:r};return sC(n,e,{...o,platform:i})};var _s=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Ws(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,o;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Ws(n[r],e[r]))return!1;return!0}if(o=Object.keys(n),t=o.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=t;r--!==0;){const i=o[r];if(!(i==="_owner"&&n.$$typeof)&&!Ws(n[i],e[i]))return!1}return!0}return n!==n&&e!==e}function Jp(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Zp(n,e){const t=Jp(n);return Math.round(e*t)/t}function Gp(n){const e=q.useRef(n);return _s(()=>{e.current=n}),e}function zC(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=n,[u,d]=q.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=q.useState(r);Ws(f,r)||h(r);const[p,m]=q.useState(null),[g,y]=q.useState(null),k=q.useCallback(z=>{z!==S.current&&(S.current=z,m(z))},[]),C=q.useCallback(z=>{z!==O.current&&(O.current=z,y(z))},[]),v=i||p,E=s||g,S=q.useRef(null),O=q.useRef(null),D=q.useRef(u),A=a!=null,P=Gp(a),H=Gp(o),N=q.useCallback(()=>{if(!S.current||!O.current)return;const z={placement:e,strategy:t,middleware:f};H.current&&(z.platform=H.current),jC(S.current,O.current,z).then(G=>{const se={...G,isPositioned:!0};$.current&&!Ws(D.current,se)&&(D.current=se,gg.flushSync(()=>{d(se)}))})},[f,e,t,H]);_s(()=>{c===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,d(z=>({...z,isPositioned:!1})))},[c]);const $=q.useRef(!1);_s(()=>($.current=!0,()=>{$.current=!1}),[]),_s(()=>{if(v&&(S.current=v),E&&(O.current=E),v&&E){if(P.current)return P.current(v,E,N);N()}},[v,E,N,P,A]);const R=q.useMemo(()=>({reference:S,floating:O,setReference:k,setFloating:C}),[k,C]),I=q.useMemo(()=>({reference:v,floating:E}),[v,E]),U=q.useMemo(()=>{const z={position:t,left:0,top:0};if(!I.floating)return z;const G=Zp(I.floating,u.x),se=Zp(I.floating,u.y);return l?{...z,transform:"translate("+G+"px, "+se+"px)",...Jp(I.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:G,top:se}},[t,l,I.floating,u.x,u.y]);return q.useMemo(()=>({...u,update:N,refs:R,elements:I,floatingStyles:U}),[u,N,R,I,U])}const VC=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:o}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?Kp({element:r.current,padding:o}).fn(t):{}:r?Kp({element:r,padding:o}).fn(t):{}}}},_C=(n,e)=>({...RC(n),options:[n,e]}),WC=(n,e)=>({...IC(n),options:[n,e]}),qC=(n,e)=>({...HC(n),options:[n,e]}),UC=(n,e)=>({...FC(n),options:[n,e]}),KC=(n,e)=>({...$C(n),options:[n,e]}),JC=(n,e)=>({...BC(n),options:[n,e]}),ZC=(n,e)=>({...VC(n),options:[n,e]}),GC=b.forwardRef((n,e)=>{const{children:t,width:r=10,height:o=5,...i}=n;return b.createElement(pr.svg,Ae({},i,{ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),n.asChild?t:b.createElement("polygon",{points:"0,0 30,0 15,10"}))});function YC(n){const[e,t]=b.useState(void 0);return Zr(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=n.offsetWidth,l=n.offsetHeight;t({width:s,height:l})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}const Yp="Popper",[Xp,Qp]=Cp(Yp),[XC,em]=Xp(Yp),QC=n=>{const{__scopePopper:e,children:t}=n,[r,o]=b.useState(null);return b.createElement(XC,{scope:e,anchor:r,onAnchorChange:o},t)},eS="PopperAnchor",tS=b.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...o}=n,i=em(eS,t),s=b.useRef(null),l=hr(e,s);return b.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:b.createElement(pr.div,Ae({},o,{ref:l}))}),tm="PopperContent",[nS,rS]=Xp(tm),oS=b.forwardRef((n,e)=>{var t,r,o,i,s,l,a,c;const{__scopePopper:u,side:d="bottom",sideOffset:f=0,align:h="center",alignOffset:p=0,arrowPadding:m=0,avoidCollisions:g=!0,collisionBoundary:y=[],collisionPadding:k=0,sticky:C="partial",hideWhenDetached:v=!1,updatePositionStrategy:E="optimized",onPlaced:S,...O}=n,D=em(tm,u),[A,P]=b.useState(null),H=hr(e,Ge=>P(Ge)),[N,$]=b.useState(null),R=YC(N),I=(t=R==null?void 0:R.width)!==null&&t!==void 0?t:0,U=(r=R==null?void 0:R.height)!==null&&r!==void 0?r:0,z=d+(h!=="center"?"-"+h:""),G=typeof k=="number"?k:{top:0,right:0,bottom:0,left:0,...k},se=Array.isArray(y)?y:[y],le=se.length>0,He={padding:G,boundary:se.filter(lS),altBoundary:le},{refs:Te,floatingStyles:ht,placement:pt,isPositioned:Re,middlewareData:Se}=zC({strategy:"fixed",placement:z,whileElementsMounted:(...Ge)=>PC(...Ge,{animationFrame:E==="always"}),elements:{reference:D.anchor},middleware:[_C({mainAxis:f+U,alignmentAxis:p}),g&&WC({mainAxis:!0,crossAxis:!1,limiter:C==="partial"?qC():void 0,...He}),g&&UC({...He}),KC({...He,apply:({elements:Ge,rects:st,availableWidth:en,availableHeight:mn})=>{const{width:Rt,height:gt}=st.reference,Ye=Ge.floating.style;Ye.setProperty("--radix-popper-available-width",`${en}px`),Ye.setProperty("--radix-popper-available-height",`${mn}px`),Ye.setProperty("--radix-popper-anchor-width",`${Rt}px`),Ye.setProperty("--radix-popper-anchor-height",`${gt}px`)}}),N&&ZC({element:N,padding:m}),aS({arrowWidth:I,arrowHeight:U}),v&&JC({strategy:"referenceHidden",...He})]}),[mt,_e]=rm(pt),Je=jn(S);Zr(()=>{Re&&(Je==null||Je())},[Re,Je]);const Ze=(o=Se.arrow)===null||o===void 0?void 0:o.x,Qt=(i=Se.arrow)===null||i===void 0?void 0:i.y,hn=((s=Se.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[pn,qn]=b.useState();return Zr(()=>{A&&qn(window.getComputedStyle(A).zIndex)},[A]),b.createElement("div",{ref:Te.setFloating,"data-radix-popper-content-wrapper":"",style:{...ht,transform:Re?ht.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:pn,"--radix-popper-transform-origin":[(l=Se.transformOrigin)===null||l===void 0?void 0:l.x,(a=Se.transformOrigin)===null||a===void 0?void 0:a.y].join(" ")},dir:n.dir},b.createElement(nS,{scope:u,placedSide:mt,onArrowChange:$,arrowX:Ze,arrowY:Qt,shouldHideArrow:hn},b.createElement(pr.div,Ae({"data-side":mt,"data-align":_e},O,{ref:H,style:{...O.style,animation:Re?void 0:"none",opacity:(c=Se.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))}),nm="PopperArrow",iS={top:"bottom",right:"left",bottom:"top",left:"right"},sS=b.forwardRef(function(e,t){const{__scopePopper:r,...o}=e,i=rS(nm,r),s=iS[i.placedSide];return b.createElement("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0}},b.createElement(GC,Ae({},o,{ref:t,style:{...o.style,display:"block"}})))});function lS(n){return n!==null}const aS=n=>({name:"transformOrigin",options:n,fn(e){var t,r,o,i,s;const{placement:l,rects:a,middlewareData:c}=e,d=((t=c.arrow)===null||t===void 0?void 0:t.centerOffset)!==0,f=d?0:n.arrowWidth,h=d?0:n.arrowHeight,[p,m]=rm(l),g={start:"0%",center:"50%",end:"100%"}[m],y=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+f/2,k=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+h/2;let C="",v="";return p==="bottom"?(C=d?g:`${y}px`,v=`${-h}px`):p==="top"?(C=d?g:`${y}px`,v=`${a.floating.height+h}px`):p==="right"?(C=`${-h}px`,v=d?g:`${k}px`):p==="left"&&(C=`${a.floating.width+h}px`,v=d?g:`${k}px`),{data:{x:C,y:v}}}});function rm(n){const[e,t="center"]=n.split("-");return[e,t]}const cS=QC,uS=tS,dS=oS;function fS(n,e){return b.useReducer((t,r)=>{const o=e[t][r];return o??t},n)}const om=n=>{const{present:e,children:t}=n,r=hS(e),o=typeof t=="function"?t({present:r.isPresent}):b.Children.only(t),i=hr(r.ref,o.ref);return typeof t=="function"||r.isPresent?b.cloneElement(o,{ref:i}):null};om.displayName="Presence";function hS(n){const[e,t]=b.useState(),r=b.useRef({}),o=b.useRef(n),i=b.useRef("none"),s=n?"mounted":"unmounted",[l,a]=fS(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=qs(r.current);i.current=l==="mounted"?c:"none"},[l]),Zr(()=>{const c=r.current,u=o.current;if(u!==n){const f=i.current,h=qs(c);n?a("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=n}},[n,a]),Zr(()=>{if(e){const c=d=>{const h=qs(r.current).includes(d.animationName);d.target===e&&h&&vt.flushSync(()=>a("ANIMATION_END"))},u=d=>{d.target===e&&(i.current=qs(r.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(c=>{c&&(r.current=getComputedStyle(c)),t(c)},[])}}function qs(n){return(n==null?void 0:n.animationName)||"none"}function pS({prop:n,defaultProp:e,onChange:t=()=>{}}){const[r,o]=mS({defaultProp:e,onChange:t}),i=n!==void 0,s=i?n:r,l=jn(t),a=b.useCallback(c=>{if(i){const d=typeof c=="function"?c(n):c;d!==n&&l(d)}else o(c)},[i,n,o,l]);return[s,a]}function mS({defaultProp:n,onChange:e}){const t=b.useState(n),[r]=t,o=b.useRef(r),i=jn(e);return b.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),t}var gS=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},to=new WeakMap,Us=new WeakMap,Ks={},kc=0,im=function(n){return n&&(n.host||im(n.parentNode))},yS=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=im(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},vS=function(n,e,t,r){var o=yS(e,Array.isArray(n)?n:[n]);Ks[t]||(Ks[t]=new WeakMap);var i=Ks[t],s=[],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=(to.get(f)||0)+1,g=(i.get(f)||0)+1;to.set(f,m),i.set(f,g),s.push(f),m===1&&p&&Us.set(f,!0),g===1&&f.setAttribute(t,"true"),p||f.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return u(e),l.clear(),kc++,function(){s.forEach(function(d){var f=to.get(d)-1,h=i.get(d)-1;to.set(d,f),i.set(d,h),f||(Us.has(d)||d.removeAttribute(r),Us.delete(d)),h||d.removeAttribute(t)}),kc--,kc||(to=new WeakMap,to=new WeakMap,Us=new WeakMap,Ks={})}},bS=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),o=gS(n);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),vS(r,o,t,"aria-hidden")):function(){return null}},Yt=function(){return Yt=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Yt.apply(this,arguments)};function sm(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]]);return t}function wS(n,e,t){if(t||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var Js="right-scroll-bar-position",Zs="width-before-scroll-bar",xS="with-scroll-bars-hidden",kS="--removed-body-scroll-bar-size";function Cc(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function CS(n,e){var t=b.useState(function(){return{value:n,callback:e,facade:{get current(){return t.value},set current(r){var o=t.value;o!==r&&(t.value=r,t.callback(r,o))}}}})[0];return t.callback=e,t.facade}var SS=typeof window<"u"?q.useLayoutEffect:q.useEffect,lm=new WeakMap;function ES(n,e){var t=CS(null,function(r){return n.forEach(function(o){return Cc(o,r)})});return SS(function(){var r=lm.get(t);if(r){var o=new Set(r),i=new Set(n),s=t.current;o.forEach(function(l){i.has(l)||Cc(l,null)}),i.forEach(function(l){o.has(l)||Cc(l,s)})}lm.set(t,n)},[n]),t}function AS(n){return n}function TS(n,e){e===void 0&&(e=AS);var t=[],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 t.length?t[t.length-1]:n},useMedium:function(i){var s=e(i,r);return t.push(s),function(){t=t.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;t.length;){var s=t;t=[],s.forEach(i)}t={push:function(l){return i(l)},filter:function(){return t}}},assignMedium:function(i){r=!0;var s=[];if(t.length){var l=t;t=[],l.forEach(i),s=t}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),t={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),t}}}};return o}function MS(n){n===void 0&&(n={});var e=TS(null);return e.options=Yt({async:!0,ssr:!1},n),e}var am=function(n){var e=n.sideCar,t=sm(n,["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 q.createElement(r,Yt({},t))};am.isSideCarExport=!0;function OS(n,e){return n.useMedium(e),am}var cm=MS(),Sc=function(){},Gs=q.forwardRef(function(n,e){var t=q.useRef(null),r=q.useState({onScrollCapture:Sc,onWheelCapture:Sc,onTouchMoveCapture:Sc}),o=r[0],i=r[1],s=n.forwardProps,l=n.children,a=n.className,c=n.removeScrollBar,u=n.enabled,d=n.shards,f=n.sideCar,h=n.noIsolation,p=n.inert,m=n.allowPinchZoom,g=n.as,y=g===void 0?"div":g,k=sm(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),C=f,v=ES([t,e]),E=Yt(Yt({},k),o);return q.createElement(q.Fragment,null,u&&q.createElement(C,{sideCar:cm,removeScrollBar:c,shards:d,noIsolation:h,inert:p,setCallbacks:i,allowPinchZoom:!!m,lockRef:t}),s?q.cloneElement(q.Children.only(l),Yt(Yt({},E),{ref:v})):q.createElement(y,Yt({},E,{className:a,ref:v}),l))});Gs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Gs.classNames={fullWidth:Zs,zeroRight:Js};var NS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function DS(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var e=NS();return e&&n.setAttribute("nonce",e),n}function LS(n,e){n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}function PS(n){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(n)}var RS=function(){var n=0,e=null;return{add:function(t){n==0&&(e=DS())&&(LS(e,t),PS(e)),n++},remove:function(){n--,!n&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},IS=function(){var n=RS();return function(e,t){q.useEffect(function(){return n.add(e),function(){n.remove()}},[e&&t])}},um=function(){var n=IS(),e=function(t){var r=t.styles,o=t.dynamic;return n(r,o),null};return e},FS={left:0,top:0,right:0,gap:0},Ec=function(n){return parseInt(n||"",10)||0},$S=function(n){var e=window.getComputedStyle(document.body),t=e[n==="padding"?"paddingLeft":"marginLeft"],r=e[n==="padding"?"paddingTop":"marginTop"],o=e[n==="padding"?"paddingRight":"marginRight"];return[Ec(t),Ec(r),Ec(o)]},BS=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return FS;var e=$S(n),t=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-t+e[2]-e[0])}},HS=um(),no="data-scroll-locked",jS=function(n,e,t,r){var o=n.left,i=n.top,s=n.right,l=n.gap;return t===void 0&&(t="margin"),`
316
+ .`.concat(xS,` {
317
+ overflow: hidden `).concat(r,`;
318
+ padding-right: `).concat(l,"px ").concat(r,`;
319
+ }
320
+ body[`).concat(no,`] {
321
+ overflow: hidden `).concat(r,`;
322
+ overscroll-behavior: contain;
323
+ `).concat([e&&"position: relative ".concat(r,";"),t==="margin"&&`
324
+ padding-left: `.concat(o,`px;
325
+ padding-top: `).concat(i,`px;
326
+ padding-right: `).concat(s,`px;
327
+ margin-left:0;
328
+ margin-top:0;
329
+ margin-right: `).concat(l,"px ").concat(r,`;
330
+ `),t==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
331
+ }
332
+
333
+ .`).concat(Js,` {
334
+ right: `).concat(l,"px ").concat(r,`;
335
+ }
336
+
337
+ .`).concat(Zs,` {
338
+ margin-right: `).concat(l,"px ").concat(r,`;
339
+ }
340
+
341
+ .`).concat(Js," .").concat(Js,` {
342
+ right: 0 `).concat(r,`;
343
+ }
344
+
345
+ .`).concat(Zs," .").concat(Zs,` {
346
+ margin-right: 0 `).concat(r,`;
347
+ }
348
+
349
+ body[`).concat(no,`] {
350
+ `).concat(kS,": ").concat(l,`px;
351
+ }
352
+ `)},dm=function(){var n=parseInt(document.body.getAttribute(no)||"0",10);return isFinite(n)?n:0},zS=function(){q.useEffect(function(){return document.body.setAttribute(no,(dm()+1).toString()),function(){var n=dm()-1;n<=0?document.body.removeAttribute(no):document.body.setAttribute(no,n.toString())}},[])},VS=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,o=r===void 0?"margin":r;zS();var i=q.useMemo(function(){return BS(o)},[o]);return q.createElement(HS,{styles:jS(i,!e,o,t?"":"!important")})},Ac=!1;if(typeof window<"u")try{var Ys=Object.defineProperty({},"passive",{get:function(){return Ac=!0,!0}});window.addEventListener("test",Ys,Ys),window.removeEventListener("test",Ys,Ys)}catch{Ac=!1}var ro=Ac?{passive:!1}:!1,_S=function(n){return n.tagName==="TEXTAREA"},fm=function(n,e){var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!_S(n)&&t[e]==="visible")},WS=function(n){return fm(n,"overflowY")},qS=function(n){return fm(n,"overflowX")},hm=function(n,e){var t=e;do{typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&(t=t.host);var r=pm(n,t);if(r){var o=mm(n,t),i=o[1],s=o[2];if(i>s)return!0}t=t.parentNode}while(t&&t!==document.body);return!1},US=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},KS=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},pm=function(n,e){return n==="v"?WS(e):qS(e)},mm=function(n,e){return n==="v"?US(e):KS(e)},JS=function(n,e){return n==="h"&&e==="rtl"?-1:1},ZS=function(n,e,t,r,o){var i=JS(n,window.getComputedStyle(e).direction),s=i*r,l=t.target,a=e.contains(l),c=!1,u=s>0,d=0,f=0;do{var h=mm(n,l),p=h[0],m=h[1],g=h[2],y=m-g-i*p;(p||y)&&pm(n,l)&&(d+=y,f+=p),l=l.parentNode}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&(d===0||!o)||!u&&(f===0||!o))&&(c=!0),c},Xs=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},gm=function(n){return[n.deltaX,n.deltaY]},ym=function(n){return n&&"current"in n?n.current:n},GS=function(n,e){return n[0]===e[0]&&n[1]===e[1]},YS=function(n){return`
353
+ .block-interactivity-`.concat(n,` {pointer-events: none;}
354
+ .allow-interactivity-`).concat(n,` {pointer-events: all;}
355
+ `)},XS=0,oo=[];function QS(n){var e=q.useRef([]),t=q.useRef([0,0]),r=q.useRef(),o=q.useState(XS++)[0],i=q.useState(function(){return um()})[0],s=q.useRef(n);q.useEffect(function(){s.current=n},[n]),q.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(o));var m=wS([n.lockRef.current],(n.shards||[]).map(ym),!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))})}}},[n.inert,n.lockRef.current,n.shards]);var l=q.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!s.current.allowPinchZoom;var y=Xs(m),k=t.current,C="deltaX"in m?m.deltaX:k[0]-y[0],v="deltaY"in m?m.deltaY:k[1]-y[1],E,S=m.target,O=Math.abs(C)>Math.abs(v)?"h":"v";if("touches"in m&&O==="h"&&S.type==="range")return!1;var D=hm(O,S);if(!D)return!0;if(D?E=O:(E=O==="v"?"h":"v",D=hm(O,S)),!D)return!1;if(!r.current&&"changedTouches"in m&&(C||v)&&(r.current=E),!E)return!0;var A=r.current||E;return ZS(A,g,m,A==="h"?C:v,!0)},[]),a=q.useCallback(function(m){var g=m;if(!(!oo.length||oo[oo.length-1]!==i)){var y="deltaY"in g?gm(g):Xs(g),k=e.current.filter(function(E){return E.name===g.type&&E.target===g.target&&GS(E.delta,y)})[0];if(k&&k.should){g.cancelable&&g.preventDefault();return}if(!k){var C=(s.current.shards||[]).map(ym).filter(Boolean).filter(function(E){return E.contains(g.target)}),v=C.length>0?l(g,C[0]):!s.current.noIsolation;v&&g.cancelable&&g.preventDefault()}}},[]),c=q.useCallback(function(m,g,y,k){var C={name:m,delta:g,target:y,should:k};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(v){return v!==C})},1)},[]),u=q.useCallback(function(m){t.current=Xs(m),r.current=void 0},[]),d=q.useCallback(function(m){c(m.type,gm(m),m.target,l(m,n.lockRef.current))},[]),f=q.useCallback(function(m){c(m.type,Xs(m),m.target,l(m,n.lockRef.current))},[]);q.useEffect(function(){return oo.push(i),n.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,ro),document.addEventListener("touchmove",a,ro),document.addEventListener("touchstart",u,ro),function(){oo=oo.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,ro),document.removeEventListener("touchmove",a,ro),document.removeEventListener("touchstart",u,ro)}},[]);var h=n.removeScrollBar,p=n.inert;return q.createElement(q.Fragment,null,p?q.createElement(i,{styles:YS(o)}):null,h?q.createElement(VS,{gapMode:"margin"}):null)}const eE=OS(cm,QS);var vm=q.forwardRef(function(n,e){return q.createElement(Gs,Yt({},n,{ref:e,sideCar:eE}))});vm.classNames=Gs.classNames;const bm="Popover",[wm,FT]=Cp(bm,[Qp]),Tc=Qp(),[tE,io]=wm(bm),nE=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=n,l=Tc(e),a=b.useRef(null),[c,u]=b.useState(!1),[d=!1,f]=pS({prop:r,defaultProp:o,onChange:i});return b.createElement(cS,l,b.createElement(tE,{scope:e,contentId:Yk(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>u(!0),[]),onCustomAnchorRemove:b.useCallback(()=>u(!1),[]),modal:s},t))},rE="PopoverTrigger",oE=b.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,o=io(rE,t),i=Tc(t),s=hr(e,o.triggerRef),l=b.createElement(pr.button,Ae({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":km(o.open)},r,{ref:s,onClick:Hn(n.onClick,o.onOpenToggle)}));return o.hasCustomAnchor?l:b.createElement(uS,Ae({asChild:!0},i),l)}),iE="PopoverPortal",[$T,sE]=wm(iE,{forceMount:void 0}),ni="PopoverContent",lE=b.forwardRef((n,e)=>{const t=sE(ni,n.__scopePopover),{forceMount:r=t.forceMount,...o}=n,i=io(ni,n.__scopePopover);return b.createElement(om,{present:r||i.open},i.modal?b.createElement(aE,Ae({},o,{ref:e})):b.createElement(cE,Ae({},o,{ref:e})))}),aE=b.forwardRef((n,e)=>{const t=io(ni,n.__scopePopover),r=b.useRef(null),o=hr(e,r),i=b.useRef(!1);return b.useEffect(()=>{const s=r.current;if(s)return bS(s)},[]),b.createElement(vm,{as:sc,allowPinchZoom:!0},b.createElement(xm,Ae({},n,{ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Hn(n.onCloseAutoFocus,s=>{var l;s.preventDefault(),i.current||(l=t.triggerRef.current)===null||l===void 0||l.focus()}),onPointerDownOutside:Hn(n.onPointerDownOutside,s=>{const l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Hn(n.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),cE=b.forwardRef((n,e)=>{const t=io(ni,n.__scopePopover),r=b.useRef(!1),o=b.useRef(!1);return b.createElement(xm,Ae({},n,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=n.onCloseAutoFocus)===null||s===void 0||s.call(n,i),!i.defaultPrevented){var l;r.current||(l=t.triggerRef.current)===null||l===void 0||l.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,l;(s=n.onInteractOutside)===null||s===void 0||s.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=i.target;((l=t.triggerRef.current)===null||l===void 0?void 0:l.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),xm=b.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=n,f=io(ni,t),h=Tc(t);return zk(),b.createElement(Vk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},b.createElement(Bk,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1)},b.createElement(dS,Ae({"data-state":km(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)"}}))))}),uE="PopoverClose",dE=b.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,o=io(uE,t);return b.createElement(pr.button,Ae({type:"button"},r,{ref:e,onClick:Hn(n.onClick,()=>o.onOpenChange(!1))}))});function km(n){return n?"open":"closed"}const fE=nE,hE=oE,pE=lE,Qs=dE,Mc=b.forwardRef(({children:n,className:e,withShadow:t=!0,withBorder:r=!0,...o},i)=>{const s=fe(e,"bg-white rounded-md",t?"shadow-md":"",r?"border border-neutral-200":"");return w.jsx("div",{className:s,...o,ref:i,children:n})});Mc.displayName="Surface";const el=({children:n,isActive:e,onClick:t,disabled:r,className:o})=>{const i=fe("flex items-center gap-2 p-1.5 text-xs font-medium text-neutral-500 text-left w-full rounded-md border border-transparent transition-all",!e&&!r,"hover:border-neutral-200 hover:bg-neutral-100",e&&!r&&"bg-neutral-200 text-neutral-800",r&&"text-neutral-300 cursor-not-allowed",o);return w.jsx("button",{className:i,disabled:r,onClick:t,children:n})},mE=(n,e,t)=>{const r=b.useCallback(()=>{const l=n.chain();l.setNodeSelection(t).unsetAllMarks(),(e==null?void 0:e.type.name)!=="paragraph"&&l.setParagraph(),l.run()},[n,t,e==null?void 0:e.type.name]),o=b.useCallback(()=>{n.commands.setNodeSelection(t);const{$anchor:l}=n.state.selection,a=l.node(1)||n.state.selection.node;n.chain().setMeta("hideDragHandle",!0).insertContentAt(t+((e==null?void 0:e.nodeSize)||0),a.toJSON()).run()},[n,t,e==null?void 0:e.nodeSize]),i=b.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).run(),document.execCommand("copy"),alert("copied")},[n,t]),s=b.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).deleteSelection().run()},[n,t]);return{resetTextFormatting:r,duplicateNode:o,copyNodeToClipboard:i,deleteNode:s}},tl=b.forwardRef(({active:n,buttonSize:e="medium",children:t,disabled:r,variant:o="primary",className:i,activeClassname:s,...l},a)=>{const c=fe("flex group items-center justify-center border border-transparent gap-2 text-sm font-semibold rounded-md disabled:opacity-50 whitespace-nowrap",o==="primary"&&fe("text-white bg-black border-black dark:text-black dark:bg-white dark:border-white",!r&&!n&&"hover:bg-neutral-800 active:bg-neutral-900 dark:hover:bg-neutral-200 dark:active:bg-neutral-300",n&&fe("bg-neutral-900 dark:bg-neutral-300",s)),o==="secondary"&&fe("text-neutral-900 dark:text-white",!r&&!n&&"hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-900 dark:active:bg-neutral-800",n&&"bg-neutral-200 dark:bg-neutral-800"),o==="tertiary"&&fe("bg-neutral-50 text-neutral-900 dark:bg-neutral-900 dark:text-white dark:border-neutral-900",!r&&!n&&"hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-800 dark:active:bg-neutral-700",n&&fe("bg-neutral-200 dark:bg-neutral-800",s)),o==="ghost"&&fe("bg-transparent border-transparent text-neutral-500",!r&&!n&&"hover:bg-black/5 hover:text-neutral-700 active:bg-black/10 active:text-neutral-800 ",n&&fe("bg-black/10 text-neutral-800 ",s)),e==="medium"&&"py-2 px-3",e==="small"&&"py-1 px-2",e==="icon"&&"w-8 h-8",e==="iconSmall"&&"w-6 h-6",i);return w.jsx("button",{ref:a,disabled:r,className:c,...l,children:t})});tl.displayName="Button";const Cm=({content:n,children:e})=>{const[t,r]=b.useState(!1);return w.jsxs("div",{className:"relative inline-block",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[e,t&&w.jsx("div",{className:"absolute z-10 p-2 mt-2 text-sm text-white bg-gray-800 rounded shadow-lg",children:n})]})},Sm=b.forwardRef(({shouldShowContent:n=!0,children:e,isVertical:t=!1,className:r,...o},i)=>{const s=fe("text-black inline-flex h-full leading-none gap-0.5",t?"flex-col p-2":"flex-row p-1 items-center",r);return n?n&&w.jsx(Mc,{className:s,...o,ref:i,children:e}):null});Sm.displayName="Toolbar";const Em=b.forwardRef(({horizontal:n,className:e,...t},r)=>{const o=fe("bg-neutral-200",n?"w-full min-w-[1.5rem] h-[1px] my-1 first:mt-0 last:mt-0":"h-full min-h-[1.5rem] w-[1px] mx-1 first:ml-0 last:mr-0",e);return w.jsx("div",{className:o,ref:r,...t})});Em.displayName="Toolbar.Divider";const Am=b.forwardRef(({children:n,buttonSize:e="icon",variant:t="ghost",className:r,tooltip:o,activeClassname:i,...s},l)=>{const a=fe("gap-1 min-w-[2rem] px-2 w-auto",r),c=w.jsx(tl,{activeClassname:i,className:a,variant:t,buttonSize:e,ref:l,...s,children:n});return o?w.jsx(Cm,{content:o,children:c}):c});Am.displayName="ToolbarButton";const ri={Wrapper:Sm,Divider:Em,Button:Am},gE=({node:n,getPos:e,editor:t,deleteNode:r})=>{const[o,i]=b.useState(!1),s=mE(t,n,e()),l=$s(),a=["https://twitter.com","https://x.com"],c=b.useMemo(()=>{const{content:A}=n.content;return A[0].type.name==="table"},[n.content]),u=b.useMemo(()=>{var P;const{content:A}=n.content;return(P=A[0].content.content[0])==null?void 0:P.text},[n.content]),d=b.useMemo(()=>{var P;const{content:A}=n.content;return(P=A[0].content.content[1])==null?void 0:P.text},[n.content]),f=b.useMemo(()=>{const{content:A}=n.content;return A[0].content.content.find(P=>{var H;return(H=P==null?void 0:P.text)==null?void 0:H.match(/\/status\/([0-9]*)/)})},[n.content]),h=()=>{if(!u)return;let A=u;if(u.includes("<iframe"))A=d;else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(u):{const R=u.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);R&&R.length>0&&(A=`https://www.youtube.com/embed/${R[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(u):{const R=u.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);R&&R.length>0&&(A=`https://player.vimeo.com/video/${R[1]}`);break}default:return}const P=640,H=360,N=e(),$=N+n.nodeSize;A&&(t==null||t.chain().focus(N).deleteRange({from:N===0?N:N+1,to:$}).setIframe({src:A,width:P,height:H}).run())},p=A=>{const P=A.match(/\/status\/([0-9]*)/);return P&&P.length>0?P[1]:null},m=()=>{if(!u)return;let A=u;const P=a.some(R=>u.includes(R)),H=p(u);P&&H?A=H:f&&(A=p(f.text));const N=e(),$=N+n.nodeSize;A&&(t==null||t.chain().focus(N).deleteRange({from:N===2?N:N+1,to:$}).setTweetEmbed({tweetId:A}).run())},g=()=>{const A=e()+n.nodeSize;t.commands.insertContentAt(A,{type:"dBlock",content:[{type:"paragraph"}]})},y=()=>{const A=e();t.commands.insertContentAt(A,{type:"dBlock",content:[{type:"paragraph"}]})},k=()=>{r()},C=A=>{A.altKey?E():v()},v=()=>{g()},E=()=>{y()},S=A=>{A.altKey&&k()},D=xp(()=>{if(a.some(A=>u.includes(A))||f!=null&&f.text){m();return}else{h();return}},1e3);return b.useEffect(()=>{u&&D()},[u]),w.jsxs(Ko,{as:"div",className:fe("flex gap-2 group w-full relative justify-center items-start",l&&"pointer-events-none",c&&"2xl:ml-4 pointer-events-auto"),children:[w.jsxs("section",{className:"lg:flex gap-1 hidden","aria-label":"left-menu",contentEditable:!1,children:[w.jsx(Cm,{content:w.jsxs("div",{className:"flex flex-col w-40",children:[w.jsx("div",{className:"text-xs",children:"Click to add below"}),w.jsx("div",{className:"text-xs",children:"Opt + Click to add above"})]}),children:w.jsx("div",{className:`d-block-button cursor-pointer ${!l&&"group-hover:opacity-100"}`,contentEditable:!1,onClick:C,children:w.jsx(Gx,{size:18})})}),w.jsxs(fE,{open:o,onOpenChange:i,children:[w.jsx(hE,{asChild:!0,children:w.jsx("div",{className:`d-block-button cursor-pointer ${!l&&"group-hover:opacity-100"}`,contentEditable:!1,draggable:!0,"data-drag-handle":!0,onClick:S,children:w.jsx(Wx,{size:18})})}),w.jsx(pE,{side:"bottom",align:"start",sideOffset:8,className:"z-10",children:w.jsxs(Mc,{className:"p-2 flex flex-col min-w-[16rem]",children:[w.jsx(Qs,{children:w.jsxs(el,{onClick:s.resetTextFormatting,children:[w.jsx(Yx,{size:18}),"Clear formatting"]})}),w.jsx(Qs,{children:w.jsxs(el,{onClick:s.copyNodeToClipboard,children:[w.jsx(jx,{size:18}),"Copy to clipboard"]})}),w.jsx(Qs,{children:w.jsxs(el,{onClick:s.duplicateNode,children:[w.jsx(Vx,{size:18}),"Duplicate"]})}),w.jsx(ri.Divider,{horizontal:!0}),w.jsx(Qs,{children:w.jsxs(el,{onClick:s.deleteNode,className:"text-red-500 hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20",children:[w.jsx(ek,{size:18}),"Delete"]})})]})})]})]}),w.jsx(yh,{className:fe("node-view-content w-full",{"is-table min-w-auto":c})})]})},yE=pe.create({name:"dBlock",priority:1e3,group:"dBlock",content:"(block|columns)",draggable:!0,selectable:!1,inline:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="d-block"]'}]},renderHTML({HTMLAttributes:n}){return["div",ee(n,{"data-type":"d-block"}),0]},addCommands(){return{setDBlock:n=>({state:e,chain:t})=>{const{selection:{from:r}}=e,o=n!==void 0||n!==null?r:n;return t().insertContentAt(o,{type:this.name,content:[{type:"paragraph"}]}).focus(o+2).run()},mergeDBlocksIntoList:n=>({state:e,dispatch:t})=>{if(!t)throw new Error("Dispatch function is not provided.");const{from:r,to:o}=e.selection;let i=e.tr;const s=[];if(e.doc.nodesBetween(r,o,a=>{if(a.type.name===this.name){const c=e.schema.nodes.listItem.create(null,a.content);c&&s.push(c)}}),s.length===0)return!1;const l=e.schema.nodes[n].create(null,s);return l?(i=i.replaceRangeWith(r,o,l),t(i),!0):!1},splitListToDBlocks:n=>({state:e,dispatch:t})=>{if(!t)throw new Error("Dispatch function is not provided.");const{from:r,to:o}=e.selection;let i=e.tr;return e.doc.nodesBetween(r,o,(s,l)=>{if(s.type.name===n){const a=e.schema.nodes[this.name].create(null,s.content);i=i.insert(l,a)}}),t(i),!0}}},addNodeView(){return cr(gE)},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setDBlock(),Enter:({editor:n})=>{var c;const{selection:{$head:e,from:t,to:r},doc:o}=n.state,i=e.node(e.depth-1);if((i==null?void 0:i.type.name)!=="dBlock")return!1;let s=-1,l="";o.descendants((u,d)=>{if(s!==-1)return!1;if(u.type.name===this.name)return;const[f,h]=[d,d+u.nodeSize];return f<=t&&r<=h&&(s=h,l=u.type.name),!1});const a=(c=o.slice(t,s))==null?void 0:c.toJSON().content;try{return l==="codeBlock"?n.chain().insertContentAt({from:t,to:s},`
356
+ `).focus(s+1).run():["columns","heading"].includes(l)?n.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run():n.chain().insertContentAt({from:t,to:s},{type:this.name,content:a}).focus(t+4).run()}catch(u){return console.error(`Error inserting content into dBlock node: ${u}`),!1}}}}});let Oc,Nc;if(typeof WeakMap<"u"){let n=new WeakMap;Oc=e=>n.get(e),Nc=(e,t)=>(n.set(e,t),t)}else{let n=[],e=10,t=0;Oc=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},Nc=(r,o)=>(t==e&&(t=0),n[t++]=r,n[t++]=o)}class so{constructor(e,t,r,o){this.left=e,this.top=t,this.right=r,this.bottom=o}}class we{constructor(e,t,r,o){this.width=e,this.height=t,this.map=r,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let o=t%this.width,i=t/this.width|0,s=o+1,l=i+1;for(let a=1;s<this.width&&this.map[t+a]==r;a++)s++;for(let a=1;l<this.height&&this.map[t+this.width*a]==r;a++)l++;return new so(o,i,s,l)}throw new RangeError("No cell with offset "+e+" found")}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError("No cell with offset "+e+" found")}nextCell(e,t,r){let{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(r<0?o==0:i==this.width)?null:this.map[s*this.width+(r<0?o-1:i)]:(r<0?s==0:l==this.height)?null:this.map[o+this.width*(r<0?s-1:l)]}rectBetween(e,t){let{left:r,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:a,top:c,bottom:u}=this.findCell(t);return new so(Math.min(r,l),Math.min(i,c),Math.max(o,a),Math.max(s,u))}cellsInRect(e){let t=[],r={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){let s=o*this.width+i,l=this.map[s];r[l]||(r[l]=!0,(i!=e.left||!i||this.map[s-1]!=l)&&(o!=e.top||!o||this.map[s-this.width]!=l)&&t.push(l))}return t}positionAt(e,t,r){for(let o=0,i=0;;o++){let s=i+r.child(o).nodeSize;if(o==e){let l=t+e*this.width,a=(e+1)*this.width;for(;l<a&&this.map[l]<i;)l++;return l==a?s-1:this.map[l]}i=s}}static get(e){return Oc(e)||Nc(e,vE(e))}}function vE(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=bE(n),t=n.childCount,r=[],o=0,i=null,s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let d=n.child(c);u++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;let m=d.child(p),{colspan:g,rowspan:y,colwidth:k}=m.attrs;for(let C=0;C<y;C++){if(C+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-C});break}let v=o+C*e;for(let E=0;E<g;E++){r[v+E]==0?r[v+E]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:g-E});let S=k&&k[E];if(S){let O=(v+E)%e*2,D=s[O];D==null||D!=S&&s[O+1]==1?(s[O]=S,s[O+1]=1):D==S&&s[O+1]++}}}o+=g,u+=m.nodeSize}let f=(c+1)*e,h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}let l=new we(e,t,r,i),a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&wE(l,s,n),l}function bE(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let o=n.child(r),i=0;if(t)for(let s=0;s<r;s++){let l=n.child(s);for(let a=0;a<l.childCount;a++){let c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){let l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function wE(n,e,t){n.problems||(n.problems=[]);for(let r=0,o={};r<n.map.length;r++){let i=n.map[r];if(o[i])continue;o[i]=!0;let s=t.nodeAt(i),l=null;for(let a=0;a<s.attrs.colspan;a++){let c=(r+a)%n.width,u=e[c*2];u!=null&&(!s.attrs.colwidth||s.attrs.colwidth[a]!=u)&&((l||(l=xE(s.attrs)))[a]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function xE(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Ve(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}const Wn=new Ce("selectingCells");function lo(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function kE(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Pt(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function nl(n){let e=n.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&e.node.type.spec.tableRole=="cell"?e.$anchor:lo(e.$head)||CE(e.$head)}function CE(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Dc(n){return n.parent.type.spec.tableRole=="row"&&n.nodeAfter}function SE(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Lc(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Tm(n,e,t){let r=n.start(-1),i=we.get(n.node(-1)).nextCell(n.pos-r,e,t);return i==null?null:n.node(0).resolve(r+i)}function Pe(n,e,t){let r={};for(let o in n)r[o]=n[o];return r[e]=t,r}function gr(n,e,t=1){let r=Pe(n,"colspan",n.colspan-t);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Mm(n,e,t=1){let r=Pe(n,"colspan",n.colspan+t);if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function EE(n,e,t){let r=Ve(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}class ne extends J{constructor(e,t=e){let r=e.node(-1),o=we.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);let c=a.map(u=>{let d=r.nodeAt(u),f=u+i+1;return new El(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Dc(r)&&Dc(o)&&Lc(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ne.rowSelection(r,o):i&&this.isColSelection()?ne.colSelection(r,o):new ne(r,o)}return K.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=we.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){let c=[];for(let u=a*t.width+o.left,d=o.left;d<o.right;d++,u++){let f=t.map[u];if(!i[f]){i[f]=!0;let h=t.findCell(f),p=e.nodeAt(f),m=o.left-h.left,g=h.right-o.right;if(m>0||g>0){let y=p.attrs;m>0&&(y=gr(y,0,m)),g>0&&(y=gr(y,y.colspan-g,g)),h.left<o.left?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}if(h.top<o.top||h.bottom>o.bottom){let y=Pe(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)}}s.push(e.child(a).copy(M.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new B(M.from(l),1,1)}replace(e,t=B.empty){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?B.empty:t)}let i=J.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new B(M.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=we.get(t),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),o+i[s])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=we.get(e.node(-1)),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),l=e.node(0);return i.top<=s.top?(i.top>0&&(e=l.resolve(o+r.map[i.left])),s.bottom<r.height&&(t=l.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(t=l.resolve(o+r.map[s.left])),i.bottom<r.height&&(e=l.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new ne(e,t)}isRowSelection(){let e=we.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-t),o=e.colCount(this.$headCell.pos-t);if(Math.min(r,o)>0)return!1;let i=r+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==e.width}eq(e){return e instanceof ne&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=we.get(e.node(-1)),o=e.start(-1),i=r.findCell(e.pos-o),s=r.findCell(t.pos-o),l=e.node(0);return i.left<=s.left?(i.left>0&&(e=l.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(t=l.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(t=l.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(e=l.resolve(o+r.map[r.width*(i.top+1)-1]))),new ne(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ne(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new ne(e.resolve(t),e.resolve(r))}getBookmark(){return new Pc(this.$anchorCell.pos,this.$headCell.pos)}}ne.prototype.visible=!1,J.jsonID("cell",ne);class Pc{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Pc(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Lc(t,r)?new ne(t,r):J.near(r,1)}}function AE(n){if(!(n.selection instanceof ne))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push($e.node(r,r+t.nodeSize,{class:"selectedCell"}))}),me.create(n.doc,e)}function TE({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function ME({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function OE(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof W&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=ne.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=ne.rowSelection(l,l)}else if(!t){let l=we.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=ne.create(o,a+1,c)}}else r instanceof K&&TE(r)?i=K.create(o,r.from):r instanceof K&&ME(r)&&(i=K.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function NE(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.firstChild.type.spec.tableRole=="table");)t--,r--,e=e.firstChild.content;let o=e.firstChild,i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content,u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Rc(Ve(s).row,new B(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||r?Rc(Ve(s).row,new B(e,t,r)).content:e);else return null;return DE(s,l)}function DE(n,e){let t=[];for(let o=0;o<e.length;o++){let i=e[o];for(let s=i.childCount-1;s>=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(M.empty),t[o]<r){let i=Ve(n).cell.createAndFill(),s=[];for(let l=t[o];l<r;l++)s.push(i);e[o]=e[o].append(M.from(s))}return{height:e.length,width:r,rows:e}}function Rc(n,e){let t=n.createAndFill();return new Cl(t).replace(0,t.content.size,e).doc}function LE({width:n,height:e,rows:t},r,o){if(n!=r){let i=[],s=[];for(let l=0;l<t.length;l++){let a=t[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.create(gr(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++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(M.from(c))}t=s,n=r}if(e!=o){let i=[];for(let s=0,l=0;s<o;s++,l++){let a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create(Pe(d.attrs,"rowspan",Math.max(1,o-d.attrs.rowspan)),d.content)),a.push(d)}i.push(M.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function PE(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=Ve(l),c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){let h=t.child(d);f+=h.nodeSize;let p=[],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);n.insert(n.mapping.slice(s).map(f-1+r),p)}if(i>e.height){let d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){let g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;d.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,M.from(d)),h=[];for(let p=e.height;p<i;p++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||u)}function Om(n,e,t,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){let u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;let f=t.nodeAt(d),{top:h,left:p}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,Pe(f.attrs,"rowspan",s-h)),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),f.type.createAndFill(Pe(f.attrs,"rowspan",h+f.attrs.rowspan-s))),c+=f.attrs.colspan-1}}return a}function Nm(n,e,t,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){let u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;let f=t.nodeAt(d),h=e.colCount(d),p=n.mapping.slice(l).map(d+r);n.setNodeMarkup(p,null,gr(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(p+f.nodeSize,f.type.createAndFill(gr(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function Dm(n,e,t,r,o){let i=t?n.doc.nodeAt(t-1):n.doc,s=we.get(i),{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=n.tr,f=0;function h(){i=t?d.doc.nodeAt(t-1):d.doc,s=we.get(i),f=d.mapping.maps.length}PE(d,s,i,t,c,u,f)&&h(),Om(d,s,i,t,a,c,l,f)&&h(),Om(d,s,i,t,a,c,u,f)&&h(),Nm(d,s,i,t,l,u,a,f)&&h(),Nm(d,s,i,t,l,u,c,f)&&h();for(let p=l;p<u;p++){let m=s.positionAt(p,a,i),g=s.positionAt(p,c,i);d.replace(d.mapping.slice(f).map(m+t),d.mapping.slice(f).map(g+t),new B(o.rows[p-l],0,0))}h(),d.setSelection(new ne(d.doc.resolve(t+s.positionAt(l,a,i)),d.doc.resolve(t+s.positionAt(u-1,c-1,i)))),e(d)}const RE=ea({ArrowLeft:ol("horiz",-1),ArrowRight:ol("horiz",1),ArrowUp:ol("vert",-1),ArrowDown:ol("vert",1),"Shift-ArrowLeft":il("horiz",-1),"Shift-ArrowRight":il("horiz",1),"Shift-ArrowUp":il("vert",-1),"Shift-ArrowDown":il("vert",1),Backspace:sl,"Mod-Backspace":sl,Delete:sl,"Mod-Delete":sl});function rl(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function ol(n,e){return(t,r,o)=>{let i=t.selection;if(i instanceof ne)return rl(t,r,J.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=Lm(o,n,e);if(s==null)return!1;if(n=="horiz")return rl(t,r,J.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=Tm(l,n,e),c;return a?c=J.near(a,1):e<0?c=J.near(t.doc.resolve(l.before(-1)),-1):c=J.near(t.doc.resolve(l.after(-1)),1),rl(t,r,c)}}}function il(n,e){return(t,r,o)=>{let i=t.selection;if(!(i instanceof ne)){let l=Lm(o,n,e);if(l==null)return!1;i=new ne(t.doc.resolve(l))}let s=Tm(i.$headCell,n,e);return s?rl(t,r,new ne(i.$anchorCell,s)):!1}}function sl(n,e){let t=n.selection;if(!(t instanceof ne))return!1;if(e){let r=n.tr,o=Ve(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new B(o,0,0))}),r.docChanged&&e(r)}return!0}function IE(n,e){let t=n.state.doc,r=lo(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ne(r))),!0):!1}function FE(n,e,t){if(!Pt(n.state))return!1;let r=NE(t),o=n.state.selection;if(o instanceof ne){r||(r={width:1,height:1,rows:[M.from(Rc(Ve(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=we.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=LE(r,l.right-l.left,l.bottom-l.top),Dm(n.state,n.dispatch,s,l,r),!0}else if(r){let i=nl(n.state),s=i.start(-1);return Dm(n.state,n.dispatch,s,we.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function $E(n,e){if(e.ctrlKey||e.metaKey)return;let t=Pm(n,e.target),r;if(e.shiftKey&&n.state.selection instanceof ne)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&t&&(r=lo(n.state.selection.$anchor))!=null&&Ic(n,e).pos!=r.pos)o(r,e),e.preventDefault();else if(!t)return;function o(l,a){let c=Ic(n,a),u=Wn.getState(n.state)==null;if(!c||!Lc(l,c))if(u)c=l;else return;let d=new ne(l,c);if(u||!n.state.selection.eq(d)){let f=n.state.tr.setSelection(d);u&&f.setMeta(Wn,l.pos),n.dispatch(f)}}function i(){n.root.removeEventListener("mouseup",i),n.root.removeEventListener("dragstart",i),n.root.removeEventListener("mousemove",s),Wn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Wn,-1))}function s(l){let a=Wn.getState(n.state),c;if(a!=null)c=n.state.doc.resolve(a);else if(Pm(n,l.target)!=t&&(c=Ic(n,e),!c))return i();c&&o(c,l)}n.root.addEventListener("mouseup",i),n.root.addEventListener("dragstart",i),n.root.addEventListener("mousemove",s)}function Lm(n,e,t){if(!(n.state.selection instanceof K))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function Pm(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e}function Ic(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?lo(n.state.doc.resolve(t.pos)):null}const BE=new Ce("fix-tables");function Rm(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){let a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<o&&n.child(l).sameMarkup(a)?Rm(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Im(n,e){let t,r=(o,i)=>{o.type.spec.tableRole=="table"&&(t=HE(n,o,i,t))};return e?e.doc!=n.doc&&Rm(e.doc,n.doc,0,r):n.doc.descendants(r),t}function HE(n,e,t,r){let o=we.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){let c=o.problems[a];if(c.type=="collision"){let u=e.nodeAt(c.pos);for(let d=0;d<u.attrs.rowspan;d++)i[c.row+d]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,gr(u.attrs,u.attrs.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,Pe(u.attrs,"rowspan",u.attrs.rowspan-c.n))}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,Pe(u.attrs,"colwidth",c.colwidth))}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<o.height;a++){let u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let g=0;g<f;g++)p.push(Ve(n.schema)[h].createAndFill());let m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(BE,{fixTables:!0})}function Xt(n){let e=n.selection,t=nl(n),r=t.node(-1),o=t.start(-1),i=we.get(r),s;return e instanceof ne?s=i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s=i.findCell(t.pos-o),s.tableStart=o,s.map=i,s.table=r,s}function Fm(n,{map:e,tableStart:t,table:r},o){let i=o>0?-1:0;EE(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){let l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){let a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,Mm(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{let a=i==null?Ve(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function jE(n,e){if(!Pt(n))return!1;if(e){let t=Xt(n);e(Fm(n.tr,t,t.left))}return!0}function zE(n,e){if(!Pt(n))return!1;if(e){let t=Xt(n);e(Fm(n.tr,t,t.right))}return!0}function VE(n,{map:e,table:t,tableStart:r},o){let i=n.mapping.maps.length;for(let s=0;s<e.height;){let l=s*e.width+o,a=e.map[l],c=t.nodeAt(a);if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(r+a),null,gr(c.attrs,o-e.colCount(a)));else{let u=n.mapping.slice(i).map(r+a);n.delete(u,u+c.nodeSize)}s+=c.attrs.rowspan}}function _E(n,e){if(!Pt(n))return!1;if(e){let t=Xt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;VE(r,t,o),o!=t.left;o--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=we.get(t.table);e(r)}return!0}function WE(n,e,t){let r=Ve(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(e.nodeAt(n.map[o+t*n.width]).type!=r)return!1;return!0}function $m(n,{map:e,tableStart:t,table:r},o){let i=t;for(let a=0;a<o;a++)i+=r.child(a).nodeSize;let s=[],l=o>0?-1:0;WE(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let a=0,c=e.width*o;a<e.width;a++,c++)if(o>0&&o<e.height&&e.map[c]==e.map[c-e.width]){let u=e.map[c],d=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,Pe(d,"rowspan",d.rowspan+1)),a+=d.colspan-1}else{let u=l==null?Ve(r.type.schema).cell:r.nodeAt(e.map[c+l*e.width]).type;s.push(u.createAndFill())}return n.insert(i,Ve(r.type.schema).row.create(null,s)),n}function qE(n,e){if(!Pt(n))return!1;if(e){let t=Xt(n);e($m(n.tr,t,t.top))}return!0}function UE(n,e){if(!Pt(n))return!1;if(e){let t=Xt(n);e($m(n.tr,t,t.bottom))}return!0}function KE(n,{map:e,table:t,tableStart:r},o){let i=0;for(let a=0;a<o;a++)i+=t.child(a).nodeSize;let s=i+t.child(o).nodeSize,l=n.mapping.maps.length;n.delete(i+r,s+r);for(let a=0,c=o*e.width;a<e.width;a++,c++){let u=e.map[c];if(o>0&&u==e.map[c-e.width]){let d=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,Pe(d,"rowspan",d.rowspan-1)),a+=d.colspan-1}else if(o<e.width&&u==e.map[c+e.width]){let d=t.nodeAt(u),f=d.type.create(Pe(d.attrs,"rowspan",d.attrs.rowspan-1),d.content),h=e.positionAt(o+1,a,t);n.insert(n.mapping.slice(l).map(r+h),f),a+=d.attrs.colspan-1}}}function JE(n,e){if(!Pt(n))return!1;if(e){let t=Xt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;KE(r,t,o),o!=t.top;o--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=we.get(t.table);e(r)}return!0}function Bm(n){let e=n.content;return e.childCount==1&&e.firstChild.isTextblock&&e.firstChild.childCount==0}function ZE({width:n,height:e,map:t},r){let o=r.top*n+r.left,i=o,s=(r.bottom-1)*n+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[s]==t[s+n])return!0;o++,s++}return!1}function Hm(n,e){let t=n.selection;if(!(t instanceof ne)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=Xt(n),{map:o}=r;if(ZE(o,r))return!1;if(e){let i=n.tr,s={},l=M.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){let f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!s[f])if(s[f]=!0,a==null)a=f,c=h;else{Bm(h)||(l=l.append(h.content));let p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(i.setNodeMarkup(a+r.tableStart,null,Pe(Mm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),"rowspan",r.bottom-r.top)),l.size){let u=a+1+c.content.size,d=Bm(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new ne(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function jm(n,e){const t=Ve(n.schema);return GE(({node:r})=>t[r.type.spec.tableRole])(n,e)}function GE(n){return(e,t)=>{let r=e.selection,o,i;if(r instanceof ne){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{if(o=kE(r.$from),!o)return!1;i=lo(r.$from).pos}if(o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let s=o.attrs,l=[],a=s.colwidth;s.rowspan>1&&(s=Pe(s,"rowspan",1)),s.colspan>1&&(s=Pe(s,"colspan",1));let c=Xt(e),u=e.tr;for(let f=0;f<c.right-c.left;f++)l.push(a?Pe(s,"colwidth",a&&a[f]?[a[f]]:null):s);let d;for(let f=c.top;f<c.bottom;f++){let h=c.map.positionAt(f,c.left,c.table);f==c.top&&(h+=o.nodeSize);for(let p=c.left,m=0;p<c.right;p++,m++)p==c.left&&f==c.top||u.insert(d=u.mapping.map(h+c.tableStart,1),n({node:o,row:f,col:p}).createAndFill(l[m]))}u.setNodeMarkup(i,n({node:o,row:c.top,col:c.left}),l[0]),r instanceof ne&&u.setSelection(new ne(u.doc.resolve(r.$anchorCell.pos),d&&u.doc.resolve(d))),t(u)}return!0}}function YE(n,e){return function(t,r){if(!Pt(t))return!1;let o=nl(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof ne?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,Pe(s.attrs,n,e))}):i.setNodeMarkup(o.pos,null,Pe(o.nodeAfter.attrs,n,e)),r(i)}return!0}}function XE(n){return function(e,t){if(!Pt(e))return!1;if(t){let r=Ve(e.schema),o=Xt(e),i=e.tr,s=o.map.cellsInRect(n=="column"?new so(o.left,0,o.right,o.map.height):n=="row"?new so(0,o.top,o.map.width,o.bottom):o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);t(i)}return!0}}function zm(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function oi(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?XE(n):function(t,r){if(!Pt(t))return!1;if(r){let o=Ve(t.schema),i=Xt(t),s=t.tr,l=zm("row",i,o),a=zm("column",i,o),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?new so(0,u,1,i.map.height):n=="row"?new so(u,0,i.map.width,1):i,f=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(h=>{const p=h+i.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}oi("row",{useDeprecatedLogic:!0}),oi("column",{useDeprecatedLogic:!0});let QE=oi("cell",{useDeprecatedLogic:!0});function eA(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r);if(i.childCount)return o-1-i.lastChild.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}}function Vm(n){return function(e,t){if(!Pt(e))return!1;let r=eA(nl(e),n);if(r!=null){if(t){let o=e.doc.resolve(r);t(e.tr.setSelection(K.between(o,SE(o))).scrollIntoView())}return!0}}}function tA(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}let nA=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Fc(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,Fc(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Fc(n,e,t,r,o,i){let s=0,l=!0,a=e.firstChild,c=n.firstChild;for(let u=0,d=0;u<c.childCount;u++){let{colspan:f,colwidth:h}=c.child(u).attrs;for(let p=0;p<f;p++,d++){let m=o==d?i:h&&h[p],g=m?m+"px":"";s+=m||r,m||(l=!1),a?(a.style.width!=g&&(a.style.width=g),a=a.nextSibling):e.appendChild(document.createElement("col")).style.width=g}}for(;a;){let u=a.nextSibling;a.parentNode.removeChild(a),a=u}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}const At=new Ce("tableColumnResizing");function rA({handleWidth:n=5,cellMinWidth:e=25,View:t=nA,lastColumnResizable:r=!0}={}){return new ge({key:At,state:{init(i,s){return this.spec.props.nodeViews[Ve(s.schema).table.name]=(l,a)=>new t(l,e,a),new ii(-1,!1)},apply(i,s){return s.apply(i)}},props:{attributes(i){return At.getState(i).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove(i,s){oA(i,s,n,e,r)},mouseleave(i){iA(i)},mousedown(i,s){sA(i,s,e)}},decorations(i){let s=At.getState(i);if(s.activeHandle>-1)return fA(i,s.activeHandle)},nodeViews:{}}})}class ii{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(At);if(r&&r.setHandle!=null)return new ii(r.setHandle,null);if(r&&r.setDragging!==void 0)return new ii(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);Dc(e.doc.resolve(o))||(o=null),t=new ii(o,t.dragging)}return t}}function oA(n,e,t,r,o){let i=At.getState(n.state);if(!i.dragging){let s=aA(e.target),l=-1;if(s){let{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=_m(n,e,"left"):c-e.clientX<=t&&(l=_m(n,e,"right"))}if(l!=i.activeHandle){if(!o&&l!==-1){let a=n.state.doc.resolve(l),c=a.node(-1),u=we.get(c),d=a.start(-1);if(u.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==u.width-1)return}qm(n,l)}}}function iA(n){let e=At.getState(n.state);e.activeHandle>-1&&!e.dragging&&qm(n,-1)}function sA(n,e,t){let r=At.getState(n.state);if(r.activeHandle==-1||r.dragging)return!1;let o=n.state.doc.nodeAt(r.activeHandle),i=lA(n,r.activeHandle,o.attrs);n.dispatch(n.state.tr.setMeta(At,{setDragging:{startX:e.clientX,startWidth:i}}));function s(a){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",l);let c=At.getState(n.state);c.dragging&&(cA(n,c.activeHandle,Wm(c.dragging,a,t)),n.dispatch(n.state.tr.setMeta(At,{setDragging:null})))}function l(a){if(!a.which)return s(a);let c=At.getState(n.state),u=Wm(c.dragging,a,t);uA(n,c.activeHandle,u,t)}return window.addEventListener("mouseup",s),window.addEventListener("mousemove",l),e.preventDefault(),!0}function lA(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function aA(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList.contains("ProseMirror")?null:n.parentNode;return n}function _m(n,e,t){let r=n.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;let{pos:o}=r,i=lo(n.state.doc.resolve(o));if(!i)return-1;if(t=="right")return i.pos;let s=we.get(i.node(-1)),l=i.start(-1),a=s.map.indexOf(i.pos-l);return a%s.width==0?-1:l+s.map[a-1]}function Wm(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function qm(n,e){n.dispatch(n.state.tr.setMeta(At,{setHandle:e}))}function cA(n,e,t){let r=n.state.doc.resolve(e),o=r.node(-1),i=we.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;let d=i.map[u],{attrs:f}=o.nodeAt(d),h=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[h]==t)continue;let p=f.colwidth?f.colwidth.slice():dA(f.colspan);p[h]=t,a.setNodeMarkup(s+d,null,Pe(f,"colwidth",p))}a.docChanged&&n.dispatch(a)}function uA(n,e,t,r){let o=n.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=we.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.domAtPos(o.start(-1)).node;for(;a.nodeName!="TABLE";)a=a.parentNode;Fc(i,a.firstChild,a,r,l,t)}function dA(n){let e=[];for(let t=0;t<n;t++)e.push(0);return e}function fA(n,e){let t=[],r=n.doc.resolve(e),o=r.node(-1),i=we.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan;for(let a=0;a<i.height;a++){let c=l+a*i.width-1;if((l==i.width||i.map[c]!=i.map[c+1])&&(a==0||i.map[c-1]!=i.map[c-1-i.width])){let u=i.map[c],d=s+u+o.nodeAt(u).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",t.push($e.widget(d,f))}}return me.create(n.doc,t)}function hA({allowTableNodeSelection:n=!1}={}){return new ge({key:Wn,state:{init(){return null},apply(e,t){let r=e.getMeta(Wn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:AE,handleDOMEvents:{mousedown:$E},createSelectionBetween(e){if(Wn.getState(e.state)!=null)return e.state.selection},handleTripleClick:IE,handleKeyDown:RE,handlePaste:FE},appendTransaction(e,t,r){return OE(r,Im(r,t),n)}})}function Um(n,e,t,r,o,i){var u;let s=0,l=!0,a=e.firstChild;const c=n.firstChild;if(c)for(let d=0,f=0;d<c.childCount;d+=1){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=o===f?i:p&&p[m],y=g?`${g}px`:"";s+=g||r,g||(l=!1),a?(a.style.width!==y&&(a.style.width=y),a=a.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;a;){const d=a.nextSibling;(u=a==null?void 0:a.parentNode)==null||u.removeChild(a),a=d}l?(t.style.width=`${s}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${s}px`)}class pA{constructor(e,t){bn(this,"node");bn(this,"cellMinWidth");bn(this,"dom");bn(this,"table");bn(this,"colgroup");bn(this,"contentDOM");this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Um(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,Um(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function Km(n,e){return n.createAndFill()}function mA(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function gA(n,e,t,r,o){const i=mA(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=Km(i.cell);if(u&&l.push(u),r){const d=Km(i.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?s:l));return i.table.createChecked(null,a)}function yA(n){return n instanceof ne}const ll=({editor:n})=>{const{selection:e}=n.state;if(!yA(e))return!1;let t=0;const r=ua(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},vA=pe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:pA,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let t=0,r=!0;try{n.content.firstChild.content.forEach(i=>{if(i.attrs.colwidth)i.attrs.colwidth.forEach(s=>{s?t+=s:(r=!1,t+=this.options.cellMinWidth)});else{r=!1;const s=i.attrs.colspan?i.attrs.colspan:1;t+=this.options.cellMinWidth*s}})}catch{r=!1}return r&&t>0?e.style=`width: ${t}px;`:t&&t>0?e.style=`min-width: ${t}px`:e.style=null,["div",{class:"table-wrapper"},["table",ee(this.options.HTMLAttributes,e),["tbody",0]]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const{selection:s}=r,l=gA(i.schema,n,e,t);if(o){const a=r.selection.anchor+1;r.replaceRangeWith(s.from-1,s.to,l).scrollIntoView().setSelection(K.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>jE(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>zE(n,e),deleteColumn:()=>({state:n,dispatch:e})=>_E(n,e),addRowBefore:()=>({state:n,dispatch:e})=>qE(n,e),addRowAfter:()=>({state:n,dispatch:e})=>UE(n,e),deleteRow:()=>({state:n,dispatch:e})=>JE(n,e),deleteTable:()=>({state:n,dispatch:e})=>tA(n,e),mergeCells:()=>({state:n,dispatch:e})=>Hm(n,e),splitCell:()=>({state:n,dispatch:e})=>jm(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>oi("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>oi("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>QE(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Hm(n,e)?!0:jm(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>YE(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Vm(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Vm(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Im(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ne.create(e.doc,n.anchorCell,n.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:ll,"Mod-Backspace":ll,Delete:ll,"Mod-Delete":ll}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[rA({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],hA({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:X(V(n,"tableRole",e))}}});function Jm(n,e){if(n==null)return{};var t={},r=Object.keys(n),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(t[o]=n[o]);return t}var Zm=typeof window<"u"&&typeof document<"u";function $c(n,e){n&&(typeof n=="function"&&n(e),{}.hasOwnProperty.call(n,"current")&&(n.current=e))}function Gm(){return Zm&&document.createElement("div")}function bA(n){var e={"data-placement":n.placement};return n.referenceHidden&&(e["data-reference-hidden"]=""),n.escaped&&(e["data-escaped"]=""),e}function Ym(n,e){if(n===e)return!0;if(typeof n=="object"&&n!=null&&typeof e=="object"&&e!=null){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(var t in n)if(e.hasOwnProperty(t)){if(!Ym(n[t],e[t]))return!1}else return!1;return!0}else return!1}function wA(n){var e=[];return n.forEach(function(t){e.find(function(r){return Ym(t,r)})||e.push(t)}),e}function xA(n,e){var t,r;return Object.assign({},e,{popperOptions:Object.assign({},n.popperOptions,e.popperOptions,{modifiers:wA([].concat(((t=n.popperOptions)==null?void 0:t.modifiers)||[],((r=e.popperOptions)==null?void 0:r.modifiers)||[]))})})}var Bc=Zm?b.useLayoutEffect:b.useEffect;function kA(n){var e=b.useRef();return e.current||(e.current=typeof n=="function"?n():n),e.current}function Xm(n,e,t){t.split(/\s+/).forEach(function(r){r&&n.classList[e](r)})}var CA={name:"className",defaultValue:"",fn:function(e){var t=e.popper.firstElementChild,r=function(){var l;return!!((l=e.props.render)!=null&&l.$$tippy)};function o(){if(e.props.className&&!r()){process.env.NODE_ENV!=="production"&&console.warn(["@tippyjs/react: Cannot use `className` prop in conjunction with","`render` prop. Place the className on the element you are","rendering."].join(" "));return}Xm(t,"add",e.props.className)}function i(){r()&&Xm(t,"remove",e.props.className)}return{onCreate:o,onBeforeUpdate:i,onAfterUpdate:o}}};function SA(n){function e(t){var r=t.children,o=t.content,i=t.visible,s=t.singleton,l=t.render,a=t.reference,c=t.disabled,u=c===void 0?!1:c,d=t.ignoreAttributes,f=d===void 0?!0:d;t.__source,t.__self;var h=Jm(t,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"]),p=i!==void 0,m=s!==void 0,g=b.useState(!1),y=g[0],k=g[1],C=b.useState({}),v=C[0],E=C[1],S=b.useState(),O=S[0],D=S[1],A=kA(function(){return{container:Gm(),renders:1}}),P=Object.assign({ignoreAttributes:f},h,{content:A.container});p&&(process.env.NODE_ENV!=="production"&&["trigger","hideOnClick","showOnCreate"].forEach(function(R){P[R]!==void 0&&console.warn(["@tippyjs/react: Cannot specify `"+R+"` prop in","controlled mode (`visible` prop)"].join(" "))}),P.trigger="manual",P.hideOnClick=!1),m&&(u=!0);var H=P,N=P.plugins||[];l&&(H=Object.assign({},P,{plugins:m&&s.data!=null?[].concat(N,[{fn:function(){return{onTrigger:function(U,z){var G=s.data.children.find(function(se){var le=se.instance;return le.reference===z.currentTarget});U.state.$$activeSingletonInstance=G.instance,D(G.content)}}}}]):N,render:function(){return{popper:A.container}}}));var $=[a].concat(r?[r.type]:[]);return Bc(function(){var R=a;a&&a.hasOwnProperty("current")&&(R=a.current);var I=n(R||A.ref||Gm(),Object.assign({},H,{plugins:[CA].concat(P.plugins||[])}));return A.instance=I,u&&I.disable(),i&&I.show(),m&&s.hook({instance:I,content:o,props:H,setSingletonContent:D}),k(!0),function(){I.destroy(),s==null||s.cleanup(I)}},$),Bc(function(){var R;if(A.renders===1){A.renders++;return}var I=A.instance;I.setProps(xA(I.props,H)),(R=I.popperInstance)==null||R.forceUpdate(),u?I.disable():I.enable(),p&&(i?I.show():I.hide()),m&&s.hook({instance:I,content:o,props:H,setSingletonContent:D})}),Bc(function(){var R;if(l){var I=A.instance;I.setProps({popperOptions:Object.assign({},I.props.popperOptions,{modifiers:[].concat((((R=I.props.popperOptions)==null?void 0:R.modifiers)||[]).filter(function(U){var z=U.name;return z!=="$$tippyReact"}),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(z){var G,se=z.state,le=(G=se.modifiersData)==null?void 0:G.hide;(v.placement!==se.placement||v.referenceHidden!==(le==null?void 0:le.isReferenceHidden)||v.escaped!==(le==null?void 0:le.hasPopperEscaped))&&E({placement:se.placement,referenceHidden:le==null?void 0:le.isReferenceHidden,escaped:le==null?void 0:le.hasPopperEscaped}),se.attributes.popper={}}}])})})}},[v.placement,v.referenceHidden,v.escaped].concat($)),b.createElement(b.Fragment,null,r?b.cloneElement(r,{ref:function(I){A.ref=I,$c(r.ref,I)}}):null,y&&vt.createPortal(l?l(bA(v),O,A.instance):o,A.container))}return e}var EA=function(n,e){return b.forwardRef(function(r,o){var i=r.children,s=Jm(r,["children"]);return b.createElement(n,Object.assign({},e,s),i?b.cloneElement(i,{ref:function(a){$c(o,a),$c(i.ref,a)}}):null)})},AA=EA(SA(ar));const TA=[{name:"Add row above",action:n=>n.chain().focus().addRowBefore().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7h2v-2h4v2h2v-2h4v2h2v-2h4v2h2v-7M4 14h4v3H4v-3m6 0h4v3h-4v-3m10 0v3h-4v-3h4m-9-4h2V7h3V5h-3V2h-2v3H8v2h3v3Z"})})},{name:"Add row below",action:n=>n.chain().focus().addRowAfter().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M22 10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3h2v2h4V3h2v2h4V3h2v2h4V3h2v7M4 10h4V7H4v3m6 0h4V7h-4v3m10 0V7h-4v3h4m-9 4h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z"})})},{name:"Add left column",action:n=>n.chain().focus().addColumnBefore().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M13 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9V2h-9m7 8v4h-7v-4h7m0 6v4h-7v-4h7m0-12v4h-7V4h7M9 11H6V8H4v3H1v2h3v3h2v-3h3v-2Z"})})},{name:"Add right column",action:n=>n.chain().focus().addColumnAfter().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M11 2a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2V2h9m-7 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m11 7h3V8h2v3h3v2h-3v3h-2v-3h-3v-2Z"})})},{name:"Remove row",action:n=>n.chain().focus().deleteRow().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41L9.41 13M22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3M4 9h4V6H4v3m6 0h4V6h-4v3m6 0h4V6h-4v3Z"})})},{name:"Remove column",action:n=>n.chain().focus().deleteColumn().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59L17.59 12Z"})})},{name:"Toggle header row",action:n=>n.chain().focus().toggleHeaderRow().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4Z"})})},{name:"Toggle header column",action:n=>n.chain().focus().toggleHeaderColumn().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M8 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8Z"})})},{name:"Toggle header cell",action:n=>n.chain().focus().toggleHeaderCell().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M21 19a1 1 0 0 1-1 1h-1v-2h2v1m-6 1v-2h2v2h-2m-4 0v-2h2v2h-2m-4 0v-2h2v2H7m-3 0a1 1 0 0 1-1-1v-1h2v2H4M19 4H5a2 2 0 0 0-2 2v2h18V6c0-1.11-.89-2-2-2M5 14H3v2h2v-2m0-4H3v2h2v-2m16 0h-2v2h2v-2m0 4h-2v2h2v-2m-10 2v-2h2v2h-2m0-4v-2h2v2h-2"})})},{name:"Remove table",action:n=>n.chain().focus().deleteTable().run(),icon:w.jsx("svg",{viewBox:"0 0 24 24",children:w.jsx("path",{fill:"currentColor",d:"M12.35 20H10v-3h2.09c.12-.72.37-1.39.72-2H10v-3h4v1.54c.58-.54 1.25-.93 2-1.19V12h4v.35c.75.26 1.42.65 2 1.19V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h9.54c-.54-.58-.93-1.25-1.19-2M16 7h4v3h-4V7m-6 0h4v3h-4V7M8 20H4v-3h4v3m0-5H4v-3h4v3m0-5H4V7h4v3m6.46 5.88l1.42-1.42L18 16.59l2.12-2.13l1.42 1.42L19.41 18l2.13 2.12l-1.42 1.42L18 19.41l-2.12 2.13l-1.42-1.42L16.59 18l-2.13-2.12"})})}],Qm=({node:n,getPos:e,selected:t,editor:r})=>{const[o,i]=b.useState(!1),s=$s(),l=b.useRef(null),a=()=>{const{from:u,to:d}=r.state.selection,f=e(),h=f+n.nodeSize;i(f<=u&&d<=h)};b.useEffect(()=>(r.on("selectionUpdate",a),setTimeout(a,100),()=>{r.off("selectionUpdate",a)}));const c=()=>{var f,h;let u=(f=l.current)==null?void 0:f.clientTop;u&&(u+=5);let d=(h=l.current)==null?void 0:h.clientLeft;return d&&(d+=5),{top:`${u}px`,left:`${d}px`}};return w.jsxs(Ko,{className:"group",children:[w.jsx(yh,{as:"span"}),(o||t)&&w.jsx(AA,{appendTo:document.body,trigger:"click",interactive:!0,animation:"shift-toward-subtle",placement:"right-start",content:w.jsx("article",{className:"dropdown",contentEditable:!1,children:w.jsx("ul",{tabIndex:0,className:"dropdown-content fixed menu menu-compact p-2 shadow bg-base-100 rounded-box w-56",style:c(),children:TA.map(u=>w.jsx("li",{children:w.jsxs("button",{type:"button",className:"button",onClick:()=>u.action(r),children:[w.jsx("span",{children:u.icon}),w.jsx("span",{children:u.name})]})},u.name))})}),children:w.jsx("label",{tabIndex:0,className:fe("trigger-button",{hidden:s}),contentEditable:!1,children:w.jsx(_x,{fontSize:"small"})})})]})},MA=pe.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",ee(this.options.HTMLAttributes,n),0]},addNodeView(){return cr(Qm,{as:"td",className:"relative"})}}),OA=pe.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",ee(this.options.HTMLAttributes,n),0]},addNodeView(){return cr(Qm,{as:"th",className:"relative"})}}),eg=n=>(n.stopPropagation(),n.preventDefault(),n),NA=function(n){const e=n.scrollHeight>n.clientHeight,r=window.getComputedStyle(n).overflowY.indexOf("hidden")!==-1;return e&&!r},tg=function(n){return!n||n===document.body?document.body:NA(n)?n:tg(n.parentNode)},Hc=(n,e,t)=>{const r=document.createElement(n);if(!r)throw new Error(`Element with name ${n} can't be created.`);return e&&Object.entries(e).forEach(([o,i])=>r.setAttribute(o,i)),t&&Object.entries(t).forEach(([o,i])=>r.addEventListener(o,i)),r},DA=pe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",ee(this.options.HTMLAttributes,n),0]},addNodeView(){return({editor:n,HTMLAttributes:e,getPos:t})=>{const r=()=>t(),o=tg(n.options.element);let i=!1;const s={deleteRow:()=>{this.editor.chain().deleteNode("tableRow").focus().run()},selectRow:()=>{const y=r(),k=n.state.doc.resolve(y),C=new W(k);n.view.dispatch(n.state.tr.setSelection(C))}},l=()=>{i=!0},a=()=>{i=!1},c=Hc("section",{class:"absolute hidden flex items-center w-2 bg-gray-200 z-50 cursor-pointer border-1 border-indigo-600 rounded-l opacity-25 hover:opacity-100",contenteditable:"false"},{click:y=>{y&&eg(y),s.selectRow()},mouseenter:()=>{l()},mouseover:()=>{l()},mouseleave:()=>{a(),f()}}),u=Hc("button",{class:"text-sm px-1 absolute -translate-x-[125%] hover:active:-translate-x-[125%] mr-2"},{click:y=>{y&&eg(y),s.deleteRow()}}),d=()=>{m(),c.classList.remove("hidden")},f=()=>{setTimeout(()=>{i||c.classList.add("hidden")},100)},h=Hc("tr",{...e},{mouseenter:d,mouseover:d,mouseleave:f});c.append(u),document.body.append(c);let p="";const m=()=>{setTimeout(()=>{const y=h.getBoundingClientRect(),k=JSON.stringify(y);p!==k&&(c.style.top=`${y.top+document.documentElement.scrollTop}px`,c.style.left=`${y.x+document.documentElement.scrollLeft-8}px`,c.style.height=`${y.height+1}px`,p=k)})};return setTimeout(()=>{m()},100),n.on("selectionUpdate",m),n.on("update",m),o==null||o.addEventListener("scroll",m),document.addEventListener("scroll",m),{dom:h,contentDOM:h,destroy:()=>{c.remove(),n.off("selectionUpdate",m),n.off("update",m),o==null||o.removeEventListener("scroll",m),document.removeEventListener("scroll",m)}}}}}),LA=[vA.configure({resizable:!0}),MA,OA,DA],PA=xh.extend({content:"(dBlock|columns)+"});function ng({types:n,node:e}){return e!=null&&e.type?Array.isArray(n)&&n.includes(e.type)||e.type===n:!1}const RA=ve.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const n=new Ce(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>this.options.notAfter.includes(t.name));return[new ge({key:n,appendTransaction:(t,r,o)=>{const{doc:i,tr:s,schema:l}=o,a=n.getState(o),c=i.content.size,u=l.nodes[this.options.node];if(a)return s.insert(c,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild;return!ng({node:o,types:e})},apply:(t,r)=>{var i,s,l;if(!t.docChanged)return r;const o=(l=(s=(i=t.doc.lastChild)==null?void 0:i.content)==null?void 0:s.content)==null?void 0:l[0];return!ng({node:o,types:e})}}})]}}),IA=({node:n,editor:e,getPos:t})=>{const[r,o]=b.useState(""),i=$s(),s=["https://twitter.com","https://x.com"],l=()=>{switch(n.attrs.data){case"twitter":return w.jsx(ip,{});case"iframe":return w.jsx(sp,{});default:return w.jsx(Qx,{})}},a=()=>{switch(n.attrs.data){case"twitter":return"Embed a Twitter tweet";case"iframe":return"Embed a video";default:return"Embed an URL"}},c=()=>{if(!r){alert("Please enter a url");return}let p=r;if(r.includes("<iframe")){const C=r.match(/src="([^"]*)"/);C&&C.length>0&&(p=C[1])}else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(r):{const C=r.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);C&&C.length>0&&(p=`https://www.youtube.com/embed/${C[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(r):{const C=r.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);C&&C.length>0&&(p=`https://player.vimeo.com/video/${C[1]}`);break}default:{alert("Please enter a valid url");return}}const m=640,g=360,y=t(),k=y+n.nodeSize;p&&(e==null||e.chain().focus(y).deleteRange({from:y,to:k}).setIframe({src:p,width:m,height:g}).run())},u=()=>{if(!r){alert("Please enter a url");return}let p=r;const m=s.some(v=>r.includes(v)),g=r.match(/\/status\/([0-9]*)/),y=g&&g.length>0;if(m&&y)p=g[1];else{alert("invalid url");return}const k=t(),C=k+n.nodeSize;p&&(e==null||e.chain().focus(k).deleteRange({from:k,to:C}).setTweetEmbed({tweetId:p}).run())},f=xp(()=>{switch(n.attrs.data){case"twitter":u();break;default:c();break}},500);b.useEffect(()=>{r&&f()},[r]),b.useEffect(()=>{e==null||e.chain().focus()},[]);const h=b.useRef(null);return b.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]),w.jsx(Ko,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:!i&&w.jsxs("div",{className:"relative w-full",children:[w.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l()}),w.jsx("input",{ref:h,value:r,placeholder:a(),onChange:p=>o(p.target.value),onClick:p=>p.stopPropagation(),className:"bg-stone-200 p-3 pl-10 rounded-xl w-full hover:bg-stone-300 cursor-pointer transition-all ease-in-out"})]})})},FA=pe.create({name:"actionButton",group:"block",content:"block*",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:"rounded-lg bg-stone-500"}}},addAttributes(){return{data:{default:null}}},addNodeView(){return cr(IA)},parseHTML(){return[{tag:"div[data-action-node]"}]},renderHTML({HTMLAttributes:n}){return console.log("action"),["div",ee(n,{"data-action-node":""}),0]},addCommands(){return{setActionButton:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{data:n},content:[]})}}}),$A=[tx,Qw.configure({strike:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bold:{HTMLAttributes:{class:"select-text pointer-events-auto"}},italic:{HTMLAttributes:{class:"select-text pointer-events-auto"}},heading:{HTMLAttributes:{class:"select-text pointer-events-auto"}},paragraph:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bulletList:{HTMLAttributes:{class:"flex flex-col items-start list-disc list-outside space-y-4 ml-6"}},orderedList:{HTMLAttributes:{class:"flex flex-col items-start list-decimal list-outside space-y-4 ml-6"}},listItem:{HTMLAttributes:{class:"leading-normal"}},blockquote:{HTMLAttributes:{class:"rounded-lg bg-stone-100 p-5 font-serif italic text-stone-800"}},codeBlock:{HTMLAttributes:{class:"rounded-lg bg-transparent border border-[#DDE2E4] p-5 font-mono font-medium text-stone-800"}},code:{HTMLAttributes:{class:"rounded-md bg-stone-200 p-1.5 font-mono font-medium text-black text-sm",spellcheck:"false"}},history:!1,gapcursor:!1,dropcursor:!1,document:!1,horizontalRule:!1}),nx.configure({types:["heading","paragraph"]}),dk,Ex.configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),Ax.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),Ox.configure({multicolor:!0}),uk,Px.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),ex,gk,Nx.configure({HTMLAttributes:{class:"not-prose space-y-4 ml-2"}}),Lx.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),kh.configure({width:3,color:"#d1d5db"}),Ch,yE,RA,PA,...LA,Tk.configure({uploadFn:ok}),mk,bk,Ck,FA.extend({addInputRules(){return[rg(/^(?:twt|###|___\s|\*\*\*\s)$/,"twitter",this.type),rg(/^(?:ytb|@@@|___\s|\*\*\*\s)$/,"iframe",this.type)]}}),pk],rg=(n,e,t)=>new Ro({find:n,handler:({state:r,range:o,commands:i})=>{const s={data:e},{tr:l}=r,a=o.from,c=o.to;l.insert(a-1,t.create(s)).delete(l.mapping.map(a),l.mapping.map(c)),i.focus(c-1)}}),og="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M272-200v-560h221q65%200%20120%2040t55%20111q0%2051-23%2078.5T602-491q25%2011%2055.5%2041t30.5%2090q0%2089-65%20124.5T501-200H272Zm121-112h104q48%200%2058.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33%200%2048-17t15-38q0-24-17-39t-44-15h-95v109Z'/%3e%3c/svg%3e",ig="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z'/%3e%3c/svg%3e",sg="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M200-120v-80h560v80H200Zm280-160q-101%200-157-63t-56-167v-330h103v336q0%2056%2028%2091t82%2035q54%200%2082-35t28-91v-336h103v330q0%20104-56%20167t-157%2063Z'/%3e%3c/svg%3e",lg="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_337_2584'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_337_2584)'%3e%3cpath%20d='M8%2018L2%2012L8%206L9.425%207.425L4.825%2012.025L9.4%2016.6L8%2018ZM16%2018L14.575%2016.575L19.175%2011.975L14.6%207.4L16%206L22%2012L16%2018Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",ag="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M486-160q-76%200-135-45t-85-123l88-38q14%2048%2048.5%2079t85.5%2031q42%200%2076-20t34-64q0-18-7-33t-19-27h112q5%2014%207.5%2028.5T694-340q0%2086-61.5%20133T486-160ZM80-480v-80h800v80H80Zm402-326q66%200%20115.5%2032.5T674-674l-88%2039q-9-29-33.5-52T484-710q-41%200-68%2018.5T386-640h-96q2-69%2054.5-117.5T482-806Z'/%3e%3c/svg%3e",cg="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_337_2557'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_337_2557)'%3e%3cpath%20d='M11%2017H7C5.61667%2017%204.4375%2016.5125%203.4625%2015.5375C2.4875%2014.5625%202%2013.3833%202%2012C2%2010.6167%202.4875%209.4375%203.4625%208.4625C4.4375%207.4875%205.61667%207%207%207H11V9H7C6.16667%209%205.45833%209.29167%204.875%209.875C4.29167%2010.4583%204%2011.1667%204%2012C4%2012.8333%204.29167%2013.5417%204.875%2014.125C5.45833%2014.7083%206.16667%2015%207%2015H11V17ZM8%2013V11H16V13H8ZM13%2017V15H17C17.8333%2015%2018.5417%2014.7083%2019.125%2014.125C19.7083%2013.5417%2020%2012.8333%2020%2012C20%2011.1667%2019.7083%2010.4583%2019.125%209.875C18.5417%209.29167%2017.8333%209%2017%209H13V7H17C18.3833%207%2019.5625%207.4875%2020.5375%208.4625C21.5125%209.4375%2022%2010.6167%2022%2012C22%2013.3833%2021.5125%2014.5625%2020.5375%2015.5375C19.5625%2016.5125%2018.3833%2017%2017%2017H13Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",BA=({editor:n,isOpen:e,setIsOpen:t})=>{const r=[{name:"Text",icon:op,command:()=>n.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>n.isActive("paragraph")&&!n.isActive("bulletList")&&!n.isActive("orderedList")},{name:"Heading 1",icon:Qh,command:()=>n.chain().focus().toggleHeading({level:1}).run(),isActive:()=>n.isActive("heading",{level:1})},{name:"Heading 2",icon:ep,command:()=>n.chain().focus().toggleHeading({level:2}).run(),isActive:()=>n.isActive("heading",{level:2})},{name:"Heading 3",icon:tp,command:()=>n.chain().focus().toggleHeading({level:3}).run(),isActive:()=>n.isActive("heading",{level:3})},{name:"To-do List",icon:np,command:()=>n.chain().focus().toggleTaskList().run(),isActive:()=>n.isActive("taskItem")},{name:"Bullet List",icon:rc,command:()=>n.chain().focus().toggleBulletList().run(),isActive:()=>n.isActive("bulletList")},{name:"Numbered List",icon:rc,command:()=>n.chain().focus().toggleOrderedList().run(),isActive:()=>n.isActive("orderedList")},{name:"Quote",icon:rp,command:()=>n.chain().focus().toggleNode("paragraph","paragraph").toggleBlockquote().run(),isActive:()=>n.isActive("blockquote")},{name:"Code",icon:Yh,command:()=>n.chain().focus().toggleCode().run(),isActive:()=>n.isActive("code")}],o=r.filter(i=>i.isActive()).pop()??{name:"Multiple"};return w.jsxs("div",{className:"relative h-full",children:[w.jsxs("button",{className:"flex h-full items-center gap-1 p-2 text-sm font-medium text-stone-600 hover:bg-stone-100 active:bg-stone-200",onClick:()=>t(!e),children:[w.jsx("span",{children:o==null?void 0:o.name}),w.jsx(nc,{className:"h-4 w-4"})]}),e&&w.jsx("section",{className:"fixed top-full z-[99999] mt-1 flex w-48 flex-col overflow-hidden rounded border border-stone-200 bg-white p-1 shadow-xl animate-in fade-in slide-in-from-top-1",children:r.map((i,s)=>w.jsxs("button",{onClick:()=>{i.command(),t(!1)},className:fe("flex items-center justify-between rounded-sm px-2 py-1 text-sm text-stone-600 hover:bg-stone-100",{"text-blue-600":i.isActive()}),children:[w.jsxs("div",{className:"flex items-center space-x-2",children:[w.jsx("div",{className:"rounded-sm border border-stone-200 p-1",children:w.jsx(i.icon,{className:"h-3 w-3"})}),w.jsx("span",{children:i.name})]}),o.name===i.name&&w.jsx(Ls,{className:"h-4 w-4"})]},s))})]})},HA=({editor:n,isOpen:e,setIsOpen:t})=>{const r=[{name:"Default",color:"#000000"},{name:"Purple",color:"#9333EA"},{name:"Red",color:"#E00000"},{name:"Blue",color:"#2563EB"},{name:"Green",color:"#008A00"},{name:"Orange",color:"#FFA500"},{name:"Pink",color:"#BA4081"},{name:"Gray",color:"#A8A29E"}],o=r.find(({color:i})=>n.isActive("textStyle",{color:i}));return w.jsxs("div",{className:"",children:[w.jsxs("button",{className:"flex h-[100%] items-center gap-1 p-2 text-sm font-medium text-stone-600 hover:bg-stone-100 active:bg-stone-200",onClick:()=>t(!e),children:[w.jsx("span",{style:{color:(o==null?void 0:o.color)||"#000000"},children:"A"}),w.jsx(nc,{className:"h-4 w-4 "})]}),e&&w.jsx("section",{className:"fixed top-full z-[99999] mt-1 flex w-48 flex-col overflow-hidden rounded border border-stone-200 bg-white p-1 shadow-xl animate-in fade-in slide-in-from-top-1",children:r.map(({name:i,color:s},l)=>w.jsxs("button",{onClick:()=>{n.chain().focus().setColor(s).run(),t(!1)},className:fe("flex items-center justify-between rounded-sm px-2 py-1 text-sm text-stone-600 hover:bg-stone-100",{"text-blue-600":n.isActive("textStyle",{color:s})}),children:[w.jsxs("div",{className:"flex items-center space-x-2",children:[w.jsx("div",{className:"rounded-sm border border-stone-200 px-1 py-px font-medium",style:{color:s},children:"A"}),w.jsx("span",{children:i})]}),n.isActive("textStyle",{color:s})&&w.jsx(Ls,{className:"h-4 w-4"})]},l))})]})};var oe=(n=>(n[n.NONE=0]="NONE",n[n.HEADING=1]="HEADING",n[n.TEXT_COLOR=2]="TEXT_COLOR",n[n.HIGHLIGHT=3]="HIGHLIGHT",n[n.LINK=4]="LINK",n[n.FONT_FAMILY=5]="FONT_FAMILY",n[n.ALIGNMENT=6]="ALIGNMENT",n[n.LIST=7]="LIST",n))(oe||{});function jA(n){const[e,t]=b.useState(n),r=b.useRef(null),o=i=>{r&&r.current&&!r.current.contains(i.target)&&t(0)};return b.useEffect(()=>(document.addEventListener("click",o,!0),()=>{document.removeEventListener("click",o,!0)}),[]),{ref:r,toolVisibilty:e,setToolVisibility:t}}const zA="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_349_446'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_349_446)'%3e%3cpath%20d='M5.55%2019L2%2015.45L3.4%2014.05L5.525%2016.175L9.775%2011.925L11.175%2013.35L5.55%2019ZM5.55%2011L2%207.45005L3.4%206.05005L5.525%208.17505L9.775%203.92505L11.175%205.35005L5.55%2011ZM13%2017V15H22V17H13ZM13%209.00005V7.00005H22V9.00005H13Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",VA="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_337_2594'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_337_2594)'%3e%3cpath%20d='M3.9751%2017L7.7251%207H9.5251L13.2751%2017H11.5501L10.6501%2014.45H6.6001L5.7001%2017H3.9751ZM7.1251%2013H10.1251L8.6751%208.85H8.5751L7.1251%2013ZM16.3501%2017.275C15.5334%2017.275%2014.8918%2017.0625%2014.4251%2016.6375C13.9584%2016.2125%2013.7251%2015.6333%2013.7251%2014.9C13.7251%2014.2%2013.9959%2013.6292%2014.5376%2013.1875C15.0793%2012.7458%2015.7751%2012.525%2016.6251%2012.525C17.0084%2012.525%2017.3626%2012.5542%2017.6876%2012.6125C18.0126%2012.6708%2018.2918%2012.7667%2018.5251%2012.9V12.55C18.5251%2012.1%2018.3709%2011.7417%2018.0626%2011.475C17.7543%2011.2083%2017.3334%2011.075%2016.8001%2011.075C16.4501%2011.075%2016.1209%2011.15%2015.8126%2011.3C15.5043%2011.45%2015.2418%2011.6667%2015.0251%2011.95L13.9501%2011.15C14.2668%2010.7%2014.6668%2010.3583%2015.1501%2010.125C15.6334%209.89167%2016.1918%209.775%2016.8251%209.775C17.8584%209.775%2018.6501%2010.0208%2019.2001%2010.5125C19.7501%2011.0042%2020.0251%2011.7167%2020.0251%2012.65V17.05H18.5501V16.2H18.4751C18.2584%2016.5333%2017.9668%2016.7958%2017.6001%2016.9875C17.2334%2017.1792%2016.8168%2017.275%2016.3501%2017.275ZM16.6001%2016.025C17.1334%2016.025%2017.5876%2015.8375%2017.9626%2015.4625C18.3376%2015.0875%2018.5251%2014.6333%2018.5251%2014.1C18.2918%2013.9667%2018.0251%2013.8667%2017.7251%2013.8C17.4251%2013.7333%2017.1501%2013.7%2016.9001%2013.7C16.3668%2013.7%2015.9584%2013.8042%2015.6751%2014.0125C15.3918%2014.2208%2015.2501%2014.5167%2015.2501%2014.9C15.2501%2015.2333%2015.3751%2015.5042%2015.6251%2015.7125C15.8751%2015.9208%2016.2001%2016.025%2016.6001%2016.025Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",ug="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_337_2572'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_337_2572)'%3e%3cpath%20d='M9%2019V17H21V19H9ZM9%2013V11H21V13H9ZM9%207V5H21V7H9ZM5%2020C4.45%2020%203.97917%2019.8042%203.5875%2019.4125C3.19583%2019.0208%203%2018.55%203%2018C3%2017.45%203.19583%2016.9792%203.5875%2016.5875C3.97917%2016.1958%204.45%2016%205%2016C5.55%2016%206.02083%2016.1958%206.4125%2016.5875C6.80417%2016.9792%207%2017.45%207%2018C7%2018.55%206.80417%2019.0208%206.4125%2019.4125C6.02083%2019.8042%205.55%2020%205%2020ZM5%2014C4.45%2014%203.97917%2013.8042%203.5875%2013.4125C3.19583%2013.0208%203%2012.55%203%2012C3%2011.45%203.19583%2010.9792%203.5875%2010.5875C3.97917%2010.1958%204.45%2010%205%2010C5.55%2010%206.02083%2010.1958%206.4125%2010.5875C6.80417%2010.9792%207%2011.45%207%2012C7%2012.55%206.80417%2013.0208%206.4125%2013.4125C6.02083%2013.8042%205.55%2014%205%2014ZM5%208C4.45%208%203.97917%207.80417%203.5875%207.4125C3.19583%207.02083%203%206.55%203%206C3%205.45%203.19583%204.97917%203.5875%204.5875C3.97917%204.19583%204.45%204%205%204C5.55%204%206.02083%204.19583%206.4125%204.5875C6.80417%204.97917%207%205.45%207%206C7%206.55%206.80417%207.02083%206.4125%207.4125C6.02083%207.80417%205.55%208%205%208Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",_A="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_349_458'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_349_458)'%3e%3cpath%20d='M3%2022V20.5H5.5V19.75H4V18.25H5.5V17.5H3V16H6C6.28333%2016%206.52083%2016.0958%206.7125%2016.2875C6.90417%2016.4792%207%2016.7167%207%2017V18C7%2018.2833%206.90417%2018.5208%206.7125%2018.7125C6.52083%2018.9042%206.28333%2019%206%2019C6.28333%2019%206.52083%2019.0958%206.7125%2019.2875C6.90417%2019.4792%207%2019.7167%207%2020V21C7%2021.2833%206.90417%2021.5208%206.7125%2021.7125C6.52083%2021.9042%206.28333%2022%206%2022H3ZM3%2015V12.25C3%2011.9667%203.09583%2011.7292%203.2875%2011.5375C3.47917%2011.3458%203.71667%2011.25%204%2011.25H5.5V10.5H3V9H6C6.28333%209%206.52083%209.09583%206.7125%209.2875C6.90417%209.47917%207%209.71667%207%2010V11.75C7%2012.0333%206.90417%2012.2708%206.7125%2012.4625C6.52083%2012.6542%206.28333%2012.75%206%2012.75H4.5V13.5H7V15H3ZM4.5%208V3.5H3V2H6V8H4.5ZM9%2019V17H21V19H9ZM9%2013V11H21V13H9ZM9%207V5H21V7H9Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",WA="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_337_2560'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3crect%20width='24'%20height='24'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_337_2560)'%3e%3cpath%20d='M5%2019V17H19V19H5ZM6.9%2015L11%204H13L17.1%2015H15.2L14.25%2012.2H9.8L8.8%2015H6.9ZM10.35%2010.6H13.65L12.05%206.05H11.95L10.35%2010.6Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/svg%3e",qA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='m228-240%2092-160q-66%200-113-47t-47-113q0-66%2047-113t113-47q66%200%20113%2047t47%20113q0%2023-5.5%2042.5T458-480L320-240h-92Zm360%200%2092-160q-66%200-113-47t-47-113q0-66%2047-113t113-47q66%200%20113%2047t47%20113q0%2023-5.5%2042.5T818-480L680-240h-92ZM320-500q25%200%2042.5-17.5T380-560q0-25-17.5-42.5T320-620q-25%200-42.5%2017.5T260-560q0%2025%2017.5%2042.5T320-500Zm360%200q25%200%2042.5-17.5T740-560q0-25-17.5-42.5T680-620q-25%200-42.5%2017.5T620-560q0%2025%2017.5%2042.5T680-500Zm0-60Zm-360%200Z'/%3e%3c/svg%3e",UA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M200-280v-400h80v160h160v-160h80v400h-80v-160H280v160h-80Zm480%200v-320h-80v-80h160v400h-80Z'/%3e%3c/svg%3e",KA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M120-280v-400h80v160h160v-160h80v400h-80v-160H200v160h-80Zm400%200v-160q0-33%2023.5-56.5T600-520h160v-80H520v-80h240q33%200%2056.5%2023.5T840-600v80q0%2033-23.5%2056.5T760-440H600v80h240v80H520Z'/%3e%3c/svg%3e",JA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M120-280v-400h80v160h160v-160h80v400h-80v-160H200v160h-80Zm400%200v-80h240v-80H600v-80h160v-80H520v-80h240q33%200%2056.5%2023.5T840-600v240q0%2033-23.5%2056.5T760-280H520Z'/%3e%3c/svg%3e",ZA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M680-360q-17%200-28.5-11.5T640-400v-160q0-17%2011.5-28.5T680-600h120q17%200%2028.5%2011.5T840-560v40h-60v-20h-80v120h80v-20h60v40q0%2017-11.5%2028.5T800-360H680Zm-300%200v-240h160q17%200%2028.5%2011.5T580-560v40q0%2017-11.5%2028.5T540-480q17%200%2028.5%2011.5T580-440v40q0%2017-11.5%2028.5T540-360H380Zm60-150h80v-30h-80v30Zm0%2090h80v-30h-80v30Zm-320%2060v-200q0-17%2011.5-28.5T160-600h120q17%200%2028.5%2011.5T320-560v200h-60v-60h-80v60h-60Zm60-120h80v-60h-80v60Z'/%3e%3c/svg%3e",GA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24'%20viewBox='0%20-960%20960%20960'%20width='24'%3e%3cpath%20d='M544-400%20440-504%20240-304l104%20104%20200-200Zm-47-161%20104%20104%20199-199-104-104-199%20199Zm-84-28%20216%20216-229%20229q-24%2024-56%2024t-56-24l-2-2-26%2026H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0%200%20227-227q24-24%2056-24t56%2024l104%20104q24%2024%2024%2056t-24%2056L629-373%20413-589Z'/%3e%3c/svg%3e",YA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M19%205v14H5V5h14m0-2H5c-1.1%200-2%20.9-2%202v14c0%201.1.9%202%202%202h14c1.1%200%202-.9%202-2V5c0-1.1-.9-2-2-2zm-4.86%208.86l-3%203.87L9%2013.14L6%2017h12l-3.86-5.14z'/%3e%3c/svg%3e",dg=({editor:n})=>{const{ref:e,toolVisibilty:t,setToolVisibility:r}=jA(oe.NONE);return{toolbar:[{icon:VA,title:"Font",onClick:()=>r(oe.FONT_FAMILY),isActive:t===oe.FONT_FAMILY},{icon:WA,title:"Text Color",onClick:()=>r(oe.TEXT_COLOR),isActive:t===oe.TEXT_COLOR},{icon:GA,title:"Highlight",onClick:()=>r(oe.HIGHLIGHT),isActive:t===oe.HIGHLIGHT},null,{icon:og,title:"Bold",onClick:()=>n==null?void 0:n.chain().focus().toggleBold().run(),isActive:n==null?void 0:n.isActive("bold")},{icon:ig,title:"Italic",onClick:()=>n==null?void 0:n.chain().focus().toggleItalic().run(),isActive:n==null?void 0:n.isActive("italic")},{icon:sg,title:"Underlined",onClick:()=>n==null?void 0:n.chain().focus().toggleUnderline().run(),isActive:n==null?void 0:n.isActive("underline")},{icon:ag,title:"Strikethrough",onClick:()=>n==null?void 0:n.chain().focus().toggleStrike().run(),isActive:n==null?void 0:n.isActive("strike")},null,{icon:ug,title:"List",onClick:()=>r(oe.LIST),isActive:t===oe.LIST},{icon:oc,title:"Alignment",onClick:()=>r(oe.ALIGNMENT),isActive:t===oe.ALIGNMENT},{icon:qA,title:"Quote",onClick:()=>n==null?void 0:n.chain().focus().toggleBlockquote().run(),isActive:n==null?void 0:n.isActive("blockquote")},null,{icon:YA,title:"Upload Image",onClick:()=>{n==null||n.chain().focus().deleteRange(n.state.selection).run();const i=document.createElement("input");i.type="file",i.accept="image/*",i.onchange=async()=>{var s;if((s=i.files)!=null&&s.length){const l=i.files[0],a=n.view.state.selection.from;lp(l,n.view,a)}},i.click()},isActive:!1},{icon:cg,title:"Link",onClick:()=>r(oe.LINK),isActive:n==null?void 0:n.isActive("link")},{icon:lg,title:"Code",onClick:()=>n==null?void 0:n.chain().focus().toggleCodeBlock().run(),isActive:n==null?void 0:n.isActive("codeBlock")}],toolRef:e,toolVisibilty:t,setToolVisibility:r}},XA=({editor:n,setVisibility:e,elementRef:t})=>{const r=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}];return w.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-[50px] flex flex-wrap left-[20%] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded-md border border-stone-200 bg-white px-1 py-2 shadow-md transition-all",children:[w.jsx(Gh,{className:"cursor-pointer",onClick:()=>{n.chain().focus().unsetHighlight().run(),e(oe.NONE)}}),r.map(o=>w.jsx("div",{onClick:()=>{n.chain().focus().toggleHighlight({color:o.color}).run(),e(oe.NONE)},className:`w-6 ${o.code} drop-shadow rounded-full flex items-center justify-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6`,children:w.jsx(Ls,{size:14,className:`${n.isActive("highlight",{color:o.color})?"visible":"invisible"}`})},o.color))]})},QA=({elementRef:n,editor:e,setToolVisibility:t})=>{const r=[{title:"Trebuchet MS",command:o=>{o.chain().focus().setFontFamily("Trebuchet MS, sans-serif").run()}},{title:"Verdana",command:o=>{o.chain().focus().setFontFamily("Verdana, Geneva, sans-serif").run()}},{title:"Georgia",command:o=>{o.chain().focus().setFontFamily("Georgia, serif").run()}},{title:"Arial",command:o=>{o.chain().focus().setFontFamily("Arial, Helvetica, sans-serif").run()}},{title:"Comic Sans MS",command:o=>{o.chain().focus().setFontFamily("Comic Sans MS, Comic Sans").run()}},{title:"Impact",command:o=>{o.chain().focus().setFontFamily("Impact, Charcoal, sans-serif").run()}},{title:"Palatino",command:o=>{o.chain().focus().setFontFamily("Palatino Linotype, Book Antiqua, Palatino, serif").run()}},{title:"Lucida Grande",command:o=>{o.chain().focus().setFontFamily("Lucida Sans Unicode, Lucida Grande, sans-serif").run()}},{title:"Serif",command:o=>{o.chain().focus().setFontFamily("serif").run()}},{title:"Monospace",command:o=>{o.chain().focus().setFontFamily("monospace").run()}},{title:"Cursive",command:o=>{o.chain().focus().setFontFamily("cursive").run()}}];return w.jsx("div",{ref:n,className:fe("z-50 h-auto absolute top-[50px] left-[20%] max-h-[330px] w-48 overflow-y-auto scroll-smooth rounded-md border border-stone-200 bg-white px-1 py-2 shadow-md transition-all"),children:r.map(o=>w.jsx("button",{onClick:()=>{o.command(e),t(oe.NONE)},style:{fontFamily:o.title},className:`flex w-full ${e.isActive("textStyle",{fontFamily:o.title})?"bg-red-500":""} items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-stone-900 hover:bg-stone-100`,children:w.jsx("p",{className:"font-medium",children:o.title})},o.title))})},eT=({elementRef:n,editor:e,setToolVisibility:t})=>w.jsxs("div",{ref:n,className:fe("z-50 h-auto absolute gap-2 top-[50px] right-[25%] flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded-md border border-stone-200 bg-white px-1 py-2 shadow-md transition-all"),children:[w.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("left").run(),t(oe.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive({textAlign:"left"})&&"bg-[#f2f2f2]"} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:w.jsx("img",{src:oc,alt:"align left"})}),w.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("center").run(),t(oe.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive({textAlign:"center"})&&"bg-[#f2f2f2]"} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:w.jsx("img",{src:pp,alt:"align center"})}),w.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("right").run(),t(oe.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive({textAlign:"right"})&&"bg-[#f2f2f2]"} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:w.jsx("img",{src:mp,alt:"align right"})})]}),tT=({elementRef:n,editor:e,setToolVisibility:t})=>w.jsxs("div",{ref:n,className:fe("z-50 h-auto absolute gap-2 top-[50px] right-[30%] flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded-md border border-stone-200 bg-white px-1 py-2 shadow-md transition-all"),children:[w.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"unordered list",children:w.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleBulletList().run(),t(oe.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("bulletList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:w.jsx("img",{src:ug,alt:"bullet list"})})}),w.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"ordered list",children:w.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleOrderedList().run(),t(oe.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("orderedList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:w.jsx("img",{src:_A,alt:"numbered list"})})}),w.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"to-do list",children:w.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleTaskList().run(),t(oe.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("taskList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:w.jsx("img",{src:zA,alt:"checklist"})})})]}),fg=({elementRef:n,editor:e,setToolVisibility:t,bubbleMenu:r,setIsLinkPopupOpen:o})=>{const[i,s]=b.useState(e.getAttributes("link").href),l=()=>{if(i===null)return;if(i===""){e.chain().focus().extendMarkRange("link").unsetLink().run();return}let a=i;!i.startsWith("http://")&&!i.startsWith("https://")&&(a="https://"+i);try{a.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&e.chain().focus().extendMarkRange("link").setLink({href:a}).run()}catch{console.error("Invalid URL");return}e.chain().focus().extendMarkRange("link").setLink({href:a}).run(),t(oe.NONE),r&&o&&o(!1)};return w.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-[50px] items-center flex right-[10%] max-h-[330px] overflow-y-auto scroll-smooth rounded-md border border-stone-200 bg-white p-2 shadow-md transition-all",children:[w.jsx("input",{onChange:a=>s(a.target.value),className:"border-2 focus:border-black px-2 py-1.5 rounded w-full font-medium text-sm",placeholder:"Add link here",value:i}),w.jsx("div",{className:"h-full flex items-center",children:w.jsx("button",{onClick:()=>l(),className:"min-w-fit",children:"Apply"})})]})},nT=({editor:n,setVisibility:e,elementRef:t})=>{const r=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}];return w.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-[50px] flex flex-wrap left-[100px] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded-md border border-stone-200 bg-white px-1 py-2 shadow-md transition-all",children:[w.jsx(Gh,{className:"cursor-pointer",onClick:()=>{n.chain().focus().unsetColor().run(),e(oe.NONE)}}),r.map(o=>w.jsx("div",{onClick:()=>{n.chain().focus().setColor(o.color).run(),e(oe.NONE)},className:`w-6 ${o.code} drop-shadow rounded-full flex justify-center items-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6`,children:w.jsx(Ls,{size:14,className:`${n.isActive("textStyle",{color:o.color})?"visible":"invisible"}`})},o.color))]})},rT=({editor:n,setVisibility:e,elementRef:t})=>{const r=[{title:"Text",description:"Normal",icon:ZA,command:o=>o.chain().focus().toggleNode("paragraph","paragraph").run()},{title:"Heading 1",description:"Big",icon:UA,command:o=>{o.chain().focus().toggleHeading({level:1}).run()}},{title:"Heading 2",description:"Medium",icon:KA,command:o=>{o.chain().focus().toggleHeading({level:2}).run()}},{title:"Heading 3",description:"Small",icon:JA,command:o=>{o.chain().focus().toggleHeading({level:3}).run()}}];return w.jsx("section",{ref:t,className:fe(" absolute top-[50px] z-50 mt-1 flex w-48 flex-col overflow-hidden rounded border border-stone-200 bg-white p-1 shadow-xl animate-in fade-in slide-in-from-top-1","left-0"),children:r.map(o=>w.jsxs("button",{onClick:()=>{o.command(n),e(oe.NONE)},className:"flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-stone-900 hover:bg-stone-100",children:[w.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-stone-200 bg-white",children:w.jsx("img",{src:o.icon,alt:o.title})}),w.jsxs("div",{children:[w.jsx("p",{className:"font-medium",children:o.title}),w.jsxs("p",{className:"text-xs text-stone-500",children:[" ",o.description," "]})]})]},o.title))})},oT=n=>{const e=[{name:"bold",isActive:()=>n.editor.isActive("bold"),command:()=>n.editor.chain().focus().toggleBold().run(),icon:og},{name:"italic",isActive:()=>n.editor.isActive("italic"),command:()=>n.editor.chain().focus().toggleItalic().run(),icon:ig},{name:"underline",isActive:()=>n.editor.isActive("underline"),command:()=>n.editor.chain().focus().toggleUnderline().run(),icon:sg},{name:"strike",isActive:()=>n.editor.isActive("strike"),command:()=>n.editor.chain().focus().toggleStrike().run(),icon:ag},{name:"codeBlock",isActive:()=>n.editor.isActive("codeBlock"),command:()=>n.editor.chain().focus().toggleCodeBlock().run(),icon:lg},{name:"link",isActive:()=>n.editor.isActive("link"),command:()=>a(!l),icon:cg}],t={...n,shouldShow:({state:d,editor:f})=>{const{selection:h}=d,{empty:p}=h;return!(f.isActive("image")||p||Cf(h))},tippyOptions:{moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",onHidden:()=>{o(!1),s(!1),a(!1)}}},[r,o]=b.useState(!1),[i,s]=b.useState(!1),[l,a]=b.useState(!1),{toolRef:c,setToolVisibility:u}=dg({editor:n.editor});return w.jsxs(ph,{...t,className:"flex gap-1 overflow-hidden rounded border border-stone-200 bg-white shadow-xl",children:[w.jsx(BA,{editor:n.editor,isOpen:r,setIsOpen:()=>{o(!r),s(!1)}}),e.map((d,f)=>w.jsx("button",{onClick:d.command,className:" py-2 text-stone-600 hover:bg-stone-100 active:bg-stone-200",children:w.jsx("img",{src:d.icon,className:fe(" p-1 rounded-lg h-6 w-6",{"bg-yellow-300":d.isActive()})})},f)),w.jsx(HA,{editor:n.editor,isOpen:i,setIsOpen:()=>{s(!i),o(!1)}}),l&&w.jsx(fg,{setToolVisibility:u,editor:n.editor,elementRef:c,bubbleMenu:!0,setIsLinkPopupOpen:a})]})},iT={attributes:{class:"prose-lg prose-headings:font-display prose prose-p:my-2 prose-h1:my-2 prose-h2:my-2 prose-h3:my-2 prose-ul:my-2 prose-ol:my-2 max-w-none focus:outline-none w-full",spellcheck:"false",suppressContentEditableWarning:"true"},handleDOMEvents:{keydown:(n,e)=>{if(["ArrowUp","ArrowDown","Enter"].includes(e.key)&&document.querySelector("#slash-command"))return!0}}};function sT(){const n=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let e=[];for(let t=0;t<36;t++)t===8||t===13||t===18||t===23?e[t]="-":e[t]=n[Math.ceil(Math.random()*n.length-1)];return e.join("")}var lT=sT;const aT=Jc(lT),cT=(n,e)=>{const{view:t,state:{selection:{from:r}}}=n,o=document.querySelectorAll(".has-focus"),i=o.length,l=o[i-1];if(l&&l.getAttribute("data-type")&&l.getAttribute("data-type")===e||l&&l.classList&&l.classList.contains(e))return l;const a=t.domAtPos(r).node;let c=a;for(c.tagName||(c=a.parentElement);c&&!(c.getAttribute("data-type")&&c.getAttribute("data-type")===e)&&!c.classList.contains(e);)c=c.parentElement;return c},uT=({editor:n,appendTo:e})=>{const t=b.useCallback(()=>{const l=cT(n,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[n]),r=b.useCallback(()=>n.isActive("columns"),[n]),o=b.useCallback(()=>{n.chain().focus().setLayout(fr.AlignLeft).run()},[n]),i=b.useCallback(()=>{n.chain().focus().setLayout(fr.AlignRight).run()},[n]),s=b.useCallback(()=>{n.chain().focus().setLayout(fr.AlignCenter).run()},[n]);return w.jsx(ph,{editor:n,pluginKey:`columnsMenu-${aT()}`,shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:t,moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",appendTo:()=>e==null?void 0:e.current,plugins:[q2],sticky:"popper"},children:w.jsxs(ri.Wrapper,{children:[w.jsx(ri.Button,{tooltip:"Align left",active:n.isActive("columns",{layout:fr.AlignLeft}),onClick:o,children:w.jsx(Jx,{size:20})}),w.jsx(ri.Button,{tooltip:"Align center",active:n.isActive("columns",{layout:fr.AlignCenter}),onClick:s,children:w.jsx(Xh,{size:20})}),w.jsx(ri.Button,{tooltip:"Align right",active:n.isActive("columns",{layout:fr.AlignRight}),onClick:i,children:w.jsx(Zx,{size:20})})]})})},dT=({editor:n})=>{const{toolRef:e,toolVisibilty:t,setToolVisibility:r,toolbar:o}=dg({editor:n});return w.jsxs("div",{className:"w-fit bg-transparent px-4 items-center rounded-lg h-16 flex gap-1 justify-center",children:[w.jsxs("button",{className:"hover:bg-[#f2f2f2] border gap-2 rounded-lg w-28 h-8 p-1 flex justify-center items-center",onClick:()=>r(oe.HEADING),children:[w.jsx("span",{className:"text-sm",children:n!=null&&n.isActive("heading",{level:1})?"Heading 1":n!=null&&n.isActive("heading",{level:2})?"Heading 2":n!=null&&n.isActive("heading",{level:3})?"Heading 3":"Text"}),w.jsx(nc,{className:"h-4 w-4"})]}),o.map((i,s)=>i?w.jsx("div",{className:"tooltip tooltip-bottom","data-tip":i.title,children:w.jsx("span",{onClick:()=>i.onClick(),className:fe("rounded-lg w-8 h-8 p-1 flex cursor-pointer justify-center items-center",i.isActive?"bg-yellow-300":"hover:bg-[#f2f2f2]"),children:typeof i.icon=="string"?w.jsx("img",{src:i.icon,className:"w-4"}):i.icon})},i.title):w.jsx("div",{className:" w-[1px] h-[50%] bg-[#777777]"},s)),t===oe.HEADING&&w.jsx(rT,{setVisibility:r,editor:n,elementRef:e}),t===oe.TEXT_COLOR&&w.jsx(nT,{setVisibility:r,editor:n,elementRef:e}),t===oe.HIGHLIGHT&&w.jsx(XA,{setVisibility:r,editor:n,elementRef:e}),t===oe.FONT_FAMILY&&w.jsx(QA,{setToolVisibility:r,editor:n,elementRef:e}),t===oe.ALIGNMENT&&w.jsx(eT,{setToolVisibility:r,editor:n,elementRef:e}),t===oe.LIST&&w.jsx(tT,{setToolVisibility:r,editor:n,elementRef:e}),t===oe.LINK&&w.jsx(fg,{setToolVisibility:r,editor:n,elementRef:e})]})},fT=({isPreviewMode:n=!1,onPublish:e,data:t,togglePreviewMode:r})=>{const[o,i]=b.useState({cover:{image:null,emoji:null,name:null},plugin:{title:null}}),s=Q2({extensions:[...$A],editorProps:iT,autofocus:"start"}),l=b.useRef(null),a=c=>{var u;(u=l.current)!=null&&u.contains(c.target)||s==null||s.chain().focus().run()};return b.useEffect(()=>{s==null||s.chain().focus()},[]),b.useEffect(()=>{s==null||s.setEditable(!n)},[n]),b.useEffect(()=>{t&&s&&(s==null||s.commands.setContent(t))},[t,s]),s?w.jsx("div",{"data-cy":"single-webpage",className:"h-screen w-screen bg-[#f9fbfd]",children:w.jsx("div",{className:"h-full flex flex-col overflow-scroll no-scrollbar",children:w.jsxs("div",{className:"w-full h-screen",children:[w.jsx("div",{className:"h-fit relative bg-[#ffffff]",children:w.jsxs("div",{className:"flex items-center justify-center pl-4 pr-4 border-b-1 border gap-2 h-16",children:[w.jsx("div",{className:"grow",children:w.jsx(wg,{metaData:o,setMetaData:i})}),!n&&w.jsx("div",{className:"grow relative",children:w.jsx(dT,{editor:s})}),w.jsx("div",{children:w.jsx(tl,{onClick:()=>r(n),children:n?"Edit":"Preview"})}),e&&w.jsx("div",{onClick:()=>e({metaData:o,editorJSONData:s.getJSON()}),className:"cursor-pointer",children:w.jsx(tl,{children:"Publish"})})]})}),w.jsx("main",{className:"h-screen lg:h-full w-full rounded-[8px] flex flex-col justify-start items-center gap-2",children:w.jsx("div",{onClick:a,className:"w-full flex justify-center relative",children:w.jsx("div",{className:"p-[96px] mt-4 min-h-[900px] shadow-inner bg-white overflow-scroll no-scrollbar rounded-md w-[70%] max-w-[856px]",children:w.jsxs("div",{ref:l,className:"w-full pt-4 h-full",children:[!n&&w.jsxs("div",{children:[w.jsx(oT,{editor:s}),w.jsx(uT,{editor:s,appendTo:l})]}),w.jsx(vk,{isPreviewMode:n,children:w.jsx(Y2,{editor:s})})]})})})})]})})}):w.jsxs("div",{className:" w-screen h-screen flex flex-col gap-4 justify-center items-center",children:[w.jsx(wp,{}),w.jsx("p",{children:"Loading Editor..."})]})};et.DdocEditor=fT,Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})});