@cyberskill/cyber-editor 3.5.1 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,45 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),qr=require("react-dom"),ft=require("antd");function bd(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var ro={exports:{}},ir={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),qr=require("react-dom"),ft=require("antd");function xd(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var ro={exports:{}},In={};/**
2
2
  * @license React
3
- * react-jsx-dev-runtime.production.min.js
3
+ * react-jsx-runtime.production.min.js
4
4
  *
5
5
  * Copyright (c) Facebook, Inc. and its affiliates.
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Os;function vd(){if(Os)return ir;Os=1;var n=Symbol.for("react.fragment");return ir.Fragment=n,ir.jsxDEV=void 0,ir}var or={};/**
9
+ */var Ns;function wd(){if(Ns)return In;Ns=1;var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={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)&&!o.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:i.current}}return In.Fragment=t,In.jsx=s,In.jsxs=s,In}var _n={};/**
10
10
  * @license React
11
- * react-jsx-dev-runtime.development.js
11
+ * react-jsx-runtime.development.js
12
12
  *
13
13
  * Copyright (c) Facebook, Inc. and its affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ds;function xd(){return Ds||(Ds=1,process.env.NODE_ENV!=="production"&&function(){var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=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(y){if(y===null||typeof y!="object")return null;var E=p&&y[p]||y[m];return typeof E=="function"?E:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(y){{for(var E=arguments.length,A=new Array(E>1?E-1:0),$=1;$<E;$++)A[$-1]=arguments[$];S("error",y,A)}}function S(y,E,A){{var $=b.ReactDebugCurrentFrame,te=$.getStackAddendum();te!==""&&(E+="%s",A=A.concat([te]));var se=A.map(function(Z){return String(Z)});se.unshift("Warning: "+E),Function.prototype.apply.call(console[y],console,se)}}var k=!1,v=!1,N=!1,O=!1,B=!1,_;_=Symbol.for("react.module.reference");function oe(y){return!!(typeof y=="string"||typeof y=="function"||y===r||y===o||B||y===i||y===c||y===u||O||y===h||k||v||N||typeof y=="object"&&y!==null&&(y.$$typeof===f||y.$$typeof===d||y.$$typeof===s||y.$$typeof===l||y.$$typeof===a||y.$$typeof===_||y.getModuleId!==void 0))}function ge(y,E,A){var $=y.displayName;if($)return $;var te=E.displayName||E.name||"";return te!==""?A+"("+te+")":A}function Ee(y){return y.displayName||"Context"}function ye(y){if(y==null)return null;if(typeof y.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case r:return"Fragment";case t:return"Portal";case o:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof y=="object")switch(y.$$typeof){case l:var E=y;return Ee(E)+".Consumer";case s:var A=y;return Ee(A._context)+".Provider";case a:return ge(y,y.render,"ForwardRef");case d:var $=y.displayName||null;return $!==null?$:ye(y.type)||"Memo";case f:{var te=y,se=te._payload,Z=te._init;try{return ye(Z(se))}catch{return null}}}return null}var pe=Object.assign,We=0,xe,Ne,ut,vt,M,R,K;function U(){}U.__reactDisabledLog=!0;function j(){{if(We===0){xe=console.log,Ne=console.info,ut=console.warn,vt=console.error,M=console.group,R=console.groupCollapsed,K=console.groupEnd;var y={configurable:!0,enumerable:!0,value:U,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}We++}}function X(){{if(We--,We===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:pe({},y,{value:xe}),info:pe({},y,{value:Ne}),warn:pe({},y,{value:ut}),error:pe({},y,{value:vt}),group:pe({},y,{value:M}),groupCollapsed:pe({},y,{value:R}),groupEnd:pe({},y,{value:K})})}We<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var F=b.ReactCurrentDispatcher,W;function J(y,E,A){{if(W===void 0)try{throw Error()}catch(te){var $=te.stack.trim().match(/\n( *(at )?)/);W=$&&$[1]||""}return`
18
- `+W+y}}var Q=!1,Y;{var Ae=typeof WeakMap=="function"?WeakMap:Map;Y=new Ae}function D(y,E){if(!y||Q)return"";{var A=Y.get(y);if(A!==void 0)return A}var $;Q=!0;var te=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var se;se=F.current,F.current=null,j();try{if(E){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(qe){$=qe}Reflect.construct(y,[],Z)}else{try{Z.call()}catch(qe){$=qe}y.call(Z.prototype)}}else{try{throw Error()}catch(qe){$=qe}y()}}catch(qe){if(qe&&$&&typeof qe.stack=="string"){for(var G=qe.stack.split(`
19
- `),Ve=$.stack.split(`
20
- `),me=G.length-1,be=Ve.length-1;me>=1&&be>=0&&G[me]!==Ve[be];)be--;for(;me>=1&&be>=0;me--,be--)if(G[me]!==Ve[be]){if(me!==1||be!==1)do if(me--,be--,be<0||G[me]!==Ve[be]){var nt=`
21
- `+G[me].replace(" at new "," at ");return y.displayName&&nt.includes("<anonymous>")&&(nt=nt.replace("<anonymous>",y.displayName)),typeof y=="function"&&Y.set(y,nt),nt}while(me>=1&&be>=0);break}}}finally{Q=!1,F.current=se,X(),Error.prepareStackTrace=te}var pn=y?y.displayName||y.name:"",Ut=pn?J(pn):"";return typeof y=="function"&&Y.set(y,Ut),Ut}function tt(y,E,A){return D(y,!1)}function fn(y){var E=y.prototype;return!!(E&&E.isReactComponent)}function qt(y,E,A){if(y==null)return"";if(typeof y=="function")return D(y,fn(y));if(typeof y=="string")return J(y);switch(y){case c:return J("Suspense");case u:return J("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case a:return tt(y.render);case d:return qt(y.type,E,A);case f:{var $=y,te=$._payload,se=$._init;try{return qt(se(te),E,A)}catch{}}}return""}var Rn=Object.prototype.hasOwnProperty,ys={},bs=b.ReactDebugCurrentFrame;function rr(y){if(y){var E=y._owner,A=qt(y.type,y._source,E?E.type:null);bs.setExtraStackFrame(A)}else bs.setExtraStackFrame(null)}function Zu(y,E,A,$,te){{var se=Function.call.bind(Rn);for(var Z in y)if(se(y,Z)){var G=void 0;try{if(typeof y[Z]!="function"){var Ve=Error(($||"React class")+": "+A+" type `"+Z+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof y[Z]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ve.name="Invariant Violation",Ve}G=y[Z](E,Z,$,A,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(me){G=me}G&&!(G instanceof Error)&&(rr(te),x("%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).",$||"React class",A,Z,typeof G),rr(null)),G instanceof Error&&!(G.message in ys)&&(ys[G.message]=!0,rr(te),x("Failed %s type: %s",A,G.message),rr(null))}}}var Qu=Array.isArray;function pi(y){return Qu(y)}function ed(y){{var E=typeof Symbol=="function"&&Symbol.toStringTag,A=E&&y[Symbol.toStringTag]||y.constructor.name||"Object";return A}}function td(y){try{return vs(y),!1}catch{return!0}}function vs(y){return""+y}function xs(y){if(td(y))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ed(y)),vs(y)}var Pn=b.ReactCurrentOwner,nd={key:!0,ref:!0,__self:!0,__source:!0},Ss,ws,mi;mi={};function rd(y){if(Rn.call(y,"ref")){var E=Object.getOwnPropertyDescriptor(y,"ref").get;if(E&&E.isReactWarning)return!1}return y.ref!==void 0}function id(y){if(Rn.call(y,"key")){var E=Object.getOwnPropertyDescriptor(y,"key").get;if(E&&E.isReactWarning)return!1}return y.key!==void 0}function od(y,E){if(typeof y.ref=="string"&&Pn.current&&E&&Pn.current.stateNode!==E){var A=ye(Pn.current.type);mi[A]||(x('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',ye(Pn.current.type),y.ref),mi[A]=!0)}}function sd(y,E){{var A=function(){Ss||(Ss=!0,x("%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)",E))};A.isReactWarning=!0,Object.defineProperty(y,"key",{get:A,configurable:!0})}}function ld(y,E){{var A=function(){ws||(ws=!0,x("%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)",E))};A.isReactWarning=!0,Object.defineProperty(y,"ref",{get:A,configurable:!0})}}var ad=function(y,E,A,$,te,se,Z){var G={$$typeof:e,type:y,key:E,ref:A,props:Z,_owner:se};return G._store={},Object.defineProperty(G._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(G,"_self",{configurable:!1,enumerable:!1,writable:!1,value:$}),Object.defineProperty(G,"_source",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.freeze&&(Object.freeze(G.props),Object.freeze(G)),G};function cd(y,E,A,$,te){{var se,Z={},G=null,Ve=null;A!==void 0&&(xs(A),G=""+A),id(E)&&(xs(E.key),G=""+E.key),rd(E)&&(Ve=E.ref,od(E,te));for(se in E)Rn.call(E,se)&&!nd.hasOwnProperty(se)&&(Z[se]=E[se]);if(y&&y.defaultProps){var me=y.defaultProps;for(se in me)Z[se]===void 0&&(Z[se]=me[se])}if(G||Ve){var be=typeof y=="function"?y.displayName||y.name||"Unknown":y;G&&sd(Z,be),Ve&&ld(Z,be)}return ad(y,G,Ve,te,$,Pn.current,Z)}}var gi=b.ReactCurrentOwner,ks=b.ReactDebugCurrentFrame;function hn(y){if(y){var E=y._owner,A=qt(y.type,y._source,E?E.type:null);ks.setExtraStackFrame(A)}else ks.setExtraStackFrame(null)}var yi;yi=!1;function bi(y){return typeof y=="object"&&y!==null&&y.$$typeof===e}function Cs(){{if(gi.current){var y=ye(gi.current.type);if(y)return`
17
+ */var Rs;function kd(){return Rs||(Rs=1,process.env.NODE_ENV!=="production"&&function(){var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=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(y){if(y===null||typeof y!="object")return null;var M=p&&y[p]||y[m];return typeof M=="function"?M:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(y){{for(var M=arguments.length,R=new Array(M>1?M-1:0),j=1;j<M;j++)R[j-1]=arguments[j];x("error",y,R)}}function x(y,M,R){{var j=b.ReactDebugCurrentFrame,te=j.getStackAddendum();te!==""&&(M+="%s",R=R.concat([te]));var se=R.map(function(Z){return String(Z)});se.unshift("Warning: "+M),Function.prototype.apply.call(console[y],console,se)}}var k=!1,v=!1,T=!1,A=!1,$=!1,_;_=Symbol.for("react.module.reference");function oe(y){return!!(typeof y=="string"||typeof y=="function"||y===r||y===o||$||y===i||y===c||y===u||A||y===h||k||v||T||typeof y=="object"&&y!==null&&(y.$$typeof===f||y.$$typeof===d||y.$$typeof===s||y.$$typeof===l||y.$$typeof===a||y.$$typeof===_||y.getModuleId!==void 0))}function ge(y,M,R){var j=y.displayName;if(j)return j;var te=M.displayName||M.name||"";return te!==""?R+"("+te+")":R}function Me(y){return y.displayName||"Context"}function ye(y){if(y==null)return null;if(typeof y.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case r:return"Fragment";case t:return"Portal";case o:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof y=="object")switch(y.$$typeof){case l:var M=y;return Me(M)+".Consumer";case s:var R=y;return Me(R._context)+".Provider";case a:return ge(y,y.render,"ForwardRef");case d:var j=y.displayName||null;return j!==null?j:ye(y.type)||"Memo";case f:{var te=y,se=te._payload,Z=te._init;try{return ye(Z(se))}catch{return null}}}return null}var pe=Object.assign,We=0,Se,Te,ut,vt,E,D,K;function U(){}U.__reactDisabledLog=!0;function F(){{if(We===0){Se=console.log,Te=console.info,ut=console.warn,vt=console.error,E=console.group,D=console.groupCollapsed,K=console.groupEnd;var y={configurable:!0,enumerable:!0,value:U,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}We++}}function X(){{if(We--,We===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:pe({},y,{value:Se}),info:pe({},y,{value:Te}),warn:pe({},y,{value:ut}),error:pe({},y,{value:vt}),group:pe({},y,{value:E}),groupCollapsed:pe({},y,{value:D}),groupEnd:pe({},y,{value:K})})}We<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=b.ReactCurrentDispatcher,W;function J(y,M,R){{if(W===void 0)try{throw Error()}catch(te){var j=te.stack.trim().match(/\n( *(at )?)/);W=j&&j[1]||""}return`
18
+ `+W+y}}var Q=!1,Y;{var Re=typeof WeakMap=="function"?WeakMap:Map;Y=new Re}function N(y,M){if(!y||Q)return"";{var R=Y.get(y);if(R!==void 0)return R}var j;Q=!0;var te=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var se;se=H.current,H.current=null,F();try{if(M){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(qe){j=qe}Reflect.construct(y,[],Z)}else{try{Z.call()}catch(qe){j=qe}y.call(Z.prototype)}}else{try{throw Error()}catch(qe){j=qe}y()}}catch(qe){if(qe&&j&&typeof qe.stack=="string"){for(var G=qe.stack.split(`
19
+ `),Be=j.stack.split(`
20
+ `),me=G.length-1,be=Be.length-1;me>=1&&be>=0&&G[me]!==Be[be];)be--;for(;me>=1&&be>=0;me--,be--)if(G[me]!==Be[be]){if(me!==1||be!==1)do if(me--,be--,be<0||G[me]!==Be[be]){var nt=`
21
+ `+G[me].replace(" at new "," at ");return y.displayName&&nt.includes("<anonymous>")&&(nt=nt.replace("<anonymous>",y.displayName)),typeof y=="function"&&Y.set(y,nt),nt}while(me>=1&&be>=0);break}}}finally{Q=!1,H.current=se,X(),Error.prepareStackTrace=te}var pn=y?y.displayName||y.name:"",Ut=pn?J(pn):"";return typeof y=="function"&&Y.set(y,Ut),Ut}function tt(y,M,R){return N(y,!1)}function fn(y){var M=y.prototype;return!!(M&&M.isReactComponent)}function qt(y,M,R){if(y==null)return"";if(typeof y=="function")return N(y,fn(y));if(typeof y=="string")return J(y);switch(y){case c:return J("Suspense");case u:return J("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case a:return tt(y.render);case d:return qt(y.type,M,R);case f:{var j=y,te=j._payload,se=j._init;try{return qt(se(te),M,R)}catch{}}}return""}var Dn=Object.prototype.hasOwnProperty,ys={},bs=b.ReactDebugCurrentFrame;function or(y){if(y){var M=y._owner,R=qt(y.type,y._source,M?M.type:null);bs.setExtraStackFrame(R)}else bs.setExtraStackFrame(null)}function Qu(y,M,R,j,te){{var se=Function.call.bind(Dn);for(var Z in y)if(se(y,Z)){var G=void 0;try{if(typeof y[Z]!="function"){var Be=Error((j||"React class")+": "+R+" type `"+Z+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof y[Z]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Be.name="Invariant Violation",Be}G=y[Z](M,Z,j,R,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(me){G=me}G&&!(G instanceof Error)&&(or(te),S("%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).",j||"React class",R,Z,typeof G),or(null)),G instanceof Error&&!(G.message in ys)&&(ys[G.message]=!0,or(te),S("Failed %s type: %s",R,G.message),or(null))}}}var ed=Array.isArray;function pi(y){return ed(y)}function td(y){{var M=typeof Symbol=="function"&&Symbol.toStringTag,R=M&&y[Symbol.toStringTag]||y.constructor.name||"Object";return R}}function nd(y){try{return vs(y),!1}catch{return!0}}function vs(y){return""+y}function Ss(y){if(nd(y))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",td(y)),vs(y)}var Pn=b.ReactCurrentOwner,rd={key:!0,ref:!0,__self:!0,__source:!0},xs,ws,mi;mi={};function id(y){if(Dn.call(y,"ref")){var M=Object.getOwnPropertyDescriptor(y,"ref").get;if(M&&M.isReactWarning)return!1}return y.ref!==void 0}function od(y){if(Dn.call(y,"key")){var M=Object.getOwnPropertyDescriptor(y,"key").get;if(M&&M.isReactWarning)return!1}return y.key!==void 0}function sd(y,M){if(typeof y.ref=="string"&&Pn.current&&M&&Pn.current.stateNode!==M){var R=ye(Pn.current.type);mi[R]||(S('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',ye(Pn.current.type),y.ref),mi[R]=!0)}}function ld(y,M){{var R=function(){xs||(xs=!0,S("%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)",M))};R.isReactWarning=!0,Object.defineProperty(y,"key",{get:R,configurable:!0})}}function ad(y,M){{var R=function(){ws||(ws=!0,S("%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)",M))};R.isReactWarning=!0,Object.defineProperty(y,"ref",{get:R,configurable:!0})}}var cd=function(y,M,R,j,te,se,Z){var G={$$typeof:e,type:y,key:M,ref:R,props:Z,_owner:se};return G._store={},Object.defineProperty(G._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(G,"_self",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.defineProperty(G,"_source",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.freeze&&(Object.freeze(G.props),Object.freeze(G)),G};function ud(y,M,R,j,te){{var se,Z={},G=null,Be=null;R!==void 0&&(Ss(R),G=""+R),od(M)&&(Ss(M.key),G=""+M.key),id(M)&&(Be=M.ref,sd(M,te));for(se in M)Dn.call(M,se)&&!rd.hasOwnProperty(se)&&(Z[se]=M[se]);if(y&&y.defaultProps){var me=y.defaultProps;for(se in me)Z[se]===void 0&&(Z[se]=me[se])}if(G||Be){var be=typeof y=="function"?y.displayName||y.name||"Unknown":y;G&&ld(Z,be),Be&&ad(Z,be)}return cd(y,G,Be,te,j,Pn.current,Z)}}var gi=b.ReactCurrentOwner,ks=b.ReactDebugCurrentFrame;function hn(y){if(y){var M=y._owner,R=qt(y.type,y._source,M?M.type:null);ks.setExtraStackFrame(R)}else ks.setExtraStackFrame(null)}var yi;yi=!1;function bi(y){return typeof y=="object"&&y!==null&&y.$$typeof===e}function Cs(){{if(gi.current){var y=ye(gi.current.type);if(y)return`
22
22
 
23
- Check the render method of \``+y+"`."}return""}}function ud(y){{if(y!==void 0){var E=y.fileName.replace(/^.*[\\\/]/,""),A=y.lineNumber;return`
23
+ Check the render method of \``+y+"`."}return""}}function dd(y){return""}var Ms={};function fd(y){{var M=Cs();if(!M){var R=typeof y=="string"?y:y.displayName||y.name;R&&(M=`
24
24
 
25
- Check your code at `+E+":"+A+"."}return""}}var Es={};function dd(y){{var E=Cs();if(!E){var A=typeof y=="string"?y:y.displayName||y.name;A&&(E=`
26
-
27
- Check the top-level render call using <`+A+">.")}return E}}function Ns(y,E){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var A=dd(E);if(Es[A])return;Es[A]=!0;var $="";y&&y._owner&&y._owner!==gi.current&&($=" It was passed a child from "+ye(y._owner.type)+"."),hn(y),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',A,$),hn(null)}}function Ms(y,E){{if(typeof y!="object")return;if(pi(y))for(var A=0;A<y.length;A++){var $=y[A];bi($)&&Ns($,E)}else if(bi(y))y._store&&(y._store.validated=!0);else if(y){var te=g(y);if(typeof te=="function"&&te!==y.entries)for(var se=te.call(y),Z;!(Z=se.next()).done;)bi(Z.value)&&Ns(Z.value,E)}}}function fd(y){{var E=y.type;if(E==null||typeof E=="string")return;var A;if(typeof E=="function")A=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===a||E.$$typeof===d))A=E.propTypes;else return;if(A){var $=ye(E);Zu(A,y.props,"prop",$,y)}else if(E.PropTypes!==void 0&&!yi){yi=!0;var te=ye(E);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",te||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hd(y){{for(var E=Object.keys(y.props),A=0;A<E.length;A++){var $=E[A];if($!=="children"&&$!=="key"){hn(y),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$),hn(null);break}}y.ref!==null&&(hn(y),x("Invalid attribute `ref` supplied to `React.Fragment`."),hn(null))}}var Ts={};function pd(y,E,A,$,te,se){{var Z=oe(y);if(!Z){var G="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(G+=" 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 Ve=ud(te);Ve?G+=Ve:G+=Cs();var me;y===null?me="null":pi(y)?me="array":y!==void 0&&y.$$typeof===e?(me="<"+(ye(y.type)||"Unknown")+" />",G=" Did you accidentally export a JSX literal instead of a component?"):me=typeof y,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,G)}var be=cd(y,E,A,te,se);if(be==null)return be;if(Z){var nt=E.children;if(nt!==void 0)if($)if(pi(nt)){for(var pn=0;pn<nt.length;pn++)Ms(nt[pn],y);Object.freeze&&Object.freeze(nt)}else x("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 Ms(nt,y)}if(Rn.call(E,"key")){var Ut=ye(y),qe=Object.keys(E).filter(function(yd){return yd!=="key"}),vi=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!Ts[Ut+vi]){var gd=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+R+">.")}return M}}function Ts(y,M){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var R=fd(M);if(Ms[R])return;Ms[R]=!0;var j="";y&&y._owner&&y._owner!==gi.current&&(j=" It was passed a child from "+ye(y._owner.type)+"."),hn(y),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',R,j),hn(null)}}function Es(y,M){{if(typeof y!="object")return;if(pi(y))for(var R=0;R<y.length;R++){var j=y[R];bi(j)&&Ts(j,M)}else if(bi(y))y._store&&(y._store.validated=!0);else if(y){var te=g(y);if(typeof te=="function"&&te!==y.entries)for(var se=te.call(y),Z;!(Z=se.next()).done;)bi(Z.value)&&Ts(Z.value,M)}}}function hd(y){{var M=y.type;if(M==null||typeof M=="string")return;var R;if(typeof M=="function")R=M.propTypes;else if(typeof M=="object"&&(M.$$typeof===a||M.$$typeof===d))R=M.propTypes;else return;if(R){var j=ye(M);Qu(R,y.props,"prop",j,y)}else if(M.PropTypes!==void 0&&!yi){yi=!0;var te=ye(M);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",te||"Unknown")}typeof M.getDefaultProps=="function"&&!M.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pd(y){{for(var M=Object.keys(y.props),R=0;R<M.length;R++){var j=M[R];if(j!=="children"&&j!=="key"){hn(y),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",j),hn(null);break}}y.ref!==null&&(hn(y),S("Invalid attribute `ref` supplied to `React.Fragment`."),hn(null))}}var Os={};function As(y,M,R,j,te,se){{var Z=oe(y);if(!Z){var G="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(G+=" 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 Be=dd();Be?G+=Be:G+=Cs();var me;y===null?me="null":pi(y)?me="array":y!==void 0&&y.$$typeof===e?(me="<"+(ye(y.type)||"Unknown")+" />",G=" Did you accidentally export a JSX literal instead of a component?"):me=typeof y,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,G)}var be=ud(y,M,R,te,se);if(be==null)return be;if(Z){var nt=M.children;if(nt!==void 0)if(j)if(pi(nt)){for(var pn=0;pn<nt.length;pn++)Es(nt[pn],y);Object.freeze&&Object.freeze(nt)}else S("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 Es(nt,y)}if(Dn.call(M,"key")){var Ut=ye(y),qe=Object.keys(M).filter(function(Sd){return Sd!=="key"}),vi=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!Os[Ut+vi]){var vd=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
28
26
  let props = %s;
29
27
  <%s {...props} />
30
28
  React keys must be passed directly to JSX without using spread:
31
29
  let props = %s;
32
- <%s key={someKey} {...props} />`,vi,Ut,gd,Ut),Ts[Ut+vi]=!0}}return y===r?hd(be):fd(be),be}}var md=pd;or.Fragment=r,or.jsxDEV=md}()),or}process.env.NODE_ENV==="production"?ro.exports=vd():ro.exports=xd();var w=ro.exports;function Me(n){this.content=n}Me.prototype={constructor:Me,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,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Me(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Me(t)},addToStart:function(n,e){return new Me([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Me(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Me(i)},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=Me.from(n),n.size?new Me(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Me.from(n),n.size?new Me(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Me.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}};Me.from=function(n){if(n instanceof Me)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Me(e)};function Oa(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Oa(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Da(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),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=Da(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class C{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,i=0,o){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||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,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",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?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new C(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let l=this.content[o],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),i+=l.nodeSize),s=a}return new C(r,i)}cutByIndex(e,t){return e==t?C.empty:e==0&&t==this.content.length?this:new C(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new C(i,o)}addToStart(e){return new C([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new C(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Oa(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Da(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sr(0,e);if(e==this.size)return sr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?sr(r+1,s):sr(r,i);i=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 C.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new C(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return C.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new C(t||e,r)}static from(e){if(!e)return C.empty;if(e instanceof C)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new C([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}C.empty=new C([],0);const xi={index:0,offset:0};function sr(n,e){return xi.index=n,xi.offset=e,xi}function Nr(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(!Nr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Nr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let le=class io{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}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&&Nr(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`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 io.none;if(e instanceof io)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};le.none=[];class Mr extends Error{}class T{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=Ra(this.content,e+this.openStart,t);return r&&new T(r,this.openStart,this.openEnd)}removeBetween(e,t){return new T(Aa(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 T.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(C.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new T(e,r,i)}}T.empty=new T(C.empty,0,0);function Aa(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.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,o.copy(Aa(o.content,e-i-1,t-i-1)))}function Ra(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Ra(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Sd(n,e,t){if(t.openStart>n.depth)throw new Mr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Mr("Inconsistent open depths");return Pa(n,e,t,0)}function Pa(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Pa(n,e,t,r+1);return o.copy(o.content.replaceChild(i,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 Qt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=wd(t,n);return Qt(o,_a(n,s,l,e,r))}else return Qt(o,Tr(n,e,r))}function Ia(n,e){if(!e.type.compatibleContent(n.type))throw new Mr("Cannot join "+e.type.name+" onto "+n.type.name)}function oo(n,e,t){let r=n.node(t);return Ia(r,e.node(t)),r}function Zt(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 $n(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Zt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)Zt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Zt(e.nodeBefore,r)}function Qt(n,e){return n.type.checkContent(e),n.copy(e)}function _a(n,e,t,r,i){let o=n.depth>i&&oo(n,e,i+1),s=r.depth>i&&oo(t,r,i+1),l=[];return $n(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Ia(o,s),Zt(Qt(o,_a(n,e,t,r,i+1)),l)):(o&&Zt(Qt(o,Tr(n,e,i+1)),l),$n(e,t,i,l),s&&Zt(Qt(s,Tr(t,r,i+1)),l)),$n(r,null,i,l),new C(l)}function Tr(n,e,t){let r=[];if($n(null,n,t,r),n.depth>t){let i=oo(n,e,t+1);Zt(Qt(i,Tr(n,e,t+1)),r)}return $n(e,null,t,r),new C(r)}function wd(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(C.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Wn{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],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].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 Or(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=[],i=0,o=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new Wn(t,r,o)}static resolveCached(e,t){let r=As.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else As.set(e,r=new kd);let i=r.elts[r.i]=Wn.resolve(e,t);return r.i=(r.i+1)%Cd,i}}class kd{constructor(){this.elts=[],this.i=0}}const Cd=12,As=new WeakMap;class Or{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 Ed=Object.create(null);let zt=class so{constructor(e,t,r,i=le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.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,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Nr(this.attrs,t||e.defaultAttrs||Ed)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new so(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new so(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 T.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new T(c,i.depth-s,o.depth-s)}replace(e,t,r){return Sd(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Wn.resolveCached(this,e)}resolveNoCache(e){return Wn.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),za(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=C.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.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),this.type.checkAttrs(this.attrs);let e=le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.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;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 i=C.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};zt.prototype.text=void 0;class Dr extends zt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):za(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 Dr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Dr(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 za(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class rn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Nd(e,t);if(r.next==null)return rn.empty;let i=La(r);r.next&&r.err("Unexpected trailing text");let o=Pd(Rd(i));return Id(o,r),o}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 i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let 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 i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return C.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())&&i.indexOf(d)==-1){i.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(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 i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
33
- `)}}rn.empty=new rn(!0);class Nd{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 La(n){let e=[];do e.push(Md(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Md(n){let e=[];do e.push(Td(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Td(n){let e=Ad(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=Od(n,e);else break;return e}function Rs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Od(n,e){let t=Rs(n),r=t;return n.eat(",")&&(n.next!="}"?r=Rs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Dd(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Ad(n){if(n.eat("(")){let e=La(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=Dd(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 Rd(n){let e=[[]];return i(o(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 i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),i(o(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 Va(n,e){return e-n}function Ps(n,e){let t=[];return r(e),t.sort(Va);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Pd(n){let e=Object.create(null);return t(Ps(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);Ps(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new rn(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Va);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function Id(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ba(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 $a(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function ja(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Fa(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new zd(n,r,e[r]);return t}let Is=class Ha{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=Fa(e,r.attrs),this.defaultAttrs=Ba(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==rn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$a(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new zt(this,this.computeAttrs(e),C.from(t),le.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new zt(this,this.computeAttrs(e),t,le.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(C.empty,!0);return o?new zt(this,e,t.append(o),le.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)}`)}checkAttrs(e){ja(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let 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:le.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Ha(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function _d(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class zd{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?_d(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ur{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Fa(e,i.attrs),this.excluded=null;let o=Ba(this.attrs);this.instance=o?new le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new le(this,$a(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ur(o,i++,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]}checkAttrs(e){ja(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Wa{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Me.from(e.nodes),t.marks=Me.from(e.marks||{}),this.nodes=Is.compile(this.spec.nodes,this),this.marks=Ur.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=rn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?_s(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:_s(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,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Is){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,i)}text(e,t){let r=this.nodes.text;return new Dr(r,r.defaultAttrs,e,le.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return zt.fromJSON(this,e)}markFromJSON(e){return le.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function _s(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Ld(n){return n.tag!=null}function Vd(n){return n.style!=null}class Lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Ld(i))this.tags.push(i);else if(Vd(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new Ls(this,t,!1);return r.addAll(e,le.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ls(this,t,!0);return r.addAll(e,le.none,t.from,t.to),T.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(jd(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],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(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Vs(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Vs(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Lt(e,Lt.schemaRules(e)))}}const qa={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},Bd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ua={ol:!0,ul:!0},Ar=1,Rr=2,jn=4;function zs(n,e,t){return e!=null?(e?Ar:0)|(e==="full"?Rr:0):n&&n.whitespace=="pre"?Ar|Rr:t&~jn}class lr{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=le.none,this.match=o||(s&jn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ar)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ls{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=zs(null,t.preserveWhitespace,0)|(r?jn:0);i?o=new lr(i.type,i.attrs,le.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new lr(null,null,le.none,!0,null,s):o=new lr(e.schema.topNodeType,null,le.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top;if(i.options&Rr||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&Ar)i.options&Rr?r=r.replace(/\r\n?/g,`
34
- `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=e.nodeName.toLowerCase(),o;Ua.hasOwnProperty(i)&&this.parser.normalizeLists&&$d(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:Bd.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(qa.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let u=s&&s.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
35
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));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,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=le.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):Bs(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=zs(e,o,s.options);s.options&jn&&s.content.length==0&&(l|=jn);let a=le.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Bs(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new lr(e,t,a,i,null,l)),this.open++,r}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?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>=o;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))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}}}function $d(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ua.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function jd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Vs(n){let e={};for(let t in n)e[t]=n[t];return e}function Bs(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class un{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Si(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=xr(Si(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&xr(Si(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return xr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new un(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=$s(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return $s(e.marks)}}function $s(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Si(n){return n.document||window.document}const js=new WeakMap;function Fd(n){let e=js.get(n);return e===void 0&&js.set(n,e=Hd(n)),e}function Hd(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function xr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Fd(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=xr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Ka=65535,Ja=Math.pow(2,16);function Wd(n,e){return n+e*Ja}function Fs(n){return n&Ka}function qd(n){return(n-(n&Ka))/Ja}const Ya=1,Ga=2,Sr=4,Xa=8;class lo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Xa)>0}get deletedBefore(){return(this.delInfo&(Ya|Sr))>0}get deletedAfter(){return(this.delInfo&(Ga|Sr))>0}get deletedAcross(){return(this.delInfo&Sr)>0}}class Ye{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ye.empty)return Ye.empty}recover(e){let t=0,r=Fs(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+qd(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 i=0,o=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?i:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Wd(l/3,e-a),m=e==a?Ga:e==d?Ya:Sr;return(t<0?e!=a:e!=d)&&(m|=Xa),new lo(h,m,p)}i+=u-c}return r?e+i:new lo(e+i,0,null)}touches(e,t){let r=0,i=Fs(t),o=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+o],u=a+c;if(e<=u&&l==i*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 i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+t],u=this.ranges[i+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new Ye(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ye.empty:new Ye(e<0?[0,-e,0]:[0,0,e])}}Ye.empty=new Ye([]);class wn{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new wn(this.maps,this.mirror,e,t)}copy(){return new wn(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 i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new wn;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 i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new lo(e,i,null)}}const wi=Object.create(null);class ze{getMap(){return Ye.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=wi[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 wi)throw new RangeError("Duplicate use of step JSON ID "+e);return wi[e]=t,t.prototype.jsonID=e,t}}class ve{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ve(e,null)}static fail(e){return new ve(null,e)}static fromReplace(e,t,r,i){try{return ve.ok(e.replace(t,r,i))}catch(o){if(o instanceof Mr)return ve.fail(o.message);throw o}}}function Lo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Lo(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return C.fromArray(r)}class Pt extends ze{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),i=r.node(r.sharedDepth(this.to)),o=new T(Lo(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,o)}invert(){return new ht(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 Pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(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 Pt(t.from,t.to,e.markFromJSON(t.mark))}}ze.jsonID("addMark",Pt);class ht extends ze{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 T(Lo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new Pt(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 ht(t.pos,r.pos,this.mark)}merge(e){return e instanceof ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ht(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 ht(t.from,t.to,e.markFromJSON(t.mark))}}ze.jsonID("removeMark",ht);class It extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new T(C.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new It(this.pos,t.marks[i]);return new It(this.pos,this.mark)}}return new En(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new It(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 It(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("addNodeMark",It);class En extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new It(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new En(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 En(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("removeNodeMark",En);class Se extends ze{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ao(e,this.from,this.to)?ve.fail("Structure replace would overwrite content"):ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ye([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(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 Se(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Se)||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?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(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?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(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 Se(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}ze.jsonID("replace",Se);class we extends ze{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ao(e,this.from,this.gapFrom)||ao(e,this.gapTo,this.to)))return ve.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ve.fromReplace(e,this.from,this.to,r):ve.fail("Content does not fit in gap")}getMap(){return new Ye([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 we(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new we(t.pos,r.pos,i,o,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 we(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}ze.jsonID("replaceAround",we);function ao(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Ud(n,e,t,r){let i=[],o=[],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:i.push(s=new ht(f,h,d[m])));l&&l.to==f?l.to=h:o.push(l=new Pt(f,h,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Kd(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Ur){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<i.length;h++){let p=i[h];p.step==o-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new ht(s.from,s.to,s.style)))}function Vo(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Se(l,u,T.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ht(l,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new T(C.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new Se(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);n.replace(l,l,new T(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Jd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Dn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Jd(i,o,s))break}return null}function Yd(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,u=C.empty,d=0;for(let p=o,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=C.from(r.node(p).copy(u)),d++):a--;let f=C.empty,h=0;for(let p=o,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=C.from(i.node(p).copy(f)),h++):c++;n.step(new we(a,c,s,l,new T(u.append(f),d,h),u.size-d,!0))}function Bo(n,e,t=null,r=n){let i=Gd(n,e),o=i&&Xd(r,e);return o?i.map(Hs).concat({type:e,attrs:t}).concat(o.map(Hs)):null}function Hs(n){return{type:n,attrs:null}}function Gd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Xd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Zd(n,e,t){let r=C.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=C.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new we(i,o,i,o,new T(r,0,0),t.length,!0))}function Qd(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&ef(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Qa(n,s,l,o),Vo(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return n.step(new we(d,f,d+1,f-1,new T(C.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Za(n,s,l,o),!1}})}function Za(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Qa(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
36
- `))}})}function ef(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function tf(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new we(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new T(C.from(s),0,0),1,!0))}function Ct(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>o;c--,u--){let d=i.node(c),f=i.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=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function nf(n,e,t=1,r){let i=n.doc.resolve(e),o=C.empty,s=C.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){o=C.from(i.node(l).copy(o));let u=r&&r[c];s=C.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new Se(e,e,new T(o.append(s),t,t),!0))}function Ft(n,e){let t=n.resolve(e),r=t.index();return ec(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function rf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function ec(n,e){return!!(n&&e&&!n.isLeaf&&rf(n,e))}function Kr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&ec(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function of(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Qa(n,u.node(),u.before(),l)}s.inlineContent&&Vo(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Se(c,a.map(e+t,-1),T.empty,!0)),r===!0){let u=n.doc.resolve(c);Za(n,u.node(),u.before(),n.steps.length)}return n}function sf(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 i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function tc(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)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(o==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.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 Jr(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return nc(i,o,r)?new Se(e,t,r):new lf(i,o,r).fit()}function nc(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class lf{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).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,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new T(o,s,l);return e>-1?new we(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=ki(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.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(C.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ki(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new T(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ki(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new T(Ln(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new T(Ln(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[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(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}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(rc(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=Vn(this.placed,t,C.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 b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?T.empty:new T(Ln(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new T(Ln(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||!Ci(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,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Ci(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ci(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?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=Vn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Vn(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=Vn(this.placed,this.frontier.length,t))}}function Ln(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ln(n.firstChild.content,e-1,t)))}function Vn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Vn(n.lastChild.content,e-1,t)))}function ki(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function rc(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,rc(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(C.empty,!0)))),n.copy(r)}function Ci(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!af(t,o.content,s)?l:null}function af(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function cf(n){return n.spec.defining||n.spec.definingForContent}function uf(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(nc(i,o,r))return n.step(new Se(e,t,r));let s=oc(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:i.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=cf(h.type);if(p&&!h.sameMarkup(i.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],b=!0;g<0&&(b=!1,g=-g);let x=i.node(g-1),S=i.index(g-1);if(x.canReplaceWith(S,S,p.type,p.marks))return n.replace(i.before(g),b?o.after(g):t,new T(ic(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=i.before(h),t=o.after(h))}}function ic(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ic(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(C.empty,!0))}return n}function df(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=sf(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new T(C.from(r),0,0))}function ff(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=oc(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function oc(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class kn extends ze{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 ve.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ve.fromReplace(e,this.pos,this.pos+1,new T(C.from(i),0,t.isLeaf?0:1))}getMap(){return Ye.empty}invert(e){return new kn(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 kn(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 kn(t.pos,t.attr,t.value)}}ze.jsonID("attr",kn);class qn extends ze{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ve.ok(r)}getMap(){return Ye.empty}invert(e){return new qn(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 qn(t.attr,t.value)}}ze.jsonID("docAttr",qn);let Nn=class extends Error{};Nn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Nn.prototype=Object.create(Error.prototype);Nn.prototype.constructor=Nn;Nn.prototype.name="TransformError";class sc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Nn(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=T.empty){let i=Jr(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new T(C.from(r),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return uf(this,e,t,r),this}replaceRangeWith(e,t,r){return df(this,e,t,r),this}deleteRange(e,t){return ff(this,e,t),this}lift(e,t){return Yd(this,e,t),this}join(e,t=1){return of(this,e,t),this}wrap(e,t){return Zd(this,e,t),this}setBlockType(e,t=e,r,i=null){return Qd(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return tf(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new kn(e,t,r)),this}setDocAttribute(e,t){return this.step(new qn(e,t)),this}addNodeMark(e,t){return this.step(new It(e,t)),this}removeNodeMark(e,t){if(!(t instanceof le)){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 En(e,t)),this}split(e,t=1,r){return nf(this,e,t,r),this}addMark(e,t,r){return Ud(this,e,t,r),this}removeMark(e,t,r){return Kd(this,e,t,r),this}clearIncompatible(e,t,r){return Vo(this,e,t,r),this}}const Ei=Object.create(null);class V{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new lc(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=T.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=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(o);e.replaceRange(u.map(a.pos),u.map(c.pos),l?T.empty:t),l==0&&Us(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Us(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):yn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?yn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):yn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Xe(e.node(0))}static atStart(e){return yn(e,e,0,0,1)||new Xe(e)}static atEnd(e){return yn(e,e,e.content.size,e.childCount,-1)||new Xe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ei[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 Ei)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ei[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}}V.prototype.visible=!0;class lc{constructor(e,t){this.$from=e,this.$to=t}}let Ws=!1;function qs(n){!Ws&&!n.parent.inlineContent&&(Ws=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class L extends V{constructor(e,t=e){qs(e),qs(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 V.near(r);let i=e.resolve(t.map(this.anchor));return new L(i.parent.inlineContent?i:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof L&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yr(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 L(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=V.findFrom(t,r,!0)||V.findFrom(t,-r,!0);if(o)t=o.$head;else return V.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(V.findFrom(e,-r,!0)||V.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new L(e,t)}}V.jsonID("text",L);class Yr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Yr(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends V{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:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?V.near(o):new z(o)}content(){return new T(C.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new $o(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(t.anchor))}static create(e,t){return new z(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1;V.jsonID("node",z);class $o{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yr(r,r):new $o(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&z.isSelectable(r)?new z(t):V.near(t)}}class Xe extends V{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let r=V.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Xe(e)}map(e){return new Xe(e)}eq(e){return e instanceof Xe}getBookmark(){return hf}}V.jsonID("all",Xe);const hf={map(){return this},resolve(n){return new Xe(n)}};function yn(n,e,t,r,i,o=!1){if(e.inlineContent)return L.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&z.isSelectable(l))return z.create(n,t-(i<0?l.nodeSize:0))}else{let a=yn(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function Us(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(V.near(n.doc.resolve(s),t))}const Ks=1,ar=2,Js=4;class pf extends sc{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|Ks)&~ar,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ks)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ar,this}ensureMarks(e){return le.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&ar)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ar,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)||le.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(V.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|=Js,this}get scrolledIntoView(){return(this.updated&Js)>0}}function Ys(n,e){return!e||!n?n:n.bind(e)}class Bn{constructor(e,t,r){this.name=e,this.init=Ys(t.init,r),this.apply=Ys(t.apply,r)}}const mf=[new Bn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Bn("selection",{init(n,e){return n.selection||V.atStart(e.doc)},apply(n){return n.selection}}),new Bn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Bn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ni{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=mf.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 Bn(r.key,r.spec.state,r))})}}class vn{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 i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[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),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new vn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new pf(this)}static create(e){let t=new Ni(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new vn(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Ni(this.schema,e.plugins),r=t.fields,i=new vn(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}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 i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.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 i=new Ni(e.schema,e.plugins),o=new vn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=zt.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=V.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.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)){o[s.name]=c.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function ac(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ac(i,e,{})),t[r]=i}return t}class Le{constructor(e){this.spec=e,this.props={},e.props&&ac(e.props,this,this.props),this.key=e.key?e.key.key:cc("plugin")}getState(e){return e[this.key]}}const Mi=Object.create(null);function cc(n){return n in Mi?n+"$"+ ++Mi[n]:(Mi[n]=0,n+"$")}class et{constructor(e="key"){this.key=cc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Te=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Un=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let co=null;const wt=function(n,e,t){let r=co||(co=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},gf=function(){co=null},on=function(n,e,t,r){return t&&(Gs(n,e,t,r,-1)||Gs(n,e,t,r,1))},yf=/^(img|br|input|textarea|hr)$/i;function Gs(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:it(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Zn(n)||yf.test(n.nodeName)||n.contentEditable=="false")return!1;e=Te(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?it(n):0}else return!1}}function it(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function bf(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=it(n)}else if(n.parentNode&&!Zn(n))e=Te(n),n=n.parentNode;else return null}}function vf(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&&!Zn(n))e=Te(n)+1,n=n.parentNode;else return null}}function xf(n,e,t){for(let r=e==0,i=e==it(n);r||i;){if(n==t)return!0;let o=Te(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==it(n)}}function Zn(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 Gr=function(n){return n.focusNode&&on(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Kt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Sf(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function wf(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(it(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(it(r.startContainer),r.startOffset)}}}const pt=typeof navigator<"u"?navigator:null,Xs=typeof document<"u"?document:null,Ht=pt&&pt.userAgent||"",uo=/Edge\/(\d+)/.exec(Ht),uc=/MSIE \d/.exec(Ht),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ht),Ke=!!(uc||fo||uo),Vt=uc?document.documentMode:fo?+fo[1]:uo?+uo[1]:0,at=!Ke&&/gecko\/(\d+)/i.test(Ht);at&&+(/Firefox\/(\d+)/.exec(Ht)||[0,0])[1];const ho=!Ke&&/Chrome\/(\d+)/.exec(Ht),Ie=!!ho,dc=ho?+ho[1]:0,je=!Ke&&!!pt&&/Apple Computer/.test(pt.vendor),Mn=je&&(/Mobile\/\w+/.test(Ht)||!!pt&&pt.maxTouchPoints>2),rt=Mn||(pt?/Mac/.test(pt.platform):!1),kf=pt?/Win/.test(pt.platform):!1,kt=/Android \d/.test(Ht),Qn=!!Xs&&"webkitFontSmoothing"in Xs.documentElement.style,Cf=Qn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ef(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 xt(n,e){return typeof n=="number"?n:n[e]}function Nf(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 Zs(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=Un(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?Ef(o):Nf(l),u=0,d=0;if(e.top<c.top+xt(r,"top")?d=-(c.top-e.top+xt(i,"top")):e.bottom>c.bottom-xt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+xt(i,"top")-c.top:e.bottom-c.bottom+xt(i,"bottom")),e.left<c.left+xt(r,"left")?u=-(c.left-e.left+xt(i,"left")):e.right>c.right-xt(r,"right")&&(u=e.right-c.right+xt(i,"right")),u||d)if(a)o.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 Mf(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:fc(n.dom)}}function fc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Un(r));return e}function Tf({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;hc(t,r==0?0:r-e)}function hc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let mn=null;function Of(n){if(n.setActive)return n.setActive();if(mn)return n.focus(mn);let e=fc(n);n.focus(mn==null?{get preventScroll(){return mn={preventScroll:!0},!0}}:void 0),mn||(mn=!1,hc(e,0))}function pc(n,e){let t,r=2e8,i,o=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=wt(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,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(o=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)&&(o=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?Df(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:pc(t,i)}function Df(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=Tt(r,1);if(o.top!=o.bottom&&jo(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function jo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Af(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Rf(n,e,t){let{node:r,offset:i}=pc(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Pf(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<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;o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function mc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(jo(e,c))return mc(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function If(n,e){let t=n.dom.ownerDocument,r,i=0,o=wf(t,e.left,e.top);o&&({node:r,offset:i}=o);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(!jo(e,c)||(s=mc(n.dom,e,c),!s))return null}if(je)for(let c=s;r&&c;c=Un(c))c.draggable&&(r=void 0);if(s=Af(s,e),r){if(at&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Qn&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Pf(n,r,i,e))}l==null&&(l=Rf(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Qs(n){return n.top<n.bottom||n.left<n.right}function Tt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Qs(r))return r}return Array.prototype.find.call(t,Qs)||n.getBoundingClientRect()}const _f=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gc(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=Qn||at;if(r.nodeType==3)if(s&&(_f.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Tt(wt(r,i,i),t);if(at&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Tt(wt(r,i-1,i-1),-1);if(c.top==a.top){let u=Tt(wt(r,i,i+1),-1);if(u.top!=a.top)return In(u,u.left<c.left)}}return a}else{let a=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,In(Tt(wt(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==it(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ti(a.getBoundingClientRect(),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ti(a.getBoundingClientRect(),!0)}return Ti(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==it(r))){let a=r.childNodes[i-1],c=a.nodeType==3?wt(a,it(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return In(Tt(c,1),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?wt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return In(Tt(c,-1),!0)}return In(Tt(r.nodeType==3?wt(r):r,-t),t>=0)}function In(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 Ti(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 yc(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function zf(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return yc(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=gc(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=wt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(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 Lf=/[\u0590-\u08ac]/;function Vf(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!Lf.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:yc(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}):r.pos==r.start()||r.pos==r.end()}let el=null,tl=null,nl=!1;function Bf(n,e,t){return el==e&&tl==t?nl:(el=e,tl=t,nl=t=="up"||t=="down"?zf(n,e,t):Vf(n,e,t))}const ot=0,rl=1,Yt=2,mt=3;class er{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ot,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 i=this.children[t];if(i==e)return r;r+=i.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 o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Te(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}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 i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof vc){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof bc&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?Te(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?Te(o.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 i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-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)){i=Te(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-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)){o=Te(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}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,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(o>p&&s<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((at||je)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
37
- `),d&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Te(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(at&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&je)&&on(l.node,l.offset,u.anchorNode,u.anchorOffset)&&on(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!d){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Yt:rl,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=mt:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Yt:mt}r=s}this.dirty=Yt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Yt:rl;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class bc extends er{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!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,o=this}matchesWidget(e){return this.dirty==ot&&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 $f extends er{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class sn extends er{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=un.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new sn(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ot){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ot}}slice(e,t,r){let i=sn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=mo(o,t,s,r)),e>0&&(o=mo(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Bt extends er{constructor(e,t,r,i,o,s,l,a,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),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}=un.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=wc(u,r,t),c?a=new jf(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new Xr(e,t,r,i,u,f,o):new Bt(e,t,r,i,u,d||null,f,o,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=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==ot&&e.eq(this.node)&&Pr(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,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Hf(this,s&&s.node,e);Uf(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?le.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Yt)&&(s&&this.protectLocalComposition(e,s),xc(this.contentDOM,this.children,e),Mn&&Kf(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof L)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Jf(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new $f(this,o,t,i);e.input.compositionNodes.push(s),this.children=mo(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==mt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ot}updateOuterDeco(e){if(Pr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Sc(this.dom,this.nodeDOM,po(this.outerDeco,this.node,t),po(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 il(n,e,t,r,i){wc(r,e,n);let o=new Bt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Xr extends Bt{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,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,i){return this.dirty==mt||this.dirty!=ot&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ot||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ot,!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 i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Xr(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=mt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class vc extends er{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ot&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class jf extends Bt{constructor(e,t,r,i,o,s,l,a,c,u){super(e,t,r,i,o,s,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==mt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function xc(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=ol(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof sn){let a=r?r.previousSibling:n.lastChild;xc(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=ol(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Fn=function(n){n&&(this.nodeName=n)};Fn.prototype=Object.create(null);const Gt=[new Fn];function po(n,e,t){if(n.length==0)return Gt;let r=t?Gt[0]:new Fn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Fn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new Fn(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 i}function Sc(n,e,t,r){if(t==Gt&&r==Gt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Gt[0]),i=a}Ff(i,l||Gt[0],s)}return i}function Ff(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):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function wc(n,e,t){return Sc(n,n,Gt,po(e,t,n.nodeType!=1))}function Pr(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 ol(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Hf{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Wf(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 i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=ot,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<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[o])&&!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=sn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=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)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==mt&&s.dom==s.contentDOM&&(s.dirty=Yt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Bt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)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!=mt&&Pr(t,a.outerDeco));if(!f&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Yt,d.updateChildren(i,s+1),d.dirty=ot),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Bt.create(this.top,t,r,i,o,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,i,o){let s=Bt.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new bc(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof sn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((je||Ie)&&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 i=new vc(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Wf(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof sn)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(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function qf(n,e){return n.type.side-e.type.side}function Uf(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(qf);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<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+f.nodeSize;if(f.isText){let g=p;s<i.length&&i[s].from<g&&(g=i[s].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=f.cut(g-o),f=f.cut(0,g-o),p=g,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(o,f),h),o=p}}function Kf(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 Jf(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=t){if(o>=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 mo(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,u=l+=a.size;c>=t||u<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>t&&o.push(a.slice(t-c,a.size,r)))}return o}function Fo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Gr(t)){for(a=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&xf(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new z(s==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=s,f=s;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);d=Math.min(d,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=Ho(n,u,l,d)}return c}function kc(n){return n.editable?n.hasFocus():Ec(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Et(n,e=!1){let t=n.state.selection;if(Cc(n,t),!!kc(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ie){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&on(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Gf(n);else{let{anchor:r,head:i}=t,o,s;sl&&!(t instanceof L)&&(t.$from.parent.inlineContent||(o=ll(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=ll(n,t.to))),n.docView.setSelection(r,i,n,e),sl&&(o&&al(o),s&&al(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Yf(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const sl=je||Ie&&dc<63;function ll(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(je&&i&&i.contentEditable=="false")return Oi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Oi(i);if(o)return Oi(o)}}function Oi(n){return n.contentEditable="true",je&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function al(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Yf(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!kc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Gf(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Te(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Ke&&Vt<=11&&(r.disabled=!0,r.disabled=!1)}function Cc(n,e){if(e instanceof z){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(cl(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else cl(n)}function cl(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ho(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}function ul(n){return n.editable&&!n.hasFocus()?!1:Ec(n)}function Ec(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 Xf(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return on(e.node,e.offset,t.anchorNode,t.anchorOffset)}function go(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&V.findFrom(o,e)}function Ot(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function dl(n,e,t){let r=n.state.selection;if(r instanceof L)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Ot(n,new L(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=go(n.state,e);return i&&i instanceof z?Ot(n,i):!1}else if(!(rt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?z.isSelectable(o)?Ot(n,new z(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Qn?Ot(n,new L(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return Ot(n,new L(e>0?r.$to:r.$from));{let i=go(n.state,e);return i?Ot(n,i):!1}}}function Ir(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Hn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function gn(n,e){return e<0?Zf(n):Qf(n)}function Zf(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(at&&t.nodeType==1&&r<Ir(t)&&Hn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Hn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Nc(t))break;{let l=t.previousSibling;for(;l&&Hn(l,-1);)i=t.parentNode,o=Te(l),l=l.previousSibling;if(l)t=l,r=Ir(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?yo(n,t,r):i&&yo(n,i,o)}function Qf(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Ir(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Hn(l,1))o=t,s=++r;else break}else{if(Nc(t))break;{let l=t.nextSibling;for(;l&&Hn(l,1);)o=l.parentNode,s=Te(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Ir(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&yo(n,o,s)}function Nc(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function eh(n,e){for(;n&&e==n.childNodes.length&&!Zn(n);)e=Te(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 th(n,e){for(;n&&!e&&!Zn(n);)e=Te(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 yo(n,e,t){if(e.nodeType!=3){let o,s;(s=eh(e,t))?(e=s,t=0):(o=th(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Gr(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Et(n)},50)}function fl(n,e){let t=n.state.doc.resolve(e);if(!(Ie||kf)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function hl(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||rt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=go(n.state,e);if(s&&s instanceof z)return Ot(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Xe?V.near(s,e):V.findFrom(s,e);return l?Ot(n,l):!1}return!1}function pl(n,e){if(!(n.state.selection instanceof L))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function ml(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function nh(n){if(!je||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;ml(n,r,"true"),setTimeout(()=>ml(n,r,"false"),20)}return!1}function rh(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ih(n,e){let t=e.keyCode,r=rh(e);if(t==8||rt&&t==72&&r=="c")return pl(n,-1)||gn(n,-1);if(t==46&&!e.shiftKey||rt&&t==68&&r=="c")return pl(n,1)||gn(n,1);if(t==13||t==27)return!0;if(t==37||rt&&t==66&&r=="c"){let i=t==37?fl(n,n.state.selection.from)=="ltr"?-1:1:-1;return dl(n,i,r)||gn(n,i)}else if(t==39||rt&&t==70&&r=="c"){let i=t==39?fl(n,n.state.selection.from)=="ltr"?1:-1:1;return dl(n,i,r)||gn(n,i)}else{if(t==38||rt&&t==80&&r=="c")return hl(n,-1,r)||gn(n,-1);if(t==40||rt&&t==78&&r=="c")return nh(n)||hl(n,1,r)||gn(n,1);if(r==(rt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Mc(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;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")||un.fromSchema(n.state.schema),l=Pc(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Rc[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",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
30
+ <%s key={someKey} {...props} />`,vi,Ut,vd,Ut),Os[Ut+vi]=!0}}return y===r?pd(be):hd(be),be}}function md(y,M,R){return As(y,M,R,!0)}function gd(y,M,R){return As(y,M,R,!1)}var yd=gd,bd=md;_n.Fragment=r,_n.jsx=yd,_n.jsxs=bd}()),_n}process.env.NODE_ENV==="production"?ro.exports=wd():ro.exports=kd();var w=ro.exports;function Ee(n){this.content=n}Ee.prototype={constructor:Ee,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,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Ee(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ee(t)},addToStart:function(n,e){return new Ee([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ee(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Ee(i)},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=Ee.from(n),n.size?new Ee(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ee.from(n),n.size?new Ee(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ee.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}};Ee.from=function(n){if(n instanceof Ee)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ee(e)};function Na(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Na(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Ra(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),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=Ra(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class C{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,i=0,o){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||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,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",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?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new C(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let l=this.content[o],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),i+=l.nodeSize),s=a}return new C(r,i)}cutByIndex(e,t){return e==t?C.empty:e==0&&t==this.content.length?this:new C(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new C(i,o)}addToStart(e){return new C([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new C(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Na(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Ra(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sr(0,e);if(e==this.size)return sr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?sr(r+1,s):sr(r,i);i=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 C.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new C(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return C.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new C(t||e,r)}static from(e){if(!e)return C.empty;if(e instanceof C)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new C([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}C.empty=new C([],0);const Si={index:0,offset:0};function sr(n,e){return Si.index=n,Si.offset=e,Si}function Tr(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(!Tr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Tr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let le=class io{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}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&&Tr(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`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 io.none;if(e instanceof io)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};le.none=[];class Er extends Error{}class O{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=Pa(this.content,e+this.openStart,t);return r&&new O(r,this.openStart,this.openEnd)}removeBetween(e,t){return new O(Da(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 O.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new O(C.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new O(e,r,i)}}O.empty=new O(C.empty,0,0);function Da(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.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,o.copy(Da(o.content,e-i-1,t-i-1)))}function Pa(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Pa(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Cd(n,e,t){if(t.openStart>n.depth)throw new Er("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Er("Inconsistent open depths");return Ia(n,e,t,0)}function Ia(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Ia(n,e,t,r+1);return o.copy(o.content.replaceChild(i,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 Qt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Md(t,n);return Qt(o,La(n,s,l,e,r))}else return Qt(o,Or(n,e,r))}function _a(n,e){if(!e.type.compatibleContent(n.type))throw new Er("Cannot join "+e.type.name+" onto "+n.type.name)}function oo(n,e,t){let r=n.node(t);return _a(r,e.node(t)),r}function Zt(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 Hn(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Zt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)Zt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Zt(e.nodeBefore,r)}function Qt(n,e){return n.type.checkContent(e),n.copy(e)}function La(n,e,t,r,i){let o=n.depth>i&&oo(n,e,i+1),s=r.depth>i&&oo(t,r,i+1),l=[];return Hn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(_a(o,s),Zt(Qt(o,La(n,e,t,r,i+1)),l)):(o&&Zt(Qt(o,Or(n,e,i+1)),l),Hn(e,t,i,l),s&&Zt(Qt(s,Or(t,r,i+1)),l)),Hn(r,null,i,l),new C(l)}function Or(n,e,t){let r=[];if(Hn(null,n,t,r),n.depth>t){let i=oo(n,e,t+1);Zt(Qt(i,Or(n,e,t+1)),r)}return Hn(e,null,t,r),new C(r)}function Md(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(C.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Un{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],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].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 Ar(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=[],i=0,o=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new Un(t,r,o)}static resolveCached(e,t){let r=Ds.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else Ds.set(e,r=new Td);let i=r.elts[r.i]=Un.resolve(e,t);return r.i=(r.i+1)%Ed,i}}class Td{constructor(){this.elts=[],this.i=0}}const Ed=12,Ds=new WeakMap;class Ar{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 Od=Object.create(null);let Lt=class so{constructor(e,t,r,i=le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.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,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Tr(this.attrs,t||e.defaultAttrs||Od)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new so(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new so(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 O.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new O(c,i.depth-s,o.depth-s)}replace(e,t,r){return Cd(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Un.resolveCached(this,e)}resolveNoCache(e){return Un.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),za(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=C.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.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),this.type.checkAttrs(this.attrs);let e=le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.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;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 i=C.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Lt.prototype.text=void 0;class Nr extends Lt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):za(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 Nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Nr(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 za(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class rn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ad(e,t);if(r.next==null)return rn.empty;let i=Ba(r);r.next&&r.err("Unexpected trailing text");let o=Ld(_d(i));return zd(o,r),o}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 i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let 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 i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return C.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())&&i.indexOf(d)==-1){i.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(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 i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
31
+ `)}}rn.empty=new rn(!0);class Ad{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 Ba(n){let e=[];do e.push(Nd(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Nd(n){let e=[];do e.push(Rd(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Rd(n){let e=Id(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=Dd(n,e);else break;return e}function Ps(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Dd(n,e){let t=Ps(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ps(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Pd(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Id(n){if(n.eat("(")){let e=Ba(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=Pd(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 _d(n){let e=[[]];return i(o(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 i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),i(o(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 $a(n,e){return e-n}function Is(n,e){let t=[];return r(e),t.sort($a);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Ld(n){let e=Object.create(null);return t(Is(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);Is(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new rn(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort($a);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function zd(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ja(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 Fa(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Ha(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Va(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new $d(n,r,e[r]);return t}let _s=class Wa{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=Va(e,r.attrs),this.defaultAttrs=ja(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==rn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Fa(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Lt(this,this.computeAttrs(e),C.from(t),le.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new Lt(this,this.computeAttrs(e),t,le.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(C.empty,!0);return o?new Lt(this,e,t.append(o),le.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)}`)}checkAttrs(e){Ha(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let 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:le.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Wa(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Bd(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class $d{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Bd(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ur{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Va(e,i.attrs),this.excluded=null;let o=ja(this.attrs);this.instance=o?new le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new le(this,Fa(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ur(o,i++,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]}checkAttrs(e){Ha(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class qa{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ee.from(e.nodes),t.marks=Ee.from(e.marks||{}),this.nodes=_s.compile(this.spec.nodes,this),this.marks=Ur.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=rn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?Ls(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Ls(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,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof _s){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,i)}text(e,t){let r=this.nodes.text;return new Nr(r,r.defaultAttrs,e,le.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Lt.fromJSON(this,e)}markFromJSON(e){return le.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ls(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function jd(n){return n.tag!=null}function Fd(n){return n.style!=null}class zt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(jd(i))this.tags.push(i);else if(Fd(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new Bs(this,t,!1);return r.addAll(e,le.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Bs(this,t,!0);return r.addAll(e,le.none,t.from,t.to),O.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Wd(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],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(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=$s(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=$s(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new zt(e,zt.schemaRules(e)))}}const Ua={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},Hd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ka={ol:!0,ul:!0},Rr=1,Dr=2,Vn=4;function zs(n,e,t){return e!=null?(e?Rr:0)|(e==="full"?Dr:0):n&&n.whitespace=="pre"?Rr|Dr:t&~Vn}class lr{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=le.none,this.match=o||(s&Vn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Rr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ua.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Bs{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=zs(null,t.preserveWhitespace,0)|(r?Vn:0);i?o=new lr(i.type,i.attrs,le.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new lr(null,null,le.none,!0,null,s):o=new lr(e.schema.topNodeType,null,le.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top;if(i.options&Dr||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&Rr)i.options&Dr?r=r.replace(/\r\n?/g,`
32
+ `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=e.nodeName.toLowerCase(),o;Ka.hasOwnProperty(i)&&this.parser.normalizeLists&&Vd(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:Hd.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(Ua.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let u=s&&s.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));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,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=le.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):js(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=zs(e,o,s.options);s.options&Vn&&s.content.length==0&&(l|=Vn);let a=le.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):js(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new lr(e,t,a,i,null,l)),this.open++,r}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?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>=o;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))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}}}function Vd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ka.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Wd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function $s(n){let e={};for(let t in n)e[t]=n[t];return e}function js(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class un{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=xi(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Sr(xi(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Sr(xi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Sr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new un(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Fs(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Fs(e.marks)}}function Fs(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function xi(n){return n.document||window.document}const Hs=new WeakMap;function qd(n){let e=Hs.get(n);return e===void 0&&Hs.set(n,e=Ud(n)),e}function Ud(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Sr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=qd(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Sr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Ja=65535,Ya=Math.pow(2,16);function Kd(n,e){return n+e*Ya}function Vs(n){return n&Ja}function Jd(n){return(n-(n&Ja))/Ya}const Ga=1,Xa=2,xr=4,Za=8;class lo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Za)>0}get deletedBefore(){return(this.delInfo&(Ga|xr))>0}get deletedAfter(){return(this.delInfo&(Xa|xr))>0}get deletedAcross(){return(this.delInfo&xr)>0}}class Ye{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ye.empty)return Ye.empty}recover(e){let t=0,r=Vs(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Jd(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 i=0,o=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?i:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Kd(l/3,e-a),m=e==a?Xa:e==d?Ga:xr;return(t<0?e!=a:e!=d)&&(m|=Za),new lo(h,m,p)}i+=u-c}return r?e+i:new lo(e+i,0,null)}touches(e,t){let r=0,i=Vs(t),o=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+o],u=a+c;if(e<=u&&l==i*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 i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+t],u=this.ranges[i+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new Ye(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ye.empty:new Ye(e<0?[0,-e,0]:[0,0,e])}}Ye.empty=new Ye([]);class wn{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new wn(this.maps,this.mirror,e,t)}copy(){return new wn(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 i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new wn;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 i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new lo(e,i,null)}}const wi=Object.create(null);class Le{getMap(){return Ye.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=wi[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 wi)throw new RangeError("Duplicate use of step JSON ID "+e);return wi[e]=t,t.prototype.jsonID=e,t}}class ve{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ve(e,null)}static fail(e){return new ve(null,e)}static fromReplace(e,t,r,i){try{return ve.ok(e.replace(t,r,i))}catch(o){if(o instanceof Er)return ve.fail(o.message);throw o}}}function zo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(zo(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return C.fromArray(r)}class Pt extends Le{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),i=r.node(r.sharedDepth(this.to)),o=new O(zo(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,o)}invert(){return new ht(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 Pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(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 Pt(t.from,t.to,e.markFromJSON(t.mark))}}Le.jsonID("addMark",Pt);class ht extends Le{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 O(zo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new Pt(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 ht(t.pos,r.pos,this.mark)}merge(e){return e instanceof ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ht(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 ht(t.from,t.to,e.markFromJSON(t.mark))}}Le.jsonID("removeMark",ht);class It extends Le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new O(C.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new It(this.pos,t.marks[i]);return new It(this.pos,this.mark)}}return new Mn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new It(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 It(t.pos,e.markFromJSON(t.mark))}}Le.jsonID("addNodeMark",It);class Mn extends Le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new O(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new It(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mn(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 Mn(t.pos,e.markFromJSON(t.mark))}}Le.jsonID("removeNodeMark",Mn);class xe extends Le{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ao(e,this.from,this.to)?ve.fail("Structure replace would overwrite content"):ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ye([this.from,this.to-this.from,this.slice.size])}invert(e){return new xe(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 xe(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof xe)||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?O.empty:new O(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new xe(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?O.empty:new O(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new xe(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 xe(t.from,t.to,O.fromJSON(e,t.slice),!!t.structure)}}Le.jsonID("replace",xe);class we extends Le{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ao(e,this.from,this.gapFrom)||ao(e,this.gapTo,this.to)))return ve.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ve.fromReplace(e,this.from,this.to,r):ve.fail("Content does not fit in gap")}getMap(){return new Ye([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 we(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new we(t.pos,r.pos,i,o,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 we(t.from,t.to,t.gapFrom,t.gapTo,O.fromJSON(e,t.slice),t.insert,!!t.structure)}}Le.jsonID("replaceAround",we);function ao(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Yd(n,e,t,r){let i=[],o=[],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:i.push(s=new ht(f,h,d[m])));l&&l.to==f?l.to=h:o.push(l=new Pt(f,h,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Gd(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Ur){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<i.length;h++){let p=i[h];p.step==o-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new ht(s.from,s.to,s.style)))}function Bo(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new xe(l,u,O.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ht(l,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new O(C.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new xe(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);n.replace(l,l,new O(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Xd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Nn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Xd(i,o,s))break}return null}function Zd(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,u=C.empty,d=0;for(let p=o,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=C.from(r.node(p).copy(u)),d++):a--;let f=C.empty,h=0;for(let p=o,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=C.from(i.node(p).copy(f)),h++):c++;n.step(new we(a,c,s,l,new O(u.append(f),d,h),u.size-d,!0))}function $o(n,e,t=null,r=n){let i=Qd(n,e),o=i&&ef(r,e);return o?i.map(Ws).concat({type:e,attrs:t}).concat(o.map(Ws)):null}function Ws(n){return{type:n,attrs:null}}function Qd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function ef(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function tf(n,e,t){let r=C.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=C.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new we(i,o,i,o,new O(r,0,0),t.length,!0))}function nf(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&rf(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ec(n,s,l,o),Bo(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return n.step(new we(d,f,d+1,f-1,new O(C.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Qa(n,s,l,o),!1}})}function Qa(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ec(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
34
+ `))}})}function rf(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function of(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new we(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new O(C.from(s),0,0),1,!0))}function Ct(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>o;c--,u--){let d=i.node(c),f=i.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=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function sf(n,e,t=1,r){let i=n.doc.resolve(e),o=C.empty,s=C.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){o=C.from(i.node(l).copy(o));let u=r&&r[c];s=C.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new xe(e,e,new O(o.append(s),t,t),!0))}function Ht(n,e){let t=n.resolve(e),r=t.index();return tc(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function lf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function tc(n,e){return!!(n&&e&&!n.isLeaf&&lf(n,e))}function Kr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&tc(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function af(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);ec(n,u.node(),u.before(),l)}s.inlineContent&&Bo(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new xe(c,a.map(e+t,-1),O.empty,!0)),r===!0){let u=n.doc.resolve(c);Qa(n,u.node(),u.before(),n.steps.length)}return n}function cf(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 i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function nc(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)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(o==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.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 Jr(n,e,t=e,r=O.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return rc(i,o,r)?new xe(e,t,r):new uf(i,o,r).fit()}function rc(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class uf{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).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,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new O(o,s,l);return e>-1?new we(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new xe(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=ki(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.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(C.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ki(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new O(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ki(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new O($n(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new O($n(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[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(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}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(ic(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=jn(this.placed,t,C.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 b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?O.empty:new O($n(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new O($n(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||!Ci(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,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Ci(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ci(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?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=jn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=jn(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=jn(this.placed,this.frontier.length,t))}}function $n(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy($n(n.firstChild.content,e-1,t)))}function jn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(jn(n.lastChild.content,e-1,t)))}function ki(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ic(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ic(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(C.empty,!0)))),n.copy(r)}function Ci(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!df(t,o.content,s)?l:null}function df(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function ff(n){return n.spec.defining||n.spec.definingForContent}function hf(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(rc(i,o,r))return n.step(new xe(e,t,r));let s=sc(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:i.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=ff(h.type);if(p&&!h.sameMarkup(i.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],b=!0;g<0&&(b=!1,g=-g);let S=i.node(g-1),x=i.index(g-1);if(S.canReplaceWith(x,x,p.type,p.marks))return n.replace(i.before(g),b?o.after(g):t,new O(oc(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=i.before(h),t=o.after(h))}}function oc(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(oc(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(C.empty,!0))}return n}function pf(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=cf(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new O(C.from(r),0,0))}function mf(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=sc(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function sc(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class kn extends Le{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 ve.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ve.fromReplace(e,this.pos,this.pos+1,new O(C.from(i),0,t.isLeaf?0:1))}getMap(){return Ye.empty}invert(e){return new kn(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 kn(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 kn(t.pos,t.attr,t.value)}}Le.jsonID("attr",kn);class Kn extends Le{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ve.ok(r)}getMap(){return Ye.empty}invert(e){return new Kn(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 Kn(t.attr,t.value)}}Le.jsonID("docAttr",Kn);let Tn=class extends Error{};Tn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Tn.prototype=Object.create(Error.prototype);Tn.prototype.constructor=Tn;Tn.prototype.name="TransformError";class lc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Tn(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=O.empty){let i=Jr(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new O(C.from(r),0,0))}delete(e,t){return this.replace(e,t,O.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return hf(this,e,t,r),this}replaceRangeWith(e,t,r){return pf(this,e,t,r),this}deleteRange(e,t){return mf(this,e,t),this}lift(e,t){return Zd(this,e,t),this}join(e,t=1){return af(this,e,t),this}wrap(e,t){return tf(this,e,t),this}setBlockType(e,t=e,r,i=null){return nf(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return of(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new kn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Kn(e,t)),this}addNodeMark(e,t){return this.step(new It(e,t)),this}removeNodeMark(e,t){if(!(t instanceof le)){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 Mn(e,t)),this}split(e,t=1,r){return sf(this,e,t,r),this}addMark(e,t,r){return Yd(this,e,t,r),this}removeMark(e,t,r){return Gd(this,e,t,r),this}clearIncompatible(e,t,r){return Bo(this,e,t,r),this}}const Mi=Object.create(null);class B{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ac(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=O.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=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(o);e.replaceRange(u.map(a.pos),u.map(c.pos),l?O.empty:t),l==0&&Ks(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Ks(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new z(e):yn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?yn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):yn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Xe(e.node(0))}static atStart(e){return yn(e,e,0,0,1)||new Xe(e)}static atEnd(e){return yn(e,e,e.content.size,e.childCount,-1)||new Xe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Mi[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 Mi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Mi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return z.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class ac{constructor(e,t){this.$from=e,this.$to=t}}let qs=!1;function Us(n){!qs&&!n.parent.inlineContent&&(qs=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class z extends B{constructor(e,t=e){Us(e),Us(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 B.near(r);let i=e.resolve(t.map(this.anchor));return new z(i.parent.inlineContent?i:r,r)}replace(e,t=O.empty){if(super.replace(e,t),t==O.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof z&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yr(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 z(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=B.findFrom(t,r,!0)||B.findFrom(t,-r,!0);if(o)t=o.$head;else return B.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new z(e,t)}}B.jsonID("text",z);class Yr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Yr(e.map(this.anchor),e.map(this.head))}resolve(e){return z.between(e.resolve(this.anchor),e.resolve(this.head))}}class L extends B{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:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?B.near(o):new L(o)}content(){return new O(C.from(this.node),0,0)}eq(e){return e instanceof L&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new jo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new L(e.resolve(t.anchor))}static create(e,t){return new L(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}L.prototype.visible=!1;B.jsonID("node",L);class jo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yr(r,r):new jo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&L.isSelectable(r)?new L(t):B.near(t)}}class Xe extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=O.empty){if(t==O.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Xe(e)}map(e){return new Xe(e)}eq(e){return e instanceof Xe}getBookmark(){return gf}}B.jsonID("all",Xe);const gf={map(){return this},resolve(n){return new Xe(n)}};function yn(n,e,t,r,i,o=!1){if(e.inlineContent)return z.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&L.isSelectable(l))return L.create(n,t-(i<0?l.nodeSize:0))}else{let a=yn(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function Ks(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof xe||i instanceof we))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}const Js=1,ar=2,Ys=4;class yf extends lc{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|Js)&~ar,this.storedMarks=null,this}get selectionSet(){return(this.updated&Js)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ar,this}ensureMarks(e){return le.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&ar)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ar,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)||le.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(B.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|=Ys,this}get scrolledIntoView(){return(this.updated&Ys)>0}}function Gs(n,e){return!e||!n?n:n.bind(e)}class Fn{constructor(e,t,r){this.name=e,this.init=Gs(t.init,r),this.apply=Gs(t.apply,r)}}const bf=[new Fn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Fn("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new Fn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Fn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ti{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=bf.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 Fn(r.key,r.spec.state,r))})}}class vn{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 i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[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),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new vn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new yf(this)}static create(e){let t=new Ti(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new vn(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Ti(this.schema,e.plugins),r=t.fields,i=new vn(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}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 i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.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 i=new Ti(e.schema,e.plugins),o=new vn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Lt.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=B.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.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)){o[s.name]=c.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function cc(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=cc(i,e,{})),t[r]=i}return t}class ze{constructor(e){this.spec=e,this.props={},e.props&&cc(e.props,this,this.props),this.key=e.key?e.key.key:uc("plugin")}getState(e){return e[this.key]}}const Ei=Object.create(null);function uc(n){return n in Ei?n+"$"+ ++Ei[n]:(Ei[n]=0,n+"$")}class et{constructor(e="key"){this.key=uc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Oe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Jn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let co=null;const wt=function(n,e,t){let r=co||(co=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},vf=function(){co=null},on=function(n,e,t,r){return t&&(Xs(n,e,t,r,-1)||Xs(n,e,t,r,1))},Sf=/^(img|br|input|textarea|hr)$/i;function Xs(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:it(n))){let o=n.parentNode;if(!o||o.nodeType!=1||er(n)||Sf.test(n.nodeName)||n.contentEditable=="false")return!1;e=Oe(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?it(n):0}else return!1}}function it(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function xf(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=it(n)}else if(n.parentNode&&!er(n))e=Oe(n),n=n.parentNode;else return null}}function wf(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&&!er(n))e=Oe(n)+1,n=n.parentNode;else return null}}function kf(n,e,t){for(let r=e==0,i=e==it(n);r||i;){if(n==t)return!0;let o=Oe(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==it(n)}}function er(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 Gr=function(n){return n.focusNode&&on(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Kt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Cf(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Mf(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(it(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(it(r.startContainer),r.startOffset)}}}const pt=typeof navigator<"u"?navigator:null,Zs=typeof document<"u"?document:null,Vt=pt&&pt.userAgent||"",uo=/Edge\/(\d+)/.exec(Vt),dc=/MSIE \d/.exec(Vt),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vt),Ke=!!(dc||fo||uo),Bt=dc?document.documentMode:fo?+fo[1]:uo?+uo[1]:0,at=!Ke&&/gecko\/(\d+)/i.test(Vt);at&&+(/Firefox\/(\d+)/.exec(Vt)||[0,0])[1];const ho=!Ke&&/Chrome\/(\d+)/.exec(Vt),Ie=!!ho,fc=ho?+ho[1]:0,Fe=!Ke&&!!pt&&/Apple Computer/.test(pt.vendor),En=Fe&&(/Mobile\/\w+/.test(Vt)||!!pt&&pt.maxTouchPoints>2),rt=En||(pt?/Mac/.test(pt.platform):!1),Tf=pt?/Win/.test(pt.platform):!1,kt=/Android \d/.test(Vt),tr=!!Zs&&"webkitFontSmoothing"in Zs.documentElement.style,Ef=tr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Of(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 St(n,e){return typeof n=="number"?n:n[e]}function Af(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 Qs(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=Jn(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?Of(o):Af(l),u=0,d=0;if(e.top<c.top+St(r,"top")?d=-(c.top-e.top+St(i,"top")):e.bottom>c.bottom-St(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+St(i,"top")-c.top:e.bottom-c.bottom+St(i,"bottom")),e.left<c.left+St(r,"left")?u=-(c.left-e.left+St(i,"left")):e.right>c.right-St(r,"right")&&(u=e.right-c.right+St(i,"right")),u||d)if(a)o.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 Nf(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:hc(n.dom)}}function hc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Jn(r));return e}function Rf({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;pc(t,r==0?0:r-e)}function pc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let mn=null;function Df(n){if(n.setActive)return n.setActive();if(mn)return n.focus(mn);let e=hc(n);n.focus(mn==null?{get preventScroll(){return mn={preventScroll:!0},!0}}:void 0),mn||(mn=!1,pc(e,0))}function mc(n,e){let t,r=2e8,i,o=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=wt(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,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(o=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)&&(o=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?Pf(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:mc(t,i)}function Pf(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=Ot(r,1);if(o.top!=o.bottom&&Fo(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function Fo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function If(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function _f(n,e,t){let{node:r,offset:i}=mc(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Lf(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<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;o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function gc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Fo(e,c))return gc(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function zf(n,e){let t=n.dom.ownerDocument,r,i=0,o=Mf(t,e.left,e.top);o&&({node:r,offset:i}=o);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(!Fo(e,c)||(s=gc(n.dom,e,c),!s))return null}if(Fe)for(let c=s;r&&c;c=Jn(c))c.draggable&&(r=void 0);if(s=If(s,e),r){if(at&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;tr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Lf(n,r,i,e))}l==null&&(l=_f(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function el(n){return n.top<n.bottom||n.left<n.right}function Ot(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(el(r))return r}return Array.prototype.find.call(t,el)||n.getBoundingClientRect()}const Bf=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function yc(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=tr||at;if(r.nodeType==3)if(s&&(Bf.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Ot(wt(r,i,i),t);if(at&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Ot(wt(r,i-1,i-1),-1);if(c.top==a.top){let u=Ot(wt(r,i,i+1),-1);if(u.top!=a.top)return Ln(u,u.left<c.left)}}return a}else{let a=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,Ln(Ot(wt(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==it(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Oi(a.getBoundingClientRect(),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];if(a.nodeType==1)return Oi(a.getBoundingClientRect(),!0)}return Oi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==it(r))){let a=r.childNodes[i-1],c=a.nodeType==3?wt(a,it(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Ln(Ot(c,1),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?wt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Ln(Ot(c,-1),!0)}return Ln(Ot(r.nodeType==3?wt(r):r,-t),t>=0)}function Ln(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 Oi(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 bc(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function $f(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return bc(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=yc(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=wt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(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 jf=/[\u0590-\u08ac]/;function Ff(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!jf.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:bc(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}):r.pos==r.start()||r.pos==r.end()}let tl=null,nl=null,rl=!1;function Hf(n,e,t){return tl==e&&nl==t?rl:(tl=e,nl=t,rl=t=="up"||t=="down"?$f(n,e,t):Ff(n,e,t))}const ot=0,il=1,Yt=2,mt=3;class nr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ot,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 i=this.children[t];if(i==e)return r;r+=i.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 o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Oe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}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 i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof Sc){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof vc&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?Oe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?Oe(o.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 i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-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)){i=Oe(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-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)){o=Oe(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}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,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(o>p&&s<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((at||Fe)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
35
+ `),d&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Oe(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(at&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&Fe)&&on(l.node,l.offset,u.anchorNode,u.anchorOffset)&&on(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!d){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Yt:il,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=mt:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Yt:mt}r=s}this.dirty=Yt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Yt:il;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class vc extends nr{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!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,o=this}matchesWidget(e){return this.dirty==ot&&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 Vf extends nr{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class sn extends nr{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=un.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new sn(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ot){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ot}}slice(e,t,r){let i=sn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=mo(o,t,s,r)),e>0&&(o=mo(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class $t extends nr{constructor(e,t,r,i,o,s,l,a,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),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}=un.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=kc(u,r,t),c?a=new Wf(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new Xr(e,t,r,i,u,f,o):new $t(e,t,r,i,u,d||null,f,o,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=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==ot&&e.eq(this.node)&&Pr(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,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Uf(this,s&&s.node,e);Yf(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?le.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Yt)&&(s&&this.protectLocalComposition(e,s),xc(this.contentDOM,this.children,e),En&&Gf(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof z)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Xf(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Vf(this,o,t,i);e.input.compositionNodes.push(s),this.children=mo(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==mt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ot}updateOuterDeco(e){if(Pr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=wc(this.dom,this.nodeDOM,po(this.outerDeco,this.node,t),po(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 ol(n,e,t,r,i){kc(r,e,n);let o=new $t(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Xr extends $t{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,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,i){return this.dirty==mt||this.dirty!=ot&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ot||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ot,!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 i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Xr(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=mt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Sc extends nr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ot&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Wf extends $t{constructor(e,t,r,i,o,s,l,a,c,u){super(e,t,r,i,o,s,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==mt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function xc(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=sl(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof sn){let a=r?r.previousSibling:n.lastChild;xc(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=sl(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Wn=function(n){n&&(this.nodeName=n)};Wn.prototype=Object.create(null);const Gt=[new Wn];function po(n,e,t){if(n.length==0)return Gt;let r=t?Gt[0]:new Wn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Wn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new Wn(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 i}function wc(n,e,t,r){if(t==Gt&&r==Gt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Gt[0]),i=a}qf(i,l||Gt[0],s)}return i}function qf(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):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function kc(n,e,t){return wc(n,n,Gt,po(e,t,n.nodeType!=1))}function Pr(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 sl(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Uf{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Kf(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 i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=ot,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<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[o])&&!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=sn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=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)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==mt&&s.dom==s.contentDOM&&(s.dirty=Yt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof $t){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)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!=mt&&Pr(t,a.outerDeco));if(!f&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Yt,d.updateChildren(i,s+1),d.dirty=ot),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=$t.create(this.top,t,r,i,o,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,i,o){let s=$t.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new vc(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof sn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Fe||Ie)&&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 i=new Sc(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Kf(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof sn)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(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Jf(n,e){return n.type.side-e.type.side}function Yf(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(Jf);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<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+f.nodeSize;if(f.isText){let g=p;s<i.length&&i[s].from<g&&(g=i[s].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=f.cut(g-o),f=f.cut(0,g-o),p=g,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(o,f),h),o=p}}function Gf(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 Xf(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=t){if(o>=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 mo(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,u=l+=a.size;c>=t||u<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>t&&o.push(a.slice(t-c,a.size,r)))}return o}function Ho(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Gr(t)){for(a=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&L.isSelectable(d)&&i.parent&&!(d.isInline&&kf(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new L(s==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=s,f=s;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);d=Math.min(d,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=Vo(n,u,l,d)}return c}function Cc(n){return n.editable?n.hasFocus():Tc(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Mt(n,e=!1){let t=n.state.selection;if(Mc(n,t),!!Cc(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ie){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&on(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Qf(n);else{let{anchor:r,head:i}=t,o,s;ll&&!(t instanceof z)&&(t.$from.parent.inlineContent||(o=al(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=al(n,t.to))),n.docView.setSelection(r,i,n,e),ll&&(o&&cl(o),s&&cl(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Zf(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ll=Fe||Ie&&fc<63;function al(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Fe&&i&&i.contentEditable=="false")return Ai(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Ai(i);if(o)return Ai(o)}}function Ai(n){return n.contentEditable="true",Fe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function cl(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Zf(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Cc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Qf(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Oe(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Ke&&Bt<=11&&(r.disabled=!0,r.disabled=!1)}function Mc(n,e){if(e instanceof L){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ul(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ul(n)}function ul(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Vo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||z.between(e,t,r)}function dl(n){return n.editable&&!n.hasFocus()?!1:Tc(n)}function Tc(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 eh(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return on(e.node,e.offset,t.anchorNode,t.anchorOffset)}function go(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&B.findFrom(o,e)}function At(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function fl(n,e,t){let r=n.state.selection;if(r instanceof z)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return At(n,new z(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=go(n.state,e);return i&&i instanceof L?At(n,i):!1}else if(!(rt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?L.isSelectable(o)?At(n,new L(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):tr?At(n,new z(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof L&&r.node.isInline)return At(n,new z(e>0?r.$to:r.$from));{let i=go(n.state,e);return i?At(n,i):!1}}}function Ir(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function qn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function gn(n,e){return e<0?th(n):nh(n)}function th(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(at&&t.nodeType==1&&r<Ir(t)&&qn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(qn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Ec(t))break;{let l=t.previousSibling;for(;l&&qn(l,-1);)i=t.parentNode,o=Oe(l),l=l.previousSibling;if(l)t=l,r=Ir(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?yo(n,t,r):i&&yo(n,i,o)}function nh(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Ir(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(qn(l,1))o=t,s=++r;else break}else{if(Ec(t))break;{let l=t.nextSibling;for(;l&&qn(l,1);)o=l.parentNode,s=Oe(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Ir(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&yo(n,o,s)}function Ec(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function rh(n,e){for(;n&&e==n.childNodes.length&&!er(n);)e=Oe(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 ih(n,e){for(;n&&!e&&!er(n);)e=Oe(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 yo(n,e,t){if(e.nodeType!=3){let o,s;(s=rh(e,t))?(e=s,t=0):(o=ih(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Gr(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Mt(n)},50)}function hl(n,e){let t=n.state.doc.resolve(e);if(!(Ie||Tf)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function pl(n,e,t){let r=n.state.selection;if(r instanceof z&&!r.empty||t.indexOf("s")>-1||rt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=go(n.state,e);if(s&&s instanceof L)return At(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Xe?B.near(s,e):B.findFrom(s,e);return l?At(n,l):!1}return!1}function ml(n,e){if(!(n.state.selection instanceof z))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function gl(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function oh(n){if(!Fe||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;gl(n,r,"true"),setTimeout(()=>gl(n,r,"false"),20)}return!1}function sh(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function lh(n,e){let t=e.keyCode,r=sh(e);if(t==8||rt&&t==72&&r=="c")return ml(n,-1)||gn(n,-1);if(t==46&&!e.shiftKey||rt&&t==68&&r=="c")return ml(n,1)||gn(n,1);if(t==13||t==27)return!0;if(t==37||rt&&t==66&&r=="c"){let i=t==37?hl(n,n.state.selection.from)=="ltr"?-1:1:-1;return fl(n,i,r)||gn(n,i)}else if(t==39||rt&&t==70&&r=="c"){let i=t==39?hl(n,n.state.selection.from)=="ltr"?1:-1:1;return fl(n,i,r)||gn(n,i)}else{if(t==38||rt&&t==80&&r=="c")return pl(n,-1,r)||gn(n,-1);if(t==40||rt&&t==78&&r=="c")return oh(n)||pl(n,1,r)||gn(n,1);if(r==(rt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Oc(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;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")||un.fromSchema(n.state.schema),l=Ic(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Pc[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",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
38
36
 
39
- `);return{dom:a,text:f,slice:e}}function Tc(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||o||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,o||r,n)}),o)return e?new T(C.from(n.state.schema.text(e.replace(/\r\n?/g,`
40
- `))),0,0):T.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)l=d;else{let f=i.marks(),{schema:h}=n.state,p=un.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=ah(t),Qn&&ch(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")||Lt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!oh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=uh(gl(l,+u[1],+u[2]),u[4]);else if(l=T.maxOpen(sh(l.content,i),!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=gl(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const oh=/^(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 sh(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Dc(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Ac(s[s.length-1],o.length));let u=Oc(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return C.from(s)}return n}function Oc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function Dc(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Dc(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(C.from(Oc(t,n,i+1))))}}function Ac(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ac(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function bo(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=bo(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function gl(n,e,t){return e<n.openStart&&(n=new T(bo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new T(bo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Rc={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 yl=null;function Pc(){return yl||(yl=document.implementation.createHTMLDocument("title"))}let Di=null;function lh(n){let e=window.trustedTypes;return e?(Di||(Di=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Di.createHTML(n)):n}function ah(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Pc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Rc[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=lh(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function ch(n){let e=n.querySelectorAll(Ie?"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 uh(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:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=C.from(a.create(r[l+1],i)),o++,s++}return new T(i,o,s)}const Fe={},He={},dh={touchstart:!0,touchmove:!0};class fh{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function hh(n){for(let e in Fe){let t=Fe[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{mh(n,r)&&!Wo(n,r)&&(n.editable||!(r.type in He))&&t(n,r)},dh[e]?{passive:!0}:void 0)}je&&n.dom.addEventListener("input",()=>null),vo(n)}function _t(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ph(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 vo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Wo(n,r))})}function Wo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function mh(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 gh(n,e){!Wo(n,e)&&Fe[e.type]&&(n.editable||!(e.type in He))&&Fe[e.type](n,e)}He.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!_c(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(kt&&Ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Mn&&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",i=>i(n,Kt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ih(n,t)?t.preventDefault():_t(n,"key")};He.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};He.keypress=(n,e)=>{let t=e;if(_c(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||rt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Zr(n){return{left:n.clientX,top:n.clientY}}function yh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function qo(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function Cn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function bh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(Cn(n,new z(t)),!0):!1}function vh(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof z&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(z.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(Cn(n,z.create(n.state.doc,i)),!0):!1}function xh(n,e,t,r,i){return qo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?vh(n,t):bh(n,t))}function Sh(n,e,t,r){return qo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function wh(n,e,t,r){return qo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||kh(n,t,r)}function kh(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Cn(n,L.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)Cn(n,L.create(r,l+1,l+1+s.content.size));else if(z.isSelectable(s))Cn(n,z.create(r,l));else continue;return!0}}function Uo(n){return _r(n)}const Ic=rt?"metaKey":"ctrlKey";Fe.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Uo(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&yh(t,n.input.lastClick)&&!t[Ic]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let s=n.posAtCoords(Zr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Ch(n,s,t,!!r)):(o=="doubleClick"?Sh:wh)(n,s.pos,s.inside,t)?t.preventDefault():_t(n,"pointer"))};class Ch{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ic],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const l=i?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&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof z&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&at&&!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)),_t(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Et(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Zr(e))),this.updateAllowDefault(e),this.allowDefault||!t?_t(this.view,"pointer"):xh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||je&&this.mightDrag&&!this.mightDrag.node.isAtom||Ie&&!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)?(Cn(this.view,V.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):_t(this.view,"pointer")}move(e){this.updateAllowDefault(e),_t(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)}}Fe.touchstart=n=>{n.input.lastTouch=Date.now(),Uo(n),_t(n,"pointer")};Fe.touchmove=n=>{n.input.lastTouch=Date.now(),_t(n,"pointer")};Fe.contextmenu=n=>Uo(n);function _c(n,e){return n.composing?!0:je&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Eh=kt?5e3:-1;He.compositionstart=He.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof L&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),_r(n,!0),n.markCursor=null;else if(_r(n,!e.selection.empty),at&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}zc(n,Eh)};He.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++,zc(n,20))};function zc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>_r(n),e))}function Lc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Mh());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Nh(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=bf(e.focusNode,e.focusOffset),r=vf(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Mh(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function _r(n,e=!1){if(!(kt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Lc(n),e||n.docView&&n.docView.dirty){let t=Fo(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Th(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(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Kn=Ke&&Vt<15||Mn&&Cf<604;Fe.copy=He.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Kn?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Mc(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):Th(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Oh(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Dh(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 i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Jn(n,r.value,null,i,e):Jn(n,r.textContent,r.innerHTML,i,e)},50)}function Jn(n,e,t,r,i){let o=Tc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,o||T.empty)))return!0;if(!o)return!1;let s=Oh(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Vc(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," "):""}He.paste=(n,e)=>{let t=e;if(n.composing&&!kt)return;let r=Kn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Jn(n,Vc(r),r.getData("text/html"),i,t)?t.preventDefault():Dh(n,t)};class Bc{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const $c=rt?"altKey":"ctrlKey";Fe.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Zr(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)s=z.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=z.create(n.state.doc,d.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:u}=Mc(n,l);(!t.dataTransfer.files.length||!Ie||dc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Kn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Kn||t.dataTransfer.setData("text/plain",c),n.dragging=new Bc(u,!t[$c],s)};Fe.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};He.dragover=He.dragenter=(n,e)=>e.preventDefault();He.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Zr(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=Tc(n,Vc(t.dataTransfer),Kn?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[$c]);if(n.someProp("handleDrop",p=>p(n,t,s||T.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?tc(n.state.doc,o.pos,s):o.pos;a==null&&(a=o.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&&z.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new z(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,x)=>p=x),c.setSelection(Ho(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Fe.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())&&Et(n)},20))};Fe.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)};Fe.beforeinput=(n,e)=>{if(Ie&&kt&&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",o=>o(n,Kt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in He)Fe[n]=He[n];function Yn(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 zr{constructor(e,t){this.toDOM=e,this.spec=t||en,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new $e(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof zr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Yn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $t{constructor(e,t){this.attrs=e,this.spec=t||en}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new $e(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $t&&Yn(this.attrs,e.attrs)&&Yn(this.spec,e.spec)}static is(e){return e.type instanceof $t}destroy(){}}class Ko{constructor(e,t){this.attrs=e,this.spec=t||en}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new $e(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Ko&&Yn(this.attrs,e.attrs)&&Yn(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 zr(t,r))}static inline(e,t,r,i){return new $e(e,t,new $t(r,i))}static node(e,t,r,i){return new $e(e,t,new Ko(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof $t}get widget(){return this.type instanceof zr}}const bn=[],en={};class ue{constructor(e,t){this.local=e.length?e:bn,this.children=t.length?t:bn}static create(e,t){return t.length?Lr(t,e,0,en):Pe}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}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,i+l,o)}}map(e,t,r){return this==Pe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||en)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?Ah(this.children,s||[],e,t,r,i,o):s?new ue(s.sort(tn),bn):Pe}add(e,t){return t.length?this==Pe?ue.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Fc(t,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,u,c+1):i.splice(o,0,a,a+l.nodeSize,Lr(u,l,c+1,en)),o+=3}});let s=jc(o?Hc(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ue(s.length?this.local.concat(s).sort(tn):this.local,i||this.children)}remove(e){return e.length==0||this==Pe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,a=r[o+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[o+2].removeInner(s,l+1);c!=Pe?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ue(i,r):Pe}forChild(e,t){if(this==Pe)return this;if(t.isLeaf)return ue.empty;let r,i;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 o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof $t){let c=Math.max(o,a.from)-o,u=Math.min(s,a.to)-o;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ue(i.sort(tn),bn);return r?new At([l,r]):l}return r||Pe}eq(e){if(this==e)return!0;if(!(e instanceof ue)||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 Jo(this.localsInner(e))}localsInner(e){if(this==Pe)return bn;if(e.inlineContent||!this.local.some($t.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof $t||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ue.empty=new ue([],[]);ue.removeOverlap=Jo;const Pe=ue.empty;class At{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,en));return At.from(r)}forChild(e,t){if(t.isLeaf)return ue.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Pe&&(o instanceof At?r=r.concat(o.members):r.push(o))}return At.from(r)}eq(e){if(!(e instanceof At)||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 i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?Jo(r?t:t.sort(tn)):bn}static from(e){switch(e.length){case 0:return Pe;case 1:return e[0];default:return new At(e.every(t=>t instanceof ue)?e:e.reduce((t,r)=>t.concat(r instanceof ue?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ah(n,e,t,r,i,o,s){let l=n.slice();for(let c=0,u=o;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let b=0;b<l.length;b+=3){let x=l[b+1];if(x<0||f>x+u-d)continue;let S=l[b]+u-d;h>=S?l[b+1]=f<=S?-2:-1:f>=u&&g&&(l[b]+=g,l[b+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]+o),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+o,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,u+1,n[c]+o+1,s);b!=Pe?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Rh(l,n,e,t,i,o,s),u=Lr(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 ue(e.sort(tn),l)}function jc(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new $e(i.from+e,i.to+e,i.type))}return t}function Rh(n,e,t,r,i,o,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,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]+o+1);return t}function Fc(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Hc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Lr(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Fc(n,l,a+t);if(c){o=!0;let u=Lr(c,l,t+a+1,r);u!=Pe&&i.push(a,a+l.nodeSize,u)}});let s=jc(o?Hc(n):n,-t).sort(tn);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||i.length?new ue(s,i):Pe}function tn(n,e){return n.from-e.from||n.to-e.to}function Jo(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),bl(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),bl(e,i,r.copy(o.from,r.to)));break}}}return e}function bl(n,e,t){for(;e<n.length&&tn(t,n[e])>0;)e++;n.splice(e,0,t)}function Ai(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Pe&&e.push(r)}),n.cursorWrapper&&e.push(ue.create(n.state.doc,[n.cursorWrapper.deco])),At.from(e)}const Ph={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ih=Ke&&Vt<=11;class _h{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 zh{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _h,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Ke&&Vt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Ih&&(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,Ph)),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(ul(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(Ke&&Vt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&on(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 o=e.focusNode;o;o=Un(o))t.add(o);for(let o=e.anchorNode;o;o=Un(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ul(e)&&!this.ignoreSelectionChange(r),o=-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&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(at&&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||Bh(e,d)!=h)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gr(r)&&(c=Fo(e))&&c.eq(V.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Lh(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(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++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Ke&&Vt<=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)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?Te(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?Te(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let vl=new WeakMap,xl=!1;function Lh(n){if(!vl.has(n)&&(vl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=at,xl)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."),xl=!0}}function Sl(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return on(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Vh(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Sl(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Sl(n,t):null}function Bh(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 $h(n,e,t){let{node:r,fromOffset:i,toOffset:o,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}],Gr(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ie&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],x=b.pmViewDesc;if(b.nodeName=="BR"&&!x){o=g;break}if(!x||x.size)break}let d=n.state.doc,f=n.someProp("domParser")||Lt.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:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:jh,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function jh(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(je&&/^(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||je&&/^(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 Fh=/^(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 Hh(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let _=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,oe=Fo(n,_);if(oe&&!n.state.selection.eq(oe)){if(Ie&&kt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Ee=>Ee(n,Kt(13,"Enter"))))return;let ge=n.state.tr.setSelection(oe);_=="pointer"?ge.setMeta("pointer",!0):_=="key"&&ge.scrollIntoView(),o&&ge.setMeta("composition",o),n.dispatch(ge)}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=$h(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=Uh(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Mn&&n.input.lastIOSEnter>Date.now()-225||kt)&&i.some(_=>_.nodeType==1&&!Fh.test(_.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",_=>_(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof L&&!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 _=wl(n,n.state.doc,c.sel);if(_&&!_.eq(n.state.selection)){let oe=n.state.tr.setSelection(_);o&&oe.setMeta("composition",o),n.dispatch(oe)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof L&&(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)),Ke&&Vt<=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),b=u.resolve(p.start),x=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,S;if((Mn&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(S=V.findFrom(c.doc.resolve(m.pos+1),1,!0))&&S.head==g.pos)&&n.someProp("handleKeyDown",_=>_(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&qh(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",_=>_(n,Kt(8,"Backspace")))){kt&&Ie&&n.domObserver.suppressSelectionUpdates();return}Ie&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),kt&&!x&&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(_){return _(n,Kt(13,"Enter"))})},20));let k=p.start,v=p.endA,N,O,B;if(x){if(m.pos==g.pos)Ke&&Vt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Et(n),20)),N=n.state.tr.delete(k,v),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(B=Wh(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))N=n.state.tr,B.type=="add"?N.addMark(k,v,B.mark):N.removeMark(k,v,B.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let _=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",oe=>oe(n,k,v,_)))return;N=n.state.tr.insertText(_,k,v)}}if(N||(N=n.state.tr.replace(k,v,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let _=wl(n,N.doc,c.sel);_&&!(Ie&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(_.head==k||_.head==N.mapping.map(v)-1)||Ke&&_.empty&&_.head==k)&&N.setSelection(_)}O&&N.ensureMarks(O),o&&N.setMeta("composition",o),n.dispatch(N.scrollIntoView())}function wl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ho(n,e.resolve(t.anchor),e.resolve(t.head))}function Wh(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[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(C.from(c).eq(n))return{mark:l,type:s}}function qh(n,e,t,r,i){if(t-e<=i.pos-r.pos||Ri(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Ri(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Ri(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ri(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Uh(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&n.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&kl(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&kl(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function kl(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 Kh{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 fh,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Tl),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=Nl(this),El(this),this.nodeViews=Ml(this),this.docView=il(this.state.doc,Cl(this),Ai(this),this.dom,this),this.domObserver=new zh(this,(r,i,o,s)=>Hh(this,r,i,o,s)),this.domObserver.start(),hh(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&&vo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Tl),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 i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Lc(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ml(this);Yh(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&vo(this),this.editable=Nl(this),El(this);let a=Ai(this),c=Cl(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Mf(this);if(s){this.domObserver.stop();let h=d&&(Ke||Ie)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Jh(i.selection,e.selection);if(d){let p=Ie?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Nh(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=il(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Xf(this))?Et(this,h):(Cc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Tf(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof z){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Zs(this,t.getBoundingClientRect(),e)}else Zs(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,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Bc(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Ke){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&&Of(this.dom),Et(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 If(this,e)}coordsAtPos(e,t=1){return gc(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 i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Bf(this,t||this.state,e)}pasteHTML(e,t){return Jn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Jn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(ph(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ai(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,gf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return gh(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?je&&this.root.nodeType===11&&Sf(this.dom.ownerDocument)==this.dom&&Vh(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Cl(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 El(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.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Nl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Jh(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 Ml(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Yh(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Tl(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")}var jt={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:"'"},Vr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Gh=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xh=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Oe=0;Oe<10;Oe++)jt[48+Oe]=jt[96+Oe]=String(Oe);for(var Oe=1;Oe<=24;Oe++)jt[Oe+111]="F"+Oe;for(var Oe=65;Oe<=90;Oe++)jt[Oe]=String.fromCharCode(Oe+32),Vr[Oe]=String.fromCharCode(Oe);for(var Pi in jt)Vr.hasOwnProperty(Pi)||(Vr[Pi]=jt[Pi]);function Zh(n){var e=Gh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Xh&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Vr:jt)[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 Qh=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function ep(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,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))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Qh?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function tp(n){let e=Object.create(null);for(let t in n)e[ep(t)]=n[t];return e}function Ii(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 np(n){return new Le({props:{handleKeyDown:Yo(n)}})}function Yo(n){let e=tp(n);return function(t,r){let i=Zh(r),o,s=e[Ii(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ii(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=jt[r.keyCode])&&o!=i){let l=e[Ii(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Go=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Wc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const qc=(n,e,t)=>{let r=Wc(n,t);if(!r)return!1;let i=Xo(r);if(!i){let s=r.blockRange(),l=s&&Dn(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(eu(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Tn(o,"end")||z.isSelectable(o)))for(let s=r.depth;;s--){let l=Jr(n.doc,r.before(s),r.after(s),T.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Tn(o,"end")?V.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):z.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},rp=(n,e,t)=>{let r=Wc(n,t);if(!r)return!1;let i=Xo(r);return i?Uc(n,i,e):!1},ip=(n,e,t)=>{let r=Jc(n,t);if(!r)return!1;let i=Zo(r);return i?Uc(n,i,e):!1};function Uc(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=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=Jr(n.doc,o,a,T.empty);if(!c||c.from!=o||c instanceof Se&&c.slice.size>=a-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(L.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Tn(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 Kc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Xo(r)}let s=o&&o.nodeBefore;return!s||!z.isSelectable(s)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Xo(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 Jc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Yc=(n,e,t)=>{let r=Jc(n,t);if(!r)return!1;let i=Zo(r);if(!i)return!1;let o=i.nodeAfter;if(eu(n,i,e,1))return!0;if(r.parent.content.size==0&&(Tn(o,"start")||z.isSelectable(o))){let s=Jr(n.doc,r.before(),r.after(),T.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Tn(o,"start")?V.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):z.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Gc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Zo(r)}let s=o&&o.nodeAfter;return!s||!z.isSelectable(s)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,o.pos)).scrollIntoView()),!0)};function Zo(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 op=(n,e)=>{let t=n.selection,r=t instanceof z,i;if(r){if(t.node.isTextblock||!Ft(n.doc,t.from))return!1;i=t.from}else if(i=Kr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(z.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},sp=(n,e)=>{let t=n.selection,r;if(t instanceof z){if(t.node.isTextblock||!Ft(n.doc,t.to))return!1;r=t.to}else if(r=Kr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},lp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Dn(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Xc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
41
- `).scrollIntoView()),!0)};function Qo(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 ap=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=Qo(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(V.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Zc=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Xe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Qo(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(L.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Qc=(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 o=t.before();if(Ct(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Dn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function cp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!Ct(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Qo(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof L||e.selection instanceof Xe)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ct(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Ct(u.doc,d,o.length,o)),u.split(d,o.length,o),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return t&&t(u.scrollIntoView()),!0}}const up=cp(),dp=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(z.create(n.doc,i))),!0)};function fp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ft(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function eu(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&fp(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let h=e.pos+o.nodeSize,p=C.empty;for(let b=s.length-1;b>=0;b--)p=C.from(s[b].create(null,p));p=C.from(i.copy(p));let m=n.tr.step(new we(e.pos-1,h,e.pos,h,new T(p,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Ft(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:V.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Dn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Tn(o,"start",!0)&&Tn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let b=C.empty;for(let S=p.length-1;S>=0;S--)b=C.from(p[S].copy(b));let x=n.tr.step(new we(e.pos-p.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new T(b,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function tu(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(L.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const hp=tu(-1),pp=tu(1);function mp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&Bo(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Ol(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}function es(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}es(Go,qc,Kc);es(Go,Yc,Gc);es(Xc,Zc,Qc,up);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function gp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let u=t.doc.resolve(s.start-2);a=new Or(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Or(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=Bo(a,n,e,s);return c?(r&&r(yp(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function yp(n,e,t,r,i){let o=C.empty;for(let u=t.length-1;u>=0;u--)o=C.from(t[u].type.create(t[u].attrs,o));n.step(new we(e.start-(r?2:0),e.end,e.start,e.end,new T(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(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&&Ct(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function bp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?vp(e,t,n,o):xp(e,t,o):!0:!1}}function vp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new we(o-1,s,o,s,new T(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Or(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Dn(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return Ft(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function xp(n,e,t){let r=n.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?C.empty:C.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new we(d-(l?1:0),f+(a?1:0),d+1,f-1,new T((l?C.empty:C.from(i.copy(C.empty))).append(a?C.empty:C.from(i.copy(C.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Sp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=C.from(c?n.create():null),d=new T(C.from(n.create(null,C.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new we(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Qr(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class ei{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:i}=t,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],a=!!e,c=e||o.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),b=h(...m)(g);return l.push(b),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:Qr({state:o,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 wp{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(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const r=(...i)=>{this.off(e,r),t.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function P(n,e,t){return n.config[e]===void 0&&n.parent?P(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?P(n.parent,e,t):null}):n.config[e]}function ti(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function nu(n){const e=[],{nodeExtensions:t,markExtensions:r}=ti(n),i=[...t,...r],o={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,extensions:i},a=P(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:{...o,...h}})})})})}),i.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=P(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...o,...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 Ce(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 ie(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const l=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else if(i==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=o}),r},{})}function Br(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ie(t,r),{})}function ru(n){return typeof n=="function"}function q(n,e=void 0,...t){return ru(n)?e?n.bind(e)(...t):n(...t):n}function kp(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cp(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Dl(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):Cp(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function Al(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&kp(t)?!1:t!=null))}function Ep(n,e){var t;const r=nu(n),{nodeExtensions:i,markExtensions:o}=ti(n),s=(t=i.find(c=>P(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((b,x)=>{const S=P(x,"extendNodeSchema",d);return{...b,...S?S(c):{}}},{}),h=Al({...f,content:q(P(c,"content",d)),marks:q(P(c,"marks",d)),group:q(P(c,"group",d)),inline:q(P(c,"inline",d)),atom:q(P(c,"atom",d)),selectable:q(P(c,"selectable",d)),draggable:q(P(c,"draggable",d)),code:q(P(c,"code",d)),whitespace:q(P(c,"whitespace",d)),linebreakReplacement:q(P(c,"linebreakReplacement",d)),defining:q(P(c,"defining",d)),isolating:q(P(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var x;return[b.name,{default:(x=b==null?void 0:b.attribute)===null||x===void 0?void 0:x.default}]}))}),p=q(P(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>Dl(b,u)));const m=P(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Br(b,u)}));const g=P(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(o.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,b)=>{const x=P(b,"extendMarkSchema",d);return{...g,...x?x(c):{}}},{}),h=Al({...f,inclusive:q(P(c,"inclusive",d)),excludes:q(P(c,"excludes",d)),group:q(P(c,"group",d)),spanning:q(P(c,"spanning",d)),code:q(P(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=q(P(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Dl(g,u)));const m=P(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Br(g,u)})),[c.name,h]}));return new Wa({topNode:s,nodes:l,marks:a})}function _i(n,e){return e.nodes[n]||e.marks[n]||null}function Rl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function ts(n,e){const t=un.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Np=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function ns(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class ni{constructor(e){this.find=e.find,this.handler=e.handler}}const Mp=(n,e)=>{if(ns(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 cr(n){var e;const{editor:t,from:r,to:i,text:o,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=Np(c)+o;return s.forEach(f=>{if(u)return;const h=Mp(d,f.find);if(!h)return;const p=a.state.tr,m=Qr({state:a.state,transaction:p}),g={from:r-(h[0].length-o.length),to:i},{commands:b,chain:x,can:S}=new ei({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:b,chain:x,can:S})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:o}),a.dispatch(p),u=!0)}),u}function Tp(n){const{editor:e,rules:t}=n,r=new Le({state:{init(){return null},apply(i,o,s){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=ts(C.from(u),s.schema);const{from:d}=a,f=d+u.length;cr({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return cr({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&cr({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?cr({editor:e,from:s.pos,to:s.pos,text:`
42
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Op(n){return Object.prototype.toString.call(n).slice(8,-1)}function ur(n){return Op(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ri(n,e){const t={...n};return ur(n)&&ur(e)&&Object.keys(e).forEach(r=>{ur(e[r])&&ur(n[r])?t[r]=ri(n[r],e[r]):t[r]=e[r]}),t}class Qe{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=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Qe(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Qe(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.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: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.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(" ",i.pos),e.view.dispatch(r),!0}return!1}}function Dp(n){return typeof n=="number"}class Ap{constructor(e){this.find=e.find,this.handler=e.handler}}const Rp=(n,e,t)=>{if(ns(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Pp(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:u}=new ei({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");Rp(b,o.find,s).forEach(S=>{if(S.index===void 0)return;const k=m+S.index+1,v=k+S[0].length,N={from:t.tr.mapping.map(k),to:t.tr.mapping.map(v)},O=o.handler({state:t,range:N,match:S,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(O)})}),d.every(h=>h!==null)}let dr=null;const Ip=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 _p(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=Qr({state:u,transaction:m});if(!(!Pp({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new Le({view(d){const f=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(dr=e)},h=()=>{dr&&(dr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(o=r===d.dom.parentElement,l=f,!o){const h=dr;h&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),x=!!b;if(!m&&!g&&!x)return;if(x){let{text:v}=b;typeof v=="string"?v=v:v=ts(C.from(v),h.schema);const{from:N}=b,O=N+v.length,B=Ip(v);return a({rule:u,state:h,from:N,to:{b:O},pasteEvt:B})}const S=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!Dp(S)||!k||S===k.b))return a({rule:u,state:h,from:S,to:k,pasteEvt:s})}}))}function zp(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class xn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=xn.resolve(e),this.schema=Ep(this.extensions,t),this.setupExtensions()}static resolve(e){const t=xn.sort(xn.flatten(e)),r=zp(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).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},i=P(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=P(r,"priority")||100,s=P(i,"priority")||100;return o>s?-1:o<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:_i(t.name,this.schema)},i=P(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=xn.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:_i(s.name,this.schema)},a=[],c=P(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&P(s,"exitable",l)&&(u.ArrowRight=()=>Qe.handleExit({editor:e,mark:s})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const d=np(u);a.push(d);const f=P(s,"addInputRules",l);Rl(s,e.options.enableInputRules)&&f&&r.push(...f());const h=P(s,"addPasteRules",l);Rl(s,e.options.enablePasteRules)&&h&&i.push(...h());const p=P(s,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[Tp({editor:e,rules:r}),..._p({editor:e,rules:i}),...o]}get attributes(){return nu(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=ti(this.extensions);return Object.fromEntries(t.filter(r=>!!P(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ce(r.name,this.schema)},s=P(r,"addNodeView",o);if(!s)return[];const l=(a,c,u,d,f)=>{const h=Br(a,i);return s()({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};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:_i(e.name,this.schema)};e.type==="mark"&&(!((t=q(P(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=P(e,"onBeforeCreate",r),o=P(e,"onCreate",r),s=P(e,"onUpdate",r),l=P(e,"onSelectionUpdate",r),a=P(e,"onTransaction",r),c=P(e,"onFocus",r),u=P(e,"onBlur",r),d=P(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),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)})}}class De{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=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new De({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.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: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}}function iu(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
37
+ `);return{dom:a,text:f,slice:e}}function Ac(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||o||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,o||r,n)}),o)return e?new O(C.from(n.state.schema.text(e.replace(/\r\n?/g,`
38
+ `))),0,0):O.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)l=d;else{let f=i.marks(),{schema:h}=n.state,p=un.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=dh(t),tr&&fh(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")||zt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!ah.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=hh(yl(l,+u[1],+u[2]),u[4]);else if(l=O.maxOpen(ch(l.content,i),!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=yl(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const ah=/^(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 ch(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Rc(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Dc(s[s.length-1],o.length));let u=Nc(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return C.from(s)}return n}function Nc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function Rc(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Rc(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(C.from(Nc(t,n,i+1))))}}function Dc(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Dc(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function bo(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=bo(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function yl(n,e,t){return e<n.openStart&&(n=new O(bo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new O(bo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Pc={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 bl=null;function Ic(){return bl||(bl=document.implementation.createHTMLDocument("title"))}let Ni=null;function uh(n){let e=window.trustedTypes;return e?(Ni||(Ni=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ni.createHTML(n)):n}function dh(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ic().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Pc[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=uh(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function fh(n){let e=n.querySelectorAll(Ie?"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 hh(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:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=C.from(a.create(r[l+1],i)),o++,s++}return new O(i,o,s)}const He={},Ve={},ph={touchstart:!0,touchmove:!0};class mh{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function gh(n){for(let e in He){let t=He[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{bh(n,r)&&!Wo(n,r)&&(n.editable||!(r.type in Ve))&&t(n,r)},ph[e]?{passive:!0}:void 0)}Fe&&n.dom.addEventListener("input",()=>null),vo(n)}function _t(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function yh(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 vo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Wo(n,r))})}function Wo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function bh(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 vh(n,e){!Wo(n,e)&&He[e.type]&&(n.editable||!(e.type in Ve))&&He[e.type](n,e)}Ve.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Lc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(kt&&Ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),En&&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",i=>i(n,Kt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||lh(n,t)?t.preventDefault():_t(n,"key")};Ve.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ve.keypress=(n,e)=>{let t=e;if(Lc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||rt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof z)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Zr(n){return{left:n.clientX,top:n.clientY}}function Sh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function qo(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function Cn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function xh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&L.isSelectable(r)?(Cn(n,new L(t)),!0):!1}function wh(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof L&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(L.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(Cn(n,L.create(n.state.doc,i)),!0):!1}function kh(n,e,t,r,i){return qo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?wh(n,t):xh(n,t))}function Ch(n,e,t,r){return qo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Mh(n,e,t,r){return qo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Th(n,t,r)}function Th(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Cn(n,z.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)Cn(n,z.create(r,l+1,l+1+s.content.size));else if(L.isSelectable(s))Cn(n,L.create(r,l));else continue;return!0}}function Uo(n){return _r(n)}const _c=rt?"metaKey":"ctrlKey";He.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Uo(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&Sh(t,n.input.lastClick)&&!t[_c]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let s=n.posAtCoords(Zr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Eh(n,s,t,!!r)):(o=="doubleClick"?Ch:Mh)(n,s.pos,s.inside,t)?t.preventDefault():_t(n,"pointer"))};class Eh{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[_c],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const l=i?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&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof L&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&at&&!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)),_t(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(()=>Mt(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(Zr(e))),this.updateAllowDefault(e),this.allowDefault||!t?_t(this.view,"pointer"):kh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Fe&&this.mightDrag&&!this.mightDrag.node.isAtom||Ie&&!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)?(Cn(this.view,B.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):_t(this.view,"pointer")}move(e){this.updateAllowDefault(e),_t(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)}}He.touchstart=n=>{n.input.lastTouch=Date.now(),Uo(n),_t(n,"pointer")};He.touchmove=n=>{n.input.lastTouch=Date.now(),_t(n,"pointer")};He.contextmenu=n=>Uo(n);function Lc(n,e){return n.composing?!0:Fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Oh=kt?5e3:-1;Ve.compositionstart=Ve.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof z&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),_r(n,!0),n.markCursor=null;else if(_r(n,!e.selection.empty),at&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}zc(n,Oh)};Ve.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++,zc(n,20))};function zc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>_r(n),e))}function Bc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Nh());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Ah(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=xf(e.focusNode,e.focusOffset),r=wf(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Nh(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function _r(n,e=!1){if(!(kt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Bc(n),e||n.docView&&n.docView.dirty){let t=Ho(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Rh(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(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Yn=Ke&&Bt<15||En&&Ef<604;He.copy=Ve.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Yn?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Oc(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):Rh(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Dh(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ph(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 i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Gn(n,r.value,null,i,e):Gn(n,r.textContent,r.innerHTML,i,e)},50)}function Gn(n,e,t,r,i){let o=Ac(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,o||O.empty)))return!0;if(!o)return!1;let s=Dh(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $c(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," "):""}Ve.paste=(n,e)=>{let t=e;if(n.composing&&!kt)return;let r=Yn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Gn(n,$c(r),r.getData("text/html"),i,t)?t.preventDefault():Ph(n,t)};class jc{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Fc=rt?"altKey":"ctrlKey";He.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Zr(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof L?i.to-1:i.to))){if(r&&r.mightDrag)s=L.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=L.create(n.state.doc,d.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:u}=Oc(n,l);(!t.dataTransfer.files.length||!Ie||fc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Yn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Yn||t.dataTransfer.setData("text/plain",c),n.dragging=new jc(u,!t[Fc],s)};He.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ve.dragover=Ve.dragenter=(n,e)=>e.preventDefault();Ve.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Zr(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=Ac(n,$c(t.dataTransfer),Yn?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[Fc]);if(n.someProp("handleDrop",p=>p(n,t,s||O.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?nc(n.state.doc,o.pos,s):o.pos;a==null&&(a=o.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&&L.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new L(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,S)=>p=S),c.setSelection(Vo(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};He.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())&&Mt(n)},20))};He.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)};He.beforeinput=(n,e)=>{if(Ie&&kt&&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",o=>o(n,Kt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Ve)He[n]=Ve[n];function Xn(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 Lr{constructor(e,t){this.toDOM=e,this.spec=t||en,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new je(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Lr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Xn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class jt{constructor(e,t){this.attrs=e,this.spec=t||en}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new je(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof jt&&Xn(this.attrs,e.attrs)&&Xn(this.spec,e.spec)}static is(e){return e.type instanceof jt}destroy(){}}class Ko{constructor(e,t){this.attrs=e,this.spec=t||en}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new je(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Ko&&Xn(this.attrs,e.attrs)&&Xn(this.spec,e.spec)}destroy(){}}class je{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new je(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 je(e,e,new Lr(t,r))}static inline(e,t,r,i){return new je(e,t,new jt(r,i))}static node(e,t,r,i){return new je(e,t,new Ko(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jt}get widget(){return this.type instanceof Lr}}const bn=[],en={};class ue{constructor(e,t){this.local=e.length?e:bn,this.children=t.length?t:bn}static create(e,t){return t.length?zr(t,e,0,en):Pe}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}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,i+l,o)}}map(e,t,r){return this==Pe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||en)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?Ih(this.children,s||[],e,t,r,i,o):s?new ue(s.sort(tn),bn):Pe}add(e,t){return t.length?this==Pe?ue.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Vc(t,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,u,c+1):i.splice(o,0,a,a+l.nodeSize,zr(u,l,c+1,en)),o+=3}});let s=Hc(o?Wc(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ue(s.length?this.local.concat(s).sort(tn):this.local,i||this.children)}remove(e){return e.length==0||this==Pe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,a=r[o+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[o+2].removeInner(s,l+1);c!=Pe?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ue(i,r):Pe}forChild(e,t){if(this==Pe)return this;if(t.isLeaf)return ue.empty;let r,i;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 o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof jt){let c=Math.max(o,a.from)-o,u=Math.min(s,a.to)-o;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ue(i.sort(tn),bn);return r?new Rt([l,r]):l}return r||Pe}eq(e){if(this==e)return!0;if(!(e instanceof ue)||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 Jo(this.localsInner(e))}localsInner(e){if(this==Pe)return bn;if(e.inlineContent||!this.local.some(jt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof jt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ue.empty=new ue([],[]);ue.removeOverlap=Jo;const Pe=ue.empty;class Rt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,en));return Rt.from(r)}forChild(e,t){if(t.isLeaf)return ue.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Pe&&(o instanceof Rt?r=r.concat(o.members):r.push(o))}return Rt.from(r)}eq(e){if(!(e instanceof Rt)||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 i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?Jo(r?t:t.sort(tn)):bn}static from(e){switch(e.length){case 0:return Pe;case 1:return e[0];default:return new Rt(e.every(t=>t instanceof ue)?e:e.reduce((t,r)=>t.concat(r instanceof ue?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ih(n,e,t,r,i,o,s){let l=n.slice();for(let c=0,u=o;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let b=0;b<l.length;b+=3){let S=l[b+1];if(S<0||f>S+u-d)continue;let x=l[b]+u-d;h>=x?l[b+1]=f<=x?-2:-1:f>=u&&g&&(l[b]+=g,l[b+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]+o),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+o,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,u+1,n[c]+o+1,s);b!=Pe?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=_h(l,n,e,t,i,o,s),u=zr(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 ue(e.sort(tn),l)}function Hc(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new je(i.from+e,i.to+e,i.type))}return t}function _h(n,e,t,r,i,o,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,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]+o+1);return t}function Vc(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Wc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function zr(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Vc(n,l,a+t);if(c){o=!0;let u=zr(c,l,t+a+1,r);u!=Pe&&i.push(a,a+l.nodeSize,u)}});let s=Hc(o?Wc(n):n,-t).sort(tn);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||i.length?new ue(s,i):Pe}function tn(n,e){return n.from-e.from||n.to-e.to}function Jo(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),vl(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),vl(e,i,r.copy(o.from,r.to)));break}}}return e}function vl(n,e,t){for(;e<n.length&&tn(t,n[e])>0;)e++;n.splice(e,0,t)}function Ri(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Pe&&e.push(r)}),n.cursorWrapper&&e.push(ue.create(n.state.doc,[n.cursorWrapper.deco])),Rt.from(e)}const Lh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},zh=Ke&&Bt<=11;class Bh{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 $h{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Bh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Ke&&Bt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),zh&&(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,Lh)),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(dl(this.view)){if(this.suppressingSelectionUpdates)return Mt(this.view);if(Ke&&Bt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&on(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 o=e.focusNode;o;o=Jn(o))t.add(o);for(let o=e.anchorNode;o;o=Jn(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&dl(e)&&!this.ignoreSelectionChange(r),o=-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&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(at&&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||Hh(e,d)!=h)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gr(r)&&(c=Ho(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Mt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),jh(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Mt(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++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Ke&&Bt<=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)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?Oe(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?Oe(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Sl=new WeakMap,xl=!1;function jh(n){if(!Sl.has(n)&&(Sl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=at,xl)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."),xl=!0}}function wl(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return on(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Fh(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return wl(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?wl(n,t):null}function Hh(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 Vh(n,e,t){let{node:r,fromOffset:i,toOffset:o,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}],Gr(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ie&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],S=b.pmViewDesc;if(b.nodeName=="BR"&&!S){o=g;break}if(!S||S.size)break}let d=n.state.doc,f=n.someProp("domParser")||zt.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:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Wh,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function Wh(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Fe&&/^(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||Fe&&/^(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 qh=/^(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 Uh(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let _=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,oe=Ho(n,_);if(oe&&!n.state.selection.eq(oe)){if(Ie&&kt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Me=>Me(n,Kt(13,"Enter"))))return;let ge=n.state.tr.setSelection(oe);_=="pointer"?ge.setMeta("pointer",!0):_=="key"&&ge.scrollIntoView(),o&&ge.setMeta("composition",o),n.dispatch(ge)}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=Vh(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=Yh(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(En&&n.input.lastIOSEnter>Date.now()-225||kt)&&i.some(_=>_.nodeType==1&&!qh.test(_.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",_=>_(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof z&&!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 _=kl(n,n.state.doc,c.sel);if(_&&!_.eq(n.state.selection)){let oe=n.state.tr.setSelection(_);o&&oe.setMeta("composition",o),n.dispatch(oe)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof z&&(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)),Ke&&Bt<=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),b=u.resolve(p.start),S=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,x;if((En&&n.input.lastIOSEnter>Date.now()-225&&(!S||i.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!S&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(x=B.findFrom(c.doc.resolve(m.pos+1),1,!0))&&x.head==g.pos)&&n.someProp("handleKeyDown",_=>_(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Jh(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",_=>_(n,Kt(8,"Backspace")))){kt&&Ie&&n.domObserver.suppressSelectionUpdates();return}Ie&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),kt&&!S&&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(_){return _(n,Kt(13,"Enter"))})},20));let k=p.start,v=p.endA,T,A,$;if(S){if(m.pos==g.pos)Ke&&Bt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Mt(n),20)),T=n.state.tr.delete(k,v),A=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&($=Kh(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))T=n.state.tr,$.type=="add"?T.addMark(k,v,$.mark):T.removeMark(k,v,$.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let _=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",oe=>oe(n,k,v,_)))return;T=n.state.tr.insertText(_,k,v)}}if(T||(T=n.state.tr.replace(k,v,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let _=kl(n,T.doc,c.sel);_&&!(Ie&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(_.head==k||_.head==T.mapping.map(v)-1)||Ke&&_.empty&&_.head==k)&&T.setSelection(_)}A&&T.ensureMarks(A),o&&T.setMeta("composition",o),n.dispatch(T.scrollIntoView())}function kl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Vo(n,e.resolve(t.anchor),e.resolve(t.head))}function Kh(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[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(C.from(c).eq(n))return{mark:l,type:s}}function Jh(n,e,t,r,i){if(t-e<=i.pos-r.pos||Di(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Di(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Di(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Di(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Yh(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&n.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&Cl(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&Cl(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Cl(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 Gh{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 mh,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Al),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=El(this),Tl(this),this.nodeViews=Ol(this),this.docView=ol(this.state.doc,Ml(this),Ri(this),this.dom,this),this.domObserver=new $h(this,(r,i,o,s)=>Uh(this,r,i,o,s)),this.domObserver.start(),gh(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&&vo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Al),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 i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Bc(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ol(this);Zh(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&vo(this),this.editable=El(this),Tl(this);let a=Ri(this),c=Ml(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Nf(this);if(s){this.domObserver.stop();let h=d&&(Ke||Ie)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Xh(i.selection,e.selection);if(d){let p=Ie?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ah(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ol(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&eh(this))?Mt(this,h):(Mc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Rf(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof L){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Qs(this,t.getBoundingClientRect(),e)}else Qs(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,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new jc(e.slice,e.move,i<0?void 0:L.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Ke){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&&Df(this.dom),Mt(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 zf(this,e)}coordsAtPos(e,t=1){return yc(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 i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Hf(this,t||this.state,e)}pasteHTML(e,t){return Gn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Gn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(yh(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ri(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return vh(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Fe&&this.root.nodeType===11&&Cf(this.dom.ownerDocument)==this.dom&&Fh(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Ml(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"),[je.node(0,n.state.doc.content.size,e)]}function Tl(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:je.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function El(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Xh(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 Ol(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Zh(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Al(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")}var Ft={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:"'"},Br={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qh=typeof navigator<"u"&&/Mac/.test(navigator.platform),ep=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ae=0;Ae<10;Ae++)Ft[48+Ae]=Ft[96+Ae]=String(Ae);for(var Ae=1;Ae<=24;Ae++)Ft[Ae+111]="F"+Ae;for(var Ae=65;Ae<=90;Ae++)Ft[Ae]=String.fromCharCode(Ae+32),Br[Ae]=String.fromCharCode(Ae);for(var Pi in Ft)Br.hasOwnProperty(Pi)||(Br[Pi]=Ft[Pi]);function tp(n){var e=Qh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ep&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Br:Ft)[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 np=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function rp(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,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))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))np?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function ip(n){let e=Object.create(null);for(let t in n)e[rp(t)]=n[t];return e}function Ii(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 op(n){return new ze({props:{handleKeyDown:Yo(n)}})}function Yo(n){let e=ip(n);return function(t,r){let i=tp(r),o,s=e[Ii(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ii(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=Ft[r.keyCode])&&o!=i){let l=e[Ii(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Go=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function qc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Uc=(n,e,t)=>{let r=qc(n,t);if(!r)return!1;let i=Xo(r);if(!i){let s=r.blockRange(),l=s&&Nn(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(tu(n,i,e,-1))return!0;if(r.parent.content.size==0&&(On(o,"end")||L.isSelectable(o)))for(let s=r.depth;;s--){let l=Jr(n.doc,r.before(s),r.after(s),O.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(On(o,"end")?B.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):L.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},sp=(n,e,t)=>{let r=qc(n,t);if(!r)return!1;let i=Xo(r);return i?Kc(n,i,e):!1},lp=(n,e,t)=>{let r=Yc(n,t);if(!r)return!1;let i=Zo(r);return i?Kc(n,i,e):!1};function Kc(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=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=Jr(n.doc,o,a,O.empty);if(!c||c.from!=o||c instanceof xe&&c.slice.size>=a-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(z.create(u.doc,o)),t(u.scrollIntoView())}return!0}function On(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 Jc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Xo(r)}let s=o&&o.nodeBefore;return!s||!L.isSelectable(s)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Xo(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 Yc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Gc=(n,e,t)=>{let r=Yc(n,t);if(!r)return!1;let i=Zo(r);if(!i)return!1;let o=i.nodeAfter;if(tu(n,i,e,1))return!0;if(r.parent.content.size==0&&(On(o,"start")||L.isSelectable(o))){let s=Jr(n.doc,r.before(),r.after(),O.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(On(o,"start")?B.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):L.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Xc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Zo(r)}let s=o&&o.nodeAfter;return!s||!L.isSelectable(s)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,o.pos)).scrollIntoView()),!0)};function Zo(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 ap=(n,e)=>{let t=n.selection,r=t instanceof L,i;if(r){if(t.node.isTextblock||!Ht(n.doc,t.from))return!1;i=t.from}else if(i=Kr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(L.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},cp=(n,e)=>{let t=n.selection,r;if(t instanceof L){if(t.node.isTextblock||!Ht(n.doc,t.to))return!1;r=t.to}else if(r=Kr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},up=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Nn(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Zc=(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 Qo(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 dp=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=Qo(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(B.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Qc=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Xe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Qo(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(z.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},eu=(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 o=t.before();if(Ct(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Nn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function fp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof L&&e.selection.node.isBlock)return!r.parentOffset||!Ct(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Qo(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof z||e.selection instanceof Xe)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ct(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Ct(u.doc,d,o.length,o)),u.split(d,o.length,o),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return t&&t(u.scrollIntoView()),!0}}const hp=fp(),pp=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(L.create(n.doc,i))),!0)};function mp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ht(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function tu(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&mp(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let h=e.pos+o.nodeSize,p=C.empty;for(let b=s.length-1;b>=0;b--)p=C.from(s[b].create(null,p));p=C.from(i.copy(p));let m=n.tr.step(new we(e.pos-1,h,e.pos,h,new O(p,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Ht(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:B.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Nn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&On(o,"start",!0)&&On(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let b=C.empty;for(let x=p.length-1;x>=0;x--)b=C.from(p[x].copy(b));let S=n.tr.step(new we(e.pos-p.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new O(b,p.length,0),0,!0));t(S.scrollIntoView())}return!0}}return!1}function nu(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(z.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const gp=nu(-1),yp=nu(1);function bp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&$o(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Nl(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}function es(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}es(Go,Uc,Jc);es(Go,Gc,Xc);es(Zc,Qc,eu,hp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function vp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let u=t.doc.resolve(s.start-2);a=new Ar(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Ar(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=$o(a,n,e,s);return c?(r&&r(Sp(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function Sp(n,e,t,r,i){let o=C.empty;for(let u=t.length-1;u>=0;u--)o=C.from(t[u].type.create(t[u].attrs,o));n.step(new we(e.start-(r?2:0),e.end,e.start,e.end,new O(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(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&&Ct(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function xp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?wp(e,t,n,o):kp(e,t,o):!0:!1}}function wp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new we(o-1,s,o,s,new O(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Ar(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Nn(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return Ht(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function kp(n,e,t){let r=n.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?C.empty:C.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new we(d-(l?1:0),f+(a?1:0),d+1,f-1,new O((l?C.empty:C.from(i.copy(C.empty))).append(a?C.empty:C.from(i.copy(C.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Cp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=C.from(c?n.create():null),d=new O(C.from(n.create(null,C.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new we(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Qr(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class ei{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:i}=t,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],a=!!e,c=e||o.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),b=h(...m)(g);return l.push(b),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:Qr({state:o,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 Mp{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(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const r=(...i)=>{this.off(e,r),t.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function P(n,e,t){return n.config[e]===void 0&&n.parent?P(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?P(n.parent,e,t):null}):n.config[e]}function ti(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function ru(n){const e=[],{nodeExtensions:t,markExtensions:r}=ti(n),i=[...t,...r],o={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,extensions:i},a=P(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:{...o,...h}})})})})}),i.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=P(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...o,...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 Ce(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 ie(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const l=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else if(i==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=o}),r},{})}function $r(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ie(t,r),{})}function iu(n){return typeof n=="function"}function q(n,e=void 0,...t){return iu(n)?e?n.bind(e)(...t):n(...t):n}function Tp(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ep(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Rl(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):Ep(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function Dl(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Tp(t)?!1:t!=null))}function Op(n,e){var t;const r=ru(n),{nodeExtensions:i,markExtensions:o}=ti(n),s=(t=i.find(c=>P(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((b,S)=>{const x=P(S,"extendNodeSchema",d);return{...b,...x?x(c):{}}},{}),h=Dl({...f,content:q(P(c,"content",d)),marks:q(P(c,"marks",d)),group:q(P(c,"group",d)),inline:q(P(c,"inline",d)),atom:q(P(c,"atom",d)),selectable:q(P(c,"selectable",d)),draggable:q(P(c,"draggable",d)),code:q(P(c,"code",d)),whitespace:q(P(c,"whitespace",d)),linebreakReplacement:q(P(c,"linebreakReplacement",d)),defining:q(P(c,"defining",d)),isolating:q(P(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var S;return[b.name,{default:(S=b==null?void 0:b.attribute)===null||S===void 0?void 0:S.default}]}))}),p=q(P(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>Rl(b,u)));const m=P(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:$r(b,u)}));const g=P(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(o.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,b)=>{const S=P(b,"extendMarkSchema",d);return{...g,...S?S(c):{}}},{}),h=Dl({...f,inclusive:q(P(c,"inclusive",d)),excludes:q(P(c,"excludes",d)),group:q(P(c,"group",d)),spanning:q(P(c,"spanning",d)),code:q(P(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=q(P(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Rl(g,u)));const m=P(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:$r(g,u)})),[c.name,h]}));return new qa({topNode:s,nodes:l,marks:a})}function _i(n,e){return e.nodes[n]||e.marks[n]||null}function Pl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function ts(n,e){const t=un.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Ap=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function ns(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class ni{constructor(e){this.find=e.find,this.handler=e.handler}}const Np=(n,e)=>{if(ns(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 cr(n){var e;const{editor:t,from:r,to:i,text:o,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=Ap(c)+o;return s.forEach(f=>{if(u)return;const h=Np(d,f.find);if(!h)return;const p=a.state.tr,m=Qr({state:a.state,transaction:p}),g={from:r-(h[0].length-o.length),to:i},{commands:b,chain:S,can:x}=new ei({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:b,chain:S,can:x})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:o}),a.dispatch(p),u=!0)}),u}function Rp(n){const{editor:e,rules:t}=n,r=new ze({state:{init(){return null},apply(i,o,s){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=ts(C.from(u),s.schema);const{from:d}=a,f=d+u.length;cr({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return cr({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&cr({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?cr({editor:e,from:s.pos,to:s.pos,text:`
40
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Dp(n){return Object.prototype.toString.call(n).slice(8,-1)}function ur(n){return Dp(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ri(n,e){const t={...n};return ur(n)&&ur(e)&&Object.keys(e).forEach(r=>{ur(e[r])&&ur(n[r])?t[r]=ri(n[r],e[r]):t[r]=e[r]}),t}class Qe{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=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Qe(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Qe(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.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: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.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(" ",i.pos),e.view.dispatch(r),!0}return!1}}function Pp(n){return typeof n=="number"}class Ip{constructor(e){this.find=e.find,this.handler=e.handler}}const _p=(n,e,t)=>{if(ns(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Lp(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:u}=new ei({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");_p(b,o.find,s).forEach(x=>{if(x.index===void 0)return;const k=m+x.index+1,v=k+x[0].length,T={from:t.tr.mapping.map(k),to:t.tr.mapping.map(v)},A=o.handler({state:t,range:T,match:x,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(A)})}),d.every(h=>h!==null)}let dr=null;const zp=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 Bp(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=Qr({state:u,transaction:m});if(!(!Lp({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new ze({view(d){const f=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(dr=e)},h=()=>{dr&&(dr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(o=r===d.dom.parentElement,l=f,!o){const h=dr;h&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),S=!!b;if(!m&&!g&&!S)return;if(S){let{text:v}=b;typeof v=="string"?v=v:v=ts(C.from(v),h.schema);const{from:T}=b,A=T+v.length,$=zp(v);return a({rule:u,state:h,from:T,to:{b:A},pasteEvt:$})}const x=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!Pp(x)||!k||x===k.b))return a({rule:u,state:h,from:x,to:k,pasteEvt:s})}}))}function $p(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Sn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Sn.resolve(e),this.schema=Op(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Sn.sort(Sn.flatten(e)),r=$p(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).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},i=P(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=P(r,"priority")||100,s=P(i,"priority")||100;return o>s?-1:o<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:_i(t.name,this.schema)},i=P(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Sn.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:_i(s.name,this.schema)},a=[],c=P(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&P(s,"exitable",l)&&(u.ArrowRight=()=>Qe.handleExit({editor:e,mark:s})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const d=op(u);a.push(d);const f=P(s,"addInputRules",l);Pl(s,e.options.enableInputRules)&&f&&r.push(...f());const h=P(s,"addPasteRules",l);Pl(s,e.options.enablePasteRules)&&h&&i.push(...h());const p=P(s,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[Rp({editor:e,rules:r}),...Bp({editor:e,rules:i}),...o]}get attributes(){return ru(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=ti(this.extensions);return Object.fromEntries(t.filter(r=>!!P(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ce(r.name,this.schema)},s=P(r,"addNodeView",o);if(!s)return[];const l=(a,c,u,d,f)=>{const h=$r(a,i);return s()({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};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:_i(e.name,this.schema)};e.type==="mark"&&(!((t=q(P(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=P(e,"onBeforeCreate",r),o=P(e,"onCreate",r),s=P(e,"onUpdate",r),l=P(e,"onSelectionUpdate",r),a=P(e,"onTransaction",r),c=P(e,"onFocus",r),u=P(e,"onBlur",r),d=P(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),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)})}}class Ne{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=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ne(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ne({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.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: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}}function ou(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
43
41
 
44
- `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(r,i,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=o);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,i-c))}),l}function ou(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const Lp=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Le({key:new et("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),a=ou(t);return iu(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Vp=()=>({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),Bp=(n=!1)=>({commands:e})=>e.setContent("",n),$p=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.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=Dn(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},jp=n=>e=>n(e),Fp=()=>({state:n,dispatch:e})=>Zc(n,e),Hp=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new L(r.doc.resolve(s-1))),!0},Wp=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const l=i.before(o),a=i.after(o);n.delete(l,a).scrollIntoView()}return!0}return!1},qp=n=>({tr:e,state:t,dispatch:r})=>{const i=Ce(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),c=o.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Up=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Kp=()=>({state:n,dispatch:e})=>Go(n,e),Jp=()=>({commands:n})=>n.keyboardShortcut("Enter"),Yp=()=>({state:n,dispatch:e})=>ap(n,e);function $r(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ns(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function su(n,e,t={}){return n.find(r=>r.type===e&&$r(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Pl(n,e,t={}){return!!su(n,e,t)}function rs(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!su([...i.node.marks],e,t)))return;let s=i.index,l=n.start()+i.offset,a=s+1,c=l+i.node.nodeSize;for(;s>0&&Pl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&Pl([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Wt(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 Gp=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Wt(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const d=rs(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=L.create(s,d.from,d.to);t.setSelection(f)}}return!0},Xp=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 lu(n){return n instanceof L}function Xt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function au(n,e=null){if(!e)return null;const t=V.atStart(n),r=V.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?L.create(n,Xt(0,i,o),Xt(n.content.size,i,o)):L.create(n,Xt(e,i,o),Xt(e,i,o))}function cu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ii(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Zp=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ii()||cu())&&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(o&&n===null&&!lu(t.state.selection))return s(),!0;const l=au(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},Qp=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),em=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),uu=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&&uu(r)}return n};function fr(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return uu(t)}function jr(n,e,t){if(n instanceof zt||n instanceof C)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return C.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),jr("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const a=new Wa({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Lt.fromSchema(a).parseSlice(fr(n),t.parseOptions):Lt.fromSchema(a).parse(fr(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=Lt.fromSchema(e);return t.slice?o.parseSlice(fr(n),t.parseOptions).content:o.parse(fr(n),t.parseOptions)}return jr("",e,t)}function tm(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;const o=n.mapping.maps[r];let s=0;o.forEach((l,a,c,u)=>{s===0&&(s=u)}),n.setSelection(V.near(n.doc.resolve(s),t))}const nm=n=>!("type"in n),rm=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;try{l=jr(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(s=t.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(p){return o.emit("contentError",{editor:o,error:p,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},u=!0,d=!0;if((nm(l)?l:[l]).forEach(p=>{p.check(),u=u?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),a===c&&d){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(u){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof C){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&tm(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},im=()=>({state:n,dispatch:e})=>op(n,e),om=()=>({state:n,dispatch:e})=>sp(n,e),sm=()=>({state:n,dispatch:e})=>qc(n,e),lm=()=>({state:n,dispatch:e})=>Yc(n,e),am=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Kr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},cm=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Kr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},um=()=>({state:n,dispatch:e})=>rp(n,e),dm=()=>({state:n,dispatch:e})=>ip(n,e);function du(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function fm(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,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))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))ii()||du()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const hm=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=fm(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.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&&i&&r.maybeStep(u)}),!0};function Gn(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?Ce(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=i-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>$r(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const pm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return Gn(t,i,e)?lp(t,r):!1},mm=()=>({state:n,dispatch:e})=>Qc(n,e),gm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return bp(r)(e,t)},ym=()=>({state:n,dispatch:e})=>Xc(n,e);function oi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Il(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const bm=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=oi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Ce(n,r.schema)),l==="mark"&&(s=Wt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{o&&o===c.type&&t.setNodeMarkup(u,void 0,Il(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&t.addMark(u,u+c.nodeSize,s.create(Il(d.attrs,e)))})})}),!0):!1},vm=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),xm=()=>({tr:n,dispatch:e})=>{if(e){const t=new Xe(n.doc);n.setSelection(t)}return!0},Sm=()=>({state:n,dispatch:e})=>Kc(n,e),wm=()=>({state:n,dispatch:e})=>Gc(n,e),km=()=>({state:n,dispatch:e})=>dp(n,e),Cm=()=>({state:n,dispatch:e})=>pp(n,e),Em=()=>({state:n,dispatch:e})=>hp(n,e);function xo(n,e,t={},r={}){return jr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Nm=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{var a,c;const{doc:u}=o;if(t.preserveWhitespace!=="full"){const d=xo(n,i.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:u.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function fu(n,e){const t=Wt(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Mm(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 hu(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 is(n){return e=>hu(e.$from,n)}function Tm(n,e){const t={from:0,to:n.content.size};return iu(n,t,e)}function Om(n,e){const t=Ce(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function Dm(n,e){const t=oi(typeof e=="string"?e:e.name,n.schema);return t==="node"?Om(n,e):t==="mark"?fu(n,e):{}}function pu(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=rs(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function wr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function So(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Wt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>$r(d.attrs,t,{strict:!1}));let s=0;const l=[];if(i.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 b=Math.max(h,g),x=Math.min(p,g+m.nodeSize),S=x-b;s+=S,l.push(...m.marks.map(k=>({mark:k,from:b,to:x})))})}),s===0)return!1;const a=l.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>$r(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Am(n,e,t={}){if(!e)return Gn(n,null,t)||So(n,null,t);const r=oi(e,n.schema);return r==="node"?Gn(n,e,t):r==="mark"?So(n,e,t):!1}function _l(n,e){const{nodeExtensions:t}=ti(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=q(P(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function ss(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(ss(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Rm(n){return n instanceof z}function Pm(n,e,t){var r;const{selection:i}=e;let o=null;if(lu(i)&&(o=i.$cursor),o){const l=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:s}=i;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 Im=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,a=Wt(n,r.schema);if(i)if(s){const c=fu(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(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&t.addMark(p,m,a.create({...b.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return Pm(r,t,a)},_m=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),zm=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Ce(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>Ol(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Ol(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Lm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Xt(n,0,r.content.size),o=z.create(r,i);e.setSelection(o)}return!0},Vm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=L.atStart(r).from,l=L.atEnd(r).to,a=Xt(i,s,l),c=Xt(o,s,l),u=L.create(r,a,c);e.setSelection(u)}return!0},Bm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return Sp(r)(e,t)};function zl(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const $m=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:a}=o,c=i.extensionManager.attributes,u=wr(c,l.node().type.name,l.node().attrs);if(o instanceof z&&o.node.isBlock)return!l.parentOffset||!Ct(s,l.pos)?!1:(r&&(n&&zl(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:Mm(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ct(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ct(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(o instanceof L&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&zl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},jm=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=Ce(n,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let b=C.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let B=a.depth-x;B>=a.depth-3;B-=1)b=C.from(a.node(B).copy(b));const S=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...wr(f,a.node().type.name,a.node().attrs),...e},v=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(k))||void 0;b=b.append(C.from(l.createAndFill(null,v)||void 0));const N=a.before(a.depth-(x-1));t.replace(N,a.after(-S),new T(b,4-x,0));let O=-1;t.doc.nodesBetween(N,t.doc.content.size,(B,_)=>{if(O>-1)return!1;B.isTextblock&&B.content.size===0&&(O=_+1)}),O>-1&&t.setSelection(L.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...wr(f,d.type.name,d.attrs),...e},m={...wr(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Ct(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:x}=r,{splittableMarks:S}=o.extensionManager,k=x||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!k||!i)return!0;const v=k.filter(N=>S.includes(N.type.name));t.ensureMarks(v)}return!0},zi=(n,e)=>{const t=is(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 i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ft(n.doc,t.pos)&&n.join(t.pos),!0},Li=(n,e)=>{const t=is(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 i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ft(n.doc,r)&&n.join(r),!0},Fm=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=Ce(n,s.schema),p=Ce(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:x}=m,S=b.blockRange(x),k=g||m.$to.parentOffset&&m.$from.marks();if(!S)return!1;const v=is(N=>_l(N.type.name,d))(m);if(S.depth>=1&&v&&S.depth-v.depth<=1){if(v.node.type===h)return c.liftListItem(p);if(_l(v.node.type.name,d)&&h.validContent(v.node.content)&&l)return a().command(()=>(o.setNodeMarkup(v.pos,h),!0)).command(()=>zi(o,h)).command(()=>Li(o,h)).run()}return!t||!k||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>zi(o,h)).command(()=>Li(o,h)).run():a().command(()=>{const N=u().wrapInList(h,r),O=k.filter(B=>f.includes(B.type.name));return o.ensureMarks(O),N?!0:c.clearNodes()}).wrapInList(h,r).command(()=>zi(o,h)).command(()=>Li(o,h)).run()},Hm=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Wt(n,r.schema);return So(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Wm=(n,e,t={})=>({state:r,commands:i})=>{const o=Ce(n,r.schema),s=Ce(e,r.schema),l=Gn(r,o,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(s,a):i.setNode(o,{...a,...t})},qm=(n,e={})=>({state:t,commands:r})=>{const i=Ce(n,t.schema);return Gn(t,i,e)?r.lift(i):r.wrapIn(i,e)},Um=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},Km=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Jm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Wt(n,r.schema),{$from:c,empty:u,ranges:d}=l;if(!i)return!0;if(u&&s){let{from:f,to:h}=l;const p=(o=c.marks().find(g=>g.type===a))===null||o===void 0?void 0:o.attrs,m=rs(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},Ym=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=oi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Ce(n,r.schema)),l==="mark"&&(s=Wt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;t.selection.empty?r.doc.nodesBetween(c,u,(m,g)=>{o&&o===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m)}):r.doc.nodesBetween(c,u,(m,g)=>{g<c&&o&&o===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m),g>=c&&g<=u&&(o&&o===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const x=Math.max(g,c),S=Math.min(g+m.nodeSize,u);t.addMark(x,S,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&t.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},Gm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return mp(i,e)(t,r)},Xm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return gp(i,e)(t,r)};var Zm=Object.freeze({__proto__:null,blur:Vp,clearContent:Bp,clearNodes:$p,command:jp,createParagraphNear:Fp,cut:Hp,deleteCurrentNode:Wp,deleteNode:qp,deleteRange:Up,deleteSelection:Kp,enter:Jp,exitCode:Yp,extendMarkRange:Gp,first:Xp,focus:Zp,forEach:Qp,insertContent:em,insertContentAt:rm,joinBackward:sm,joinDown:om,joinForward:lm,joinItemBackward:am,joinItemForward:cm,joinTextblockBackward:um,joinTextblockForward:dm,joinUp:im,keyboardShortcut:hm,lift:pm,liftEmptyBlock:mm,liftListItem:gm,newlineInCode:ym,resetAttributes:bm,scrollIntoView:vm,selectAll:xm,selectNodeBackward:Sm,selectNodeForward:wm,selectParentNode:km,selectTextblockEnd:Cm,selectTextblockStart:Em,setContent:Nm,setMark:Im,setMeta:_m,setNode:zm,setNodeSelection:Lm,setTextSelection:Vm,sinkListItem:Bm,splitBlock:$m,splitListItem:jm,toggleList:Fm,toggleMark:Hm,toggleNode:Wm,toggleWrap:qm,undoInputRule:Um,unsetAllMarks:Km,unsetMark:Jm,updateAttributes:Ym,wrapIn:Gm,wrapInList:Xm});const Qm=De.create({name:"commands",addCommands(){return{...Zm}}}),eg=De.create({name:"drop",addProseMirrorPlugins(){return[new Le({key:new et("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),tg=De.create({name:"editable",addProseMirrorPlugins(){return[new Le({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ng=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Le({key:new et("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}}}})]}}),rg=De.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,b=m&&p.parent.childCount===1?g===d.pos:V.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&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()},i={...r},o={...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 ii()||du()?o:i},addProseMirrorPlugins(){return[new Le({key:new et("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:l}=e.selection,a=V.atStart(e.doc).from,c=V.atEnd(e.doc).to;if(o||!(s===a&&l===c)||!ss(t.doc))return;const f=t.tr,h=Qr({state:t,transaction:f}),{commands:p}=new ei({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),ig=De.create({name:"paste",addProseMirrorPlugins(){return[new Le({key:new et("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),og=De.create({name:"tabindex",addProseMirrorPlugins(){return[new Le({key:new et("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Jt{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}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 Jt(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 Jt(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 Jt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+r+(o?0:1),l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;const a=new Jt(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Jt(l,this.editor,i,i?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,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const o=i.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(o[a]!==t[a])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>t[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const sg=`.ProseMirror {
42
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(r,i,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=o);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,i-c))}),l}function su(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const jp=Ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ze({key:new et("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),a=su(t);return ou(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Fp=()=>({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),Hp=(n=!1)=>({commands:e})=>e.setContent("",n),Vp=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.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=Nn(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},Wp=n=>e=>n(e),qp=()=>({state:n,dispatch:e})=>Qc(n,e),Up=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new z(r.doc.resolve(s-1))),!0},Kp=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const l=i.before(o),a=i.after(o);n.delete(l,a).scrollIntoView()}return!0}return!1},Jp=n=>({tr:e,state:t,dispatch:r})=>{const i=Ce(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),c=o.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Yp=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Gp=()=>({state:n,dispatch:e})=>Go(n,e),Xp=()=>({commands:n})=>n.keyboardShortcut("Enter"),Zp=()=>({state:n,dispatch:e})=>dp(n,e);function jr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ns(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function lu(n,e,t={}){return n.find(r=>r.type===e&&jr(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Il(n,e,t={}){return!!lu(n,e,t)}function rs(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!lu([...i.node.marks],e,t)))return;let s=i.index,l=n.start()+i.offset,a=s+1,c=l+i.node.nodeSize;for(;s>0&&Il([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&Il([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Wt(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 Qp=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Wt(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const d=rs(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=z.create(s,d.from,d.to);t.setSelection(f)}}return!0},em=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 au(n){return n instanceof z}function Xt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function cu(n,e=null){if(!e)return null;const t=B.atStart(n),r=B.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?z.create(n,Xt(0,i,o),Xt(n.content.size,i,o)):z.create(n,Xt(e,i,o),Xt(e,i,o))}function uu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ii(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const tm=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ii()||uu())&&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(o&&n===null&&!au(t.state.selection))return s(),!0;const l=cu(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},nm=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),rm=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),du=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&&du(r)}return n};function fr(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return du(t)}function Fr(n,e,t){if(n instanceof Lt||n instanceof C)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return C.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Fr("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const a=new qa({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?zt.fromSchema(a).parseSlice(fr(n),t.parseOptions):zt.fromSchema(a).parse(fr(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=zt.fromSchema(e);return t.slice?o.parseSlice(fr(n),t.parseOptions).content:o.parse(fr(n),t.parseOptions)}return Fr("",e,t)}function im(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof xe||i instanceof we))return;const o=n.mapping.maps[r];let s=0;o.forEach((l,a,c,u)=>{s===0&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}const om=n=>!("type"in n),sm=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;try{l=Fr(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(s=t.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(p){return o.emit("contentError",{editor:o,error:p,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},u=!0,d=!0;if((om(l)?l:[l]).forEach(p=>{p.check(),u=u?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),a===c&&d){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(u){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof C){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&im(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},lm=()=>({state:n,dispatch:e})=>ap(n,e),am=()=>({state:n,dispatch:e})=>cp(n,e),cm=()=>({state:n,dispatch:e})=>Uc(n,e),um=()=>({state:n,dispatch:e})=>Gc(n,e),dm=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Kr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},fm=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Kr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},hm=()=>({state:n,dispatch:e})=>sp(n,e),pm=()=>({state:n,dispatch:e})=>lp(n,e);function fu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function mm(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,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))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))ii()||fu()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const gm=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=mm(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.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&&i&&r.maybeStep(u)}),!0};function Zn(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?Ce(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=i-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>jr(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const ym=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return Zn(t,i,e)?up(t,r):!1},bm=()=>({state:n,dispatch:e})=>eu(n,e),vm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return xp(r)(e,t)},Sm=()=>({state:n,dispatch:e})=>Zc(n,e);function oi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function _l(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const xm=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=oi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Ce(n,r.schema)),l==="mark"&&(s=Wt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{o&&o===c.type&&t.setNodeMarkup(u,void 0,_l(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&t.addMark(u,u+c.nodeSize,s.create(_l(d.attrs,e)))})})}),!0):!1},wm=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),km=()=>({tr:n,dispatch:e})=>{if(e){const t=new Xe(n.doc);n.setSelection(t)}return!0},Cm=()=>({state:n,dispatch:e})=>Jc(n,e),Mm=()=>({state:n,dispatch:e})=>Xc(n,e),Tm=()=>({state:n,dispatch:e})=>pp(n,e),Em=()=>({state:n,dispatch:e})=>yp(n,e),Om=()=>({state:n,dispatch:e})=>gp(n,e);function So(n,e,t={},r={}){return Fr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Am=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{var a,c;const{doc:u}=o;if(t.preserveWhitespace!=="full"){const d=So(n,i.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:u.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function hu(n,e){const t=Wt(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Nm(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 pu(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 is(n){return e=>pu(e.$from,n)}function Rm(n,e){const t={from:0,to:n.content.size};return ou(n,t,e)}function Dm(n,e){const t=Ce(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function Pm(n,e){const t=oi(typeof e=="string"?e:e.name,n.schema);return t==="node"?Dm(n,e):t==="mark"?hu(n,e):{}}function mu(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=rs(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function wr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function xo(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Wt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>jr(d.attrs,t,{strict:!1}));let s=0;const l=[];if(i.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 b=Math.max(h,g),S=Math.min(p,g+m.nodeSize),x=S-b;s+=x,l.push(...m.marks.map(k=>({mark:k,from:b,to:S})))})}),s===0)return!1;const a=l.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>jr(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Im(n,e,t={}){if(!e)return Zn(n,null,t)||xo(n,null,t);const r=oi(e,n.schema);return r==="node"?Zn(n,e,t):r==="mark"?xo(n,e,t):!1}function Ll(n,e){const{nodeExtensions:t}=ti(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=q(P(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function ss(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(ss(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function _m(n){return n instanceof L}function Lm(n,e,t){var r;const{selection:i}=e;let o=null;if(au(i)&&(o=i.$cursor),o){const l=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:s}=i;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 zm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,a=Wt(n,r.schema);if(i)if(s){const c=hu(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(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&t.addMark(p,m,a.create({...b.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return Lm(r,t,a)},Bm=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),$m=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Ce(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>Nl(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Nl(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},jm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Xt(n,0,r.content.size),o=L.create(r,i);e.setSelection(o)}return!0},Fm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=z.atStart(r).from,l=z.atEnd(r).to,a=Xt(i,s,l),c=Xt(o,s,l),u=z.create(r,a,c);e.setSelection(u)}return!0},Hm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return Cp(r)(e,t)};function zl(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const Vm=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:a}=o,c=i.extensionManager.attributes,u=wr(c,l.node().type.name,l.node().attrs);if(o instanceof L&&o.node.isBlock)return!l.parentOffset||!Ct(s,l.pos)?!1:(r&&(n&&zl(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:Nm(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ct(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ct(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(o instanceof z&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&zl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Wm=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=Ce(n,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let b=C.empty;const S=a.index(-1)?1:a.index(-2)?2:3;for(let $=a.depth-S;$>=a.depth-3;$-=1)b=C.from(a.node($).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...wr(f,a.node().type.name,a.node().attrs),...e},v=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(k))||void 0;b=b.append(C.from(l.createAndFill(null,v)||void 0));const T=a.before(a.depth-(S-1));t.replace(T,a.after(-x),new O(b,4-S,0));let A=-1;t.doc.nodesBetween(T,t.doc.content.size,($,_)=>{if(A>-1)return!1;$.isTextblock&&$.content.size===0&&(A=_+1)}),A>-1&&t.setSelection(z.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...wr(f,d.type.name,d.attrs),...e},m={...wr(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Ct(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:S}=r,{splittableMarks:x}=o.extensionManager,k=S||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!k||!i)return!0;const v=k.filter(T=>x.includes(T.type.name));t.ensureMarks(v)}return!0},Li=(n,e)=>{const t=is(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 i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ht(n.doc,t.pos)&&n.join(t.pos),!0},zi=(n,e)=>{const t=is(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 i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ht(n.doc,r)&&n.join(r),!0},qm=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=Ce(n,s.schema),p=Ce(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:S}=m,x=b.blockRange(S),k=g||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const v=is(T=>Ll(T.type.name,d))(m);if(x.depth>=1&&v&&x.depth-v.depth<=1){if(v.node.type===h)return c.liftListItem(p);if(Ll(v.node.type.name,d)&&h.validContent(v.node.content)&&l)return a().command(()=>(o.setNodeMarkup(v.pos,h),!0)).command(()=>Li(o,h)).command(()=>zi(o,h)).run()}return!t||!k||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Li(o,h)).command(()=>zi(o,h)).run():a().command(()=>{const T=u().wrapInList(h,r),A=k.filter($=>f.includes($.type.name));return o.ensureMarks(A),T?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Li(o,h)).command(()=>zi(o,h)).run()},Um=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Wt(n,r.schema);return xo(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Km=(n,e,t={})=>({state:r,commands:i})=>{const o=Ce(n,r.schema),s=Ce(e,r.schema),l=Zn(r,o,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(s,a):i.setNode(o,{...a,...t})},Jm=(n,e={})=>({state:t,commands:r})=>{const i=Ce(n,t.schema);return Zn(t,i,e)?r.lift(i):r.wrapIn(i,e)},Ym=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},Gm=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Xm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Wt(n,r.schema),{$from:c,empty:u,ranges:d}=l;if(!i)return!0;if(u&&s){let{from:f,to:h}=l;const p=(o=c.marks().find(g=>g.type===a))===null||o===void 0?void 0:o.attrs,m=rs(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},Zm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=oi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Ce(n,r.schema)),l==="mark"&&(s=Wt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;t.selection.empty?r.doc.nodesBetween(c,u,(m,g)=>{o&&o===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m)}):r.doc.nodesBetween(c,u,(m,g)=>{g<c&&o&&o===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m),g>=c&&g<=u&&(o&&o===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const S=Math.max(g,c),x=Math.min(g+m.nodeSize,u);t.addMark(S,x,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&t.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},Qm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return bp(i,e)(t,r)},eg=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return vp(i,e)(t,r)};var tg=Object.freeze({__proto__:null,blur:Fp,clearContent:Hp,clearNodes:Vp,command:Wp,createParagraphNear:qp,cut:Up,deleteCurrentNode:Kp,deleteNode:Jp,deleteRange:Yp,deleteSelection:Gp,enter:Xp,exitCode:Zp,extendMarkRange:Qp,first:em,focus:tm,forEach:nm,insertContent:rm,insertContentAt:sm,joinBackward:cm,joinDown:am,joinForward:um,joinItemBackward:dm,joinItemForward:fm,joinTextblockBackward:hm,joinTextblockForward:pm,joinUp:lm,keyboardShortcut:gm,lift:ym,liftEmptyBlock:bm,liftListItem:vm,newlineInCode:Sm,resetAttributes:xm,scrollIntoView:wm,selectAll:km,selectNodeBackward:Cm,selectNodeForward:Mm,selectParentNode:Tm,selectTextblockEnd:Em,selectTextblockStart:Om,setContent:Am,setMark:zm,setMeta:Bm,setNode:$m,setNodeSelection:jm,setTextSelection:Fm,sinkListItem:Hm,splitBlock:Vm,splitListItem:Wm,toggleList:qm,toggleMark:Um,toggleNode:Km,toggleWrap:Jm,undoInputRule:Ym,unsetAllMarks:Gm,unsetMark:Xm,updateAttributes:Zm,wrapIn:Qm,wrapInList:eg});const ng=Ne.create({name:"commands",addCommands(){return{...tg}}}),rg=Ne.create({name:"drop",addProseMirrorPlugins(){return[new ze({key:new et("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),ig=Ne.create({name:"editable",addProseMirrorPlugins(){return[new ze({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),og=Ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ze({key:new et("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}}}})]}}),sg=Ne.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,b=m&&p.parent.childCount===1?g===d.pos:B.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&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()},i={...r},o={...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 ii()||fu()?o:i},addProseMirrorPlugins(){return[new ze({key:new et("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:l}=e.selection,a=B.atStart(e.doc).from,c=B.atEnd(e.doc).to;if(o||!(s===a&&l===c)||!ss(t.doc))return;const f=t.tr,h=Qr({state:t,transaction:f}),{commands:p}=new ei({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),lg=Ne.create({name:"paste",addProseMirrorPlugins(){return[new ze({key:new et("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ag=Ne.create({name:"tabindex",addProseMirrorPlugins(){return[new ze({key:new et("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Jt{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}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 Jt(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 Jt(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 Jt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+r+(o?0:1),l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;const a=new Jt(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Jt(l,this.editor,i,i?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,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const o=i.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(o[a]!==t[a])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>t[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const cg=`.ProseMirror {
45
43
  position: relative;
46
44
  }
47
45
 
@@ -115,9 +113,9 @@ img.ProseMirror-separator {
115
113
 
116
114
  .tippy-box[data-animation=fade][data-state=hidden] {
117
115
  opacity: 0
118
- }`;function lg(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}class ag extends wp{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!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,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>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.on("contentError",this.options.onContentError),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),this.on("drop",({event:t,slice:r,moved:i})=>this.options.onDrop(t,r,i)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},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=lg(sg,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=ru(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=t.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[tg,Lp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),Qm,ng,rg,og,eg,ig].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new xn(i,this)}createCommandManager(){this.commandManager=new ei({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=xo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=xo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=au(t,this.options.autofocus);this.view=new Kh(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:vn.create({doc:t,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||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.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Dm(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Am(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ts(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
116
+ }`;function ug(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}class dg extends Mp{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!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,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>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.on("contentError",this.options.onContentError),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),this.on("drop",({event:t,slice:r,moved:i})=>this.options.onDrop(t,r,i)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},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=ug(cg,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=iu(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=t.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[ig,jp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),ng,og,sg,ag,rg,lg].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Sn(i,this)}createCommandManager(){this.commandManager=new ei({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=So(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=So(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=cu(t,this.options.autofocus);this.view=new Gh(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:vn.create({doc:t,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||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.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Pm(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Im(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ts(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
119
117
 
120
- `,textSerializers:r={}}=e||{};return Tm(this.state.doc,{blockSeparator:t,textSerializers:{...ou(this.schema),...r}})}get isEmpty(){return ss(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(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,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 Jt(t,this)}get $doc(){return this.$pos(0)}}function ln(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=q(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=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(pu(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&&o.delete(u,t.to),c>t.from&&o.delete(t.from+a,c);const f=t.from+a+s.length;o.addMark(t.from+a,f,n.type.create(i||{})),o.removeStoredMark(n.type)}}})}function mu(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=q(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let l=t.to;const a=n.type.create(i);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];o.insertText(d,s+r[0].length-1),o.replaceWith(u,l,a)}else if(r[0]){const c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()}})}function wo(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=q(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function On(n){return new ni({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=q(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&Bo(a,n.type,o);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";i().updateAttributes(d,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ft(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)}})}class ce{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=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ce(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new ce(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.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: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}}class cg{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.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,i,o,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 b=this.dom.getBoundingClientRect(),x=d.getBoundingClientRect(),S=(i=e.offsetX)!==null&&i!==void 0?i:(o=e.nativeEvent)===null||o===void 0?void 0:o.offsetX,k=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=x.x-b.x+S,h=x.y-b.y+k}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);const p=this.getPos();if(typeof p!="number")return;const m=z.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}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 o=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=z.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!u&&d&&o&&e.target===this.dom&&e.preventDefault(),u&&o&&!c&&e.target===this.dom)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"&&(ii()||cu())&&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 typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}}function an(n){return new Ap({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=q(n.getAttributes,void 0,r,i);if(o===!1||o===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(pu(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(o||{})),s.removeStoredMark(n.type)}}})}function ug(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ko={exports:{}},Vi={};/**
118
+ `,textSerializers:r={}}=e||{};return Rm(this.state.doc,{blockSeparator:t,textSerializers:{...su(this.schema),...r}})}get isEmpty(){return ss(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(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,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 Jt(t,this)}get $doc(){return this.$pos(0)}}function ln(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=q(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=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(mu(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&&o.delete(u,t.to),c>t.from&&o.delete(t.from+a,c);const f=t.from+a+s.length;o.addMark(t.from+a,f,n.type.create(i||{})),o.removeStoredMark(n.type)}}})}function gu(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=q(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let l=t.to;const a=n.type.create(i);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];o.insertText(d,s+r[0].length-1),o.replaceWith(u,l,a)}else if(r[0]){const c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()}})}function wo(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=q(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function An(n){return new ni({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=q(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&$o(a,n.type,o);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";i().updateAttributes(d,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ht(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)}})}class ce{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=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ce(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new ce(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.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: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}}class fg{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.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,i,o,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 b=this.dom.getBoundingClientRect(),S=d.getBoundingClientRect(),x=(i=e.offsetX)!==null&&i!==void 0?i:(o=e.nativeEvent)===null||o===void 0?void 0:o.offsetX,k=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=S.x-b.x+x,h=S.y-b.y+k}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);const p=this.getPos();if(typeof p!="number")return;const m=L.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}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 o=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=L.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!u&&d&&o&&e.target===this.dom&&e.preventDefault(),u&&o&&!c&&e.target===this.dom)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"&&(ii()||uu())&&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 typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}}function an(n){return new Ip({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=q(n.getAttributes,void 0,r,i);if(o===!1||o===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(mu(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(o||{})),s.removeStoredMark(n.type)}}})}function hg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ko={exports:{}},Bi={};/**
121
119
  * @license React
122
120
  * use-sync-external-store-shim.production.min.js
123
121
  *
@@ -125,7 +123,7 @@ img.ProseMirror-separator {
125
123
  *
126
124
  * This source code is licensed under the MIT license found in the
127
125
  * LICENSE file in the root directory of this source tree.
128
- */var Ll;function dg(){if(Ll)return Vi;Ll=1;var n=I;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,o=n.useLayoutEffect,s=n.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,g=p[1];return o(function(){m.value=h,m.getSnapshot=f,a(m)&&g({inst:m})},[d,h,f]),i(function(){return a(m)&&g({inst:m}),d(function(){a(m)&&g({inst:m})})},[d]),s(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!t(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Vi.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Vi}var Bi={};/**
126
+ */var Bl;function pg(){if(Bl)return Bi;Bl=1;var n=I;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,o=n.useLayoutEffect,s=n.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,g=p[1];return o(function(){m.value=h,m.getSnapshot=f,a(m)&&g({inst:m})},[d,h,f]),i(function(){return a(m)&&g({inst:m}),d(function(){a(m)&&g({inst:m})})},[d]),s(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!t(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Bi.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Bi}var $i={};/**
129
127
  * @license React
130
128
  * use-sync-external-store-shim.development.js
131
129
  *
@@ -133,7 +131,7 @@ img.ProseMirror-separator {
133
131
  *
134
132
  * This source code is licensed under the MIT license found in the
135
133
  * LICENSE file in the root directory of this source tree.
136
- */var Vl;function fg(){return Vl||(Vl=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=I,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(S){{for(var k=arguments.length,v=new Array(k>1?k-1:0),N=1;N<k;N++)v[N-1]=arguments[N];r("error",S,v)}}function r(S,k,v){{var N=e.ReactDebugCurrentFrame,O=N.getStackAddendum();O!==""&&(k+="%s",v=v.concat([O]));var B=v.map(function(_){return String(_)});B.unshift("Warning: "+k),Function.prototype.apply.call(console[S],console,B)}}function i(S,k){return S===k&&(S!==0||1/S===1/k)||S!==S&&k!==k}var o=typeof Object.is=="function"?Object.is:i,s=n.useState,l=n.useEffect,a=n.useLayoutEffect,c=n.useDebugValue,u=!1,d=!1;function f(S,k,v){u||n.startTransition!==void 0&&(u=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var N=k();if(!d){var O=k();o(N,O)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var B=s({inst:{value:N,getSnapshot:k}}),_=B[0].inst,oe=B[1];return a(function(){_.value=N,_.getSnapshot=k,h(_)&&oe({inst:_})},[S,N,k]),l(function(){h(_)&&oe({inst:_});var ge=function(){h(_)&&oe({inst:_})};return S(ge)},[S]),c(N),N}function h(S){var k=S.getSnapshot,v=S.value;try{var N=k();return!o(v,N)}catch{return!0}}function p(S,k,v){return k()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,b=g?p:f,x=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;Bi.useSyncExternalStore=x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Bi}process.env.NODE_ENV==="production"?ko.exports=dg():ko.exports=fg();var si=ko.exports;const hg=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},pg=({contentComponent:n})=>{const e=si.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return I.createElement(I.Fragment,null,Object.values(e))};function mg(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:qr.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}class gg extends I.Component{constructor(e){var t;super(e),this.editorContentRef=I.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=mg(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),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 I.createElement(I.Fragment,null,I.createElement("div",{ref:hg(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&I.createElement(pg,{contentComponent:e.contentComponent}))}}const yg=I.forwardRef((n,e)=>{const t=I.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return I.createElement(gg,{key:t,innerRef:e,...n})}),bg=I.memo(yg);var vg=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!n(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!n(e[s],t[s]))return!1}return!0}return e!==e&&t!==t},xg=ug(vg),Co={exports:{}},$i={};/**
134
+ */var $l;function mg(){return $l||($l=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=I,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(x){{for(var k=arguments.length,v=new Array(k>1?k-1:0),T=1;T<k;T++)v[T-1]=arguments[T];r("error",x,v)}}function r(x,k,v){{var T=e.ReactDebugCurrentFrame,A=T.getStackAddendum();A!==""&&(k+="%s",v=v.concat([A]));var $=v.map(function(_){return String(_)});$.unshift("Warning: "+k),Function.prototype.apply.call(console[x],console,$)}}function i(x,k){return x===k&&(x!==0||1/x===1/k)||x!==x&&k!==k}var o=typeof Object.is=="function"?Object.is:i,s=n.useState,l=n.useEffect,a=n.useLayoutEffect,c=n.useDebugValue,u=!1,d=!1;function f(x,k,v){u||n.startTransition!==void 0&&(u=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var T=k();if(!d){var A=k();o(T,A)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var $=s({inst:{value:T,getSnapshot:k}}),_=$[0].inst,oe=$[1];return a(function(){_.value=T,_.getSnapshot=k,h(_)&&oe({inst:_})},[x,T,k]),l(function(){h(_)&&oe({inst:_});var ge=function(){h(_)&&oe({inst:_})};return x(ge)},[x]),c(T),T}function h(x){var k=x.getSnapshot,v=x.value;try{var T=k();return!o(v,T)}catch{return!0}}function p(x,k,v){return k()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,b=g?p:f,S=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;$i.useSyncExternalStore=S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),$i}process.env.NODE_ENV==="production"?ko.exports=pg():ko.exports=mg();var si=ko.exports;const gg=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},yg=({contentComponent:n})=>{const e=si.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return I.createElement(I.Fragment,null,Object.values(e))};function bg(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:qr.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}class vg extends I.Component{constructor(e){var t;super(e),this.editorContentRef=I.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=bg(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),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 I.createElement(I.Fragment,null,I.createElement("div",{ref:gg(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&I.createElement(yg,{contentComponent:e.contentComponent}))}}const Sg=I.forwardRef((n,e)=>{const t=I.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return I.createElement(vg,{key:t,innerRef:e,...n})}),xg=I.memo(Sg);var wg=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!n(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!n(e[s],t[s]))return!1}return!0}return e!==e&&t!==t},kg=hg(wg),Co={exports:{}},ji={};/**
137
135
  * @license React
138
136
  * use-sync-external-store-shim/with-selector.production.min.js
139
137
  *
@@ -141,7 +139,7 @@ img.ProseMirror-separator {
141
139
  *
142
140
  * This source code is licensed under the MIT license found in the
143
141
  * LICENSE file in the root directory of this source tree.
144
- */var Bl;function Sg(){if(Bl)return $i;Bl=1;var n=I,e=si;function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;return $i.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function b(N){if(!x){if(x=!0,S=N,N=f(N),h!==void 0&&m.hasValue){var O=m.value;if(h(O,N))return k=O}return k=N}if(O=k,r(S,N))return O;var B=f(N);return h!==void 0&&h(O,B)?O:(S=N,k=B)}var x=!1,S,k,v=d===void 0?null:d;return[function(){return b(u())},v===null?void 0:function(){return b(v())}]},[u,d,f,h]);var g=i(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=g},[g]),a(g),g},$i}var ji={};/**
142
+ */var jl;function Cg(){if(jl)return ji;jl=1;var n=I,e=si;function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;return ji.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function b(T){if(!S){if(S=!0,x=T,T=f(T),h!==void 0&&m.hasValue){var A=m.value;if(h(A,T))return k=A}return k=T}if(A=k,r(x,T))return A;var $=f(T);return h!==void 0&&h(A,$)?A:(x=T,k=$)}var S=!1,x,k,v=d===void 0?null:d;return[function(){return b(u())},v===null?void 0:function(){return b(v())}]},[u,d,f,h]);var g=i(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=g},[g]),a(g),g},ji}var Fi={};/**
145
143
  * @license React
146
144
  * use-sync-external-store-shim/with-selector.development.js
147
145
  *
@@ -149,219 +147,219 @@ img.ProseMirror-separator {
149
147
  *
150
148
  * This source code is licensed under the MIT license found in the
151
149
  * LICENSE file in the root directory of this source tree.
152
- */var $l;function wg(){return $l||($l=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=I,e=si;function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;function c(u,d,f,h,p){var m=o(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var b=l(function(){var v=!1,N,O,B=function(Ee){if(!v){v=!0,N=Ee;var ye=h(Ee);if(p!==void 0&&g.hasValue){var pe=g.value;if(p(pe,ye))return O=pe,pe}return O=ye,ye}var We=N,xe=O;if(r(We,Ee))return xe;var Ne=h(Ee);return p!==void 0&&p(xe,Ne)?xe:(N=Ee,O=Ne,Ne)},_=f===void 0?null:f,oe=function(){return B(d())},ge=_===null?void 0:function(){return B(_())};return[oe,ge]},[d,f,h,p]),x=b[0],S=b[1],k=i(u,x,S);return s(function(){g.hasValue=!0,g.value=k},[k]),a(k),k}ji.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ji}process.env.NODE_ENV==="production"?Co.exports=Sg():Co.exports=wg();var kg=Co.exports;const Cg=typeof window<"u"?I.useLayoutEffect:I.useEffect;class Eg{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function Ng(n){var e;const[t]=I.useState(()=>new Eg(n.editor)),r=kg.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:xg);return Cg(()=>t.watch(n.editor),[n.editor,t]),I.useDebugValue(r),r}const jl=process.env.NODE_ENV!=="production",Eo=typeof window>"u",Mg=Eo||!!(typeof window<"u"&&window.next);class ls{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Eo||Mg?(jl&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Eo&&jl)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...r)}};return new ag(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=t.extensions)===null||s===void 0?void 0:s[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?ls.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function Tg(n={},e=[]){const t=I.useRef(n);t.current=n;const[r]=I.useState(()=>new ls(t)),i=si.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return I.useDebugValue(i),I.useEffect(r.onRender(e)),Ng({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&o===0?0:o+1}),i}const Og=I.createContext({editor:null});Og.Consumer;const gu=I.createContext({onDragStart:void 0}),yu=()=>I.useContext(gu),Dg=n=>{const e=n.as||"div",{nodeViewContentRef:t}=yu();return I.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},bu=I.forwardRef((n,e)=>{const{onDragStart:t}=yu(),r=n.as||"div";return I.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Ag(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Rg(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class Pg{constructor(e,{editor:t,props:r={},as:i="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?qr.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,i=this.editor;(Ag(t)||Rg(t))&&(r.ref=o=>{this.ref=o}),this.reactElement=I.createElement(t,{...r}),(e=i==null?void 0:i.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class Ig extends cg{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const c=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=c(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)}},o=this.component,s=I.memo(c=>I.createElement(gu.Provider,{value:i},I.createElement(o,c)));s.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.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Pg(s,{editor:this.editor,props:e,as:l,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}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,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r})),!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}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=Br(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function vu(n,e){return t=>t.editor.contentComponent?new Ig(n,t,e):{}}/**
150
+ */var Fl;function Mg(){return Fl||(Fl=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=I,e=si;function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;function c(u,d,f,h,p){var m=o(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var b=l(function(){var v=!1,T,A,$=function(Me){if(!v){v=!0,T=Me;var ye=h(Me);if(p!==void 0&&g.hasValue){var pe=g.value;if(p(pe,ye))return A=pe,pe}return A=ye,ye}var We=T,Se=A;if(r(We,Me))return Se;var Te=h(Me);return p!==void 0&&p(Se,Te)?Se:(T=Me,A=Te,Te)},_=f===void 0?null:f,oe=function(){return $(d())},ge=_===null?void 0:function(){return $(_())};return[oe,ge]},[d,f,h,p]),S=b[0],x=b[1],k=i(u,S,x);return s(function(){g.hasValue=!0,g.value=k},[k]),a(k),k}Fi.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Fi}process.env.NODE_ENV==="production"?Co.exports=Cg():Co.exports=Mg();var Tg=Co.exports;const Eg=typeof window<"u"?I.useLayoutEffect:I.useEffect;class Og{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function Ag(n){var e;const[t]=I.useState(()=>new Og(n.editor)),r=Tg.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:kg);return Eg(()=>t.watch(n.editor),[n.editor,t]),I.useDebugValue(r),r}const Hl=process.env.NODE_ENV!=="production",Mo=typeof window>"u",Ng=Mo||!!(typeof window<"u"&&window.next);class ls{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Mo||Ng?(Hl&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Mo&&Hl)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...r)}};return new dg(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=t.extensions)===null||s===void 0?void 0:s[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?ls.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function Rg(n={},e=[]){const t=I.useRef(n);t.current=n;const[r]=I.useState(()=>new ls(t)),i=si.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return I.useDebugValue(i),I.useEffect(r.onRender(e)),Ag({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&o===0?0:o+1}),i}const Dg=I.createContext({editor:null});Dg.Consumer;const yu=I.createContext({onDragStart:void 0}),bu=()=>I.useContext(yu),Pg=n=>{const e=n.as||"div",{nodeViewContentRef:t}=bu();return I.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},vu=I.forwardRef((n,e)=>{const{onDragStart:t}=bu(),r=n.as||"div";return I.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Ig(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function _g(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class Lg{constructor(e,{editor:t,props:r={},as:i="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?qr.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,i=this.editor;(Ig(t)||_g(t))&&(r.ref=o=>{this.ref=o}),this.reactElement=I.createElement(t,{...r}),(e=i==null?void 0:i.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class zg extends fg{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const c=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=c(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)}},o=this.component,s=I.memo(c=>I.createElement(yu.Provider,{value:i},I.createElement(o,c)));s.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.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Lg(s,{editor:this.editor,props:e,as:l,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}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,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r})),!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}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=$r(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function Su(n,e){return t=>t.editor.contentComponent?new zg(n,t,e):{}}/**
153
151
  * @license lucide-react v0.474.0 - ISC
154
152
  *
155
153
  * This source code is licensed under the ISC license.
156
154
  * See the LICENSE file in the root directory of this source tree.
157
- */const _g=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xu=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
155
+ */const Bg=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xu=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
158
156
  * @license lucide-react v0.474.0 - ISC
159
157
  *
160
158
  * This source code is licensed under the ISC license.
161
159
  * See the LICENSE file in the root directory of this source tree.
162
- */var zg={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"};/**
160
+ */var $g={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"};/**
163
161
  * @license lucide-react v0.474.0 - ISC
164
162
  *
165
163
  * This source code is licensed under the ISC license.
166
164
  * See the LICENSE file in the root directory of this source tree.
167
- */const Lg=I.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...l},a)=>I.createElement("svg",{ref:a,...zg,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:xu("lucide",i),...l},[...s.map(([c,u])=>I.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
165
+ */const jg=I.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...l},a)=>I.createElement("svg",{ref:a,...$g,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:xu("lucide",i),...l},[...s.map(([c,u])=>I.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
168
166
  * @license lucide-react v0.474.0 - ISC
169
167
  *
170
168
  * This source code is licensed under the ISC license.
171
169
  * See the LICENSE file in the root directory of this source tree.
172
- */const ee=(n,e)=>{const t=I.forwardRef(({className:r,...i},o)=>I.createElement(Lg,{ref:o,iconNode:e,className:xu(`lucide-${_g(n)}`,r),...i}));return t.displayName=`${n}`,t};/**
170
+ */const ee=(n,e)=>{const t=I.forwardRef(({className:r,...i},o)=>I.createElement(jg,{ref:o,iconNode:e,className:xu(`lucide-${Bg(n)}`,r),...i}));return t.displayName=`${n}`,t};/**
173
171
  * @license lucide-react v0.474.0 - ISC
174
172
  *
175
173
  * This source code is licensed under the ISC license.
176
174
  * See the LICENSE file in the root directory of this source tree.
177
- */const Vg=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Bg=ee("AlignCenter",Vg);/**
175
+ */const Fg=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Hg=ee("AlignCenter",Fg);/**
178
176
  * @license lucide-react v0.474.0 - ISC
179
177
  *
180
178
  * This source code is licensed under the ISC license.
181
179
  * See the LICENSE file in the root directory of this source tree.
182
- */const $g=[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],jg=ee("AlignJustify",$g);/**
180
+ */const Vg=[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],Wg=ee("AlignJustify",Vg);/**
183
181
  * @license lucide-react v0.474.0 - ISC
184
182
  *
185
183
  * This source code is licensed under the ISC license.
186
184
  * See the LICENSE file in the root directory of this source tree.
187
- */const Fg=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Hg=ee("AlignLeft",Fg);/**
185
+ */const qg=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Ug=ee("AlignLeft",qg);/**
188
186
  * @license lucide-react v0.474.0 - ISC
189
187
  *
190
188
  * This source code is licensed under the ISC license.
191
189
  * See the LICENSE file in the root directory of this source tree.
192
- */const Wg=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],qg=ee("AlignRight",Wg);/**
190
+ */const Kg=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Jg=ee("AlignRight",Kg);/**
193
191
  * @license lucide-react v0.474.0 - ISC
194
192
  *
195
193
  * This source code is licensed under the ISC license.
196
194
  * See the LICENSE file in the root directory of this source tree.
197
- */const Ug=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Kg=ee("Bold",Ug);/**
195
+ */const Yg=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Gg=ee("Bold",Yg);/**
198
196
  * @license lucide-react v0.474.0 - ISC
199
197
  *
200
198
  * This source code is licensed under the ISC license.
201
199
  * See the LICENSE file in the root directory of this source tree.
202
- */const Jg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Yg=ee("ChevronDown",Jg);/**
200
+ */const Xg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Zg=ee("ChevronDown",Xg);/**
203
201
  * @license lucide-react v0.474.0 - ISC
204
202
  *
205
203
  * This source code is licensed under the ISC license.
206
204
  * See the LICENSE file in the root directory of this source tree.
207
- */const Gg=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],Xg=ee("Code",Gg);/**
205
+ */const Qg=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],ey=ee("Code",Qg);/**
208
206
  * @license lucide-react v0.474.0 - ISC
209
207
  *
210
208
  * This source code is licensed under the ISC license.
211
209
  * See the LICENSE file in the root directory of this source tree.
212
- */const Zg=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Qg=ee("CornerDownRight",Zg);/**
210
+ */const ty=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],ny=ee("CornerDownRight",ty);/**
213
211
  * @license lucide-react v0.474.0 - ISC
214
212
  *
215
213
  * This source code is licensed under the ISC license.
216
214
  * See the LICENSE file in the root directory of this source tree.
217
- */const ey=[["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"}]],Fi=ee("Heading1",ey);/**
215
+ */const ry=[["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"}]],Hi=ee("Heading1",ry);/**
218
216
  * @license lucide-react v0.474.0 - ISC
219
217
  *
220
218
  * This source code is licensed under the ISC license.
221
219
  * See the LICENSE file in the root directory of this source tree.
222
- */const ty=[["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"}]],Fl=ee("Heading2",ty);/**
220
+ */const iy=[["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"}]],Vl=ee("Heading2",iy);/**
223
221
  * @license lucide-react v0.474.0 - ISC
224
222
  *
225
223
  * This source code is licensed under the ISC license.
226
224
  * See the LICENSE file in the root directory of this source tree.
227
- */const ny=[["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"}]],Hl=ee("Heading3",ny);/**
225
+ */const oy=[["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"}]],Wl=ee("Heading3",oy);/**
228
226
  * @license lucide-react v0.474.0 - ISC
229
227
  *
230
228
  * This source code is licensed under the ISC license.
231
229
  * See the LICENSE file in the root directory of this source tree.
232
- */const ry=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],Wl=ee("Heading4",ry);/**
230
+ */const sy=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],ql=ee("Heading4",sy);/**
233
231
  * @license lucide-react v0.474.0 - ISC
234
232
  *
235
233
  * This source code is licensed under the ISC license.
236
234
  * See the LICENSE file in the root directory of this source tree.
237
- */const iy=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],ql=ee("Heading5",iy);/**
235
+ */const ly=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],Ul=ee("Heading5",ly);/**
238
236
  * @license lucide-react v0.474.0 - ISC
239
237
  *
240
238
  * This source code is licensed under the ISC license.
241
239
  * See the LICENSE file in the root directory of this source tree.
242
- */const oy=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],Ul=ee("Heading6",oy);/**
240
+ */const ay=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],Kl=ee("Heading6",ay);/**
243
241
  * @license lucide-react v0.474.0 - ISC
244
242
  *
245
243
  * This source code is licensed under the ISC license.
246
244
  * See the LICENSE file in the root directory of this source tree.
247
- */const sy=[["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"}]],ly=ee("Image",sy);/**
245
+ */const cy=[["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"}]],uy=ee("Image",cy);/**
248
246
  * @license lucide-react v0.474.0 - ISC
249
247
  *
250
248
  * This source code is licensed under the ISC license.
251
249
  * See the LICENSE file in the root directory of this source tree.
252
- */const ay=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],cy=ee("Italic",ay);/**
250
+ */const dy=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],fy=ee("Italic",dy);/**
253
251
  * @license lucide-react v0.474.0 - ISC
254
252
  *
255
253
  * This source code is licensed under the ISC license.
256
254
  * See the LICENSE file in the root directory of this source tree.
257
- */const uy=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],dy=ee("Layers",uy);/**
255
+ */const hy=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],py=ee("Layers",hy);/**
258
256
  * @license lucide-react v0.474.0 - ISC
259
257
  *
260
258
  * This source code is licensed under the ISC license.
261
259
  * See the LICENSE file in the root directory of this source tree.
262
- */const fy=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],hy=ee("ListOrdered",fy);/**
260
+ */const my=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],gy=ee("ListOrdered",my);/**
263
261
  * @license lucide-react v0.474.0 - ISC
264
262
  *
265
263
  * This source code is licensed under the ISC license.
266
264
  * See the LICENSE file in the root directory of this source tree.
267
- */const py=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],my=ee("List",py);/**
265
+ */const yy=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],by=ee("List",yy);/**
268
266
  * @license lucide-react v0.474.0 - ISC
269
267
  *
270
268
  * This source code is licensed under the ISC license.
271
269
  * See the LICENSE file in the root directory of this source tree.
272
- */const gy=[["path",{d:"M5 12h14",key:"1ays0h"}]],yy=ee("Minus",gy);/**
270
+ */const vy=[["path",{d:"M5 12h14",key:"1ays0h"}]],Sy=ee("Minus",vy);/**
273
271
  * @license lucide-react v0.474.0 - ISC
274
272
  *
275
273
  * This source code is licensed under the ISC license.
276
274
  * See the LICENSE file in the root directory of this source tree.
277
- */const by=[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]],vy=ee("PaintBucket",by);/**
275
+ */const xy=[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]],wy=ee("PaintBucket",xy);/**
278
276
  * @license lucide-react v0.474.0 - ISC
279
277
  *
280
278
  * This source code is licensed under the ISC license.
281
279
  * See the LICENSE file in the root directory of this source tree.
282
- */const xy=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sy=ee("Plus",xy);/**
280
+ */const ky=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Cy=ee("Plus",ky);/**
283
281
  * @license lucide-react v0.474.0 - ISC
284
282
  *
285
283
  * This source code is licensed under the ISC license.
286
284
  * See the LICENSE file in the root directory of this source tree.
287
- */const wy=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],ky=ee("Quote",wy);/**
285
+ */const My=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],Ty=ee("Quote",My);/**
288
286
  * @license lucide-react v0.474.0 - ISC
289
287
  *
290
288
  * This source code is licensed under the ISC license.
291
289
  * See the LICENSE file in the root directory of this source tree.
292
- */const Cy=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],Ey=ee("Redo",Cy);/**
290
+ */const Ey=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],Oy=ee("Redo",Ey);/**
293
291
  * @license lucide-react v0.474.0 - ISC
294
292
  *
295
293
  * This source code is licensed under the ISC license.
296
294
  * See the LICENSE file in the root directory of this source tree.
297
- */const Ny=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],My=ee("SquareCheckBig",Ny);/**
295
+ */const Ay=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ny=ee("SquareCheckBig",Ay);/**
298
296
  * @license lucide-react v0.474.0 - ISC
299
297
  *
300
298
  * This source code is licensed under the ISC license.
301
299
  * See the LICENSE file in the root directory of this source tree.
302
- */const Ty=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Oy=ee("Strikethrough",Ty);/**
300
+ */const Ry=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Dy=ee("Strikethrough",Ry);/**
303
301
  * @license lucide-react v0.474.0 - ISC
304
302
  *
305
303
  * This source code is licensed under the ISC license.
306
304
  * See the LICENSE file in the root directory of this source tree.
307
- */const Dy=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],Ay=ee("Subscript",Dy);/**
305
+ */const Py=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],Iy=ee("Subscript",Py);/**
308
306
  * @license lucide-react v0.474.0 - ISC
309
307
  *
310
308
  * This source code is licensed under the ISC license.
311
309
  * See the LICENSE file in the root directory of this source tree.
312
- */const Ry=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],Py=ee("Superscript",Ry);/**
310
+ */const _y=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],Ly=ee("Superscript",_y);/**
313
311
  * @license lucide-react v0.474.0 - ISC
314
312
  *
315
313
  * This source code is licensed under the ISC license.
316
314
  * See the LICENSE file in the root directory of this source tree.
317
- */const Iy=[["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"}]],_y=ee("Table",Iy);/**
315
+ */const zy=[["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"}]],By=ee("Table",zy);/**
318
316
  * @license lucide-react v0.474.0 - ISC
319
317
  *
320
318
  * This source code is licensed under the ISC license.
321
319
  * See the LICENSE file in the root directory of this source tree.
322
- */const zy=[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]],Ly=ee("TextCursor",zy);/**
320
+ */const $y=[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]],jy=ee("TextCursor",$y);/**
323
321
  * @license lucide-react v0.474.0 - ISC
324
322
  *
325
323
  * This source code is licensed under the ISC license.
326
324
  * See the LICENSE file in the root directory of this source tree.
327
- */const Vy=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],By=ee("Underline",Vy);/**
325
+ */const Fy=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Hy=ee("Underline",Fy);/**
328
326
  * @license lucide-react v0.474.0 - ISC
329
327
  *
330
328
  * This source code is licensed under the ISC license.
331
329
  * See the LICENSE file in the root directory of this source tree.
332
- */const $y=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],jy=ee("Undo",$y);/**
330
+ */const Vy=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],Wy=ee("Undo",Vy);/**
333
331
  * @license lucide-react v0.474.0 - ISC
334
332
  *
335
333
  * This source code is licensed under the ISC license.
336
334
  * See the LICENSE file in the root directory of this source tree.
337
- */const Fy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hy=ee("X",Fy);function Wy({editor:n}){const[e,t]=I.useState(!1);return w.jsxDEV("div",{className:"relative",children:[w.jsxDEV("button",{type:"button",className:`p-1 text-black transition-all duration-300 rounded-md shadow-lg hover:bg-blue-100 hover:text-blue-600 ${e?"bg-blue-100 text-blue-600":""}`,onClick:r=>{r.preventDefault(),r.stopPropagation(),t(!e)},children:e?w.jsxDEV(Hy,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:20,columnNumber:25},this):w.jsxDEV(dy,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:20,columnNumber:43},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:9,columnNumber:13},this),e&&w.jsxDEV("div",{className:"fixed z-40 w-64 p-4 bg-white border border-gray-200 rounded-lg shadow-xl bottom-20 right-4 animate-slide-up",children:w.jsxDEV("div",{className:"space-y-2",children:[w.jsxDEV("h3",{className:"mb-3 font-bold text-center text-gray-700",children:"Cyber Extensions"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:26,columnNumber:25},this),w.jsxDEV("button",{type:"button",onClick:()=>{n.chain().focus().insertContent({type:"accordion",content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()},className:"flex items-center justify-center w-full gap-2 px-3 py-1 text-blue-600 duration-300 rounded-md bg-blue-50 hover:bg-blue-100 hover:text-blue-700",children:[w.jsxDEV(Sy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:54,columnNumber:29},this)," Accordion"]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:30,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:25,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:24,columnNumber:17},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:8,columnNumber:9},this)}const Fr=({value:n,onChange:e})=>w.jsxDEV(ft.ColorPicker,{value:n,onChange:e,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/color-picker.tsx",lineNumber:12,columnNumber:9},void 0),qy=({editor:n})=>{const[e,t]=I.useState("#1677ff"),[r,i]=I.useState("#ffffff"),o=a=>{const c=a.toHexString();t(c),n.chain().focus().setColor(c).run()},s=a=>{const c=a.toHexString();i(c),n.chain().focus().setHighlight({color:c}).run()},l=a=>{a.preventDefault()};return w.jsxDEV("div",{className:"flex items-center gap-4",children:[w.jsxDEV(ft.Tooltip,{title:"Text Color",children:w.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsxDEV(Ly,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:33,columnNumber:21},void 0),w.jsxDEV(Fr,{value:e,onChange:o},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:34,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:32,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:31,columnNumber:13},void 0),w.jsxDEV(ft.Tooltip,{title:"Highlight Color",children:w.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsxDEV(vy,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:41,columnNumber:21},void 0),w.jsxDEV(Fr,{value:r,onChange:s},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:42,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:40,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:39,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:29,columnNumber:9},void 0)},Uy=({editor:n})=>{if(!n)return null;const e=()=>{for(let r=1;r<=6;r++)if(n.isActive("heading",{level:r}))switch(r){case 1:return w.jsxDEV(Fi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:15,columnNumber:36},void 0);case 2:return w.jsxDEV(Fl,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:16,columnNumber:36},void 0);case 3:return w.jsxDEV(Hl,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:17,columnNumber:36},void 0);case 4:return w.jsxDEV(Wl,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:18,columnNumber:36},void 0);case 5:return w.jsxDEV(ql,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:19,columnNumber:36},void 0);case 6:return w.jsxDEV(Ul,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:20,columnNumber:36},void 0)}return w.jsxDEV(Fi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:24,columnNumber:16},void 0)},t=[...Array.from({length:6},(r,i)=>({key:`${i+1}`,label:w.jsxDEV("div",{className:"flex items-center gap-2",onClick:()=>n.chain().focus().toggleHeading({level:i+1}).run(),children:[I.createElement([Fi,Fl,Hl,Wl,ql,Ul][i],{size:16}),w.jsxDEV("span",{children:["Heading ",i+1]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:33,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:31,columnNumber:17},void 0),className:n.isActive("heading",{level:i+1})?"ant-dropdown-menu-item-active":""}))];return w.jsxDEV(ft.Dropdown,{menu:{items:t},trigger:["hover"],placement:"bottomLeft",children:w.jsxDEV("button",{className:"flex items-center gap-1 p-2 rounded-md hover:bg-blue-100 hover:text-blue-600",children:e()},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:42,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:41,columnNumber:9},void 0)},Ky=8,Jy=8,Yy=({editor:n,buttonClass:e,activeClass:t})=>{const[r,i]=I.useState({rows:0,cols:0}),[o,s]=I.useState(!1),l=(a,c)=>{n.chain().focus().insertTable({rows:a,cols:c,withHeaderRow:!0}).run(),s(!1)};return w.jsxDEV(ft.Dropdown,{open:o,onOpenChange:s,trigger:["hover"],overlay:w.jsxDEV("div",{className:"w-56 p-4 bg-white border border-gray-300 rounded-lg shadow-xl",children:[w.jsxDEV("div",{className:"grid grid-cols-8 gap-1",children:Array.from({length:Ky}).map((a,c)=>Array.from({length:Jy}).map((u,d)=>{const f=c<r.rows&&d<r.cols;return w.jsxDEV("div",{className:`w-5 h-5 border rounded-sm cursor-pointer transition-all duration-200 ${f?"bg-blue-400 border-white scale-110":"bg-gray-200 hover:bg-gray-300"}`,onMouseEnter:()=>i({rows:c+1,cols:d+1}),onClick:()=>l(c+1,d+1)},`${c}-${d}`,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:40,columnNumber:37},void 0)}))},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:35,columnNumber:21},void 0),w.jsxDEV("div",{className:"mt-3 text-sm font-medium text-center text-gray-700",children:r.rows>0&&r.cols>0?`${r.rows} × ${r.cols} Table`:"Insert Table"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:53,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:34,columnNumber:17},void 0),children:w.jsxDEV("button",{className:`${e} ${o?t:""} transition-all`,children:w.jsxDEV(_y,{className:"w-5 h-5"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:65,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:61,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:29,columnNumber:9},void 0)};function Gy({editor:n}){if(!n)return null;const e="p-2 rounded-md transition-all duration-200 hover:bg-blue-100 hover:text-blue-600",t="bg-blue-100 text-blue-600",r=(i,o,s,l,a)=>w.jsxDEV(ft.Tooltip,{title:a,children:w.jsxDEV("button",{type:"button",onClick:o,disabled:l,className:`
335
+ */const qy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Uy=ee("X",qy);function Ky({editor:n}){const[e,t]=I.useState(!1);return w.jsxs("div",{className:"relative",children:[w.jsx("button",{type:"button",className:`p-1 text-black transition-all duration-300 rounded-md shadow-lg hover:bg-blue-100 hover:text-blue-600 ${e?"bg-blue-100 text-blue-600":""}`,onClick:r=>{r.preventDefault(),r.stopPropagation(),t(!e)},children:e?w.jsx(Uy,{size:24}):w.jsx(py,{size:24})}),e&&w.jsx("div",{className:"fixed z-40 w-64 p-4 bg-white border border-gray-200 rounded-lg shadow-xl bottom-20 right-4 animate-slide-up",children:w.jsxs("div",{className:"space-y-2",children:[w.jsx("h3",{className:"mb-3 font-bold text-center text-gray-700",children:"Cyber Extensions"}),w.jsxs("button",{type:"button",onClick:()=>{n.chain().focus().insertContent({type:"accordion",content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()},className:"flex items-center justify-center w-full gap-2 px-3 py-1 text-blue-600 duration-300 rounded-md bg-blue-50 hover:bg-blue-100 hover:text-blue-700",children:[w.jsx(Cy,{size:16})," Accordion"]})]})})]})}const Hr=({value:n,onChange:e})=>w.jsx(ft.ColorPicker,{value:n,onChange:e,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]}),Jy=({editor:n})=>{const[e,t]=I.useState("#1677ff"),[r,i]=I.useState("#ffffff"),o=a=>{const c=a.toHexString();t(c),n.chain().focus().setColor(c).run()},s=a=>{const c=a.toHexString();i(c),n.chain().focus().setHighlight({color:c}).run()},l=a=>{a.preventDefault()};return w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(ft.Tooltip,{title:"Text Color",children:w.jsxs("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsx(jy,{size:20,color:"black"}),w.jsx(Hr,{value:e,onChange:o})]})}),w.jsx(ft.Tooltip,{title:"Highlight Color",children:w.jsxs("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsx(wy,{size:20,color:"black"}),w.jsx(Hr,{value:r,onChange:s})]})})]})},Yy=({editor:n})=>{if(!n)return null;const e=()=>{for(let r=1;r<=6;r++)if(n.isActive("heading",{level:r}))switch(r){case 1:return w.jsx(Hi,{size:16});case 2:return w.jsx(Vl,{size:16});case 3:return w.jsx(Wl,{size:16});case 4:return w.jsx(ql,{size:16});case 5:return w.jsx(Ul,{size:16});case 6:return w.jsx(Kl,{size:16})}return w.jsx(Hi,{size:16})},t=[...Array.from({length:6},(r,i)=>({key:`${i+1}`,label:w.jsxs("div",{className:"flex items-center gap-2",onClick:()=>n.chain().focus().toggleHeading({level:i+1}).run(),children:[I.createElement([Hi,Vl,Wl,ql,Ul,Kl][i],{size:16}),w.jsxs("span",{children:["Heading ",i+1]})]}),className:n.isActive("heading",{level:i+1})?"ant-dropdown-menu-item-active":""}))];return w.jsx(ft.Dropdown,{menu:{items:t},trigger:["hover"],placement:"bottomLeft",children:w.jsx("button",{className:"flex items-center gap-1 p-2 rounded-md hover:bg-blue-100 hover:text-blue-600",children:e()})})},Gy=8,Xy=8,Zy=({editor:n,buttonClass:e,activeClass:t})=>{const[r,i]=I.useState({rows:0,cols:0}),[o,s]=I.useState(!1),l=(a,c)=>{n.chain().focus().insertTable({rows:a,cols:c,withHeaderRow:!0}).run(),s(!1)};return w.jsx(ft.Dropdown,{open:o,onOpenChange:s,trigger:["hover"],overlay:w.jsxs("div",{className:"w-56 p-4 bg-white border border-gray-300 rounded-lg shadow-xl",children:[w.jsx("div",{className:"grid grid-cols-8 gap-1",children:Array.from({length:Gy}).map((a,c)=>Array.from({length:Xy}).map((u,d)=>{const f=c<r.rows&&d<r.cols;return w.jsx("div",{className:`w-5 h-5 border rounded-sm cursor-pointer transition-all duration-200 ${f?"bg-blue-400 border-white scale-110":"bg-gray-200 hover:bg-gray-300"}`,onMouseEnter:()=>i({rows:c+1,cols:d+1}),onClick:()=>l(c+1,d+1)},`${c}-${d}`)}))}),w.jsx("div",{className:"mt-3 text-sm font-medium text-center text-gray-700",children:r.rows>0&&r.cols>0?`${r.rows} × ${r.cols} Table`:"Insert Table"})]}),children:w.jsx("button",{className:`${e} ${o?t:""} transition-all`,children:w.jsx(By,{className:"w-5 h-5"})})})};function Qy({editor:n}){if(!n)return null;const e="p-2 rounded-md transition-all duration-200 hover:bg-blue-100 hover:text-blue-600",t="bg-blue-100 text-blue-600",r=(i,o,s,l,a)=>w.jsx(ft.Tooltip,{title:a,children:w.jsx("button",{type:"button",onClick:o,disabled:l,className:`
338
336
  ${e}
339
337
  ${s?t:""}
340
338
  ${l?"opacity-50 cursor-not-allowed":""}
341
- `,children:i},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:32,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:31,columnNumber:9},this);return w.jsxDEV("div",{className:"flex flex-wrap items-center gap-2 p-2 border-b border-gray-200 rounded-t-lg bg-gray-50",children:[w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(Kg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:52,columnNumber:21},this),()=>n.chain().focus().toggleBold().run(),n.isActive("bold"),!1,"Bold"),r(w.jsxDEV(cy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:59,columnNumber:21},this),()=>n.chain().focus().toggleItalic().run(),n.isActive("italic"),!1,"Italic"),r(w.jsxDEV(By,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:66,columnNumber:21},this),()=>n.chain().focus().toggleUnderline().run(),n.isActive("underline"),!1,"Underline"),r(w.jsxDEV(Oy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:73,columnNumber:21},this),()=>n.chain().focus().toggleStrike().run(),n.isActive("strike"),!1,"Strikethrough"),r(w.jsxDEV(Xg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:80,columnNumber:21},this),()=>n.chain().focus().toggleCode().run(),n.isActive("code"),!1,"Code"),r(w.jsxDEV(Ay,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:87,columnNumber:21},this),()=>n.chain().focus().toggleSubscript().run(),n.isActive("subscript"),!1,"Subscript"),r(w.jsxDEV(Py,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:94,columnNumber:21},this),()=>n.chain().focus().toggleSuperscript().run(),n.isActive("superscript"),!1,"Superscript")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:50,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:102,columnNumber:13},this),w.jsxDEV(Uy,{editor:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:105,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:107,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(Hg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:112,columnNumber:21},this),()=>n.chain().focus().setTextAlign("left").run(),n.isActive({textAlign:"left"}),!1,"Align Left"),r(w.jsxDEV(Bg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:119,columnNumber:21},this),()=>n.chain().focus().setTextAlign("center").run(),n.isActive({textAlign:"center"}),!1,"Align Center"),r(w.jsxDEV(qg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:124,columnNumber:21},this),()=>n.chain().focus().setTextAlign("right").run(),n.isActive({textAlign:"right"}),!1,"Align Right"),r(w.jsxDEV(jg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:129,columnNumber:21},this),()=>n.chain().focus().setTextAlign("justify").run(),n.isActive({textAlign:"justify"}),!1,"Align Justify")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:110,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:135,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(my,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:140,columnNumber:21},this),()=>n.chain().focus().toggleBulletList().run(),n.isActive("bulletList"),!1,"Bullet List"),r(w.jsxDEV(hy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:145,columnNumber:21},this),()=>n.chain().focus().toggleOrderedList().run(),n.isActive("orderedList"),!1,"Ordered List"),r(w.jsxDEV(My,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:150,columnNumber:21},this),()=>n.chain().focus().toggleTaskList().run(),n.isActive("taskList"),!1,"Task List")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:138,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:156,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(ky,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:161,columnNumber:21},this),()=>n.chain().focus().toggleBlockquote().run(),n.isActive("blockquote"),!1,"Blockquote"),w.jsxDEV(Yy,{editor:n,buttonClass:e,activeClass:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:165,columnNumber:17},this),r(w.jsxDEV(yy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:167,columnNumber:21},this),()=>n.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),r(w.jsxDEV(Qg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:171,columnNumber:21},this),()=>n.chain().focus().setHardBreak().run(),!1,!1,"Line Break")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:159,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:176,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(jy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:181,columnNumber:21},this),()=>n.chain().focus().undo().run(),!1,!n.can().chain().focus().undo().run()),r(w.jsxDEV(Ey,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:187,columnNumber:21},this),()=>n.chain().focus().redo().run(),!1,!n.can().chain().focus().redo().run())]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:179,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:194,columnNumber:13},this),r(w.jsxDEV(ly,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:197,columnNumber:17},this),()=>{const i=prompt("Enter the image URL");i&&n.chain().focus().insertContent({type:"image",attrs:{src:i,width:300,height:300,marginLeft:0,marginRight:0}}).run()},!1,!1,"Insert Image"),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:218,columnNumber:13},this),w.jsxDEV(qy,{editor:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:221,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:223,columnNumber:13},this),w.jsxDEV(Wy,{editor:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:224,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:48,columnNumber:9},this)}const Su=ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ie(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)}}}),Xy=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,i;const o=t.getAttribute("style"),s=(i=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");t.setAttribute("style",`${s};${o}`)})},Kl=Qe.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Xy(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),Zy=De.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()}}}),Qy=/^\s*>\s$/,eb=ce.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",ie(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[On({find:Qy,type:this.type})]}}),tb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ib=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ob=Qe.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",ie(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[ln({find:tb,type:this.type}),ln({find:rb,type:this.type})]},addPasteRules(){return[an({find:nb,type:this.type}),an({find:ib,type:this.type})]}}),sb="listItem",Jl="textStyle",Yl=/^\s*([-+*])\s$/,lb=ce.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",ie(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(sb,this.editor.getAttributes(Jl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=On({find:Yl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=On({find:Yl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jl),editor:this.editor})),[n]}}),ab=/(^|[^`])`([^`]+)`(?!`)/,cb=/(^|[^`])`([^`]+)`(?!`)/g,ub=Qe.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ie(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[ln({find:ab,type:this.type})]},addPasteRules(){return[an({find:cb,type:this.type})]}}),db=/^```([a-z]+)?[\s\n]$/,fb=/^~~~([a-z]+)?[\s\n]$/,hb=ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,o=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ie(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:i}=t;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
339
+ `,children:i})});return w.jsxs("div",{className:"flex flex-wrap items-center gap-2 p-2 border-b border-gray-200 rounded-t-lg bg-gray-50",children:[w.jsxs("div",{className:"flex items-center gap-1",children:[r(w.jsx(Gg,{size:16}),()=>n.chain().focus().toggleBold().run(),n.isActive("bold"),!1,"Bold"),r(w.jsx(fy,{size:16}),()=>n.chain().focus().toggleItalic().run(),n.isActive("italic"),!1,"Italic"),r(w.jsx(Hy,{size:16}),()=>n.chain().focus().toggleUnderline().run(),n.isActive("underline"),!1,"Underline"),r(w.jsx(Dy,{size:16}),()=>n.chain().focus().toggleStrike().run(),n.isActive("strike"),!1,"Strikethrough"),r(w.jsx(ey,{size:16}),()=>n.chain().focus().toggleCode().run(),n.isActive("code"),!1,"Code"),r(w.jsx(Iy,{size:16}),()=>n.chain().focus().toggleSubscript().run(),n.isActive("subscript"),!1,"Subscript"),r(w.jsx(Ly,{size:16}),()=>n.chain().focus().toggleSuperscript().run(),n.isActive("superscript"),!1,"Superscript")]}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsx(Yy,{editor:n}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsxs("div",{className:"flex items-center gap-1",children:[r(w.jsx(Ug,{size:16}),()=>n.chain().focus().setTextAlign("left").run(),n.isActive({textAlign:"left"}),!1,"Align Left"),r(w.jsx(Hg,{size:16}),()=>n.chain().focus().setTextAlign("center").run(),n.isActive({textAlign:"center"}),!1,"Align Center"),r(w.jsx(Jg,{size:16}),()=>n.chain().focus().setTextAlign("right").run(),n.isActive({textAlign:"right"}),!1,"Align Right"),r(w.jsx(Wg,{size:16}),()=>n.chain().focus().setTextAlign("justify").run(),n.isActive({textAlign:"justify"}),!1,"Align Justify")]}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsxs("div",{className:"flex items-center gap-1",children:[r(w.jsx(by,{size:16}),()=>n.chain().focus().toggleBulletList().run(),n.isActive("bulletList"),!1,"Bullet List"),r(w.jsx(gy,{size:16}),()=>n.chain().focus().toggleOrderedList().run(),n.isActive("orderedList"),!1,"Ordered List"),r(w.jsx(Ny,{size:16}),()=>n.chain().focus().toggleTaskList().run(),n.isActive("taskList"),!1,"Task List")]}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsxs("div",{className:"flex items-center gap-1",children:[r(w.jsx(Ty,{size:16}),()=>n.chain().focus().toggleBlockquote().run(),n.isActive("blockquote"),!1,"Blockquote"),w.jsx(Zy,{editor:n,buttonClass:e,activeClass:t}),r(w.jsx(Sy,{size:16}),()=>n.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),r(w.jsx(ny,{size:16}),()=>n.chain().focus().setHardBreak().run(),!1,!1,"Line Break")]}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsxs("div",{className:"flex items-center gap-1",children:[r(w.jsx(Wy,{size:16}),()=>n.chain().focus().undo().run(),!1,!n.can().chain().focus().undo().run()),r(w.jsx(Oy,{size:16}),()=>n.chain().focus().redo().run(),!1,!n.can().chain().focus().redo().run())]}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),r(w.jsx(uy,{size:16}),()=>{const i=prompt("Enter the image URL");i&&n.chain().focus().insertContent({type:"image",attrs:{src:i,width:300,height:300,marginLeft:0,marginRight:0}}).run()},!1,!1,"Insert Image"),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsx(Jy,{editor:n}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsx(Ky,{editor:n})]})}const wu=ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ie(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)}}}),eb=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,i;const o=t.getAttribute("style"),s=(i=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");t.setAttribute("style",`${s};${o}`)})},Jl=Qe.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&eb(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),tb=Ne.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()}}}),nb=/^\s*>\s$/,rb=ce.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",ie(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[An({find:nb,type:this.type})]}}),ib=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ob=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,sb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,lb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ab=Qe.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",ie(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[ln({find:ib,type:this.type}),ln({find:sb,type:this.type})]},addPasteRules(){return[an({find:ob,type:this.type}),an({find:lb,type:this.type})]}}),cb="listItem",Yl="textStyle",Gl=/^\s*([-+*])\s$/,ub=ce.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",ie(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(cb,this.editor.getAttributes(Yl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=An({find:Gl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=An({find:Gl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Yl),editor:this.editor})),[n]}}),db=/(^|[^`])`([^`]+)`(?!`)/,fb=/(^|[^`])`([^`]+)`(?!`)/g,hb=Qe.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ie(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[ln({find:db,type:this.type})]},addPasteRules(){return[an({find:fb,type:this.type})]}}),pb=/^```([a-z]+)?[\s\n]$/,mb=/^~~~([a-z]+)?[\s\n]$/,gb=ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,o=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ie(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:i}=t;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
342
340
 
343
- `);return!o||!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:i,empty:o}=t;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(V.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[wo({find:db,type:this.type,getAttributes:n=>({language:n[1]})}),wo({find:fb,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Le({key:new et("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"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!t||!o)return!1;const{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
344
- `));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(L.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),pb=ce.create({name:"doc",topNode:!0,content:"block+"});function mb(n={}){return new Le({view(e){return new gb(e,n)}})}class gb{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(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}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 i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"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),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=tc(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 yb=De.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[mb(this.options)]}});class de extends V{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return de.valid(r)?new de(r):V.near(r)}content(){return T.empty}eq(e){return e instanceof de&&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 de(e.resolve(t.pos))}getBookmark(){return new as(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!bb(e)||!vb(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(de.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!z.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;V.jsonID("gapcursor",de);class as{constructor(e){this.pos=e}map(e){return new as(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return de.valid(t)?new de(t):V.near(t)}}function bb(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 i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function vb(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 i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function xb(){return new Le({props:{decorations:Cb,createSelectionBetween(n,e,t){return e.pos==t.pos&&de.valid(t)?new de(t):null},handleClick:wb,handleKeyDown:Sb,handleDOMEvents:{beforeinput:kb}}})}const Sb=Yo({ArrowLeft:hr("horiz",-1),ArrowRight:hr("horiz",1),ArrowUp:hr("vert",-1),ArrowDown:hr("vert",1)});function hr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof L){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new de(c))),!0):!1}}function wb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!de.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&z.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new de(r))),!0)}function kb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof de))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 i=C.empty;for(let s=r.length-1;s>=0;s--)i=C.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new T(i,0,0));return o.setSelection(L.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Cb(n){if(!(n.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ue.create(n.doc,[$e.widget(n.selection.head,e,{key:"gapcursor"})])}const Eb=De.create({name:"gapCursor",addProseMirrorPlugins(){return[xb()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=q(P(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Nb=ce.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ie(this.options.HTMLAttributes,n)]},renderText(){return`
345
- `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:o}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=o||i.$to.parentOffset&&i.$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()}}}),Mb=ce.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]}`,ie(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=>wo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Hr=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<Hr&&this.leafAppend(e)||this.length<Hr&&e.leafPrepend(this)||this.appendInner(e)):this};ke.prototype.prepend=function(e){return e.length?ke.from(e).append(this):this};ke.prototype.appendInner=function(e){return new Tb(this,e)};ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ke.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)};ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};ke.from=function(e){return e instanceof ke?e:e&&e.length?new wu(e):ke.empty};var wu=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(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Hr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ke);ke.empty=new wu([]);var Tb=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,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ke);const Ob=500;class lt{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 i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new dt(d.map));let h=d.step.map(i.slice(o)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+u.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(o)):d.selection,a=new lt(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,i){let o=[],s=this.eventCount,l=this.items,a=!i&&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 dt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(s++,t=void 0),i||(a=f)}let c=s-r.depth;return c>Ab&&(l=Db(l,c),s-=c),new lt(l.append(o),s)}remapping(e,t){let r=new wn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new lt(this.items.append(e.map(t=>new dt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=o.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(o.slice(a+1,h));g&&l++,r.push(new dt(p,m,g))}else r.push(new dt(p))},i);let c=[];for(let f=t;f<s;f++)c.push(new dt(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new lt(u,l);return d.emptyItemCount()>Ob&&(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,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;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&&o++;let d=new dt(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new lt(ke.from(i.reverse()),o)}}lt.empty=new lt(ke.empty,0);function Db(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class dt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new dt(t.getMap().invert(),t,this.selection)}}}class Dt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Ab=20;function Rb(n,e,t,r){let i=t.getMeta(nn),o;if(i)return i.historyState;t.getMeta(_b)&&(n=new Dt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(nn))return s.getMeta(nn).redo?new Dt(n.done.addTransform(t,void 0,r,kr(e)),n.undone,Gl(t.mapping.maps),n.prevTime,n.prevComposition):new Dt(n.done,n.undone.addTransform(t,void 0,r,kr(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||!Pb(t,n.prevRanges)),c=s?Hi(n.prevRanges,t.mapping):Gl(t.mapping.maps);return new Dt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,kr(e)),lt.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new Dt(n.done.rebased(t,o),n.undone.rebased(t,o),Hi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Dt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Hi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Pb(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Gl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Hi(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function Ib(n,e,t){let r=kr(e),i=nn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new Dt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(nn,{redo:t,historyState:a})}let Wi=!1,Xl=null;function kr(n){let e=n.plugins;if(Xl!=e){Wi=!1,Xl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Wi=!0;break}}return Wi}const nn=new et("history"),_b=new et("closeHistory");function zb(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Le({key:nn,state:{init(){return new Dt(lt.empty,lt.empty,null,0,-1)},apply(e,t,r){return Rb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Cu:r=="historyRedo"?Eu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function ku(n,e){return(t,r)=>{let i=nn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Ib(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Cu=ku(!1,!0),Eu=ku(!0,!0),Lb=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Cu(n,e),redo:()=>({state:n,dispatch:e})=>Eu(n,e)}},addProseMirrorPlugins(){return[zb(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()}}}),Vb=ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ie(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{selection:t}=e,{$from:r,$to:i}=t,o=n();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):Rm(t)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(L.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(z.create(s.doc,c.pos)):s.setSelection(L.create(s.doc,c.pos));else{const d=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();d&&(s.insert(u,d),s.setSelection(L.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[mu({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Bb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,$b=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Fb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Hb=Qe.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ie(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[ln({find:Bb,type:this.type}),ln({find:jb,type:this.type})]},addPasteRules(){return[an({find:$b,type:this.type}),an({find:Fb,type:this.type})]}}),Wb="listItem",Zl="textStyle",Ql=/^(\d+)\.\s$/,qb=ce.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},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ie(this.options.HTMLAttributes,t),0]:["ol",ie(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(Wb,this.editor.getAttributes(Zl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=On({find:Ql,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=On({find:Ql,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Zl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Ub=ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Kb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Jb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Yb=Qe.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",ie(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[ln({find:Kb,type:this.type})]},addPasteRules(){return[an({find:Jb,type:this.type})]}}),Gb=ce.create({name:"text",group:"inline"}),Xb=De.create({name:"starterKit",addExtensions(){var n,e,t,r,i,o,s,l,a,c,u,d,f,h,p,m,g,b;const x=[];return this.options.bold!==!1&&x.push(ob.configure((n=this.options)===null||n===void 0?void 0:n.bold)),this.options.blockquote!==!1&&x.push(eb.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&x.push(lb.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&x.push(ub.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&x.push(hb.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&x.push(pb.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&x.push(yb.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&x.push(Eb.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&x.push(Nb.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&x.push(Mb.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&x.push(Lb.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&x.push(Vb.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&x.push(Hb.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&x.push(Su.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&x.push(qb.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&x.push(Ub.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&x.push(Yb.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&x.push(Gb.configure((b=this.options)===null||b===void 0?void 0:b.text)),x}}),Zb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Qb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,e0=Qe.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",ie(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[ln({find:Zb,type:this.type})]},addPasteRules(){return[an({find:Qb,type:this.type})]}}),t0=Qe.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",ie(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()}}}),n0=Qe.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),r0=Qe.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),i0=De.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{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")}}}),o0=ce.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",ie(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()}}}),s0=/^\s*(\[([( |x])?\])\s$/,l0=ce.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=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ie(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 i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");return o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",c=>c.preventDefault()),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();if(typeof f!="number")return!1;const 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])=>{i.setAttribute(c,u)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(e).forEach(([c,u])=>{i.setAttribute(c,u)}),{dom:i,contentDOM:a,update:c=>c.type!==this.type?!1:(i.dataset.checked=c.attrs.checked,l.checked=c.attrs.checked,!0)}}},addInputRules(){return[On({find:s0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}});var No,Mo;if(typeof WeakMap<"u"){let n=new WeakMap;No=e=>n.get(e),Mo=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;No=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Mo=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var fe=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==t;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:o,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[o*this.width+(t<0?r-1:i)]:(t<0?o==0:s==this.height)?null:this.map[r+this.width*(t<0?o-1:s)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:o}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const o=r*this.width+i,s=this.map[o];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[o-1]==s||r==n.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const o=i+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(n){return No(n)||Mo(n,a0(n))}};function a0(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=c0(n),t=n.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const d=n.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:x}=m.attrs;for(let S=0;S<b;S++){if(S+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:b-S});break}const k=i+S*e;for(let v=0;v<g;v++){r[k+v]==0?r[k+v]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:g-v});const N=x&&x[v];if(N){const O=(k+v)%e*2,B=s[O];B==null||B!=N&&s[O+1]==1?(s[O]=N,s[O+1]=1):B==N&&s[O+1]++}}}i+=g,u+=m.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(o||(o=[])).push({type:"missing",row:c,n:h}),u++}const l=new fe(e,t,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&u0(l,s,n),l}function c0(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let o=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function u0(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const o=n.map[i];if(r[o])continue;r[o]=!0;const s=t.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=(i+c)%n.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=d0(a)))[c]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function d0(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function _e(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var Rt=new et("selectingCells");function An(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 f0(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 ct(n){const 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 li(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=An(e.$head)||h0(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function h0(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const 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--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function To(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function p0(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function cs(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Nu(n,e,t){const r=n.node(-1),i=fe.get(r),o=n.start(-1),s=i.nextCell(n.pos-o,e,t);return s==null?null:n.node(0).resolve(o+s)}function cn(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Mu(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function m0(n,e,t){const r=_e(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var ae=class St extends V{constructor(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,t.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(u=>u!=t.pos-o);a.unshift(t.pos-o);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=o+u+1;return new lc(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){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(To(r)&&To(i)&&cs(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?St.rowSelection(r,i):o&&this.isColSelection()?St.colSelection(r,i):new St(r,i)}return L.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=fe.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*t.width+i.left,d=i.left;d<i.right;d++,u++){const f=t.map[u];if(o[f])continue;o[f]=!0;const h=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=i.left-h.left,g=h.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=cn(b,0,m)),g>0&&(b=cn(b,b.colspan-g,g)),h.left<i.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(h.top<i.top||h.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}s.push(e.child(a).copy(C.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new T(C.from(l),1,1)}replace(e,t=T.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?T.empty:t)}const o=V.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new T(C.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=fe.get(t),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(t.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new St(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=fe.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof St&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new St(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new St(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new St(e.resolve(t),e.resolve(r))}getBookmark(){return new g0(this.$anchorCell.pos,this.$headCell.pos)}};ae.prototype.visible=!1;V.jsonID("cell",ae);var g0=class Tu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Tu(e.map(this.anchor),e.map(this.head))}resolve(e){const 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&&cs(t,r)?new ae(t,r):V.near(r,1)}};function y0(n){if(!(n.selection instanceof ae))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push($e.node(r,r+t.nodeSize,{class:"selectedCell"}))}),ue.create(n.doc,e)}function b0({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function v0({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const o=n.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){t=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return t!==r&&e.parentOffset===0}function x0(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof z&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=ae.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=ae.rowSelection(l,l)}else if(!t){const l=fe.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=ae.create(i,a+1,c)}}else r instanceof L&&b0(r)?o=L.create(i,r.from):r instanceof L&&v0(r)&&(o=L.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var S0=new et("fix-tables");function Ou(n,e,t,r){const i=n.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,u=Math.min(i,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?Ou(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Du(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=w0(n,i,o,t))};return e?e.doc!=n.doc&&Ou(e.doc,n.doc,0,r):n.doc.descendants(r),t}function w0(n,e,t,r){const i=fe.get(e);if(!i.problems)return r;r||(r=n.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)o[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,cn(d,d.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const u=e.child(a),d=c+u.nodeSize,f=o[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const b=_e(n.schema)[h].createAndFill();b&&p.push(b)}const m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(S0,{fixTables:!0})}function gt(n){const e=n.selection,t=li(n),r=t.node(-1),i=t.start(-1),o=fe.get(r);return{...e instanceof ae?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function Au(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;m0(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,Mu(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?_e(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function k0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Au(n.tr,t,t.left))}return!0}function C0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Au(n.tr,t,t.right))}return!0}function E0(n,{map:e,table:t,tableStart:r},i){const o=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(o).map(r+a),null,cn(u,i-e.colCount(a)));else{const d=n.mapping.slice(o).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function N0(n,e){if(!ct(n))return!1;if(e){const t=gt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;E0(r,t,i),i!=t.left;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=fe.get(o)}e(r)}return!0}function M0(n,e,t){var r;const i=_e(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(((r=e.nodeAt(n.map[o+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function Ru(n,{map:e,tableStart:t,table:r},i){var o;let s=t;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const l=[];let a=i>0?-1:0;M0(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c<e.width;c++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=a==null?_e(r.type.schema).cell:(o=r.nodeAt(e.map[u+a*e.width]))==null?void 0:o.type,f=d==null?void 0:d.createAndFill();f&&l.push(f)}return n.insert(s,_e(r.type.schema).row.create(null,l)),n}function T0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Ru(n.tr,t,t.top))}return!0}function O0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Ru(n.tr,t,t.bottom))}return!0}function D0(n,{map:e,table:t,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=t.child(c).nodeSize;const s=o+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(o+r,s+r);const a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==e.map[u-e.width]){const f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const f=t.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function A0(n,e){if(!ct(n))return!1;if(e){const t=gt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;D0(r,t,i),i!=t.top;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=fe.get(t.table)}e(r)}return!0}function ea(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function R0({width:n,height:e,map:t},r){let i=r.top*n+r.left,o=i,s=(r.bottom-1)*n+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[o]==t[o-1]||r.right<n&&t[l]==t[l+1])return!0;o+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[s]==t[s+n])return!0;i++,s++}return!1}function ta(n,e){const t=n.selection;if(!(t instanceof ae)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=gt(n),{map:i}=r;if(R0(i,r))return!1;if(e){const o=n.tr,s={};let l=C.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=i.map[u*i.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{ea(h)||(l=l.append(h.content));const p=o.mapping.map(f+r.tableStart);o.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...Mu(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const u=a+1+c.content.size,d=ea(c)?a+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,l)}o.setSelection(new ae(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function na(n,e){const t=_e(n.schema);return P0(({node:r})=>t[r.type.spec.tableRole])(n,e)}function P0(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof ae){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=f0(i.$from),!o)return!1;s=(r=An(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=gt(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let m=u.left,g=0;m<u.right;m++,g++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),n({node:o,row:h,col:m}).createAndFill(a[g]))}d.setNodeMarkup(s,n({node:o,row:u.top,col:u.left}),a[0]),i instanceof ae&&d.setSelection(new ae(d.doc.resolve(i.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function I0(n,e){return function(t,r){if(!ct(t))return!1;const i=li(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof ae?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(o)}return!0}}function _0(n){return function(e,t){if(!ct(e))return!1;if(t){const r=_e(e.schema),i=gt(e),o=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length==0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);t(o)}return!0}}function ra(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 i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==t.header_cell)return!1}return!0}function Xn(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_0(n):function(t,r){if(!ct(t))return!1;if(r){const i=_e(t.schema),o=gt(t),s=t.tr,l=ra("row",o,i),a=ra("column",o,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?{bottom:o.map.height}:n=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(d).forEach(h=>{const p=h+o.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}Xn("row",{useDeprecatedLogic:!0});Xn("column",{useDeprecatedLogic:!0});var z0=Xn("cell",{useDeprecatedLogic:!0});function L0(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const o=n.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const o=t.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function ia(n){return function(e,t){if(!ct(e))return!1;const r=L0(li(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(L.between(i,p0(i))).scrollIntoView())}return!0}}function V0(n,e){const 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}function pr(n,e){const t=n.selection;if(!(t instanceof ae))return!1;if(e){const r=n.tr,i=_e(n.schema).cell.createAndFill().content;t.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new T(i,0,0))}),r.docChanged&&e(r)}return!0}function B0(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Oo(_e(s).row,new T(c,u,d)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?Oo(_e(s).row,new T(e,t,r)).content:e);else return null;return $0(s,l)}function $0(n,e){const t=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(C.empty),t[i]<r){const o=_e(n).cell.createAndFill(),s=[];for(let l=t[i];l<r;l++)s.push(o);e[i]=e[i].append(C.from(s))}return{height:e.length,width:r,rows:e}}function Oo(n,e){const t=n.createAndFill();return new sc(t).replace(0,t.content.size,e).doc}function j0({width:n,height:e,rows:t},r,i){if(n!=r){const o=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=o[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(cn(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++)o[l+h]=(o[l+h]||0)+f.attrs.colspan}s.push(C.from(c))}t=s,n=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}o.push(C.from(a))}t=o,e=i}return{width:n,height:e,rows:t}}function F0(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=_e(l);let c,u;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=t.child(d);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);n.insert(n.mapping.slice(s).map(f-1+r),p)}if(o>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const 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()))}const f=a.row.create(null,C.from(d)),h=[];for(let p=e.height;p<o;p++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||u)}function oa(n,e,t,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=t.nodeAt(d),{top:h,left:p}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function sa(n,e,t,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=t.nodeAt(d),h=e.colCount(d),p=n.mapping.slice(l).map(d+r);n.setNodeMarkup(p,null,cn(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(p+f.nodeSize,f.type.createAndFill(cn(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function la(n,e,t,r,i){let o=t?n.doc.nodeAt(t-1):n.doc;if(!o)throw new Error("No table found");let s=fe.get(o);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,d=n.tr;let f=0;function h(){if(o=t?d.doc.nodeAt(t-1):d.doc,!o)throw new Error("No table found");s=fe.get(o),f=d.mapping.maps.length}F0(d,s,o,t,c,u,f)&&h(),oa(d,s,o,t,a,c,l,f)&&h(),oa(d,s,o,t,a,c,u,f)&&h(),sa(d,s,o,t,l,u,a,f)&&h(),sa(d,s,o,t,l,u,c,f)&&h();for(let p=l;p<u;p++){const m=s.positionAt(p,a,o),g=s.positionAt(p,c,o);d.replace(d.mapping.slice(f).map(m+t),d.mapping.slice(f).map(g+t),new T(i.rows[p-l],0,0))}h(),d.setSelection(new ae(d.doc.resolve(t+s.positionAt(l,a,o)),d.doc.resolve(t+s.positionAt(u-1,c-1,o)))),e(d)}var H0=Yo({ArrowLeft:mr("horiz",-1),ArrowRight:mr("horiz",1),ArrowUp:mr("vert",-1),ArrowDown:mr("vert",1),"Shift-ArrowLeft":gr("horiz",-1),"Shift-ArrowRight":gr("horiz",1),"Shift-ArrowUp":gr("vert",-1),"Shift-ArrowDown":gr("vert",1),Backspace:pr,"Mod-Backspace":pr,Delete:pr,"Mod-Delete":pr});function Cr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function mr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof ae)return Cr(t,r,V.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Pu(i,n,e);if(s==null)return!1;if(n=="horiz")return Cr(t,r,V.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=Nu(l,n,e);let c;return a?c=V.near(a,1):e<0?c=V.near(t.doc.resolve(l.before(-1)),-1):c=V.near(t.doc.resolve(l.after(-1)),1),Cr(t,r,c)}}}function gr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof ae)s=o;else{const a=Pu(i,n,e);if(a==null)return!1;s=new ae(t.doc.resolve(a))}const l=Nu(s.$headCell,n,e);return l?Cr(t,r,new ae(s.$anchorCell,l)):!1}}function W0(n,e){const t=n.state.doc,r=An(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ae(r))),!0):!1}function q0(n,e,t){if(!ct(n.state))return!1;let r=B0(t);const i=n.state.selection;if(i instanceof ae){r||(r={width:1,height:1,rows:[C.from(Oo(_e(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=fe.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=j0(r,l.right-l.left,l.bottom-l.top),la(n.state,n.dispatch,s,l,r),!0}else if(r){const o=li(n.state),s=o.start(-1);return la(n.state,n.dispatch,s,fe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function U0(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=aa(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof ae)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=An(n.state.selection.$anchor))!=null&&((t=qi(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=qi(n,c);const d=Rt.getState(n.state)==null;if(!u||!cs(a,u))if(d)u=a;else return;const f=new ae(a,u);if(d||!n.state.selection.eq(f)){const h=n.state.tr.setSelection(f);d&&h.setMeta(Rt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Rt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Rt,-1))}function l(a){const c=a,u=Rt.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(aa(n,c.target)!=r&&(d=qi(n,e),!d))return s();d&&o(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Pu(n,e,t){if(!(n.state.selection instanceof L))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function aa(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function qi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?An(n.state.doc.resolve(t.pos)):null}var K0=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Do(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,Do(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Do(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m++,f++){const g=i==f?o:p&&p[m],b=g?g+"px":"";if(l+=g||r,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=b,e.appendChild(x)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=d}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Ge=new et("tableColumnResizing");function J0({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=K0,lastColumnResizable:i=!0}={}){const o=new Le({key:Ge,state:{init(s,l){var a,c;const u=(c=(a=o.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=_e(l.schema).table.name;return r&&u&&(u[d]=(f,h)=>new r(f,t,h)),new Y0(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Ge.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{G0(s,l,n,i)},mouseleave:s=>{X0(s)},mousedown:(s,l)=>{Z0(s,l,e,t)}},decorations:s=>{const l=Ge.getState(s);if(l&&l.activeHandle>-1)return r1(s,l.activeHandle)},nodeViews:{}}});return o}var Y0=class Er{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ge);if(r&&r.setHandle!=null)return new Er(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Er(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return To(e.doc.resolve(i))||(i=-1),new Er(i,t.dragging)}return t}};function G0(n,e,t,r){const i=Ge.getState(n.state);if(i&&!i.dragging){const o=e1(e.target);let s=-1;if(o){const{left:l,right:a}=o.getBoundingClientRect();e.clientX-l<=t?s=ca(n,e,"left",t):a-e.clientX<=t&&(s=ca(n,e,"right",t))}if(s!=i.activeHandle){if(!r&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=fe.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Iu(n,s)}}}function X0(n){const e=Ge.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Iu(n,-1)}function Z0(n,e,t,r){var i;const o=(i=n.dom.ownerDocument.defaultView)!=null?i:window,s=Ge.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=Q0(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Ge,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const f=Ge.getState(n.state);f!=null&&f.dragging&&(t1(n,f.activeHandle,ua(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Ge,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ge.getState(n.state);if(f&&f.dragging){const h=ua(f.dragging,d,t);da(n,f.activeHandle,h,r)}}return da(n,s.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function Q0(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=n.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function e1(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function ca(n,e,t,r){const i=t=="right"?-r:r,o=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=An(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=fe.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function ua(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Iu(n,e){n.dispatch(n.state.tr.setMeta(Ge,{setHandle:e}))}function t1(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=fe.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<o.height;c++){const u=c*o.width+l;if(c&&o.map[u]==o.map[u-o.width])continue;const d=o.map[u],f=i.nodeAt(d).attrs,h=f.colspan==1?0:l-o.colCount(d);if(f.colwidth&&f.colwidth[h]==t)continue;const p=f.colwidth?f.colwidth.slice():n1(f.colspan);p[h]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function da(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=fe.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Do(o,a.firstChild,a,r,l,t)}function n1(n){return Array(n).fill(0)}function r1(n,e){var t;const r=[],i=n.doc.resolve(e),o=i.node(-1);if(!o)return ue.empty;const s=fe.get(o),l=i.start(-1),a=s.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const d=s.map[u],f=l+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=Ge.getState(n))!=null&&t.dragging&&r.push($e.node(l+d,l+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push($e.widget(f,h))}}return ue.create(n.doc,r)}function i1({allowTableNodeSelection:n=!1}={}){return new Le({key:Rt,state:{init(){return null},apply(e,t){const r=e.getMeta(Rt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:o}=e.mapping.mapResult(t);return i?null:o}},props:{decorations:y0,handleDOMEvents:{mousedown:U0},createSelectionBetween(e){return Rt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:W0,handleKeyDown:H0,handlePaste:q0},appendTransaction(e,t,r){return x0(r,Du(r,t),n)}})}function Ao(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function fa(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=i===f?o:p&&p[m],b=g?`${g}px`:"";if(l+=g||r,g||(a=!1),c){if(c.style.width!==b){const[x,S]=Ao(r,g);c.style.setProperty(x,S)}c=c.nextSibling}else{const x=document.createElement("col"),[S,k]=Ao(r,g);x.style.setProperty(S,k),e.appendChild(x)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)===null||s===void 0||s.removeChild(c),c=d}a?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}class o1{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")),fa(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,fa(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function s1(n,e,t,r){let i=0,o=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=t===f?r:p&&p[m];i+=g||e,g||(o=!1);const[b,x]=Ao(e,g);s.push(["col",{style:`${b}: ${x}`}])}}const a=o?`${i}px`:"",c=o?"":`${i}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function ha(n,e){return n.createAndFill()}function l1(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 a1(n,e,t,r,i){const o=l1(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=ha(o.cell);if(u&&l.push(u),r){const d=ha(o.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(o.row.createChecked(null,r&&c===0?s:l));return o.table.createChecked(null,a)}function c1(n){return n instanceof ae}const yr=({editor:n})=>{const{selection:e}=n.state;if(!c1(e))return!1;let t=0;const r=hu(e.ranges[0].$from,o=>o.type.name==="table");return r==null||r.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},u1=ce.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:o1,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:i}=s1(n,this.options.cellMinWidth);return["table",ie(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const s=a1(o.schema,n,e,t);if(i){const l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(L.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>k0(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>C0(n,e),deleteColumn:()=>({state:n,dispatch:e})=>N0(n,e),addRowBefore:()=>({state:n,dispatch:e})=>T0(n,e),addRowAfter:()=>({state:n,dispatch:e})=>O0(n,e),deleteRow:()=>({state:n,dispatch:e})=>A0(n,e),deleteTable:()=>({state:n,dispatch:e})=>V0(n,e),mergeCells:()=>({state:n,dispatch:e})=>ta(n,e),splitCell:()=>({state:n,dispatch:e})=>na(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Xn("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Xn("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>z0(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>ta(n,e)?!0:na(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>I0(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>ia(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>ia(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Du(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ae.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:yr,"Mod-Backspace":yr,Delete:yr,"Mod-Delete":yr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[J0({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],i1({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:q(P(n,"tableRole",e))}}}),d1=ce.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",ie(this.options.HTMLAttributes,n),0]}}),f1=ce.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?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",ie(this.options.HTMLAttributes,n),0]}}),h1=ce.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?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",ie(this.options.HTMLAttributes,n),0]}}),_u=({title:n,childrenContent:e,editable:t,childrenEdit:r})=>{const[i,o]=I.useState(!1),s=t?w.jsxDEV(ft.Menu,{children:w.jsxDEV(ft.Menu.Item,{onClick:()=>o(!0),children:"Edit"},"edit",!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:19,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:18,columnNumber:9},void 0):null;return w.jsxDEV("div",{children:[t&&s?w.jsxDEV(ft.Dropdown,{overlay:s,trigger:["contextMenu"],children:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:28,columnNumber:17},void 0):e,w.jsxDEV(ft.Modal,{title:`Edit ${n}`,open:i,onOk:()=>o(!1),onCancel:()=>o(!1),children:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:35,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:26,columnNumber:9},void 0)},p1=({node:n,editor:e})=>{const[t,r]=I.useState(!1),[i,o]=I.useState(n.attrs.bgColor||"#f3f4f6"),[s,l]=I.useState(n.attrs.titleColor||"#000000"),a=d=>{d.preventDefault()},c=d=>{o(d.toHexString())},u=d=>{l(d.toHexString())};return w.jsxDEV(bu,{className:"accordion-wrapper",children:w.jsxDEV(_u,{title:"Accordion",childrenContent:w.jsxDEV("div",{className:"my-4 transition-all duration-300 border rounded-lg shadow-sm",onContextMenu:a,children:[w.jsxDEV("div",{className:"flex items-center justify-between p-4 transition-colors accordion-header",style:{backgroundColor:i},onClick:()=>r(!t),children:[w.jsxDEV("input",{className:"w-full text-lg font-medium bg-transparent border-none outline-none",style:{color:s},defaultValue:n.attrs.title||"Accordion Title",disabled:!e.isEditable,suppressContentEditableWarning:!0,contentEditable:!0,placeholder:"Accordion title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:38,columnNumber:29},void 0),w.jsxDEV(Yg,{className:`transition-transform duration-300 ${t?"rotate-180":""}`,size:20},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:47,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:33,columnNumber:25},void 0),w.jsxDEV("div",{className:`overflow-hidden duration-300 ease-in-out ${t?"max-h-96 opacity-100":"max-h-0 opacity-0"} `,children:w.jsxDEV("div",{className:"p-4 border-t",children:w.jsxDEV(Dg,{contentEditable:e.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:57,columnNumber:33},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:56,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:53,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:29,columnNumber:21},void 0),editable:e.isEditable,childrenEdit:w.jsxDEV("div",{className:"px-6 py-4 space-y-6 rounded-lg bg-gray-50",children:[w.jsxDEV("div",{className:"grid grid-cols-1 gap-6",children:[w.jsxDEV("div",{className:"flex flex-col space-y-2",children:[w.jsxDEV("label",{className:"font-medium text-gray-700",children:"Background Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:69,columnNumber:33},void 0),w.jsxDEV("div",{className:"flex items-center space-x-3",children:[w.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:i}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:71,columnNumber:37},void 0),w.jsxDEV(Fr,{value:i,onChange:c},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:75,columnNumber:37},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:70,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:68,columnNumber:29},void 0),w.jsxDEV("div",{className:"flex flex-col space-y-2",children:[w.jsxDEV("label",{className:"font-medium text-gray-700",children:"Title Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:80,columnNumber:33},void 0),w.jsxDEV("div",{className:"flex items-center space-x-3",children:[w.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:s}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:82,columnNumber:37},void 0),w.jsxDEV(Fr,{value:s,onChange:u},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:86,columnNumber:37},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:81,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:79,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:67,columnNumber:25},void 0),w.jsxDEV("div",{className:"pt-4 border-t border-gray-200",children:w.jsxDEV("div",{className:"p-3 bg-white border rounded-md",children:[w.jsxDEV("div",{className:"text-sm text-gray-600",children:"Preview"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:93,columnNumber:33},void 0),w.jsxDEV("div",{className:"p-2 mt-2 rounded",style:{backgroundColor:i},children:w.jsxDEV("span",{style:{color:s,fontWeight:500},children:"Accordion Title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:95,columnNumber:37},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:94,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:92,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:91,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:66,columnNumber:21},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:26,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:25,columnNumber:9},void 0)},m1=ce.create({name:"accordion",group:"block",content:"block+",atom:!1,draggable:!0,selectable:!0,inline:!1,defining:!0,addAttributes(){return{title:{default:"Accordion Title"},bgColor:{default:"#f3f4f6"},titleColor:{default:"#000000"}}},parseHTML(){return[{tag:"accordion"}]},renderHTML({HTMLAttributes:n}){return["accordion",ie(n)]},addNodeView(){return vu(p1)},addCommands(){return{setAccordion:n=>({chain:e})=>e().insertContent({type:"accordion",attrs:n,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}}),g1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,y1=ce.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",ie(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[mu({find:g1,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var us={exports:{}},tr={},ai={exports:{}},zu={},Ro={exports:{}},br={exports:{}},ne={};/** @license React v16.13.1
341
+ `);return!o||!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:i,empty:o}=t;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(B.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[wo({find:pb,type:this.type,getAttributes:n=>({language:n[1]})}),wo({find:mb,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ze({key:new et("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"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!t||!o)return!1;const{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
342
+ `));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(z.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),yb=ce.create({name:"doc",topNode:!0,content:"block+"});function bb(n={}){return new ze({view(e){return new vb(e,n)}})}class vb{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(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}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 i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"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),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=nc(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 Sb=Ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[bb(this.options)]}});class de extends B{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return de.valid(r)?new de(r):B.near(r)}content(){return O.empty}eq(e){return e instanceof de&&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 de(e.resolve(t.pos))}getBookmark(){return new as(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!xb(e)||!wb(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(de.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!L.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;B.jsonID("gapcursor",de);class as{constructor(e){this.pos=e}map(e){return new as(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return de.valid(t)?new de(t):B.near(t)}}function xb(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 i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function wb(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 i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function kb(){return new ze({props:{decorations:Eb,createSelectionBetween(n,e,t){return e.pos==t.pos&&de.valid(t)?new de(t):null},handleClick:Mb,handleKeyDown:Cb,handleDOMEvents:{beforeinput:Tb}}})}const Cb=Yo({ArrowLeft:hr("horiz",-1),ArrowRight:hr("horiz",1),ArrowUp:hr("vert",-1),ArrowDown:hr("vert",1)});function hr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof z){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new de(c))),!0):!1}}function Mb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!de.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&L.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new de(r))),!0)}function Tb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof de))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 i=C.empty;for(let s=r.length-1;s>=0;s--)i=C.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new O(i,0,0));return o.setSelection(z.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Eb(n){if(!(n.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ue.create(n.doc,[je.widget(n.selection.head,e,{key:"gapcursor"})])}const Ob=Ne.create({name:"gapCursor",addProseMirrorPlugins(){return[kb()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=q(P(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Ab=ce.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ie(this.options.HTMLAttributes,n)]},renderText(){return`
343
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:o}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=o||i.$to.parentOffset&&i.$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()}}}),Nb=ce.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]}`,ie(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=>wo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Vr=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<Vr&&this.leafAppend(e)||this.length<Vr&&e.leafPrepend(this)||this.appendInner(e)):this};ke.prototype.prepend=function(e){return e.length?ke.from(e).append(this):this};ke.prototype.appendInner=function(e){return new Rb(this,e)};ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ke.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)};ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};ke.from=function(e){return e instanceof ke?e:e&&e.length?new ku(e):ke.empty};var ku=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(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Vr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Vr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ke);ke.empty=new ku([]);var Rb=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,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ke);const Db=500;class lt{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 i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new dt(d.map));let h=d.step.map(i.slice(o)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+u.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(o)):d.selection,a=new lt(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,i){let o=[],s=this.eventCount,l=this.items,a=!i&&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 dt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(s++,t=void 0),i||(a=f)}let c=s-r.depth;return c>Ib&&(l=Pb(l,c),s-=c),new lt(l.append(o),s)}remapping(e,t){let r=new wn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new lt(this.items.append(e.map(t=>new dt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=o.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(o.slice(a+1,h));g&&l++,r.push(new dt(p,m,g))}else r.push(new dt(p))},i);let c=[];for(let f=t;f<s;f++)c.push(new dt(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new lt(u,l);return d.emptyItemCount()>Db&&(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,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;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&&o++;let d=new dt(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new lt(ke.from(i.reverse()),o)}}lt.empty=new lt(ke.empty,0);function Pb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class dt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new dt(t.getMap().invert(),t,this.selection)}}}class Nt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Ib=20;function _b(n,e,t,r){let i=t.getMeta(nn),o;if(i)return i.historyState;t.getMeta(Bb)&&(n=new Nt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(nn))return s.getMeta(nn).redo?new Nt(n.done.addTransform(t,void 0,r,kr(e)),n.undone,Xl(t.mapping.maps),n.prevTime,n.prevComposition):new Nt(n.done,n.undone.addTransform(t,void 0,r,kr(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||!Lb(t,n.prevRanges)),c=s?Vi(n.prevRanges,t.mapping):Xl(t.mapping.maps);return new Nt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,kr(e)),lt.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new Nt(n.done.rebased(t,o),n.undone.rebased(t,o),Vi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Nt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Vi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Lb(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Xl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Vi(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function zb(n,e,t){let r=kr(e),i=nn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new Nt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(nn,{redo:t,historyState:a})}let Wi=!1,Zl=null;function kr(n){let e=n.plugins;if(Zl!=e){Wi=!1,Zl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Wi=!0;break}}return Wi}const nn=new et("history"),Bb=new et("closeHistory");function $b(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ze({key:nn,state:{init(){return new Nt(lt.empty,lt.empty,null,0,-1)},apply(e,t,r){return _b(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Mu:r=="historyRedo"?Tu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Cu(n,e){return(t,r)=>{let i=nn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=zb(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Mu=Cu(!1,!0),Tu=Cu(!0,!0),jb=Ne.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Mu(n,e),redo:()=>({state:n,dispatch:e})=>Tu(n,e)}},addProseMirrorPlugins(){return[$b(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()}}}),Fb=ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ie(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{selection:t}=e,{$from:r,$to:i}=t,o=n();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):_m(t)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(z.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(L.create(s.doc,c.pos)):s.setSelection(z.create(s.doc,c.pos));else{const d=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();d&&(s.insert(u,d),s.setSelection(z.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[gu({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Hb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Vb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Wb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,qb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ub=Qe.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ie(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[ln({find:Hb,type:this.type}),ln({find:Wb,type:this.type})]},addPasteRules(){return[an({find:Vb,type:this.type}),an({find:qb,type:this.type})]}}),Kb="listItem",Ql="textStyle",ea=/^(\d+)\.\s$/,Jb=ce.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},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ie(this.options.HTMLAttributes,t),0]:["ol",ie(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(Kb,this.editor.getAttributes(Ql)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=An({find:ea,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=An({find:ea,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ql)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Yb=ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Gb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Xb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Zb=Qe.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",ie(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[ln({find:Gb,type:this.type})]},addPasteRules(){return[an({find:Xb,type:this.type})]}}),Qb=ce.create({name:"text",group:"inline"}),e0=Ne.create({name:"starterKit",addExtensions(){var n,e,t,r,i,o,s,l,a,c,u,d,f,h,p,m,g,b;const S=[];return this.options.bold!==!1&&S.push(ab.configure((n=this.options)===null||n===void 0?void 0:n.bold)),this.options.blockquote!==!1&&S.push(rb.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&S.push(ub.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&S.push(hb.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&S.push(gb.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&S.push(yb.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&S.push(Sb.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&S.push(Ob.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&S.push(Ab.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&S.push(Nb.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&S.push(jb.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&S.push(Fb.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&S.push(Ub.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&S.push(wu.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&S.push(Jb.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&S.push(Yb.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&S.push(Zb.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&S.push(Qb.configure((b=this.options)===null||b===void 0?void 0:b.text)),S}}),t0=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,n0=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,r0=Qe.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",ie(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[ln({find:t0,type:this.type})]},addPasteRules(){return[an({find:n0,type:this.type})]}}),i0=Qe.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",ie(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()}}}),o0=Qe.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),s0=Qe.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),l0=Ne.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{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")}}}),a0=ce.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",ie(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()}}}),c0=/^\s*(\[([( |x])?\])\s$/,u0=ce.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=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ie(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 i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");return o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",c=>c.preventDefault()),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();if(typeof f!="number")return!1;const 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])=>{i.setAttribute(c,u)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(e).forEach(([c,u])=>{i.setAttribute(c,u)}),{dom:i,contentDOM:a,update:c=>c.type!==this.type?!1:(i.dataset.checked=c.attrs.checked,l.checked=c.attrs.checked,!0)}}},addInputRules(){return[An({find:c0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}});var To,Eo;if(typeof WeakMap<"u"){let n=new WeakMap;To=e=>n.get(e),Eo=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;To=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Eo=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var fe=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==t;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:o,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[o*this.width+(t<0?r-1:i)]:(t<0?o==0:s==this.height)?null:this.map[r+this.width*(t<0?o-1:s)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:o}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const o=r*this.width+i,s=this.map[o];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[o-1]==s||r==n.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const o=i+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(n){return To(n)||Eo(n,d0(n))}};function d0(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=f0(n),t=n.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const d=n.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:S}=m.attrs;for(let x=0;x<b;x++){if(x+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:b-x});break}const k=i+x*e;for(let v=0;v<g;v++){r[k+v]==0?r[k+v]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:g-v});const T=S&&S[v];if(T){const A=(k+v)%e*2,$=s[A];$==null||$!=T&&s[A+1]==1?(s[A]=T,s[A+1]=1):$==T&&s[A+1]++}}}i+=g,u+=m.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(o||(o=[])).push({type:"missing",row:c,n:h}),u++}const l=new fe(e,t,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&h0(l,s,n),l}function f0(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let o=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function h0(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const o=n.map[i];if(r[o])continue;r[o]=!0;const s=t.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=(i+c)%n.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=p0(a)))[c]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function p0(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function _e(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var Dt=new et("selectingCells");function Rn(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 m0(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 ct(n){const 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 li(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Rn(e.$head)||g0(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function g0(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const 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--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Oo(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function y0(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function cs(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Eu(n,e,t){const r=n.node(-1),i=fe.get(r),o=n.start(-1),s=i.nextCell(n.pos-o,e,t);return s==null?null:n.node(0).resolve(o+s)}function cn(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Ou(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function b0(n,e,t){const r=_e(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var ae=class xt extends B{constructor(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,t.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(u=>u!=t.pos-o);a.unshift(t.pos-o);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=o+u+1;return new ac(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){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Oo(r)&&Oo(i)&&cs(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?xt.rowSelection(r,i):o&&this.isColSelection()?xt.colSelection(r,i):new xt(r,i)}return z.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=fe.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*t.width+i.left,d=i.left;d<i.right;d++,u++){const f=t.map[u];if(o[f])continue;o[f]=!0;const h=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=i.left-h.left,g=h.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=cn(b,0,m)),g>0&&(b=cn(b,b.colspan-g,g)),h.left<i.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(h.top<i.top||h.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}s.push(e.child(a).copy(C.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new O(C.from(l),1,1)}replace(e,t=O.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?O.empty:t)}const o=B.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new O(C.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=fe.get(t),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(t.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new xt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=fe.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof xt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new xt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new xt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new xt(e.resolve(t),e.resolve(r))}getBookmark(){return new v0(this.$anchorCell.pos,this.$headCell.pos)}};ae.prototype.visible=!1;B.jsonID("cell",ae);var v0=class Au{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Au(e.map(this.anchor),e.map(this.head))}resolve(e){const 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&&cs(t,r)?new ae(t,r):B.near(r,1)}};function S0(n){if(!(n.selection instanceof ae))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(je.node(r,r+t.nodeSize,{class:"selectedCell"}))}),ue.create(n.doc,e)}function x0({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function w0({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const o=n.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){t=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return t!==r&&e.parentOffset===0}function k0(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof L&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=ae.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=ae.rowSelection(l,l)}else if(!t){const l=fe.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=ae.create(i,a+1,c)}}else r instanceof z&&x0(r)?o=z.create(i,r.from):r instanceof z&&w0(r)&&(o=z.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var C0=new et("fix-tables");function Nu(n,e,t,r){const i=n.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,u=Math.min(i,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?Nu(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Ru(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=M0(n,i,o,t))};return e?e.doc!=n.doc&&Nu(e.doc,n.doc,0,r):n.doc.descendants(r),t}function M0(n,e,t,r){const i=fe.get(e);if(!i.problems)return r;r||(r=n.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)o[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,cn(d,d.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const u=e.child(a),d=c+u.nodeSize,f=o[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const b=_e(n.schema)[h].createAndFill();b&&p.push(b)}const m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(C0,{fixTables:!0})}function gt(n){const e=n.selection,t=li(n),r=t.node(-1),i=t.start(-1),o=fe.get(r);return{...e instanceof ae?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function Du(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;b0(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,Ou(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?_e(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function T0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Du(n.tr,t,t.left))}return!0}function E0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Du(n.tr,t,t.right))}return!0}function O0(n,{map:e,table:t,tableStart:r},i){const o=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(o).map(r+a),null,cn(u,i-e.colCount(a)));else{const d=n.mapping.slice(o).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function A0(n,e){if(!ct(n))return!1;if(e){const t=gt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;O0(r,t,i),i!=t.left;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=fe.get(o)}e(r)}return!0}function N0(n,e,t){var r;const i=_e(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(((r=e.nodeAt(n.map[o+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function Pu(n,{map:e,tableStart:t,table:r},i){var o;let s=t;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const l=[];let a=i>0?-1:0;N0(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c<e.width;c++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=a==null?_e(r.type.schema).cell:(o=r.nodeAt(e.map[u+a*e.width]))==null?void 0:o.type,f=d==null?void 0:d.createAndFill();f&&l.push(f)}return n.insert(s,_e(r.type.schema).row.create(null,l)),n}function R0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Pu(n.tr,t,t.top))}return!0}function D0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Pu(n.tr,t,t.bottom))}return!0}function P0(n,{map:e,table:t,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=t.child(c).nodeSize;const s=o+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(o+r,s+r);const a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==e.map[u-e.width]){const f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const f=t.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function I0(n,e){if(!ct(n))return!1;if(e){const t=gt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;P0(r,t,i),i!=t.top;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=fe.get(t.table)}e(r)}return!0}function ta(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function _0({width:n,height:e,map:t},r){let i=r.top*n+r.left,o=i,s=(r.bottom-1)*n+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[o]==t[o-1]||r.right<n&&t[l]==t[l+1])return!0;o+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[s]==t[s+n])return!0;i++,s++}return!1}function na(n,e){const t=n.selection;if(!(t instanceof ae)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=gt(n),{map:i}=r;if(_0(i,r))return!1;if(e){const o=n.tr,s={};let l=C.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=i.map[u*i.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{ta(h)||(l=l.append(h.content));const p=o.mapping.map(f+r.tableStart);o.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...Ou(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const u=a+1+c.content.size,d=ta(c)?a+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,l)}o.setSelection(new ae(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function ra(n,e){const t=_e(n.schema);return L0(({node:r})=>t[r.type.spec.tableRole])(n,e)}function L0(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof ae){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=m0(i.$from),!o)return!1;s=(r=Rn(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=gt(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let m=u.left,g=0;m<u.right;m++,g++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),n({node:o,row:h,col:m}).createAndFill(a[g]))}d.setNodeMarkup(s,n({node:o,row:u.top,col:u.left}),a[0]),i instanceof ae&&d.setSelection(new ae(d.doc.resolve(i.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function z0(n,e){return function(t,r){if(!ct(t))return!1;const i=li(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof ae?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(o)}return!0}}function B0(n){return function(e,t){if(!ct(e))return!1;if(t){const r=_e(e.schema),i=gt(e),o=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length==0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);t(o)}return!0}}function ia(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 i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==t.header_cell)return!1}return!0}function Qn(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?B0(n):function(t,r){if(!ct(t))return!1;if(r){const i=_e(t.schema),o=gt(t),s=t.tr,l=ia("row",o,i),a=ia("column",o,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?{bottom:o.map.height}:n=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(d).forEach(h=>{const p=h+o.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}Qn("row",{useDeprecatedLogic:!0});Qn("column",{useDeprecatedLogic:!0});var $0=Qn("cell",{useDeprecatedLogic:!0});function j0(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const o=n.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const o=t.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function oa(n){return function(e,t){if(!ct(e))return!1;const r=j0(li(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(z.between(i,y0(i))).scrollIntoView())}return!0}}function F0(n,e){const 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}function pr(n,e){const t=n.selection;if(!(t instanceof ae))return!1;if(e){const r=n.tr,i=_e(n.schema).cell.createAndFill().content;t.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new O(i,0,0))}),r.docChanged&&e(r)}return!0}function H0(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Ao(_e(s).row,new O(c,u,d)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?Ao(_e(s).row,new O(e,t,r)).content:e);else return null;return V0(s,l)}function V0(n,e){const t=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(C.empty),t[i]<r){const o=_e(n).cell.createAndFill(),s=[];for(let l=t[i];l<r;l++)s.push(o);e[i]=e[i].append(C.from(s))}return{height:e.length,width:r,rows:e}}function Ao(n,e){const t=n.createAndFill();return new lc(t).replace(0,t.content.size,e).doc}function W0({width:n,height:e,rows:t},r,i){if(n!=r){const o=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=o[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(cn(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++)o[l+h]=(o[l+h]||0)+f.attrs.colspan}s.push(C.from(c))}t=s,n=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}o.push(C.from(a))}t=o,e=i}return{width:n,height:e,rows:t}}function q0(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=_e(l);let c,u;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=t.child(d);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);n.insert(n.mapping.slice(s).map(f-1+r),p)}if(o>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const 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()))}const f=a.row.create(null,C.from(d)),h=[];for(let p=e.height;p<o;p++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||u)}function sa(n,e,t,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=t.nodeAt(d),{top:h,left:p}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function la(n,e,t,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=t.nodeAt(d),h=e.colCount(d),p=n.mapping.slice(l).map(d+r);n.setNodeMarkup(p,null,cn(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(p+f.nodeSize,f.type.createAndFill(cn(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function aa(n,e,t,r,i){let o=t?n.doc.nodeAt(t-1):n.doc;if(!o)throw new Error("No table found");let s=fe.get(o);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,d=n.tr;let f=0;function h(){if(o=t?d.doc.nodeAt(t-1):d.doc,!o)throw new Error("No table found");s=fe.get(o),f=d.mapping.maps.length}q0(d,s,o,t,c,u,f)&&h(),sa(d,s,o,t,a,c,l,f)&&h(),sa(d,s,o,t,a,c,u,f)&&h(),la(d,s,o,t,l,u,a,f)&&h(),la(d,s,o,t,l,u,c,f)&&h();for(let p=l;p<u;p++){const m=s.positionAt(p,a,o),g=s.positionAt(p,c,o);d.replace(d.mapping.slice(f).map(m+t),d.mapping.slice(f).map(g+t),new O(i.rows[p-l],0,0))}h(),d.setSelection(new ae(d.doc.resolve(t+s.positionAt(l,a,o)),d.doc.resolve(t+s.positionAt(u-1,c-1,o)))),e(d)}var U0=Yo({ArrowLeft:mr("horiz",-1),ArrowRight:mr("horiz",1),ArrowUp:mr("vert",-1),ArrowDown:mr("vert",1),"Shift-ArrowLeft":gr("horiz",-1),"Shift-ArrowRight":gr("horiz",1),"Shift-ArrowUp":gr("vert",-1),"Shift-ArrowDown":gr("vert",1),Backspace:pr,"Mod-Backspace":pr,Delete:pr,"Mod-Delete":pr});function Cr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function mr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof ae)return Cr(t,r,B.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Iu(i,n,e);if(s==null)return!1;if(n=="horiz")return Cr(t,r,B.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=Eu(l,n,e);let c;return a?c=B.near(a,1):e<0?c=B.near(t.doc.resolve(l.before(-1)),-1):c=B.near(t.doc.resolve(l.after(-1)),1),Cr(t,r,c)}}}function gr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof ae)s=o;else{const a=Iu(i,n,e);if(a==null)return!1;s=new ae(t.doc.resolve(a))}const l=Eu(s.$headCell,n,e);return l?Cr(t,r,new ae(s.$anchorCell,l)):!1}}function K0(n,e){const t=n.state.doc,r=Rn(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ae(r))),!0):!1}function J0(n,e,t){if(!ct(n.state))return!1;let r=H0(t);const i=n.state.selection;if(i instanceof ae){r||(r={width:1,height:1,rows:[C.from(Ao(_e(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=fe.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=W0(r,l.right-l.left,l.bottom-l.top),aa(n.state,n.dispatch,s,l,r),!0}else if(r){const o=li(n.state),s=o.start(-1);return aa(n.state,n.dispatch,s,fe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function Y0(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=ca(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof ae)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Rn(n.state.selection.$anchor))!=null&&((t=qi(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=qi(n,c);const d=Dt.getState(n.state)==null;if(!u||!cs(a,u))if(d)u=a;else return;const f=new ae(a,u);if(d||!n.state.selection.eq(f)){const h=n.state.tr.setSelection(f);d&&h.setMeta(Dt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Dt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Dt,-1))}function l(a){const c=a,u=Dt.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(ca(n,c.target)!=r&&(d=qi(n,e),!d))return s();d&&o(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Iu(n,e,t){if(!(n.state.selection instanceof z))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function ca(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function qi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Rn(n.state.doc.resolve(t.pos)):null}var G0=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),No(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,No(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function No(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m++,f++){const g=i==f?o:p&&p[m],b=g?g+"px":"";if(l+=g||r,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const S=document.createElement("col");S.style.width=b,e.appendChild(S)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=d}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Ge=new et("tableColumnResizing");function X0({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=G0,lastColumnResizable:i=!0}={}){const o=new ze({key:Ge,state:{init(s,l){var a,c;const u=(c=(a=o.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=_e(l.schema).table.name;return r&&u&&(u[d]=(f,h)=>new r(f,t,h)),new Z0(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Ge.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{Q0(s,l,n,i)},mouseleave:s=>{e1(s)},mousedown:(s,l)=>{t1(s,l,e,t)}},decorations:s=>{const l=Ge.getState(s);if(l&&l.activeHandle>-1)return s1(s,l.activeHandle)},nodeViews:{}}});return o}var Z0=class Mr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ge);if(r&&r.setHandle!=null)return new Mr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Mr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Oo(e.doc.resolve(i))||(i=-1),new Mr(i,t.dragging)}return t}};function Q0(n,e,t,r){const i=Ge.getState(n.state);if(i&&!i.dragging){const o=r1(e.target);let s=-1;if(o){const{left:l,right:a}=o.getBoundingClientRect();e.clientX-l<=t?s=ua(n,e,"left",t):a-e.clientX<=t&&(s=ua(n,e,"right",t))}if(s!=i.activeHandle){if(!r&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=fe.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}_u(n,s)}}}function e1(n){const e=Ge.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&_u(n,-1)}function t1(n,e,t,r){var i;const o=(i=n.dom.ownerDocument.defaultView)!=null?i:window,s=Ge.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=n1(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Ge,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const f=Ge.getState(n.state);f!=null&&f.dragging&&(i1(n,f.activeHandle,da(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Ge,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ge.getState(n.state);if(f&&f.dragging){const h=da(f.dragging,d,t);fa(n,f.activeHandle,h,r)}}return fa(n,s.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function n1(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=n.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function r1(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function ua(n,e,t,r){const i=t=="right"?-r:r,o=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=Rn(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=fe.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function da(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function _u(n,e){n.dispatch(n.state.tr.setMeta(Ge,{setHandle:e}))}function i1(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=fe.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<o.height;c++){const u=c*o.width+l;if(c&&o.map[u]==o.map[u-o.width])continue;const d=o.map[u],f=i.nodeAt(d).attrs,h=f.colspan==1?0:l-o.colCount(d);if(f.colwidth&&f.colwidth[h]==t)continue;const p=f.colwidth?f.colwidth.slice():o1(f.colspan);p[h]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function fa(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=fe.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&No(o,a.firstChild,a,r,l,t)}function o1(n){return Array(n).fill(0)}function s1(n,e){var t;const r=[],i=n.doc.resolve(e),o=i.node(-1);if(!o)return ue.empty;const s=fe.get(o),l=i.start(-1),a=s.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const d=s.map[u],f=l+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=Ge.getState(n))!=null&&t.dragging&&r.push(je.node(l+d,l+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(je.widget(f,h))}}return ue.create(n.doc,r)}function l1({allowTableNodeSelection:n=!1}={}){return new ze({key:Dt,state:{init(){return null},apply(e,t){const r=e.getMeta(Dt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:o}=e.mapping.mapResult(t);return i?null:o}},props:{decorations:S0,handleDOMEvents:{mousedown:Y0},createSelectionBetween(e){return Dt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:K0,handleKeyDown:U0,handlePaste:J0},appendTransaction(e,t,r){return k0(r,Ru(r,t),n)}})}function Ro(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function ha(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=i===f?o:p&&p[m],b=g?`${g}px`:"";if(l+=g||r,g||(a=!1),c){if(c.style.width!==b){const[S,x]=Ro(r,g);c.style.setProperty(S,x)}c=c.nextSibling}else{const S=document.createElement("col"),[x,k]=Ro(r,g);S.style.setProperty(x,k),e.appendChild(S)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)===null||s===void 0||s.removeChild(c),c=d}a?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}class a1{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")),ha(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,ha(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function c1(n,e,t,r){let i=0,o=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=t===f?r:p&&p[m];i+=g||e,g||(o=!1);const[b,S]=Ro(e,g);s.push(["col",{style:`${b}: ${S}`}])}}const a=o?`${i}px`:"",c=o?"":`${i}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function pa(n,e){return n.createAndFill()}function u1(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 d1(n,e,t,r,i){const o=u1(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=pa(o.cell);if(u&&l.push(u),r){const d=pa(o.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(o.row.createChecked(null,r&&c===0?s:l));return o.table.createChecked(null,a)}function f1(n){return n instanceof ae}const yr=({editor:n})=>{const{selection:e}=n.state;if(!f1(e))return!1;let t=0;const r=pu(e.ranges[0].$from,o=>o.type.name==="table");return r==null||r.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},h1=ce.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:a1,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:i}=c1(n,this.options.cellMinWidth);return["table",ie(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const s=d1(o.schema,n,e,t);if(i){const l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(z.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>T0(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>E0(n,e),deleteColumn:()=>({state:n,dispatch:e})=>A0(n,e),addRowBefore:()=>({state:n,dispatch:e})=>R0(n,e),addRowAfter:()=>({state:n,dispatch:e})=>D0(n,e),deleteRow:()=>({state:n,dispatch:e})=>I0(n,e),deleteTable:()=>({state:n,dispatch:e})=>F0(n,e),mergeCells:()=>({state:n,dispatch:e})=>na(n,e),splitCell:()=>({state:n,dispatch:e})=>ra(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Qn("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Qn("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>$0(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>na(n,e)?!0:ra(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>z0(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>oa(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>oa(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Ru(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ae.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:yr,"Mod-Backspace":yr,Delete:yr,"Mod-Delete":yr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[X0({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],l1({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:q(P(n,"tableRole",e))}}}),p1=ce.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",ie(this.options.HTMLAttributes,n),0]}}),m1=ce.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?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",ie(this.options.HTMLAttributes,n),0]}}),g1=ce.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?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",ie(this.options.HTMLAttributes,n),0]}}),Lu=({title:n,childrenContent:e,editable:t,childrenEdit:r})=>{const[i,o]=I.useState(!1),s=t?w.jsx(ft.Menu,{children:w.jsx(ft.Menu.Item,{onClick:()=>o(!0),children:"Edit"},"edit")}):null;return w.jsxs("div",{children:[t&&s?w.jsx(ft.Dropdown,{overlay:s,trigger:["contextMenu"],children:e}):e,w.jsx(ft.Modal,{title:`Edit ${n}`,open:i,onOk:()=>o(!1),onCancel:()=>o(!1),children:r})]})},y1=({node:n,editor:e})=>{const[t,r]=I.useState(!1),[i,o]=I.useState(n.attrs.bgColor||"#f3f4f6"),[s,l]=I.useState(n.attrs.titleColor||"#000000"),a=d=>{d.preventDefault()},c=d=>{o(d.toHexString())},u=d=>{l(d.toHexString())};return w.jsx(vu,{className:"accordion-wrapper",children:w.jsx(Lu,{title:"Accordion",childrenContent:w.jsxs("div",{className:"my-4 transition-all duration-300 border rounded-lg shadow-sm",onContextMenu:a,children:[w.jsxs("div",{className:"flex items-center justify-between p-4 transition-colors accordion-header",style:{backgroundColor:i},onClick:()=>r(!t),children:[w.jsx("input",{className:"w-full text-lg font-medium bg-transparent border-none outline-none",style:{color:s},defaultValue:n.attrs.title||"Accordion Title",disabled:!e.isEditable,suppressContentEditableWarning:!0,contentEditable:!0,placeholder:"Accordion title"}),w.jsx(Zg,{className:`transition-transform duration-300 ${t?"rotate-180":""}`,size:20})]}),w.jsx("div",{className:`overflow-hidden duration-300 ease-in-out ${t?"max-h-96 opacity-100":"max-h-0 opacity-0"} `,children:w.jsx("div",{className:"p-4 border-t",children:w.jsx(Pg,{contentEditable:e.isEditable})})})]}),editable:e.isEditable,childrenEdit:w.jsxs("div",{className:"px-6 py-4 space-y-6 rounded-lg bg-gray-50",children:[w.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[w.jsxs("div",{className:"flex flex-col space-y-2",children:[w.jsx("label",{className:"font-medium text-gray-700",children:"Background Color"}),w.jsxs("div",{className:"flex items-center space-x-3",children:[w.jsx("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:i}}),w.jsx(Hr,{value:i,onChange:c})]})]}),w.jsxs("div",{className:"flex flex-col space-y-2",children:[w.jsx("label",{className:"font-medium text-gray-700",children:"Title Color"}),w.jsxs("div",{className:"flex items-center space-x-3",children:[w.jsx("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:s}}),w.jsx(Hr,{value:s,onChange:u})]})]})]}),w.jsx("div",{className:"pt-4 border-t border-gray-200",children:w.jsxs("div",{className:"p-3 bg-white border rounded-md",children:[w.jsx("div",{className:"text-sm text-gray-600",children:"Preview"}),w.jsx("div",{className:"p-2 mt-2 rounded",style:{backgroundColor:i},children:w.jsx("span",{style:{color:s,fontWeight:500},children:"Accordion Title"})})]})})]})})})},b1=ce.create({name:"accordion",group:"block",content:"block+",atom:!1,draggable:!0,selectable:!0,inline:!1,defining:!0,addAttributes(){return{title:{default:"Accordion Title"},bgColor:{default:"#f3f4f6"},titleColor:{default:"#000000"}}},parseHTML(){return[{tag:"accordion"}]},renderHTML({HTMLAttributes:n}){return["accordion",ie(n)]},addNodeView(){return Su(y1)},addCommands(){return{setAccordion:n=>({chain:e})=>e().insertContent({type:"accordion",attrs:n,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}}),v1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,S1=ce.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",ie(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[gu({find:v1,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var us={exports:{}},rr={},ai={exports:{}},zu={},Do={exports:{}},br={exports:{}},ne={};/** @license React v16.13.1
346
344
  * react-is.production.min.js
347
345
  *
348
346
  * Copyright (c) Facebook, Inc. and its affiliates.
349
347
  *
350
348
  * This source code is licensed under the MIT license found in the
351
349
  * LICENSE file in the root directory of this source tree.
352
- */var pa;function b1(){if(pa)return ne;pa=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,a=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function S(v){if(typeof v=="object"&&v!==null){var N=v.$$typeof;switch(N){case e:switch(v=v.type,v){case a:case c:case r:case o:case i:case d:return v;default:switch(v=v&&v.$$typeof,v){case l:case u:case p:case h:case s:return v;default:return N}}case t:return N}}}function k(v){return S(v)===c}return ne.AsyncMode=a,ne.ConcurrentMode=c,ne.ContextConsumer=l,ne.ContextProvider=s,ne.Element=e,ne.ForwardRef=u,ne.Fragment=r,ne.Lazy=p,ne.Memo=h,ne.Portal=t,ne.Profiler=o,ne.StrictMode=i,ne.Suspense=d,ne.isAsyncMode=function(v){return k(v)||S(v)===a},ne.isConcurrentMode=k,ne.isContextConsumer=function(v){return S(v)===l},ne.isContextProvider=function(v){return S(v)===s},ne.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},ne.isForwardRef=function(v){return S(v)===u},ne.isFragment=function(v){return S(v)===r},ne.isLazy=function(v){return S(v)===p},ne.isMemo=function(v){return S(v)===h},ne.isPortal=function(v){return S(v)===t},ne.isProfiler=function(v){return S(v)===o},ne.isStrictMode=function(v){return S(v)===i},ne.isSuspense=function(v){return S(v)===d},ne.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===c||v===o||v===i||v===d||v===f||typeof v=="object"&&v!==null&&(v.$$typeof===p||v.$$typeof===h||v.$$typeof===s||v.$$typeof===l||v.$$typeof===u||v.$$typeof===g||v.$$typeof===b||v.$$typeof===x||v.$$typeof===m)},ne.typeOf=S,ne}var re={};/** @license React v16.13.1
350
+ */var ma;function x1(){if(ma)return ne;ma=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,a=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,S=n?Symbol.for("react.scope"):60119;function x(v){if(typeof v=="object"&&v!==null){var T=v.$$typeof;switch(T){case e:switch(v=v.type,v){case a:case c:case r:case o:case i:case d:return v;default:switch(v=v&&v.$$typeof,v){case l:case u:case p:case h:case s:return v;default:return T}}case t:return T}}}function k(v){return x(v)===c}return ne.AsyncMode=a,ne.ConcurrentMode=c,ne.ContextConsumer=l,ne.ContextProvider=s,ne.Element=e,ne.ForwardRef=u,ne.Fragment=r,ne.Lazy=p,ne.Memo=h,ne.Portal=t,ne.Profiler=o,ne.StrictMode=i,ne.Suspense=d,ne.isAsyncMode=function(v){return k(v)||x(v)===a},ne.isConcurrentMode=k,ne.isContextConsumer=function(v){return x(v)===l},ne.isContextProvider=function(v){return x(v)===s},ne.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},ne.isForwardRef=function(v){return x(v)===u},ne.isFragment=function(v){return x(v)===r},ne.isLazy=function(v){return x(v)===p},ne.isMemo=function(v){return x(v)===h},ne.isPortal=function(v){return x(v)===t},ne.isProfiler=function(v){return x(v)===o},ne.isStrictMode=function(v){return x(v)===i},ne.isSuspense=function(v){return x(v)===d},ne.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===c||v===o||v===i||v===d||v===f||typeof v=="object"&&v!==null&&(v.$$typeof===p||v.$$typeof===h||v.$$typeof===s||v.$$typeof===l||v.$$typeof===u||v.$$typeof===g||v.$$typeof===b||v.$$typeof===S||v.$$typeof===m)},ne.typeOf=x,ne}var re={};/** @license React v16.13.1
353
351
  * react-is.development.js
354
352
  *
355
353
  * Copyright (c) Facebook, Inc. and its affiliates.
356
354
  *
357
355
  * This source code is licensed under the MIT license found in the
358
356
  * LICENSE file in the root directory of this source tree.
359
- */var ma;function v1(){return ma||(ma=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,a=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function S(D){return typeof D=="string"||typeof D=="function"||D===r||D===c||D===o||D===i||D===d||D===f||typeof D=="object"&&D!==null&&(D.$$typeof===p||D.$$typeof===h||D.$$typeof===s||D.$$typeof===l||D.$$typeof===u||D.$$typeof===g||D.$$typeof===b||D.$$typeof===x||D.$$typeof===m)}function k(D){if(typeof D=="object"&&D!==null){var tt=D.$$typeof;switch(tt){case e:var fn=D.type;switch(fn){case a:case c:case r:case o:case i:case d:return fn;default:var qt=fn&&fn.$$typeof;switch(qt){case l:case u:case p:case h:case s:return qt;default:return tt}}case t:return tt}}}var v=a,N=c,O=l,B=s,_=e,oe=u,ge=r,Ee=p,ye=h,pe=t,We=o,xe=i,Ne=d,ut=!1;function vt(D){return ut||(ut=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),M(D)||k(D)===a}function M(D){return k(D)===c}function R(D){return k(D)===l}function K(D){return k(D)===s}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function j(D){return k(D)===u}function X(D){return k(D)===r}function F(D){return k(D)===p}function W(D){return k(D)===h}function J(D){return k(D)===t}function Q(D){return k(D)===o}function Y(D){return k(D)===i}function Ae(D){return k(D)===d}re.AsyncMode=v,re.ConcurrentMode=N,re.ContextConsumer=O,re.ContextProvider=B,re.Element=_,re.ForwardRef=oe,re.Fragment=ge,re.Lazy=Ee,re.Memo=ye,re.Portal=pe,re.Profiler=We,re.StrictMode=xe,re.Suspense=Ne,re.isAsyncMode=vt,re.isConcurrentMode=M,re.isContextConsumer=R,re.isContextProvider=K,re.isElement=U,re.isForwardRef=j,re.isFragment=X,re.isLazy=F,re.isMemo=W,re.isPortal=J,re.isProfiler=Q,re.isStrictMode=Y,re.isSuspense=Ae,re.isValidElementType=S,re.typeOf=k}()),re}var ga;function Lu(){return ga||(ga=1,process.env.NODE_ENV==="production"?br.exports=b1():br.exports=v1()),br.exports}/*
357
+ */var ga;function w1(){return ga||(ga=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,a=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,S=n?Symbol.for("react.scope"):60119;function x(N){return typeof N=="string"||typeof N=="function"||N===r||N===c||N===o||N===i||N===d||N===f||typeof N=="object"&&N!==null&&(N.$$typeof===p||N.$$typeof===h||N.$$typeof===s||N.$$typeof===l||N.$$typeof===u||N.$$typeof===g||N.$$typeof===b||N.$$typeof===S||N.$$typeof===m)}function k(N){if(typeof N=="object"&&N!==null){var tt=N.$$typeof;switch(tt){case e:var fn=N.type;switch(fn){case a:case c:case r:case o:case i:case d:return fn;default:var qt=fn&&fn.$$typeof;switch(qt){case l:case u:case p:case h:case s:return qt;default:return tt}}case t:return tt}}}var v=a,T=c,A=l,$=s,_=e,oe=u,ge=r,Me=p,ye=h,pe=t,We=o,Se=i,Te=d,ut=!1;function vt(N){return ut||(ut=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),E(N)||k(N)===a}function E(N){return k(N)===c}function D(N){return k(N)===l}function K(N){return k(N)===s}function U(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function F(N){return k(N)===u}function X(N){return k(N)===r}function H(N){return k(N)===p}function W(N){return k(N)===h}function J(N){return k(N)===t}function Q(N){return k(N)===o}function Y(N){return k(N)===i}function Re(N){return k(N)===d}re.AsyncMode=v,re.ConcurrentMode=T,re.ContextConsumer=A,re.ContextProvider=$,re.Element=_,re.ForwardRef=oe,re.Fragment=ge,re.Lazy=Me,re.Memo=ye,re.Portal=pe,re.Profiler=We,re.StrictMode=Se,re.Suspense=Te,re.isAsyncMode=vt,re.isConcurrentMode=E,re.isContextConsumer=D,re.isContextProvider=K,re.isElement=U,re.isForwardRef=F,re.isFragment=X,re.isLazy=H,re.isMemo=W,re.isPortal=J,re.isProfiler=Q,re.isStrictMode=Y,re.isSuspense=Re,re.isValidElementType=x,re.typeOf=k}()),re}var ya;function Bu(){return ya||(ya=1,process.env.NODE_ENV==="production"?br.exports=x1():br.exports=w1()),br.exports}/*
360
358
  object-assign
361
359
  (c) Sindre Sorhus
362
360
  @license MIT
363
- */var Ui,ya;function x1(){if(ya)return Ui;ya=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},l=0;l<10;l++)s["_"+String.fromCharCode(l)]=l;var a=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(a.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ui=i()?Object.assign:function(o,s){for(var l,a=r(o),c,u=1;u<arguments.length;u++){l=Object(arguments[u]);for(var d in l)e.call(l,d)&&(a[d]=l[d]);if(n){c=n(l);for(var f=0;f<c.length;f++)t.call(l,c[f])&&(a[c[f]]=l[c[f]])}}return a},Ui}var Ki,ba;function ds(){if(ba)return Ki;ba=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ki=n,Ki}var Ji,va;function Vu(){return va||(va=1,Ji=Function.call.bind(Object.prototype.hasOwnProperty)),Ji}var Yi,xa;function S1(){if(xa)return Yi;xa=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=ds(),t={},r=Vu();n=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,l,a,c){if(process.env.NODE_ENV!=="production"){for(var u in o)if(r(o,u)){var d;try{if(typeof o[u]!="function"){var f=Error((a||"React class")+": "+l+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}d=o[u](s,u,a,l,null,e)}catch(p){d=p}if(d&&!(d instanceof Error)&&n((a||"React class")+": type specification of "+l+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in t)){t[d.message]=!0;var h=c?c():"";n("Failed "+l+" type: "+d.message+(h??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},Yi=i,Yi}var Gi,Sa;function w1(){if(Sa)return Gi;Sa=1;var n=Lu(),e=x1(),t=ds(),r=Vu(),i=S1(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(l){var a="Warning: "+l;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}});function s(){return null}return Gi=function(l,a){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(M){var R=M&&(c&&M[c]||M[u]);if(typeof R=="function")return R}var f="<<anonymous>>",h={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:x(),arrayOf:S,element:k(),elementType:v(),instanceOf:N,node:oe(),objectOf:B,oneOf:O,oneOfType:_,shape:Ee,exact:ye};function p(M,R){return M===R?M!==0||1/M===1/R:M!==M&&R!==R}function m(M,R){this.message=M,this.data=R&&typeof R=="object"?R:{},this.stack=""}m.prototype=Error.prototype;function g(M){if(process.env.NODE_ENV!=="production")var R={},K=0;function U(X,F,W,J,Q,Y,Ae){if(J=J||f,Y=Y||W,Ae!==t){if(a){var D=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw D.name="Invariant Violation",D}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var tt=J+":"+W;!R[tt]&&K<3&&(o("You are manually calling a React.PropTypes validation function for the `"+Y+"` prop on `"+J+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[tt]=!0,K++)}}return F[W]==null?X?F[W]===null?new m("The "+Q+" `"+Y+"` is marked as required "+("in `"+J+"`, but its value is `null`.")):new m("The "+Q+" `"+Y+"` is marked as required in "+("`"+J+"`, but its value is `undefined`.")):null:M(F,W,J,Q,Y)}var j=U.bind(null,!1);return j.isRequired=U.bind(null,!0),j}function b(M){function R(K,U,j,X,F,W){var J=K[U],Q=xe(J);if(Q!==M){var Y=Ne(J);return new m("Invalid "+X+" `"+F+"` of type "+("`"+Y+"` supplied to `"+j+"`, expected ")+("`"+M+"`."),{expectedType:M})}return null}return g(R)}function x(){return g(s)}function S(M){function R(K,U,j,X,F){if(typeof M!="function")return new m("Property `"+F+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var W=K[U];if(!Array.isArray(W)){var J=xe(W);return new m("Invalid "+X+" `"+F+"` of type "+("`"+J+"` supplied to `"+j+"`, expected an array."))}for(var Q=0;Q<W.length;Q++){var Y=M(W,Q,j,X,F+"["+Q+"]",t);if(Y instanceof Error)return Y}return null}return g(R)}function k(){function M(R,K,U,j,X){var F=R[K];if(!l(F)){var W=xe(F);return new m("Invalid "+j+" `"+X+"` of type "+("`"+W+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return g(M)}function v(){function M(R,K,U,j,X){var F=R[K];if(!n.isValidElementType(F)){var W=xe(F);return new m("Invalid "+j+" `"+X+"` of type "+("`"+W+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return g(M)}function N(M){function R(K,U,j,X,F){if(!(K[U]instanceof M)){var W=M.name||f,J=vt(K[U]);return new m("Invalid "+X+" `"+F+"` of type "+("`"+J+"` supplied to `"+j+"`, expected ")+("instance of `"+W+"`."))}return null}return g(R)}function O(M){if(!Array.isArray(M))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function R(K,U,j,X,F){for(var W=K[U],J=0;J<M.length;J++)if(p(W,M[J]))return null;var Q=JSON.stringify(M,function(Ae,D){var tt=Ne(D);return tt==="symbol"?String(D):D});return new m("Invalid "+X+" `"+F+"` of value `"+String(W)+"` "+("supplied to `"+j+"`, expected one of "+Q+"."))}return g(R)}function B(M){function R(K,U,j,X,F){if(typeof M!="function")return new m("Property `"+F+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var W=K[U],J=xe(W);if(J!=="object")return new m("Invalid "+X+" `"+F+"` of type "+("`"+J+"` supplied to `"+j+"`, expected an object."));for(var Q in W)if(r(W,Q)){var Y=M(W,Q,j,X,F+"."+Q,t);if(Y instanceof Error)return Y}return null}return g(R)}function _(M){if(!Array.isArray(M))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var R=0;R<M.length;R++){var K=M[R];if(typeof K!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ut(K)+" at index "+R+"."),s}function U(j,X,F,W,J){for(var Q=[],Y=0;Y<M.length;Y++){var Ae=M[Y],D=Ae(j,X,F,W,J,t);if(D==null)return null;D.data&&r(D.data,"expectedType")&&Q.push(D.data.expectedType)}var tt=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new m("Invalid "+W+" `"+J+"` supplied to "+("`"+F+"`"+tt+"."))}return g(U)}function oe(){function M(R,K,U,j,X){return pe(R[K])?null:new m("Invalid "+j+" `"+X+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return g(M)}function ge(M,R,K,U,j){return new m((M||"React class")+": "+R+" type `"+K+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function Ee(M){function R(K,U,j,X,F){var W=K[U],J=xe(W);if(J!=="object")return new m("Invalid "+X+" `"+F+"` of type `"+J+"` "+("supplied to `"+j+"`, expected `object`."));for(var Q in M){var Y=M[Q];if(typeof Y!="function")return ge(j,X,F,Q,Ne(Y));var Ae=Y(W,Q,j,X,F+"."+Q,t);if(Ae)return Ae}return null}return g(R)}function ye(M){function R(K,U,j,X,F){var W=K[U],J=xe(W);if(J!=="object")return new m("Invalid "+X+" `"+F+"` of type `"+J+"` "+("supplied to `"+j+"`, expected `object`."));var Q=e({},K[U],M);for(var Y in Q){var Ae=M[Y];if(r(M,Y)&&typeof Ae!="function")return ge(j,X,F,Y,Ne(Ae));if(!Ae)return new m("Invalid "+X+" `"+F+"` key `"+Y+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(K[U],null," ")+`
364
- Valid keys: `+JSON.stringify(Object.keys(M),null," "));var D=Ae(W,Y,j,X,F+"."+Y,t);if(D)return D}return null}return g(R)}function pe(M){switch(typeof M){case"number":case"string":case"undefined":return!0;case"boolean":return!M;case"object":if(Array.isArray(M))return M.every(pe);if(M===null||l(M))return!0;var R=d(M);if(R){var K=R.call(M),U;if(R!==M.entries){for(;!(U=K.next()).done;)if(!pe(U.value))return!1}else for(;!(U=K.next()).done;){var j=U.value;if(j&&!pe(j[1]))return!1}}else return!1;return!0;default:return!1}}function We(M,R){return M==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function xe(M){var R=typeof M;return Array.isArray(M)?"array":M instanceof RegExp?"object":We(R,M)?"symbol":R}function Ne(M){if(typeof M>"u"||M===null)return""+M;var R=xe(M);if(R==="object"){if(M instanceof Date)return"date";if(M instanceof RegExp)return"regexp"}return R}function ut(M){var R=Ne(M);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function vt(M){return!M.constructor||!M.constructor.name?f:M.constructor.name}return h.checkPropTypes=i,h.resetWarningCache=i.resetWarningCache,h.PropTypes=h,h},Gi}var Xi,wa;function k1(){if(wa)return Xi;wa=1;var n=ds();function e(){}function t(){}return t.resetWarningCache=e,Xi=function(){function r(s,l,a,c,u,d){if(d!==n){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return o.PropTypes=o,o},Xi}if(process.env.NODE_ENV!=="production"){var C1=Lu(),E1=!0;Ro.exports=w1()(C1.isElement,E1)}else Ro.exports=k1()();var ci=Ro.exports;function Bu(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e<n.length;e++)n[e]&&(t=Bu(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function ka(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=Bu(n))&&(r&&(r+=" "),r+=e);return r}const N1=Object.freeze(Object.defineProperty({__proto__:null,clsx:ka,default:ka},Symbol.toStringTag,{value:"Module"})),M1=bd(N1);var he={},yt={};Object.defineProperty(yt,"__esModule",{value:!0});yt.dontSetMe=R1;yt.findInArray=T1;yt.int=A1;yt.isFunction=O1;yt.isNum=D1;function T1(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function O1(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function D1(n){return typeof n=="number"&&!isNaN(n)}function A1(n){return parseInt(n,10)}function R1(n,e,t){if(n[e])return new Error("Invalid prop ".concat(e," passed to ").concat(t," - do not set this, set it on the child."))}var dn={};Object.defineProperty(dn,"__esModule",{value:!0});dn.browserPrefixToKey=ju;dn.browserPrefixToStyle=P1;dn.default=void 0;dn.getPrefix=$u;const Zi=["Moz","Webkit","O","ms"];function $u(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const t=(n=window.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.style;if(!t||e in t)return"";for(let r=0;r<Zi.length;r++)if(ju(e,Zi[r])in t)return Zi[r];return""}function ju(n,e){return e?"".concat(e).concat(I1(n)):n}function P1(n,e){return e?"-".concat(e.toLowerCase(),"-").concat(n):n}function I1(n){let e="",t=!0;for(let r=0;r<n.length;r++)t?(e+=n[r].toUpperCase(),t=!1):n[r]==="-"?t=!0:e+=n[r];return e}dn.default=$u();Object.defineProperty(he,"__esModule",{value:!0});he.addClassName=Wu;he.addEvent=L1;he.addUserSelectStyles=J1;he.createCSSTransform=W1;he.createSVGTransform=q1;he.getTouch=U1;he.getTouchIdentifier=K1;he.getTranslation=fs;he.innerHeight=j1;he.innerWidth=F1;he.matchesSelector=Hu;he.matchesSelectorAndParentsTo=z1;he.offsetXYFromParent=H1;he.outerHeight=B1;he.outerWidth=$1;he.removeClassName=qu;he.removeEvent=V1;he.removeUserSelectStyles=Y1;var Ze=yt,Ca=_1(dn);function Fu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Fu=function(r){return r?t:e})(n)}function _1(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Fu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}let vr="";function Hu(n,e){return vr||(vr=(0,Ze.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,Ze.isFunction)(n[t])})),(0,Ze.isFunction)(n[vr])?n[vr](e):!1}function z1(n,e,t){let r=n;do{if(Hu(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function L1(n,e,t,r){if(!n)return;const i={capture:!0,...r};n.addEventListener?n.addEventListener(e,t,i):n.attachEvent?n.attachEvent("on"+e,t):n["on"+e]=t}function V1(n,e,t,r){if(!n)return;const i={capture:!0,...r};n.removeEventListener?n.removeEventListener(e,t,i):n.detachEvent?n.detachEvent("on"+e,t):n["on"+e]=null}function B1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ze.int)(t.borderTopWidth),e+=(0,Ze.int)(t.borderBottomWidth),e}function $1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ze.int)(t.borderLeftWidth),e+=(0,Ze.int)(t.borderRightWidth),e}function j1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ze.int)(t.paddingTop),e-=(0,Ze.int)(t.paddingBottom),e}function F1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ze.int)(t.paddingLeft),e-=(0,Ze.int)(t.paddingRight),e}function H1(n,e,t){const i=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),o=(n.clientX+e.scrollLeft-i.left)/t,s=(n.clientY+e.scrollTop-i.top)/t;return{x:o,y:s}}function W1(n,e){const t=fs(n,e,"px");return{[(0,Ca.browserPrefixToKey)("transform",Ca.default)]:t}}function q1(n,e){return fs(n,e,"")}function fs(n,e,t){let{x:r,y:i}=n,o="translate(".concat(r).concat(t,",").concat(i).concat(t,")");if(e){const s="".concat(typeof e.x=="string"?e.x:e.x+t),l="".concat(typeof e.y=="string"?e.y:e.y+t);o="translate(".concat(s,", ").concat(l,")")+o}return o}function U1(n,e){return n.targetTouches&&(0,Ze.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,Ze.findInArray)(n.changedTouches,t=>e===t.identifier)}function K1(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function J1(n){if(!n)return;let e=n.getElementById("react-draggable-style-el");e||(e=n.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
361
+ */var Ui,ba;function k1(){if(ba)return Ui;ba=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},l=0;l<10;l++)s["_"+String.fromCharCode(l)]=l;var a=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(a.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ui=i()?Object.assign:function(o,s){for(var l,a=r(o),c,u=1;u<arguments.length;u++){l=Object(arguments[u]);for(var d in l)e.call(l,d)&&(a[d]=l[d]);if(n){c=n(l);for(var f=0;f<c.length;f++)t.call(l,c[f])&&(a[c[f]]=l[c[f]])}}return a},Ui}var Ki,va;function ds(){if(va)return Ki;va=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ki=n,Ki}var Ji,Sa;function $u(){return Sa||(Sa=1,Ji=Function.call.bind(Object.prototype.hasOwnProperty)),Ji}var Yi,xa;function C1(){if(xa)return Yi;xa=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=ds(),t={},r=$u();n=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,l,a,c){if(process.env.NODE_ENV!=="production"){for(var u in o)if(r(o,u)){var d;try{if(typeof o[u]!="function"){var f=Error((a||"React class")+": "+l+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}d=o[u](s,u,a,l,null,e)}catch(p){d=p}if(d&&!(d instanceof Error)&&n((a||"React class")+": type specification of "+l+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in t)){t[d.message]=!0;var h=c?c():"";n("Failed "+l+" type: "+d.message+(h??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},Yi=i,Yi}var Gi,wa;function M1(){if(wa)return Gi;wa=1;var n=Bu(),e=k1(),t=ds(),r=$u(),i=C1(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(l){var a="Warning: "+l;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}});function s(){return null}return Gi=function(l,a){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(E){var D=E&&(c&&E[c]||E[u]);if(typeof D=="function")return D}var f="<<anonymous>>",h={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:S(),arrayOf:x,element:k(),elementType:v(),instanceOf:T,node:oe(),objectOf:$,oneOf:A,oneOfType:_,shape:Me,exact:ye};function p(E,D){return E===D?E!==0||1/E===1/D:E!==E&&D!==D}function m(E,D){this.message=E,this.data=D&&typeof D=="object"?D:{},this.stack=""}m.prototype=Error.prototype;function g(E){if(process.env.NODE_ENV!=="production")var D={},K=0;function U(X,H,W,J,Q,Y,Re){if(J=J||f,Y=Y||W,Re!==t){if(a){var N=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw N.name="Invariant Violation",N}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var tt=J+":"+W;!D[tt]&&K<3&&(o("You are manually calling a React.PropTypes validation function for the `"+Y+"` prop on `"+J+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),D[tt]=!0,K++)}}return H[W]==null?X?H[W]===null?new m("The "+Q+" `"+Y+"` is marked as required "+("in `"+J+"`, but its value is `null`.")):new m("The "+Q+" `"+Y+"` is marked as required in "+("`"+J+"`, but its value is `undefined`.")):null:E(H,W,J,Q,Y)}var F=U.bind(null,!1);return F.isRequired=U.bind(null,!0),F}function b(E){function D(K,U,F,X,H,W){var J=K[U],Q=Se(J);if(Q!==E){var Y=Te(J);return new m("Invalid "+X+" `"+H+"` of type "+("`"+Y+"` supplied to `"+F+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return g(D)}function S(){return g(s)}function x(E){function D(K,U,F,X,H){if(typeof E!="function")return new m("Property `"+H+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var W=K[U];if(!Array.isArray(W)){var J=Se(W);return new m("Invalid "+X+" `"+H+"` of type "+("`"+J+"` supplied to `"+F+"`, expected an array."))}for(var Q=0;Q<W.length;Q++){var Y=E(W,Q,F,X,H+"["+Q+"]",t);if(Y instanceof Error)return Y}return null}return g(D)}function k(){function E(D,K,U,F,X){var H=D[K];if(!l(H)){var W=Se(H);return new m("Invalid "+F+" `"+X+"` of type "+("`"+W+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return g(E)}function v(){function E(D,K,U,F,X){var H=D[K];if(!n.isValidElementType(H)){var W=Se(H);return new m("Invalid "+F+" `"+X+"` of type "+("`"+W+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return g(E)}function T(E){function D(K,U,F,X,H){if(!(K[U]instanceof E)){var W=E.name||f,J=vt(K[U]);return new m("Invalid "+X+" `"+H+"` of type "+("`"+J+"` supplied to `"+F+"`, expected ")+("instance of `"+W+"`."))}return null}return g(D)}function A(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function D(K,U,F,X,H){for(var W=K[U],J=0;J<E.length;J++)if(p(W,E[J]))return null;var Q=JSON.stringify(E,function(Re,N){var tt=Te(N);return tt==="symbol"?String(N):N});return new m("Invalid "+X+" `"+H+"` of value `"+String(W)+"` "+("supplied to `"+F+"`, expected one of "+Q+"."))}return g(D)}function $(E){function D(K,U,F,X,H){if(typeof E!="function")return new m("Property `"+H+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var W=K[U],J=Se(W);if(J!=="object")return new m("Invalid "+X+" `"+H+"` of type "+("`"+J+"` supplied to `"+F+"`, expected an object."));for(var Q in W)if(r(W,Q)){var Y=E(W,Q,F,X,H+"."+Q,t);if(Y instanceof Error)return Y}return null}return g(D)}function _(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var D=0;D<E.length;D++){var K=E[D];if(typeof K!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ut(K)+" at index "+D+"."),s}function U(F,X,H,W,J){for(var Q=[],Y=0;Y<E.length;Y++){var Re=E[Y],N=Re(F,X,H,W,J,t);if(N==null)return null;N.data&&r(N.data,"expectedType")&&Q.push(N.data.expectedType)}var tt=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new m("Invalid "+W+" `"+J+"` supplied to "+("`"+H+"`"+tt+"."))}return g(U)}function oe(){function E(D,K,U,F,X){return pe(D[K])?null:new m("Invalid "+F+" `"+X+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return g(E)}function ge(E,D,K,U,F){return new m((E||"React class")+": "+D+" type `"+K+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function Me(E){function D(K,U,F,X,H){var W=K[U],J=Se(W);if(J!=="object")return new m("Invalid "+X+" `"+H+"` of type `"+J+"` "+("supplied to `"+F+"`, expected `object`."));for(var Q in E){var Y=E[Q];if(typeof Y!="function")return ge(F,X,H,Q,Te(Y));var Re=Y(W,Q,F,X,H+"."+Q,t);if(Re)return Re}return null}return g(D)}function ye(E){function D(K,U,F,X,H){var W=K[U],J=Se(W);if(J!=="object")return new m("Invalid "+X+" `"+H+"` of type `"+J+"` "+("supplied to `"+F+"`, expected `object`."));var Q=e({},K[U],E);for(var Y in Q){var Re=E[Y];if(r(E,Y)&&typeof Re!="function")return ge(F,X,H,Y,Te(Re));if(!Re)return new m("Invalid "+X+" `"+H+"` key `"+Y+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(K[U],null," ")+`
362
+ Valid keys: `+JSON.stringify(Object.keys(E),null," "));var N=Re(W,Y,F,X,H+"."+Y,t);if(N)return N}return null}return g(D)}function pe(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(pe);if(E===null||l(E))return!0;var D=d(E);if(D){var K=D.call(E),U;if(D!==E.entries){for(;!(U=K.next()).done;)if(!pe(U.value))return!1}else for(;!(U=K.next()).done;){var F=U.value;if(F&&!pe(F[1]))return!1}}else return!1;return!0;default:return!1}}function We(E,D){return E==="symbol"?!0:D?D["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&D instanceof Symbol:!1}function Se(E){var D=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":We(D,E)?"symbol":D}function Te(E){if(typeof E>"u"||E===null)return""+E;var D=Se(E);if(D==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return D}function ut(E){var D=Te(E);switch(D){case"array":case"object":return"an "+D;case"boolean":case"date":case"regexp":return"a "+D;default:return D}}function vt(E){return!E.constructor||!E.constructor.name?f:E.constructor.name}return h.checkPropTypes=i,h.resetWarningCache=i.resetWarningCache,h.PropTypes=h,h},Gi}var Xi,ka;function T1(){if(ka)return Xi;ka=1;var n=ds();function e(){}function t(){}return t.resetWarningCache=e,Xi=function(){function r(s,l,a,c,u,d){if(d!==n){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return o.PropTypes=o,o},Xi}if(process.env.NODE_ENV!=="production"){var E1=Bu(),O1=!0;Do.exports=M1()(E1.isElement,O1)}else Do.exports=T1()();var ci=Do.exports;function ju(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e<n.length;e++)n[e]&&(t=ju(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function Ca(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=ju(n))&&(r&&(r+=" "),r+=e);return r}const A1=Object.freeze(Object.defineProperty({__proto__:null,clsx:Ca,default:Ca},Symbol.toStringTag,{value:"Module"})),N1=xd(A1);var he={},yt={};Object.defineProperty(yt,"__esModule",{value:!0});yt.dontSetMe=_1;yt.findInArray=R1;yt.int=I1;yt.isFunction=D1;yt.isNum=P1;function R1(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function D1(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function P1(n){return typeof n=="number"&&!isNaN(n)}function I1(n){return parseInt(n,10)}function _1(n,e,t){if(n[e])return new Error("Invalid prop ".concat(e," passed to ").concat(t," - do not set this, set it on the child."))}var dn={};Object.defineProperty(dn,"__esModule",{value:!0});dn.browserPrefixToKey=Hu;dn.browserPrefixToStyle=L1;dn.default=void 0;dn.getPrefix=Fu;const Zi=["Moz","Webkit","O","ms"];function Fu(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const t=(n=window.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.style;if(!t||e in t)return"";for(let r=0;r<Zi.length;r++)if(Hu(e,Zi[r])in t)return Zi[r];return""}function Hu(n,e){return e?"".concat(e).concat(z1(n)):n}function L1(n,e){return e?"-".concat(e.toLowerCase(),"-").concat(n):n}function z1(n){let e="",t=!0;for(let r=0;r<n.length;r++)t?(e+=n[r].toUpperCase(),t=!1):n[r]==="-"?t=!0:e+=n[r];return e}dn.default=Fu();Object.defineProperty(he,"__esModule",{value:!0});he.addClassName=qu;he.addEvent=j1;he.addUserSelectStyles=X1;he.createCSSTransform=K1;he.createSVGTransform=J1;he.getTouch=Y1;he.getTouchIdentifier=G1;he.getTranslation=fs;he.innerHeight=W1;he.innerWidth=q1;he.matchesSelector=Wu;he.matchesSelectorAndParentsTo=$1;he.offsetXYFromParent=U1;he.outerHeight=H1;he.outerWidth=V1;he.removeClassName=Uu;he.removeEvent=F1;he.removeUserSelectStyles=Z1;var Ze=yt,Ma=B1(dn);function Vu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Vu=function(r){return r?t:e})(n)}function B1(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Vu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}let vr="";function Wu(n,e){return vr||(vr=(0,Ze.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,Ze.isFunction)(n[t])})),(0,Ze.isFunction)(n[vr])?n[vr](e):!1}function $1(n,e,t){let r=n;do{if(Wu(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function j1(n,e,t,r){if(!n)return;const i={capture:!0,...r};n.addEventListener?n.addEventListener(e,t,i):n.attachEvent?n.attachEvent("on"+e,t):n["on"+e]=t}function F1(n,e,t,r){if(!n)return;const i={capture:!0,...r};n.removeEventListener?n.removeEventListener(e,t,i):n.detachEvent?n.detachEvent("on"+e,t):n["on"+e]=null}function H1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ze.int)(t.borderTopWidth),e+=(0,Ze.int)(t.borderBottomWidth),e}function V1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ze.int)(t.borderLeftWidth),e+=(0,Ze.int)(t.borderRightWidth),e}function W1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ze.int)(t.paddingTop),e-=(0,Ze.int)(t.paddingBottom),e}function q1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ze.int)(t.paddingLeft),e-=(0,Ze.int)(t.paddingRight),e}function U1(n,e,t){const i=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),o=(n.clientX+e.scrollLeft-i.left)/t,s=(n.clientY+e.scrollTop-i.top)/t;return{x:o,y:s}}function K1(n,e){const t=fs(n,e,"px");return{[(0,Ma.browserPrefixToKey)("transform",Ma.default)]:t}}function J1(n,e){return fs(n,e,"")}function fs(n,e,t){let{x:r,y:i}=n,o="translate(".concat(r).concat(t,",").concat(i).concat(t,")");if(e){const s="".concat(typeof e.x=="string"?e.x:e.x+t),l="".concat(typeof e.y=="string"?e.y:e.y+t);o="translate(".concat(s,", ").concat(l,")")+o}return o}function Y1(n,e){return n.targetTouches&&(0,Ze.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,Ze.findInArray)(n.changedTouches,t=>e===t.identifier)}function G1(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function X1(n){if(!n)return;let e=n.getElementById("react-draggable-style-el");e||(e=n.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
365
363
  `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
366
- `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&Wu(n.body,"react-draggable-transparent-selection")}function Y1(n){if(n)try{if(n.body&&qu(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function Wu(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(n.className+=" ".concat(e))}function qu(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.canDragX=Z1;bt.canDragY=Q1;bt.createCoreData=tv;bt.createDraggableData=nv;bt.getBoundPosition=G1;bt.getControlPosition=ev;bt.snapToGrid=X1;var Je=yt,Sn=he;function G1(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:rv(r);const i=hs(n);if(typeof r=="string"){const{ownerDocument:o}=i,s=o.defaultView;let l;if(r==="parent"?l=i.parentNode:l=o.querySelector(r),!(l instanceof s.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const a=l,c=s.getComputedStyle(i),u=s.getComputedStyle(a);r={left:-i.offsetLeft+(0,Je.int)(u.paddingLeft)+(0,Je.int)(c.marginLeft),top:-i.offsetTop+(0,Je.int)(u.paddingTop)+(0,Je.int)(c.marginTop),right:(0,Sn.innerWidth)(a)-(0,Sn.outerWidth)(i)-i.offsetLeft+(0,Je.int)(u.paddingRight)-(0,Je.int)(c.marginRight),bottom:(0,Sn.innerHeight)(a)-(0,Sn.outerHeight)(i)-i.offsetTop+(0,Je.int)(u.paddingBottom)-(0,Je.int)(c.marginBottom)}}return(0,Je.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Je.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,Je.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Je.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function X1(n,e,t){const r=Math.round(e/n[0])*n[0],i=Math.round(t/n[1])*n[1];return[r,i]}function Z1(n){return n.props.axis==="both"||n.props.axis==="x"}function Q1(n){return n.props.axis==="both"||n.props.axis==="y"}function ev(n,e,t){const r=typeof e=="number"?(0,Sn.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const i=hs(t),o=t.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,Sn.offsetXYFromParent)(r||n,o,t.props.scale)}function tv(n,e,t){const r=!(0,Je.isNum)(n.lastX),i=hs(n);return r?{node:i,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:i,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function nv(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function rv(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function hs(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var ui={},di={};Object.defineProperty(di,"__esModule",{value:!0});di.default=iv;function iv(){}Object.defineProperty(ui,"__esModule",{value:!0});ui.default=void 0;var Qi=sv(I),Ue=ps(ci),ov=ps(qr),Re=he,Nt=bt,eo=yt,_n=ps(di);function ps(n){return n&&n.__esModule?n:{default:n}}function Uu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Uu=function(r){return r?t:e})(n)}function sv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Uu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function Be(n,e,t){return e=lv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lv(n){var e=av(n,"string");return typeof e=="symbol"?e:String(e)}function av(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const st={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Mt=st.mouse,fi=class extends Qi.Component{constructor(){super(...arguments),Be(this,"dragging",!1),Be(this,"lastX",NaN),Be(this,"lastY",NaN),Be(this,"touchIdentifier",null),Be(this,"mounted",!1),Be(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,Re.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,Re.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&e.preventDefault();const i=(0,Re.getTouchIdentifier)(e);this.touchIdentifier=i;const o=(0,Nt.getControlPosition)(e,i,this);if(o==null)return;const{x:s,y:l}=o,a=(0,Nt.createCoreData)(this,s,l);(0,_n.default)("DraggableCore: handleDragStart: %j",a),(0,_n.default)("calling",this.props.onStart),!(this.props.onStart(e,a)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Re.addUserSelectStyles)(r),this.dragging=!0,this.lastX=s,this.lastY=l,(0,Re.addEvent)(r,Mt.move,this.handleDrag),(0,Re.addEvent)(r,Mt.stop,this.handleDragStop))}),Be(this,"handleDrag",e=>{const t=(0,Nt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX,a=i-this.lastY;if([l,a]=(0,Nt.snapToGrid)(this.props.grid,l,a),!l&&!a)return;r=this.lastX+l,i=this.lastY+a}const o=(0,Nt.createCoreData)(this,r,i);if((0,_n.default)("DraggableCore: handleDrag: %j",o),this.props.onDrag(e,o)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const a=document.createEvent("MouseEvents");a.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(a)}return}this.lastX=r,this.lastY=i}),Be(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,Nt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX||0,c=i-this.lastY||0;[a,c]=(0,Nt.snapToGrid)(this.props.grid,a,c),r=this.lastX+a,i=this.lastY+c}const o=(0,Nt.createCoreData)(this,r,i);if(this.props.onStop(e,o)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,Re.removeUserSelectStyles)(l.ownerDocument),(0,_n.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,_n.default)("DraggableCore: Removing handlers"),(0,Re.removeEvent)(l.ownerDocument,Mt.move,this.handleDrag),(0,Re.removeEvent)(l.ownerDocument,Mt.stop,this.handleDragStop))}),Be(this,"onMouseDown",e=>(Mt=st.mouse,this.handleDragStart(e))),Be(this,"onMouseUp",e=>(Mt=st.mouse,this.handleDragStop(e))),Be(this,"onTouchStart",e=>(Mt=st.touch,this.handleDragStart(e))),Be(this,"onTouchEnd",e=>(Mt=st.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,Re.addEvent)(e,st.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,Re.removeEvent)(t,st.mouse.move,this.handleDrag),(0,Re.removeEvent)(t,st.touch.move,this.handleDrag),(0,Re.removeEvent)(t,st.mouse.stop,this.handleDragStop),(0,Re.removeEvent)(t,st.touch.stop,this.handleDragStop),(0,Re.removeEvent)(e,st.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Re.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(t=this.props)===null||t===void 0||(t=t.nodeRef)===null||t===void 0?void 0:t.current:ov.default.findDOMNode(this)}render(){return Qi.cloneElement(Qi.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ui.default=fi;Be(fi,"displayName","DraggableCore");Be(fi,"propTypes",{allowAnyClick:Ue.default.bool,children:Ue.default.node.isRequired,disabled:Ue.default.bool,enableUserSelectHack:Ue.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ue.default.arrayOf(Ue.default.number),handle:Ue.default.string,cancel:Ue.default.string,nodeRef:Ue.default.object,onStart:Ue.default.func,onDrag:Ue.default.func,onStop:Ue.default.func,onMouseDown:Ue.default.func,scale:Ue.default.number,className:eo.dontSetMe,style:eo.dontSetMe,transform:eo.dontSetMe});Be(fi,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return a.default}}),n.default=void 0;var e=f(I),t=u(ci),r=u(qr),i=u(M1),o=he,s=bt,l=yt,a=u(ui),c=u(di);function u(x){return x&&x.__esModule?x:{default:x}}function d(x){if(typeof WeakMap!="function")return null;var S=new WeakMap,k=new WeakMap;return(d=function(v){return v?k:S})(x)}function f(x,S){if(x&&x.__esModule)return x;if(x===null||typeof x!="object"&&typeof x!="function")return{default:x};var k=d(S);if(k&&k.has(x))return k.get(x);var v={},N=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in x)if(O!=="default"&&Object.prototype.hasOwnProperty.call(x,O)){var B=N?Object.getOwnPropertyDescriptor(x,O):null;B&&(B.get||B.set)?Object.defineProperty(v,O,B):v[O]=x[O]}return v.default=x,k&&k.set(x,v),v}function h(){return h=Object.assign?Object.assign.bind():function(x){for(var S=1;S<arguments.length;S++){var k=arguments[S];for(var v in k)Object.prototype.hasOwnProperty.call(k,v)&&(x[v]=k[v])}return x},h.apply(this,arguments)}function p(x,S,k){return S=m(S),S in x?Object.defineProperty(x,S,{value:k,enumerable:!0,configurable:!0,writable:!0}):x[S]=k,x}function m(x){var S=g(x,"string");return typeof S=="symbol"?S:String(S)}function g(x,S){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var v=k.call(x,S||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(x)}class b extends e.Component{static getDerivedStateFromProps(S,k){let{position:v}=S,{prevPropsPosition:N}=k;return v&&(!N||v.x!==N.x||v.y!==N.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:v,prevPropsPosition:N}),{x:v.x,y:v.y,prevPropsPosition:{...v}}):null}constructor(S){super(S),p(this,"onDragStart",(k,v)=>{if((0,c.default)("Draggable: onDragStart: %j",v),this.props.onStart(k,(0,s.createDraggableData)(this,v))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(k,v)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",v);const N=(0,s.createDraggableData)(this,v),O={x:N.x,y:N.y,slackX:0,slackY:0};if(this.props.bounds){const{x:_,y:oe}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[ge,Ee]=(0,s.getBoundPosition)(this,O.x,O.y);O.x=ge,O.y=Ee,O.slackX=this.state.slackX+(_-O.x),O.slackY=this.state.slackY+(oe-O.y),N.x=O.x,N.y=O.y,N.deltaX=O.x-this.state.x,N.deltaY=O.y-this.state.y}if(this.props.onDrag(k,N)===!1)return!1;this.setState(O)}),p(this,"onDragStop",(k,v)=>{if(!this.state.dragging||this.props.onStop(k,(0,s.createDraggableData)(this,v))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",v);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:_,y:oe}=this.props.position;O.x=_,O.y=oe}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},S.position&&!(S.onDrag||S.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var S,k;return(S=(k=this.props)===null||k===void 0||(k=k.nodeRef)===null||k===void 0?void 0:k.current)!==null&&S!==void 0?S:r.default.findDOMNode(this)}render(){const{axis:S,bounds:k,children:v,defaultPosition:N,defaultClassName:O,defaultClassNameDragging:B,defaultClassNameDragged:_,position:oe,positionOffset:ge,scale:Ee,...ye}=this.props;let pe={},We=null;const Ne=!!!oe||this.state.dragging,ut=oe||N,vt={x:(0,s.canDragX)(this)&&Ne?this.state.x:ut.x,y:(0,s.canDragY)(this)&&Ne?this.state.y:ut.y};this.state.isElementSVG?We=(0,o.createSVGTransform)(vt,ge):pe=(0,o.createCSSTransform)(vt,ge);const M=(0,i.default)(v.props.className||"",O,{[B]:this.state.dragging,[_]:this.state.dragged});return e.createElement(a.default,h({},ye,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(v),{className:M,style:{...v.props.style,...pe},transform:We}))}}n.default=b,p(b,"displayName","Draggable"),p(b,"propTypes",{...a.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(b,"defaultProps",{...a.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(zu);const{default:Ku,DraggableCore:cv}=zu;ai.exports=Ku;ai.exports.default=Ku;ai.exports.DraggableCore=cv;var uv=ai.exports,ms={};ms.__esModule=!0;ms.cloneElement=gv;var dv=fv(I);function fv(n){return n&&n.__esModule?n:{default:n}}function Ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Na(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(r){hv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function hv(n,e,t){return e=pv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pv(n){var e=mv(n,"string");return typeof e=="symbol"?e:String(e)}function mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function gv(n,e){return e.style&&n.props.style&&(e.style=Na(Na({},n.props.style),e.style)),e.className&&n.props.className&&(e.className=n.props.className+" "+e.className),dv.default.cloneElement(n,e)}var nr={};nr.__esModule=!0;nr.resizableProps=void 0;var H=yv(ci);function yv(n){return n&&n.__esModule?n:{default:n}}var bv={axis:H.default.oneOf(["both","x","y","none"]),className:H.default.string,children:H.default.element.isRequired,draggableOpts:H.default.shape({allowAnyClick:H.default.bool,cancel:H.default.string,children:H.default.node,disabled:H.default.bool,enableUserSelectHack:H.default.bool,offsetParent:H.default.node,grid:H.default.arrayOf(H.default.number),handle:H.default.string,nodeRef:H.default.object,onStart:H.default.func,onDrag:H.default.func,onStop:H.default.func,onMouseDown:H.default.func,scale:H.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0];if(i.axis==="both"||i.axis==="y"){var o;return(o=H.default.number).isRequired.apply(o,t)}return H.default.number.apply(H.default,t)},handle:H.default.oneOfType([H.default.node,H.default.func]),handleSize:H.default.arrayOf(H.default.number),lockAspectRatio:H.default.bool,maxConstraints:H.default.arrayOf(H.default.number),minConstraints:H.default.arrayOf(H.default.number),onResizeStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,resizeHandles:H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:H.default.number,width:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0];if(i.axis==="both"||i.axis==="x"){var o;return(o=H.default.number).isRequired.apply(o,t)}return H.default.number.apply(H.default,t)}};nr.resizableProps=bv;tr.__esModule=!0;tr.default=void 0;var zn=kv(I),vv=uv,xv=ms,Sv=nr,wv=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Ju(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Ju=function(i){return i?t:e})(n)}function kv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Ju(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function Po(){return Po=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Po.apply(this,arguments)}function Cv(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function to(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ma(Object(t),!0).forEach(function(r){Ev(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ev(n,e,t){return e=Nv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nv(n){var e=Mv(n,"string");return typeof e=="symbol"?e:String(e)}function Mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Tv(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,Io(n,e)}function Io(n,e){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Io(n,e)}var gs=function(n){Tv(e,n);function e(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=n.call.apply(n,[this].concat(o))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var t=e.prototype;return t.componentWillUnmount=function(){this.resetData()},t.resetData=function(){this.lastHandleRect=this.slack=null},t.runConstraints=function(i,o){var s=this.props,l=s.minConstraints,a=s.maxConstraints,c=s.lockAspectRatio;if(!l&&!a&&!c)return[i,o];if(c){var u=this.props.width/this.props.height,d=i-this.props.width,f=o-this.props.height;Math.abs(d)>Math.abs(f*u)?o=i/u:i=o*u}var h=i,p=o,m=this.slack||[0,0],g=m[0],b=m[1];return i+=g,o+=b,l&&(i=Math.max(l[0],i),o=Math.max(l[1],o)),a&&(i=Math.min(a[0],i),o=Math.min(a[1],o)),this.slack=[g+(h-i),b+(p-o)],[i,o]},t.resizeHandler=function(i,o){var s=this;return function(l,a){var c=a.node,u=a.deltaX,d=a.deltaY;i==="onResizeStart"&&s.resetData();var f=(s.props.axis==="both"||s.props.axis==="x")&&o!=="n"&&o!=="s",h=(s.props.axis==="both"||s.props.axis==="y")&&o!=="e"&&o!=="w";if(!(!f&&!h)){var p=o[0],m=o[o.length-1],g=c.getBoundingClientRect();if(s.lastHandleRect!=null){if(m==="w"){var b=g.left-s.lastHandleRect.left;u+=b}if(p==="n"){var x=g.top-s.lastHandleRect.top;d+=x}}s.lastHandleRect=g,m==="w"&&(u=-u),p==="n"&&(d=-d);var S=s.props.width+(f?u/s.props.transformScale:0),k=s.props.height+(h?d/s.props.transformScale:0),v=s.runConstraints(S,k);S=v[0],k=v[1];var N=S!==s.props.width||k!==s.props.height,O=typeof s.props[i]=="function"?s.props[i]:null,B=i==="onResize"&&!N;O&&!B&&(l.persist==null||l.persist(),O(l,{node:c,size:{width:S,height:k},handle:o})),i==="onResizeStop"&&s.resetData()}}},t.renderResizeHandle=function(i,o){var s=this.props.handle;if(!s)return zn.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+i,ref:o});if(typeof s=="function")return s(i,o);var l=typeof s.type=="string",a=to({ref:o},l?{}:{handleAxis:i});return zn.cloneElement(s,a)},t.render=function(){var i=this,o=this.props,s=o.children,l=o.className,a=o.draggableOpts;o.width,o.height,o.handle,o.handleSize,o.lockAspectRatio,o.axis,o.minConstraints,o.maxConstraints,o.onResize,o.onResizeStop,o.onResizeStart;var c=o.resizeHandles;o.transformScale;var u=Cv(o,wv);return(0,xv.cloneElement)(s,to(to({},u),{},{className:(l?l+" ":"")+"react-resizable",children:[].concat(s.props.children,c.map(function(d){var f,h=(f=i.handleRefs[d])!=null?f:i.handleRefs[d]=zn.createRef();return zn.createElement(vv.DraggableCore,Po({},a,{nodeRef:h,key:"resizableHandle-"+d,onStop:i.resizeHandler("onResizeStop",d),onStart:i.resizeHandler("onResizeStart",d),onDrag:i.resizeHandler("onResize",d)}),i.renderResizeHandle(d,h))}))}))},e}(zn.Component);tr.default=gs;gs.propTypes=Sv.resizableProps;gs.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var hi={};hi.__esModule=!0;hi.default=void 0;var no=Pv(I),Ov=Yu(ci),Dv=Yu(tr),Av=nr,Rv=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Yu(n){return n&&n.__esModule?n:{default:n}}function Gu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Gu=function(i){return i?t:e})(n)}function Pv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Gu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function _o(){return _o=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},_o.apply(this,arguments)}function Ta(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(r){Iv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Iv(n,e,t){return e=_v(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _v(n){var e=zv(n,"string");return typeof e=="symbol"?e:String(e)}function zv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Lv(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Vv(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,zo(n,e)}function zo(n,e){return zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},zo(n,e)}var Xu=function(n){Vv(e,n);function e(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=n.call.apply(n,[this].concat(o))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(l,a){var c=a.size;r.props.onResize?(l.persist==null||l.persist(),r.setState(c,function(){return r.props.onResize&&r.props.onResize(l,a)})):r.setState(c)},r}e.getDerivedStateFromProps=function(i,o){return o.propsWidth!==i.width||o.propsHeight!==i.height?{width:i.width,height:i.height,propsWidth:i.width,propsHeight:i.height}:null};var t=e.prototype;return t.render=function(){var i=this.props,o=i.handle,s=i.handleSize;i.onResize;var l=i.onResizeStart,a=i.onResizeStop,c=i.draggableOpts,u=i.minConstraints,d=i.maxConstraints,f=i.lockAspectRatio,h=i.axis;i.width,i.height;var p=i.resizeHandles,m=i.style,g=i.transformScale,b=Lv(i,Rv);return no.createElement(Dv.default,{axis:h,draggableOpts:c,handle:o,handleSize:s,height:this.state.height,lockAspectRatio:f,maxConstraints:d,minConstraints:u,onResizeStart:l,onResize:this.onResize,onResizeStop:a,resizeHandles:p,transformScale:g,width:this.state.width},no.createElement("div",_o({},b,{style:Wr(Wr({},m),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(no.Component);hi.default=Xu;Xu.propTypes=Wr(Wr({},Av.resizableProps),{},{children:Ov.default.element});us.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};us.exports.Resizable=tr.default;var Bv=us.exports.ResizableBox=hi.default;const $v=({node:n,updateAttributes:e,editor:t})=>{const[r,i]=I.useState({width:n.attrs.width||300,height:n.attrs.height||300}),[o,s]=I.useState({left:n.attrs.marginLeft||0,right:n.attrs.marginRight||0}),[l,a]=I.useState(n.attrs.src||""),c=I.useRef(null);I.useEffect(()=>{if(n.attrs.src&&c.current){const h=new Image;h.onload=()=>{(!n.attrs.width||!n.attrs.height)&&i({width:h.width>600?600:h.width,height:h.width>600?600/h.width*h.height:h.height})},h.src=n.attrs.src}},[n.attrs.src]);const u=(h,{size:p})=>{i({width:p.width,height:p.height}),e({width:p.width,height:p.height})},d=()=>{e({src:l,width:r.width,height:r.height,marginLeft:o.left,marginRight:o.right})},f=h=>{h.preventDefault()};return w.jsxDEV(bu,{className:"image-wrapper",children:w.jsxDEV(_u,{title:"Image",childrenContent:w.jsxDEV("div",{className:"relative",style:{marginLeft:o.left,marginRight:o.right},onContextMenu:f,children:t.isEditable?w.jsxDEV(Bv,{width:r.width,height:r.height,onResize:u,minConstraints:[100,100],maxConstraints:[800,800],lockAspectRatio:!0,className:"relative",children:w.jsxDEV("img",{ref:c,src:n.attrs.src,alt:"Uploaded",className:"object-contain w-full h-full",draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:89,columnNumber:33},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:80,columnNumber:29},void 0):w.jsxDEV("img",{ref:c,src:n.attrs.src,alt:"Uploaded",style:{width:r.width,height:r.height},className:"object-contain",draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:98,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:71,columnNumber:21},void 0),editable:t.isEditable,childrenEdit:w.jsxDEV("div",{className:"space-y-4",children:[w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Image URL"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:116,columnNumber:29},void 0),w.jsxDEV("input",{type:"text",value:l,onChange:h=>a(h.target.value),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:117,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:115,columnNumber:25},void 0),w.jsxDEV("div",{className:"flex gap-2",children:[w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Width"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:128,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:r.width,onChange:h=>i({...r,width:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:129,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:127,columnNumber:29},void 0),w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Height"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:138,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:r.height,onChange:h=>i({...r,height:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:139,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:137,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:126,columnNumber:25},void 0),w.jsxDEV("div",{className:"flex gap-2",children:[w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Margin Left"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:151,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:o.left,onChange:h=>s({...o,left:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:152,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:150,columnNumber:29},void 0),w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Margin Right"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:161,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:o.right,onChange:h=>s({...o,right:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:162,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:160,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:149,columnNumber:25},void 0),w.jsxDEV("button",{onClick:d,className:"w-full p-2 text-white bg-blue-500 rounded hover:bg-blue-600",disabled:!t.isEditable,children:"Update Image"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:172,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:114,columnNumber:21},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:68,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:67,columnNumber:9},void 0)},jv=ce.create({name:"image",group:"block",content:"inline*",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:300},height:{default:300},marginLeft:{default:0},marginRight:{default:0}}},parseHTML(){return[{tag:"img",getAttrs:n=>n instanceof HTMLElement?{src:n.getAttribute("src"),width:Number(n.getAttribute("width"))||300,height:Number(n.getAttribute("height"))||300,marginLeft:Number(n.getAttribute("marginleft"))||0,marginRight:Number(n.getAttribute("marginright"))||0}:null}]},renderHTML({HTMLAttributes:n}){return["img",ie(n)]},addNodeView(){return vu($v)},addCommands(){return{setImage:n=>({chain:e})=>e().insertContent({type:"image",attrs:n}).run()}}}),Fv=[Zy.configure({types:[Kl.name,Su.name]}),Kl,e0.configure({multicolor:!0}),Xb.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),m1,t0,n0,r0,i0.configure({types:["heading","paragraph"]}),o0,l0,u1.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),d1,f1,h1.configure({HTMLAttributes:{class:"table-cell"}}),y1,jv],Hv=({content:n="",slotBefore:e=!1,className:t="",editorClassName:r="",editable:i=!0,onChange:o})=>{const[s,l]=I.useState(!1);I.useEffect(()=>{l(!0)},[]);const a=Tg({extensions:Fv,content:n,editable:i,onUpdate:({editor:c})=>{o&&o(c.getHTML())}});return I.useEffect(()=>{a&&n!==a.getHTML()&&a.commands.setContent(n,!1)},[a,n]),!s||!a?null:w.jsxDEV("div",{className:`cyber-editor-container ${t}`,children:[e&&w.jsxDEV(Gy,{editor:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:42,columnNumber:28},void 0),w.jsxDEV(bg,{editor:a,className:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:43,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:41,columnNumber:9},void 0)};exports.CyberEditorProvider=Hv;
364
+ `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&qu(n.body,"react-draggable-transparent-selection")}function Z1(n){if(n)try{if(n.body&&Uu(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function qu(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(n.className+=" ".concat(e))}function Uu(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.canDragX=tv;bt.canDragY=nv;bt.createCoreData=iv;bt.createDraggableData=ov;bt.getBoundPosition=Q1;bt.getControlPosition=rv;bt.snapToGrid=ev;var Je=yt,xn=he;function Q1(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:sv(r);const i=hs(n);if(typeof r=="string"){const{ownerDocument:o}=i,s=o.defaultView;let l;if(r==="parent"?l=i.parentNode:l=o.querySelector(r),!(l instanceof s.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const a=l,c=s.getComputedStyle(i),u=s.getComputedStyle(a);r={left:-i.offsetLeft+(0,Je.int)(u.paddingLeft)+(0,Je.int)(c.marginLeft),top:-i.offsetTop+(0,Je.int)(u.paddingTop)+(0,Je.int)(c.marginTop),right:(0,xn.innerWidth)(a)-(0,xn.outerWidth)(i)-i.offsetLeft+(0,Je.int)(u.paddingRight)-(0,Je.int)(c.marginRight),bottom:(0,xn.innerHeight)(a)-(0,xn.outerHeight)(i)-i.offsetTop+(0,Je.int)(u.paddingBottom)-(0,Je.int)(c.marginBottom)}}return(0,Je.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Je.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,Je.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Je.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function ev(n,e,t){const r=Math.round(e/n[0])*n[0],i=Math.round(t/n[1])*n[1];return[r,i]}function tv(n){return n.props.axis==="both"||n.props.axis==="x"}function nv(n){return n.props.axis==="both"||n.props.axis==="y"}function rv(n,e,t){const r=typeof e=="number"?(0,xn.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const i=hs(t),o=t.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,xn.offsetXYFromParent)(r||n,o,t.props.scale)}function iv(n,e,t){const r=!(0,Je.isNum)(n.lastX),i=hs(n);return r?{node:i,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:i,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function ov(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function sv(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function hs(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var ui={},di={};Object.defineProperty(di,"__esModule",{value:!0});di.default=lv;function lv(){}Object.defineProperty(ui,"__esModule",{value:!0});ui.default=void 0;var Qi=cv(I),Ue=ps(ci),av=ps(qr),De=he,Tt=bt,eo=yt,zn=ps(di);function ps(n){return n&&n.__esModule?n:{default:n}}function Ku(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Ku=function(r){return r?t:e})(n)}function cv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Ku(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function $e(n,e,t){return e=uv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uv(n){var e=dv(n,"string");return typeof e=="symbol"?e:String(e)}function dv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const st={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Et=st.mouse,fi=class extends Qi.Component{constructor(){super(...arguments),$e(this,"dragging",!1),$e(this,"lastX",NaN),$e(this,"lastY",NaN),$e(this,"touchIdentifier",null),$e(this,"mounted",!1),$e(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,De.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,De.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&e.preventDefault();const i=(0,De.getTouchIdentifier)(e);this.touchIdentifier=i;const o=(0,Tt.getControlPosition)(e,i,this);if(o==null)return;const{x:s,y:l}=o,a=(0,Tt.createCoreData)(this,s,l);(0,zn.default)("DraggableCore: handleDragStart: %j",a),(0,zn.default)("calling",this.props.onStart),!(this.props.onStart(e,a)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,De.addUserSelectStyles)(r),this.dragging=!0,this.lastX=s,this.lastY=l,(0,De.addEvent)(r,Et.move,this.handleDrag),(0,De.addEvent)(r,Et.stop,this.handleDragStop))}),$e(this,"handleDrag",e=>{const t=(0,Tt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX,a=i-this.lastY;if([l,a]=(0,Tt.snapToGrid)(this.props.grid,l,a),!l&&!a)return;r=this.lastX+l,i=this.lastY+a}const o=(0,Tt.createCoreData)(this,r,i);if((0,zn.default)("DraggableCore: handleDrag: %j",o),this.props.onDrag(e,o)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const a=document.createEvent("MouseEvents");a.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(a)}return}this.lastX=r,this.lastY=i}),$e(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,Tt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX||0,c=i-this.lastY||0;[a,c]=(0,Tt.snapToGrid)(this.props.grid,a,c),r=this.lastX+a,i=this.lastY+c}const o=(0,Tt.createCoreData)(this,r,i);if(this.props.onStop(e,o)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,De.removeUserSelectStyles)(l.ownerDocument),(0,zn.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,zn.default)("DraggableCore: Removing handlers"),(0,De.removeEvent)(l.ownerDocument,Et.move,this.handleDrag),(0,De.removeEvent)(l.ownerDocument,Et.stop,this.handleDragStop))}),$e(this,"onMouseDown",e=>(Et=st.mouse,this.handleDragStart(e))),$e(this,"onMouseUp",e=>(Et=st.mouse,this.handleDragStop(e))),$e(this,"onTouchStart",e=>(Et=st.touch,this.handleDragStart(e))),$e(this,"onTouchEnd",e=>(Et=st.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,De.addEvent)(e,st.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,De.removeEvent)(t,st.mouse.move,this.handleDrag),(0,De.removeEvent)(t,st.touch.move,this.handleDrag),(0,De.removeEvent)(t,st.mouse.stop,this.handleDragStop),(0,De.removeEvent)(t,st.touch.stop,this.handleDragStop),(0,De.removeEvent)(e,st.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,De.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(t=this.props)===null||t===void 0||(t=t.nodeRef)===null||t===void 0?void 0:t.current:av.default.findDOMNode(this)}render(){return Qi.cloneElement(Qi.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ui.default=fi;$e(fi,"displayName","DraggableCore");$e(fi,"propTypes",{allowAnyClick:Ue.default.bool,children:Ue.default.node.isRequired,disabled:Ue.default.bool,enableUserSelectHack:Ue.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ue.default.arrayOf(Ue.default.number),handle:Ue.default.string,cancel:Ue.default.string,nodeRef:Ue.default.object,onStart:Ue.default.func,onDrag:Ue.default.func,onStop:Ue.default.func,onMouseDown:Ue.default.func,scale:Ue.default.number,className:eo.dontSetMe,style:eo.dontSetMe,transform:eo.dontSetMe});$e(fi,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return a.default}}),n.default=void 0;var e=f(I),t=u(ci),r=u(qr),i=u(N1),o=he,s=bt,l=yt,a=u(ui),c=u(di);function u(S){return S&&S.__esModule?S:{default:S}}function d(S){if(typeof WeakMap!="function")return null;var x=new WeakMap,k=new WeakMap;return(d=function(v){return v?k:x})(S)}function f(S,x){if(S&&S.__esModule)return S;if(S===null||typeof S!="object"&&typeof S!="function")return{default:S};var k=d(x);if(k&&k.has(S))return k.get(S);var v={},T=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in S)if(A!=="default"&&Object.prototype.hasOwnProperty.call(S,A)){var $=T?Object.getOwnPropertyDescriptor(S,A):null;$&&($.get||$.set)?Object.defineProperty(v,A,$):v[A]=S[A]}return v.default=S,k&&k.set(S,v),v}function h(){return h=Object.assign?Object.assign.bind():function(S){for(var x=1;x<arguments.length;x++){var k=arguments[x];for(var v in k)Object.prototype.hasOwnProperty.call(k,v)&&(S[v]=k[v])}return S},h.apply(this,arguments)}function p(S,x,k){return x=m(x),x in S?Object.defineProperty(S,x,{value:k,enumerable:!0,configurable:!0,writable:!0}):S[x]=k,S}function m(S){var x=g(S,"string");return typeof x=="symbol"?x:String(x)}function g(S,x){if(typeof S!="object"||S===null)return S;var k=S[Symbol.toPrimitive];if(k!==void 0){var v=k.call(S,x||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(S)}class b extends e.Component{static getDerivedStateFromProps(x,k){let{position:v}=x,{prevPropsPosition:T}=k;return v&&(!T||v.x!==T.x||v.y!==T.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:v,prevPropsPosition:T}),{x:v.x,y:v.y,prevPropsPosition:{...v}}):null}constructor(x){super(x),p(this,"onDragStart",(k,v)=>{if((0,c.default)("Draggable: onDragStart: %j",v),this.props.onStart(k,(0,s.createDraggableData)(this,v))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(k,v)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",v);const T=(0,s.createDraggableData)(this,v),A={x:T.x,y:T.y,slackX:0,slackY:0};if(this.props.bounds){const{x:_,y:oe}=A;A.x+=this.state.slackX,A.y+=this.state.slackY;const[ge,Me]=(0,s.getBoundPosition)(this,A.x,A.y);A.x=ge,A.y=Me,A.slackX=this.state.slackX+(_-A.x),A.slackY=this.state.slackY+(oe-A.y),T.x=A.x,T.y=A.y,T.deltaX=A.x-this.state.x,T.deltaY=A.y-this.state.y}if(this.props.onDrag(k,T)===!1)return!1;this.setState(A)}),p(this,"onDragStop",(k,v)=>{if(!this.state.dragging||this.props.onStop(k,(0,s.createDraggableData)(this,v))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",v);const A={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:_,y:oe}=this.props.position;A.x=_,A.y=oe}this.setState(A)}),this.state={dragging:!1,dragged:!1,x:x.position?x.position.x:x.defaultPosition.x,y:x.position?x.position.y:x.defaultPosition.y,prevPropsPosition:{...x.position},slackX:0,slackY:0,isElementSVG:!1},x.position&&!(x.onDrag||x.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var x,k;return(x=(k=this.props)===null||k===void 0||(k=k.nodeRef)===null||k===void 0?void 0:k.current)!==null&&x!==void 0?x:r.default.findDOMNode(this)}render(){const{axis:x,bounds:k,children:v,defaultPosition:T,defaultClassName:A,defaultClassNameDragging:$,defaultClassNameDragged:_,position:oe,positionOffset:ge,scale:Me,...ye}=this.props;let pe={},We=null;const Te=!!!oe||this.state.dragging,ut=oe||T,vt={x:(0,s.canDragX)(this)&&Te?this.state.x:ut.x,y:(0,s.canDragY)(this)&&Te?this.state.y:ut.y};this.state.isElementSVG?We=(0,o.createSVGTransform)(vt,ge):pe=(0,o.createCSSTransform)(vt,ge);const E=(0,i.default)(v.props.className||"",A,{[$]:this.state.dragging,[_]:this.state.dragged});return e.createElement(a.default,h({},ye,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(v),{className:E,style:{...v.props.style,...pe},transform:We}))}}n.default=b,p(b,"displayName","Draggable"),p(b,"propTypes",{...a.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(b,"defaultProps",{...a.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(zu);const{default:Ju,DraggableCore:fv}=zu;ai.exports=Ju;ai.exports.default=Ju;ai.exports.DraggableCore=fv;var hv=ai.exports,ms={};ms.__esModule=!0;ms.cloneElement=vv;var pv=mv(I);function mv(n){return n&&n.__esModule?n:{default:n}}function Ta(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ea(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(r){gv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gv(n,e,t){return e=yv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yv(n){var e=bv(n,"string");return typeof e=="symbol"?e:String(e)}function bv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vv(n,e){return e.style&&n.props.style&&(e.style=Ea(Ea({},n.props.style),e.style)),e.className&&n.props.className&&(e.className=n.props.className+" "+e.className),pv.default.cloneElement(n,e)}var ir={};ir.__esModule=!0;ir.resizableProps=void 0;var V=Sv(ci);function Sv(n){return n&&n.__esModule?n:{default:n}}var xv={axis:V.default.oneOf(["both","x","y","none"]),className:V.default.string,children:V.default.element.isRequired,draggableOpts:V.default.shape({allowAnyClick:V.default.bool,cancel:V.default.string,children:V.default.node,disabled:V.default.bool,enableUserSelectHack:V.default.bool,offsetParent:V.default.node,grid:V.default.arrayOf(V.default.number),handle:V.default.string,nodeRef:V.default.object,onStart:V.default.func,onDrag:V.default.func,onStop:V.default.func,onMouseDown:V.default.func,scale:V.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0];if(i.axis==="both"||i.axis==="y"){var o;return(o=V.default.number).isRequired.apply(o,t)}return V.default.number.apply(V.default,t)},handle:V.default.oneOfType([V.default.node,V.default.func]),handleSize:V.default.arrayOf(V.default.number),lockAspectRatio:V.default.bool,maxConstraints:V.default.arrayOf(V.default.number),minConstraints:V.default.arrayOf(V.default.number),onResizeStop:V.default.func,onResizeStart:V.default.func,onResize:V.default.func,resizeHandles:V.default.arrayOf(V.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:V.default.number,width:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0];if(i.axis==="both"||i.axis==="x"){var o;return(o=V.default.number).isRequired.apply(o,t)}return V.default.number.apply(V.default,t)}};ir.resizableProps=xv;rr.__esModule=!0;rr.default=void 0;var Bn=Tv(I),wv=hv,kv=ms,Cv=ir,Mv=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Yu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Yu=function(i){return i?t:e})(n)}function Tv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Yu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function Po(){return Po=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Po.apply(this,arguments)}function Ev(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function to(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(r){Ov(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ov(n,e,t){return e=Av(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Av(n){var e=Nv(n,"string");return typeof e=="symbol"?e:String(e)}function Nv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rv(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,Io(n,e)}function Io(n,e){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Io(n,e)}var gs=function(n){Rv(e,n);function e(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=n.call.apply(n,[this].concat(o))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var t=e.prototype;return t.componentWillUnmount=function(){this.resetData()},t.resetData=function(){this.lastHandleRect=this.slack=null},t.runConstraints=function(i,o){var s=this.props,l=s.minConstraints,a=s.maxConstraints,c=s.lockAspectRatio;if(!l&&!a&&!c)return[i,o];if(c){var u=this.props.width/this.props.height,d=i-this.props.width,f=o-this.props.height;Math.abs(d)>Math.abs(f*u)?o=i/u:i=o*u}var h=i,p=o,m=this.slack||[0,0],g=m[0],b=m[1];return i+=g,o+=b,l&&(i=Math.max(l[0],i),o=Math.max(l[1],o)),a&&(i=Math.min(a[0],i),o=Math.min(a[1],o)),this.slack=[g+(h-i),b+(p-o)],[i,o]},t.resizeHandler=function(i,o){var s=this;return function(l,a){var c=a.node,u=a.deltaX,d=a.deltaY;i==="onResizeStart"&&s.resetData();var f=(s.props.axis==="both"||s.props.axis==="x")&&o!=="n"&&o!=="s",h=(s.props.axis==="both"||s.props.axis==="y")&&o!=="e"&&o!=="w";if(!(!f&&!h)){var p=o[0],m=o[o.length-1],g=c.getBoundingClientRect();if(s.lastHandleRect!=null){if(m==="w"){var b=g.left-s.lastHandleRect.left;u+=b}if(p==="n"){var S=g.top-s.lastHandleRect.top;d+=S}}s.lastHandleRect=g,m==="w"&&(u=-u),p==="n"&&(d=-d);var x=s.props.width+(f?u/s.props.transformScale:0),k=s.props.height+(h?d/s.props.transformScale:0),v=s.runConstraints(x,k);x=v[0],k=v[1];var T=x!==s.props.width||k!==s.props.height,A=typeof s.props[i]=="function"?s.props[i]:null,$=i==="onResize"&&!T;A&&!$&&(l.persist==null||l.persist(),A(l,{node:c,size:{width:x,height:k},handle:o})),i==="onResizeStop"&&s.resetData()}}},t.renderResizeHandle=function(i,o){var s=this.props.handle;if(!s)return Bn.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+i,ref:o});if(typeof s=="function")return s(i,o);var l=typeof s.type=="string",a=to({ref:o},l?{}:{handleAxis:i});return Bn.cloneElement(s,a)},t.render=function(){var i=this,o=this.props,s=o.children,l=o.className,a=o.draggableOpts;o.width,o.height,o.handle,o.handleSize,o.lockAspectRatio,o.axis,o.minConstraints,o.maxConstraints,o.onResize,o.onResizeStop,o.onResizeStart;var c=o.resizeHandles;o.transformScale;var u=Ev(o,Mv);return(0,kv.cloneElement)(s,to(to({},u),{},{className:(l?l+" ":"")+"react-resizable",children:[].concat(s.props.children,c.map(function(d){var f,h=(f=i.handleRefs[d])!=null?f:i.handleRefs[d]=Bn.createRef();return Bn.createElement(wv.DraggableCore,Po({},a,{nodeRef:h,key:"resizableHandle-"+d,onStop:i.resizeHandler("onResizeStop",d),onStart:i.resizeHandler("onResizeStart",d),onDrag:i.resizeHandler("onResize",d)}),i.renderResizeHandle(d,h))}))}))},e}(Bn.Component);rr.default=gs;gs.propTypes=Cv.resizableProps;gs.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var hi={};hi.__esModule=!0;hi.default=void 0;var no=Lv(I),Dv=Gu(ci),Pv=Gu(rr),Iv=ir,_v=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Gu(n){return n&&n.__esModule?n:{default:n}}function Xu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Xu=function(i){return i?t:e})(n)}function Lv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Xu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function _o(){return _o=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},_o.apply(this,arguments)}function Aa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Aa(Object(t),!0).forEach(function(r){zv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zv(n,e,t){return e=Bv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bv(n){var e=$v(n,"string");return typeof e=="symbol"?e:String(e)}function $v(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function jv(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Fv(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,Lo(n,e)}function Lo(n,e){return Lo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Lo(n,e)}var Zu=function(n){Fv(e,n);function e(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=n.call.apply(n,[this].concat(o))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(l,a){var c=a.size;r.props.onResize?(l.persist==null||l.persist(),r.setState(c,function(){return r.props.onResize&&r.props.onResize(l,a)})):r.setState(c)},r}e.getDerivedStateFromProps=function(i,o){return o.propsWidth!==i.width||o.propsHeight!==i.height?{width:i.width,height:i.height,propsWidth:i.width,propsHeight:i.height}:null};var t=e.prototype;return t.render=function(){var i=this.props,o=i.handle,s=i.handleSize;i.onResize;var l=i.onResizeStart,a=i.onResizeStop,c=i.draggableOpts,u=i.minConstraints,d=i.maxConstraints,f=i.lockAspectRatio,h=i.axis;i.width,i.height;var p=i.resizeHandles,m=i.style,g=i.transformScale,b=jv(i,_v);return no.createElement(Pv.default,{axis:h,draggableOpts:c,handle:o,handleSize:s,height:this.state.height,lockAspectRatio:f,maxConstraints:d,minConstraints:u,onResizeStart:l,onResize:this.onResize,onResizeStop:a,resizeHandles:p,transformScale:g,width:this.state.width},no.createElement("div",_o({},b,{style:Wr(Wr({},m),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(no.Component);hi.default=Zu;Zu.propTypes=Wr(Wr({},Iv.resizableProps),{},{children:Dv.default.element});us.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};us.exports.Resizable=rr.default;var Hv=us.exports.ResizableBox=hi.default;const Vv=({node:n,updateAttributes:e,editor:t})=>{const[r,i]=I.useState({width:n.attrs.width||300,height:n.attrs.height||300}),[o,s]=I.useState({left:n.attrs.marginLeft||0,right:n.attrs.marginRight||0}),[l,a]=I.useState(n.attrs.src||""),c=I.useRef(null);I.useEffect(()=>{if(n.attrs.src&&c.current){const h=new Image;h.onload=()=>{(!n.attrs.width||!n.attrs.height)&&i({width:h.width>600?600:h.width,height:h.width>600?600/h.width*h.height:h.height})},h.src=n.attrs.src}},[n.attrs.src]);const u=(h,{size:p})=>{i({width:p.width,height:p.height}),e({width:p.width,height:p.height})},d=()=>{e({src:l,width:r.width,height:r.height,marginLeft:o.left,marginRight:o.right})},f=h=>{h.preventDefault()};return w.jsx(vu,{className:"image-wrapper",children:w.jsx(Lu,{title:"Image",childrenContent:w.jsx("div",{className:"relative",style:{marginLeft:o.left,marginRight:o.right},onContextMenu:f,children:t.isEditable?w.jsx(Hv,{width:r.width,height:r.height,onResize:u,minConstraints:[100,100],maxConstraints:[800,800],lockAspectRatio:!0,className:"relative",children:w.jsx("img",{ref:c,src:n.attrs.src,alt:"Uploaded",className:"object-contain w-full h-full",draggable:!1})}):w.jsx("img",{ref:c,src:n.attrs.src,alt:"Uploaded",style:{width:r.width,height:r.height},className:"object-contain",draggable:!1})}),editable:t.isEditable,childrenEdit:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{children:[w.jsx("label",{className:"block text-sm font-medium",children:"Image URL"}),w.jsx("input",{type:"text",value:l,onChange:h=>a(h.target.value),className:"w-full p-2 border rounded",disabled:!t.isEditable})]}),w.jsxs("div",{className:"flex gap-2",children:[w.jsxs("div",{children:[w.jsx("label",{className:"block text-sm font-medium",children:"Width"}),w.jsx("input",{type:"number",value:r.width,onChange:h=>i({...r,width:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable})]}),w.jsxs("div",{children:[w.jsx("label",{className:"block text-sm font-medium",children:"Height"}),w.jsx("input",{type:"number",value:r.height,onChange:h=>i({...r,height:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable})]})]}),w.jsxs("div",{className:"flex gap-2",children:[w.jsxs("div",{children:[w.jsx("label",{className:"block text-sm font-medium",children:"Margin Left"}),w.jsx("input",{type:"number",value:o.left,onChange:h=>s({...o,left:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable})]}),w.jsxs("div",{children:[w.jsx("label",{className:"block text-sm font-medium",children:"Margin Right"}),w.jsx("input",{type:"number",value:o.right,onChange:h=>s({...o,right:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable})]})]}),w.jsx("button",{onClick:d,className:"w-full p-2 text-white bg-blue-500 rounded hover:bg-blue-600",disabled:!t.isEditable,children:"Update Image"})]})})})},Wv=ce.create({name:"image",group:"block",content:"inline*",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:300},height:{default:300},marginLeft:{default:0},marginRight:{default:0}}},parseHTML(){return[{tag:"img",getAttrs:n=>n instanceof HTMLElement?{src:n.getAttribute("src"),width:Number(n.getAttribute("width"))||300,height:Number(n.getAttribute("height"))||300,marginLeft:Number(n.getAttribute("marginleft"))||0,marginRight:Number(n.getAttribute("marginright"))||0}:null}]},renderHTML({HTMLAttributes:n}){return["img",ie(n)]},addNodeView(){return Su(Vv)},addCommands(){return{setImage:n=>({chain:e})=>e().insertContent({type:"image",attrs:n}).run()}}}),qv=[tb.configure({types:[Jl.name,wu.name]}),Jl,r0.configure({multicolor:!0}),e0.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),b1,i0,o0,s0,l0.configure({types:["heading","paragraph"]}),a0,u0,h1.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),p1,m1,g1.configure({HTMLAttributes:{class:"table-cell"}}),S1,Wv],Uv=({content:n="",slotBefore:e=!1,className:t="",editorClassName:r="",editable:i=!0,onChange:o})=>{const[s,l]=I.useState(!1);I.useEffect(()=>{l(!0)},[]);const a=Rg({extensions:qv,content:n,editable:i,onUpdate:({editor:c})=>{o&&o(c.getHTML())}});return I.useEffect(()=>{a&&n!==a.getHTML()&&a.commands.setContent(n,!1)},[a,n]),!s||!a?null:w.jsxs("div",{className:`cyber-editor-container ${t}`,children:[e&&w.jsx(Qy,{editor:a}),w.jsx(xg,{editor:a,className:r})]})};exports.CyberEditorProvider=Uv;
367
365
  //# sourceMappingURL=cyber-editor.cjs.js.map