@cyberskill/cyber-editor 3.6.0 → 3.6.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,45 +1,46 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),Hr=require("react-dom"),ft=require("antd");function Sd(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 Qi={exports:{}},Pn={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react"),$r=require("react-dom"),lt=require("antd");function _u(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 qi={exports:{}},An={};/**
2
2
  * @license React
3
- * react-jsx-runtime.production.min.js
3
+ * react-jsx-runtime.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and 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 As;function xd(){if(As)return Pn;As=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 Pn.Fragment=t,Pn.jsx=s,Pn.jsxs=s,Pn}var In={};/**
9
+ */var ds;function zu(){if(ds)return An;ds=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,i,o){var s=null;if(o!==void 0&&(s=""+o),i.key!==void 0&&(s=""+i.key),"key"in i){o={};for(var l in i)l!=="key"&&(o[l]=i[l])}else o=i;return i=o.ref,{$$typeof:n,type:r,key:s,ref:i!==void 0?i:null,props:o}}return An.Fragment=e,An.jsx=t,An.jsxs=t,An}var Rn={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and 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 Ns;function wd(){return Ns||(Ns=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 ve(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:ve(y.type)||"Memo";case f:{var te=y,se=te._payload,Z=te._init;try{return ve(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,ye=Be.length-1;me>=1&&ye>=0&&G[me]!==Be[ye];)ye--;for(;me>=1&&ye>=0;me--,ye--)if(G[me]!==Be[ye]){if(me!==1||ye!==1)do if(me--,ye--,ye<0||G[me]!==Be[ye]){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&&ye>=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,ms={},gs=b.ReactDebugCurrentFrame;function ir(y){if(y){var M=y._owner,R=qt(y.type,y._source,M?M.type:null);gs.setExtraStackFrame(R)}else gs.setExtraStackFrame(null)}function Zu(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)&&(ir(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),ir(null)),G instanceof Error&&!(G.message in ms)&&(ms[G.message]=!0,ir(te),S("Failed %s type: %s",R,G.message),ir(null))}}}var Qu=Array.isArray;function di(y){return Qu(y)}function ed(y){{var M=typeof Symbol=="function"&&Symbol.toStringTag,R=M&&y[Symbol.toStringTag]||y.constructor.name||"Object";return R}}function td(y){try{return ys(y),!1}catch{return!0}}function ys(y){return""+y}function bs(y){if(td(y))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ed(y)),ys(y)}var vs=b.ReactCurrentOwner,nd={key:!0,ref:!0,__self:!0,__source:!0},Ss,xs;function rd(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 id(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 od(y,M){typeof y.ref=="string"&&vs.current}function sd(y,M){{var R=function(){Ss||(Ss=!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 ld(y,M){{var R=function(){xs||(xs=!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 ad=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 cd(y,M,R,j,te){{var se,Z={},G=null,Be=null;R!==void 0&&(bs(R),G=""+R),id(M)&&(bs(M.key),G=""+M.key),rd(M)&&(Be=M.ref,od(M,te));for(se in M)Dn.call(M,se)&&!nd.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 ye=typeof y=="function"?y.displayName||y.name||"Unknown":y;G&&sd(Z,ye),Be&&ld(Z,ye)}return ad(y,G,Be,te,j,vs.current,Z)}}var fi=b.ReactCurrentOwner,ws=b.ReactDebugCurrentFrame;function hn(y){if(y){var M=y._owner,R=qt(y.type,y._source,M?M.type:null);ws.setExtraStackFrame(R)}else ws.setExtraStackFrame(null)}var hi;hi=!1;function pi(y){return typeof y=="object"&&y!==null&&y.$$typeof===e}function ks(){{if(fi.current){var y=ve(fi.current.type);if(y)return`
22
-
23
- Check the render method of \``+y+"`."}return""}}function ud(y){return""}var Cs={};function dd(y){{var M=ks();if(!M){var R=typeof y=="string"?y:y.displayName||y.name;R&&(M=`
24
-
25
- Check the top-level render call using <`+R+">.")}return M}}function Ms(y,M){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var R=dd(M);if(Cs[R])return;Cs[R]=!0;var j="";y&&y._owner&&y._owner!==fi.current&&(j=" It was passed a child from "+ve(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 Ts(y,M){{if(typeof y!="object")return;if(di(y))for(var R=0;R<y.length;R++){var j=y[R];pi(j)&&Ms(j,M)}else if(pi(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;)pi(Z.value)&&Ms(Z.value,M)}}}function fd(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=ve(M);Zu(R,y.props,"prop",j,y)}else if(M.PropTypes!==void 0&&!hi){hi=!0;var te=ve(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 hd(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 Es={};function Os(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=ud();Be?G+=Be:G+=ks();var me;y===null?me="null":di(y)?me="array":y!==void 0&&y.$$typeof===e?(me="<"+(ve(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 ye=cd(y,M,R,te,se);if(ye==null)return ye;if(Z){var nt=M.children;if(nt!==void 0)if(j)if(di(nt)){for(var pn=0;pn<nt.length;pn++)Ts(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 Ts(nt,y)}if(Dn.call(M,"key")){var Ut=ve(y),qe=Object.keys(M).filter(function(vd){return vd!=="key"}),mi=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!Es[Ut+mi]){var bd=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
17
+ */var fs;function Lu(){return fs||(fs=1,process.env.NODE_ENV!=="production"&&function(){function n(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===pt?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case M:return"Fragment";case S:return"Portal";case $:return"Profiler";case O:return"StrictMode";case pe:return"Suspense";case Fe:return"SuspenseList"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case re:return(y.displayName||"Context")+".Provider";case P:return(y._context.displayName||"Context")+".Consumer";case ae:var I=y.render;return y=y.displayName,y||(y=I.displayName||I.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case Se:return I=y.displayName||null,I!==null?I:n(y.type)||"Memo";case Ze:I=y._payload,y=y._init;try{return n(y(I))}catch{}}return null}function e(y){return""+y}function t(y){try{e(y);var I=!1}catch{I=!0}if(I){I=console;var _=I.error,Q=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return _.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Q),e(y)}}function r(){}function i(){if(j===0){J=console.log,F=console.info,U=console.warn,Y=console.error,Z=console.group,G=console.groupCollapsed,we=console.groupEnd;var y={configurable:!0,enumerable:!0,value:r,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}j++}function o(){if(j--,j===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},y,{value:J}),info:A({},y,{value:F}),warn:A({},y,{value:U}),error:A({},y,{value:Y}),group:A({},y,{value:Z}),groupCollapsed:A({},y,{value:G}),groupEnd:A({},y,{value:we})})}0>j&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function s(y){if(N===void 0)try{throw Error()}catch(_){var I=_.stack.trim().match(/\n( *(at )?)/);N=I&&I[1]||"",We=-1<_.stack.indexOf(`
18
+ at`)?" (<anonymous>)":-1<_.stack.indexOf("@")?"@unknown:0:0":""}return`
19
+ `+N+y+We}function l(y,I){if(!y||kt)return"";var _=un.get(y);if(_!==void 0)return _;kt=!0,_=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var Q=null;Q=je.H,je.H=null,i();try{var Te={DetermineComponentFrameRoot:function(){try{if(I){var Ct=function(){throw Error()};if(Object.defineProperty(Ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ct,[])}catch(gt){var tr=gt}Reflect.construct(y,[],Ct)}else{try{Ct.call()}catch(gt){tr=gt}y.call(Ct.prototype)}}else{try{throw Error()}catch(gt){tr=gt}(Ct=y())&&typeof Ct.catch=="function"&&Ct.catch(function(){})}}catch(gt){if(gt&&tr&&typeof gt.stack=="string")return[gt.stack,tr.stack]}return[null,null]}};Te.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var se=Object.getOwnPropertyDescriptor(Te.DetermineComponentFrameRoot,"name");se&&se.configurable&&Object.defineProperty(Te.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var W=Te.DetermineComponentFrameRoot(),mt=W[0],dn=W[1];if(mt&&dn){var Ie=mt.split(`
20
+ `),Wt=dn.split(`
21
+ `);for(W=se=0;se<Ie.length&&!Ie[se].includes("DetermineComponentFrameRoot");)se++;for(;W<Wt.length&&!Wt[W].includes("DetermineComponentFrameRoot");)W++;if(se===Ie.length||W===Wt.length)for(se=Ie.length-1,W=Wt.length-1;1<=se&&0<=W&&Ie[se]!==Wt[W];)W--;for(;1<=se&&0<=W;se--,W--)if(Ie[se]!==Wt[W]){if(se!==1||W!==1)do if(se--,W--,0>W||Ie[se]!==Wt[W]){var Nn=`
22
+ `+Ie[se].replace(" at new "," at ");return y.displayName&&Nn.includes("<anonymous>")&&(Nn=Nn.replace("<anonymous>",y.displayName)),typeof y=="function"&&un.set(y,Nn),Nn}while(1<=se&&0<=W);break}}}finally{kt=!1,je.H=Q,o(),Error.prepareStackTrace=_}return Ie=(Ie=y?y.displayName||y.name:"")?s(Ie):"",typeof y=="function"&&un.set(y,Ie),Ie}function a(y){if(y==null)return"";if(typeof y=="function"){var I=y.prototype;return l(y,!(!I||!I.isReactComponent))}if(typeof y=="string")return s(y);switch(y){case pe:return s("Suspense");case Fe:return s("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case ae:return y=l(y.render,!1),y;case Se:return a(y.type);case Ze:I=y._payload,y=y._init;try{return a(y(I))}catch{}}return""}function c(){var y=je.A;return y===null?null:y.getOwner()}function u(y){if(E.call(y,"key")){var I=Object.getOwnPropertyDescriptor(y,"key").get;if(I&&I.isReactWarning)return!1}return y.key!==void 0}function d(y,I){function _(){ls||(ls=!0,console.error("%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://react.dev/link/special-props)",I))}_.isReactWarning=!0,Object.defineProperty(y,"key",{get:_,configurable:!0})}function f(){var y=n(this.type);return as[y]||(as[y]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),y=this.props.ref,y!==void 0?y:null}function h(y,I,_,Q,Te,se){return _=se.ref,y={$$typeof:k,type:y,key:I,props:se,_owner:Te},(_!==void 0?_:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:f}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function p(y,I,_,Q,Te,se){if(typeof y=="string"||typeof y=="function"||y===M||y===$||y===O||y===pe||y===Fe||y===xe||typeof y=="object"&&y!==null&&(y.$$typeof===Ze||y.$$typeof===Se||y.$$typeof===re||y.$$typeof===P||y.$$typeof===ae||y.$$typeof===K||y.getModuleId!==void 0)){var W=I.children;if(W!==void 0)if(Q)if(V(W)){for(Q=0;Q<W.length;Q++)m(W[Q],y);Object.freeze&&Object.freeze(W)}else console.error("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 m(W,y)}else W="",(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(W+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),y===null?Q="null":V(y)?Q="array":y!==void 0&&y.$$typeof===k?(Q="<"+(n(y.type)||"Unknown")+" />",W=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof y,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,W);if(E.call(I,"key")){W=n(y);var mt=Object.keys(I).filter(function(Ie){return Ie!=="key"});Q=0<mt.length?"{key: someKey, "+mt.join(": ..., ")+": ...}":"{key: someKey}",cs[W+Q]||(mt=0<mt.length?"{"+mt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
26
23
  let props = %s;
27
24
  <%s {...props} />
28
25
  React keys must be passed directly to JSX without using spread:
29
26
  let props = %s;
30
- <%s key={someKey} {...props} />`,mi,Ut,bd,Ut),Es[Ut+mi]=!0}}return y===r?hd(ye):fd(ye),ye}}function pd(y,M,R){return Os(y,M,R,!0)}function md(y,M,R){return Os(y,M,R,!1)}var gd=md,yd=pd;In.Fragment=r,In.jsx=gd,In.jsxs=yd}()),In}process.env.NODE_ENV==="production"?Qi.exports=xd():Qi.exports=wd();var w=Qi.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 or(0,e);if(e==this.size)return or(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?or(r+1,s):or(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 gi={index:0,offset:0};function or(n,e){return gi.index=n,gi.offset=e,gi}function Mr(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(!Mr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Mr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let le=class eo{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&&Mr(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 eo.none;if(e instanceof eo)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};le.none=[];class Tr 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 kd(n,e,t){if(t.openStart>n.depth)throw new Tr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Tr("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}=Cd(t,n);return Qt(o,za(n,s,l,e,r))}else return Qt(o,Er(n,e,r))}function _a(n,e){if(!e.type.compatibleContent(n.type))throw new Tr("Cannot join "+e.type.name+" onto "+n.type.name)}function to(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 Fn(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 za(n,e,t,r,i){let o=n.depth>i&&to(n,e,i+1),s=r.depth>i&&to(t,r,i+1),l=[];return Fn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(_a(o,s),Zt(Qt(o,za(n,e,t,r,i+1)),l)):(o&&Zt(Qt(o,Er(n,e,i+1)),l),Fn(e,t,i,l),s&&Zt(Qt(s,Er(t,r,i+1)),l)),Fn(r,null,i,l),new C(l)}function Er(n,e,t){let r=[];if(Fn(null,n,t,r),n.depth>t){let i=to(n,e,t+1);Zt(Qt(i,Er(n,e,t+1)),r)}return Fn(e,null,t,r),new C(r)}function Cd(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=Rs.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 Rs.set(e,r=new Md);let i=r.elts[r.i]=Wn.resolve(e,t);return r.i=(r.i+1)%Td,i}}class Md{constructor(){this.elts=[],this.i=0}}const Td=12,Rs=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 no{constructor(e,t,r,i=le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,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&&Mr(this.attrs,t||e.defaultAttrs||Ed)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new no(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new no(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 kd(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()+")"),La(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 Ar 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):La(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 Ar(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ar(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 La(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 Od(e,t);if(r.next==null)return rn.empty;let i=Ba(r);r.next&&r.err("Unexpected trailing text");let o=_d(Id(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 Od{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(Ad(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ad(n){let e=[];do e.push(Nd(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Nd(n){let e=Pd(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=Rd(n,e);else break;return e}function Ds(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Rd(n,e){let t=Ds(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ds(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 Pd(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=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 Id(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 Ps(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 _d(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($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 Bd(n,r,e[r]);return t}let Is=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 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){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 Ld(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 Bd{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Ld(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Vr{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 Vr(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=Is.compile(this.spec.nodes,this),this.marks=Vr.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 Ar(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 $d(n){return n.tag!=null}function jd(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($d(i))this.tags.push(i);else if(jd(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),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(Vd(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=Bs(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=Bs(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 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},Fd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ka={ol:!0,ul:!0},qn=1,ro=2,br=4;function zs(n,e,t){return e!=null?(e?qn:0)|(e==="full"?ro:0):n&&n.whitespace=="pre"?qn|ro:t&-5}class sr{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&br?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&qn)){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 Ls{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=zs(null,t.preserveWhitespace,0)|(r?br:0);i?o=new sr(i.type,i.attrs,le.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new sr(null,null,le.none,!0,null,s):o=new sr(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,o=i.options&ro?"full":this.localPreserveWS||(i.options&qn)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
32
- `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],l=e.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.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=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Ka.hasOwnProperty(s)&&this.parser.normalizeLists&&Hd(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Fd.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Ua.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}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):$s(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&br&&s.content.length==0&&(l|=br);let a=le.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):$s(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new sr(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;this.localPreserveWS&&(this.nodes[t].options|=qn)}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 Hd(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 Vd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Bs(n){let e={};for(let t in n)e[t]=n[t];return e}function $s(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=yi(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}=vr(yi(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&&vr(yi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return vr(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=js(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return js(e.marks)}}function js(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function yi(n){return n.document||window.document}const Fs=new WeakMap;function Wd(n){let e=Fs.get(n);return e===void 0&&Fs.set(n,e=qd(n)),e}function qd(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 vr(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=Wd(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}=vr(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 Ud(n,e){return n+e*Ya}function Hs(n){return n&Ja}function Kd(n){return(n-(n&Ja))/Ya}const Ga=1,Xa=2,Sr=4,Za=8;class io{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|Sr))>0}get deletedAfter(){return(this.delInfo&(Xa|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=Hs(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+Kd(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:Ud(l/3,e-a),m=e==a?Xa:e==d?Ga:Sr;return(t<0?e!=a:e!=d)&&(m|=Za),new io(h,m,p)}i+=u-c}return r?e+i:new io(e+i,0,null)}touches(e,t){let r=0,i=Hs(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 Un{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Un(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),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 Un;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 io(e,i,null)}}const bi=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=bi[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 bi)throw new RangeError("Duplicate use of step JSON ID "+e);return bi[e]=t,t.prototype.jsonID=e,t}}class be{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new be(e,null)}static fail(e){return new be(null,e)}static fromReplace(e,t,r,i){try{return be.ok(e.replace(t,r,i))}catch(o){if(o instanceof Tr)return be.fail(o.message);throw o}}}function Io(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Io(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 O(Io(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 be.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 O(Io(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return be.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 be.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return be.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 Cn(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 Cn extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return be.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return be.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 Cn(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 Cn(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("removeNodeMark",Cn);class xe 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&&oo(e,this.from,this.to)?be.fail("Structure replace would overwrite content"):be.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)}}ze.jsonID("replace",xe);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&&(oo(e,this.from,this.gapFrom)||oo(e,this.gapTo,this.to)))return be.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return be.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?be.fromReplace(e,this.from,this.to,r):be.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)}}ze.jsonID("replaceAround",we);function oo(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 Jd(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 Yd(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 Vr){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 _o(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 Gd(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||!Gd(i,o,s))break}return null}function Xd(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 zo(n,e,t=null,r=n){let i=Zd(n,e),o=i&&Qd(r,e);return o?i.map(Vs).concat({type:e,attrs:t}).concat(o.map(Vs)):null}function Vs(n){return{type:n,attrs:null}}function Zd(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 Qd(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 ef(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 tf(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)&&nf(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),_o(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 nf(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function rf(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 of(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 sf(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&&sf(n,e))}function Wr(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 lf(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&&_o(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 af(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 qr(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 cf(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 cf{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=vi(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=vi(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=vi(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new O(Bn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new O(Bn(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=$n(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(Bn(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new O(Bn(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||!Si(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=Si(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Si(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=$n(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=$n(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=$n(this.placed,this.frontier.length,t))}}function Bn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Bn(n.firstChild.content,e-1,t)))}function $n(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy($n(n.lastChild.content,e-1,t)))}function vi(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 Si(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&&!uf(t,o.content,s)?l:null}function uf(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function df(n){return n.spec.defining||n.spec.definingForContent}function ff(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=df(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 hf(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=af(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new O(C.from(r),0,0))}function pf(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 wn 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 be.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 be.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 wn(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 wn(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 wn(t.pos,t.attr,t.value)}}ze.jsonID("attr",wn);class Kn 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 be.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)}}ze.jsonID("docAttr",Kn);let Mn=class extends Error{};Mn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Mn.prototype=Object.create(Error.prototype);Mn.prototype.constructor=Mn;Mn.prototype.name="TransformError";class lc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Un}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Mn(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=qr(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 ff(this,e,t,r),this}replaceRangeWith(e,t,r){return hf(this,e,t,r),this}deleteRange(e,t){return pf(this,e,t),this}lift(e,t){return Xd(this,e,t),this}join(e,t=1){return lf(this,e,t),this}wrap(e,t){return ef(this,e,t),this}setBlockType(e,t=e,r,i=null){return tf(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return rf(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new wn(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 Cn(e,t)),this}split(e,t=1,r){return of(this,e,t,r),this}addMark(e,t,r){return Jd(this,e,t,r),this}removeMark(e,t,r){return Yd(this,e,t,r),this}clearIncompatible(e,t,r){return _o(this,e,t,r),this}}const xi=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&&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=xi[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 xi)throw new RangeError("Duplicate use of selection JSON ID "+e);return xi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class ac{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 B{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 B.near(r);let i=e.resolve(t.map(this.anchor));return new L(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 L&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ur(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=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 L(e,t)}}B.jsonID("text",L);class Ur{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ur(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}}class z 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 z(o)}content(){return new O(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 Lo(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;B.jsonID("node",z);class Lo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Ur(r,r):new Lo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&z.isSelectable(r)?new z(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 mf}}B.jsonID("all",Xe);const mf={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 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 Ks=1,Js=2,Ys=4;class gf 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|Ks)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ks)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Js,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&Js)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&-3,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 jn{constructor(e,t,r){this.name=e,this.init=Gs(t.init,r),this.apply=Gs(t.apply,r)}}const yf=[new jn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new jn("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new jn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new jn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class wi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=yf.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 jn(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 gf(this)}static create(e){let t=new wi(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 wi(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 wi(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=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 Le{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 ki=Object.create(null);function uc(n){return n in ki?n+"$"+ ++ki[n]:(ki[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},Tn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let so=null;const wt=function(n,e,t){let r=so||(so=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},bf=function(){so=null},on=function(n,e,t,r){return t&&(Xs(n,e,t,r,-1)||Xs(n,e,t,r,1))},vf=/^(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||Qn(n)||vf.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 Sf(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&&!Qn(n))e=Oe(n),n=n.parentNode;else return null}}function xf(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&&!Qn(n))e=Oe(n)+1,n=n.parentNode;else return null}}function wf(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 Qn(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 Kr=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 kf(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Cf(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||"",lo=/Edge\/(\d+)/.exec(Vt),dc=/MSIE \d/.exec(Vt),ao=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vt),Ke=!!(dc||ao||lo),Bt=dc?document.documentMode:ao?+ao[1]:lo?+lo[1]:0,at=!Ke&&/gecko\/(\d+)/i.test(Vt);at&&+(/Firefox\/(\d+)/.exec(Vt)||[0,0])[1];const co=!Ke&&/Chrome\/(\d+)/.exec(Vt),Ie=!!co,fc=co?+co[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),Mf=pt?/Win/.test(pt.platform):!1,kt=/Android \d/.test(Vt),er=!!Zs&&"webkitFontSmoothing"in Zs.documentElement.style,Tf=er?+(/\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 St(n,e){return typeof n=="number"?n:n[e]}function Of(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;){if(s.nodeType!=1){s=Tn(s);continue}let l=s,a=l==o.body,c=a?Ef(o):Of(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 h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:Tn(s)}}function Af(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=Tn(r));return e}function Nf({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 Rf(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?Df(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:mc(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=Ot(r,1);if(o.top!=o.bottom&&Bo(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function Bo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Pf(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function If(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 _f(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(Bo(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=Cf(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(!Bo(e,c)||(s=gc(n.dom,e,c),!s))return null}if(Fe)for(let c=s;r&&c;c=Tn(c))c.draggable&&(r=void 0);if(s=Pf(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;er&&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=_f(n,r,i,e))}l==null&&(l=If(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 Lf=/[\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=er||at;if(r.nodeType==3)if(s&&(Lf.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 _n(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++,_n(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 Ci(a.getBoundingClientRect(),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ci(a.getBoundingClientRect(),!0)}return Ci(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 _n(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 _n(Ot(c,-1),!0)}return _n(Ot(r.nodeType==3?wt(r):r,-t),t>=0)}function _n(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 Ci(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 Bf(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 $f=/[\u0590-\u08ac]/;function jf(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?!$f.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 Ff(n,e,t){return tl==e&&nl==t?rl:(tl=e,nl=t,rl=t=="up"||t=="down"?Bf(n,e,t):jf(n,e,t))}const ot=0,il=1,Yt=2,mt=3;class tr{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 tr{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 Hf extends tr{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 tr{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=fo(o,t,s,r)),e>0&&(o=fo(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 tr{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 Vf(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new Jr(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)&&Nr(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 qf(this,s&&s.node,e);Jf(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&&Yf(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=Gf(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 Hf(this,o,t,i);e.input.compositionNodes.push(s),this.children=fo(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(Nr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=wc(this.dom,this.nodeDOM,uo(this.outerDeco,this.node,t),uo(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 Jr 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 Jr(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 tr{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 Vf 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 Hn=function(n){n&&(this.nodeName=n)};Hn.prototype=Object.create(null);const Gt=[new Hn];function uo(n,e,t){if(n.length==0)return Gt;let r=t?Gt[0]:new Hn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Hn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new Hn(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}Wf(i,l||Gt[0],s)}return i}function Wf(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,uo(e,t,n.nodeType!=1))}function Nr(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 qf{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Uf(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&&Nr(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)||!Nr(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 Jr)||/\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 Uf(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 Kf(n,e){return n.type.side-e.type.side}function Jf(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(Kf);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 Yf(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 Gf(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 fo(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 $o(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(Kr(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&&wf(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=jo(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)Zf(n);else{let{anchor:r,head:i}=t,o,s;ll&&!(t instanceof L)&&(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&&Xf(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 Mi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Mi(i);if(o)return Mi(o)}}function Mi(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 Xf(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 Zf(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 z){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 jo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.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 Qf(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 ho(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 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 At(n,new L(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=ho(n.state,e);return i&&i instanceof z?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?z.isSelectable(o)?At(n,new z(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):er?At(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 At(n,new L(e>0?r.$to:r.$from));{let i=ho(n.state,e);return i?At(n,i):!1}}}function Rr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Vn(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?eh(n):th(n)}function eh(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<Rr(t)&&Vn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Vn(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&&Vn(l,-1);)i=t.parentNode,o=Oe(l),l=l.previousSibling;if(l)t=l,r=Rr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?po(n,t,r):i&&po(n,i,o)}function th(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Rr(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Vn(l,1))o=t,s=++r;else break}else{if(Ec(t))break;{let l=t.nextSibling;for(;l&&Vn(l,1);)o=l.parentNode,s=Oe(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Rr(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&po(n,o,s)}function Ec(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function nh(n,e){for(;n&&e==n.childNodes.length&&!Qn(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 rh(n,e){for(;n&&!e&&!Qn(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 po(n,e,t){if(e.nodeType!=3){let o,s;(s=nh(e,t))?(e=s,t=0):(o=rh(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Kr(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||Mf)&&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 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=ho(n.state,e);if(s&&s instanceof z)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 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 gl(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function ih(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 oh(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function sh(n,e){let t=e.keyCode,r=oh(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 ih(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 Fo(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=Dc[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,`
27
+ <%s key={someKey} {...props} />`,Q,W,mt,W),cs[W+Q]=!0)}if(W=null,_!==void 0&&(t(_),W=""+_),u(I)&&(t(I.key),W=""+I.key),"key"in I){_={};for(var dn in I)dn!=="key"&&(_[dn]=I[dn])}else _=I;return W&&d(_,typeof y=="function"?y.displayName||y.name||"Unknown":y),h(y,W,se,Te,c(),_)}function m(y,I){if(typeof y=="object"&&y&&y.$$typeof!==Iu){if(V(y))for(var _=0;_<y.length;_++){var Q=y[_];g(Q)&&b(Q,I)}else if(g(y))y._store&&(y._store.validated=1);else if(y===null||typeof y!="object"?_=null:(_=ve&&y[ve]||y["@@iterator"],_=typeof _=="function"?_:null),typeof _=="function"&&_!==y.entries&&(_=_.call(y),_!==y))for(;!(y=_.next()).done;)g(y.value)&&b(y.value,I)}}function g(y){return typeof y=="object"&&y!==null&&y.$$typeof===k}function b(y,I){if(y._store&&!y._store.validated&&y.key==null&&(y._store.validated=1,I=x(I),!us[I])){us[I]=!0;var _="";y&&y._owner!=null&&y._owner!==c()&&(_=null,typeof y._owner.tag=="number"?_=n(y._owner.type):typeof y._owner.name=="string"&&(_=y._owner.name),_=" It was passed a child from "+_+".");var Q=je.getCurrentStack;je.getCurrentStack=function(){var Te=a(y.type);return Q&&(Te+=Q()||""),Te},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',I,_),je.getCurrentStack=Q}}function x(y){var I="",_=c();return _&&(_=n(_.type))&&(I=`
28
+
29
+ Check the render method of \``+_+"`."),I||(y=n(y))&&(I=`
30
+
31
+ Check the top-level render call using <`+y+">."),I}var v=D,k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),re=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),pe=Symbol.for("react.suspense"),Fe=Symbol.for("react.suspense_list"),Se=Symbol.for("react.memo"),Ze=Symbol.for("react.lazy"),xe=Symbol.for("react.offscreen"),ve=Symbol.iterator,pt=Symbol.for("react.client.reference"),je=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=Object.prototype.hasOwnProperty,A=Object.assign,K=Symbol.for("react.client.reference"),V=Array.isArray,j=0,J,F,U,Y,Z,G,we;r.__reactDisabledLog=!0;var N,We,kt=!1,un=new(typeof WeakMap=="function"?WeakMap:Map),Iu=Symbol.for("react.client.reference"),ls,as={},cs={},us={};Rn.Fragment=M,Rn.jsx=function(y,I,_,Q,Te){return p(y,I,_,!1,Q,Te)},Rn.jsxs=function(y,I,_,Q,Te){return p(y,I,_,!0,Q,Te)}}()),Rn}process.env.NODE_ENV==="production"?qi.exports=zu():qi.exports=Lu();var w=qi.exports;function ke(n){this.content=n}ke.prototype={constructor:ke,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 ke(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 ke(t)},addToStart:function(n,e){return new ke([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ke(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 ke(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=ke.from(n),n.size?new ke(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ke.from(n),n.size?new ke(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ke.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}};ke.from=function(n){if(n instanceof ke)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ke(e)};function fa(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=fa(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function ha(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=ha(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 fa(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return ha(this,e,t,r)}findIndex(e,t=-1){if(e==0)return nr(0,e);if(e==this.size)return nr(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?nr(r+1,s):nr(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 ai={index:0,offset:0};function nr(n,e){return ai.index=n,ai.offset=e,ai}function wr(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(!wr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!wr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ie=class Ui{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&&wr(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 Ui.none;if(e instanceof Ui)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};ie.none=[];class kr 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=ma(this.content,e+this.openStart,t);return r&&new T(r,this.openStart,this.openEnd)}removeBetween(e,t){return new T(pa(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 pa(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(pa(o.content,e-i-1,t-i-1)))}function ma(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=ma(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Bu(n,e,t){if(t.openStart>n.depth)throw new kr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new kr("Inconsistent open depths");return ga(n,e,t,0)}function ga(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=ga(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 Xt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=$u(t,n);return Xt(o,ba(n,s,l,e,r))}else return Xt(o,Cr(n,e,r))}function ya(n,e){if(!e.type.compatibleContent(n.type))throw new kr("Cannot join "+e.type.name+" onto "+n.type.name)}function Ki(n,e,t){let r=n.node(t);return ya(r,e.node(t)),r}function Gt(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 Bn(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&&(Gt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)Gt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Gt(e.nodeBefore,r)}function Xt(n,e){return n.type.checkContent(e),n.copy(e)}function ba(n,e,t,r,i){let o=n.depth>i&&Ki(n,e,i+1),s=r.depth>i&&Ki(t,r,i+1),l=[];return Bn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(ya(o,s),Gt(Xt(o,ba(n,e,t,r,i+1)),l)):(o&&Gt(Xt(o,Cr(n,e,i+1)),l),Bn(e,t,i,l),s&&Gt(Xt(s,Cr(t,r,i+1)),l)),Bn(r,null,i,l),new C(l)}function Cr(n,e,t){let r=[];if(Bn(null,n,t,r),n.depth>t){let i=Ki(n,e,t+1);Gt(Xt(i,Cr(n,e,t+1)),r)}return Bn(e,null,t,r),new C(r)}function $u(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 Hn{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 ie.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 Mr(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 Hn(t,r,o)}static resolveCached(e,t){let r=hs.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 hs.set(e,r=new ju);let i=r.elts[r.i]=Hn.resolve(e,t);return r.i=(r.i+1)%Hu,i}}class ju{constructor(){this.elts=[],this.i=0}}const Hu=12,hs=new WeakMap;class Mr{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 Vu=Object.create(null);let _t=class Ji{constructor(e,t,r,i=ie.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,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&&wr(this.attrs,t||e.defaultAttrs||Vu)&&ie.sameSet(this.marks,r||ie.none)}copy(e=null){return e==this.content?this:new Ji(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ji(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 Bu(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 Hn.resolveCached(this,e)}resolveNoCache(e){return Hn.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()+")"),Sa(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=ie.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(!ie.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}};_t.prototype.text=void 0;class Er extends _t{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):Sa(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 Er(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Er(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 Sa(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class tn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Fu(e,t);if(r.next==null)return tn.empty;let i=xa(r);r.next&&r.err("Unexpected trailing text");let o=Gu(Yu(i));return Xu(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(`
32
+ `)}}tn.empty=new tn(!0);class Fu{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 xa(n){let e=[];do e.push(Wu(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Wu(n){let e=[];do e.push(qu(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function qu(n){let e=Ju(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=Uu(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 Uu(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 Ku(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 Ju(n){if(n.eat("(")){let e=xa(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=Ku(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 Yu(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 ms(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 Gu(n){let e=Object.create(null);return t(ms(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]);ms(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new tn(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 Xu(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 wa(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 ka(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 Ca(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 Ma(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Qu(n,r,e[r]);return t}let gs=class Ea{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=Ma(e,r.attrs),this.defaultAttrs=wa(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==tn.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:ka(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _t(this,this.computeAttrs(e),C.from(t),ie.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new _t(this,this.computeAttrs(e),t,ie.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 _t(this,e,t.append(o),ie.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){Ca(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:ie.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Ea(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 Zu(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 Qu{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Zu(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ma(e,i.attrs),this.excluded=null;let o=wa(this.attrs);this.instance=o?new ie(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ie(this,ka(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new jr(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){Ca(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ta{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=ke.from(e.nodes),t.marks=ke.from(e.marks||{}),this.nodes=gs.compile(this.spec.nodes,this),this.marks=jr.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]=tn.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?ys(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==""?[]:ys(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 gs){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 Er(r,r.defaultAttrs,e,ie.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return _t.fromJSON(this,e)}markFromJSON(e){return ie.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ys(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 ed(n){return n.tag!=null}function td(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(ed(i))this.tags.push(i);else if(td(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 Ss(this,t,!1);return r.addAll(e,ie.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ss(this,t,!0);return r.addAll(e,ie.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(id(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=xs(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=xs(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 Oa={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},nd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Na={ol:!0,ul:!0},Vn=1,Yi=2,mr=4;function bs(n,e,t){return e!=null?(e?Vn:0)|(e==="full"?Yi:0):n&&n.whitespace=="pre"?Vn|Yi:t&-5}class rr{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=ie.none,this.match=o||(s&mr?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&Vn)){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&&!Oa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ss{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=bs(null,t.preserveWhitespace,0)|(r?mr:0);i?o=new rr(i.type,i.attrs,ie.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new rr(null,null,ie.none,!0,null,s):o=new rr(e.schema.topNodeType,null,ie.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,o=i.options&Yi?"full":this.localPreserveWS||(i.options&Vn)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
33
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],l=e.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.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=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Na.hasOwnProperty(s)&&this.parser.normalizeLists&&rd(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:nd.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Oa.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
34
+ `),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=ie.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):vs(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=bs(e,o,s.options);s.options&mr&&s.content.length==0&&(l|=mr);let a=ie.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):vs(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new rr(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;this.localPreserveWS&&(this.nodes[t].options|=Vn)}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 rd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Na.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function id(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function xs(n){let e={};for(let t in n)e[t]=n[t];return e}function vs(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 an{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ci(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}=gr(ci(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&&gr(ci(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return gr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new an(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ws(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ws(e.marks)}}function ws(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ci(n){return n.document||window.document}const ks=new WeakMap;function od(n){let e=ks.get(n);return e===void 0&&ks.set(n,e=sd(n)),e}function sd(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 gr(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=od(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}=gr(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 Aa=65535,Ra=Math.pow(2,16);function ld(n,e){return n+e*Ra}function Cs(n){return n&Aa}function ad(n){return(n-(n&Aa))/Ra}const Da=1,Pa=2,yr=4,Ia=8;class Gi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ia)>0}get deletedBefore(){return(this.delInfo&(Da|yr))>0}get deletedAfter(){return(this.delInfo&(Pa|yr))>0}get deletedAcross(){return(this.delInfo&yr)>0}}class Ue{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ue.empty)return Ue.empty}recover(e){let t=0,r=Cs(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+ad(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:ld(l/3,e-a),m=e==a?Pa:e==d?Da:yr;return(t<0?e!=a:e!=d)&&(m|=Ia),new Gi(h,m,p)}i+=u-c}return r?e+i:new Gi(e+i,0,null)}touches(e,t){let r=0,i=Cs(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 Ue(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ue.empty:new Ue(e<0?[0,-e,0]:[0,0,e])}}Ue.empty=new Ue([]);class Fn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Fn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),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 Fn;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 Gi(e,i,null)}}const ui=Object.create(null);class De{getMap(){return Ue.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ui[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 ui)throw new RangeError("Duplicate use of step JSON ID "+e);return ui[e]=t,t.prototype.jsonID=e,t}}class he{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new he(e,null)}static fail(e){return new he(null,e)}static fromReplace(e,t,r,i){try{return he.ok(e.replace(t,r,i))}catch(o){if(o instanceof kr)return he.fail(o.message);throw o}}}function Eo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Eo(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return C.fromArray(r)}class Dt extends De{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(Eo(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 he.fromReplace(e,this.from,this.to,o)}invert(){return new at(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 Dt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dt(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 Dt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",Dt);class at extends De{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(Eo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return he.fromReplace(e,this.from,this.to,r)}invert(){return new Dt(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 at(t.pos,r.pos,this.mark)}merge(e){return e instanceof at&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new at(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 at(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",at);class Pt extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return he.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return he.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 Pt(this.pos,t.marks[i]);return new Pt(this.pos,this.mark)}}return new vn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Pt(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 Pt(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Pt);class vn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return he.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return he.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 Pt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vn(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 vn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",vn);class me extends De{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Xi(e,this.from,this.to)?he.fail("Structure replace would overwrite content"):he.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ue([this.from,this.to-this.from,this.slice.size])}invert(e){return new me(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 me(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof me)||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 me(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 me(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 me(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}De.jsonID("replace",me);class ge extends De{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&&(Xi(e,this.from,this.gapFrom)||Xi(e,this.gapTo,this.to)))return he.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return he.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?he.fromReplace(e,this.from,this.to,r):he.fail("Content does not fit in gap")}getMap(){return new Ue([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 ge(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 ge(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 ge(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",ge);function Xi(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 cd(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 at(f,h,d[m])));l&&l.to==f?l.to=h:o.push(l=new Dt(f,h,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function ud(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 jr){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 at(s.from,s.to,s.style)))}function To(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 me(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 at(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 me(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 dd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Tn(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||!dd(i,o,s))break}return null}function fd(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 ge(a,c,s,l,new T(u.append(f),d,h),u.size-d,!0))}function Oo(n,e,t=null,r=n){let i=hd(n,e),o=i&&pd(r,e);return o?i.map(Ms).concat({type:e,attrs:t}).concat(o.map(Ms)):null}function Ms(n){return{type:n,attrs:null}}function hd(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 pd(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 md(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 ge(i,o,i,o,new T(r,0,0),t.length,!0))}function gd(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)&&yd(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&&za(n,s,l,o),To(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 ge(d,f,d+1,f-1,new T(C.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&_a(n,s,l,o),!1}})}function _a(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 za(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(`
35
+ `))}})}function yd(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function bd(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 ge(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new T(C.from(s),0,0),1,!0))}function vt(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 Sd(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 me(e,e,new T(o.append(s),t,t),!0))}function Ht(n,e){let t=n.resolve(e),r=t.index();return La(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function xd(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 La(n,e){return!!(n&&e&&!n.isLeaf&&xd(n,e))}function Hr(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&&La(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 vd(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);za(n,u.node(),u.before(),l)}s.inlineContent&&To(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 me(c,a.map(e+t,-1),T.empty,!0)),r===!0){let u=n.doc.resolve(c);_a(n,u.node(),u.before(),n.steps.length)}return n}function wd(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 Ba(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 Vr(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return $a(i,o,r)?new me(e,t,r):new kd(i,o,r).fit()}function $a(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class kd{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 ge(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new me(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=di(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=di(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=di(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new T(_n(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new T(_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(ja(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=zn(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(_n(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new T(_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||!fi(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=fi(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=fi(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=zn(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=zn(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=zn(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 zn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(zn(n.lastChild.content,e-1,t)))}function di(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ja(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ja(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 fi(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&&!Cd(t,o.content,s)?l:null}function Cd(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Md(n){return n.spec.defining||n.spec.definingForContent}function Ed(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if($a(i,o,r))return n.step(new me(e,t,r));let s=Va(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=Md(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),v=i.index(g-1);if(x.canReplaceWith(v,v,p.type,p.marks))return n.replace(i.before(g),b?o.after(g):t,new T(Ha(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 Ha(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Ha(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 Td(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=wd(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new T(C.from(r),0,0))}function Od(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Va(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 Va(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 Sn extends De{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 he.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 he.fromReplace(e,this.pos,this.pos+1,new T(C.from(i),0,t.isLeaf?0:1))}getMap(){return Ue.empty}invert(e){return new Sn(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 Sn(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 Sn(t.pos,t.attr,t.value)}}De.jsonID("attr",Sn);class Wn extends De{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 he.ok(r)}getMap(){return Ue.empty}invert(e){return new Wn(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 Wn(t.attr,t.value)}}De.jsonID("docAttr",Wn);let wn=class extends Error{};wn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};wn.prototype=Object.create(Error.prototype);wn.prototype.constructor=wn;wn.prototype.name="TransformError";class Fa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new wn(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=Vr(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 Ed(this,e,t,r),this}replaceRangeWith(e,t,r){return Td(this,e,t,r),this}deleteRange(e,t){return Od(this,e,t),this}lift(e,t){return fd(this,e,t),this}join(e,t=1){return vd(this,e,t),this}wrap(e,t){return md(this,e,t),this}setBlockType(e,t=e,r,i=null){return gd(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return bd(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Sn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Wn(e,t)),this}addNodeMark(e,t){return this.step(new Pt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof ie)){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 vn(e,t)),this}split(e,t=1,r){return Sd(this,e,t,r),this}addMark(e,t,r){return cd(this,e,t,r),this}removeMark(e,t,r){return ud(this,e,t,r),this}clearIncompatible(e,t,r){return To(this,e,t,r),this}}const hi=Object.create(null);class B{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Wa(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&&Os(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),Os(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):pn(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?pn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):pn(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 Je(e.node(0))}static atStart(e){return pn(e,e,0,0,1)||new Je(e)}static atEnd(e){return pn(e,e,e.content.size,e.childCount,-1)||new Je(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=hi[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 hi)throw new RangeError("Duplicate use of selection JSON ID "+e);return hi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class Wa{constructor(e,t){this.$from=e,this.$to=t}}let Es=!1;function Ts(n){!Es&&!n.parent.inlineContent&&(Es=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class L extends B{constructor(e,t=e){Ts(e),Ts(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 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 Fr(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=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 L(e,t)}}B.jsonID("text",L);class Fr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Fr(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}}class z 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 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 No(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;B.jsonID("node",z);class No{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Fr(r,r):new No(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&z.isSelectable(r)?new z(t):B.near(t)}}class Je extends B{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=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 Je(e)}map(e){return new Je(e)}eq(e){return e instanceof Je}getBookmark(){return Nd}}B.jsonID("all",Je);const Nd={map(){return this},resolve(n){return new Je(n)}};function pn(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=pn(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function Os(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof me||i instanceof ge))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 Ns=1,As=2,Rs=4;class Ad extends Fa{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|Ns)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ns)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=As,this}ensureMarks(e){return ie.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&As)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&-3,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)||ie.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|=Rs,this}get scrolledIntoView(){return(this.updated&Rs)>0}}function Ds(n,e){return!e||!n?n:n.bind(e)}class Ln{constructor(e,t,r){this.name=e,this.init=Ds(t.init,r),this.apply=Ds(t.apply,r)}}const Rd=[new Ln("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ln("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new Ln("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ln("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class pi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Rd.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 Ln(r.key,r.spec.state,r))})}}class gn{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 gn(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 Ad(this)}static create(e){let t=new pi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new gn(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 pi(this.schema,e.plugins),r=t.fields,i=new gn(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 pi(e.schema,e.plugins),o=new gn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=_t.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 qa(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=qa(i,e,{})),t[r]=i}return t}class Pe{constructor(e){this.spec=e,this.props={},e.props&&qa(e.props,this,this.props),this.key=e.key?e.key.key:Ua("plugin")}getState(e){return e[this.key]}}const mi=Object.create(null);function Ua(n){return n in mi?n+"$"+ ++mi[n]:(mi[n]=0,n+"$")}class Xe{constructor(e="key"){this.key=Ua(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ce=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},kn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Zi=null;const St=function(n,e,t){let r=Zi||(Zi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Dd=function(){Zi=null},nn=function(n,e,t,r){return t&&(Ps(n,e,t,r,-1)||Ps(n,e,t,r,1))},Pd=/^(img|br|input|textarea|hr)$/i;function Ps(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:et(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Gn(n)||Pd.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ce(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?et(n):0}else return!1}}function et(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Id(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=et(n)}else if(n.parentNode&&!Gn(n))e=Ce(n),n=n.parentNode;else return null}}function _d(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&&!Gn(n))e=Ce(n)+1,n=n.parentNode;else return null}}function zd(n,e,t){for(let r=e==0,i=e==et(n);r||i;){if(n==t)return!0;let o=Ce(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==et(n)}}function Gn(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 Wr=function(n){return n.focusNode&&nn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function qt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Ld(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Bd(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(et(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(et(r.startContainer),r.startOffset)}}}const ct=typeof navigator<"u"?navigator:null,Is=typeof document<"u"?document:null,Vt=ct&&ct.userAgent||"",Qi=/Edge\/(\d+)/.exec(Vt),Ka=/MSIE \d/.exec(Vt),eo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vt),Ve=!!(Ka||eo||Qi),Lt=Ka?document.documentMode:eo?+eo[1]:Qi?+Qi[1]:0,it=!Ve&&/gecko\/(\d+)/i.test(Vt);it&&+(/Firefox\/(\d+)/.exec(Vt)||[0,0])[1];const to=!Ve&&/Chrome\/(\d+)/.exec(Vt),Ae=!!to,Ja=to?+to[1]:0,Le=!Ve&&!!ct&&/Apple Computer/.test(ct.vendor),Cn=Le&&(/Mobile\/\w+/.test(Vt)||!!ct&&ct.maxTouchPoints>2),Qe=Cn||(ct?/Mac/.test(ct.platform):!1),$d=ct?/Win/.test(ct.platform):!1,xt=/Android \d/.test(Vt),Xn=!!Is&&"webkitFontSmoothing"in Is.documentElement.style,jd=Xn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Hd(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 yt(n,e){return typeof n=="number"?n:n[e]}function Vd(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 _s(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;){if(s.nodeType!=1){s=kn(s);continue}let l=s,a=l==o.body,c=a?Hd(o):Vd(l),u=0,d=0;if(e.top<c.top+yt(r,"top")?d=-(c.top-e.top+yt(i,"top")):e.bottom>c.bottom-yt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+yt(i,"top")-c.top:e.bottom-c.bottom+yt(i,"bottom")),e.left<c.left+yt(r,"left")?u=-(c.left-e.left+yt(i,"left")):e.right>c.right-yt(r,"right")&&(u=e.right-c.right+yt(i,"right")),u||d)if(a)o.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:kn(s)}}function Fd(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:Ya(n.dom)}}function Ya(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=kn(r));return e}function Wd({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Ga(t,r==0?0:r-e)}function Ga(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 fn=null;function qd(n){if(n.setActive)return n.setActive();if(fn)return n.focus(fn);let e=Ya(n);n.focus(fn==null?{get preventScroll(){return fn={preventScroll:!0},!0}}:void 0),fn||(fn=!1,Ga(e,0))}function Xa(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=St(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?Ud(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:Xa(t,i)}function Ud(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&&Ao(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function Ao(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Kd(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Jd(n,e,t){let{node:r,offset:i}=Xa(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 Yd(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 Za(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(Ao(e,c))return Za(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function Gd(n,e){let t=n.dom.ownerDocument,r,i=0,o=Bd(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(!Ao(e,c)||(s=Za(n.dom,e,c),!s))return null}if(Le)for(let c=s;r&&c;c=kn(c))c.draggable&&(r=void 0);if(s=Kd(s,e),r){if(it&&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;Xn&&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=Yd(n,r,i,e))}l==null&&(l=Jd(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function zs(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(zs(r))return r}return Array.prototype.find.call(t,zs)||n.getBoundingClientRect()}const Xd=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Qa(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=Xn||it;if(r.nodeType==3)if(s&&(Xd.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Tt(St(r,i,i),t);if(it&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Tt(St(r,i-1,i-1),-1);if(c.top==a.top){let u=Tt(St(r,i,i+1),-1);if(u.top!=a.top)return Dn(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++,Dn(Tt(St(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==et(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return gi(a.getBoundingClientRect(),!1)}if(o==null&&i<et(r)){let a=r.childNodes[i];if(a.nodeType==1)return gi(a.getBoundingClientRect(),!0)}return gi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==et(r))){let a=r.childNodes[i-1],c=a.nodeType==3?St(a,et(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Dn(Tt(c,1),!1)}if(o==null&&i<et(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?St(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Dn(Tt(c,-1),!0)}return Dn(Tt(r.nodeType==3?St(r):r,-t),t>=0)}function Dn(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 gi(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 ec(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 Zd(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return ec(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=Qa(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=St(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 Qd=/[\u0590-\u08ac]/;function ef(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?!Qd.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:ec(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 Ls=null,Bs=null,$s=!1;function tf(n,e,t){return Ls==e&&Bs==t?$s:(Ls=e,Bs=t,$s=t=="up"||t=="down"?Zd(n,e,t):ef(n,e,t))}const tt=0,js=1,Kt=2,ut=3;class Zn{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=tt,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>Ce(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 nc){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 tc&&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?Ce(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?Ce(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=Ce(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=Ce(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((it||Le)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
36
+ `),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:Ce(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(it&&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&&Le)&&nn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&nn(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?Kt:js,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=ut:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Kt:ut}r=s}this.dirty=Kt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Kt:js;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class tc extends Zn{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==tt&&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 nf extends Zn{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 rn extends Zn{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=an.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new rn(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ut||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ut&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=tt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=tt}}slice(e,t,r){let i=rn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=ro(o,t,s,r)),e>0&&(o=ro(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 Zn{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}=an.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=oc(u,r,t),c?a=new rf(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new qr(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==tt&&e.eq(this.node)&&Tr(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 sf(this,s&&s.node,e);cf(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?ie.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==Kt)&&(s&&this.protectLocalComposition(e,s),rc(this.contentDOM,this.children,e),Cn&&uf(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=df(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 nf(this,o,t,i);e.input.compositionNodes.push(s),this.children=ro(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==ut||!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=tt}updateOuterDeco(e){if(Tr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ic(this.dom,this.nodeDOM,no(this.outerDeco,this.node,t),no(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 Hs(n,e,t,r,i){oc(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 qr 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==ut||this.dirty!=tt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=tt||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=tt,!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 qr(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=ut)}get domAtom(){return!1}isText(e){return this.node.text==e}}class nc extends Zn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==tt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class rf 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==ut)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 rc(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=Vs(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof rn){let a=r?r.previousSibling:n.lastChild;rc(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=Vs(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const $n=function(n){n&&(this.nodeName=n)};$n.prototype=Object.create(null);const Jt=[new $n];function no(n,e,t){if(n.length==0)return Jt;let r=t?Jt[0]:new $n,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new $n(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new $n(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 ic(n,e,t,r){if(t==Jt&&r==Jt)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=Jt[0]),i=a}of(i,l||Jt[0],s)}return i}function of(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 oc(n,e,t){return ic(n,n,Jt,no(e,t,n.nodeType!=1))}function Tr(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 Vs(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class sf{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=lf(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=tt,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=rn.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==ut&&s.dom==s.contentDOM&&(s.dirty=Kt),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!=ut&&Tr(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=Kt,d.updateChildren(i,s+1),d.dirty=tt),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)||!Tr(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 tc(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 rn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof qr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Le||Ae)&&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 nc(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 lf(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 rn)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 af(n,e){return n.type.side-e.type.side}function cf(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(af);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 uf(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 df(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 ro(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 Ro(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(Wr(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&&zd(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=Do(n,u,l,d)}return c}function sc(n){return n.editable?n.hasFocus():ac(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function wt(n,e=!1){let t=n.state.selection;if(lc(n,t),!!sc(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&nn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)hf(n);else{let{anchor:r,head:i}=t,o,s;Fs&&!(t instanceof L)&&(t.$from.parent.inlineContent||(o=Ws(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Ws(n,t.to))),n.docView.setSelection(r,i,n,e),Fs&&(o&&qs(o),s&&qs(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ff(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Fs=Le||Ae&&Ja<63;function Ws(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(Le&&i&&i.contentEditable=="false")return yi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return yi(i);if(o)return yi(o)}}function yi(n){return n.contentEditable="true",Le&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function qs(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function ff(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(()=>{(!sc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function hf(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,Ce(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Ve&&Lt<=11&&(r.disabled=!0,r.disabled=!1)}function lc(n,e){if(e instanceof z){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Us(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Us(n)}function Us(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Do(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}function Ks(n){return n.editable&&!n.hasFocus()?!1:ac(n)}function ac(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 pf(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return nn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function io(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 Ot(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Js(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=io(n.state,e);return i&&i instanceof z?Ot(n,i):!1}else if(!(Qe&&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)):Xn?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=io(n.state,e);return i?Ot(n,i):!1}}}function Or(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function jn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function hn(n,e){return e<0?mf(n):gf(n)}function mf(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(it&&t.nodeType==1&&r<Or(t)&&jn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(jn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(cc(t))break;{let l=t.previousSibling;for(;l&&jn(l,-1);)i=t.parentNode,o=Ce(l),l=l.previousSibling;if(l)t=l,r=Or(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?oo(n,t,r):i&&oo(n,i,o)}function gf(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Or(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(jn(l,1))o=t,s=++r;else break}else{if(cc(t))break;{let l=t.nextSibling;for(;l&&jn(l,1);)o=l.parentNode,s=Ce(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Or(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&oo(n,o,s)}function cc(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function yf(n,e){for(;n&&e==n.childNodes.length&&!Gn(n);)e=Ce(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 bf(n,e){for(;n&&!e&&!Gn(n);)e=Ce(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 oo(n,e,t){if(e.nodeType!=3){let o,s;(s=yf(e,t))?(e=s,t=0):(o=bf(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Wr(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&&wt(n)},50)}function Ys(n,e){let t=n.state.doc.resolve(e);if(!(Ae||$d)&&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 Gs(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||Qe&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=io(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 Je?B.near(s,e):B.findFrom(s,e);return l?Ot(n,l):!1}return!1}function Xs(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 Zs(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Sf(n){if(!Le||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;Zs(n,r,"true"),setTimeout(()=>Zs(n,r,"false"),20)}return!1}function xf(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function vf(n,e){let t=e.keyCode,r=xf(e);if(t==8||Qe&&t==72&&r=="c")return Xs(n,-1)||hn(n,-1);if(t==46&&!e.shiftKey||Qe&&t==68&&r=="c")return Xs(n,1)||hn(n,1);if(t==13||t==27)return!0;if(t==37||Qe&&t==66&&r=="c"){let i=t==37?Ys(n,n.state.selection.from)=="ltr"?-1:1:-1;return Js(n,i,r)||hn(n,i)}else if(t==39||Qe&&t==70&&r=="c"){let i=t==39?Ys(n,n.state.selection.from)=="ltr"?1:-1:1;return Js(n,i,r)||hn(n,i)}else{if(t==38||Qe&&t==80&&r=="c")return Gs(n,-1,r)||hn(n,-1);if(t==40||Qe&&t==78&&r=="c")return Sf(n)||Gs(n,1,r)||hn(n,1);if(r==(Qe?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Po(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")||an.fromSchema(n.state.schema),l=mc(),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,`
36
37
 
37
- `);return{dom:a,text:f,slice:e}}function Oc(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=uh(t),er&&dh(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&&!lh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=fh(yl(l,+u[1],+u[2]),u[4]);else if(l=O.maxOpen(ah(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 lh=/^(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 ah(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&&Nc(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Rc(s[s.length-1],o.length));let u=Ac(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return C.from(s)}return n}function Ac(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function Nc(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Nc(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(Ac(t,n,i+1))))}}function Rc(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Rc(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function mo(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=mo(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(mo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new O(mo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Dc={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 Pc(){return bl||(bl=document.implementation.createHTMLDocument("title"))}let Ti=null;function ch(n){let e=window.trustedTypes;return e?(Ti||(Ti=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ti.createHTML(n)):n}function uh(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&&Dc[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=ch(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function dh(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 fh(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={},hh={touchstart:!0,touchmove:!0};class ph{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 mh(n){for(let e in He){let t=He[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{yh(n,r)&&!Ho(n,r)&&(n.editable||!(r.type in Ve))&&t(n,r)},hh[e]?{passive:!0}:void 0)}Fe&&n.dom.addEventListener("input",()=>null),go(n)}function _t(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function gh(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 go(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ho(n,r))})}function Ho(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function yh(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 bh(n,e){!Ho(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,!_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(),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))||sh(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(_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 Yr(n){return{left:n.clientX,top:n.clientY}}function vh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Vo(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 kn(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 Sh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(kn(n,new z(t)),!0):!1}function xh(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?(kn(n,z.create(n.state.doc,i)),!0):!1}function wh(n,e,t,r,i){return Vo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?xh(n,t):Sh(n,t))}function kh(n,e,t,r){return Vo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Ch(n,e,t,r){return Vo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Mh(n,t,r)}function Mh(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(kn(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)kn(n,L.create(r,l+1,l+1+s.content.size));else if(z.isSelectable(s))kn(n,z.create(r,l));else continue;return!0}}function Wo(n){return Dr(n)}const Ic=rt?"metaKey":"ctrlKey";He.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Wo(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&vh(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(Yr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Th(n,s,t,!!r)):(o=="doubleClick"?kh:Ch)(n,s.pos,s.inside,t)?t.preventDefault():_t(n,"pointer"))};class Th{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(()=>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(Yr(e))),this.updateAllowDefault(e),this.allowDefault||!t?_t(this.view,"pointer"):wh(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)?(kn(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(),Wo(n),_t(n,"pointer")};He.touchmove=n=>{n.input.lastTouch=Date.now(),_t(n,"pointer")};He.contextmenu=n=>Wo(n);function _c(n,e){return n.composing?!0:Fe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Eh=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 L&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Dr(n,!0),n.markCursor=null;else if(Dr(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)};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(()=>Dr(n),e))}function Lc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Ah());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Oh(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Sf(e.focusNode,e.focusOffset),r=xf(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 Ah(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Dr(n,e=!1){if(!(kt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Lc(n),e||n.docView&&n.docView.dirty){let t=$o(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 Nh(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 Jn=Ke&&Bt<15||En&&Tf<604;He.copy=Ve.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Jn?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Fo(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):Nh(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Rh(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?Yn(n,r.value,null,i,e):Yn(n,r.textContent,r.innerHTML,i,e)},50)}function Yn(n,e,t,r,i){let o=Oc(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=Rh(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 Bc(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=Jn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Yn(n,Bc(r),r.getData("text/html"),i,t)?t.preventDefault():Dh(n,t)};class $c{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const jc=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(Yr(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}=Fo(n,l);(!t.dataTransfer.files.length||!Ie||fc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Jn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Jn||t.dataTransfer.setData("text/plain",c),n.dragging=new $c(u,!t[jc],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(Yr(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=Oc(n,Bc(t.dataTransfer),Jn?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[jc]);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&&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,S)=>p=S),c.setSelection(jo(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 Gn(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 Pr{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 Pr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Gn(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&&Gn(this.attrs,e.attrs)&&Gn(this.spec,e.spec)}static is(e){return e.type instanceof jt}destroy(){}}class qo{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 qo&&Gn(this.attrs,e.attrs)&&Gn(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 Pr(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 qo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jt}get widget(){return this.type instanceof Pr}}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?Ir(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?Ph(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=Hc(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,Ir(u,l,c+1,en)),o+=3}});let s=Fc(o?Vc(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 Uo(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=Uo;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?Uo(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 Ph(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=Ih(l,n,e,t,i,o,s),u=Ir(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 Fc(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 Ih(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 Hc(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 Vc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ir(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Hc(n,l,a+t);if(c){o=!0;let u=Ir(c,l,t+a+1,r);u!=Pe&&i.push(a,a+l.nodeSize,u)}});let s=Fc(o?Vc(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 Uo(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 Ei(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 _h={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},zh=Ke&&Bt<=11;class Lh{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 Bh{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Lh,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,_h)),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=Tn(o))t.add(o);for(let o=e.anchorNode;o;o=Tn(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||Fh(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&&Kr(r)&&(c=$o(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),$h(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 $h(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 jh(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 Fh(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 Hh(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}],Kr(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")||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:Vh,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 Vh(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 Wh=/^(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 qh(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=$o(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=Hh(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=Jh(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&&!Wh.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 _=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 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&&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&&Kh(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&&($=Uh(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:jo(n,e.resolve(t.anchor),e.resolve(t.head))}function Uh(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 Kh(n,e,t,r,i){if(t-e<=i.pos-r.pos||Oi(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(Oi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Oi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Oi(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 Jh(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 Yh{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 ph,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),Ei(this),this.dom,this),this.domObserver=new Bh(this,(r,i,o,s)=>qh(this,r,i,o,s)),this.domObserver.start(),mh(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&&go(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&&(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=Ol(this);Xh(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&go(this),this.editable=El(this),Tl(this);let a=Ei(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&&Af(this);if(s){this.domObserver.stop();let h=d&&(Ke||Ie)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Gh(i.selection,e.selection);if(d){let p=Ie?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Oh(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())&&Qf(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&&Nf(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&&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 $c(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&&Rf(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 Ff(this,t||this.state,e)}pasteHTML(e,t){return Yn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Yn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Fo(this,e)}destroy(){this.docView&&(gh(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ei(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,bf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return bh(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&&kf(this.dom.ownerDocument)==this.dom&&jh(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 Gh(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 Xh(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:"'"},_r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Zh=typeof navigator<"u"&&/Mac/.test(navigator.platform),Qh=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),_r[Ae]=String.fromCharCode(Ae);for(var Ai in Ft)_r.hasOwnProperty(Ai)||(_r[Ai]=Ft[Ai]);function ep(n){var e=Zh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Qh&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?_r: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 tp=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function np(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))tp?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 rp(n){let e=Object.create(null);for(let t in n)e[np(t)]=n[t];return e}function Ni(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 ip(n){return new Le({props:{handleKeyDown:Ko(n)}})}function Ko(n){let e=rp(n);return function(t,r){let i=ep(r),o,s=e[Ni(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ni(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[Ni(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Jo=(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=Yo(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(eu(n,i,e,-1))return!0;if(r.parent.content.size==0&&(On(o,"end")||z.isSelectable(o)))for(let s=r.depth;;s--){let l=qr(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):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},op=(n,e,t)=>{let r=Wc(n,t);if(!r)return!1;let i=Yo(r);return i?Uc(n,i,e):!1},sp=(n,e,t)=>{let r=Jc(n,t);if(!r)return!1;let i=Go(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=qr(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(L.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 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=Yo(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 Yo(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=Go(r);if(!i)return!1;let o=i.nodeAfter;if(eu(n,i,e,1))return!0;if(r.parent.content.size==0&&(On(o,"start")||z.isSelectable(o))){let s=qr(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):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=Go(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 Go(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 lp=(n,e)=>{let t=n.selection,r=t instanceof z,i;if(r){if(t.node.isTextblock||!Ht(n.doc,t.from))return!1;i=t.from}else if(i=Wr(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},ap=(n,e)=>{let t=n.selection,r;if(t instanceof z){if(t.node.isTextblock||!Ht(n.doc,t.to))return!1;r=t.to}else if(r=Wr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},cp=(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)},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(`
39
- `).scrollIntoView()),!0)};function Xo(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 up=(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=Xo(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},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=Xo(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&&Nn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function dp(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=Xo(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 fp=dp(),hp=(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 pp(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 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&&pp(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 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 mp=tu(-1),gp=tu(1);function yp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&zo(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 Zo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}Zo(Jo,qc,Kc);Zo(Jo,Yc,Gc);Zo(Xc,Zc,Qc,fp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function bp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let l=r?t.tr:null;return vp(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function vp(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);o=new Or(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Or(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=zo(o,t,r,e);return l?(n&&Sp(n,e,l,i,t),!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 Or(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.doc.resolve(i.mapping.map(o,-1)-1);return Ht(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),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 Gr(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 Xr{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:Gr({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 Zr(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}=Zr(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 zr(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 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=nu(n),{nodeExtensions:i,markExtensions:o}=Zr(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:zr(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:zr(g,u)})),[c.name,h]}));return new qa({topNode:s,nodes:l,marks:a})}function Ri(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 Qo(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 es(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Qr{constructor(e){this.find=e.find,this.handler=e.handler}}const Np=(n,e)=>{if(es(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 lr(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=Gr({state:a.state,transaction:p}),g={from:r-(h[0].length-o.length),to:i},{commands:b,chain:S,can:x}=new Xr({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 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=Qo(C.from(u),s.schema);const{from:d}=a,f=d+u.length;lr({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 lr({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&lr({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?lr({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 ar(n){return Dp(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ei(n,e){const t={...n};return ar(n)&&ar(e)&&Object.keys(e).forEach(r=>{ar(e[r])&&ar(n[r])?t[r]=ei(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:()=>ei(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(es(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 zp(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Xr({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 cr=null;const Lp=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=Gr({state:u,transaction:m});if(!(!zp({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&&(cr=e)},h=()=>{cr&&(cr=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=cr;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=Qo(C.from(v),h.schema);const{from:T}=b,A=T+v.length,$=Lp(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:Ri(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:Ri(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=ip(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 nu(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Zr(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=zr(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:Ri(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:()=>ei(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 iu(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
38
+ `);return{dom:a,text:f,slice:e}}function uc(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,`
39
+ `))),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=an.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=Mf(t),Xn&&Ef(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&&!wf.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Tf(Qs(l,+u[1],+u[2]),u[4]);else if(l=T.maxOpen(kf(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=Qs(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const wf=/^(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 kf(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&&fc(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=hc(s[s.length-1],o.length));let u=dc(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return C.from(s)}return n}function dc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function fc(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=fc(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(dc(t,n,i+1))))}}function hc(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,hc(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function so(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=so(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 Qs(n,e,t){return e<n.openStart&&(n=new T(so(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new T(so(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 el=null;function mc(){return el||(el=document.implementation.createHTMLDocument("title"))}let bi=null;function Cf(n){let e=window.trustedTypes;return e?(bi||(bi=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),bi.createHTML(n)):n}function Mf(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=mc().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=Cf(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function Ef(n){let e=n.querySelectorAll(Ae?"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 Tf(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 Be={},$e={},Of={touchstart:!0,touchmove:!0};class Nf{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 Af(n){for(let e in Be){let t=Be[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Df(n,r)&&!Io(n,r)&&(n.editable||!(r.type in $e))&&t(n,r)},Of[e]?{passive:!0}:void 0)}Le&&n.dom.addEventListener("input",()=>null),lo(n)}function It(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Rf(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 lo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Io(n,r))})}function Io(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Df(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 Pf(n,e){!Io(n,e)&&Be[e.type]&&(n.editable||!(e.type in $e))&&Be[e.type](n,e)}$e.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!yc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(xt&&Ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Cn&&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,qt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||vf(n,t)?t.preventDefault():It(n,"key")};$e.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};$e.keypress=(n,e)=>{let t=e;if(yc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Qe&&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 Ur(n){return{left:n.clientX,top:n.clientY}}function If(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function _o(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 xn(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 _f(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(xn(n,new z(t)),!0):!1}function zf(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?(xn(n,z.create(n.state.doc,i)),!0):!1}function Lf(n,e,t,r,i){return _o(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?zf(n,t):_f(n,t))}function Bf(n,e,t,r){return _o(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function $f(n,e,t,r){return _o(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||jf(n,t,r)}function jf(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(xn(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)xn(n,L.create(r,l+1,l+1+s.content.size));else if(z.isSelectable(s))xn(n,z.create(r,l));else continue;return!0}}function zo(n){return Nr(n)}const gc=Qe?"metaKey":"ctrlKey";Be.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=zo(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&If(t,n.input.lastClick)&&!t[gc]&&(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(Ur(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Hf(n,s,t,!!r)):(o=="doubleClick"?Bf:$f)(n,s.pos,s.inside,t)?t.preventDefault():It(n,"pointer"))};class Hf{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[gc],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&&it&&!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)),It(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(()=>wt(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(Ur(e))),this.updateAllowDefault(e),this.allowDefault||!t?It(this.view,"pointer"):Lf(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Le&&this.mightDrag&&!this.mightDrag.node.isAtom||Ae&&!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)?(xn(this.view,B.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):It(this.view,"pointer")}move(e){this.updateAllowDefault(e),It(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)}}Be.touchstart=n=>{n.input.lastTouch=Date.now(),zo(n),It(n,"pointer")};Be.touchmove=n=>{n.input.lastTouch=Date.now(),It(n,"pointer")};Be.contextmenu=n=>zo(n);function yc(n,e){return n.composing?!0:Le&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Vf=xt?5e3:-1;$e.compositionstart=$e.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(),Nr(n,!0),n.markCursor=null;else if(Nr(n,!e.selection.empty),it&&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}bc(n,Vf)};$e.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++,bc(n,20))};function bc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Nr(n),e))}function Sc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Wf());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Ff(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Id(e.focusNode,e.focusOffset),r=_d(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 Wf(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Nr(n,e=!1){if(!(xt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Sc(n),e||n.docView&&n.docView.dirty){let t=Ro(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 qf(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 qn=Ve&&Lt<15||Cn&&jd<604;Be.copy=$e.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=qn?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Po(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):qf(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Uf(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Kf(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?Un(n,r.value,null,i,e):Un(n,r.textContent,r.innerHTML,i,e)},50)}function Un(n,e,t,r,i){let o=uc(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=Uf(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 xc(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," "):""}$e.paste=(n,e)=>{let t=e;if(n.composing&&!xt)return;let r=qn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Un(n,xc(r),r.getData("text/html"),i,t)?t.preventDefault():Kf(n,t)};class vc{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const wc=Qe?"altKey":"ctrlKey";Be.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(Ur(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}=Po(n,l);(!t.dataTransfer.files.length||!Ae||Ja>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(qn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",qn||t.dataTransfer.setData("text/plain",c),n.dragging=new vc(u,!t[wc],s)};Be.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};$e.dragover=$e.dragenter=(n,e)=>e.preventDefault();$e.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Ur(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=uc(n,xc(t.dataTransfer),qn?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[wc]);if(n.someProp("handleDrop",p=>p(n,t,s||T.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?Ba(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(Do(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Be.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())&&wt(n)},20))};Be.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)};Be.beforeinput=(n,e)=>{if(Ae&&xt&&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,qt(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 $e)Be[n]=$e[n];function Kn(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 Ar{constructor(e,t){this.toDOM=e,this.spec=t||Zt,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 ze(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ar&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Kn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $t{constructor(e,t){this.attrs=e,this.spec=t||Zt}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 ze(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $t&&Kn(this.attrs,e.attrs)&&Kn(this.spec,e.spec)}static is(e){return e.type instanceof $t}destroy(){}}class Lo{constructor(e,t){this.attrs=e,this.spec=t||Zt}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 ze(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 Lo&&Kn(this.attrs,e.attrs)&&Kn(this.spec,e.spec)}destroy(){}}class ze{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ze(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 ze(e,e,new Ar(t,r))}static inline(e,t,r,i){return new ze(e,t,new $t(r,i))}static node(e,t,r,i){return new ze(e,t,new Lo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof $t}get widget(){return this.type instanceof Ar}}const mn=[],Zt={};class ce{constructor(e,t){this.local=e.length?e:mn,this.children=t.length?t:mn}static create(e,t){return t.length?Rr(t,e,0,Zt):Ne}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==Ne||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Zt)}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?Jf(this.children,s||[],e,t,r,i,o):s?new ce(s.sort(Qt),mn):Ne}add(e,t){return t.length?this==Ne?ce.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=Cc(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,Rr(u,l,c+1,Zt)),o+=3}});let s=kc(o?Mc(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ce(s.length?this.local.concat(s).sort(Qt):this.local,i||this.children)}remove(e){return e.length==0||this==Ne?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!=Ne?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 ce(i,r):Ne}forChild(e,t){if(this==Ne)return this;if(t.isLeaf)return ce.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 ce(i.sort(Qt),mn);return r?new At([l,r]):l}return r||Ne}eq(e){if(this==e)return!0;if(!(e instanceof ce)||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 Bo(this.localsInner(e))}localsInner(e){if(this==Ne)return mn;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)}}ce.empty=new ce([],[]);ce.removeOverlap=Bo;const Ne=ce.empty;class At{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Zt));return At.from(r)}forChild(e,t){if(t.isLeaf)return ce.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Ne&&(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?Bo(r?t:t.sort(Qt)):mn}static from(e){switch(e.length){case 0:return Ne;case 1:return e[0];default:return new At(e.every(t=>t instanceof ce)?e:e.reduce((t,r)=>t.concat(r instanceof ce?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Jf(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 v=l[b]+u-d;h>=v?l[b+1]=f<=v?-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!=Ne?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Yf(l,n,e,t,i,o,s),u=Rr(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 ce(e.sort(Qt),l)}function kc(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 ze(i.from+e,i.to+e,i.type))}return t}function Yf(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 Cc(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 Mc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Rr(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Cc(n,l,a+t);if(c){o=!0;let u=Rr(c,l,t+a+1,r);u!=Ne&&i.push(a,a+l.nodeSize,u)}});let s=kc(o?Mc(n):n,-t).sort(Qt);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 ce(s,i):Ne}function Qt(n,e){return n.from-e.from||n.to-e.to}function Bo(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),tl(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),tl(e,i,r.copy(o.from,r.to)));break}}}return e}function tl(n,e,t){for(;e<n.length&&Qt(t,n[e])>0;)e++;n.splice(e,0,t)}function Si(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ne&&e.push(r)}),n.cursorWrapper&&e.push(ce.create(n.state.doc,[n.cursorWrapper.deco])),At.from(e)}const Gf={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xf=Ve&&Lt<=11;class Zf{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 Qf{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Zf,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]);Ve&&Lt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Xf&&(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,Gf)),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(Ks(this.view)){if(this.suppressingSelectionUpdates)return wt(this.view);if(Ve&&Lt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&nn(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=kn(o))t.add(o);for(let o=e.anchorNode;o;o=kn(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)&&Ks(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(it&&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||nh(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&&Wr(r)&&(c=Ro(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,wt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),eh(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||wt(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(Ve&&Lt<=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?Ce(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?Ce(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 nl=new WeakMap,rl=!1;function eh(n){if(!nl.has(n)&&(nl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=it,rl)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."),rl=!0}}function il(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return nn(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function th(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return il(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?il(n,t):null}function nh(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 rh(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}],Wr(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ae&&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")||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:ih,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 ih(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Le&&/^(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||Le&&/^(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 oh=/^(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 sh(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let P=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,re=Ro(n,P);if(re&&!n.state.selection.eq(re)){if(Ae&&xt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",pe=>pe(n,qt(13,"Enter"))))return;let ae=n.state.tr.setSelection(re);P=="pointer"?ae.setMeta("pointer",!0):P=="key"&&ae.scrollIntoView(),o&&ae.setMeta("composition",o),n.dispatch(ae)}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=rh(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=ch(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Cn&&n.input.lastIOSEnter>Date.now()-225||xt)&&i.some(P=>P.nodeType==1&&!oh.test(P.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",P=>P(n,qt(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 P=ol(n,n.state.doc,c.sel);if(P&&!P.eq(n.state.selection)){let re=n.state.tr.setSelection(P);o&&re.setMeta("composition",o),n.dispatch(re)}}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)),Ve&&Lt<=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,v;if((Cn&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(v=B.findFrom(c.doc.resolve(m.pos+1),1,!0))&&v.head==g.pos)&&n.someProp("handleKeyDown",P=>P(n,qt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&ah(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",P=>P(n,qt(8,"Backspace")))){xt&&Ae&&n.domObserver.suppressSelectionUpdates();return}Ae&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),xt&&!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(P){return P(n,qt(13,"Enter"))})},20));let k=p.start,S=p.endA,M,O,$;if(x){if(m.pos==g.pos)Ve&&Lt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>wt(n),20)),M=n.state.tr.delete(k,S),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&($=lh(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))M=n.state.tr,$.type=="add"?M.addMark(k,S,$.mark):M.removeMark(k,S,$.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let P=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",re=>re(n,k,S,P)))return;M=n.state.tr.insertText(P,k,S)}}if(M||(M=n.state.tr.replace(k,S,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let P=ol(n,M.doc,c.sel);P&&!(Ae&&n.composing&&P.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(P.head==k||P.head==M.mapping.map(S)-1)||Ve&&P.empty&&P.head==k)&&M.setSelection(P)}O&&M.ensureMarks(O),o&&M.setMeta("composition",o),n.dispatch(M.scrollIntoView())}function ol(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Do(n,e.resolve(t.anchor),e.resolve(t.head))}function lh(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 ah(n,e,t,r,i){if(t-e<=i.pos-r.pos||xi(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(xi(o,!0,!0));return!s.parent.isTextblock||s.pos>t||xi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function xi(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 ch(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&&sl(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&&sl(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function sl(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 uh{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 Nf,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(dl),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=cl(this),al(this),this.nodeViews=ul(this),this.docView=Hs(this.state.doc,ll(this),Si(this),this.dom,this),this.domObserver=new Qf(this,(r,i,o,s)=>sh(this,r,i,o,s)),this.domObserver.start(),Af(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&&lo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dl),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&&(Sc(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=ul(this);fh(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&lo(this),this.editable=cl(this),al(this);let a=Si(this),c=ll(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&&Fd(this);if(s){this.domObserver.stop();let h=d&&(Ve||Ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&dh(i.selection,e.selection);if(d){let p=Ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ff(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Hs(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&pf(this))?wt(this,h):(lc(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&&Wd(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&&_s(this,t.getBoundingClientRect(),e)}else _s(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 vc(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(Ve){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&&qd(this.dom),wt(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 Gd(this,e)}coordsAtPos(e,t=1){return Qa(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 tf(this,t||this.state,e)}pasteHTML(e,t){return Un(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Un(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Po(this,e)}destroy(){this.docView&&(Rf(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Si(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Dd())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Pf(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?Le&&this.root.nodeType===11&&Ld(this.dom.ownerDocument)==this.dom&&th(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ll(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"),[ze.node(0,n.state.doc.content.size,e)]}function al(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:ze.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function cl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function dh(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 ul(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 fh(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 dl(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:"'"},Dr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hh=typeof navigator<"u"&&/Mac/.test(navigator.platform),ph=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Me=0;Me<10;Me++)jt[48+Me]=jt[96+Me]=String(Me);for(var Me=1;Me<=24;Me++)jt[Me+111]="F"+Me;for(var Me=65;Me<=90;Me++)jt[Me]=String.fromCharCode(Me+32),Dr[Me]=String.fromCharCode(Me);for(var vi in jt)Dr.hasOwnProperty(vi)||(Dr[vi]=jt[vi]);function mh(n){var e=hh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ph&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Dr: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 gh=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function yh(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))gh?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 bh(n){let e=Object.create(null);for(let t in n)e[yh(t)]=n[t];return e}function wi(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 Sh(n){return new Pe({props:{handleKeyDown:$o(n)}})}function $o(n){let e=bh(n);return function(t,r){let i=mh(r),o,s=e[wi(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[wi(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[wi(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const jo=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ec(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Tc=(n,e,t)=>{let r=Ec(n,t);if(!r)return!1;let i=Ho(r);if(!i){let s=r.blockRange(),l=s&&Tn(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(zc(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Mn(o,"end")||z.isSelectable(o)))for(let s=r.depth;;s--){let l=Vr(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(Mn(o,"end")?B.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},xh=(n,e,t)=>{let r=Ec(n,t);if(!r)return!1;let i=Ho(r);return i?Oc(n,i,e):!1},vh=(n,e,t)=>{let r=Ac(n,t);if(!r)return!1;let i=Vo(r);return i?Oc(n,i,e):!1};function Oc(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=Vr(n.doc,o,a,T.empty);if(!c||c.from!=o||c instanceof me&&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 Mn(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 Nc=(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=Ho(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 Ho(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 Ac(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Rc=(n,e,t)=>{let r=Ac(n,t);if(!r)return!1;let i=Vo(r);if(!i)return!1;let o=i.nodeAfter;if(zc(n,i,e,1))return!0;if(r.parent.content.size==0&&(Mn(o,"start")||z.isSelectable(o))){let s=Vr(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(Mn(o,"start")?B.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},Dc=(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=Vo(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 Vo(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 wh=(n,e)=>{let t=n.selection,r=t instanceof z,i;if(r){if(t.node.isTextblock||!Ht(n.doc,t.from))return!1;i=t.from}else if(i=Hr(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},kh=(n,e)=>{let t=n.selection,r;if(t instanceof z){if(t.node.isTextblock||!Ht(n.doc,t.to))return!1;r=t.to}else if(r=Hr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Ch=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Tn(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Pc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
40
+ `).scrollIntoView()),!0)};function Fo(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 Mh=(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=Fo(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},Ic=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Je||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Fo(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},_c=(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(vt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Tn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Eh(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!vt(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=Fo(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 Je)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=vt(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=vt(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 Th=Eh(),Oh=(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 Nh(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 zc(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&Nh(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 ge(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&&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&&Tn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Mn(o,"start",!0)&&Mn(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 v=p.length-1;v>=0;v--)b=C.from(p[v].copy(b));let x=n.tr.step(new ge(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 Lc(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 Ah=Lc(-1),Rh=Lc(1);function Dh(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&Oo(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function fl(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 Wo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}Wo(jo,Tc,Nc);Wo(jo,Rc,Dc);Wo(Pc,Ic,_c,Th);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Ph(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let l=r?t.tr:null;return Ih(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Ih(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);o=new Mr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Mr(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=Oo(o,t,r,e);return l?(n&&_h(n,e,l,i,t),!0):!1}function _h(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 ge(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&&vt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function zh(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?Lh(e,t,n,o):Bh(e,t,o):!0:!1}}function Lh(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ge(o-1,s,o,s,new T(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Mr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Tn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return Ht(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function Bh(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 ge(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 $h(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 ge(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Kr(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 Jr{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:Kr({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 jh{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 R(n,e,t){return n.config[e]===void 0&&n.parent?R(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?R(n.parent,e,t):null}):n.config[e]}function Yr(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 Bc(n){const e=[],{nodeExtensions:t,markExtensions:r}=Yr(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=R(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=R(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 be(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 ne(...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 Pr(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)=>ne(t,r),{})}function $c(n){return typeof n=="function"}function q(n,e=void 0,...t){return $c(n)?e?n.bind(e)(...t):n(...t):n}function Hh(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Vh(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function hl(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):Vh(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function pl(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Hh(t)?!1:t!=null))}function Fh(n,e){var t;const r=Bc(n),{nodeExtensions:i,markExtensions:o}=Yr(n),s=(t=i.find(c=>R(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 v=R(x,"extendNodeSchema",d);return{...b,...v?v(c):{}}},{}),h=pl({...f,content:q(R(c,"content",d)),marks:q(R(c,"marks",d)),group:q(R(c,"group",d)),inline:q(R(c,"inline",d)),atom:q(R(c,"atom",d)),selectable:q(R(c,"selectable",d)),draggable:q(R(c,"draggable",d)),code:q(R(c,"code",d)),whitespace:q(R(c,"whitespace",d)),linebreakReplacement:q(R(c,"linebreakReplacement",d)),defining:q(R(c,"defining",d)),isolating:q(R(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(R(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>hl(b,u)));const m=R(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Pr(b,u)}));const g=R(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=R(b,"extendMarkSchema",d);return{...g,...x?x(c):{}}},{}),h=pl({...f,inclusive:q(R(c,"inclusive",d)),excludes:q(R(c,"excludes",d)),group:q(R(c,"group",d)),spanning:q(R(c,"spanning",d)),code:q(R(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(R(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>hl(g,u)));const m=R(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Pr(g,u)})),[c.name,h]}));return new Ta({topNode:s,nodes:l,marks:a})}function ki(n,e){return e.nodes[n]||e.marks[n]||null}function ml(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function qo(n,e){const t=an.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Wh=(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 Uo(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Gr{constructor(e){this.find=e.find,this.handler=e.handler}}const qh=(n,e)=>{if(Uo(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 ir(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=Wh(c)+o;return s.forEach(f=>{if(u)return;const h=qh(d,f.find);if(!h)return;const p=a.state.tr,m=Kr({state:a.state,transaction:p}),g={from:r-(h[0].length-o.length),to:i},{commands:b,chain:x,can:v}=new Jr({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:b,chain:x,can:v})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:o}),a.dispatch(p),u=!0)}),u}function Uh(n){const{editor:e,rules:t}=n,r=new Pe({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=qo(C.from(u),s.schema);const{from:d}=a,f=d+u.length;ir({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 ir({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ir({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?ir({editor:e,from:s.pos,to:s.pos,text:`
41
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Kh(n){return Object.prototype.toString.call(n).slice(8,-1)}function or(n){return Kh(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Xr(n,e){const t={...n};return or(n)&&or(e)&&Object.keys(e).forEach(r=>{or(e[r])&&or(n[r])?t[r]=Xr(n[r],e[r]):t[r]=e[r]}),t}class Ge{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(R(this,"addOptions",{name:this.name}))),this.storage=q(R(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ge(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Xr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ge(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(R(t,"addOptions",{name:t.name})),t.storage=q(R(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 Jh(n){return typeof n=="number"}class Yh{constructor(e){this.find=e.find,this.handler=e.handler}}const Gh=(n,e,t)=>{if(Uo(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 Xh(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Jr({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,"");Gh(b,o.find,s).forEach(v=>{if(v.index===void 0)return;const k=m+v.index+1,S=k+v[0].length,M={from:t.tr.mapping.map(k),to:t.tr.mapping.map(S)},O=o.handler({state:t,range:M,match:v,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(O)})}),d.every(h=>h!==null)}let sr=null;const Zh=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 Qh(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=Kr({state:u,transaction:m});if(!(!Xh({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 Pe({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&&(sr=e)},h=()=>{sr&&(sr=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=sr;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:S}=b;typeof S=="string"?S=S:S=qo(C.from(S),h.schema);const{from:M}=b,O=M+S.length,$=Zh(S);return a({rule:u,state:h,from:M,to:{b:O},pasteEvt:$})}const v=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!Jh(v)||!k||v===k.b))return a({rule:u,state:h,from:v,to:k,pasteEvt:s})}}))}function ep(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class yn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=yn.resolve(e),this.schema=Fh(this.extensions,t),this.setupExtensions()}static resolve(e){const t=yn.sort(yn.flatten(e)),r=ep(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=R(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=R(r,"priority")||100,s=R(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:ki(t.name,this.schema)},i=R(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=yn.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:ki(s.name,this.schema)},a=[],c=R(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&R(s,"exitable",l)&&(u.ArrowRight=()=>Ge.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=Sh(u);a.push(d);const f=R(s,"addInputRules",l);ml(s,e.options.enableInputRules)&&f&&r.push(...f());const h=R(s,"addPasteRules",l);ml(s,e.options.enablePasteRules)&&h&&i.push(...h());const p=R(s,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[Uh({editor:e,rules:r}),...Qh({editor:e,rules:i}),...o]}get attributes(){return Bc(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Yr(this.extensions);return Object.fromEntries(t.filter(r=>!!R(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:be(r.name,this.schema)},s=R(r,"addNodeView",o);if(!s)return[];const l=(a,c,u,d,f)=>{const h=Pr(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:ki(e.name,this.schema)};e.type==="mark"&&(!((t=q(R(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=R(e,"onBeforeCreate",r),o=R(e,"onCreate",r),s=R(e,"onUpdate",r),l=R(e,"onSelectionUpdate",r),a=R(e,"onTransaction",r),c=R(e,"onFocus",r),u=R(e,"onBlur",r),d=R(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 Ee{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(R(this,"addOptions",{name:this.name}))),this.storage=q(R(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ee(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Xr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ee({...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(R(t,"addOptions",{name:t.name})),t.storage=q(R(t,"addStorage",{name:t.name,options:t.options})),t}}function jc(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
41
42
 
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 ou(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 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})}}})]}}),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})=>Zc(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 L(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})=>Jo(n,e),Xp=()=>({commands:n})=>n.keyboardShortcut("Enter"),Zp=()=>({state:n,dispatch:e})=>up(n,e);function Lr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:es(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function su(n,e,t={}){return n.find(r=>r.type===e&&Lr(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Il(n,e,t={}){return!!su(n,e,t)}function ts(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&&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=ts(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},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 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=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"?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 ti(){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=()=>{(ti()||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},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),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 ur(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return uu(t)}function Br(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),Br("",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?Lt.fromSchema(a).parseSlice(ur(n),t.parseOptions):Lt.fromSchema(a).parse(ur(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(ur(n),t.parseOptions).content:o.parse(ur(n),t.parseOptions)}return Br("",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=Br(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})=>lp(n,e),am=()=>({state:n,dispatch:e})=>ap(n,e),cm=()=>({state:n,dispatch:e})=>qc(n,e),um=()=>({state:n,dispatch:e})=>Yc(n,e),dm=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Wr(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=Wr(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})=>op(n,e),pm=()=>({state:n,dispatch:e})=>sp(n,e);function du(){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))ti()||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 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 Xn(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=>Lr(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 Xn(t,i,e)?cp(t,r):!1},bm=()=>({state:n,dispatch:e})=>Qc(n,e),vm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return xp(r)(e,t)},Sm=()=>({state:n,dispatch:e})=>Xc(n,e);function ni(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=ni(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})=>Kc(n,e),Mm=()=>({state:n,dispatch:e})=>Gc(n,e),Tm=()=>({state:n,dispatch:e})=>hp(n,e),Em=()=>({state:n,dispatch:e})=>gp(n,e),Om=()=>({state:n,dispatch:e})=>mp(n,e);function yo(n,e,t={},r={}){return Br(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=yo(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 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 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 ns(n){return e=>hu(e.$from,n)}function Rm(n,e){const t={from:0,to:n.content.size};return iu(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=ni(typeof e=="string"?e:e.name,n.schema);return t==="node"?Dm(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=ts(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 xr(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 bo(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=>Lr(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=>Lr(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 Xn(n,null,t)||bo(n,null,t);const r=ni(e,n.schema);return r==="node"?Xn(n,e,t):r==="mark"?bo(n,e,t):!1}function zl(n,e){const{nodeExtensions:t}=Zr(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 rs(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&&(rs(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function _m(n){return n instanceof z}function zm(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 Lm=(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 zm(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=z.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=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},Hm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return Cp(r)(e,t)};function Ll(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=xr(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&&Ll(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 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&&Ll(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={...xr(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(L.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...xr(f,d.type.name,d.attrs),...e},m={...xr(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},Di=(n,e)=>{const t=ns(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},Pi=(n,e)=>{const t=ns(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=ns(T=>zl(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(zl(v.node.type.name,d)&&h.validContent(v.node.content)&&l)return a().command(()=>(o.setNodeMarkup(v.pos,h),!0)).command(()=>Di(o,h)).command(()=>Pi(o,h)).run()}return!t||!k||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Di(o,h)).command(()=>Pi(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(()=>Di(o,h)).command(()=>Pi(o,h)).run()},Um=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Wt(n,r.schema);return bo(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=Xn(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 Xn(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=ts(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=ni(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 yp(i,e)(t,r)},eg=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return bp(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:Lm,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 Le({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 Le({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),og=Ne.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}}}})]}}),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 ti()||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=B.atStart(e.doc).from,c=B.atEnd(e.doc).to;if(o||!(s===a&&l===c)||!rs(t.doc))return;const f=t.tr,h=Gr({state:t,transaction:f}),{commands:p}=new Xr({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),lg=Ne.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})}}})]}}),ag=Ne.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 cg=`.ProseMirror {
43
+ `,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 Hc(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const tp=Ee.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pe({key:new Xe("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=Hc(t);return jc(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),np=()=>({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),rp=(n=!1)=>({commands:e})=>e.setContent("",n),ip=()=>({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=Tn(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},op=n=>e=>n(e),sp=()=>({state:n,dispatch:e})=>Ic(n,e),lp=(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},ap=()=>({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},cp=n=>({tr:e,state:t,dispatch:r})=>{const i=be(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},dp=()=>({state:n,dispatch:e})=>jo(n,e),fp=()=>({commands:n})=>n.keyboardShortcut("Enter"),hp=()=>({state:n,dispatch:e})=>Mh(n,e);function Ir(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Uo(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Vc(n,e,t={}){return n.find(r=>r.type===e&&Ir(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function gl(n,e,t={}){return!!Vc(n,e,t)}function Ko(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),!Vc([...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&&gl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&gl([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Ft(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 pp=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Ft(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const d=Ko(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},mp=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 Fc(n){return n instanceof L}function Yt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Wc(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"?L.create(n,Yt(0,i,o),Yt(n.content.size,i,o)):L.create(n,Yt(e,i,o),Yt(e,i,o))}function qc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Zr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const gp=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Zr()||qc())&&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&&!Fc(t.state.selection))return s(),!0;const l=Wc(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},yp=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),bp=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Uc=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&&Uc(r)}return n};function lr(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Uc(t)}function _r(n,e,t){if(n instanceof _t||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),_r("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const a=new Ta({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(lr(n),t.parseOptions):zt.fromSchema(a).parse(lr(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(lr(n),t.parseOptions).content:o.parse(lr(n),t.parseOptions)}return _r("",e,t)}function Sp(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof me||i instanceof ge))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 xp=n=>!("type"in n),vp=(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=_r(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((xp(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&&Sp(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},wp=()=>({state:n,dispatch:e})=>wh(n,e),kp=()=>({state:n,dispatch:e})=>kh(n,e),Cp=()=>({state:n,dispatch:e})=>Tc(n,e),Mp=()=>({state:n,dispatch:e})=>Rc(n,e),Ep=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Hr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Tp=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Hr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Op=()=>({state:n,dispatch:e})=>xh(n,e),Np=()=>({state:n,dispatch:e})=>vh(n,e);function Kc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Ap(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))Zr()||Kc()?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 Rp=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Ap(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 Jn(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?be(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=>Ir(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const Dp=(n,e={})=>({state:t,dispatch:r})=>{const i=be(n,t.schema);return Jn(t,i,e)?Ch(t,r):!1},Pp=()=>({state:n,dispatch:e})=>_c(n,e),Ip=n=>({state:e,dispatch:t})=>{const r=be(n,e.schema);return zh(r)(e,t)},_p=()=>({state:n,dispatch:e})=>Pc(n,e);function Qr(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function yl(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 zp=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=Qr(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=be(n,r.schema)),l==="mark"&&(s=Ft(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,yl(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&t.addMark(u,u+c.nodeSize,s.create(yl(d.attrs,e)))})})}),!0):!1},Lp=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Bp=()=>({tr:n,dispatch:e})=>{if(e){const t=new Je(n.doc);n.setSelection(t)}return!0},$p=()=>({state:n,dispatch:e})=>Nc(n,e),jp=()=>({state:n,dispatch:e})=>Dc(n,e),Hp=()=>({state:n,dispatch:e})=>Oh(n,e),Vp=()=>({state:n,dispatch:e})=>Rh(n,e),Fp=()=>({state:n,dispatch:e})=>Ah(n,e);function ao(n,e,t={},r={}){return _r(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Wp=(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=ao(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 Jc(n,e){const t=Ft(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 qp(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 Yc(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 Jo(n){return e=>Yc(e.$from,n)}function Up(n,e){const t={from:0,to:n.content.size};return jc(n,t,e)}function Kp(n,e){const t=be(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 Jp(n,e){const t=Qr(typeof e=="string"?e:e.name,n.schema);return t==="node"?Kp(n,e):t==="mark"?Jc(n,e):{}}function Gc(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=Ko(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 br(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 co(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Ft(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>Ir(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),v=x-b;s+=v,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=>Ir(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 Yp(n,e,t={}){if(!e)return Jn(n,null,t)||co(n,null,t);const r=Qr(e,n.schema);return r==="node"?Jn(n,e,t):r==="mark"?co(n,e,t):!1}function bl(n,e){const{nodeExtensions:t}=Yr(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(R(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Yo(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&&(Yo(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Gp(n){return n instanceof z}function Xp(n,e,t){var r;const{selection:i}=e;let o=null;if(Fc(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 Zp=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,a=Ft(n,r.schema);if(i)if(s){const c=Jc(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 Xp(r,t,a)},Qp=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),em=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=be(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})=>fl(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>fl(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},tm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Yt(n,0,r.content.size),o=z.create(r,i);e.setSelection(o)}return!0},nm=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=Yt(i,s,l),c=Yt(o,s,l),u=L.create(r,a,c);e.setSelection(u)}return!0},rm=n=>({state:e,dispatch:t})=>{const r=be(n,e.schema);return $h(r)(e,t)};function Sl(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 im=({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=br(c,l.node().type.name,l.node().attrs);if(o instanceof z&&o.node.isBlock)return!l.parentOffset||!vt(s,l.pos)?!1:(r&&(n&&Sl(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:qp(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=vt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&vt(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&&Sl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},om=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=be(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 $=a.depth-x;$>=a.depth-3;$-=1)b=C.from(a.node($).copy(b));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...br(f,a.node().type.name,a.node().attrs),...e},S=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(k))||void 0;b=b.append(C.from(l.createAndFill(null,S)||void 0));const M=a.before(a.depth-(x-1));t.replace(M,a.after(-v),new T(b,4-x,0));let O=-1;t.doc.nodesBetween(M,t.doc.content.size,($,P)=>{if(O>-1)return!1;$.isTextblock&&$.content.size===0&&(O=P+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={...br(f,d.type.name,d.attrs),...e},m={...br(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(!vt(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:x}=r,{splittableMarks:v}=o.extensionManager,k=x||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!k||!i)return!0;const S=k.filter(M=>v.includes(M.type.name));t.ensureMarks(S)}return!0},Ci=(n,e)=>{const t=Jo(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},Mi=(n,e)=>{const t=Jo(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},sm=(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=be(n,s.schema),p=be(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:x}=m,v=b.blockRange(x),k=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const S=Jo(M=>bl(M.type.name,d))(m);if(v.depth>=1&&S&&v.depth-S.depth<=1){if(S.node.type===h)return c.liftListItem(p);if(bl(S.node.type.name,d)&&h.validContent(S.node.content)&&l)return a().command(()=>(o.setNodeMarkup(S.pos,h),!0)).command(()=>Ci(o,h)).command(()=>Mi(o,h)).run()}return!t||!k||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Ci(o,h)).command(()=>Mi(o,h)).run():a().command(()=>{const M=u().wrapInList(h,r),O=k.filter($=>f.includes($.type.name));return o.ensureMarks(O),M?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Ci(o,h)).command(()=>Mi(o,h)).run()},lm=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Ft(n,r.schema);return co(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},am=(n,e,t={})=>({state:r,commands:i})=>{const o=be(n,r.schema),s=be(e,r.schema),l=Jn(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})},cm=(n,e={})=>({state:t,commands:r})=>{const i=be(n,t.schema);return Jn(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},dm=()=>({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},fm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Ft(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=Ko(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},hm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=Qr(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=be(n,r.schema)),l==="mark"&&(s=Ft(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),v=Math.min(g+m.nodeSize,u);t.addMark(x,v,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},pm=(n,e={})=>({state:t,dispatch:r})=>{const i=be(n,t.schema);return Dh(i,e)(t,r)},mm=(n,e={})=>({state:t,dispatch:r})=>{const i=be(n,t.schema);return Ph(i,e)(t,r)};var gm=Object.freeze({__proto__:null,blur:np,clearContent:rp,clearNodes:ip,command:op,createParagraphNear:sp,cut:lp,deleteCurrentNode:ap,deleteNode:cp,deleteRange:up,deleteSelection:dp,enter:fp,exitCode:hp,extendMarkRange:pp,first:mp,focus:gp,forEach:yp,insertContent:bp,insertContentAt:vp,joinBackward:Cp,joinDown:kp,joinForward:Mp,joinItemBackward:Ep,joinItemForward:Tp,joinTextblockBackward:Op,joinTextblockForward:Np,joinUp:wp,keyboardShortcut:Rp,lift:Dp,liftEmptyBlock:Pp,liftListItem:Ip,newlineInCode:_p,resetAttributes:zp,scrollIntoView:Lp,selectAll:Bp,selectNodeBackward:$p,selectNodeForward:jp,selectParentNode:Hp,selectTextblockEnd:Vp,selectTextblockStart:Fp,setContent:Wp,setMark:Zp,setMeta:Qp,setNode:em,setNodeSelection:tm,setTextSelection:nm,sinkListItem:rm,splitBlock:im,splitListItem:om,toggleList:sm,toggleMark:lm,toggleNode:am,toggleWrap:cm,undoInputRule:um,unsetAllMarks:dm,unsetMark:fm,updateAttributes:hm,wrapIn:pm,wrapInList:mm});const ym=Ee.create({name:"commands",addCommands(){return{...gm}}}),bm=Ee.create({name:"drop",addProseMirrorPlugins(){return[new Pe({key:new Xe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Sm=Ee.create({name:"editable",addProseMirrorPlugins(){return[new Pe({key:new Xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),xm=Ee.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Pe({key:new Xe("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}}}})]}}),vm=Ee.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 Zr()||Kc()?o:i},addProseMirrorPlugins(){return[new Pe({key:new Xe("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)||!Yo(t.doc))return;const f=t.tr,h=Kr({state:t,transaction:f}),{commands:p}=new Jr({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),wm=Ee.create({name:"paste",addProseMirrorPlugins(){return[new Pe({key:new Xe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),km=Ee.create({name:"tabindex",addProseMirrorPlugins(){return[new Pe({key:new Xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ut{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 Ut(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 Ut(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 Ut(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 Ut(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Ut(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 Cm=`.ProseMirror {
43
44
  position: relative;
44
45
  }
45
46
 
@@ -113,9 +114,9 @@ img.ProseMirror-separator {
113
114
 
114
115
  .tippy-box[data-animation=fade][data-state=hidden] {
115
116
  opacity: 0
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=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?[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 Xr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=yo(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=yo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=au(t,this.options.autofocus);this.view=new Yh(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 Qo(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
117
+ }`;function Mm(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 Em extends jh{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=Mm(Cm,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=$c(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?[Sm,tp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),ym,xm,vm,km,bm,wm].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 yn(i,this)}createCommandManager(){this.commandManager=new Jr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=ao(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=ao(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Wc(t,this.options.autofocus);this.view=new uh(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:gn.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 Jp(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Yp(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return qo(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
117
118
 
118
- `,textSerializers:r={}}=e||{};return Rm(this.state.doc,{blockSeparator:t,textSerializers:{...ou(this.schema),...r}})}get isEmpty(){return rs(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 Qr({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 Qr({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 vo(n){return new Qr({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 Qr({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&&zo(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:()=>ei(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=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"&&(ti()||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 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(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 hg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var So={exports:{}},Ii={};/**
119
+ `,textSerializers:r={}}=e||{};return Up(this.state.doc,{blockSeparator:t,textSerializers:{...Hc(this.schema),...r}})}get isEmpty(){return Yo(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 Ut(t,this)}get $doc(){return this.$pos(0)}}function on(n){return new Gr({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(Gc(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 Xc(n){return new Gr({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 uo(n){return new Gr({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 En(n){return new Gr({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&&Oo(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 le{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(R(this,"addOptions",{name:this.name}))),this.storage=q(R(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new le(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Xr(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new le(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(R(t,"addOptions",{name:t.name})),t.storage=q(R(t,"addStorage",{name:t.name,options:t.options})),t}}class Tm{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(),v=(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+v,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"&&(Zr()||qc())&&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 sn(n){return new Yh({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(Gc(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 Om(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fo={exports:{}},Ei={};/**
119
120
  * @license React
120
121
  * use-sync-external-store-shim.production.min.js
121
122
  *
@@ -123,7 +124,7 @@ img.ProseMirror-separator {
123
124
  *
124
125
  * This source code is licensed under the MIT license found in the
125
126
  * LICENSE file in the root directory of this source tree.
126
- */var Bl;function pg(){if(Bl)return Ii;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 Ii.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Ii}var _i={};/**
127
+ */var xl;function Nm(){if(xl)return Ei;xl=1;var n=D;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 Ei.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Ei}var Ti={};/**
127
128
  * @license React
128
129
  * use-sync-external-store-shim.development.js
129
130
  *
@@ -131,7 +132,7 @@ img.ProseMirror-separator {
131
132
  *
132
133
  * This source code is licensed under the MIT license found in the
133
134
  * LICENSE file in the root directory of this source tree.
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"?So.exports=pg():So.exports=mg();var ri=So.exports;const gg=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},yg=({contentComponent:n})=>{const e=ri.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]:Hr.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),xo={exports:{}},zi={};/**
135
+ */var vl;function Am(){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=D,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(v){{for(var k=arguments.length,S=new Array(k>1?k-1:0),M=1;M<k;M++)S[M-1]=arguments[M];r("error",v,S)}}function r(v,k,S){{var M=e.ReactDebugCurrentFrame,O=M.getStackAddendum();O!==""&&(k+="%s",S=S.concat([O]));var $=S.map(function(P){return String(P)});$.unshift("Warning: "+k),Function.prototype.apply.call(console[v],console,$)}}function i(v,k){return v===k&&(v!==0||1/v===1/k)||v!==v&&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(v,k,S){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 M=k();if(!d){var O=k();o(M,O)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var $=s({inst:{value:M,getSnapshot:k}}),P=$[0].inst,re=$[1];return a(function(){P.value=M,P.getSnapshot=k,h(P)&&re({inst:P})},[v,M,k]),l(function(){h(P)&&re({inst:P});var ae=function(){h(P)&&re({inst:P})};return v(ae)},[v]),c(M),M}function h(v){var k=v.getSnapshot,S=v.value;try{var M=k();return!o(S,M)}catch{return!0}}function p(v,k,S){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;Ti.useSyncExternalStore=x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ti}process.env.NODE_ENV==="production"?fo.exports=Nm():fo.exports=Am();var ei=fo.exports;const Rm=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Dm=({contentComponent:n})=>{const e=ei.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return D.createElement(D.Fragment,null,Object.values(e))};function Pm(){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]:$r.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 Im extends D.Component{constructor(e){var t;super(e),this.editorContentRef=D.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=Pm(),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 D.createElement(D.Fragment,null,D.createElement("div",{ref:Rm(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&D.createElement(Dm,{contentComponent:e.contentComponent}))}}const _m=D.forwardRef((n,e)=>{const t=D.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return D.createElement(Im,{key:t,innerRef:e,...n})}),zm=D.memo(_m);var Lm=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},Bm=Om(Lm),ho={exports:{}},Oi={};/**
135
136
  * @license React
136
137
  * use-sync-external-store-shim/with-selector.production.min.js
137
138
  *
@@ -139,7 +140,7 @@ img.ProseMirror-separator {
139
140
  *
140
141
  * This source code is licensed under the MIT license found in the
141
142
  * LICENSE file in the root directory of this source tree.
142
- */var jl;function Cg(){if(jl)return zi;jl=1;var n=I,e=ri;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 zi.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},zi}var Li={};/**
143
+ */var wl;function $m(){if(wl)return Oi;wl=1;var n=D,e=ei;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 Oi.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(M){if(!x){if(x=!0,v=M,M=f(M),h!==void 0&&m.hasValue){var O=m.value;if(h(O,M))return k=O}return k=M}if(O=k,r(v,M))return O;var $=f(M);return h!==void 0&&h(O,$)?O:(v=M,k=$)}var x=!1,v,k,S=d===void 0?null:d;return[function(){return b(u())},S===null?void 0:function(){return b(S())}]},[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},Oi}var Ni={};/**
143
144
  * @license React
144
145
  * use-sync-external-store-shim/with-selector.development.js
145
146
  *
@@ -147,219 +148,219 @@ img.ProseMirror-separator {
147
148
  *
148
149
  * This source code is licensed under the MIT license found in the
149
150
  * LICENSE file in the root directory of this source tree.
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=ri;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 ve=h(Me);if(p!==void 0&&g.hasValue){var pe=g.value;if(p(pe,ve))return A=pe,pe}return A=ve,ve}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}Li.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Li}process.env.NODE_ENV==="production"?xo.exports=Cg():xo.exports=Mg();var Tg=xo.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",wo=typeof window>"u",Ng=wo||!!(typeof window<"u"&&window.next);class is{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 wo||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&&wo&&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?is.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 is(t)),i=ri.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 gu=I.createContext({onDragStart:void 0}),yu=()=>I.useContext(gu),Pg=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 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 zg{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?Hr.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 Lg 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(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 zg(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=zr(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 Lg(n,t,e):{}}/**
151
+ */var kl;function jm(){return kl||(kl=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=D,e=ei;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 S=!1,M,O,$=function(pe){if(!S){S=!0,M=pe;var Fe=h(pe);if(p!==void 0&&g.hasValue){var Se=g.value;if(p(Se,Fe))return O=Se,Se}return O=Fe,Fe}var Ze=M,xe=O;if(r(Ze,pe))return xe;var ve=h(pe);return p!==void 0&&p(xe,ve)?xe:(M=pe,O=ve,ve)},P=f===void 0?null:f,re=function(){return $(d())},ae=P===null?void 0:function(){return $(P())};return[re,ae]},[d,f,h,p]),x=b[0],v=b[1],k=i(u,x,v);return s(function(){g.hasValue=!0,g.value=k},[k]),a(k),k}Ni.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ni}process.env.NODE_ENV==="production"?ho.exports=$m():ho.exports=jm();var Hm=ho.exports;const Vm=typeof window<"u"?D.useLayoutEffect:D.useEffect;class Fm{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 Wm(n){var e;const[t]=D.useState(()=>new Fm(n.editor)),r=Hm.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:Bm);return Vm(()=>t.watch(n.editor),[n.editor,t]),D.useDebugValue(r),r}const Cl=process.env.NODE_ENV!=="production",po=typeof window>"u",qm=po||!!(typeof window<"u"&&window.next);class Go{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 po||qm?(Cl&&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&&po&&Cl)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 Em(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?Go.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 Um(n={},e=[]){const t=D.useRef(n);t.current=n;const[r]=D.useState(()=>new Go(t)),i=ei.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return D.useDebugValue(i),D.useEffect(r.onRender(e)),Wm({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&o===0?0:o+1}),i}const Km=D.createContext({editor:null});Km.Consumer;const Zc=D.createContext({onDragStart:void 0}),Qc=()=>D.useContext(Zc),Jm=n=>{const e=n.as||"div",{nodeViewContentRef:t}=Qc();return D.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},eu=D.forwardRef((n,e)=>{const{onDragStart:t}=Qc(),r=n.as||"div";return D.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Ym(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Gm(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class Xm{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?$r.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,i=this.editor;(Ym(t)||Gm(t))&&(r.ref=o=>{this.ref=o}),this.reactElement=D.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 Zm extends Tm{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=D.memo(c=>D.createElement(Zc.Provider,{value:i},D.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 Xm(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=Pr(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function tu(n,e){return t=>t.editor.contentComponent?new Zm(n,t,e):{}}/**
151
152
  * @license lucide-react v0.474.0 - ISC
152
153
  *
153
154
  * This source code is licensed under the ISC license.
154
155
  * See the LICENSE file in the root directory of this source tree.
155
- */const Bg=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Su=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
156
+ */const Qm=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nu=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
156
157
  * @license lucide-react v0.474.0 - ISC
157
158
  *
158
159
  * This source code is licensed under the ISC license.
159
160
  * See the LICENSE file in the root directory of this source tree.
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"};/**
161
+ */var eg={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"};/**
161
162
  * @license lucide-react v0.474.0 - ISC
162
163
  *
163
164
  * This source code is licensed under the ISC license.
164
165
  * See the LICENSE file in the root directory of this source tree.
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:Su("lucide",i),...l},[...s.map(([c,u])=>I.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
166
+ */const tg=D.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...l},a)=>D.createElement("svg",{ref:a,...eg,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:nu("lucide",i),...l},[...s.map(([c,u])=>D.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
166
167
  * @license lucide-react v0.474.0 - ISC
167
168
  *
168
169
  * This source code is licensed under the ISC license.
169
170
  * See the LICENSE file in the root directory of this source tree.
170
- */const ee=(n,e)=>{const t=I.forwardRef(({className:r,...i},o)=>I.createElement(jg,{ref:o,iconNode:e,className:Su(`lucide-${Bg(n)}`,r),...i}));return t.displayName=`${n}`,t};/**
171
+ */const X=(n,e)=>{const t=D.forwardRef(({className:r,...i},o)=>D.createElement(tg,{ref:o,iconNode:e,className:nu(`lucide-${Qm(n)}`,r),...i}));return t.displayName=`${n}`,t};/**
171
172
  * @license lucide-react v0.474.0 - ISC
172
173
  *
173
174
  * This source code is licensed under the ISC license.
174
175
  * See the LICENSE file in the root directory of this source tree.
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);/**
176
+ */const ng=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],rg=X("AlignCenter",ng);/**
176
177
  * @license lucide-react v0.474.0 - ISC
177
178
  *
178
179
  * This source code is licensed under the ISC license.
179
180
  * See the LICENSE file in the root directory of this source tree.
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);/**
181
+ */const ig=[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],og=X("AlignJustify",ig);/**
181
182
  * @license lucide-react v0.474.0 - ISC
182
183
  *
183
184
  * This source code is licensed under the ISC license.
184
185
  * See the LICENSE file in the root directory of this source tree.
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);/**
186
+ */const sg=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],lg=X("AlignLeft",sg);/**
186
187
  * @license lucide-react v0.474.0 - ISC
187
188
  *
188
189
  * This source code is licensed under the ISC license.
189
190
  * See the LICENSE file in the root directory of this source tree.
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);/**
191
+ */const ag=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],cg=X("AlignRight",ag);/**
191
192
  * @license lucide-react v0.474.0 - ISC
192
193
  *
193
194
  * This source code is licensed under the ISC license.
194
195
  * See the LICENSE file in the root directory of this source tree.
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);/**
196
+ */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"}]],dg=X("Bold",ug);/**
196
197
  * @license lucide-react v0.474.0 - ISC
197
198
  *
198
199
  * This source code is licensed under the ISC license.
199
200
  * See the LICENSE file in the root directory of this source tree.
200
- */const Xg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Zg=ee("ChevronDown",Xg);/**
201
+ */const fg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],hg=X("ChevronDown",fg);/**
201
202
  * @license lucide-react v0.474.0 - ISC
202
203
  *
203
204
  * This source code is licensed under the ISC license.
204
205
  * See the LICENSE file in the root directory of this source tree.
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);/**
206
+ */const pg=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],mg=X("Code",pg);/**
206
207
  * @license lucide-react v0.474.0 - ISC
207
208
  *
208
209
  * This source code is licensed under the ISC license.
209
210
  * See the LICENSE file in the root directory of this source tree.
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);/**
211
+ */const gg=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],yg=X("CornerDownRight",gg);/**
211
212
  * @license lucide-react v0.474.0 - ISC
212
213
  *
213
214
  * This source code is licensed under the ISC license.
214
215
  * See the LICENSE file in the root directory of this source tree.
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"}]],Bi=ee("Heading1",ry);/**
216
+ */const bg=[["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"}]],Ai=X("Heading1",bg);/**
216
217
  * @license lucide-react v0.474.0 - ISC
217
218
  *
218
219
  * This source code is licensed under the ISC license.
219
220
  * See the LICENSE file in the root directory of this source tree.
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);/**
221
+ */const Sg=[["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"}]],Ml=X("Heading2",Sg);/**
221
222
  * @license lucide-react v0.474.0 - ISC
222
223
  *
223
224
  * This source code is licensed under the ISC license.
224
225
  * See the LICENSE file in the root directory of this source tree.
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);/**
226
+ */const xg=[["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"}]],El=X("Heading3",xg);/**
226
227
  * @license lucide-react v0.474.0 - ISC
227
228
  *
228
229
  * This source code is licensed under the ISC license.
229
230
  * See the LICENSE file in the root directory of this source tree.
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);/**
231
+ */const vg=[["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"}]],Tl=X("Heading4",vg);/**
231
232
  * @license lucide-react v0.474.0 - ISC
232
233
  *
233
234
  * This source code is licensed under the ISC license.
234
235
  * See the LICENSE file in the root directory of this source tree.
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);/**
236
+ */const wg=[["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"}]],Ol=X("Heading5",wg);/**
236
237
  * @license lucide-react v0.474.0 - ISC
237
238
  *
238
239
  * This source code is licensed under the ISC license.
239
240
  * See the LICENSE file in the root directory of this source tree.
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);/**
241
+ */const kg=[["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"}]],Nl=X("Heading6",kg);/**
241
242
  * @license lucide-react v0.474.0 - ISC
242
243
  *
243
244
  * This source code is licensed under the ISC license.
244
245
  * See the LICENSE file in the root directory of this source tree.
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);/**
246
+ */const Cg=[["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"}]],Mg=X("Image",Cg);/**
246
247
  * @license lucide-react v0.474.0 - ISC
247
248
  *
248
249
  * This source code is licensed under the ISC license.
249
250
  * See the LICENSE file in the root directory of this source tree.
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);/**
251
+ */const Eg=[["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"}]],Tg=X("Italic",Eg);/**
251
252
  * @license lucide-react v0.474.0 - ISC
252
253
  *
253
254
  * This source code is licensed under the ISC license.
254
255
  * See the LICENSE file in the root directory of this source tree.
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);/**
256
+ */const Og=[["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"}]],Ng=X("Layers",Og);/**
256
257
  * @license lucide-react v0.474.0 - ISC
257
258
  *
258
259
  * This source code is licensed under the ISC license.
259
260
  * See the LICENSE file in the root directory of this source tree.
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);/**
261
+ */const Ag=[["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"}]],Rg=X("ListOrdered",Ag);/**
261
262
  * @license lucide-react v0.474.0 - ISC
262
263
  *
263
264
  * This source code is licensed under the ISC license.
264
265
  * See the LICENSE file in the root directory of this source tree.
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);/**
266
+ */const Dg=[["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"}]],Pg=X("List",Dg);/**
266
267
  * @license lucide-react v0.474.0 - ISC
267
268
  *
268
269
  * This source code is licensed under the ISC license.
269
270
  * See the LICENSE file in the root directory of this source tree.
270
- */const vy=[["path",{d:"M5 12h14",key:"1ays0h"}]],Sy=ee("Minus",vy);/**
271
+ */const Ig=[["path",{d:"M5 12h14",key:"1ays0h"}]],_g=X("Minus",Ig);/**
271
272
  * @license lucide-react v0.474.0 - ISC
272
273
  *
273
274
  * This source code is licensed under the ISC license.
274
275
  * See the LICENSE file in the root directory of this source tree.
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);/**
276
+ */const zg=[["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"}]],Lg=X("PaintBucket",zg);/**
276
277
  * @license lucide-react v0.474.0 - ISC
277
278
  *
278
279
  * This source code is licensed under the ISC license.
279
280
  * See the LICENSE file in the root directory of this source tree.
280
- */const ky=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Cy=ee("Plus",ky);/**
281
+ */const Bg=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$g=X("Plus",Bg);/**
281
282
  * @license lucide-react v0.474.0 - ISC
282
283
  *
283
284
  * This source code is licensed under the ISC license.
284
285
  * See the LICENSE file in the root directory of this source tree.
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);/**
286
+ */const jg=[["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"}]],Hg=X("Quote",jg);/**
286
287
  * @license lucide-react v0.474.0 - ISC
287
288
  *
288
289
  * This source code is licensed under the ISC license.
289
290
  * See the LICENSE file in the root directory of this source tree.
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);/**
291
+ */const Vg=[["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"}]],Fg=X("Redo",Vg);/**
291
292
  * @license lucide-react v0.474.0 - ISC
292
293
  *
293
294
  * This source code is licensed under the ISC license.
294
295
  * See the LICENSE file in the root directory of this source tree.
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);/**
296
+ */const Wg=[["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"}]],qg=X("SquareCheckBig",Wg);/**
296
297
  * @license lucide-react v0.474.0 - ISC
297
298
  *
298
299
  * This source code is licensed under the ISC license.
299
300
  * See the LICENSE file in the root directory of this source tree.
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);/**
301
+ */const Ug=[["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"}]],Kg=X("Strikethrough",Ug);/**
301
302
  * @license lucide-react v0.474.0 - ISC
302
303
  *
303
304
  * This source code is licensed under the ISC license.
304
305
  * See the LICENSE file in the root directory of this source tree.
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);/**
306
+ */const Jg=[["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"}]],Yg=X("Subscript",Jg);/**
306
307
  * @license lucide-react v0.474.0 - ISC
307
308
  *
308
309
  * This source code is licensed under the ISC license.
309
310
  * See the LICENSE file in the root directory of this source tree.
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"}]],zy=ee("Superscript",_y);/**
311
+ */const Gg=[["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"}]],Xg=X("Superscript",Gg);/**
311
312
  * @license lucide-react v0.474.0 - ISC
312
313
  *
313
314
  * This source code is licensed under the ISC license.
314
315
  * See the LICENSE file in the root directory of this source tree.
315
- */const Ly=[["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",Ly);/**
316
+ */const Zg=[["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"}]],Qg=X("Table",Zg);/**
316
317
  * @license lucide-react v0.474.0 - ISC
317
318
  *
318
319
  * This source code is licensed under the ISC license.
319
320
  * See the LICENSE file in the root directory of this source tree.
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);/**
321
+ */const ey=[["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"}]],ty=X("TextCursor",ey);/**
321
322
  * @license lucide-react v0.474.0 - ISC
322
323
  *
323
324
  * This source code is licensed under the ISC license.
324
325
  * See the LICENSE file in the root directory of this source tree.
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);/**
326
+ */const ny=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],ry=X("Underline",ny);/**
326
327
  * @license lucide-react v0.474.0 - ISC
327
328
  *
328
329
  * This source code is licensed under the ISC license.
329
330
  * See the LICENSE file in the root directory of this source tree.
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);/**
331
+ */const iy=[["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"}]],oy=X("Undo",iy);/**
331
332
  * @license lucide-react v0.474.0 - ISC
332
333
  *
333
334
  * This source code is licensed under the ISC license.
334
335
  * See the LICENSE file in the root directory of this source tree.
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 $r=({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($r,{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($r,{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(Bi,{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(Bi,{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([Bi,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:`
336
+ */const sy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ly=X("X",sy);function ay({editor:n}){const[e,t]=D.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(ly,{size:24}):w.jsx(Ng,{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($g,{size:16})," Accordion"]})]})})]})}const zr=({value:n,onChange:e})=>w.jsx(lt.ColorPicker,{value:n,onChange:e,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]}),cy=({editor:n})=>{const[e,t]=D.useState("#1677ff"),[r,i]=D.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(lt.Tooltip,{title:"Text Color",children:w.jsxs("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsx(ty,{size:20,color:"black"}),w.jsx(zr,{value:e,onChange:o})]})}),w.jsx(lt.Tooltip,{title:"Highlight Color",children:w.jsxs("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsx(Lg,{size:20,color:"black"}),w.jsx(zr,{value:r,onChange:s})]})})]})},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.jsx(Ai,{size:16});case 2:return w.jsx(Ml,{size:16});case 3:return w.jsx(El,{size:16});case 4:return w.jsx(Tl,{size:16});case 5:return w.jsx(Ol,{size:16});case 6:return w.jsx(Nl,{size:16})}return w.jsx(Ai,{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:[D.createElement([Ai,Ml,El,Tl,Ol,Nl][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(lt.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()})})},dy=8,fy=8,hy=({editor:n,buttonClass:e,activeClass:t})=>{const[r,i]=D.useState({rows:0,cols:0}),[o,s]=D.useState(!1),l=(a,c)=>{n.chain().focus().insertTable({rows:a,cols:c,withHeaderRow:!0}).run(),s(!1)};return w.jsx(lt.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:dy}).map((a,c)=>Array.from({length:fy}).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(Qg,{className:"w-5 h-5"})})})};function py({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(lt.Tooltip,{title:a,children:w.jsx("button",{type:"button",onClick:o,disabled:l,className:`
336
337
  ${e}
337
338
  ${s?t:""}
338
339
  ${l?"opacity-50 cursor-not-allowed":""}
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(zy,{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 xu=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(`
340
+ `,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(dg,{size:16}),()=>n.chain().focus().toggleBold().run(),n.isActive("bold"),!1,"Bold"),r(w.jsx(Tg,{size:16}),()=>n.chain().focus().toggleItalic().run(),n.isActive("italic"),!1,"Italic"),r(w.jsx(ry,{size:16}),()=>n.chain().focus().toggleUnderline().run(),n.isActive("underline"),!1,"Underline"),r(w.jsx(Kg,{size:16}),()=>n.chain().focus().toggleStrike().run(),n.isActive("strike"),!1,"Strikethrough"),r(w.jsx(mg,{size:16}),()=>n.chain().focus().toggleCode().run(),n.isActive("code"),!1,"Code"),r(w.jsx(Yg,{size:16}),()=>n.chain().focus().toggleSubscript().run(),n.isActive("subscript"),!1,"Subscript"),r(w.jsx(Xg,{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(uy,{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(lg,{size:16}),()=>n.chain().focus().setTextAlign("left").run(),n.isActive({textAlign:"left"}),!1,"Align Left"),r(w.jsx(rg,{size:16}),()=>n.chain().focus().setTextAlign("center").run(),n.isActive({textAlign:"center"}),!1,"Align Center"),r(w.jsx(cg,{size:16}),()=>n.chain().focus().setTextAlign("right").run(),n.isActive({textAlign:"right"}),!1,"Align Right"),r(w.jsx(og,{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(Pg,{size:16}),()=>n.chain().focus().toggleBulletList().run(),n.isActive("bulletList"),!1,"Bullet List"),r(w.jsx(Rg,{size:16}),()=>n.chain().focus().toggleOrderedList().run(),n.isActive("orderedList"),!1,"Ordered List"),r(w.jsx(qg,{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(Hg,{size:16}),()=>n.chain().focus().toggleBlockquote().run(),n.isActive("blockquote"),!1,"Blockquote"),w.jsx(hy,{editor:n,buttonClass:e,activeClass:t}),r(w.jsx(_g,{size:16}),()=>n.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),r(w.jsx(yg,{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(oy,{size:16}),()=>n.chain().focus().undo().run(),!1,!n.can().chain().focus().undo().run()),r(w.jsx(Fg,{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(Mg,{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(cy,{editor:n}),w.jsx("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"}),w.jsx(ay,{editor:n})]})}const ru=le.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ne(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)}}}),my=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}`)})},Al=Ge.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&my(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",ne(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}}}}),gy=Ee.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()}}}),yy=/^\s*>\s$/,by=le.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",ne(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[En({find:yy,type:this.type})]}}),Sy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,xy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,vy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,wy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ky=Ge.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",ne(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[on({find:Sy,type:this.type}),on({find:vy,type:this.type})]},addPasteRules(){return[sn({find:xy,type:this.type}),sn({find:wy,type:this.type})]}}),Cy="listItem",Rl="textStyle",Dl=/^\s*([-+*])\s$/,My=le.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",ne(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(Cy,this.editor.getAttributes(Rl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=En({find:Dl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=En({find:Dl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Rl),editor:this.editor})),[n]}}),Ey=/(^|[^`])`([^`]+)`(?!`)/,Ty=/(^|[^`])`([^`]+)`(?!`)/g,Oy=Ge.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ne(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[on({find:Ey,type:this.type})]},addPasteRules(){return[sn({find:Ty,type:this.type})]}}),Ny=/^```([a-z]+)?[\s\n]$/,Ay=/^~~~([a-z]+)?[\s\n]$/,Ry=le.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",ne(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(`
340
341
 
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[vo({find:pb,type:this.type,getAttributes:n=>({language:n[1]})}),vo({find:mb,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,`
342
- `));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}}})]}}),yb=ce.create({name:"doc",topNode:!0,content:"block+"});function bb(n={}){return new Le({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 ss(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&&!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;B.jsonID("gapcursor",de);class ss{constructor(e){this.pos=e}map(e){return new ss(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 Le({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=Ko({ArrowLeft:dr("horiz",-1),ArrowRight:dr("horiz",1),ArrowUp:dr("vert",-1),ArrowDown:dr("vert",1)});function dr(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 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&&z.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(L.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=>vo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var jr=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<jr&&this.leafAppend(e)||this.length<jr&&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 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<=jr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=jr)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 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 Un;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,wr(e)),n.undone,Xl(t.mapping.maps),n.prevTime,n.prevComposition):new Nt(n.done,n.undone.addTransform(t,void 0,r,wr(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||!zb(t,n.prevRanges)),c=s?$i(n.prevRanges,t.mapping):Xl(t.mapping.maps);return new Nt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,wr(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),$i(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Nt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),$i(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function zb(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 $i(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 Lb(n,e,t){let r=wr(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 ji=!1,Zl=null;function wr(n){let e=n.plugins;if(Zl!=e){ji=!1,Zl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){ji=!0;break}}return ji}const nn=new et("history"),Bb=new et("closeHistory");function $b(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Le({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"?Cu:r=="historyRedo"?Mu: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=Lb(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Cu=ku(!1,!0),Mu=ku(!0,!0),jb=Ne.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Cu(n,e),redo:()=>({state:n,dispatch:e})=>Mu(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(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})]}}),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(xu.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 ko,Co;if(typeof WeakMap<"u"){let n=new WeakMap;ko=e=>n.get(e),Co=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;ko=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Co=(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 ko(n)||Co(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++}(e===0||t===0)&&(o||(o=[])).push({type:"zero_sized"});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 ii(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 Mo(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function y0(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ls(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Tu(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 Eu(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(Mo(r)&&Mo(i)&&ls(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 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 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 Ou{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ou(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&&ls(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 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&&x0(r)?o=L.create(i,r.from):r instanceof L&&w0(r)&&(o=L.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var C0=new et("fix-tables");function Au(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)?Au(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Nu(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&&Au(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})}else if(c.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}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=ii(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 Ru(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,Eu(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(Ru(n.tr,t,t.left))}return!0}function E0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Ru(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 Du(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(Du(n.tr,t,t.top))}return!0}function D0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Du(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,{...Eu(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 z0(({node:r})=>t[r.type.spec.tableRole])(n,e)}function z0(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 L0(n,e){return function(t,r){if(!ct(t))return!1;const i=ii(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 Zn(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"?{left:0,top:u,right:1,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}}Zn("row",{useDeprecatedLogic:!0});Zn("column",{useDeprecatedLogic:!0});var $0=Zn("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(ii(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(L.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 fr(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=To(_e(s).row,new O(c,u,d)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?To(_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 To(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=Ko({ArrowLeft:hr("horiz",-1),ArrowRight:hr("horiz",1),ArrowUp:hr("vert",-1),ArrowDown:hr("vert",1),"Shift-ArrowLeft":pr("horiz",-1),"Shift-ArrowRight":pr("horiz",1),"Shift-ArrowUp":pr("vert",-1),"Shift-ArrowDown":pr("vert",1),Backspace:fr,"Mod-Backspace":fr,Delete:fr,"Mod-Delete":fr});function kr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function hr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof ae)return kr(t,r,B.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 kr(t,r,B.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=Tu(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),kr(t,r,c)}}}function pr(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=Tu(s.$headCell,n,e);return l?kr(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(To(_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=ii(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=Fi(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=Fi(n,c);const d=Dt.getState(n.state)==null;if(!u||!ls(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=Fi(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 ca(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fi(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")),Eo(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,Eo(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Eo(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 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 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 Cr{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 Cr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Cr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Mo(e.doc.resolve(i))||(i=-1),new Cr(i,t.dragging)}return t}};function Q0(n,e,t,r){if(!n.editable)return;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}Iu(n,s)}}}function e1(n){if(!n.editable)return;const e=Ge.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Iu(n,-1)}function t1(n,e,t,r){var i;if(!n.editable)return!1;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 Iu(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&&Eo(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 Le({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,Nu(r,t),n)}})}function Oo(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]=Oo(r,g);c.style.setProperty(S,x)}c=c.nextSibling}else{const S=document.createElement("col"),[x,k]=Oo(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]=Oo(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 mr=({editor:n})=>{const{selection:e}=n.state;if(!f1(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},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(L.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})=>Zn("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Zn("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})=>L0(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&&Nu(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:mr,"Mod-Backspace":mr,Delete:mr,"Mod-Delete":mr}},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]}}),_u=({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(bu,{className:"accordion-wrapper",children:w.jsx(_u,{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($r,{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($r,{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 vu(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[mu({find:v1,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var as={exports:{}},nr={},oi={exports:{}},zu={},Ao={exports:{}},gr={exports:{}},ne={};/** @license React v16.13.1
342
+ `);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[uo({find:Ny,type:this.type,getAttributes:n=>({language:n[1]})}),uo({find:Ay,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Pe({key:new Xe("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,`
343
+ `));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}}})]}}),Dy=le.create({name:"doc",topNode:!0,content:"block+"});function Py(n={}){return new Pe({view(e){return new Iy(e,n)}})}class Iy{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=Ba(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 _y=Ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Py(this.options)]}});class ue extends B{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ue.valid(r)?new ue(r):B.near(r)}content(){return T.empty}eq(e){return e instanceof ue&&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 ue(e.resolve(t.pos))}getBookmark(){return new Xo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!zy(e)||!Ly(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&&ue.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(ue.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(ue.valid(l))return l}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;B.jsonID("gapcursor",ue);class Xo{constructor(e){this.pos=e}map(e){return new Xo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):B.near(t)}}function zy(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 Ly(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 By(){return new Pe({props:{decorations:Vy,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:jy,handleKeyDown:$y,handleDOMEvents:{beforeinput:Hy}}})}const $y=$o({ArrowLeft:ar("horiz",-1),ArrowRight:ar("horiz",1),ArrowUp:ar("vert",-1),ArrowDown:ar("vert",1)});function ar(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=ue.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new ue(c))),!0):!1}}function jy(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ue.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 ue(r))),!0)}function Hy(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ue))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 Vy(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ce.create(n.doc,[ze.widget(n.selection.head,e,{key:"gapcursor"})])}const Fy=Ee.create({name:"gapCursor",addProseMirrorPlugins(){return[By()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=q(R(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Wy=le.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",ne(this.options.HTMLAttributes,n)]},renderText(){return`
344
+ `},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()}}}),qy=le.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]}`,ne(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=>uo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Lr=200,ye=function(){};ye.prototype.append=function(e){return e.length?(e=ye.from(e),!this.length&&e||e.length<Lr&&this.leafAppend(e)||this.length<Lr&&e.leafPrepend(this)||this.appendInner(e)):this};ye.prototype.prepend=function(e){return e.length?ye.from(e).append(this):this};ye.prototype.appendInner=function(e){return new Uy(this,e)};ye.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ye.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ye.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ye.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)};ye.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};ye.from=function(e){return e instanceof ye?e:e&&e.length?new iu(e):ye.empty};var iu=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<=Lr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Lr)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}(ye);ye.empty=new iu([]);var Uy=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}(ye);const Ky=500;class rt{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 st(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 st(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 rt(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 st(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>Yy&&(l=Jy(l,c),s-=c),new rt(l.append(o),s)}remapping(e,t){let r=new Fn;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 rt(this.items.append(e.map(t=>new st(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 st(p,m,g))}else r.push(new st(p))},i);let c=[];for(let f=t;f<s;f++)c.push(new st(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new rt(u,l);return d.emptyItemCount()>Ky&&(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 st(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 rt(ye.from(i.reverse()),o)}}rt.empty=new rt(ye.empty,0);function Jy(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class st{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 st(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 Yy=20;function Gy(n,e,t,r){let i=t.getMeta(en),o;if(i)return i.historyState;t.getMeta(Qy)&&(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(en))return s.getMeta(en).redo?new Nt(n.done.addTransform(t,void 0,r,Sr(e)),n.undone,Pl(t.mapping.maps),n.prevTime,n.prevComposition):new Nt(n.done,n.undone.addTransform(t,void 0,r,Sr(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||!Xy(t,n.prevRanges)),c=s?Ri(n.prevRanges,t.mapping):Pl(t.mapping.maps);return new Nt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Sr(e)),rt.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),Ri(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Nt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ri(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Xy(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 Pl(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 Ri(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 Zy(n,e,t){let r=Sr(e),i=en.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(en,{redo:t,historyState:a})}let Di=!1,Il=null;function Sr(n){let e=n.plugins;if(Il!=e){Di=!1,Il=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Di=!0;break}}return Di}const en=new Xe("history"),Qy=new Xe("closeHistory");function eb(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Pe({key:en,state:{init(){return new Nt(rt.empty,rt.empty,null,0,-1)},apply(e,t,r){return Gy(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?su:r=="historyRedo"?lu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function ou(n,e){return(t,r)=>{let i=en.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Zy(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const su=ou(!1,!0),lu=ou(!0,!0),tb=Ee.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>su(n,e),redo:()=>({state:n,dispatch:e})=>lu(n,e)}},addProseMirrorPlugins(){return[eb(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()}}}),nb=le.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ne(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}):Gp(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[Xc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),rb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ib=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ob=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,lb=Ge.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",ne(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[on({find:rb,type:this.type}),on({find:ob,type:this.type})]},addPasteRules(){return[sn({find:ib,type:this.type}),sn({find:sb,type:this.type})]}}),ab="listItem",_l="textStyle",zl=/^(\d+)\.\s$/,cb=le.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",ne(this.options.HTMLAttributes,t),0]:["ol",ne(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(ab,this.editor.getAttributes(_l)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=En({find:zl,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=En({find:zl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_l)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ub=le.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ne(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),db=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,hb=Ge.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",ne(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[on({find:db,type:this.type})]},addPasteRules(){return[sn({find:fb,type:this.type})]}}),pb=le.create({name:"text",group:"inline"}),mb=Ee.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(ky.configure((n=this.options)===null||n===void 0?void 0:n.bold)),this.options.blockquote!==!1&&x.push(by.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&x.push(My.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&x.push(Oy.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&x.push(Ry.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&x.push(Dy.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&x.push(_y.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&x.push(Fy.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&x.push(Wy.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&x.push(qy.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&x.push(tb.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&x.push(nb.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&x.push(lb.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&x.push(ru.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&x.push(cb.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(hb.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&x.push(pb.configure((b=this.options)===null||b===void 0?void 0:b.text)),x}}),gb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,yb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,bb=Ge.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",ne(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[on({find:gb,type:this.type})]},addPasteRules(){return[sn({find:yb,type:this.type})]}}),Sb=Ge.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",ne(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()}}}),xb=Ge.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",ne(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()}}}),vb=Ge.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",ne(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()}}}),wb=Ee.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")}}}),kb=le.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",ne(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()}}}),Cb=/^\s*(\[([( |x])?\])\s$/,Mb=le.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",ne(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[En({find:Cb,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}});var mo,go;if(typeof WeakMap<"u"){let n=new WeakMap;mo=e=>n.get(e),go=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;mo=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},go=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var de=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 mo(n)||go(n,Eb(n))}};function Eb(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Tb(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 v=0;v<b;v++){if(v+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:b-v});break}const k=i+v*e;for(let S=0;S<g;S++){r[k+S]==0?r[k+S]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:g-S});const M=x&&x[S];if(M){const O=(k+S)%e*2,$=s[O];$==null||$!=M&&s[O+1]==1?(s[O]=M,s[O+1]=1):$==M&&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++}(e===0||t===0)&&(o||(o=[])).push({type:"zero_sized"});const l=new de(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&&Ob(l,s,n),l}function Tb(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 Ob(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=Nb(a)))[c]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function Nb(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Re(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 Xe("selectingCells");function On(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 Ab(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 ot(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 ti(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=On(e.$head)||Rb(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Rb(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 yo(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Db(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Zo(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function au(n,e,t){const r=n.node(-1),i=de.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 ln(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 cu(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 Pb(n,e,t){const r=Re(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 oe=class bt extends B{constructor(e,t=e){const r=e.node(-1),i=de.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 Wa(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(yo(r)&&yo(i)&&Zo(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?bt.rowSelection(r,i):o&&this.isColSelection()?bt.colSelection(r,i):new bt(r,i)}return L.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=de.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=ln(b,0,m)),g>0&&(b=ln(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=B.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=de.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=de.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 bt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=de.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 bt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=de.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 bt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new bt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new bt(e.resolve(t),e.resolve(r))}getBookmark(){return new Ib(this.$anchorCell.pos,this.$headCell.pos)}};oe.prototype.visible=!1;B.jsonID("cell",oe);var Ib=class uu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new uu(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&&Zo(t,r)?new oe(t,r):B.near(r,1)}};function _b(n){if(!(n.selection instanceof oe))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(ze.node(r,r+t.nodeSize,{class:"selectedCell"}))}),ce.create(n.doc,e)}function zb({$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 Lb({$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 Bb(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=oe.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=oe.rowSelection(l,l)}else if(!t){const l=de.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=oe.create(i,a+1,c)}}else r instanceof L&&zb(r)?o=L.create(i,r.from):r instanceof L&&Lb(r)&&(o=L.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var $b=new Xe("fix-tables");function du(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)?du(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function fu(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=jb(n,i,o,t))};return e?e.doc!=n.doc&&du(e.doc,n.doc,0,r):n.doc.descendants(r),t}function jb(n,e,t,r){const i=de.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,ln(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})}else if(c.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}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=Re(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($b,{fixTables:!0})}function dt(n){const e=n.selection,t=ti(n),r=t.node(-1),i=t.start(-1),o=de.get(r);return{...e instanceof oe?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function hu(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;Pb(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,cu(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?Re(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 Hb(n,e){if(!ot(n))return!1;if(e){const t=dt(n);e(hu(n.tr,t,t.left))}return!0}function Vb(n,e){if(!ot(n))return!1;if(e){const t=dt(n);e(hu(n.tr,t,t.right))}return!0}function Fb(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,ln(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 Wb(n,e){if(!ot(n))return!1;if(e){const t=dt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;Fb(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=de.get(o)}e(r)}return!0}function qb(n,e,t){var r;const i=Re(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;qb(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?Re(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,Re(r.type.schema).row.create(null,l)),n}function Ub(n,e){if(!ot(n))return!1;if(e){const t=dt(n);e(pu(n.tr,t,t.top))}return!0}function Kb(n,e){if(!ot(n))return!1;if(e){const t=dt(n);e(pu(n.tr,t,t.bottom))}return!0}function Jb(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 Yb(n,e){if(!ot(n))return!1;if(e){const t=dt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;Jb(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=de.get(t.table)}e(r)}return!0}function Ll(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Gb({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 Bl(n,e){const t=n.selection;if(!(t instanceof oe)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=dt(n),{map:i}=r;if(Gb(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{Ll(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,{...cu(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=Ll(c)?a+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,l)}o.setSelection(new oe(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function $l(n,e){const t=Re(n.schema);return Xb(({node:r})=>t[r.type.spec.tableRole])(n,e)}function Xb(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof oe){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=Ab(i.$from),!o)return!1;s=(r=On(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=dt(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 oe&&d.setSelection(new oe(d.doc.resolve(i.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function Zb(n,e){return function(t,r){if(!ot(t))return!1;const i=ti(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof oe?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 Qb(n){return function(e,t){if(!ot(e))return!1;if(t){const r=Re(e.schema),i=dt(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 jl(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 Yn(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Qb(n):function(t,r){if(!ot(t))return!1;if(r){const i=Re(t.schema),o=dt(t),s=t.tr,l=jl("row",o,i),a=jl("column",o,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?{left:0,top:u,right:1,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}}Yn("row",{useDeprecatedLogic:!0});Yn("column",{useDeprecatedLogic:!0});var e0=Yn("cell",{useDeprecatedLogic:!0});function t0(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 Hl(n){return function(e,t){if(!ot(e))return!1;const r=t0(ti(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(L.between(i,Db(i))).scrollIntoView())}return!0}}function n0(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 cr(n,e){const t=n.selection;if(!(t instanceof oe))return!1;if(e){const r=n.tr,i=Re(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 r0(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=bo(Re(s).row,new T(c,u,d)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?bo(Re(s).row,new T(e,t,r)).content:e);else return null;return i0(s,l)}function i0(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=Re(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 bo(n,e){const t=n.createAndFill();return new Fa(t).replace(0,t.content.size,e).doc}function o0({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(ln(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 s0(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=Re(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 Vl(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 Fl(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,ln(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(p+f.nodeSize,f.type.createAndFill(ln(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function Wl(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=de.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=de.get(o),f=d.mapping.maps.length}s0(d,s,o,t,c,u,f)&&h(),Vl(d,s,o,t,a,c,l,f)&&h(),Vl(d,s,o,t,a,c,u,f)&&h(),Fl(d,s,o,t,l,u,a,f)&&h(),Fl(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 oe(d.doc.resolve(t+s.positionAt(l,a,o)),d.doc.resolve(t+s.positionAt(u-1,c-1,o)))),e(d)}var l0=$o({ArrowLeft:ur("horiz",-1),ArrowRight:ur("horiz",1),ArrowUp:ur("vert",-1),ArrowDown:ur("vert",1),"Shift-ArrowLeft":dr("horiz",-1),"Shift-ArrowRight":dr("horiz",1),"Shift-ArrowUp":dr("vert",-1),"Shift-ArrowDown":dr("vert",1),Backspace:cr,"Mod-Backspace":cr,Delete:cr,"Mod-Delete":cr});function xr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function ur(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof oe)return xr(t,r,B.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=mu(i,n,e);if(s==null)return!1;if(n=="horiz")return xr(t,r,B.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=au(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),xr(t,r,c)}}}function dr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof oe)s=o;else{const a=mu(i,n,e);if(a==null)return!1;s=new oe(t.doc.resolve(a))}const l=au(s.$headCell,n,e);return l?xr(t,r,new oe(s.$anchorCell,l)):!1}}function a0(n,e){const t=n.state.doc,r=On(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new oe(r))),!0):!1}function c0(n,e,t){if(!ot(n.state))return!1;let r=r0(t);const i=n.state.selection;if(i instanceof oe){r||(r={width:1,height:1,rows:[C.from(bo(Re(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=de.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=o0(r,l.right-l.left,l.bottom-l.top),Wl(n.state,n.dispatch,s,l,r),!0}else if(r){const o=ti(n.state),s=o.start(-1);return Wl(n.state,n.dispatch,s,de.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=ql(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof oe)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=On(n.state.selection.$anchor))!=null&&((t=Pi(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=Pi(n,c);const d=Rt.getState(n.state)==null;if(!u||!Zo(a,u))if(d)u=a;else return;const f=new oe(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(ql(n,c.target)!=r&&(d=Pi(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 mu(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 ql(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Pi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?On(n.state.doc.resolve(t.pos)):null}var d0=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")),So(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,So(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function So(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 Ke=new Xe("tableColumnResizing");function f0({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=d0,lastColumnResizable:i=!0}={}){const o=new Pe({key:Ke,state:{init(s,l){var a,c;const u=(c=(a=o.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=Re(l.schema).table.name;return r&&u&&(u[d]=(f,h)=>new r(f,t,h)),new h0(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Ke.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{p0(s,l,n,i)},mouseleave:s=>{m0(s)},mousedown:(s,l)=>{g0(s,l,e,t)}},decorations:s=>{const l=Ke.getState(s);if(l&&l.activeHandle>-1)return v0(s,l.activeHandle)},nodeViews:{}}});return o}var h0=class vr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ke);if(r&&r.setHandle!=null)return new vr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new vr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return yo(e.doc.resolve(i))||(i=-1),new vr(i,t.dragging)}return t}};function p0(n,e,t,r){if(!n.editable)return;const i=Ke.getState(n.state);if(i&&!i.dragging){const o=b0(e.target);let s=-1;if(o){const{left:l,right:a}=o.getBoundingClientRect();e.clientX-l<=t?s=Ul(n,e,"left",t):a-e.clientX<=t&&(s=Ul(n,e,"right",t))}if(s!=i.activeHandle){if(!r&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=de.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}gu(n,s)}}}function m0(n){if(!n.editable)return;const e=Ke.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&gu(n,-1)}function g0(n,e,t,r){var i;if(!n.editable)return!1;const o=(i=n.dom.ownerDocument.defaultView)!=null?i:window,s=Ke.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=y0(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Ke,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const f=Ke.getState(n.state);f!=null&&f.dragging&&(S0(n,f.activeHandle,Kl(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Ke,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ke.getState(n.state);if(f&&f.dragging){const h=Kl(f.dragging,d,t);Jl(n,f.activeHandle,h,r)}}return Jl(n,s.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function y0(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 b0(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Ul(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=On(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=de.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Kl(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function gu(n,e){n.dispatch(n.state.tr.setMeta(Ke,{setHandle:e}))}function S0(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=de.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():x0(f.colspan);p[h]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function Jl(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=de.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&&So(o,a.firstChild,a,r,l,t)}function x0(n){return Array(n).fill(0)}function v0(n,e){var t;const r=[],i=n.doc.resolve(e),o=i.node(-1);if(!o)return ce.empty;const s=de.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=Ke.getState(n))!=null&&t.dragging&&r.push(ze.node(l+d,l+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(ze.widget(f,h))}}return ce.create(n.doc,r)}function w0({allowTableNodeSelection:n=!1}={}){return new Pe({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:_b,handleDOMEvents:{mousedown:u0},createSelectionBetween(e){return Rt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:a0,handleKeyDown:l0,handlePaste:c0},appendTransaction(e,t,r){return Bb(r,fu(r,t),n)}})}function xo(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Yl(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,v]=xo(r,g);c.style.setProperty(x,v)}c=c.nextSibling}else{const x=document.createElement("col"),[v,k]=xo(r,g);x.style.setProperty(v,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 k0{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")),Yl(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,Yl(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function C0(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]=xo(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 Gl(n,e){return n.createAndFill()}function M0(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 E0(n,e,t,r,i){const o=M0(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=Gl(o.cell);if(u&&l.push(u),r){const d=Gl(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 T0(n){return n instanceof oe}const fr=({editor:n})=>{const{selection:e}=n.state;if(!T0(e))return!1;let t=0;const r=Yc(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},O0=le.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:k0,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}=C0(n,this.options.cellMinWidth);return["table",ne(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=E0(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})=>Hb(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>Vb(n,e),deleteColumn:()=>({state:n,dispatch:e})=>Wb(n,e),addRowBefore:()=>({state:n,dispatch:e})=>Ub(n,e),addRowAfter:()=>({state:n,dispatch:e})=>Kb(n,e),deleteRow:()=>({state:n,dispatch:e})=>Yb(n,e),deleteTable:()=>({state:n,dispatch:e})=>n0(n,e),mergeCells:()=>({state:n,dispatch:e})=>Bl(n,e),splitCell:()=>({state:n,dispatch:e})=>$l(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Yn("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Yn("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>e0(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Bl(n,e)?!0:$l(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>Zb(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Hl(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Hl(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&fu(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=oe.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:fr,"Mod-Backspace":fr,Delete:fr,"Mod-Delete":fr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[f0({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],w0({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:q(R(n,"tableRole",e))}}}),N0=le.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",ne(this.options.HTMLAttributes,n),0]}}),A0=le.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",ne(this.options.HTMLAttributes,n),0]}}),R0=le.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",ne(this.options.HTMLAttributes,n),0]}}),yu=({title:n,childrenContent:e,editable:t,childrenEdit:r})=>{const[i,o]=D.useState(!1),s=t?w.jsx(lt.Menu,{children:w.jsx(lt.Menu.Item,{onClick:()=>o(!0),children:"Edit"},"edit")}):null;return w.jsxs("div",{children:[t&&s?w.jsx(lt.Dropdown,{overlay:s,trigger:["contextMenu"],children:e}):e,w.jsx(lt.Modal,{title:`Edit ${n}`,open:i,onOk:()=>o(!1),onCancel:()=>o(!1),children:r})]})},D0=({node:n,editor:e})=>{const[t,r]=D.useState(!1),[i,o]=D.useState(n.attrs.bgColor||"#f3f4f6"),[s,l]=D.useState(n.attrs.titleColor||"#000000"),a=d=>{d.preventDefault()},c=d=>{o(d.toHexString())},u=d=>{l(d.toHexString())};return w.jsx(eu,{className:"accordion-wrapper",children:w.jsx(yu,{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(hg,{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(Jm,{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(zr,{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(zr,{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"})})]})})]})})})},P0=le.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",ne(n)]},addNodeView(){return tu(D0)},addCommands(){return{setAccordion:n=>({chain:e})=>e().insertContent({type:"accordion",attrs:n,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}}),I0=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,_0=le.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",ne(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Xc({find:I0,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var Qo={exports:{}},Qn={},ni={exports:{}},bu={},vo={exports:{}},hr={exports:{}},ee={};/** @license React v16.13.1
344
345
  * react-is.production.min.js
345
346
  *
346
347
  * Copyright (c) Facebook, Inc. and its affiliates.
347
348
  *
348
349
  * This source code is licensed under the MIT license found in the
349
350
  * LICENSE file in the root directory of this source tree.
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
351
+ */var Xl;function z0(){if(Xl)return ee;Xl=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 v(S){if(typeof S=="object"&&S!==null){var M=S.$$typeof;switch(M){case e:switch(S=S.type,S){case a:case c:case r:case o:case i:case d:return S;default:switch(S=S&&S.$$typeof,S){case l:case u:case p:case h:case s:return S;default:return M}}case t:return M}}}function k(S){return v(S)===c}return ee.AsyncMode=a,ee.ConcurrentMode=c,ee.ContextConsumer=l,ee.ContextProvider=s,ee.Element=e,ee.ForwardRef=u,ee.Fragment=r,ee.Lazy=p,ee.Memo=h,ee.Portal=t,ee.Profiler=o,ee.StrictMode=i,ee.Suspense=d,ee.isAsyncMode=function(S){return k(S)||v(S)===a},ee.isConcurrentMode=k,ee.isContextConsumer=function(S){return v(S)===l},ee.isContextProvider=function(S){return v(S)===s},ee.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===e},ee.isForwardRef=function(S){return v(S)===u},ee.isFragment=function(S){return v(S)===r},ee.isLazy=function(S){return v(S)===p},ee.isMemo=function(S){return v(S)===h},ee.isPortal=function(S){return v(S)===t},ee.isProfiler=function(S){return v(S)===o},ee.isStrictMode=function(S){return v(S)===i},ee.isSuspense=function(S){return v(S)===d},ee.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===c||S===o||S===i||S===d||S===f||typeof S=="object"&&S!==null&&(S.$$typeof===p||S.$$typeof===h||S.$$typeof===s||S.$$typeof===l||S.$$typeof===u||S.$$typeof===g||S.$$typeof===b||S.$$typeof===x||S.$$typeof===m)},ee.typeOf=v,ee}var te={};/** @license React v16.13.1
351
352
  * react-is.development.js
352
353
  *
353
354
  * Copyright (c) Facebook, Inc. and its affiliates.
354
355
  *
355
356
  * This source code is licensed under the MIT license found in the
356
357
  * LICENSE file in the root directory of this source tree.
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,ve=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=ve,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 Lu(){return ya||(ya=1,process.env.NODE_ENV==="production"?gr.exports=x1():gr.exports=w1()),gr.exports}/*
358
+ */var Zl;function L0(){return Zl||(Zl=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 v(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===x||N.$$typeof===m)}function k(N){if(typeof N=="object"&&N!==null){var We=N.$$typeof;switch(We){case e:var kt=N.type;switch(kt){case a:case c:case r:case o:case i:case d:return kt;default:var un=kt&&kt.$$typeof;switch(un){case l:case u:case p:case h:case s:return un;default:return We}}case t:return We}}}var S=a,M=c,O=l,$=s,P=e,re=u,ae=r,pe=p,Fe=h,Se=t,Ze=o,xe=i,ve=d,pt=!1;function je(N){return pt||(pt=!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 A(N){return k(N)===l}function K(N){return k(N)===s}function V(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function j(N){return k(N)===u}function J(N){return k(N)===r}function F(N){return k(N)===p}function U(N){return k(N)===h}function Y(N){return k(N)===t}function Z(N){return k(N)===o}function G(N){return k(N)===i}function we(N){return k(N)===d}te.AsyncMode=S,te.ConcurrentMode=M,te.ContextConsumer=O,te.ContextProvider=$,te.Element=P,te.ForwardRef=re,te.Fragment=ae,te.Lazy=pe,te.Memo=Fe,te.Portal=Se,te.Profiler=Ze,te.StrictMode=xe,te.Suspense=ve,te.isAsyncMode=je,te.isConcurrentMode=E,te.isContextConsumer=A,te.isContextProvider=K,te.isElement=V,te.isForwardRef=j,te.isFragment=J,te.isLazy=F,te.isMemo=U,te.isPortal=Y,te.isProfiler=Z,te.isStrictMode=G,te.isSuspense=we,te.isValidElementType=v,te.typeOf=k}()),te}var Ql;function Su(){return Ql||(Ql=1,process.env.NODE_ENV==="production"?hr.exports=z0():hr.exports=L0()),hr.exports}/*
358
359
  object-assign
359
360
  (c) Sindre Sorhus
360
361
  @license MIT
361
- */var Hi,ba;function k1(){if(ba)return Hi;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 Hi=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},Hi}var Vi,va;function cs(){if(va)return Vi;va=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Vi=n,Vi}var Wi,Sa;function Bu(){return Sa||(Sa=1,Wi=Function.call.bind(Object.prototype.hasOwnProperty)),Wi}var qi,xa;function C1(){if(xa)return qi;xa=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=cs(),t={},r=Bu();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={})},qi=i,qi}var Ui,wa;function M1(){if(wa)return Ui;wa=1;var n=Lu(),e=k1(),t=cs(),r=Bu(),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 Ui=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:ve};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 ve(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},Ui}var Ki,ka;function T1(){if(ka)return Ki;ka=1;var n=cs();function e(){}function t(){}return t.resetWarningCache=e,Ki=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},Ki}if(process.env.NODE_ENV!=="production"){var E1=Lu(),O1=!0;Ao.exports=M1()(E1.isElement,O1)}else Ao.exports=T1()();var si=Ao.exports;function $u(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=$u(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=$u(n))&&(r&&(r+=" "),r+=e);return r}const A1=Object.freeze(Object.defineProperty({__proto__:null,clsx:Ca,default:Ca},Symbol.toStringTag,{value:"Module"})),N1=Sd(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=Fu;dn.browserPrefixToStyle=z1;dn.default=void 0;dn.getPrefix=ju;const Ji=["Moz","Webkit","O","ms"];function ju(){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<Ji.length;r++)if(Fu(e,Ji[r])in t)return Ji[r];return""}function Fu(n,e){return e?"".concat(e).concat(L1(n)):n}function z1(n,e){return e?"-".concat(e.toLowerCase(),"-").concat(n):n}function L1(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=ju();Object.defineProperty(he,"__esModule",{value:!0});he.addClassName=Wu;he.addEvent=j1;he.addUserSelectStyles=X1;he.createCSSTransform=K1;he.createSVGTransform=J1;he.getTouch=Y1;he.getTouchIdentifier=G1;he.getTranslation=us;he.innerHeight=W1;he.innerWidth=q1;he.matchesSelector=Vu;he.matchesSelectorAndParentsTo=$1;he.offsetXYFromParent=U1;he.outerHeight=H1;he.outerWidth=V1;he.removeClassName=qu;he.removeEvent=F1;he.removeUserSelectStyles=Z1;var Ze=yt,Ma=B1(dn);function Hu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Hu=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=Hu(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 yr="";function Vu(n,e){return yr||(yr=(0,Ze.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,Ze.isFunction)(n[t])})),(0,Ze.isFunction)(n[yr])?n[yr](e):!1}function $1(n,e,t){let r=n;do{if(Vu(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=us(n,e,"px");return{[(0,Ma.browserPrefixToKey)("transform",Ma.default)]:t}}function J1(n,e){return us(n,e,"")}function us(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;}
362
+ */var Ii,ea;function B0(){if(ea)return Ii;ea=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 Ii=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},Ii}var _i,ta;function es(){if(ta)return _i;ta=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _i=n,_i}var zi,na;function xu(){return na||(na=1,zi=Function.call.bind(Object.prototype.hasOwnProperty)),zi}var Li,ra;function $0(){if(ra)return Li;ra=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=es(),t={},r=xu();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={})},Li=i,Li}var Bi,ia;function j0(){if(ia)return Bi;ia=1;var n=Su(),e=B0(),t=es(),r=xu(),i=$0(),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 Bi=function(l,a){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(E){var A=E&&(c&&E[c]||E[u]);if(typeof A=="function")return A}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:v,element:k(),elementType:S(),instanceOf:M,node:re(),objectOf:$,oneOf:O,oneOfType:P,shape:pe,exact:Fe};function p(E,A){return E===A?E!==0||1/E===1/A:E!==E&&A!==A}function m(E,A){this.message=E,this.data=A&&typeof A=="object"?A:{},this.stack=""}m.prototype=Error.prototype;function g(E){if(process.env.NODE_ENV!=="production")var A={},K=0;function V(J,F,U,Y,Z,G,we){if(Y=Y||f,G=G||U,we!==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 We=Y+":"+U;!A[We]&&K<3&&(o("You are manually calling a React.PropTypes validation function for the `"+G+"` prop on `"+Y+"`. 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."),A[We]=!0,K++)}}return F[U]==null?J?F[U]===null?new m("The "+Z+" `"+G+"` is marked as required "+("in `"+Y+"`, but its value is `null`.")):new m("The "+Z+" `"+G+"` is marked as required in "+("`"+Y+"`, but its value is `undefined`.")):null:E(F,U,Y,Z,G)}var j=V.bind(null,!1);return j.isRequired=V.bind(null,!0),j}function b(E){function A(K,V,j,J,F,U){var Y=K[V],Z=xe(Y);if(Z!==E){var G=ve(Y);return new m("Invalid "+J+" `"+F+"` of type "+("`"+G+"` supplied to `"+j+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return g(A)}function x(){return g(s)}function v(E){function A(K,V,j,J,F){if(typeof E!="function")return new m("Property `"+F+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var U=K[V];if(!Array.isArray(U)){var Y=xe(U);return new m("Invalid "+J+" `"+F+"` of type "+("`"+Y+"` supplied to `"+j+"`, expected an array."))}for(var Z=0;Z<U.length;Z++){var G=E(U,Z,j,J,F+"["+Z+"]",t);if(G instanceof Error)return G}return null}return g(A)}function k(){function E(A,K,V,j,J){var F=A[K];if(!l(F)){var U=xe(F);return new m("Invalid "+j+" `"+J+"` of type "+("`"+U+"` supplied to `"+V+"`, expected a single ReactElement."))}return null}return g(E)}function S(){function E(A,K,V,j,J){var F=A[K];if(!n.isValidElementType(F)){var U=xe(F);return new m("Invalid "+j+" `"+J+"` of type "+("`"+U+"` supplied to `"+V+"`, expected a single ReactElement type."))}return null}return g(E)}function M(E){function A(K,V,j,J,F){if(!(K[V]instanceof E)){var U=E.name||f,Y=je(K[V]);return new m("Invalid "+J+" `"+F+"` of type "+("`"+Y+"` supplied to `"+j+"`, expected ")+("instance of `"+U+"`."))}return null}return g(A)}function O(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 A(K,V,j,J,F){for(var U=K[V],Y=0;Y<E.length;Y++)if(p(U,E[Y]))return null;var Z=JSON.stringify(E,function(we,N){var We=ve(N);return We==="symbol"?String(N):N});return new m("Invalid "+J+" `"+F+"` of value `"+String(U)+"` "+("supplied to `"+j+"`, expected one of "+Z+"."))}return g(A)}function $(E){function A(K,V,j,J,F){if(typeof E!="function")return new m("Property `"+F+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var U=K[V],Y=xe(U);if(Y!=="object")return new m("Invalid "+J+" `"+F+"` of type "+("`"+Y+"` supplied to `"+j+"`, expected an object."));for(var Z in U)if(r(U,Z)){var G=E(U,Z,j,J,F+"."+Z,t);if(G instanceof Error)return G}return null}return g(A)}function P(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 A=0;A<E.length;A++){var K=E[A];if(typeof K!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+pt(K)+" at index "+A+"."),s}function V(j,J,F,U,Y){for(var Z=[],G=0;G<E.length;G++){var we=E[G],N=we(j,J,F,U,Y,t);if(N==null)return null;N.data&&r(N.data,"expectedType")&&Z.push(N.data.expectedType)}var We=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new m("Invalid "+U+" `"+Y+"` supplied to "+("`"+F+"`"+We+"."))}return g(V)}function re(){function E(A,K,V,j,J){return Se(A[K])?null:new m("Invalid "+j+" `"+J+"` supplied to "+("`"+V+"`, expected a ReactNode."))}return g(E)}function ae(E,A,K,V,j){return new m((E||"React class")+": "+A+" type `"+K+"."+V+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function pe(E){function A(K,V,j,J,F){var U=K[V],Y=xe(U);if(Y!=="object")return new m("Invalid "+J+" `"+F+"` of type `"+Y+"` "+("supplied to `"+j+"`, expected `object`."));for(var Z in E){var G=E[Z];if(typeof G!="function")return ae(j,J,F,Z,ve(G));var we=G(U,Z,j,J,F+"."+Z,t);if(we)return we}return null}return g(A)}function Fe(E){function A(K,V,j,J,F){var U=K[V],Y=xe(U);if(Y!=="object")return new m("Invalid "+J+" `"+F+"` of type `"+Y+"` "+("supplied to `"+j+"`, expected `object`."));var Z=e({},K[V],E);for(var G in Z){var we=E[G];if(r(E,G)&&typeof we!="function")return ae(j,J,F,G,ve(we));if(!we)return new m("Invalid "+J+" `"+F+"` key `"+G+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(K[V],null," ")+`
363
+ Valid keys: `+JSON.stringify(Object.keys(E),null," "));var N=we(U,G,j,J,F+"."+G,t);if(N)return N}return null}return g(A)}function Se(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(Se);if(E===null||l(E))return!0;var A=d(E);if(A){var K=A.call(E),V;if(A!==E.entries){for(;!(V=K.next()).done;)if(!Se(V.value))return!1}else for(;!(V=K.next()).done;){var j=V.value;if(j&&!Se(j[1]))return!1}}else return!1;return!0;default:return!1}}function Ze(E,A){return E==="symbol"?!0:A?A["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&A instanceof Symbol:!1}function xe(E){var A=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":Ze(A,E)?"symbol":A}function ve(E){if(typeof E>"u"||E===null)return""+E;var A=xe(E);if(A==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return A}function pt(E){var A=ve(E);switch(A){case"array":case"object":return"an "+A;case"boolean":case"date":case"regexp":return"a "+A;default:return A}}function je(E){return!E.constructor||!E.constructor.name?f:E.constructor.name}return h.checkPropTypes=i,h.resetWarningCache=i.resetWarningCache,h.PropTypes=h,h},Bi}var $i,oa;function H0(){if(oa)return $i;oa=1;var n=es();function e(){}function t(){}return t.resetWarningCache=e,$i=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},$i}if(process.env.NODE_ENV!=="production"){var V0=Su(),F0=!0;vo.exports=j0()(V0.isElement,F0)}else vo.exports=H0()();var ri=vo.exports;function vu(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=vu(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function sa(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=vu(n))&&(r&&(r+=" "),r+=e);return r}const W0=Object.freeze(Object.defineProperty({__proto__:null,clsx:sa,default:sa},Symbol.toStringTag,{value:"Module"})),q0=_u(W0);var fe={},ft={};Object.defineProperty(ft,"__esModule",{value:!0});ft.dontSetMe=G0;ft.findInArray=U0;ft.int=Y0;ft.isFunction=K0;ft.isNum=J0;function U0(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function K0(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function J0(n){return typeof n=="number"&&!isNaN(n)}function Y0(n){return parseInt(n,10)}function G0(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 cn={};Object.defineProperty(cn,"__esModule",{value:!0});cn.browserPrefixToKey=ku;cn.browserPrefixToStyle=X0;cn.default=void 0;cn.getPrefix=wu;const ji=["Moz","Webkit","O","ms"];function wu(){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<ji.length;r++)if(ku(e,ji[r])in t)return ji[r];return""}function ku(n,e){return e?"".concat(e).concat(Z0(n)):n}function X0(n,e){return e?"-".concat(e.toLowerCase(),"-").concat(n):n}function Z0(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}cn.default=wu();Object.defineProperty(fe,"__esModule",{value:!0});fe.addClassName=Eu;fe.addEvent=t1;fe.addUserSelectStyles=f1;fe.createCSSTransform=a1;fe.createSVGTransform=c1;fe.getTouch=u1;fe.getTouchIdentifier=d1;fe.getTranslation=ts;fe.innerHeight=o1;fe.innerWidth=s1;fe.matchesSelector=Mu;fe.matchesSelectorAndParentsTo=e1;fe.offsetXYFromParent=l1;fe.outerHeight=r1;fe.outerWidth=i1;fe.removeClassName=Tu;fe.removeEvent=n1;fe.removeUserSelectStyles=h1;var Ye=ft,la=Q0(cn);function Cu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Cu=function(r){return r?t:e})(n)}function Q0(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Cu(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 pr="";function Mu(n,e){return pr||(pr=(0,Ye.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,Ye.isFunction)(n[t])})),(0,Ye.isFunction)(n[pr])?n[pr](e):!1}function e1(n,e,t){let r=n;do{if(Mu(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function t1(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 n1(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 r1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ye.int)(t.borderTopWidth),e+=(0,Ye.int)(t.borderBottomWidth),e}function i1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ye.int)(t.borderLeftWidth),e+=(0,Ye.int)(t.borderRightWidth),e}function o1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ye.int)(t.paddingTop),e-=(0,Ye.int)(t.paddingBottom),e}function s1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ye.int)(t.paddingLeft),e-=(0,Ye.int)(t.paddingRight),e}function l1(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 a1(n,e){const t=ts(n,e,"px");return{[(0,la.browserPrefixToKey)("transform",la.default)]:t}}function c1(n,e){return ts(n,e,"")}function ts(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,Ye.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,Ye.findInArray)(n.changedTouches,t=>e===t.identifier)}function d1(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function f1(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;}
363
364
  `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
364
- `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&Wu(n.body,"react-draggable-transparent-selection")}function Z1(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=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=ds(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=ds(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=ds(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 ds(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var li={},ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.default=lv;function lv(){}Object.defineProperty(li,"__esModule",{value:!0});li.default=void 0;var Yi=cv(I),Ue=fs(si),av=fs(Hr),De=he,Tt=bt,Gi=yt,zn=fs(ai);function fs(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 cv(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 $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);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,ci=class extends Yi.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 Yi.cloneElement(Yi.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};li.default=ci;$e(ci,"displayName","DraggableCore");$e(ci,"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:Gi.dontSetMe,style:Gi.dontSetMe,transform:Gi.dontSetMe});$e(ci,"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(si),r=u(Hr),i=u(N1),o=he,s=bt,l=yt,a=u(li),c=u(ai);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);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,...ve}=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({},ve,{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:Ku,DraggableCore:fv}=zu;oi.exports=Ku;oi.exports.default=Ku;oi.exports.DraggableCore=fv;var hv=oi.exports,hs={};hs.__esModule=!0;hs.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);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 rr={};rr.__esModule=!0;rr.resizableProps=void 0;var V=Sv(si);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)}};rr.resizableProps=xv;nr.__esModule=!0;nr.default=void 0;var Ln=Tv(I),wv=hv,kv=hs,Cv=rr,Mv=["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 Tv(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 No(){return No=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},No.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 Xi(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);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,Ro(n,e)}function Ro(n,e){return Ro=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Ro(n,e)}var ps=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 Ln.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=Xi({ref:o},l?{}:{handleAxis:i});return Ln.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,Xi(Xi({},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]=Ln.createRef();return Ln.createElement(wv.DraggableCore,No({},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}(Ln.Component);nr.default=ps;ps.propTypes=Cv.resizableProps;ps.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var ui={};ui.__esModule=!0;ui.default=void 0;var Zi=zv(I),Dv=Yu(si),Pv=Yu(nr),Iv=rr,_v=["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 zv(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 Do(){return Do=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},Do.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 Fr(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){Lv(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 Lv(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);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,Po(n,e)}function Po(n,e){return Po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Po(n,e)}var Xu=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 Zi.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},Zi.createElement("div",Do({},b,{style:Fr(Fr({},m),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(Zi.Component);ui.default=Xu;Xu.propTypes=Fr(Fr({},Iv.resizableProps),{},{children:Dv.default.element});as.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};as.exports.Resizable=nr.default;var Hv=as.exports.ResizableBox=ui.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(bu,{className:"image-wrapper",children:w.jsx(_u,{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 vu(Vv)},addCommands(){return{setImage:n=>({chain:e})=>e().insertContent({type:"image",attrs:n}).run()}}}),qv=[tb.configure({types:[Jl.name,xu.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;
365
+ `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&Eu(n.body,"react-draggable-transparent-selection")}function h1(n){if(n)try{if(n.body&&Tu(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 Eu(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(n.className+=" ".concat(e))}function Tu(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.canDragX=g1;ht.canDragY=y1;ht.createCoreData=S1;ht.createDraggableData=x1;ht.getBoundPosition=p1;ht.getControlPosition=b1;ht.snapToGrid=m1;var qe=ft,bn=fe;function p1(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:v1(r);const i=ns(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,qe.int)(u.paddingLeft)+(0,qe.int)(c.marginLeft),top:-i.offsetTop+(0,qe.int)(u.paddingTop)+(0,qe.int)(c.marginTop),right:(0,bn.innerWidth)(a)-(0,bn.outerWidth)(i)-i.offsetLeft+(0,qe.int)(u.paddingRight)-(0,qe.int)(c.marginRight),bottom:(0,bn.innerHeight)(a)-(0,bn.outerHeight)(i)-i.offsetTop+(0,qe.int)(u.paddingBottom)-(0,qe.int)(c.marginBottom)}}return(0,qe.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,qe.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,qe.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,qe.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function m1(n,e,t){const r=Math.round(e/n[0])*n[0],i=Math.round(t/n[1])*n[1];return[r,i]}function g1(n){return n.props.axis==="both"||n.props.axis==="x"}function y1(n){return n.props.axis==="both"||n.props.axis==="y"}function b1(n,e,t){const r=typeof e=="number"?(0,bn.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const i=ns(t),o=t.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,bn.offsetXYFromParent)(r||n,o,t.props.scale)}function S1(n,e,t){const r=!(0,qe.isNum)(n.lastX),i=ns(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 x1(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 v1(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function ns(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var ii={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.default=w1;function w1(){}Object.defineProperty(ii,"__esModule",{value:!0});ii.default=void 0;var Hi=C1(D),He=rs(ri),k1=rs($r),Oe=fe,Mt=ht,Vi=ft,Pn=rs(oi);function rs(n){return n&&n.__esModule?n:{default:n}}function Ou(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Ou=function(r){return r?t:e})(n)}function C1(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Ou(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=M1(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function M1(n){var e=E1(n,"string");return typeof e=="symbol"?e:String(e)}function E1(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);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const nt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Et=nt.mouse,si=class extends Hi.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,Oe.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,Oe.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&e.preventDefault();const i=(0,Oe.getTouchIdentifier)(e);this.touchIdentifier=i;const o=(0,Mt.getControlPosition)(e,i,this);if(o==null)return;const{x:s,y:l}=o,a=(0,Mt.createCoreData)(this,s,l);(0,Pn.default)("DraggableCore: handleDragStart: %j",a),(0,Pn.default)("calling",this.props.onStart),!(this.props.onStart(e,a)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Oe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=s,this.lastY=l,(0,Oe.addEvent)(r,Et.move,this.handleDrag),(0,Oe.addEvent)(r,Et.stop,this.handleDragStop))}),_e(this,"handleDrag",e=>{const t=(0,Mt.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,Mt.snapToGrid)(this.props.grid,l,a),!l&&!a)return;r=this.lastX+l,i=this.lastY+a}const o=(0,Mt.createCoreData)(this,r,i);if((0,Pn.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,Mt.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,Mt.snapToGrid)(this.props.grid,a,c),r=this.lastX+a,i=this.lastY+c}const o=(0,Mt.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,Oe.removeUserSelectStyles)(l.ownerDocument),(0,Pn.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,Pn.default)("DraggableCore: Removing handlers"),(0,Oe.removeEvent)(l.ownerDocument,Et.move,this.handleDrag),(0,Oe.removeEvent)(l.ownerDocument,Et.stop,this.handleDragStop))}),_e(this,"onMouseDown",e=>(Et=nt.mouse,this.handleDragStart(e))),_e(this,"onMouseUp",e=>(Et=nt.mouse,this.handleDragStop(e))),_e(this,"onTouchStart",e=>(Et=nt.touch,this.handleDragStart(e))),_e(this,"onTouchEnd",e=>(Et=nt.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,Oe.addEvent)(e,nt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,Oe.removeEvent)(t,nt.mouse.move,this.handleDrag),(0,Oe.removeEvent)(t,nt.touch.move,this.handleDrag),(0,Oe.removeEvent)(t,nt.mouse.stop,this.handleDragStop),(0,Oe.removeEvent)(t,nt.touch.stop,this.handleDragStop),(0,Oe.removeEvent)(e,nt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Oe.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:k1.default.findDOMNode(this)}render(){return Hi.cloneElement(Hi.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ii.default=si;_e(si,"displayName","DraggableCore");_e(si,"propTypes",{allowAnyClick:He.default.bool,children:He.default.node.isRequired,disabled:He.default.bool,enableUserSelectHack:He.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:He.default.arrayOf(He.default.number),handle:He.default.string,cancel:He.default.string,nodeRef:He.default.object,onStart:He.default.func,onDrag:He.default.func,onStop:He.default.func,onMouseDown:He.default.func,scale:He.default.number,className:Vi.dontSetMe,style:Vi.dontSetMe,transform:Vi.dontSetMe});_e(si,"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(D),t=u(ri),r=u($r),i=u(q0),o=fe,s=ht,l=ft,a=u(ii),c=u(oi);function u(x){return x&&x.__esModule?x:{default:x}}function d(x){if(typeof WeakMap!="function")return null;var v=new WeakMap,k=new WeakMap;return(d=function(S){return S?k:v})(x)}function f(x,v){if(x&&x.__esModule)return x;if(x===null||typeof x!="object"&&typeof x!="function")return{default:x};var k=d(v);if(k&&k.has(x))return k.get(x);var S={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in x)if(O!=="default"&&Object.prototype.hasOwnProperty.call(x,O)){var $=M?Object.getOwnPropertyDescriptor(x,O):null;$&&($.get||$.set)?Object.defineProperty(S,O,$):S[O]=x[O]}return S.default=x,k&&k.set(x,S),S}function h(){return h=Object.assign?Object.assign.bind():function(x){for(var v=1;v<arguments.length;v++){var k=arguments[v];for(var S in k)Object.prototype.hasOwnProperty.call(k,S)&&(x[S]=k[S])}return x},h.apply(this,arguments)}function p(x,v,k){return v=m(v),v in x?Object.defineProperty(x,v,{value:k,enumerable:!0,configurable:!0,writable:!0}):x[v]=k,x}function m(x){var v=g(x,"string");return typeof v=="symbol"?v:String(v)}function g(x,v){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var S=k.call(x,v);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(v==="string"?String:Number)(x)}class b extends e.Component{static getDerivedStateFromProps(v,k){let{position:S}=v,{prevPropsPosition:M}=k;return S&&(!M||S.x!==M.x||S.y!==M.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:S,prevPropsPosition:M}),{x:S.x,y:S.y,prevPropsPosition:{...S}}):null}constructor(v){super(v),p(this,"onDragStart",(k,S)=>{if((0,c.default)("Draggable: onDragStart: %j",S),this.props.onStart(k,(0,s.createDraggableData)(this,S))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(k,S)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",S);const M=(0,s.createDraggableData)(this,S),O={x:M.x,y:M.y,slackX:0,slackY:0};if(this.props.bounds){const{x:P,y:re}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[ae,pe]=(0,s.getBoundPosition)(this,O.x,O.y);O.x=ae,O.y=pe,O.slackX=this.state.slackX+(P-O.x),O.slackY=this.state.slackY+(re-O.y),M.x=O.x,M.y=O.y,M.deltaX=O.x-this.state.x,M.deltaY=O.y-this.state.y}if(this.props.onDrag(k,M)===!1)return!1;this.setState(O)}),p(this,"onDragStop",(k,S)=>{if(!this.state.dragging||this.props.onStop(k,(0,s.createDraggableData)(this,S))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",S);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:P,y:re}=this.props.position;O.x=P,O.y=re}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:v.position?v.position.x:v.defaultPosition.x,y:v.position?v.position.y:v.defaultPosition.y,prevPropsPosition:{...v.position},slackX:0,slackY:0,isElementSVG:!1},v.position&&!(v.onDrag||v.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 v,k;return(v=(k=this.props)===null||k===void 0||(k=k.nodeRef)===null||k===void 0?void 0:k.current)!==null&&v!==void 0?v:r.default.findDOMNode(this)}render(){const{axis:v,bounds:k,children:S,defaultPosition:M,defaultClassName:O,defaultClassNameDragging:$,defaultClassNameDragged:P,position:re,positionOffset:ae,scale:pe,...Fe}=this.props;let Se={},Ze=null;const ve=!!!re||this.state.dragging,pt=re||M,je={x:(0,s.canDragX)(this)&&ve?this.state.x:pt.x,y:(0,s.canDragY)(this)&&ve?this.state.y:pt.y};this.state.isElementSVG?Ze=(0,o.createSVGTransform)(je,ae):Se=(0,o.createCSSTransform)(je,ae);const E=(0,i.default)(S.props.className||"",O,{[$]:this.state.dragging,[P]:this.state.dragged});return e.createElement(a.default,h({},Fe,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(S),{className:E,style:{...S.props.style,...Se},transform:Ze}))}}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})})(bu);const{default:Nu,DraggableCore:T1}=bu;ni.exports=Nu;ni.exports.default=Nu;ni.exports.DraggableCore=T1;var O1=ni.exports,is={};is.__esModule=!0;is.cloneElement=I1;var N1=A1(D);function A1(n){return n&&n.__esModule?n:{default:n}}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 ca(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){R1(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 R1(n,e,t){return e=D1(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function D1(n){var e=P1(n,"string");return typeof e=="symbol"?e:String(e)}function P1(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);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function I1(n,e){return e.style&&n.props.style&&(e.style=ca(ca({},n.props.style),e.style)),e.className&&n.props.className&&(e.className=n.props.className+" "+e.className),N1.default.cloneElement(n,e)}var er={};er.__esModule=!0;er.resizableProps=void 0;var H=_1(ri);function _1(n){return n&&n.__esModule?n:{default:n}}var z1={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)}};er.resizableProps=z1;Qn.__esModule=!0;Qn.default=void 0;var In=H1(D),L1=O1,B1=is,$1=er,j1=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Au(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Au=function(i){return i?t:e})(n)}function H1(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Au(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 wo(){return wo=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},wo.apply(this,arguments)}function V1(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 ua(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 Fi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){F1(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function F1(n,e,t){return e=W1(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function W1(n){var e=q1(n,"string");return typeof e=="symbol"?e:String(e)}function q1(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);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function U1(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,ko(n,e)}function ko(n,e){return ko=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},ko(n,e)}var ss=function(n){U1(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 v=s.props.width+(f?u/s.props.transformScale:0),k=s.props.height+(h?d/s.props.transformScale:0),S=s.runConstraints(v,k);v=S[0],k=S[1];var M=v!==s.props.width||k!==s.props.height,O=typeof s.props[i]=="function"?s.props[i]:null,$=i==="onResize"&&!M;O&&!$&&(l.persist==null||l.persist(),O(l,{node:c,size:{width:v,height:k},handle:o})),i==="onResizeStop"&&s.resetData()}}},t.renderResizeHandle=function(i,o){var s=this.props.handle;if(!s)return In.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=Fi({ref:o},l?{}:{handleAxis:i});return In.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=V1(o,j1);return(0,B1.cloneElement)(s,Fi(Fi({},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]=In.createRef();return In.createElement(L1.DraggableCore,wo({},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}(In.Component);Qn.default=ss;ss.propTypes=$1.resizableProps;ss.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var li={};li.__esModule=!0;li.default=void 0;var Wi=X1(D),K1=Ru(ri),J1=Ru(Qn),Y1=er,G1=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Ru(n){return n&&n.__esModule?n:{default:n}}function Du(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Du=function(i){return i?t:e})(n)}function X1(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Du(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 Co(){return Co=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},Co.apply(this,arguments)}function da(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 Br(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?da(Object(t),!0).forEach(function(r){Z1(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):da(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Z1(n,e,t){return e=Q1(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Q1(n){var e=eS(n,"string");return typeof e=="symbol"?e:String(e)}function eS(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);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function tS(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 nS(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,Mo(n,e)}function Mo(n,e){return Mo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Mo(n,e)}var Pu=function(n){nS(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=tS(i,G1);return Wi.createElement(J1.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},Wi.createElement("div",Co({},b,{style:Br(Br({},m),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(Wi.Component);li.default=Pu;Pu.propTypes=Br(Br({},Y1.resizableProps),{},{children:K1.default.element});Qo.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};Qo.exports.Resizable=Qn.default;var rS=Qo.exports.ResizableBox=li.default;const iS=({node:n,updateAttributes:e,editor:t})=>{const[r,i]=D.useState({width:n.attrs.width||300,height:n.attrs.height||300}),[o,s]=D.useState({left:n.attrs.marginLeft||0,right:n.attrs.marginRight||0}),[l,a]=D.useState(n.attrs.src||""),c=D.useRef(null);D.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(eu,{className:"image-wrapper",children:w.jsx(yu,{title:"Image",childrenContent:w.jsx("div",{className:"relative",style:{marginLeft:o.left,marginRight:o.right},onContextMenu:f,children:t.isEditable?w.jsx(rS,{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"})]})})})},oS=le.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",ne(n)]},addNodeView(){return tu(iS)},addCommands(){return{setImage:n=>({chain:e})=>e().insertContent({type:"image",attrs:n}).run()}}}),sS=[gy.configure({types:[Al.name,ru.name]}),Al,bb.configure({multicolor:!0}),mb.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),P0,Sb,xb,vb,wb.configure({types:["heading","paragraph"]}),kb,Mb,O0.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),N0,A0,R0.configure({HTMLAttributes:{class:"table-cell"}}),_0,oS],lS=({content:n="",slotBefore:e=!1,className:t="",editorClassName:r="",editable:i=!0,onChange:o})=>{const[s,l]=D.useState(!1);D.useEffect(()=>{l(!0)},[]);const a=Um({extensions:sS,content:n,editable:i,onUpdate:({editor:c})=>{o&&o(c.getHTML())}});return D.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(py,{editor:a}),w.jsx(zm,{editor:a,className:r})]})};exports.CyberEditorProvider=lS;
365
366
  //# sourceMappingURL=cyber-editor.cjs.js.map