autoforma 1.0.38 → 1.0.41
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.
- package/README.md +237 -157
- package/dist/components/AutoForm/AutoForm.d.ts +3 -0
- package/dist/components/AutoForm/AutoForm.types.d.ts +23 -0
- package/dist/components/AutoForm/index.d.ts +0 -0
- package/dist/fields/FieldRenderer/DefaultFieldRender.d.ts +10 -0
- package/dist/fields/FieldRenderer/FieldLayoutWrapper.d.ts +9 -0
- package/dist/fields/FieldRenderer/FieldRenderer.d.ts +3 -0
- package/dist/fields/FieldRenderer/FieldRenderer.types.d.ts +10 -0
- package/dist/fields/renderer.types.d.ts +9 -0
- package/dist/fields/renderers/ArrayFieldRenderer.d.ts +6 -0
- package/dist/fields/renderers/CheckBoxFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/DateFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/DateTimeFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/NumberFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/ObjectFieldRenderer.d.ts +6 -0
- package/dist/fields/renderers/RichTextEditorFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/SelectFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/SwitchFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/TagsFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/TextFieldRenderer.d.ts +4 -0
- package/dist/fields/renderers/TimeFieldRenderer.d.ts +4 -0
- package/dist/fields/types.d.ts +61 -0
- package/dist/fields/utils/layout.utils.d.ts +5 -0
- package/dist/fields/utils/values.utils.d.ts +3 -0
- package/dist/index.cjs.js +145 -10
- package/dist/index.d.ts +4 -3
- package/dist/index.es.js +21052 -3755
- package/dist/theme.d.ts +6 -6
- package/package.json +34 -4
- package/dist/components/AutoForm.d.ts +0 -18
- package/dist/components/FieldRender.d.ts +0 -16
- package/dist/components/fields/ArrayField.d.ts +0 -13
- package/dist/components/fields/CheckField.d.ts +0 -7
- package/dist/components/fields/DateField.d.ts +0 -6
- package/dist/components/fields/DateTimeField.d.ts +0 -6
- package/dist/components/fields/NumberField.d.ts +0 -6
- package/dist/components/fields/ObjectField.d.ts +0 -9
- package/dist/components/fields/SelectField.d.ts +0 -10
- package/dist/components/fields/TextAreaField.d.ts +0 -6
- package/dist/components/fields/TextField.d.ts +0 -6
- package/dist/components/fields/TimeField.d.ts +0 -6
- package/dist/types/custom-render.d.ts +0 -11
- package/dist/types/field.d.ts +0 -31
- package/dist/types/form.d.ts +0 -7
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),v=require("@mantine/core"),I=require("dayjs"),dh=require("react-dom");function Br(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jr={exports:{}},ir={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
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
|
|
9
|
+
*/var sa;function fh(){if(sa)return ir;sa=1;var n=T,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(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:s.current}}return ir.Fragment=t,ir.jsx=i,ir.jsxs=i,ir}var lr={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,17 +14,152 @@
|
|
|
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
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var oa;function hh(){return oa||(oa=1,process.env.NODE_ENV!=="production"&&function(){var n=T,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=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,g="@@iterator";function y(x){if(x===null||typeof x!="object")return null;var N=p&&x[p]||x[g];return typeof N=="function"?N:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(x){{for(var N=arguments.length,F=new Array(N>1?N-1:0),Z=1;Z<N;Z++)F[Z-1]=arguments[Z];C("error",x,F)}}function C(x,N,F){{var Z=b.ReactDebugCurrentFrame,be=Z.getStackAddendum();be!==""&&(N+="%s",F=F.concat([be]));var ve=F.map(function(he){return String(he)});ve.unshift("Warning: "+N),Function.prototype.apply.call(console[x],console,ve)}}var E=!1,w=!1,S=!1,M=!1,O=!1,A;A=Symbol.for("react.module.reference");function $(x){return!!(typeof x=="string"||typeof x=="function"||x===r||x===o||O||x===s||x===c||x===u||M||x===h||E||w||S||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===i||x.$$typeof===l||x.$$typeof===a||x.$$typeof===A||x.getModuleId!==void 0))}function W(x,N,F){var Z=x.displayName;if(Z)return Z;var be=N.displayName||N.name||"";return be!==""?F+"("+be+")":F}function U(x){return x.displayName||"Context"}function _(x){if(x==null)return null;if(typeof x.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case r:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var N=x;return U(N)+".Consumer";case i:var F=x;return U(F._context)+".Provider";case a:return W(x,x.render,"ForwardRef");case d:var Z=x.displayName||null;return Z!==null?Z:_(x.type)||"Memo";case f:{var be=x,ve=be._payload,he=be._init;try{return _(he(ve))}catch{return null}}}return null}var J=Object.assign,G=0,Q,V,ne,L,le,j,q;function pe(){}pe.__reactDisabledLog=!0;function ce(){{if(G===0){Q=console.log,V=console.info,ne=console.warn,L=console.error,le=console.group,j=console.groupCollapsed,q=console.groupEnd;var x={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}G++}}function P(){{if(G--,G===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},x,{value:Q}),info:J({},x,{value:V}),warn:J({},x,{value:ne}),error:J({},x,{value:L}),group:J({},x,{value:le}),groupCollapsed:J({},x,{value:j}),groupEnd:J({},x,{value:q})})}G<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=b.ReactCurrentDispatcher,se;function ae(x,N,F){{if(se===void 0)try{throw Error()}catch(be){var Z=be.stack.trim().match(/\n( *(at )?)/);se=Z&&Z[1]||""}return`
|
|
18
|
+
`+se+x}}var X=!1,ke;{var re=typeof WeakMap=="function"?WeakMap:Map;ke=new re}function we(x,N){if(!x||X)return"";{var F=ke.get(x);if(F!==void 0)return F}var Z;X=!0;var be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ve;ve=te.current,te.current=null,ce();try{if(N){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(rt){Z=rt}Reflect.construct(x,[],he)}else{try{he.call()}catch(rt){Z=rt}x.call(he.prototype)}}else{try{throw Error()}catch(rt){Z=rt}x()}}catch(rt){if(rt&&Z&&typeof rt.stack=="string"){for(var de=rt.stack.split(`
|
|
19
|
+
`),Xe=Z.stack.split(`
|
|
20
|
+
`),Re=de.length-1,Ie=Xe.length-1;Re>=1&&Ie>=0&&de[Re]!==Xe[Ie];)Ie--;for(;Re>=1&&Ie>=0;Re--,Ie--)if(de[Re]!==Xe[Ie]){if(Re!==1||Ie!==1)do if(Re--,Ie--,Ie<0||de[Re]!==Xe[Ie]){var dt=`
|
|
21
|
+
`+de[Re].replace(" at new "," at ");return x.displayName&&dt.includes("<anonymous>")&&(dt=dt.replace("<anonymous>",x.displayName)),typeof x=="function"&&ke.set(x,dt),dt}while(Re>=1&&Ie>=0);break}}}finally{X=!1,te.current=ve,P(),Error.prepareStackTrace=be}var _n=x?x.displayName||x.name:"",gn=_n?ae(_n):"";return typeof x=="function"&&ke.set(x,gn),gn}function H(x,N,F){return we(x,!1)}function me(x){var N=x.prototype;return!!(N&&N.isReactComponent)}function ue(x,N,F){if(x==null)return"";if(typeof x=="function")return we(x,me(x));if(typeof x=="string")return ae(x);switch(x){case c:return ae("Suspense");case u:return ae("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case a:return H(x.render);case d:return ue(x.type,N,F);case f:{var Z=x,be=Z._payload,ve=Z._init;try{return ue(ve(be),N,F)}catch{}}}return""}var Ce=Object.prototype.hasOwnProperty,At={},vt=b.ReactDebugCurrentFrame;function qe(x){if(x){var N=x._owner,F=ue(x.type,x._source,N?N.type:null);vt.setExtraStackFrame(F)}else vt.setExtraStackFrame(null)}function fn(x,N,F,Z,be){{var ve=Function.call.bind(Ce);for(var he in x)if(ve(x,he)){var de=void 0;try{if(typeof x[he]!="function"){var Xe=Error((Z||"React class")+": "+F+" type `"+he+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[he]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Xe.name="Invariant Violation",Xe}de=x[he](N,he,Z,F,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Re){de=Re}de&&!(de instanceof Error)&&(qe(be),k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Z||"React class",F,he,typeof de),qe(null)),de instanceof Error&&!(de.message in At)&&(At[de.message]=!0,qe(be),k("Failed %s type: %s",F,de.message),qe(null))}}}var hn=Array.isArray;function ge(x){return hn(x)}function nt(x){{var N=typeof Symbol=="function"&&Symbol.toStringTag,F=N&&x[Symbol.toStringTag]||x.constructor.name||"Object";return F}}function ut(x){try{return Nt(x),!1}catch{return!0}}function Nt(x){return""+x}function pn(x){if(ut(x))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nt(x)),Nt(x)}var mn=b.ReactCurrentOwner,zo={key:!0,ref:!0,__self:!0,__source:!0},Wr,Ur;function nr(x){if(Ce.call(x,"ref")){var N=Object.getOwnPropertyDescriptor(x,"ref").get;if(N&&N.isReactWarning)return!1}return x.ref!==void 0}function jn(x){if(Ce.call(x,"key")){var N=Object.getOwnPropertyDescriptor(x,"key").get;if(N&&N.isReactWarning)return!1}return x.key!==void 0}function Fo(x,N){typeof x.ref=="string"&&mn.current}function St(x,N){{var F=function(){Wr||(Wr=!0,k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",N))};F.isReactWarning=!0,Object.defineProperty(x,"key",{get:F,configurable:!0})}}function rr(x,N){{var F=function(){Ur||(Ur=!0,k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",N))};F.isReactWarning=!0,Object.defineProperty(x,"ref",{get:F,configurable:!0})}}var $o=function(x,N,F,Z,be,ve,he){var de={$$typeof:e,type:x,key:N,ref:F,props:he,_owner:ve};return de._store={},Object.defineProperty(de._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(de,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.defineProperty(de,"_source",{configurable:!1,enumerable:!1,writable:!1,value:be}),Object.freeze&&(Object.freeze(de.props),Object.freeze(de)),de};function Vt(x,N,F,Z,be){{var ve,he={},de=null,Xe=null;F!==void 0&&(pn(F),de=""+F),jn(N)&&(pn(N.key),de=""+N.key),nr(N)&&(Xe=N.ref,Fo(N,be));for(ve in N)Ce.call(N,ve)&&!zo.hasOwnProperty(ve)&&(he[ve]=N[ve]);if(x&&x.defaultProps){var Re=x.defaultProps;for(ve in Re)he[ve]===void 0&&(he[ve]=Re[ve])}if(de||Xe){var Ie=typeof x=="function"?x.displayName||x.name||"Unknown":x;de&&St(he,Ie),Xe&&rr(he,Ie)}return $o(x,de,Xe,be,Z,mn.current,he)}}var Pn=b.ReactCurrentOwner,qr=b.ReactDebugCurrentFrame;function Ke(x){if(x){var N=x._owner,F=ue(x.type,x._source,N?N.type:null);qr.setExtraStackFrame(F)}else qr.setExtraStackFrame(null)}var sr;sr=!1;function or(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function Kr(){{if(Pn.current){var x=_(Pn.current.type);if(x)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+x+"`."}return""}}function Vo(x){return""}var Yr={};function Ho(x){{var N=Kr();if(!N){var F=typeof x=="string"?x:x.displayName||x.name;F&&(N=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using
|
|
25
|
+
Check the top-level render call using <`+F+">.")}return N}}function Oe(x,N){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var F=Ho(N);if(Yr[F])return;Yr[F]=!0;var Z="";x&&x._owner&&x._owner!==Pn.current&&(Z=" It was passed a child from "+_(x._owner.type)+"."),Ke(x),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',F,Z),Ke(null)}}function Ht(x,N){{if(typeof x!="object")return;if(ge(x))for(var F=0;F<x.length;F++){var Z=x[F];or(Z)&&Oe(Z,N)}else if(or(x))x._store&&(x._store.validated=!0);else if(x){var be=y(x);if(typeof be=="function"&&be!==x.entries)for(var ve=be.call(x),he;!(he=ve.next()).done;)or(he.value)&&Oe(he.value,N)}}}function rh(x){{var N=x.type;if(N==null||typeof N=="string")return;var F;if(typeof N=="function")F=N.propTypes;else if(typeof N=="object"&&(N.$$typeof===a||N.$$typeof===d))F=N.propTypes;else return;if(F){var Z=_(N);fn(F,x.props,"prop",Z,x)}else if(N.PropTypes!==void 0&&!sr){sr=!0;var be=_(N);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",be||"Unknown")}typeof N.getDefaultProps=="function"&&!N.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sh(x){{for(var N=Object.keys(x.props),F=0;F<N.length;F++){var Z=N[F];if(Z!=="children"&&Z!=="key"){Ke(x),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Z),Ke(null);break}}x.ref!==null&&(Ke(x),k("Invalid attribute `ref` supplied to `React.Fragment`."),Ke(null))}}var na={};function ra(x,N,F,Z,be,ve){{var he=$(x);if(!he){var de="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(de+=" 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 Xe=Vo();Xe?de+=Xe:de+=Kr();var Re;x===null?Re="null":ge(x)?Re="array":x!==void 0&&x.$$typeof===e?(Re="<"+(_(x.type)||"Unknown")+" />",de=" Did you accidentally export a JSX literal instead of a component?"):Re=typeof x,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Re,de)}var Ie=Vt(x,N,F,be,ve);if(Ie==null)return Ie;if(he){var dt=N.children;if(dt!==void 0)if(Z)if(ge(dt)){for(var _n=0;_n<dt.length;_n++)Ht(dt[_n],x);Object.freeze&&Object.freeze(dt)}else k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ht(dt,x)}if(Ce.call(N,"key")){var gn=_(x),rt=Object.keys(N).filter(function(uh){return uh!=="key"}),Wo=rt.length>0?"{key: someKey, "+rt.join(": ..., ")+": ...}":"{key: someKey}";if(!na[gn+Wo]){var ch=rt.length>0?"{"+rt.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Ft,Ye,Ur,Ye),Kt[Ye+Ft]=!0}}return c===n?Wr(pe):Pr(pe),pe}}function zr(c,T,$){return Zt(c,T,$,!0)}function Ir(c,T,$){return Zt(c,T,$,!1)}var Hr=Ir,Br=zr;Ke.Fragment=n,Ke.jsx=Hr,Ke.jsxs=Br}()),Ke}var Qt;function Zr(){return Qt||(Qt=1,process.env.NODE_ENV==="production"?ot.exports=Gr():ot.exports=Kr()),ot.exports}var S=Zr();function Jr(e){if(!/^[0-9a-zA-Z-]+$/.test(e))throw new Error(`[@mantine/use-form] Form name "${e}" is invalid, it should contain only letters, numbers and dashes`)}const Xr=typeof window<"u"?x.useLayoutEffect:x.useEffect;function ye(e,t){Xr(()=>{if(e)return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e])}function Qr(e,t){e&&Jr(e),ye(`mantine-form:${e}:set-field-value`,r=>t.setFieldValue(r.detail.path,r.detail.value)),ye(`mantine-form:${e}:set-values`,r=>t.setValues(r.detail)),ye(`mantine-form:${e}:set-initial-values`,r=>t.setInitialValues(r.detail)),ye(`mantine-form:${e}:set-errors`,r=>t.setErrors(r.detail)),ye(`mantine-form:${e}:set-field-error`,r=>t.setFieldError(r.detail.path,r.detail.error)),ye(`mantine-form:${e}:clear-field-error`,r=>t.clearFieldError(r.detail)),ye(`mantine-form:${e}:clear-errors`,t.clearErrors),ye(`mantine-form:${e}:reset`,t.reset),ye(`mantine-form:${e}:validate`,t.validate),ye(`mantine-form:${e}:validate-field`,r=>t.validateField(r.detail)),ye(`mantine-form:${e}:reorder-list-item`,r=>t.reorderListItem(r.detail.path,r.detail.payload)),ye(`mantine-form:${e}:remove-list-item`,r=>t.removeListItem(r.detail.path,r.detail.index)),ye(`mantine-form:${e}:insert-list-item`,r=>t.insertListItem(r.detail.path,r.detail.item,r.detail.index)),ye(`mantine-form:${e}:set-dirty`,r=>t.setDirty(r.detail)),ye(`mantine-form:${e}:set-touched`,r=>t.setTouched(r.detail)),ye(`mantine-form:${e}:reset-dirty`,r=>t.resetDirty(r.detail)),ye(`mantine-form:${e}:reset-touched`,t.resetTouched)}function en(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:r}=t;r instanceof HTMLInputElement?r.type==="checkbox"?e(r.checked):e(r.value):(r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement)&&e(r.value)}else e(t)}}function At(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,r)=>{const n=e[r];return n!=null&&n!==!1&&(t[r]=n),t},{})}function tn(e){const[t,r]=x.useState(At(e)),n=x.useRef(t),s=x.useCallback(i=>{r(u=>{const f=At(typeof i=="function"?i(u):i);return n.current=f,f})},[]),o=x.useCallback(()=>s({}),[]),a=x.useCallback(i=>{n.current[i]!==void 0&&s(u=>{const f={...u};return delete f[i],f})},[t]),l=x.useCallback((i,u)=>{u==null||u===!1?a(i):n.current[i]!==u&&s(f=>({...f,[i]:u}))},[t]);return{errorsState:t,setErrors:s,clearErrors:o,setFieldError:l,clearFieldError:a}}function Nt(e,t){if(t===null||typeof t!="object")return{};const r={...t};return Object.keys(t).forEach(n=>{n.includes(`${String(e)}.`)&&delete r[n]}),r}function er(e,t){const r=e.substring(t.length+1).split(".")[0];return parseInt(r,10)}function tr(e,t,r,n){if(t===void 0)return r;const s=`${String(e)}`;let o=r;n===-1&&(o=Nt(`${s}.${t}`,o));const a={...o},l=new Set;return Object.entries(o).filter(([i])=>{if(!i.startsWith(`${s}.`))return!1;const u=er(i,s);return Number.isNaN(u)?!1:u>=t}).forEach(([i,u])=>{const f=er(i,s),h=i.replace(`${s}.${f}`,`${s}.${f+n}`);a[h]=u,l.add(h),l.has(i)||delete a[i]}),a}function rn(e,{from:t,to:r},n){const s=`${e}.${t}`,o=`${e}.${r}`,a={...n};return Object.keys(n).every(l=>{let i,u;if(l.startsWith(s)&&(i=l,u=l.replace(s,o)),l.startsWith(o)&&(i=l.replace(o,s),u=l),i&&u){const f=a[i],h=a[u];return h===void 0?delete a[i]:a[i]=h,f===void 0?delete a[u]:a[u]=f,!1}return!0}),a}function rr(e,t,r){typeof r.value=="object"&&(r.value=ze(r.value)),!r.enumerable||r.get||r.set||!r.configurable||!r.writable||t==="__proto__"?Object.defineProperty(e,t,r):e[t]=r.value}function ze(e){if(typeof e!="object")return e;var t=0,r,n,s,o=Object.prototype.toString.call(e);if(o==="[object Object]"?s=Object.create(e.__proto__||null):o==="[object Array]"?s=Array(e.length):o==="[object Set]"?(s=new Set,e.forEach(function(a){s.add(ze(a))})):o==="[object Map]"?(s=new Map,e.forEach(function(a,l){s.set(ze(l),ze(a))})):o==="[object Date]"?s=new Date(+e):o==="[object RegExp]"?s=new RegExp(e.source,e.flags):o==="[object DataView]"?s=new e.constructor(ze(e.buffer)):o==="[object ArrayBuffer]"?s=e.slice(0):o.slice(-6)==="Array]"&&(s=new e.constructor(e)),s){for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)rr(s,n[t],Object.getOwnPropertyDescriptor(e,n[t]));for(t=0,n=Object.getOwnPropertyNames(e);t<n.length;t++)Object.hasOwnProperty.call(s,r=n[t])&&s[r]===e[r]||rr(s,r,Object.getOwnPropertyDescriptor(e,r))}return s||e}function yr(e){return typeof e!="string"?[]:e.split(".")}function ve(e,t){const r=yr(e);if(r.length===0||typeof t!="object"||t===null)return;let n=t[r[0]];for(let s=1;s<r.length&&n!=null;s+=1)n=n[r[s]];return n}function et(e,t,r){const n=yr(e);if(n.length===0)return r;const s=ze(r);if(n.length===1)return s[n[0]]=t,s;let o=s[n[0]];for(let a=1;a<n.length-1;a+=1){if(o===void 0)return s;o=o[n[a]]}return o[n[n.length-1]]=t,s}function nn(e,{from:t,to:r},n){const s=ve(e,n);if(!Array.isArray(s))return n;const o=[...s],a=s[t];return o.splice(t,1),o.splice(r,0,a),et(e,o,n)}function sn(e,t,r,n){const s=ve(e,n);if(!Array.isArray(s))return n;const o=[...s];return o.splice(typeof r=="number"?r:o.length,0,t),et(e,o,n)}function an(e,t,r){const n=ve(e,r);return Array.isArray(n)?et(e,n.filter((s,o)=>o!==t),r):r}function on(e,t,r,n){const s=ve(e,n);if(!Array.isArray(s)||s.length<=r)return n;const o=[...s];return o[r]=t,et(e,o,n)}function ln({$values:e,$errors:t,$status:r}){const n=x.useCallback((l,i)=>{r.clearFieldDirty(l),t.setErrors(u=>rn(l,i,u)),e.setValues({values:nn(l,i,e.refValues.current),updateState:!0})},[]),s=x.useCallback((l,i)=>{r.clearFieldDirty(l),t.setErrors(u=>tr(l,i,u,-1)),e.setValues({values:an(l,i,e.refValues.current),updateState:!0})},[]),o=x.useCallback((l,i,u)=>{r.clearFieldDirty(l),t.setErrors(f=>tr(l,u,f,1)),e.setValues({values:sn(l,i,u,e.refValues.current),updateState:!0})},[]),a=x.useCallback((l,i,u)=>{r.clearFieldDirty(l),e.setValues({values:on(l,u,i,e.refValues.current),updateState:!0})},[]);return{reorderListItem:n,removeListItem:s,insertListItem:o,replaceListItem:a}}var Mt,nr;function cn(){return nr||(nr=1,Mt=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var a=o[s];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}),Mt}var un=cn();const it=Qe(un);function Ze(e,t){const r=Object.keys(e);if(typeof t=="string"){const n=r.filter(s=>s.startsWith(`${t}.`));return e[t]||n.some(s=>e[s])||!1}return r.some(n=>e[n])}function fn({initialDirty:e,initialTouched:t,mode:r,$values:n}){const[s,o]=x.useState(t),[a,l]=x.useState(e),i=x.useRef(t),u=x.useRef(e),f=x.useCallback(v=>{const C=typeof v=="function"?v(i.current):v;i.current=C,r==="controlled"&&o(C)},[]),h=x.useCallback((v,C=!1)=>{const O=typeof v=="function"?v(u.current):v;u.current=O,(r==="controlled"||C)&&l(O)},[]),y=x.useCallback(()=>f({}),[]),w=x.useCallback(v=>{const C=v?{...n.refValues.current,...v}:n.refValues.current;n.setValuesSnapshot(C),h({})},[]),b=x.useCallback((v,C)=>{f(O=>Ze(O,v)===C?O:{...O,[v]:C})},[]),m=x.useCallback((v,C,O)=>{h(F=>Ze(F,v)===C?F:{...F,[v]:C},O)},[]),d=x.useCallback((v,C)=>{const O=Ze(u.current,v),F=!it(ve(v,n.getValuesSnapshot()),C),Y=Nt(v,u.current);Y[v]=F,h(Y,O!==F)},[]),p=x.useCallback(v=>Ze(i.current,v),[]),g=x.useCallback(v=>h(C=>{if(typeof v!="string")return C;const O=Nt(v,C);return delete O[v],it(O,C)?C:O}),[]),D=x.useCallback(v=>{if(v){const O=ve(v,u.current);if(typeof O=="boolean")return O;const F=ve(v,n.refValues.current),Y=ve(v,n.valuesSnapshot.current);return!it(F,Y)}return Object.keys(u.current).length>0?Ze(u.current):!it(n.refValues.current,n.valuesSnapshot.current)},[]),L=x.useCallback(()=>u.current,[]),k=x.useCallback(()=>i.current,[]);return{touchedState:s,dirtyState:a,touchedRef:i,dirtyRef:u,setTouched:f,setDirty:h,resetDirty:w,resetTouched:y,isTouched:p,setFieldTouched:b,setFieldDirty:m,setTouchedState:o,setDirtyState:l,clearFieldDirty:g,isDirty:D,getDirty:L,getTouched:k,setCalculatedFieldDirty:d}}function dn({initialValues:e,onValuesChange:t,mode:r}){const n=x.useRef(!1),[s,o]=x.useState(e||{}),a=x.useRef(s),l=x.useRef(s),i=x.useCallback(({values:m,subscribers:d,updateState:p=!0,mergeWithPreviousValues:g=!0})=>{const D=a.current,L=m instanceof Function?m(a.current):m,k=g?{...D,...L}:L;a.current=k,p&&o(k),t==null||t(k,D),d==null||d.filter(Boolean).forEach(v=>v({updatedValues:k,previousValues:D}))},[t]),u=x.useCallback(m=>{var g;const d=ve(m.path,a.current),p=m.value instanceof Function?m.value(d):m.value;if(d!==p){const D=a.current,L=et(m.path,p,a.current);i({values:L,updateState:m.updateState}),(g=m.subscribers)==null||g.filter(Boolean).forEach(k=>k({path:m.path,updatedValues:L,previousValues:D}))}},[i]),f=x.useCallback(m=>{l.current=m},[]),h=x.useCallback((m,d)=>{n.current||(n.current=!0,i({values:m,updateState:r==="controlled"}),f(m),d())},[i]),y=x.useCallback(()=>{i({values:l.current,updateState:!0,mergeWithPreviousValues:!1})},[i]),w=x.useCallback(()=>a.current,[]),b=x.useCallback(()=>l.current,[]);return{initialized:n,stateValues:s,refValues:a,valuesSnapshot:l,setValues:i,setFieldValue:u,resetValues:y,setValuesSnapshot:f,initialize:h,getValues:w,getValuesSnapshot:b}}function mn({$status:e}){const t=x.useRef({}),r=x.useCallback((s,o)=>{x.useEffect(()=>(t.current[s]=t.current[s]||[],t.current[s].push(o),()=>{t.current[s]=t.current[s].filter(a=>a!==o)}),[o])},[]),n=x.useCallback(s=>t.current[s]?t.current[s].map(o=>a=>o({previousValue:ve(s,a.previousValues),value:ve(s,a.updatedValues),touched:e.isTouched(s),dirty:e.isDirty(s)})):[],[]);return{subscribers:t,watch:r,getFieldSubscribers:n}}function sr(e,t){return e?`${e}-${t.toString()}`:t.toString()}const lt=Symbol("root-rule");function ar(e){const t=At(e);return{hasErrors:Object.keys(t).length>0,errors:t}}function Yt(e,t,r="",n={}){return typeof e!="object"||e===null?n:Object.keys(e).reduce((s,o)=>{const a=e[o],l=`${r===""?"":`${r}.`}${o}`,i=ve(l,t);let u=!1;return typeof a=="function"&&(s[l]=a(i,t,l)),typeof a=="object"&&Array.isArray(i)&&(u=!0,i.forEach((f,h)=>Yt(a,t,`${l}.${h}`,s)),lt in a&&(s[l]=a[lt](i,t,l))),typeof a=="object"&&typeof i=="object"&&i!==null&&(u||Yt(a,t,l,s),lt in a&&(s[l]=a[lt](i,t,l))),s},n)}function Vt(e,t){return ar(typeof e=="function"?e(t):Yt(e,t))}function ct(e,t,r){if(typeof e!="string")return{hasError:!1,error:null};const n=Vt(t,r),s=Object.keys(n.errors).find(o=>e.split(".").every((a,l)=>a===o.split(".")[l]));return{hasError:!!s,error:s?n.errors[s]:null}}const hn="__MANTINE_FORM_INDEX__";function or(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]+/g,`.${hn}`)):!1:!1}function pn({name:e,mode:t="controlled",initialValues:r,initialErrors:n={},initialDirty:s={},initialTouched:o={},clearInputErrorOnChange:a=!0,validateInputOnChange:l=!1,validateInputOnBlur:i=!1,onValuesChange:u,transformValues:f=m=>m,enhanceGetInputProps:h,validate:y,onSubmitPreventDefault:w="always",touchTrigger:b="change"}={}){const m=tn(n),d=dn({initialValues:r,onValuesChange:u,mode:t}),p=fn({initialDirty:s,initialTouched:o,$values:d,mode:t}),g=ln({$values:d,$errors:m,$status:p}),D=mn({$status:p}),[L,k]=x.useState(0),[v,C]=x.useState({}),[O,F]=x.useState(!1),Y=x.useCallback(()=>{d.resetValues(),m.clearErrors(),p.resetDirty(),p.resetTouched(),t==="uncontrolled"&&k(M=>M+1)},[]),V=x.useCallback(M=>{a&&m.clearErrors(),t==="uncontrolled"&&k(G=>G+1),Object.keys(D.subscribers.current).forEach(G=>{const X=ve(G,d.refValues.current),ee=ve(G,M);X!==ee&&D.getFieldSubscribers(G).forEach(B=>B({previousValues:M,updatedValues:d.refValues.current}))})},[a]),z=x.useCallback(M=>{const G=d.refValues.current;d.initialize(M,()=>t==="uncontrolled"&&k(X=>X+1)),V(G)},[V]),P=x.useCallback((M,G,X)=>{const ee=or(M,l),B=G instanceof Function?G(ve(M,d.refValues.current)):G;p.setCalculatedFieldDirty(M,B),b==="change"&&p.setFieldTouched(M,!0),!ee&&a&&m.clearFieldError(M),d.setFieldValue({path:M,value:G,updateState:t==="controlled",subscribers:[...D.getFieldSubscribers(M),ee?ie=>{const Z=ct(M,y,ie.updatedValues);Z.hasError?m.setFieldError(M,Z.error):m.clearFieldError(M)}:null,(X==null?void 0:X.forceUpdate)!==!1&&t!=="controlled"?()=>C(ie=>({...ie,[M]:(ie[M]||0)+1})):null]})},[u,y]),H=x.useCallback(M=>{const G=d.refValues.current;d.setValues({values:M,updateState:t==="controlled"}),V(G)},[u,V]),I=x.useCallback(()=>{const M=Vt(y,d.refValues.current);return m.setErrors(M.errors),M},[y]),q=x.useCallback(M=>{const G=ct(M,y,d.refValues.current);return G.hasError?m.setFieldError(M,G.error):m.clearFieldError(M),G},[y]),A=(M,{type:G="input",withError:X=!0,withFocus:ee=!0,...B}={})=>{const Z={onChange:en(ue=>P(M,ue,{forceUpdate:!1})),"data-path":sr(e,M)};return X&&(Z.error=m.errorsState[M]),G==="checkbox"?Z[t==="controlled"?"checked":"defaultChecked"]=ve(M,d.refValues.current):Z[t==="controlled"?"value":"defaultValue"]=ve(M,d.refValues.current),ee&&(Z.onFocus=()=>p.setFieldTouched(M,!0),Z.onBlur=()=>{if(or(M,i)){const ue=ct(M,y,d.refValues.current);ue.hasError?m.setFieldError(M,ue.error):m.clearFieldError(M)}}),Object.assign(Z,h==null?void 0:h({inputProps:Z,field:M,options:{type:G,withError:X,withFocus:ee,...B},form:te}))},U=(M,G)=>X=>{w==="always"&&(X==null||X.preventDefault());const ee=I();if(ee.hasErrors)w==="validation-failed"&&(X==null||X.preventDefault()),G==null||G(ee.errors,d.refValues.current,X);else{const B=M==null?void 0:M(f(d.refValues.current),X);B instanceof Promise&&(F(!0),B.finally(()=>F(!1)))}},E=M=>f(M||d.refValues.current),J=x.useCallback(M=>{M.preventDefault(),Y()},[]),j=x.useCallback(M=>M?!ct(M,y,d.refValues.current).hasError:!Vt(y,d.refValues.current).hasErrors,[y]),W=M=>`${L}-${M}-${v[M]||0}`,re=x.useCallback(M=>document.querySelector(`[data-path="${sr(e,M)}"]`),[]),te={watch:D.watch,initialized:d.initialized.current,values:d.stateValues,getValues:d.getValues,getInitialValues:d.getValuesSnapshot,setInitialValues:d.setValuesSnapshot,initialize:z,setValues:H,setFieldValue:P,submitting:O,setSubmitting:F,errors:m.errorsState,setErrors:m.setErrors,setFieldError:m.setFieldError,clearFieldError:m.clearFieldError,clearErrors:m.clearErrors,resetDirty:p.resetDirty,setTouched:p.setTouched,setDirty:p.setDirty,isTouched:p.isTouched,resetTouched:p.resetTouched,isDirty:p.isDirty,getTouched:p.getTouched,getDirty:p.getDirty,reorderListItem:g.reorderListItem,insertListItem:g.insertListItem,removeListItem:g.removeListItem,replaceListItem:g.replaceListItem,reset:Y,validate:I,validateField:q,getInputProps:A,onSubmit:U,onReset:J,isValid:j,getTransformedValues:E,key:W,getInputNode:re};return Qr(e,te),te}function yn(){const e=x.createContext(null);function t({form:n,children:s}){return S.jsx(e.Provider,{value:n,children:s})}function r(){const n=x.useContext(e);if(!n)throw new Error("useFormContext was called outside of FormProvider context");return n}return[t,r,pn]}function vn(e,t,r){return t===void 0&&r===void 0?e:t!==void 0&&r===void 0?Math.max(e,t):Math.min(t===void 0&&r!==void 0?e:Math.max(e,t),r)}function gn(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}const bn=()=>{};function Dn(e,t){const r=t,n=!1,s=gn(e),o=x.useRef(0),a=Object.assign(x.useCallback((...l)=>{window.clearTimeout(o.current);const i=()=>{o.current!==0&&(o.current=0,s(...l))};a.flush=i,o.current=window.setTimeout(i,r)},[s,r]),{flush:bn});return x.useEffect(()=>()=>{window.clearTimeout(o.current)},[a,n]),a}const ir=["mousedown","touchstart"];function _n(e,t,r){const n=x.useRef(null);return x.useEffect(()=>{const s=o=>{const{target:a}=o??{};if(Array.isArray(r)){const l=(a==null?void 0:a.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(a)&&a.tagName!=="HTML";r.every(u=>!!u&&!o.composedPath().includes(u))&&!l&&e()}else n.current&&!n.current.contains(a)&&e()};return ir.forEach(o=>document.addEventListener(o,s)),()=>{ir.forEach(o=>document.removeEventListener(o,s))}},[n,e,r]),n}function Pt(e,t){const r=x.useRef(!1);x.useEffect(()=>()=>{r.current=!1},[]),x.useEffect(()=>{if(r.current)return e();r.current=!0},t)}function lr(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function Sn(...e){const t=new Map;return r=>{if(e.forEach(n=>{const s=lr(n,r);s&&t.set(n,s)}),t.size>0)return()=>{e.forEach(n=>{const s=t.get(n);s?s():lr(n,null)}),t.clear()}}}function xn(...e){return x.useCallback(Sn(...e),e)}function vr({value:e,defaultValue:t,finalValue:r,onChange:n=()=>{}}){const[s,o]=x.useState(t!==void 0?t:r),a=(l,...i)=>{o(l),n==null||n(l,...i)};return e!==void 0?[e,n,!0]:[s,a,!1]}function Cn(e=!1,t){const{onOpen:r,onClose:n}={},[s,o]=x.useState(e),a=x.useCallback(()=>{o(u=>u||(r==null||r(),!0))},[r]),l=x.useCallback(()=>{o(u=>u&&(n==null||n(),!1))},[n]),i=x.useCallback(()=>{s?l():a()},[l,a,s]);return[s,{open:a,close:l,toggle:i}]}const wn=e=>{const{fields:t,options:r,value:n,error:s={},name:o,readOnly:a}=e,l=n.map((i,u)=>{const f=(h,y)=>{i[h]=y,r.replaceElement(u,i)};return t.map((h,y)=>S.jsxs(x.Fragment,{children:[S.jsx(Et,{field:h,formValues:i,onChange:f,value:i[h.name],error:h.name in(s[u]??{})?s[u][h.name]:void 0,readOnly:a}),!a&&S.jsx(_.Button,{onClick:()=>r.removeElement(u),children:"Remove"})]},y))});return S.jsxs(S.Fragment,{children:[typeof s=="string"&&S.jsx(_.Text,{c:"red",fz:"sm",fw:500,children:s}),l,!a&&S.jsx(_.Button,{display:"block",onClick:()=>r.addElement({}),children:"Add"})]})},kn=e=>{const{name:t,onChange:r,value:n,readOnly:s,label:o}=e;return S.jsx(_.Checkbox,{name:t,checked:n,readOnly:s,onChange:a=>r(t,a.target.checked),label:o})};var ut={exports:{}},En=ut.exports,cr;function Tn(){return cr||(cr=1,function(e,t){(function(r,n){e.exports=n()})(En,function(){var r={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,o=/\d\d/,a=/\d\d?/,l=/\d*[^-_:/,()\s\d]+/,i={},u=function(d){return(d=+d)+(d>68?1900:2e3)},f=function(d){return function(p){this[d]=+p}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(d){(this.zone||(this.zone={})).offset=function(p){if(!p||p==="Z")return 0;var g=p.match(/([+-]|\d\d)/g),D=60*g[1]+(+g[2]||0);return D===0?0:g[0]==="+"?-D:D}(d)}],y=function(d){var p=i[d];return p&&(p.indexOf?p:p.s.concat(p.f))},w=function(d,p){var g,D=i.meridiem;if(D){for(var L=1;L<=24;L+=1)if(d.indexOf(D(L,0,p))>-1){g=L>12;break}}else g=d===(p?"pm":"PM");return g},b={A:[l,function(d){this.afternoon=w(d,!1)}],a:[l,function(d){this.afternoon=w(d,!0)}],Q:[s,function(d){this.month=3*(d-1)+1}],S:[s,function(d){this.milliseconds=100*+d}],SS:[o,function(d){this.milliseconds=10*+d}],SSS:[/\d{3}/,function(d){this.milliseconds=+d}],s:[a,f("seconds")],ss:[a,f("seconds")],m:[a,f("minutes")],mm:[a,f("minutes")],H:[a,f("hours")],h:[a,f("hours")],HH:[a,f("hours")],hh:[a,f("hours")],D:[a,f("day")],DD:[o,f("day")],Do:[l,function(d){var p=i.ordinal,g=d.match(/\d+/);if(this.day=g[0],p)for(var D=1;D<=31;D+=1)p(D).replace(/\[|\]/g,"")===d&&(this.day=D)}],w:[a,f("week")],ww:[o,f("week")],M:[a,f("month")],MM:[o,f("month")],MMM:[l,function(d){var p=y("months"),g=(y("monthsShort")||p.map(function(D){return D.slice(0,3)})).indexOf(d)+1;if(g<1)throw new Error;this.month=g%12||g}],MMMM:[l,function(d){var p=y("months").indexOf(d)+1;if(p<1)throw new Error;this.month=p%12||p}],Y:[/[+-]?\d+/,f("year")],YY:[o,function(d){this.year=u(d)}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function m(d){var p,g;p=d,g=i&&i.formats;for(var D=(d=p.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Y,V,z){var P=z&&z.toUpperCase();return V||g[z]||r[z]||g[P].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(H,I,q){return I||q.slice(1)})})).match(n),L=D.length,k=0;k<L;k+=1){var v=D[k],C=b[v],O=C&&C[0],F=C&&C[1];D[k]=F?{regex:O,parser:F}:v.replace(/^\[|\]$/g,"")}return function(Y){for(var V={},z=0,P=0;z<L;z+=1){var H=D[z];if(typeof H=="string")P+=H.length;else{var I=H.regex,q=H.parser,A=Y.slice(P),U=I.exec(A)[0];q.call(V,U),Y=Y.replace(U,"")}}return function(E){var J=E.afternoon;if(J!==void 0){var j=E.hours;J?j<12&&(E.hours+=12):j===12&&(E.hours=0),delete E.afternoon}}(V),V}}return function(d,p,g){g.p.customParseFormat=!0,d&&d.parseTwoDigitYear&&(u=d.parseTwoDigitYear);var D=p.prototype,L=D.parse;D.parse=function(k){var v=k.date,C=k.utc,O=k.args;this.$u=C;var F=O[1];if(typeof F=="string"){var Y=O[2]===!0,V=O[3]===!0,z=Y||V,P=O[2];V&&(P=O[2]),i=this.$locale(),!Y&&P&&(i=g.Ls[P]),this.$d=function(A,U,E,J){try{if(["x","X"].indexOf(U)>-1)return new Date((U==="X"?1e3:1)*A);var j=m(U)(A),W=j.year,re=j.month,te=j.day,M=j.hours,G=j.minutes,X=j.seconds,ee=j.milliseconds,B=j.zone,ie=j.week,Z=new Date,ue=te||(W||re?1:Z.getDate()),N=W||Z.getFullYear(),ne=0;W&&!re||(ne=re>0?re-1:Z.getMonth());var Q,ce=M||0,Ce=G||0,De=X||0,he=ee||0;return B?new Date(Date.UTC(N,ne,ue,ce,Ce,De,he+60*B.offset*1e3)):E?new Date(Date.UTC(N,ne,ue,ce,Ce,De,he)):(Q=new Date(N,ne,ue,ce,Ce,De,he),ie&&(Q=J(Q).week(ie).toDate()),Q)}catch{return new Date("")}}(v,F,C,g),this.init(),P&&P!==!0&&(this.$L=this.locale(P).$L),z&&v!=this.format(F)&&(this.$d=new Date("")),i={}}else if(F instanceof Array)for(var H=F.length,I=1;I<=H;I+=1){O[1]=F[I-1];var q=g.apply(this,O);if(q.isValid()){this.$d=q.$d,this.$L=q.$L,this.init();break}I===H&&(this.$d=new Date(""))}else L.call(this,k)}}})}(ut)),ut.exports}var jn=Tn();const gr=Qe(jn);function On({direction:e,levelIndex:t,rowIndex:r,cellIndex:n,size:s}){switch(e){case"up":return t===0&&r===0?null:r===0?{levelIndex:t-1,rowIndex:n<=s[t-1][s[t-1].length-1]-1?s[t-1].length-1:s[t-1].length-2,cellIndex:n}:{levelIndex:t,rowIndex:r-1,cellIndex:n};case"down":return r===s[t].length-1?{levelIndex:t+1,rowIndex:0,cellIndex:n}:r===s[t].length-2&&n>=s[t][s[t].length-1]?{levelIndex:t+1,rowIndex:0,cellIndex:n}:{levelIndex:t,rowIndex:r+1,cellIndex:n};case"left":return t===0&&r===0&&n===0?null:r===0&&n===0?{levelIndex:t-1,rowIndex:s[t-1].length-1,cellIndex:s[t-1][s[t-1].length-1]-1}:n===0?{levelIndex:t,rowIndex:r-1,cellIndex:s[t][r-1]-1}:{levelIndex:t,rowIndex:r,cellIndex:n-1};case"right":return r===s[t].length-1&&n===s[t][r]-1?{levelIndex:t+1,rowIndex:0,cellIndex:0}:n===s[t][r]-1?{levelIndex:t,rowIndex:r+1,cellIndex:0}:{levelIndex:t,rowIndex:r,cellIndex:n+1};default:return{levelIndex:t,rowIndex:r,cellIndex:n}}}function br({controlsRef:e,direction:t,levelIndex:r,rowIndex:n,cellIndex:s,size:o}){var i,u,f;const a=On({direction:t,size:o,rowIndex:n,cellIndex:s,levelIndex:r});if(!a)return;const l=(f=(u=(i=e.current)==null?void 0:i[a.levelIndex])==null?void 0:u[a.rowIndex])==null?void 0:f[a.cellIndex];l&&(l.disabled||l.getAttribute("data-hidden")||l.getAttribute("data-outside")?br({controlsRef:e,direction:t,levelIndex:a.levelIndex,cellIndex:a.cellIndex,rowIndex:a.rowIndex,size:o}):l.focus())}function Ln(e){switch(e){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function Rn(e){var t;return(t=e.current)==null?void 0:t.map(r=>r.map(n=>n.length))}function It({controlsRef:e,levelIndex:t,rowIndex:r,cellIndex:n,event:s}){const o=Ln(s.key);if(o){s.preventDefault();const a=Rn(e);br({controlsRef:e,direction:o,levelIndex:t,rowIndex:r,cellIndex:n,size:a})}}function Wt(e,t){if(!e||!t)return t;const r=e.getHours(),n=e.getMinutes(),s=e.getSeconds(),o=e.getMilliseconds(),a=new Date(t);return a.setHours(r),a.setMinutes(n),a.setSeconds(s),a.setMilliseconds(o),a}var ft={exports:{}},Fn=ft.exports,ur;function Mn(){return ur||(ur=1,function(e,t){(function(r,n){e.exports=n()})(Fn,function(){var r={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(s,o,a){var l,i=function(y,w,b){b===void 0&&(b={});var m=new Date(y),d=function(p,g){g===void 0&&(g={});var D=g.timeZoneName||"short",L=p+"|"+D,k=n[L];return k||(k=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:p,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:D}),n[L]=k),k}(w,b);return d.formatToParts(m)},u=function(y,w){for(var b=i(y,w),m=[],d=0;d<b.length;d+=1){var p=b[d],g=p.type,D=p.value,L=r[g];L>=0&&(m[L]=parseInt(D,10))}var k=m[3],v=k===24?0:k,C=m[0]+"-"+m[1]+"-"+m[2]+" "+v+":"+m[4]+":"+m[5]+":000",O=+y;return(a.utc(C).valueOf()-(O-=O%1e3))/6e4},f=o.prototype;f.tz=function(y,w){y===void 0&&(y=l);var b,m=this.utcOffset(),d=this.toDate(),p=d.toLocaleString("en-US",{timeZone:y}),g=Math.round((d-new Date(p))/1e3/60),D=15*-Math.round(d.getTimezoneOffset()/15)-g;if(!Number(D))b=this.utcOffset(0,w);else if(b=a(p,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(D,!0),w){var L=b.utcOffset();b=b.add(m-L,"minute")}return b.$x.$timezone=y,b},f.offsetName=function(y){var w=this.$x.$timezone||a.tz.guess(),b=i(this.valueOf(),w,{timeZoneName:y}).find(function(m){return m.type.toLowerCase()==="timezonename"});return b&&b.value};var h=f.startOf;f.startOf=function(y,w){if(!this.$x||!this.$x.$timezone)return h.call(this,y,w);var b=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return h.call(b,y,w).tz(this.$x.$timezone,!0)},a.tz=function(y,w,b){var m=b&&w,d=b||w||l,p=u(+a(),d);if(typeof y!="string")return a(y).tz(d);var g=function(v,C,O){var F=v-60*C*1e3,Y=u(F,O);if(C===Y)return[F,C];var V=u(F-=60*(Y-C)*1e3,O);return Y===V?[F,Y]:[v-60*Math.min(Y,V)*1e3,Math.max(Y,V)]}(a.utc(y,m).valueOf(),p,d),D=g[0],L=g[1],k=a(D).utcOffset(L);return k.$x.$timezone=d,k},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(y){l=y}}})}(ft)),ft.exports}var $n=Mn();const An=Qe($n);var dt={exports:{}},Nn=dt.exports,fr;function Yn(){return fr||(fr=1,function(e,t){(function(r,n){e.exports=n()})(Nn,function(){var r="minute",n=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(o,a,l){var i=a.prototype;l.utc=function(m){var d={date:m,utc:!0,args:arguments};return new a(d)},i.utc=function(m){var d=l(this.toDate(),{locale:this.$L,utc:!0});return m?d.add(this.utcOffset(),r):d},i.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var u=i.parse;i.parse=function(m){m.utc&&(this.$u=!0),this.$utils().u(m.$offset)||(this.$offset=m.$offset),u.call(this,m)};var f=i.init;i.init=function(){if(this.$u){var m=this.$d;this.$y=m.getUTCFullYear(),this.$M=m.getUTCMonth(),this.$D=m.getUTCDate(),this.$W=m.getUTCDay(),this.$H=m.getUTCHours(),this.$m=m.getUTCMinutes(),this.$s=m.getUTCSeconds(),this.$ms=m.getUTCMilliseconds()}else f.call(this)};var h=i.utcOffset;i.utcOffset=function(m,d){var p=this.$utils().u;if(p(m))return this.$u?0:p(this.$offset)?h.call(this):this.$offset;if(typeof m=="string"&&(m=function(k){k===void 0&&(k="");var v=k.match(n);if(!v)return null;var C=(""+v[0]).match(s)||["-",0,0],O=C[0],F=60*+C[1]+ +C[2];return F===0?0:O==="+"?F:-F}(m),m===null))return this;var g=Math.abs(m)<=16?60*m:m,D=this;if(d)return D.$offset=g,D.$u=m===0,D;if(m!==0){var L=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(D=this.local().add(g+L,r)).$offset=g,D.$x.$localOffset=L}else D=this.utc();return D};var y=i.format;i.format=function(m){var d=m||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return y.call(this,d)},i.valueOf=function(){var m=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*m},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var w=i.toDate;i.toDate=function(m){return m==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():w.call(this)};var b=i.diff;i.diff=function(m,d,p){if(m&&this.$u===m.$u)return b.call(this,m,d,p);var g=this.local(),D=l(m).local();return b.call(g,D,d,p)}}})}(dt)),dt.exports}var Vn=Yn();const Pn=Qe(Vn);R.extend(Pn);R.extend(An);function Wn(e,t){return t?R(e).tz(t).utcOffset()+e.getTimezoneOffset():0}const dr=(e,t,r)=>{if(!e)return null;if(!t)return e;let n=Wn(e,t);return r==="remove"&&(n*=-1),R(e).add(n,"minutes").toDate()};function Te(e,t,r,n){return n||!t?t:Array.isArray(t)?t.map(s=>dr(s,r,e)):dr(t,r,e)}const zn={locale:"en",timezone:null,firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:"–",consistentWeeks:!1},In=x.createContext(zn);function xe(){const e=x.useContext(In),t=x.useCallback(a=>a||e.locale,[e.locale]),r=x.useCallback(a=>a||e.timezone||void 0,[e.timezone]),n=x.useCallback(a=>typeof a=="number"?a:e.firstDayOfWeek,[e.firstDayOfWeek]),s=x.useCallback(a=>Array.isArray(a)?a:e.weekendDays,[e.weekendDays]),o=x.useCallback(a=>typeof a=="string"?a:e.labelSeparator,[e.labelSeparator]);return{...e,getLocale:t,getTimezone:r,getFirstDayOfWeek:n,getWeekendDays:s,getLabelSeparator:o}}function Hn(e,t){const r=xe(),n=s=>Te("remove",s,r.getTimezone()).toISOString();if(t==="range"&&Array.isArray(e)){const[s,o]=e;return s?o?`${n(s)} – ${n(o)}`:`${n(s)} –`:""}return t==="multiple"&&Array.isArray(e)?e.map(s=>s&&n(s)).filter(Boolean).join(", "):!Array.isArray(e)&&e?n(e):""}function Ht({value:e,type:t,name:r,form:n}){return S.jsx("input",{type:"hidden",value:Hn(e,t),name:r,form:n})}Ht.displayName="@mantine/dates/HiddenDatesInput";function Dr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Dr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function _r(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Dr(e))&&(n&&(n+=" "),n+=t);return n}var Bn={input:"m_468e7eda"};const Un={},ht=_.factory((e,t)=>{const r=_.useProps("TimeInput",Un,e),{classNames:n,styles:s,unstyled:o,vars:a,withSeconds:l,minTime:i,maxTime:u,value:f,onChange:h,...y}=r,{resolvedClassNames:w,resolvedStyles:b}=_.useResolvedStylesApi({classNames:n,styles:s,props:r}),m=p=>{if(i!==void 0||u!==void 0){const[g,D,L]=p.split(":").map(Number);if(i){const[k,v,C]=i.split(":").map(Number);if(g<k||g===k&&D<v||l&&g===k&&D===v&&L<C)return-1}if(u){const[k,v,C]=u.split(":").map(Number);if(g>k||g===k&&D>v||l&&g===k&&D===v&&L>C)return 1}}return 0},d=p=>{var g,D,L;if((g=r.onBlur)==null||g.call(r,p),i!==void 0||u!==void 0){const k=p.currentTarget.value;if(k){const v=m(k);v===1?(p.currentTarget.value=u,(D=r.onChange)==null||D.call(r,p)):v===-1&&(p.currentTarget.value=i,(L=r.onChange)==null||L.call(r,p))}}};return S.jsx(_.InputBase,{classNames:{...w,input:_r(Bn.input,w==null?void 0:w.input)},styles:b,unstyled:o,ref:t,value:f,...y,step:l?1:60,onChange:h,onBlur:d,type:"time",__staticSelector:"TimeInput"})});ht.classes=_.InputBase.classes;ht.displayName="@mantine/dates/TimeInput";var Sr={day:"m_396ce5cb"};const qn={},Gn=_.createVarsResolver((e,{size:t})=>({day:{"--day-size":_.getSize(t,"day-size")}})),Bt=_.factory((e,t)=>{const r=_.useProps("Day",qn,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,date:u,disabled:f,__staticSelector:h,weekend:y,outside:w,selected:b,renderDay:m,inRange:d,firstInRange:p,lastInRange:g,hidden:D,static:L,highlightToday:k,...v}=r,C=_.useStyles({name:h||"Day",classes:Sr,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,varsResolver:Gn,rootSelector:"day"}),O=xe();return S.jsx(_.UnstyledButton,{...C("day",{style:D?{display:"none"}:void 0}),component:L?"div":"button",ref:t,disabled:f,"data-today":R(u).isSame(Te("add",new Date,O.getTimezone()),"day")||void 0,"data-hidden":D||void 0,"data-highlight-today":k||void 0,"data-disabled":f||void 0,"data-weekend":!f&&!w&&y||void 0,"data-outside":!f&&w||void 0,"data-selected":!f&&b||void 0,"data-in-range":d&&!f||void 0,"data-first-in-range":p&&!f||void 0,"data-last-in-range":g&&!f||void 0,"data-static":L||void 0,unstyled:l,...v,children:(m==null?void 0:m(u))||R(u).date()})});Bt.classes=Sr;Bt.displayName="@mantine/dates/Day";function Kn({locale:e,format:t="dd",firstDayOfWeek:r=1}){const n=R().day(r),s=[];for(let o=0;o<7;o+=1)typeof t=="string"?s.push(R(n).add(o,"days").locale(e).format(t)):s.push(t(R(n).add(o,"days").toDate()));return s}var xr={weekday:"m_18a3eca"};const Zn={},Jn=_.createVarsResolver((e,{size:t})=>({weekdaysRow:{"--wr-fz":_.getFontSize(t),"--wr-spacing":_.getSpacing(t)}})),Ut=_.factory((e,t)=>{const r=_.useProps("WeekdaysRow",Zn,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,locale:u,firstDayOfWeek:f,weekdayFormat:h,cellComponent:y="th",__staticSelector:w,withWeekNumbers:b,...m}=r,d=_.useStyles({name:w||"WeekdaysRow",classes:xr,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,varsResolver:Jn,rootSelector:"weekdaysRow"}),p=xe(),g=Kn({locale:p.getLocale(u),format:h,firstDayOfWeek:p.getFirstDayOfWeek(f)}).map((D,L)=>S.jsx(y,{...d("weekday"),children:D},L));return S.jsxs(_.Box,{component:"tr",ref:t,...d("weekdaysRow"),...m,children:[b&&S.jsx(y,{...d("weekday"),children:"#"}),g]})});Ut.classes=xr;Ut.displayName="@mantine/dates/WeekdaysRow";function Xn(e,t=1){let r=R(e);const n=t===0?6:t-1;for(;r.day()!==n;)r=r.add(1,"day");return r.toDate()}function Qn(e,t=1){let r=R(e);for(;r.day()!==t;)r=r.subtract(1,"day");return r.toDate()}function es({month:e,firstDayOfWeek:t=1,consistentWeeks:r}){const n=R(e).subtract(R(e).date()-1,"day"),s=R(n).startOf("day"),o=s.toDate(),a=s.add(+s.daysInMonth()-1,"day").toDate(),l=Xn(a,t),i=Qn(o,t),u=[];for(;i<=l;){const f=[];for(let h=0;h<7;h+=1)f.push(new Date(i)),i.setDate(i.getDate()+1);u.push(f)}if(r&&u.length<6){const f=u[u.length-1],h=f[f.length-1],y=new Date(h);for(y.setDate(y.getDate()+1);u.length<6;){const w=[];for(let b=0;b<7;b+=1)w.push(new Date(y)),y.setDate(y.getDate()+1);u.push(w)}}return u}function Cr(e,t){return R(e).format("YYYY-MM")===R(t).format("YYYY-MM")}function wr(e,t){return t instanceof Date?R(e).isAfter(R(t).subtract(1,"day"),"day"):!0}function kr(e,t){return t instanceof Date?R(e).isBefore(R(t).add(1,"day"),"day"):!0}function ts(e,t,r,n,s,o,a){const l=e.flat().filter(f=>{var h;return kr(f,r)&&wr(f,t)&&!(s!=null&&s(f))&&!((h=n==null?void 0:n(f))!=null&&h.disabled)&&(!o||Cr(f,a))}),i=l.find(f=>{var h;return(h=n==null?void 0:n(f))==null?void 0:h.selected});if(i)return i;const u=l.find(f=>R().isSame(f,"date"));return u||l[0]}var mt={exports:{}},rs=mt.exports,mr;function ns(){return mr||(mr=1,function(e,t){(function(r,n){e.exports=n()})(rs,function(){var r="day";return function(n,s,o){var a=function(u){return u.add(4-u.isoWeekday(),r)},l=s.prototype;l.isoWeekYear=function(){return a(this).year()},l.isoWeek=function(u){if(!this.$utils().u(u))return this.add(7*(u-this.isoWeek()),r);var f,h,y,w,b=a(this),m=(f=this.isoWeekYear(),h=this.$u,y=(h?o.utc:o)().year(f).startOf("year"),w=4-y.isoWeekday(),y.isoWeekday()>4&&(w+=7),y.add(w,r));return b.diff(m,"week")+1},l.isoWeekday=function(u){return this.$utils().u(u)?this.day()||7:this.day(this.day()%7?u:u-7)};var i=l.startOf;l.startOf=function(u,f){var h=this.$utils(),y=!!h.u(f)||f;return h.p(u)==="isoweek"?y?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):i.bind(this)(u,f)}}})}(mt)),mt.exports}var ss=ns();const as=Qe(ss);R.extend(as);function os(e){const t=e.find(r=>R(r).day()===1);return R(t).isoWeek()}var Er={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const is={withCellSpacing:!0},ls=_.createVarsResolver((e,{size:t})=>({weekNumber:{"--wn-fz":_.getFontSize(t),"--wn-size":_.getSize(t,"wn-size")}})),pt=_.factory((e,t)=>{const r=_.useProps("Month",is,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,__staticSelector:u,locale:f,firstDayOfWeek:h,weekdayFormat:y,month:w,weekendDays:b,getDayProps:m,excludeDate:d,minDate:p,maxDate:g,renderDay:D,hideOutsideDates:L,hideWeekdays:k,getDayAriaLabel:v,static:C,__getDayRef:O,__onDayKeyDown:F,__onDayClick:Y,__onDayMouseEnter:V,__preventFocus:z,__stopPropagation:P,withCellSpacing:H,size:I,highlightToday:q,withWeekNumbers:A,...U}=r,E=_.useStyles({name:u||"Month",classes:Er,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,varsResolver:ls,rootSelector:"month"}),J=xe(),j=es({month:w,firstDayOfWeek:J.getFirstDayOfWeek(h),consistentWeeks:J.consistentWeeks}),W=ts(j,p,g,m,d,L,w),{resolvedClassNames:re,resolvedStyles:te}=_.useResolvedStylesApi({classNames:n,styles:a,props:r}),M=j.map((G,X)=>{const ee=G.map((B,ie)=>{const Z=!Cr(B,w),ue=(v==null?void 0:v(B))||R(B).locale(f||J.locale).format("D MMMM YYYY"),N=m==null?void 0:m(B),ne=R(B).isSame(W,"date");return S.jsx("td",{...E("monthCell"),"data-with-spacing":H||void 0,children:S.jsx(Bt,{__staticSelector:u||"Month",classNames:re,styles:te,unstyled:l,"data-mantine-stop-propagation":P||void 0,highlightToday:q,renderDay:D,date:B,size:I,weekend:J.getWeekendDays(b).includes(B.getDay()),outside:Z,hidden:L?Z:!1,"aria-label":ue,static:C,disabled:(d==null?void 0:d(B))||!kr(B,g)||!wr(B,p),ref:Q=>O==null?void 0:O(X,ie,Q),...N,onKeyDown:Q=>{var ce;(ce=N==null?void 0:N.onKeyDown)==null||ce.call(N,Q),F==null||F(Q,{rowIndex:X,cellIndex:ie,date:B})},onMouseEnter:Q=>{var ce;(ce=N==null?void 0:N.onMouseEnter)==null||ce.call(N,Q),V==null||V(Q,B)},onClick:Q=>{var ce;(ce=N==null?void 0:N.onClick)==null||ce.call(N,Q),Y==null||Y(Q,B)},onMouseDown:Q=>{var ce;(ce=N==null?void 0:N.onMouseDown)==null||ce.call(N,Q),z&&Q.preventDefault()},tabIndex:z||!ne?-1:0})},B.toString())});return S.jsxs("tr",{...E("monthRow"),children:[A&&S.jsx("td",{...E("weekNumber"),children:os(G)}),ee]},X)});return S.jsxs(_.Box,{component:"table",...E("month"),size:I,ref:t,...U,children:[!k&&S.jsx("thead",{...E("monthThead"),children:S.jsx(Ut,{__staticSelector:u||"Month",locale:f,firstDayOfWeek:h,weekdayFormat:y,size:I,classNames:re,styles:te,unstyled:l,withWeekNumbers:A})}),S.jsx("tbody",{...E("monthTbody"),children:M})]})});pt.classes=Er;pt.displayName="@mantine/dates/Month";var Tr={pickerControl:"m_dc6a3c71"};const cs={},us=_.createVarsResolver((e,{size:t})=>({pickerControl:{"--dpc-fz":_.getFontSize(t),"--dpc-size":_.getSize(t,"dpc-size")}})),yt=_.factory((e,t)=>{const r=_.useProps("PickerControl",cs,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,firstInRange:u,lastInRange:f,inRange:h,__staticSelector:y,selected:w,disabled:b,...m}=r,d=_.useStyles({name:y||"PickerControl",classes:Tr,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,varsResolver:us,rootSelector:"pickerControl"});return S.jsx(_.UnstyledButton,{...d("pickerControl"),ref:t,unstyled:l,"data-picker-control":!0,"data-selected":w&&!b||void 0,"data-disabled":b||void 0,"data-in-range":h&&!b&&!w||void 0,"data-first-in-range":u&&!b||void 0,"data-last-in-range":f&&!b||void 0,disabled:b,...m})});yt.classes=Tr;yt.displayName="@mantine/dates/PickerControl";function jr(e,t,r){return!t&&!r?!1:!!(t&&R(e).isBefore(t,"year")||r&&R(e).isAfter(r,"year"))}function fs(e,t,r,n){const s=e.flat().filter(l=>{var i;return!jr(l,t,r)&&!((i=n==null?void 0:n(l))!=null&&i.disabled)}),o=s.find(l=>{var i;return(i=n==null?void 0:n(l))==null?void 0:i.selected});if(o)return o;const a=s.find(l=>R().isSame(l,"year"));return a||s[0]}function Or(e){const t=e.getFullYear(),r=t-t%10;let n=0;const s=[[],[],[],[]];for(let o=0;o<4;o+=1){const a=o===3?1:3;for(let l=0;l<a;l+=1)s[o].push(new Date(r+n,0)),n+=1}return s}var Lr={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const ds={yearsListFormat:"YYYY",withCellSpacing:!0},vt=_.factory((e,t)=>{const r=_.useProps("YearsList",ds,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,decade:u,yearsListFormat:f,locale:h,minDate:y,maxDate:w,getYearControlProps:b,__staticSelector:m,__getControlRef:d,__onControlKeyDown:p,__onControlClick:g,__onControlMouseEnter:D,__preventFocus:L,__stopPropagation:k,withCellSpacing:v,size:C,...O}=r,F=_.useStyles({name:m||"YearsList",classes:Lr,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,rootSelector:"yearsList"}),Y=xe(),V=Or(u),z=fs(V,y,w,b),P=V.map((H,I)=>{const q=H.map((A,U)=>{const E=b==null?void 0:b(A),J=R(A).isSame(z,"year");return S.jsx("td",{...F("yearsListCell"),"data-with-spacing":v||void 0,children:S.jsx(yt,{...F("yearsListControl"),size:C,unstyled:l,"data-mantine-stop-propagation":k||void 0,disabled:jr(A,y,w),ref:j=>d==null?void 0:d(I,U,j),...E,onKeyDown:j=>{var W;(W=E==null?void 0:E.onKeyDown)==null||W.call(E,j),p==null||p(j,{rowIndex:I,cellIndex:U,date:A})},onClick:j=>{var W;(W=E==null?void 0:E.onClick)==null||W.call(E,j),g==null||g(j,A)},onMouseEnter:j=>{var W;(W=E==null?void 0:E.onMouseEnter)==null||W.call(E,j),D==null||D(j,A)},onMouseDown:j=>{var W;(W=E==null?void 0:E.onMouseDown)==null||W.call(E,j),L&&j.preventDefault()},tabIndex:L||!J?-1:0,children:R(A).locale(Y.getLocale(h)).format(f)})},U)});return S.jsx("tr",{...F("yearsListRow"),children:q},I)});return S.jsx(_.Box,{component:"table",ref:t,size:C,...F("yearsList"),...O,children:S.jsx("tbody",{children:P})})});vt.classes=Lr;vt.displayName="@mantine/dates/YearsList";function Rr(e,t,r){return!t&&!r?!1:!!(t&&R(e).isBefore(t,"month")||r&&R(e).isAfter(r,"month"))}function ms(e,t,r,n){const s=e.flat().filter(l=>{var i;return!Rr(l,t,r)&&!((i=n==null?void 0:n(l))!=null&&i.disabled)}),o=s.find(l=>{var i;return(i=n==null?void 0:n(l))==null?void 0:i.selected});if(o)return o;const a=s.find(l=>R().isSame(l,"month"));return a||s[0]}function hs(e){const t=R(e).startOf("year").toDate(),r=[[],[],[],[]];let n=0;for(let s=0;s<4;s+=1)for(let o=0;o<3;o+=1)r[s].push(R(t).add(n,"months").toDate()),n+=1;return r}var Fr={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const ps={monthsListFormat:"MMM",withCellSpacing:!0},gt=_.factory((e,t)=>{const r=_.useProps("MonthsList",ps,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,__staticSelector:u,year:f,monthsListFormat:h,locale:y,minDate:w,maxDate:b,getMonthControlProps:m,__getControlRef:d,__onControlKeyDown:p,__onControlClick:g,__onControlMouseEnter:D,__preventFocus:L,__stopPropagation:k,withCellSpacing:v,size:C,...O}=r,F=_.useStyles({name:u||"MonthsList",classes:Fr,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,rootSelector:"monthsList"}),Y=xe(),V=hs(f),z=ms(V,w,b,m),P=V.map((H,I)=>{const q=H.map((A,U)=>{const E=m==null?void 0:m(A),J=R(A).isSame(z,"month");return S.jsx("td",{...F("monthsListCell"),"data-with-spacing":v||void 0,children:S.jsx(yt,{...F("monthsListControl"),size:C,unstyled:l,__staticSelector:u||"MonthsList","data-mantine-stop-propagation":k||void 0,disabled:Rr(A,w,b),ref:j=>d==null?void 0:d(I,U,j),...E,onKeyDown:j=>{var W;(W=E==null?void 0:E.onKeyDown)==null||W.call(E,j),p==null||p(j,{rowIndex:I,cellIndex:U,date:A})},onClick:j=>{var W;(W=E==null?void 0:E.onClick)==null||W.call(E,j),g==null||g(j,A)},onMouseEnter:j=>{var W;(W=E==null?void 0:E.onMouseEnter)==null||W.call(E,j),D==null||D(j,A)},onMouseDown:j=>{var W;(W=E==null?void 0:E.onMouseDown)==null||W.call(E,j),L&&j.preventDefault()},tabIndex:L||!J?-1:0,children:R(A).locale(Y.getLocale(y)).format(h)})},U)});return S.jsx("tr",{...F("monthsListRow"),children:q},I)});return S.jsx(_.Box,{component:"table",ref:t,size:C,...F("monthsList"),...O,children:S.jsx("tbody",{children:P})})});gt.classes=Fr;gt.displayName="@mantine/dates/MonthsList";var Mr={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const ys={nextDisabled:!1,previousDisabled:!1,hasNextLevel:!0,withNext:!0,withPrevious:!0},vs=_.createVarsResolver((e,{size:t})=>({calendarHeader:{"--dch-control-size":_.getSize(t,"dch-control-size"),"--dch-fz":_.getFontSize(t)}})),Fe=_.factory((e,t)=>{const r=_.useProps("CalendarHeader",ys,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,nextIcon:u,previousIcon:f,nextLabel:h,previousLabel:y,onNext:w,onPrevious:b,onLevelClick:m,label:d,nextDisabled:p,previousDisabled:g,hasNextLevel:D,levelControlAriaLabel:L,withNext:k,withPrevious:v,__staticSelector:C,__preventFocus:O,__stopPropagation:F,...Y}=r,V=_.useStyles({name:C||"CalendarHeader",classes:Mr,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,varsResolver:vs,rootSelector:"calendarHeader"}),z=O?P=>P.preventDefault():void 0;return S.jsxs(_.Box,{...V("calendarHeader"),ref:t,...Y,children:[v&&S.jsx(_.UnstyledButton,{...V("calendarHeaderControl"),"data-direction":"previous","aria-label":y,onClick:b,unstyled:l,onMouseDown:z,disabled:g,"data-disabled":g||void 0,tabIndex:O||g?-1:0,"data-mantine-stop-propagation":F||void 0,children:f||S.jsx(_.AccordionChevron,{...V("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})}),S.jsx(_.UnstyledButton,{component:D?"button":"div",...V("calendarHeaderLevel"),onClick:D?m:void 0,unstyled:l,onMouseDown:D?z:void 0,disabled:!D,"data-static":!D||void 0,"aria-label":L,tabIndex:O||!D?-1:0,"data-mantine-stop-propagation":F||void 0,children:d}),k&&S.jsx(_.UnstyledButton,{...V("calendarHeaderControl"),"data-direction":"next","aria-label":h,onClick:w,unstyled:l,onMouseDown:z,disabled:p,"data-disabled":p||void 0,tabIndex:O||p?-1:0,"data-mantine-stop-propagation":F||void 0,children:u||S.jsx(_.AccordionChevron,{...V("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})})]})});Fe.classes=Mr;Fe.displayName="@mantine/dates/CalendarHeader";function gs(e){const t=Or(e);return[t[0][0],t[3][0]]}const bs={decadeLabelFormat:"YYYY"},bt=_.factory((e,t)=>{const r=_.useProps("DecadeLevel",bs,e),{decade:n,locale:s,minDate:o,maxDate:a,yearsListFormat:l,getYearControlProps:i,__getControlRef:u,__onControlKeyDown:f,__onControlClick:h,__onControlMouseEnter:y,withCellSpacing:w,__preventFocus:b,nextIcon:m,previousIcon:d,nextLabel:p,previousLabel:g,onNext:D,onPrevious:L,nextDisabled:k,previousDisabled:v,levelControlAriaLabel:C,withNext:O,withPrevious:F,decadeLabelFormat:Y,classNames:V,styles:z,unstyled:P,__staticSelector:H,__stopPropagation:I,size:q,...A}=r,U=xe(),[E,J]=gs(n),j={__staticSelector:H||"DecadeLevel",classNames:V,styles:z,unstyled:P,size:q},W=typeof k=="boolean"?k:a?!R(J).endOf("year").isBefore(a):!1,re=typeof v=="boolean"?v:o?!R(E).startOf("year").isAfter(o):!1,te=(M,G)=>R(M).locale(s||U.locale).format(G);return S.jsxs(_.Box,{"data-decade-level":!0,size:q,ref:t,...A,children:[S.jsx(Fe,{label:typeof Y=="function"?Y(E,J):`${te(E,Y)} – ${te(J,Y)}`,__preventFocus:b,__stopPropagation:I,nextIcon:m,previousIcon:d,nextLabel:p,previousLabel:g,onNext:D,onPrevious:L,nextDisabled:W,previousDisabled:re,hasNextLevel:!1,levelControlAriaLabel:C,withNext:O,withPrevious:F,...j}),S.jsx(vt,{decade:n,locale:s,minDate:o,maxDate:a,yearsListFormat:l,getYearControlProps:i,__getControlRef:u,__onControlKeyDown:f,__onControlClick:h,__onControlMouseEnter:y,__preventFocus:b,__stopPropagation:I,withCellSpacing:w,...j})]})});bt.classes={...vt.classes,...Fe.classes};bt.displayName="@mantine/dates/DecadeLevel";const Ds={yearLabelFormat:"YYYY"},Dt=_.factory((e,t)=>{const r=_.useProps("YearLevel",Ds,e),{year:n,locale:s,minDate:o,maxDate:a,monthsListFormat:l,getMonthControlProps:i,__getControlRef:u,__onControlKeyDown:f,__onControlClick:h,__onControlMouseEnter:y,withCellSpacing:w,__preventFocus:b,nextIcon:m,previousIcon:d,nextLabel:p,previousLabel:g,onNext:D,onPrevious:L,onLevelClick:k,nextDisabled:v,previousDisabled:C,hasNextLevel:O,levelControlAriaLabel:F,withNext:Y,withPrevious:V,yearLabelFormat:z,__staticSelector:P,__stopPropagation:H,size:I,classNames:q,styles:A,unstyled:U,...E}=r,J=xe(),j={__staticSelector:P||"YearLevel",classNames:q,styles:A,unstyled:U,size:I},W=typeof v=="boolean"?v:a?!R(n).endOf("year").isBefore(a):!1,re=typeof C=="boolean"?C:o?!R(n).startOf("year").isAfter(o):!1;return S.jsxs(_.Box,{"data-year-level":!0,size:I,ref:t,...E,children:[S.jsx(Fe,{label:typeof z=="function"?z(n):R(n).locale(s||J.locale).format(z),__preventFocus:b,__stopPropagation:H,nextIcon:m,previousIcon:d,nextLabel:p,previousLabel:g,onNext:D,onPrevious:L,onLevelClick:k,nextDisabled:W,previousDisabled:re,hasNextLevel:O,levelControlAriaLabel:F,withNext:Y,withPrevious:V,...j}),S.jsx(gt,{year:n,locale:s,minDate:o,maxDate:a,monthsListFormat:l,getMonthControlProps:i,__getControlRef:u,__onControlKeyDown:f,__onControlClick:h,__onControlMouseEnter:y,__preventFocus:b,__stopPropagation:H,withCellSpacing:w,...j})]})});Dt.classes={...Fe.classes,...gt.classes};Dt.displayName="@mantine/dates/YearLevel";const _s={monthLabelFormat:"MMMM YYYY"},_t=_.factory((e,t)=>{const r=_.useProps("MonthLevel",_s,e),{month:n,locale:s,firstDayOfWeek:o,weekdayFormat:a,weekendDays:l,getDayProps:i,excludeDate:u,minDate:f,maxDate:h,renderDay:y,hideOutsideDates:w,hideWeekdays:b,getDayAriaLabel:m,__getDayRef:d,__onDayKeyDown:p,__onDayClick:g,__onDayMouseEnter:D,withCellSpacing:L,highlightToday:k,withWeekNumbers:v,__preventFocus:C,__stopPropagation:O,nextIcon:F,previousIcon:Y,nextLabel:V,previousLabel:z,onNext:P,onPrevious:H,onLevelClick:I,nextDisabled:q,previousDisabled:A,hasNextLevel:U,levelControlAriaLabel:E,withNext:J,withPrevious:j,monthLabelFormat:W,classNames:re,styles:te,unstyled:M,__staticSelector:G,size:X,static:ee,...B}=r,ie=xe(),Z={__staticSelector:G||"MonthLevel",classNames:re,styles:te,unstyled:M,size:X},ue=typeof q=="boolean"?q:h?!R(n).endOf("month").isBefore(h):!1,N=typeof A=="boolean"?A:f?!R(n).startOf("month").isAfter(f):!1;return S.jsxs(_.Box,{"data-month-level":!0,size:X,ref:t,...B,children:[S.jsx(Fe,{label:typeof W=="function"?W(n):R(n).locale(s||ie.locale).format(W),__preventFocus:C,__stopPropagation:O,nextIcon:F,previousIcon:Y,nextLabel:V,previousLabel:z,onNext:P,onPrevious:H,onLevelClick:I,nextDisabled:ue,previousDisabled:N,hasNextLevel:U,levelControlAriaLabel:E,withNext:J,withPrevious:j,...Z}),S.jsx(pt,{month:n,locale:s,firstDayOfWeek:o,weekdayFormat:a,weekendDays:l,getDayProps:i,excludeDate:u,minDate:f,maxDate:h,renderDay:y,hideOutsideDates:w,hideWeekdays:b,getDayAriaLabel:m,__getDayRef:d,__onDayKeyDown:p,__onDayClick:g,__onDayMouseEnter:D,__preventFocus:C,__stopPropagation:O,static:ee,withCellSpacing:L,highlightToday:k,withWeekNumbers:v,...Z})]})});_t.classes={...pt.classes,...Fe.classes};_t.displayName="@mantine/dates/MonthLevel";var $r={levelsGroup:"m_30b26e33"};const Ss={},Me=_.factory((e,t)=>{const r=_.useProps("LevelsGroup",Ss,e),{classNames:n,className:s,style:o,styles:a,unstyled:l,vars:i,__staticSelector:u,...f}=r,h=_.useStyles({name:u||"LevelsGroup",classes:$r,props:r,className:s,style:o,classNames:n,styles:a,unstyled:l,vars:i,rootSelector:"levelsGroup"});return S.jsx(_.Box,{ref:t,...h("levelsGroup"),...f})});Me.classes=$r;Me.displayName="@mantine/dates/LevelsGroup";const xs={numberOfColumns:1},St=_.factory((e,t)=>{const r=_.useProps("DecadeLevelGroup",xs,e),{decade:n,locale:s,minDate:o,maxDate:a,yearsListFormat:l,getYearControlProps:i,__onControlClick:u,__onControlMouseEnter:f,withCellSpacing:h,__preventFocus:y,nextIcon:w,previousIcon:b,nextLabel:m,previousLabel:d,onNext:p,onPrevious:g,nextDisabled:D,previousDisabled:L,classNames:k,styles:v,unstyled:C,__staticSelector:O,__stopPropagation:F,numberOfColumns:Y,levelControlAriaLabel:V,decadeLabelFormat:z,size:P,vars:H,...I}=r,q=x.useRef([]),A=Array(Y).fill(0).map((U,E)=>{const J=R(n).add(E*10,"years").toDate();return S.jsx(bt,{size:P,yearsListFormat:l,decade:J,withNext:E===Y-1,withPrevious:E===0,decadeLabelFormat:z,__onControlClick:u,__onControlMouseEnter:f,__onControlKeyDown:(j,W)=>It({levelIndex:E,rowIndex:W.rowIndex,cellIndex:W.cellIndex,event:j,controlsRef:q}),__getControlRef:(j,W,re)=>{Array.isArray(q.current[E])||(q.current[E]=[]),Array.isArray(q.current[E][j])||(q.current[E][j]=[]),q.current[E][j][W]=re},levelControlAriaLabel:typeof V=="function"?V(J):V,locale:s,minDate:o,maxDate:a,__preventFocus:y,__stopPropagation:F,nextIcon:w,previousIcon:b,nextLabel:m,previousLabel:d,onNext:p,onPrevious:g,nextDisabled:D,previousDisabled:L,getYearControlProps:i,__staticSelector:O||"DecadeLevelGroup",classNames:k,styles:v,unstyled:C,withCellSpacing:h},E)});return S.jsx(Me,{classNames:k,styles:v,__staticSelector:O||"DecadeLevelGroup",ref:t,size:P,unstyled:C,...I,children:A})});St.classes={...Me.classes,...bt.classes};St.displayName="@mantine/dates/DecadeLevelGroup";const Cs={numberOfColumns:1},xt=_.factory((e,t)=>{const r=_.useProps("YearLevelGroup",Cs,e),{year:n,locale:s,minDate:o,maxDate:a,monthsListFormat:l,getMonthControlProps:i,__onControlClick:u,__onControlMouseEnter:f,withCellSpacing:h,__preventFocus:y,nextIcon:w,previousIcon:b,nextLabel:m,previousLabel:d,onNext:p,onPrevious:g,onLevelClick:D,nextDisabled:L,previousDisabled:k,hasNextLevel:v,classNames:C,styles:O,unstyled:F,__staticSelector:Y,__stopPropagation:V,numberOfColumns:z,levelControlAriaLabel:P,yearLabelFormat:H,size:I,vars:q,...A}=r,U=x.useRef([]),E=Array(z).fill(0).map((J,j)=>{const W=R(n).add(j,"years").toDate();return S.jsx(Dt,{size:I,monthsListFormat:l,year:W,withNext:j===z-1,withPrevious:j===0,yearLabelFormat:H,__stopPropagation:V,__onControlClick:u,__onControlMouseEnter:f,__onControlKeyDown:(re,te)=>It({levelIndex:j,rowIndex:te.rowIndex,cellIndex:te.cellIndex,event:re,controlsRef:U}),__getControlRef:(re,te,M)=>{Array.isArray(U.current[j])||(U.current[j]=[]),Array.isArray(U.current[j][re])||(U.current[j][re]=[]),U.current[j][re][te]=M},levelControlAriaLabel:typeof P=="function"?P(W):P,locale:s,minDate:o,maxDate:a,__preventFocus:y,nextIcon:w,previousIcon:b,nextLabel:m,previousLabel:d,onNext:p,onPrevious:g,onLevelClick:D,nextDisabled:L,previousDisabled:k,hasNextLevel:v,getMonthControlProps:i,classNames:C,styles:O,unstyled:F,__staticSelector:Y||"YearLevelGroup",withCellSpacing:h},j)});return S.jsx(Me,{classNames:C,styles:O,__staticSelector:Y||"YearLevelGroup",ref:t,size:I,unstyled:F,...A,children:E})});xt.classes={...Dt.classes,...Me.classes};xt.displayName="@mantine/dates/YearLevelGroup";const ws={numberOfColumns:1},Ct=_.factory((e,t)=>{const r=_.useProps("MonthLevelGroup",ws,e),{month:n,locale:s,firstDayOfWeek:o,weekdayFormat:a,weekendDays:l,getDayProps:i,excludeDate:u,minDate:f,maxDate:h,renderDay:y,hideOutsideDates:w,hideWeekdays:b,getDayAriaLabel:m,__onDayClick:d,__onDayMouseEnter:p,withCellSpacing:g,highlightToday:D,withWeekNumbers:L,__preventFocus:k,nextIcon:v,previousIcon:C,nextLabel:O,previousLabel:F,onNext:Y,onPrevious:V,onLevelClick:z,nextDisabled:P,previousDisabled:H,hasNextLevel:I,classNames:q,styles:A,unstyled:U,numberOfColumns:E,levelControlAriaLabel:J,monthLabelFormat:j,__staticSelector:W,__stopPropagation:re,size:te,static:M,vars:G,...X}=r,ee=x.useRef([]),B=Array(E).fill(0).map((ie,Z)=>{const ue=R(n).add(Z,"months").toDate();return S.jsx(_t,{month:ue,withNext:Z===E-1,withPrevious:Z===0,monthLabelFormat:j,__stopPropagation:re,__onDayClick:d,__onDayMouseEnter:p,__onDayKeyDown:(N,ne)=>It({levelIndex:Z,rowIndex:ne.rowIndex,cellIndex:ne.cellIndex,event:N,controlsRef:ee}),__getDayRef:(N,ne,Q)=>{Array.isArray(ee.current[Z])||(ee.current[Z]=[]),Array.isArray(ee.current[Z][N])||(ee.current[Z][N]=[]),ee.current[Z][N][ne]=Q},levelControlAriaLabel:typeof J=="function"?J(ue):J,locale:s,firstDayOfWeek:o,weekdayFormat:a,weekendDays:l,getDayProps:i,excludeDate:u,minDate:f,maxDate:h,renderDay:y,hideOutsideDates:w,hideWeekdays:b,getDayAriaLabel:m,__preventFocus:k,nextIcon:v,previousIcon:C,nextLabel:O,previousLabel:F,onNext:Y,onPrevious:V,onLevelClick:z,nextDisabled:P,previousDisabled:H,hasNextLevel:I,classNames:q,styles:A,unstyled:U,__staticSelector:W||"MonthLevelGroup",size:te,static:M,withCellSpacing:g,highlightToday:D,withWeekNumbers:L},Z)});return S.jsx(Me,{classNames:q,styles:A,__staticSelector:W||"MonthLevelGroup",ref:t,size:te,...X,children:B})});Ct.classes={...Me.classes,..._t.classes};Ct.displayName="@mantine/dates/MonthLevelGroup";var Ar={input:"m_6fa5e2aa"};const ks={},wt=_.factory((e,t)=>{const{inputProps:r,wrapperProps:n,placeholder:s,classNames:o,styles:a,unstyled:l,popoverProps:i,modalProps:u,dropdownType:f,children:h,formattedValue:y,dropdownHandlers:w,dropdownOpened:b,onClick:m,clearable:d,onClear:p,clearButtonProps:g,rightSection:D,shouldClear:L,readOnly:k,disabled:v,value:C,name:O,form:F,type:Y,...V}=_.useInputProps("PickerInputBase",ks,e),z=S.jsx(_.Input.ClearButton,{onClick:p,unstyled:l,...g}),P=()=>{Y==="range"&&Array.isArray(C)&&C[0]&&!C[1]&&p(),w.close()};return S.jsxs(S.Fragment,{children:[f==="modal"&&!k&&S.jsx(_.Modal,{opened:b,onClose:P,withCloseButton:!1,size:"auto","data-dates-modal":!0,unstyled:l,...u,children:h}),S.jsx(_.Input.Wrapper,{...n,children:S.jsxs(_.Popover,{position:"bottom-start",opened:b,trapFocus:!0,returnFocus:!1,unstyled:l,...i,disabled:(i==null?void 0:i.disabled)||f==="modal"||k,onChange:H=>{var I;H||((I=i==null?void 0:i.onClose)==null||I.call(i),P())},children:[S.jsx(_.Popover.Target,{children:S.jsx(_.Input,{"data-dates-input":!0,"data-read-only":k||void 0,disabled:v,component:"button",type:"button",multiline:!0,onClick:H=>{m==null||m(H),w.toggle()},__clearSection:z,__clearable:d&&L&&!k&&!v,rightSection:D,...r,ref:t,classNames:{...o,input:_r(Ar.input,o==null?void 0:o.input)},...V,children:y||S.jsx(_.Input.Placeholder,{error:r.error,unstyled:l,className:o==null?void 0:o.placeholder,style:a==null?void 0:a.placeholder,children:s})})}),S.jsx(_.Popover.Dropdown,{"data-dates-dropdown":!0,children:h})]})}),S.jsx(Ht,{value:C,name:O,form:F,type:Y})]})});wt.classes=Ar;wt.displayName="@mantine/dates/PickerInputBase";const hr=e=>e==="range"?[null,null]:e==="multiple"?[]:null;function Xe({type:e,value:t,defaultValue:r,onChange:n,applyTimezone:s=!0}){const o=x.useRef(e),a=xe(),[l,i,u]=vr({value:Te("add",t,a.getTimezone(),!s),defaultValue:Te("add",r,a.getTimezone(),!s),finalValue:hr(e),onChange:h=>{n==null||n(Te("remove",h,a.getTimezone(),!s))}});let f=l;if(o.current!==e){if(o.current=e,t===void 0)f=r!==void 0?r:hr(e),i(f);else if(process.env.NODE_ENV==="development")switch(e){case"default":t!==null&&typeof t!="string"&&console.error("[@mantine/dates/use-uncontrolled-dates] Value must be type of `null` or `string`");break;case"multiple":t instanceof Array||console.error("[@mantine/dates/use-uncontrolled-dates] Value must be type of `string[]`");break;case"range":(!(t instanceof Array)||t.length!==2)&&console.error("[@mantine/dates/use-uncontrolled-dates] Value must be type of `[string, string]`");break}}return[f,i,u]}function $t(e,t){return e?e==="month"?0:e==="year"?1:2:t||0}function Es(e){return e===0?"month":e===1?"year":"decade"}function Je(e,t,r){return Es(vn($t(e,0),$t(t,0),$t(r,2)))}const Ts={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0},Ie=_.factory((e,t)=>{const r=_.useProps("Calendar",Ts,e),{vars:n,maxLevel:s,minLevel:o,defaultLevel:a,level:l,onLevelChange:i,date:u,defaultDate:f,onDateChange:h,numberOfColumns:y,columnsToScroll:w,ariaLabels:b,nextLabel:m,previousLabel:d,onYearSelect:p,onMonthSelect:g,onYearMouseEnter:D,onMonthMouseEnter:L,__updateDateOnYearSelect:k,__updateDateOnMonthSelect:v,firstDayOfWeek:C,weekdayFormat:O,weekendDays:F,getDayProps:Y,excludeDate:V,renderDay:z,hideOutsideDates:P,hideWeekdays:H,getDayAriaLabel:I,monthLabelFormat:q,nextIcon:A,previousIcon:U,__onDayClick:E,__onDayMouseEnter:J,withCellSpacing:j,highlightToday:W,withWeekNumbers:re,monthsListFormat:te,getMonthControlProps:M,yearLabelFormat:G,yearsListFormat:X,getYearControlProps:ee,decadeLabelFormat:B,classNames:ie,styles:Z,unstyled:ue,minDate:N,maxDate:ne,locale:Q,__staticSelector:ce,size:Ce,__preventFocus:De,__stopPropagation:he,onNextDecade:Oe,onPreviousDecade:$e,onNextYear:oe,onPreviousYear:_e,onNextMonth:we,onPreviousMonth:je,static:Ae,__timezoneApplied:Ne,...Tt}=r,{resolvedClassNames:tt,resolvedStyles:rt}=_.useResolvedStylesApi({classNames:ie,styles:Z,props:r}),[He,Ve]=vr({value:l?Je(l,o,s):void 0,defaultValue:a?Je(a,o,s):void 0,finalValue:Je(void 0,o,s),onChange:i}),[jt,Ee]=Xe({type:"default",value:u,defaultValue:f,onChange:h,applyTimezone:!Ne}),Be={__staticSelector:ce||"Calendar",styles:rt,classNames:tt,unstyled:ue,size:Ce},Ot=xe(),Le=w||y||1,Pe=new Date,nt=N&&N>Pe?N:Pe,ge=jt||Te("add",nt,Ot.getTimezone()),Ue=()=>{const de=R(ge).add(Le,"month").toDate();we==null||we(de),Ee(de)},qe=()=>{const de=R(ge).subtract(Le,"month").toDate();je==null||je(de),Ee(de)},st=()=>{const de=R(ge).add(Le,"year").toDate();oe==null||oe(de),Ee(de)},Lt=()=>{const de=R(ge).subtract(Le,"year").toDate();_e==null||_e(de),Ee(de)},at=()=>{const de=R(ge).add(10*Le,"year").toDate();Oe==null||Oe(de),Ee(de)},Rt=()=>{const de=R(ge).subtract(10*Le,"year").toDate();$e==null||$e(de),Ee(de)};return S.jsxs(_.Box,{ref:t,size:Ce,"data-calendar":!0,...Tt,children:[He==="month"&&S.jsx(Ct,{month:ge,minDate:N,maxDate:ne,firstDayOfWeek:C,weekdayFormat:O,weekendDays:F,getDayProps:Y,excludeDate:V,renderDay:z,hideOutsideDates:P,hideWeekdays:H,getDayAriaLabel:I,onNext:Ue,onPrevious:qe,hasNextLevel:s!=="month",onLevelClick:()=>Ve("year"),numberOfColumns:y,locale:Q,levelControlAriaLabel:b==null?void 0:b.monthLevelControl,nextLabel:(b==null?void 0:b.nextMonth)??m,nextIcon:A,previousLabel:(b==null?void 0:b.previousMonth)??d,previousIcon:U,monthLabelFormat:q,__onDayClick:E,__onDayMouseEnter:J,__preventFocus:De,__stopPropagation:he,static:Ae,withCellSpacing:j,highlightToday:W,withWeekNumbers:re,...Be}),He==="year"&&S.jsx(xt,{year:ge,numberOfColumns:y,minDate:N,maxDate:ne,monthsListFormat:te,getMonthControlProps:M,locale:Q,onNext:st,onPrevious:Lt,hasNextLevel:s!=="month"&&s!=="year",onLevelClick:()=>Ve("decade"),levelControlAriaLabel:b==null?void 0:b.yearLevelControl,nextLabel:(b==null?void 0:b.nextYear)??m,nextIcon:A,previousLabel:(b==null?void 0:b.previousYear)??d,previousIcon:U,yearLabelFormat:G,__onControlMouseEnter:L,__onControlClick:(de,Re)=>{v&&Ee(Re),Ve(Je("month",o,s)),g==null||g(Re)},__preventFocus:De,__stopPropagation:he,withCellSpacing:j,...Be}),He==="decade"&&S.jsx(St,{decade:ge,minDate:N,maxDate:ne,yearsListFormat:X,getYearControlProps:ee,locale:Q,onNext:at,onPrevious:Rt,numberOfColumns:y,nextLabel:(b==null?void 0:b.nextDecade)??m,nextIcon:A,previousLabel:(b==null?void 0:b.previousDecade)??d,previousIcon:U,decadeLabelFormat:B,__onControlMouseEnter:D,__onControlClick:(de,Re)=>{k&&Ee(Re),Ve(Je("year",o,s)),p==null||p(Re)},__preventFocus:De,__stopPropagation:he,withCellSpacing:j,...Be})]})});Ie.classes={...St.classes,...xt.classes,...Ct.classes};Ie.displayName="@mantine/dates/Calendar";function Nr(e){const{maxLevel:t,minLevel:r,defaultLevel:n,level:s,onLevelChange:o,nextIcon:a,previousIcon:l,date:i,defaultDate:u,onDateChange:f,numberOfColumns:h,columnsToScroll:y,ariaLabels:w,nextLabel:b,previousLabel:m,onYearSelect:d,onMonthSelect:p,onYearMouseEnter:g,onMonthMouseEnter:D,onNextMonth:L,onPreviousMonth:k,onNextYear:v,onPreviousYear:C,onNextDecade:O,onPreviousDecade:F,withCellSpacing:Y,highlightToday:V,__updateDateOnYearSelect:z,__updateDateOnMonthSelect:P,withWeekNumbers:H,firstDayOfWeek:I,weekdayFormat:q,weekendDays:A,getDayProps:U,excludeDate:E,renderDay:J,hideOutsideDates:j,hideWeekdays:W,getDayAriaLabel:re,monthLabelFormat:te,monthsListFormat:M,getMonthControlProps:G,yearLabelFormat:X,yearsListFormat:ee,getYearControlProps:B,decadeLabelFormat:ie,allowSingleDateInRange:Z,allowDeselect:ue,minDate:N,maxDate:ne,locale:Q,...ce}=e;return{calendarProps:{maxLevel:t,minLevel:r,defaultLevel:n,level:s,onLevelChange:o,nextIcon:a,previousIcon:l,date:i,defaultDate:u,onDateChange:f,numberOfColumns:h,columnsToScroll:y,ariaLabels:w,nextLabel:b,previousLabel:m,onYearSelect:d,onMonthSelect:p,onYearMouseEnter:g,onMonthMouseEnter:D,onNextMonth:L,onPreviousMonth:k,onNextYear:v,onPreviousYear:C,onNextDecade:O,onPreviousDecade:F,withCellSpacing:Y,highlightToday:V,__updateDateOnYearSelect:z,__updateDateOnMonthSelect:P,withWeekNumbers:H,firstDayOfWeek:I,weekdayFormat:q,weekendDays:A,getDayProps:U,excludeDate:E,renderDay:J,hideOutsideDates:j,hideWeekdays:W,getDayAriaLabel:re,monthLabelFormat:te,monthsListFormat:M,getMonthControlProps:G,yearLabelFormat:X,yearsListFormat:ee,getYearControlProps:B,decadeLabelFormat:ie,allowSingleDateInRange:Z,allowDeselect:ue,minDate:N,maxDate:ne,locale:Q},others:ce}}function pr(e,t){const r=[...t].sort((n,s)=>n.getTime()-s.getTime());return R(r[0]).startOf("day").subtract(1,"ms").isBefore(e)&&R(r[1]).endOf("day").add(1,"ms").isAfter(e)}function js({type:e,level:t,value:r,defaultValue:n,onChange:s,allowSingleDateInRange:o,allowDeselect:a,onMouseLeave:l,applyTimezone:i=!0}){const[u,f]=Xe({type:e,value:r,defaultValue:n,onChange:s,applyTimezone:i}),[h,y]=x.useState(e==="range"&&u[0]&&!u[1]?u[0]:null),[w,b]=x.useState(null),m=v=>{if(e==="range"){if(h instanceof Date&&!u[1]){if(R(v).isSame(h,t)&&!o){y(null),b(null),f([null,null]);return}const C=[v,h];C.sort((O,F)=>O.getTime()-F.getTime()),f(C),b(null),y(null);return}if(u[0]&&!u[1]&&R(v).isSame(u[0],t)&&!o){y(null),b(null),f([null,null]);return}f([v,null]),b(null),y(v);return}if(e==="multiple"){u.some(C=>R(C).isSame(v,t))?f(u.filter(C=>!R(C).isSame(v,t))):f([...u,v]);return}u&&a&&R(v).isSame(u,t)?f(null):f(v)},d=v=>h instanceof Date&&w instanceof Date?pr(v,[w,h]):u[0]instanceof Date&&u[1]instanceof Date?pr(v,u):!1,p=e==="range"?v=>{l==null||l(v),b(null)}:l,g=v=>u[0]instanceof Date&&R(v).isSame(u[0],t)?!(w&&R(w).isBefore(u[0])):!1,D=v=>u[1]instanceof Date?R(v).isSame(u[1],t):!(u[0]instanceof Date)||!w?!1:R(w).isBefore(u[0])&&R(v).isSame(u[0],t),L=v=>{if(e==="range")return{selected:u.some(O=>O&&R(O).isSame(v,t)),inRange:d(v),firstInRange:g(v),lastInRange:D(v),"data-autofocus":!!u[0]&&R(u[0]).isSame(v,t)||void 0};if(e==="multiple")return{selected:u.some(O=>O&&R(O).isSame(v,t)),"data-autofocus":!!u[0]&&R(u[0]).isSame(v,t)||void 0};const C=R(u).isSame(v,t);return{selected:C,"data-autofocus":C||void 0}},k=e==="range"&&h?b:()=>{};return x.useEffect(()=>{if(e==="range")if(u[0]&&!u[1]&&(h==null?void 0:h.getTime())!==u[0].getTime())y(u[0]);else{const v=u[0]==null&&u[1]==null,C=u[0]!=null&&u[1]!=null;(v||C)&&(y(null),b(null))}},[u]),{onDateChange:m,onRootMouseLeave:p,onHoveredDateChange:k,getControlProps:L,_value:u,setValue:f}}const Os={type:"default",defaultLevel:"month",numberOfColumns:1},kt=_.factory((e,t)=>{const r=_.useProps("DatePicker",Os,e),{classNames:n,styles:s,vars:o,type:a,defaultValue:l,value:i,onChange:u,__staticSelector:f,getDayProps:h,allowSingleDateInRange:y,allowDeselect:w,onMouseLeave:b,numberOfColumns:m,hideOutsideDates:d,__onDayMouseEnter:p,__onDayClick:g,__timezoneApplied:D,...L}=r,{onDateChange:k,onRootMouseLeave:v,onHoveredDateChange:C,getControlProps:O}=js({type:a,level:"day",allowDeselect:w,allowSingleDateInRange:y,value:i,defaultValue:l,onChange:u,onMouseLeave:b,applyTimezone:!D}),{resolvedClassNames:F,resolvedStyles:Y}=_.useResolvedStylesApi({classNames:n,styles:s,props:r}),V=xe();return S.jsx(Ie,{ref:t,minLevel:"month",classNames:F,styles:Y,__staticSelector:f||"DatePicker",onMouseLeave:v,numberOfColumns:m,hideOutsideDates:d??m!==1,__onDayMouseEnter:(z,P)=>{C(P),p==null||p(z,P)},__onDayClick:(z,P)=>{k(P),g==null||g(z,P)},getDayProps:z=>({...O(z),...h==null?void 0:h(z)}),...L,date:Te("add",L.date,V.getTimezone(),D),__timezoneApplied:!0})});kt.classes=Ie.classes;kt.displayName="@mantine/dates/DatePicker";function Ls(e,t){if(e===null)return null;const r=Te("add",new Date(e),t);return Number.isNaN(r.getTime())||!e?null:r}function Rs({date:e,maxDate:t,minDate:r}){return!(e==null||Number.isNaN(e.getTime())||t&&R(e).isAfter(t,"date")||r&&R(e).isBefore(r,"date"))}const Fs={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,preserveTime:!0},qt=_.factory((e,t)=>{const r=_.useInputProps("DateInput",Fs,e),{inputProps:n,wrapperProps:s,value:o,defaultValue:a,onChange:l,clearable:i,clearButtonProps:u,popoverProps:f,getDayProps:h,locale:y,valueFormat:w,dateParser:b,minDate:m,maxDate:d,fixOnBlur:p,onFocus:g,onBlur:D,onClick:L,readOnly:k,name:v,form:C,rightSection:O,unstyled:F,classNames:Y,styles:V,allowDeselect:z,preserveTime:P,date:H,defaultDate:I,onDateChange:q,...A}=r,U=x.useRef(null),E=x.useRef(null),[J,j]=x.useState(!1),{calendarProps:W,others:re}=Nr(A),te=xe(),G=b||(oe=>{const _e=R(oe,w,te.getLocale(y)).toDate();return Number.isNaN(_e.getTime())?Ls(oe,te.getTimezone()):_e}),X=z!==void 0?z:i,ee=oe=>oe?R(oe).locale(te.getLocale(y)).format(w):"",[B,ie,Z]=Xe({type:"default",value:o,defaultValue:a,onChange:l}),[ue,N]=Xe({type:"default",value:H,defaultValue:a||I,onChange:q});x.useEffect(()=>{Z&&o!==null&&N(o)},[Z,o]);const[ne,Q]=x.useState(ee(B));x.useEffect(()=>{Q(ee(B))},[te.getLocale(y)]);const ce=oe=>{const _e=oe.currentTarget.value;if(Q(_e),j(!0),_e.trim()===""&&i)ie(null);else{const we=G(_e);Rs({date:we,minDate:m,maxDate:d})&&(ie(we),N(we))}},Ce=oe=>{D==null||D(oe),j(!1),p&&Q(ee(B))},De=oe=>{g==null||g(oe),j(!0)},he=oe=>{L==null||L(oe),j(!0)},Oe=oe=>({...h==null?void 0:h(oe),selected:R(B).isSame(oe,"day"),onClick:_e=>{var Ae,Ne;(Ne=h==null?void 0:(Ae=h(oe)).onClick)==null||Ne.call(Ae,_e);const we=P?Wt(B,oe):oe,je=i&&X&&R(B).isSame(oe,"day")?null:we;ie(je),!Z&&Q(ee(je)),j(!1)}}),$e=O||(i&&B&&!k?S.jsx(_.CloseButton,{variant:"transparent",onMouseDown:oe=>oe.preventDefault(),tabIndex:-1,onClick:()=>{ie(null),!Z&&Q(""),j(!1)},unstyled:F,size:n.size||"sm",...u}):null);return Pt(()=>{B!==void 0&&!J&&Q(ee(B))},[B]),_n(()=>j(!1),void 0,[U.current,E.current]),S.jsxs(S.Fragment,{children:[S.jsx(_.Input.Wrapper,{...s,__staticSelector:"DateInput",ref:U,children:S.jsxs(_.Popover,{opened:J,trapFocus:!1,position:"bottom-start",disabled:k,withRoles:!1,unstyled:F,...f,children:[S.jsx(_.Popover.Target,{children:S.jsx(_.Input,{"data-dates-input":!0,"data-read-only":k||void 0,autoComplete:"off",ref:t,value:ne,onChange:ce,onBlur:Ce,onFocus:De,onClick:he,readOnly:k,rightSection:$e,...n,...re,__staticSelector:"DateInput"})}),S.jsx(_.Popover.Dropdown,{onMouseDown:oe=>oe.preventDefault(),"data-dates-dropdown":!0,ref:E,children:S.jsx(Ie,{__staticSelector:"DateInput",__timezoneApplied:!0,...W,classNames:Y,styles:V,unstyled:F,__preventFocus:!0,minDate:m,maxDate:d,locale:y,getDayProps:Oe,size:n.size,date:ue,onDateChange:N})})]})}),S.jsx(Ht,{name:v,form:C,value:B,type:"default"})]})});qt.classes={..._.Input.classes,...Ie.classes};qt.displayName="@mantine/dates/DateInput";var Yr={timeWrapper:"m_208d2562",timeInput:"m_62ee059"};const Ms={dropdownType:"popover"},Gt=_.factory((e,t)=>{const r=_.useProps("DateTimePicker",Ms,e),{value:n,defaultValue:s,onChange:o,valueFormat:a,locale:l,classNames:i,styles:u,unstyled:f,timeInputProps:h,submitButtonProps:y,withSeconds:w,level:b,defaultLevel:m,size:d,variant:p,dropdownType:g,vars:D,minDate:L,maxDate:k,...v}=r,C=_.useStyles({name:"DateTimePicker",classes:Yr,props:r,classNames:i,styles:u,unstyled:f,vars:D}),{resolvedClassNames:O,resolvedStyles:F}=_.useResolvedStylesApi({classNames:i,styles:u,props:r}),Y=a||(w?"DD/MM/YYYY HH:mm:ss":"DD/MM/YYYY HH:mm"),V=x.useRef(null),z=xn(V,h==null?void 0:h.ref),{calendarProps:{allowSingleDateInRange:P,...H},others:I}=Nr(v),q=xe(),[A,U]=Xe({type:"default",value:n,defaultValue:s,onChange:o}),E=N=>N?R(N).format(w?"HH:mm:ss":"HH:mm"):"",[J,j]=x.useState(E(A)),[W,re]=x.useState(b||m||"month"),[te,M]=Cn(!1),G=A?R(A).locale(q.getLocale(l)).tz(q.getTimezone(),!0).format(Y):"",X=N=>{var Q;(Q=h==null?void 0:h.onChange)==null||Q.call(h,N);const ne=N.currentTarget.value;if(j(ne),ne){const[ce,Ce,De]=ne.split(":").map(Number),he=Te("add",new Date,q.getTimezone());he.setHours(ce),he.setMinutes(Ce),he.setSeconds(De||0),he.setMilliseconds(0),U(Wt(he,A||Te("add",new Date,q.getTimezone())))}},ee=N=>{var ne;N&&U(Wt(A,N)),(ne=V.current)==null||ne.focus()},B=N=>{var ne;(ne=h==null?void 0:h.onKeyDown)==null||ne.call(h,N),N.key==="Enter"&&(N.preventDefault(),M.close())};Pt(()=>{te||j(E(A))},[A,te]),Pt(()=>{te&&re("month")},[te]);const ie=L?R(L).format("HH:mm:ss"):null,Z=k?R(k).format("HH:mm:ss"):null,ue=g==="popover";return S.jsxs(wt,{formattedValue:G,dropdownOpened:v.disabled?!1:te,dropdownHandlers:M,classNames:O,styles:F,unstyled:f,ref:t,onClear:()=>U(null),shouldClear:!!A,value:A,size:d,variant:p,dropdownType:g,...I,type:"default",__staticSelector:"DateTimePicker",children:[S.jsx(kt,{...H,maxDate:k,minDate:L,size:d,variant:p,type:"default",value:A,defaultDate:A,onChange:ee,locale:l,classNames:O,styles:F,unstyled:f,__staticSelector:"DateTimePicker",__stopPropagation:ue,level:b,defaultLevel:m,onLevelChange:N=>{var ne;re(N),(ne=H.onLevelChange)==null||ne.call(H,N)},__timezoneApplied:!0}),W==="month"&&S.jsxs("div",{...C("timeWrapper"),children:[S.jsx(ht,{value:J,withSeconds:w,ref:z,unstyled:f,minTime:A&&L&&A.toDateString()===L.toDateString()?ie??void 0:void 0,maxTime:A&&k&&A.toDateString()===k.toDateString()?Z??void 0:void 0,...h,...C("timeInput",{className:h==null?void 0:h.className,style:h==null?void 0:h.style}),onChange:X,onKeyDown:B,size:d,"data-mantine-stop-propagation":ue||void 0}),S.jsx(_.ActionIcon,{variant:"default",size:`input-${d||"sm"}`,...C("submitButton",{className:y==null?void 0:y.className,style:y==null?void 0:y.style}),unstyled:f,"data-mantine-stop-propagation":ue||void 0,children:S.jsx(_.CheckIcon,{size:"30%"}),...y,onClick:N=>{var ne;(ne=y==null?void 0:y.onClick)==null||ne.call(y,N),M.close()}})]})]})});Gt.classes={...Yr,...wt.classes,...kt.classes};Gt.displayName="@mantine/dates/DateTimePicker";R.extend(gr);const $s=e=>{const{name:t,onChange:r,value:n,readOnly:s}=e;return S.jsx(qt,{name:t,onChange:o=>r(t,o),value:n,readOnly:s,valueFormat:"YYYY-MM-DD",clearable:!0})};R.extend(gr);const As=e=>{const{name:t,onChange:r,value:n,readOnly:s}=e;return S.jsx(Gt,{name:t,onChange:o=>r(t,o),value:n,readOnly:s,valueFormat:"YYYY-MM-DD HH:mm:ss",clearable:!0})},Ns=e=>{const{name:t,onChange:r,value:n,readOnly:s}=e;return S.jsx(_.NumberInput,{name:t,onChange:o=>r(t,o),value:n,readOnly:s})},Ys=e=>{const{fields:t,name:r,onChange:n,value:s,formValues:o,error:a={},readOnly:l}=e,i=(f,h)=>{n(`${r}.${f}`,h)};return t.map((f,h)=>S.jsx(Et,{field:f,formValues:o,onChange:i,value:s[f.name],error:a[f.name],readOnly:l},h))},Vs=e=>{const{data:t,name:r,onChange:n,value:s,readOnly:o}=e;return S.jsx(_.Select,{name:r,data:t,value:s,onChange:a=>n(r,a),readOnly:o,clearable:!0})},Ps=e=>{const{name:t,onChange:r,value:n,readOnly:s}=e;return S.jsx(_.Textarea,{name:t,onChange:o=>r(t,o.target.value),value:n,readOnly:s,styles:{input:{height:200}}})},Ws=e=>{const{name:t,onChange:r,value:n,readOnly:s}=e;return S.jsx(_.TextInput,{name:t,onChange:o=>r(t,o.target.value),value:n,readOnly:s})},zs=e=>{const{name:t,onChange:r,value:n,readOnly:s}=e,o=x.useRef(null),a=S.jsx(_.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>{var l;return(l=o.current)==null?void 0:l.showPicker()},children:"🕛"});return S.jsx(ht,{name:t,onChange:l=>r(t,l.target.value),value:n,readOnly:s,ref:o,rightSection:a,withSeconds:!0})};function Is(e,t,r){return{addElement:n=>{t(e,[...r,n])},replaceElement:(n,s)=>{const o=r.map((a,l)=>l===n?s:a);t(e,o)},removeElement:n=>{t(e,r.filter((s,o)=>o!==n))}}}const Et=({field:e,value:t,error:r,onChange:n,formValues:s,fieldContainer:o=i=>S.jsx(S.Fragment,{children:i}),customRender:a,readOnly:l})=>{const i=x.useMemo(()=>typeof e.visible=="function"?e.visible(s):e.visible!==!1,[e.visible,s]),u=x.useMemo(()=>typeof e.disabled=="function"?e.disabled(s):e.disabled===!0,[e.disabled,s]),f=x.useMemo(()=>{if(e.type==="array")return Is(e.name,n,t)},[e.type,e.name,n,t]),h=x.useMemo(()=>a==null?void 0:a(e,t,r,n,s,f,l||e.readOnly),[a,e,t,r,n,s,f,l,e.readOnly]);if(!i)return null;if(h)return h;const y=()=>{switch(e.type){case"text":return S.jsx(Ws,{name:e.name,value:t,onChange:n,readOnly:l});case"number":return S.jsx(Ns,{name:e.name,value:t,onChange:n,readOnly:l});case"object":return S.jsx(Ys,{name:e.name,onChange:n,value:t,fields:e.fields??[],formValues:s,error:r,readOnly:l});case"array":return S.jsx(wn,{name:e.name,onChange:n,value:t,fields:e.fields,options:f,error:r,readOnly:l});case"check":return S.jsx(kn,{name:e.name,value:t,onChange:n,readOnly:l,label:e.label});case"select":return S.jsx(Vs,{name:e.name,value:t,onChange:n,readOnly:l,data:e.data});case"textarea":return S.jsx(Ps,{name:e.name,value:t,onChange:n,readOnly:l});case"date":return S.jsx($s,{name:e.name,value:t,onChange:n,readOnly:l});case"datetime":return S.jsx(As,{name:e.name,value:t,onChange:n,readOnly:l});case"time":return S.jsx(zs,{name:e.name,value:t,onChange:n,readOnly:l});default:return null}},w=S.jsxs(_.Fieldset,{legend:e.type==="check"?void 0:e.label,variant:"unstyled",disabled:u||l,styles:{legend:{fontWeight:500}},children:[y(),!["object","array"].includes(e.type)&&typeof r=="string"&&S.jsx(_.Text,{c:"red",fz:"sm",fw:500,children:r})]});return o(w,e)},[Hs,Zs,Bs]=yn(),Us=e=>{switch(e){case"number":return 0;case"array":return[];case"check":return!1;case"object":return{};case"select":case"date":case"datetime":return null;default:return""}},Vr=e=>{const t={};for(const r of e)r.type==="object"&&r.fields?t[r.name]=Vr(r.fields):t[r.name]=r.initialValue??Us(r.type);return t},qs=e=>e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0,zt=(e,t,r="")=>{const n={};for(const s of e){const o=r?`${r}.${s.name}`:s.name,a=t==null?void 0:t[s.name];if(s.type==="object")Object.assign(n,zt(s.fields,a||{},o));else if(s.type==="array"){if(s.required&&(!Array.isArray(a)||a.length===0)){n[o]=s.name+" is required";continue}Array.isArray(a)&&a.forEach((l,i)=>{Object.assign(n,zt(s.fields,l,`${o}.${i}`))})}else s.required&&qs(a)&&(n[o]=s.name+" is required")}return n};function Gs(e){const t={};return Object.entries(e).forEach(([r,n])=>{const s=r.split(".");let o=t;s.forEach((a,l)=>{const i=l===s.length-1;s[l+1],i?o[a]=n:(a in o||(o[a]={}),o=o[a])})}),t}const Ks=({onSubmit:e,schema:t,container:r,fieldContainer:n,customRender:s,validate:o,readOnly:a,values:l,onFieldChange:i})=>{const u=Bs({mode:"uncontrolled",initialValues:Vr(t),validate:o}),f=x.useMemo(()=>u.getValues(),[u.getValues()]),h=Dn(async(m,d)=>{if(u.setFieldValue(m,d),i){const p=f[m];f[m]=d;const g=i(m,p,d,f),D=g instanceof Promise?await g:g;u.setValues(D)}},0),y=x.useCallback((m,d)=>{const p=u.errors;return m==="object"||m==="array"?Gs(p)[d]:p[d]},[u.errors]),w=x.useCallback(()=>{const m=u.getValues(),d=zt(t,m);if(Object.keys(d).length>0){u.setErrors(d);return}u.onSubmit(e)()},[u,e,t]);x.useEffect(()=>{l&&u.initialize(l)},[l]);const b=S.jsx(Hs,{form:u,children:t.map((m,d)=>S.jsx(Et,{field:m,formValues:f,value:f[m.name],error:y(m.type,m.name),onChange:h,fieldContainer:n,customRender:s,readOnly:m.readOnly||a},d))});return r(b,w,a)};exports.AutoForm=Ks;exports.FieldRender=Et;
|
|
30
|
+
<%s key={someKey} {...props} />`,Wo,gn,ch,gn),na[gn+Wo]=!0}}return x===r?sh(Ie):rh(Ie),Ie}}function oh(x,N,F){return ra(x,N,F,!0)}function ih(x,N,F){return ra(x,N,F,!1)}var lh=ih,ah=oh;lr.Fragment=r,lr.jsx=lh,lr.jsxs=ah}()),lr}var ia;function ph(){return ia||(ia=1,process.env.NODE_ENV==="production"?Jr.exports=fh():Jr.exports=hh()),Jr.exports}var m=ph();function mh(n){if(!/^[0-9a-zA-Z-]+$/.test(n))throw new Error(`[@mantine/use-form] Form name "${n}" is invalid, it should contain only letters, numbers and dashes`)}const gh=typeof window<"u"?T.useLayoutEffect:T.useEffect;function $e(n,e){gh(()=>{if(n)return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[n])}function yh(n,e){n&&mh(n),$e(`mantine-form:${n}:set-field-value`,t=>e.setFieldValue(t.detail.path,t.detail.value)),$e(`mantine-form:${n}:set-values`,t=>e.setValues(t.detail)),$e(`mantine-form:${n}:set-initial-values`,t=>e.setInitialValues(t.detail)),$e(`mantine-form:${n}:set-errors`,t=>e.setErrors(t.detail)),$e(`mantine-form:${n}:set-field-error`,t=>e.setFieldError(t.detail.path,t.detail.error)),$e(`mantine-form:${n}:clear-field-error`,t=>e.clearFieldError(t.detail)),$e(`mantine-form:${n}:clear-errors`,e.clearErrors),$e(`mantine-form:${n}:reset`,e.reset),$e(`mantine-form:${n}:validate`,e.validate),$e(`mantine-form:${n}:validate-field`,t=>e.validateField(t.detail)),$e(`mantine-form:${n}:reorder-list-item`,t=>e.reorderListItem(t.detail.path,t.detail.payload)),$e(`mantine-form:${n}:remove-list-item`,t=>e.removeListItem(t.detail.path,t.detail.index)),$e(`mantine-form:${n}:insert-list-item`,t=>e.insertListItem(t.detail.path,t.detail.item,t.detail.index)),$e(`mantine-form:${n}:set-dirty`,t=>e.setDirty(t.detail)),$e(`mantine-form:${n}:set-touched`,t=>e.setTouched(t.detail)),$e(`mantine-form:${n}:reset-dirty`,t=>e.resetDirty(t.detail)),$e(`mantine-form:${n}:reset-touched`,e.resetTouched)}function bh(n){return e=>{if(!e)n(e);else if(typeof e=="function")n(e);else if(typeof e=="object"&&"nativeEvent"in e){const{currentTarget:t}=e;t instanceof HTMLInputElement?t.type==="checkbox"?n(t.checked):n(t.value):(t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&n(t.value)}else n(e)}}function wi(n){return n===null||typeof n!="object"?{}:Object.keys(n).reduce((e,t)=>{const r=n[t];return r!=null&&r!==!1&&(e[t]=r),e},{})}function xh(n){const[e,t]=T.useState(wi(n)),r=T.useRef(e),s=T.useCallback(a=>{t(c=>{const u=wi(typeof a=="function"?a(c):a);return r.current=u,u})},[]),o=T.useCallback(()=>s({}),[]),i=T.useCallback(a=>{r.current[a]!==void 0&&s(c=>{const u={...c};return delete u[a],u})},[e]),l=T.useCallback((a,c)=>{c==null||c===!1?i(a):r.current[a]!==c&&s(u=>({...u,[a]:c}))},[e]);return{errorsState:e,setErrors:s,clearErrors:o,setFieldError:l,clearFieldError:i}}function Ei(n,e){if(e===null||typeof e!="object")return{};const t={...e};return Object.keys(e).forEach(r=>{r.includes(`${String(n)}.`)&&delete t[r]}),t}function la(n,e){const t=n.substring(e.length+1).split(".")[0];return parseInt(t,10)}function aa(n,e,t,r){if(e===void 0)return t;const s=`${String(n)}`;let o=t;r===-1&&(o=Ei(`${s}.${e}`,o));const i={...o},l=new Set;return Object.entries(o).filter(([a])=>{if(!a.startsWith(`${s}.`))return!1;const c=la(a,s);return Number.isNaN(c)?!1:c>=e}).forEach(([a,c])=>{const u=la(a,s),d=a.replace(`${s}.${u}`,`${s}.${u+r}`);i[d]=c,l.add(d),l.has(a)||delete i[a]}),i}function kh(n,{from:e,to:t},r){const s=`${n}.${e}`,o=`${n}.${t}`,i={...r};return Object.keys(r).every(l=>{let a,c;if(l.startsWith(s)&&(a=l,c=l.replace(s,o)),l.startsWith(o)&&(a=l.replace(o,s),c=l),a&&c){const u=i[a],d=i[c];return d===void 0?delete i[a]:i[a]=d,u===void 0?delete i[c]:i[c]=u,!1}return!0}),i}function ca(n,e,t){typeof t.value=="object"&&(t.value=Wn(t.value)),!t.enumerable||t.get||t.set||!t.configurable||!t.writable||e==="__proto__"?Object.defineProperty(n,e,t):n[e]=t.value}function Wn(n){if(typeof n!="object")return n;var e=0,t,r,s,o=Object.prototype.toString.call(n);if(o==="[object Object]"?s=Object.create(n.__proto__||null):o==="[object Array]"?s=Array(n.length):o==="[object Set]"?(s=new Set,n.forEach(function(i){s.add(Wn(i))})):o==="[object Map]"?(s=new Map,n.forEach(function(i,l){s.set(Wn(l),Wn(i))})):o==="[object Date]"?s=new Date(+n):o==="[object RegExp]"?s=new RegExp(n.source,n.flags):o==="[object DataView]"?s=new n.constructor(Wn(n.buffer)):o==="[object ArrayBuffer]"?s=n.slice(0):o.slice(-6)==="Array]"&&(s=new n.constructor(n)),s){for(r=Object.getOwnPropertySymbols(n);e<r.length;e++)ca(s,r[e],Object.getOwnPropertyDescriptor(n,r[e]));for(e=0,r=Object.getOwnPropertyNames(n);e<r.length;e++)Object.hasOwnProperty.call(s,t=r[e])&&s[t]===n[t]||ca(s,t,Object.getOwnPropertyDescriptor(n,t))}return s||n}function Zc(n){return typeof n!="string"?[]:n.split(".")}function Ue(n,e){const t=Zc(n);if(t.length===0||typeof e!="object"||e===null)return;let r=e[t[0]];for(let s=1;s<t.length&&r!=null;s+=1)r=r[t[s]];return r}function zr(n,e,t){const r=Zc(n);if(r.length===0)return t;const s=Wn(t);if(r.length===1)return s[r[0]]=e,s;let o=s[r[0]];for(let i=1;i<r.length-1;i+=1){if(o===void 0)return s;o=o[r[i]]}return o[r[r.length-1]]=e,s}function vh(n,{from:e,to:t},r){const s=Ue(n,r);if(!Array.isArray(s))return r;const o=[...s],i=s[e];return o.splice(e,1),o.splice(t,0,i),zr(n,o,r)}function Sh(n,e,t,r){const s=Ue(n,r);if(!Array.isArray(s))return r;const o=[...s];return o.splice(typeof t=="number"?t:o.length,0,e),zr(n,o,r)}function Ch(n,e,t){const r=Ue(n,t);return Array.isArray(r)?zr(n,r.filter((s,o)=>o!==e),t):t}function Mh(n,e,t,r){const s=Ue(n,r);if(!Array.isArray(s)||s.length<=t)return r;const o=[...s];return o[t]=e,zr(n,o,r)}function wh({$values:n,$errors:e,$status:t}){const r=T.useCallback((l,a)=>{t.clearFieldDirty(l),e.setErrors(c=>kh(l,a,c)),n.setValues({values:vh(l,a,n.refValues.current),updateState:!0})},[]),s=T.useCallback((l,a)=>{t.clearFieldDirty(l),e.setErrors(c=>aa(l,a,c,-1)),n.setValues({values:Ch(l,a,n.refValues.current),updateState:!0})},[]),o=T.useCallback((l,a,c)=>{t.clearFieldDirty(l),e.setErrors(u=>aa(l,c,u,1)),n.setValues({values:Sh(l,a,c,n.refValues.current),updateState:!0})},[]),i=T.useCallback((l,a,c)=>{t.clearFieldDirty(l),n.setValues({values:Mh(l,c,a,n.refValues.current),updateState:!0})},[]);return{reorderListItem:r,removeListItem:s,insertListItem:o,replaceListItem:i}}var Uo,ua;function Eh(){return ua||(ua=1,Uo=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,s,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(s=r;s--!==0;)if(!n(e[s],t[s]))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(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!n(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}),Uo}var Th=Eh();const Gr=Br(Th);function ar(n,e){const t=Object.keys(n);if(typeof e=="string"){const r=t.filter(s=>s.startsWith(`${e}.`));return n[e]||r.some(s=>n[s])||!1}return t.some(r=>n[r])}function Oh({initialDirty:n,initialTouched:e,mode:t,$values:r}){const[s,o]=T.useState(e),[i,l]=T.useState(n),a=T.useRef(e),c=T.useRef(n),u=T.useCallback(S=>{const M=typeof S=="function"?S(a.current):S;a.current=M,t==="controlled"&&o(M)},[]),d=T.useCallback((S,M=!1)=>{const O=typeof S=="function"?S(c.current):S;c.current=O,(t==="controlled"||M)&&l(O)},[]),f=T.useCallback(()=>u({}),[]),h=T.useCallback(S=>{const M=S?{...r.refValues.current,...S}:r.refValues.current;r.setValuesSnapshot(M),d({})},[]),p=T.useCallback((S,M)=>{u(O=>ar(O,S)===M?O:{...O,[S]:M})},[]),g=T.useCallback((S,M,O)=>{d(A=>ar(A,S)===M?A:{...A,[S]:M},O)},[]),y=T.useCallback((S,M)=>{const O=ar(c.current,S),A=!Gr(Ue(S,r.getValuesSnapshot()),M),$=Ei(S,c.current);$[S]=A,d($,O!==A)},[]),b=T.useCallback(S=>ar(a.current,S),[]),k=T.useCallback(S=>d(M=>{if(typeof S!="string")return M;const O=Ei(S,M);return delete O[S],Gr(O,M)?M:O}),[]),C=T.useCallback(S=>{if(S){const O=Ue(S,c.current);if(typeof O=="boolean")return O;const A=Ue(S,r.refValues.current),$=Ue(S,r.valuesSnapshot.current);return!Gr(A,$)}return Object.keys(c.current).length>0?ar(c.current):!Gr(r.refValues.current,r.valuesSnapshot.current)},[]),E=T.useCallback(()=>c.current,[]),w=T.useCallback(()=>a.current,[]);return{touchedState:s,dirtyState:i,touchedRef:a,dirtyRef:c,setTouched:u,setDirty:d,resetDirty:h,resetTouched:f,isTouched:b,setFieldTouched:p,setFieldDirty:g,setTouchedState:o,setDirtyState:l,clearFieldDirty:k,isDirty:C,getDirty:E,getTouched:w,setCalculatedFieldDirty:y}}function Dh({initialValues:n,onValuesChange:e,mode:t}){const r=T.useRef(!1),[s,o]=T.useState(n||{}),i=T.useRef(s),l=T.useRef(s),a=T.useCallback(({values:g,subscribers:y,updateState:b=!0,mergeWithPreviousValues:k=!0})=>{const C=i.current,E=g instanceof Function?g(i.current):g,w=k?{...C,...E}:E;i.current=w,b&&o(w),e==null||e(w,C),y==null||y.filter(Boolean).forEach(S=>S({updatedValues:w,previousValues:C}))},[e]),c=T.useCallback(g=>{var k;const y=Ue(g.path,i.current),b=g.value instanceof Function?g.value(y):g.value;if(y!==b){const C=i.current,E=zr(g.path,b,i.current);a({values:E,updateState:g.updateState}),(k=g.subscribers)==null||k.filter(Boolean).forEach(w=>w({path:g.path,updatedValues:E,previousValues:C}))}},[a]),u=T.useCallback(g=>{l.current=g},[]),d=T.useCallback((g,y)=>{r.current||(r.current=!0,a({values:g,updateState:t==="controlled"}),u(g),y())},[a]),f=T.useCallback(()=>{a({values:l.current,updateState:!0,mergeWithPreviousValues:!1})},[a]),h=T.useCallback(()=>i.current,[]),p=T.useCallback(()=>l.current,[]);return{initialized:r,stateValues:s,refValues:i,valuesSnapshot:l,setValues:a,setFieldValue:c,resetValues:f,setValuesSnapshot:u,initialize:d,getValues:h,getValuesSnapshot:p}}function Ah({$status:n}){const e=T.useRef({}),t=T.useCallback((s,o)=>{T.useEffect(()=>(e.current[s]=e.current[s]||[],e.current[s].push(o),()=>{e.current[s]=e.current[s].filter(i=>i!==o)}),[o])},[]),r=T.useCallback(s=>e.current[s]?e.current[s].map(o=>i=>o({previousValue:Ue(s,i.previousValues),value:Ue(s,i.updatedValues),touched:n.isTouched(s),dirty:n.isDirty(s)})):[],[]);return{subscribers:e,watch:t,getFieldSubscribers:r}}function da(n,e){return n?`${n}-${e.toString()}`:e.toString()}const Xr=Symbol("root-rule");function fa(n){const e=wi(n);return{hasErrors:Object.keys(e).length>0,errors:e}}function Ti(n,e,t="",r={}){return typeof n!="object"||n===null?r:Object.keys(n).reduce((s,o)=>{const i=n[o],l=`${t===""?"":`${t}.`}${o}`,a=Ue(l,e);let c=!1;return typeof i=="function"&&(s[l]=i(a,e,l)),typeof i=="object"&&Array.isArray(a)&&(c=!0,a.forEach((u,d)=>Ti(i,e,`${l}.${d}`,s)),Xr in i&&(s[l]=i[Xr](a,e,l))),typeof i=="object"&&typeof a=="object"&&a!==null&&(c||Ti(i,e,l,s),Xr in i&&(s[l]=i[Xr](a,e,l))),s},r)}function Oi(n,e){return fa(typeof n=="function"?n(e):Ti(n,e))}function Qr(n,e,t){if(typeof n!="string")return{hasError:!1,error:null};const r=Oi(e,t),s=Object.keys(r.errors).find(o=>n.split(".").every((i,l)=>i===o.split(".")[l]));return{hasError:!!s,error:s?r.errors[s]:null}}const Nh="__MANTINE_FORM_INDEX__";function ha(n,e){return e?typeof e=="boolean"?e:Array.isArray(e)?e.includes(n.replace(/[.][0-9]+/g,`.${Nh}`)):!1:!1}function Rh({name:n,mode:e="controlled",initialValues:t,initialErrors:r={},initialDirty:s={},initialTouched:o={},clearInputErrorOnChange:i=!0,validateInputOnChange:l=!1,validateInputOnBlur:a=!1,onValuesChange:c,transformValues:u=g=>g,enhanceGetInputProps:d,validate:f,onSubmitPreventDefault:h="always",touchTrigger:p="change"}={}){const g=xh(r),y=Dh({initialValues:t,onValuesChange:c,mode:e}),b=Oh({initialDirty:s,initialTouched:o,$values:y,mode:e}),k=wh({$values:y,$errors:g,$status:b}),C=Ah({$status:b}),[E,w]=T.useState(0),[S,M]=T.useState({}),[O,A]=T.useState(!1),$=T.useCallback(()=>{y.resetValues(),g.clearErrors(),b.resetDirty(),b.resetTouched(),e==="uncontrolled"&&w(P=>P+1)},[]),W=T.useCallback(P=>{i&&g.clearErrors(),e==="uncontrolled"&&w(te=>te+1),Object.keys(C.subscribers.current).forEach(te=>{const se=Ue(te,y.refValues.current),ae=Ue(te,P);se!==ae&&C.getFieldSubscribers(te).forEach(X=>X({previousValues:P,updatedValues:y.refValues.current}))})},[i]),U=T.useCallback(P=>{const te=y.refValues.current;y.initialize(P,()=>e==="uncontrolled"&&w(se=>se+1)),W(te)},[W]),_=T.useCallback((P,te,se)=>{const ae=ha(P,l),X=te instanceof Function?te(Ue(P,y.refValues.current)):te;b.setCalculatedFieldDirty(P,X),p==="change"&&b.setFieldTouched(P,!0),!ae&&i&&g.clearFieldError(P),y.setFieldValue({path:P,value:te,updateState:e==="controlled",subscribers:[...C.getFieldSubscribers(P),ae?ke=>{const re=Qr(P,f,ke.updatedValues);re.hasError?g.setFieldError(P,re.error):g.clearFieldError(P)}:null,(se==null?void 0:se.forceUpdate)!==!1&&e!=="controlled"?()=>M(ke=>({...ke,[P]:(ke[P]||0)+1})):null]})},[c,f]),J=T.useCallback(P=>{const te=y.refValues.current;y.setValues({values:P,updateState:e==="controlled"}),W(te)},[c,W]),G=T.useCallback(()=>{const P=Oi(f,y.refValues.current);return g.setErrors(P.errors),P},[f]),Q=T.useCallback(P=>{const te=Qr(P,f,y.refValues.current);return te.hasError?g.setFieldError(P,te.error):g.clearFieldError(P),te},[f]),V=(P,{type:te="input",withError:se=!0,withFocus:ae=!0,...X}={})=>{const re={onChange:bh(we=>_(P,we,{forceUpdate:!1})),"data-path":da(n,P)};return se&&(re.error=g.errorsState[P]),te==="checkbox"?re[e==="controlled"?"checked":"defaultChecked"]=Ue(P,y.refValues.current):re[e==="controlled"?"value":"defaultValue"]=Ue(P,y.refValues.current),ae&&(re.onFocus=()=>b.setFieldTouched(P,!0),re.onBlur=()=>{if(ha(P,a)){const we=Qr(P,f,y.refValues.current);we.hasError?g.setFieldError(P,we.error):g.clearFieldError(P)}}),Object.assign(re,d==null?void 0:d({inputProps:re,field:P,options:{type:te,withError:se,withFocus:ae,...X},form:ce}))},ne=(P,te)=>se=>{h==="always"&&(se==null||se.preventDefault());const ae=G();if(ae.hasErrors)h==="validation-failed"&&(se==null||se.preventDefault()),te==null||te(ae.errors,y.refValues.current,se);else{const X=P==null?void 0:P(u(y.refValues.current),se);X instanceof Promise&&(A(!0),X.finally(()=>A(!1)))}},L=P=>u(P||y.refValues.current),le=T.useCallback(P=>{P.preventDefault(),$()},[]),j=T.useCallback(P=>P?!Qr(P,f,y.refValues.current).hasError:!Oi(f,y.refValues.current).hasErrors,[f]),q=P=>`${E}-${P}-${S[P]||0}`,pe=T.useCallback(P=>document.querySelector(`[data-path="${da(n,P)}"]`),[]),ce={watch:C.watch,initialized:y.initialized.current,values:y.stateValues,getValues:y.getValues,getInitialValues:y.getValuesSnapshot,setInitialValues:y.setValuesSnapshot,initialize:U,setValues:J,setFieldValue:_,submitting:O,setSubmitting:A,errors:g.errorsState,setErrors:g.setErrors,setFieldError:g.setFieldError,clearFieldError:g.clearFieldError,clearErrors:g.clearErrors,resetDirty:b.resetDirty,setTouched:b.setTouched,setDirty:b.setDirty,isTouched:b.isTouched,resetTouched:b.resetTouched,isDirty:b.isDirty,getTouched:b.getTouched,getDirty:b.getDirty,reorderListItem:k.reorderListItem,insertListItem:k.insertListItem,removeListItem:k.removeListItem,replaceListItem:k.replaceListItem,reset:$,validate:G,validateField:Q,getInputProps:V,onSubmit:ne,onReset:le,isValid:j,getTransformedValues:L,key:q,getInputNode:pe};return yh(n,ce),ce}const Lh=n=>{switch(n){case"number":return 0;case"array":return[];case"checkbox":return!1;case"object":return{};case"select":case"date":case"datetime":return null;default:return""}};function il(n){const e={};for(const t of n)t.type==="object"&&t.fields?e[t.name]=il(t.fields):e[t.name]=t.initialValue??Lh(t.type);return e}const eu={vertical:n=>m.jsx(v.Stack,{gap:"md",children:n}),horizontal:n=>m.jsx(v.Group,{wrap:"wrap",gap:"md",children:n}),grid:n=>m.jsx(v.Grid,{gutter:"md",children:n})};function Ih({field:n,form:e,layout:t}){const r=n,s=e.getInputProps(r.name),o=s.value??[],i=r.readOnly===!0,l=r.disabled===!0;function a(){s.onFieldChange([...o,il(r.fields)])}function c(u){s.onFieldChange(o.filter((d,f)=>f!==u))}return m.jsxs(v.Stack,{gap:"md",children:[o.map((u,d)=>{var f;return m.jsxs(v.Paper,{withBorder:!0,radius:"md",p:"md",shadow:"xs",children:[eu[t]((f=r.fields)==null?void 0:f.map(h=>m.jsx(ta,{field:{...h,name:`${n.name}.${d}.${h.name}`,disabled:l||h.disabled,readOnly:i||h.readOnly},form:e,layout:t},`${n.name}.${d}.${h.name}`))),!i&&!l&&m.jsx(v.Group,{justify:"flex-end",mt:"xs",children:m.jsx(v.Button,{color:"red",variant:"light",onClick:()=>c(d),children:"Remove"})})]},`${r.name}.${d}`)}),!i&&!l&&m.jsxs(m.Fragment,{children:[o.length>0&&m.jsx(v.Divider,{my:"sm"}),m.jsx(v.Button,{onClick:a,variant:"default",children:"Add Row"})]})]})}function jh({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.Checkbox,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0,checked:t.value}):m.jsx(v.Checkbox,{...t,checked:t.value,onChange:o=>t.onFieldChange(o.target.value),required:n.required,placeholder:n.placeholder,error:void 0})}function Ph({direction:n,levelIndex:e,rowIndex:t,cellIndex:r,size:s}){switch(n){case"up":return e===0&&t===0?null:t===0?{levelIndex:e-1,rowIndex:r<=s[e-1][s[e-1].length-1]-1?s[e-1].length-1:s[e-1].length-2,cellIndex:r}:{levelIndex:e,rowIndex:t-1,cellIndex:r};case"down":return t===s[e].length-1?{levelIndex:e+1,rowIndex:0,cellIndex:r}:t===s[e].length-2&&r>=s[e][s[e].length-1]?{levelIndex:e+1,rowIndex:0,cellIndex:r}:{levelIndex:e,rowIndex:t+1,cellIndex:r};case"left":return e===0&&t===0&&r===0?null:t===0&&r===0?{levelIndex:e-1,rowIndex:s[e-1].length-1,cellIndex:s[e-1][s[e-1].length-1]-1}:r===0?{levelIndex:e,rowIndex:t-1,cellIndex:s[e][t-1]-1}:{levelIndex:e,rowIndex:t,cellIndex:r-1};case"right":return t===s[e].length-1&&r===s[e][t]-1?{levelIndex:e+1,rowIndex:0,cellIndex:0}:r===s[e][t]-1?{levelIndex:e,rowIndex:t+1,cellIndex:0}:{levelIndex:e,rowIndex:t,cellIndex:r+1};default:return{levelIndex:e,rowIndex:t,cellIndex:r}}}function tu({controlsRef:n,direction:e,levelIndex:t,rowIndex:r,cellIndex:s,size:o}){var a,c,u;const i=Ph({direction:e,size:o,rowIndex:r,cellIndex:s,levelIndex:t});if(!i)return;const l=(u=(c=(a=n.current)==null?void 0:a[i.levelIndex])==null?void 0:c[i.rowIndex])==null?void 0:u[i.cellIndex];l&&(l.disabled||l.getAttribute("data-hidden")||l.getAttribute("data-outside")?tu({controlsRef:n,direction:e,levelIndex:i.levelIndex,cellIndex:i.cellIndex,rowIndex:i.rowIndex,size:o}):l.focus())}function _h(n){switch(n){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function Bh(n){var e;return(e=n.current)==null?void 0:e.map(t=>t.map(r=>r.length))}function ll({controlsRef:n,levelIndex:e,rowIndex:t,cellIndex:r,event:s}){const o=_h(s.key);if(o){s.preventDefault();const i=Bh(n);tu({controlsRef:n,direction:o,levelIndex:e,rowIndex:t,cellIndex:r,size:i})}}function Di(n,e){if(!n||!e)return e;const t=n.getHours(),r=n.getMinutes(),s=n.getSeconds(),o=n.getMilliseconds(),i=new Date(e);return i.setHours(t),i.setMinutes(r),i.setSeconds(s),i.setMilliseconds(o),i}var fs={exports:{}},zh=fs.exports,pa;function Fh(){return pa||(pa=1,function(n,e){(function(t,r){n.exports=r()})(zh,function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(s,o,i){var l,a=function(f,h,p){p===void 0&&(p={});var g=new Date(f),y=function(b,k){k===void 0&&(k={});var C=k.timeZoneName||"short",E=b+"|"+C,w=r[E];return w||(w=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:C}),r[E]=w),w}(h,p);return y.formatToParts(g)},c=function(f,h){for(var p=a(f,h),g=[],y=0;y<p.length;y+=1){var b=p[y],k=b.type,C=b.value,E=t[k];E>=0&&(g[E]=parseInt(C,10))}var w=g[3],S=w===24?0:w,M=g[0]+"-"+g[1]+"-"+g[2]+" "+S+":"+g[4]+":"+g[5]+":000",O=+f;return(i.utc(M).valueOf()-(O-=O%1e3))/6e4},u=o.prototype;u.tz=function(f,h){f===void 0&&(f=l);var p,g=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:f}),k=Math.round((y-new Date(b))/1e3/60),C=15*-Math.round(y.getTimezoneOffset()/15)-k;if(!Number(C))p=this.utcOffset(0,h);else if(p=i(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(C,!0),h){var E=p.utcOffset();p=p.add(g-E,"minute")}return p.$x.$timezone=f,p},u.offsetName=function(f){var h=this.$x.$timezone||i.tz.guess(),p=a(this.valueOf(),h,{timeZoneName:f}).find(function(g){return g.type.toLowerCase()==="timezonename"});return p&&p.value};var d=u.startOf;u.startOf=function(f,h){if(!this.$x||!this.$x.$timezone)return d.call(this,f,h);var p=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return d.call(p,f,h).tz(this.$x.$timezone,!0)},i.tz=function(f,h,p){var g=p&&h,y=p||h||l,b=c(+i(),y);if(typeof f!="string")return i(f).tz(y);var k=function(S,M,O){var A=S-60*M*1e3,$=c(A,O);if(M===$)return[A,M];var W=c(A-=60*($-M)*1e3,O);return $===W?[A,$]:[S-60*Math.min($,W)*1e3,Math.max($,W)]}(i.utc(f,g).valueOf(),b,y),C=k[0],E=k[1],w=i(C).utcOffset(E);return w.$x.$timezone=y,w},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(f){l=f}}})}(fs)),fs.exports}var $h=Fh();const Vh=Br($h);var hs={exports:{}},Hh=hs.exports,ma;function Wh(){return ma||(ma=1,function(n,e){(function(t,r){n.exports=r()})(Hh,function(){var t="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(o,i,l){var a=i.prototype;l.utc=function(g){var y={date:g,utc:!0,args:arguments};return new i(y)},a.utc=function(g){var y=l(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),t):y},a.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var c=a.parse;a.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),c.call(this,g)};var u=a.init;a.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else u.call(this)};var d=a.utcOffset;a.utcOffset=function(g,y){var b=this.$utils().u;if(b(g))return this.$u?0:b(this.$offset)?d.call(this):this.$offset;if(typeof g=="string"&&(g=function(w){w===void 0&&(w="");var S=w.match(r);if(!S)return null;var M=(""+S[0]).match(s)||["-",0,0],O=M[0],A=60*+M[1]+ +M[2];return A===0?0:O==="+"?A:-A}(g),g===null))return this;var k=Math.abs(g)<=16?60*g:g,C=this;if(y)return C.$offset=k,C.$u=g===0,C;if(g!==0){var E=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(C=this.local().add(k+E,t)).$offset=k,C.$x.$localOffset=E}else C=this.utc();return C};var f=a.format;a.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return f.call(this,y)},a.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var h=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var p=a.diff;a.diff=function(g,y,b){if(g&&this.$u===g.$u)return p.call(this,g,y,b);var k=this.local(),C=l(g).local();return p.call(k,C,y,b)}}})}(hs)),hs.exports}var Uh=Wh();const qh=Br(Uh);I.extend(qh);I.extend(Vh);function Kh(n,e){return e?I(n).tz(e).utcOffset()+n.getTimezoneOffset():0}const ga=(n,e,t)=>{if(!n)return null;if(!e)return n;let r=Kh(n,e);return t==="remove"&&(r*=-1),I(n).add(r,"minutes").toDate()};function Et(n,e,t,r){return r||!e?e:Array.isArray(e)?e.map(s=>ga(s,t,n)):ga(e,t,n)}const Yh={locale:"en",timezone:null,firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:"–",consistentWeeks:!1},Jh=T.createContext(Yh);function it(){const n=T.useContext(Jh),e=T.useCallback(i=>i||n.locale,[n.locale]),t=T.useCallback(i=>i||n.timezone||void 0,[n.timezone]),r=T.useCallback(i=>typeof i=="number"?i:n.firstDayOfWeek,[n.firstDayOfWeek]),s=T.useCallback(i=>Array.isArray(i)?i:n.weekendDays,[n.weekendDays]),o=T.useCallback(i=>typeof i=="string"?i:n.labelSeparator,[n.labelSeparator]);return{...n,getLocale:e,getTimezone:t,getFirstDayOfWeek:r,getWeekendDays:s,getLabelSeparator:o}}function Gh(n,e){const t=it(),r=s=>Et("remove",s,t.getTimezone()).toISOString();if(e==="range"&&Array.isArray(n)){const[s,o]=n;return s?o?`${r(s)} – ${r(o)}`:`${r(s)} –`:""}return e==="multiple"&&Array.isArray(n)?n.map(s=>s&&r(s)).filter(Boolean).join(", "):!Array.isArray(n)&&n?r(n):""}function al({value:n,type:e,name:t,form:r}){return m.jsx("input",{type:"hidden",value:Gh(n,e),name:t,form:r})}al.displayName="@mantine/dates/HiddenDatesInput";function nu(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=nu(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function ru(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=nu(n))&&(r&&(r+=" "),r+=e);return r}var Xh={input:"m_468e7eda"};const Qh={},wr=v.factory((n,e)=>{const t=v.useProps("TimeInput",Qh,n),{classNames:r,styles:s,unstyled:o,vars:i,withSeconds:l,minTime:a,maxTime:c,value:u,onChange:d,...f}=t,{resolvedClassNames:h,resolvedStyles:p}=v.useResolvedStylesApi({classNames:r,styles:s,props:t}),g=b=>{if(a!==void 0||c!==void 0){const[k,C,E]=b.split(":").map(Number);if(a){const[w,S,M]=a.split(":").map(Number);if(k<w||k===w&&C<S||l&&k===w&&C===S&&E<M)return-1}if(c){const[w,S,M]=c.split(":").map(Number);if(k>w||k===w&&C>S||l&&k===w&&C===S&&E>M)return 1}}return 0},y=b=>{var k,C,E;if((k=t.onBlur)==null||k.call(t,b),a!==void 0||c!==void 0){const w=b.currentTarget.value;if(w){const S=g(w);S===1?(b.currentTarget.value=c,(C=t.onChange)==null||C.call(t,b)):S===-1&&(b.currentTarget.value=a,(E=t.onChange)==null||E.call(t,b))}}};return m.jsx(v.InputBase,{classNames:{...h,input:ru(Xh.input,h==null?void 0:h.input)},styles:p,unstyled:o,ref:e,value:u,...f,step:l?1:60,onChange:d,onBlur:y,type:"time",__staticSelector:"TimeInput"})});wr.classes=v.InputBase.classes;wr.displayName="@mantine/dates/TimeInput";var su={day:"m_396ce5cb"};const Zh={},ep=v.createVarsResolver((n,{size:e})=>({day:{"--day-size":v.getSize(e,"day-size")}})),cl=v.factory((n,e)=>{const t=v.useProps("Day",Zh,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,date:c,disabled:u,__staticSelector:d,weekend:f,outside:h,selected:p,renderDay:g,inRange:y,firstInRange:b,lastInRange:k,hidden:C,static:E,highlightToday:w,...S}=t,M=v.useStyles({name:d||"Day",classes:su,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,varsResolver:ep,rootSelector:"day"}),O=it();return m.jsx(v.UnstyledButton,{...M("day",{style:C?{display:"none"}:void 0}),component:E?"div":"button",ref:e,disabled:u,"data-today":I(c).isSame(Et("add",new Date,O.getTimezone()),"day")||void 0,"data-hidden":C||void 0,"data-highlight-today":w||void 0,"data-disabled":u||void 0,"data-weekend":!u&&!h&&f||void 0,"data-outside":!u&&h||void 0,"data-selected":!u&&p||void 0,"data-in-range":y&&!u||void 0,"data-first-in-range":b&&!u||void 0,"data-last-in-range":k&&!u||void 0,"data-static":E||void 0,unstyled:l,...S,children:(g==null?void 0:g(c))||I(c).date()})});cl.classes=su;cl.displayName="@mantine/dates/Day";function tp({locale:n,format:e="dd",firstDayOfWeek:t=1}){const r=I().day(t),s=[];for(let o=0;o<7;o+=1)typeof e=="string"?s.push(I(r).add(o,"days").locale(n).format(e)):s.push(e(I(r).add(o,"days").toDate()));return s}var ou={weekday:"m_18a3eca"};const np={},rp=v.createVarsResolver((n,{size:e})=>({weekdaysRow:{"--wr-fz":v.getFontSize(e),"--wr-spacing":v.getSpacing(e)}})),ul=v.factory((n,e)=>{const t=v.useProps("WeekdaysRow",np,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,locale:c,firstDayOfWeek:u,weekdayFormat:d,cellComponent:f="th",__staticSelector:h,withWeekNumbers:p,...g}=t,y=v.useStyles({name:h||"WeekdaysRow",classes:ou,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,varsResolver:rp,rootSelector:"weekdaysRow"}),b=it(),k=tp({locale:b.getLocale(c),format:d,firstDayOfWeek:b.getFirstDayOfWeek(u)}).map((C,E)=>m.jsx(f,{...y("weekday"),children:C},E));return m.jsxs(v.Box,{component:"tr",ref:e,...y("weekdaysRow"),...g,children:[p&&m.jsx(f,{...y("weekday"),children:"#"}),k]})});ul.classes=ou;ul.displayName="@mantine/dates/WeekdaysRow";function sp(n,e=1){let t=I(n);const r=e===0?6:e-1;for(;t.day()!==r;)t=t.add(1,"day");return t.toDate()}function op(n,e=1){let t=I(n);for(;t.day()!==e;)t=t.subtract(1,"day");return t.toDate()}function ip({month:n,firstDayOfWeek:e=1,consistentWeeks:t}){const r=I(n).subtract(I(n).date()-1,"day"),s=I(r).startOf("day"),o=s.toDate(),i=s.add(+s.daysInMonth()-1,"day").toDate(),l=sp(i,e),a=op(o,e),c=[];for(;a<=l;){const u=[];for(let d=0;d<7;d+=1)u.push(new Date(a)),a.setDate(a.getDate()+1);c.push(u)}if(t&&c.length<6){const u=c[c.length-1],d=u[u.length-1],f=new Date(d);for(f.setDate(f.getDate()+1);c.length<6;){const h=[];for(let p=0;p<7;p+=1)h.push(new Date(f)),f.setDate(f.getDate()+1);c.push(h)}}return c}function iu(n,e){return I(n).format("YYYY-MM")===I(e).format("YYYY-MM")}function lu(n,e){return e instanceof Date?I(n).isAfter(I(e).subtract(1,"day"),"day"):!0}function au(n,e){return e instanceof Date?I(n).isBefore(I(e).add(1,"day"),"day"):!0}function lp(n,e,t,r,s,o,i){const l=n.flat().filter(u=>{var d;return au(u,t)&&lu(u,e)&&!(s!=null&&s(u))&&!((d=r==null?void 0:r(u))!=null&&d.disabled)&&(!o||iu(u,i))}),a=l.find(u=>{var d;return(d=r==null?void 0:r(u))==null?void 0:d.selected});if(a)return a;const c=l.find(u=>I().isSame(u,"date"));return c||l[0]}var ps={exports:{}},ap=ps.exports,ya;function cp(){return ya||(ya=1,function(n,e){(function(t,r){n.exports=r()})(ap,function(){var t="day";return function(r,s,o){var i=function(c){return c.add(4-c.isoWeekday(),t)},l=s.prototype;l.isoWeekYear=function(){return i(this).year()},l.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),t);var u,d,f,h,p=i(this),g=(u=this.isoWeekYear(),d=this.$u,f=(d?o.utc:o)().year(u).startOf("year"),h=4-f.isoWeekday(),f.isoWeekday()>4&&(h+=7),f.add(h,t));return p.diff(g,"week")+1},l.isoWeekday=function(c){return this.$utils().u(c)?this.day()||7:this.day(this.day()%7?c:c-7)};var a=l.startOf;l.startOf=function(c,u){var d=this.$utils(),f=!!d.u(u)||u;return d.p(c)==="isoweek"?f?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):a.bind(this)(c,u)}}})}(ps)),ps.exports}var up=cp();const dp=Br(up);I.extend(dp);function fp(n){const e=n.find(t=>I(t).day()===1);return I(e).isoWeek()}var cu={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const hp={withCellSpacing:!0},pp=v.createVarsResolver((n,{size:e})=>({weekNumber:{"--wn-fz":v.getFontSize(e),"--wn-size":v.getSize(e,"wn-size")}})),fo=v.factory((n,e)=>{const t=v.useProps("Month",hp,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,__staticSelector:c,locale:u,firstDayOfWeek:d,weekdayFormat:f,month:h,weekendDays:p,getDayProps:g,excludeDate:y,minDate:b,maxDate:k,renderDay:C,hideOutsideDates:E,hideWeekdays:w,getDayAriaLabel:S,static:M,__getDayRef:O,__onDayKeyDown:A,__onDayClick:$,__onDayMouseEnter:W,__preventFocus:U,__stopPropagation:_,withCellSpacing:J,size:G,highlightToday:Q,withWeekNumbers:V,...ne}=t,L=v.useStyles({name:c||"Month",classes:cu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,varsResolver:pp,rootSelector:"month"}),le=it(),j=ip({month:h,firstDayOfWeek:le.getFirstDayOfWeek(d),consistentWeeks:le.consistentWeeks}),q=lp(j,b,k,g,y,E,h),{resolvedClassNames:pe,resolvedStyles:ce}=v.useResolvedStylesApi({classNames:r,styles:i,props:t}),P=j.map((te,se)=>{const ae=te.map((X,ke)=>{const re=!iu(X,h),we=(S==null?void 0:S(X))||I(X).locale(u||le.locale).format("D MMMM YYYY"),H=g==null?void 0:g(X),me=I(X).isSame(q,"date");return m.jsx("td",{...L("monthCell"),"data-with-spacing":J||void 0,children:m.jsx(cl,{__staticSelector:c||"Month",classNames:pe,styles:ce,unstyled:l,"data-mantine-stop-propagation":_||void 0,highlightToday:Q,renderDay:C,date:X,size:G,weekend:le.getWeekendDays(p).includes(X.getDay()),outside:re,hidden:E?re:!1,"aria-label":we,static:M,disabled:(y==null?void 0:y(X))||!au(X,k)||!lu(X,b),ref:ue=>O==null?void 0:O(se,ke,ue),...H,onKeyDown:ue=>{var Ce;(Ce=H==null?void 0:H.onKeyDown)==null||Ce.call(H,ue),A==null||A(ue,{rowIndex:se,cellIndex:ke,date:X})},onMouseEnter:ue=>{var Ce;(Ce=H==null?void 0:H.onMouseEnter)==null||Ce.call(H,ue),W==null||W(ue,X)},onClick:ue=>{var Ce;(Ce=H==null?void 0:H.onClick)==null||Ce.call(H,ue),$==null||$(ue,X)},onMouseDown:ue=>{var Ce;(Ce=H==null?void 0:H.onMouseDown)==null||Ce.call(H,ue),U&&ue.preventDefault()},tabIndex:U||!me?-1:0})},X.toString())});return m.jsxs("tr",{...L("monthRow"),children:[V&&m.jsx("td",{...L("weekNumber"),children:fp(te)}),ae]},se)});return m.jsxs(v.Box,{component:"table",...L("month"),size:G,ref:e,...ne,children:[!w&&m.jsx("thead",{...L("monthThead"),children:m.jsx(ul,{__staticSelector:c||"Month",locale:u,firstDayOfWeek:d,weekdayFormat:f,size:G,classNames:pe,styles:ce,unstyled:l,withWeekNumbers:V})}),m.jsx("tbody",{...L("monthTbody"),children:P})]})});fo.classes=cu;fo.displayName="@mantine/dates/Month";var uu={pickerControl:"m_dc6a3c71"};const mp={},gp=v.createVarsResolver((n,{size:e})=>({pickerControl:{"--dpc-fz":v.getFontSize(e),"--dpc-size":v.getSize(e,"dpc-size")}})),ho=v.factory((n,e)=>{const t=v.useProps("PickerControl",mp,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,firstInRange:c,lastInRange:u,inRange:d,__staticSelector:f,selected:h,disabled:p,...g}=t,y=v.useStyles({name:f||"PickerControl",classes:uu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,varsResolver:gp,rootSelector:"pickerControl"});return m.jsx(v.UnstyledButton,{...y("pickerControl"),ref:e,unstyled:l,"data-picker-control":!0,"data-selected":h&&!p||void 0,"data-disabled":p||void 0,"data-in-range":d&&!p&&!h||void 0,"data-first-in-range":c&&!p||void 0,"data-last-in-range":u&&!p||void 0,disabled:p,...g})});ho.classes=uu;ho.displayName="@mantine/dates/PickerControl";function du(n,e,t){return!e&&!t?!1:!!(e&&I(n).isBefore(e,"year")||t&&I(n).isAfter(t,"year"))}function yp(n,e,t,r){const s=n.flat().filter(l=>{var a;return!du(l,e,t)&&!((a=r==null?void 0:r(l))!=null&&a.disabled)}),o=s.find(l=>{var a;return(a=r==null?void 0:r(l))==null?void 0:a.selected});if(o)return o;const i=s.find(l=>I().isSame(l,"year"));return i||s[0]}function fu(n){const e=n.getFullYear(),t=e-e%10;let r=0;const s=[[],[],[],[]];for(let o=0;o<4;o+=1){const i=o===3?1:3;for(let l=0;l<i;l+=1)s[o].push(new Date(t+r,0)),r+=1}return s}var hu={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const bp={yearsListFormat:"YYYY",withCellSpacing:!0},po=v.factory((n,e)=>{const t=v.useProps("YearsList",bp,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,decade:c,yearsListFormat:u,locale:d,minDate:f,maxDate:h,getYearControlProps:p,__staticSelector:g,__getControlRef:y,__onControlKeyDown:b,__onControlClick:k,__onControlMouseEnter:C,__preventFocus:E,__stopPropagation:w,withCellSpacing:S,size:M,...O}=t,A=v.useStyles({name:g||"YearsList",classes:hu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,rootSelector:"yearsList"}),$=it(),W=fu(c),U=yp(W,f,h,p),_=W.map((J,G)=>{const Q=J.map((V,ne)=>{const L=p==null?void 0:p(V),le=I(V).isSame(U,"year");return m.jsx("td",{...A("yearsListCell"),"data-with-spacing":S||void 0,children:m.jsx(ho,{...A("yearsListControl"),size:M,unstyled:l,"data-mantine-stop-propagation":w||void 0,disabled:du(V,f,h),ref:j=>y==null?void 0:y(G,ne,j),...L,onKeyDown:j=>{var q;(q=L==null?void 0:L.onKeyDown)==null||q.call(L,j),b==null||b(j,{rowIndex:G,cellIndex:ne,date:V})},onClick:j=>{var q;(q=L==null?void 0:L.onClick)==null||q.call(L,j),k==null||k(j,V)},onMouseEnter:j=>{var q;(q=L==null?void 0:L.onMouseEnter)==null||q.call(L,j),C==null||C(j,V)},onMouseDown:j=>{var q;(q=L==null?void 0:L.onMouseDown)==null||q.call(L,j),E&&j.preventDefault()},tabIndex:E||!le?-1:0,children:I(V).locale($.getLocale(d)).format(u)})},ne)});return m.jsx("tr",{...A("yearsListRow"),children:Q},G)});return m.jsx(v.Box,{component:"table",ref:e,size:M,...A("yearsList"),...O,children:m.jsx("tbody",{children:_})})});po.classes=hu;po.displayName="@mantine/dates/YearsList";function pu(n,e,t){return!e&&!t?!1:!!(e&&I(n).isBefore(e,"month")||t&&I(n).isAfter(t,"month"))}function xp(n,e,t,r){const s=n.flat().filter(l=>{var a;return!pu(l,e,t)&&!((a=r==null?void 0:r(l))!=null&&a.disabled)}),o=s.find(l=>{var a;return(a=r==null?void 0:r(l))==null?void 0:a.selected});if(o)return o;const i=s.find(l=>I().isSame(l,"month"));return i||s[0]}function kp(n){const e=I(n).startOf("year").toDate(),t=[[],[],[],[]];let r=0;for(let s=0;s<4;s+=1)for(let o=0;o<3;o+=1)t[s].push(I(e).add(r,"months").toDate()),r+=1;return t}var mu={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const vp={monthsListFormat:"MMM",withCellSpacing:!0},mo=v.factory((n,e)=>{const t=v.useProps("MonthsList",vp,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,__staticSelector:c,year:u,monthsListFormat:d,locale:f,minDate:h,maxDate:p,getMonthControlProps:g,__getControlRef:y,__onControlKeyDown:b,__onControlClick:k,__onControlMouseEnter:C,__preventFocus:E,__stopPropagation:w,withCellSpacing:S,size:M,...O}=t,A=v.useStyles({name:c||"MonthsList",classes:mu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,rootSelector:"monthsList"}),$=it(),W=kp(u),U=xp(W,h,p,g),_=W.map((J,G)=>{const Q=J.map((V,ne)=>{const L=g==null?void 0:g(V),le=I(V).isSame(U,"month");return m.jsx("td",{...A("monthsListCell"),"data-with-spacing":S||void 0,children:m.jsx(ho,{...A("monthsListControl"),size:M,unstyled:l,__staticSelector:c||"MonthsList","data-mantine-stop-propagation":w||void 0,disabled:pu(V,h,p),ref:j=>y==null?void 0:y(G,ne,j),...L,onKeyDown:j=>{var q;(q=L==null?void 0:L.onKeyDown)==null||q.call(L,j),b==null||b(j,{rowIndex:G,cellIndex:ne,date:V})},onClick:j=>{var q;(q=L==null?void 0:L.onClick)==null||q.call(L,j),k==null||k(j,V)},onMouseEnter:j=>{var q;(q=L==null?void 0:L.onMouseEnter)==null||q.call(L,j),C==null||C(j,V)},onMouseDown:j=>{var q;(q=L==null?void 0:L.onMouseDown)==null||q.call(L,j),E&&j.preventDefault()},tabIndex:E||!le?-1:0,children:I(V).locale($.getLocale(f)).format(d)})},ne)});return m.jsx("tr",{...A("monthsListRow"),children:Q},G)});return m.jsx(v.Box,{component:"table",ref:e,size:M,...A("monthsList"),...O,children:m.jsx("tbody",{children:_})})});mo.classes=mu;mo.displayName="@mantine/dates/MonthsList";var gu={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const Sp={nextDisabled:!1,previousDisabled:!1,hasNextLevel:!0,withNext:!0,withPrevious:!0},Cp=v.createVarsResolver((n,{size:e})=>({calendarHeader:{"--dch-control-size":v.getSize(e,"dch-control-size"),"--dch-fz":v.getFontSize(e)}})),an=v.factory((n,e)=>{const t=v.useProps("CalendarHeader",Sp,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,nextIcon:c,previousIcon:u,nextLabel:d,previousLabel:f,onNext:h,onPrevious:p,onLevelClick:g,label:y,nextDisabled:b,previousDisabled:k,hasNextLevel:C,levelControlAriaLabel:E,withNext:w,withPrevious:S,__staticSelector:M,__preventFocus:O,__stopPropagation:A,...$}=t,W=v.useStyles({name:M||"CalendarHeader",classes:gu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,varsResolver:Cp,rootSelector:"calendarHeader"}),U=O?_=>_.preventDefault():void 0;return m.jsxs(v.Box,{...W("calendarHeader"),ref:e,...$,children:[S&&m.jsx(v.UnstyledButton,{...W("calendarHeaderControl"),"data-direction":"previous","aria-label":f,onClick:p,unstyled:l,onMouseDown:U,disabled:k,"data-disabled":k||void 0,tabIndex:O||k?-1:0,"data-mantine-stop-propagation":A||void 0,children:u||m.jsx(v.AccordionChevron,{...W("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})}),m.jsx(v.UnstyledButton,{component:C?"button":"div",...W("calendarHeaderLevel"),onClick:C?g:void 0,unstyled:l,onMouseDown:C?U:void 0,disabled:!C,"data-static":!C||void 0,"aria-label":E,tabIndex:O||!C?-1:0,"data-mantine-stop-propagation":A||void 0,children:y}),w&&m.jsx(v.UnstyledButton,{...W("calendarHeaderControl"),"data-direction":"next","aria-label":d,onClick:h,unstyled:l,onMouseDown:U,disabled:b,"data-disabled":b||void 0,tabIndex:O||b?-1:0,"data-mantine-stop-propagation":A||void 0,children:c||m.jsx(v.AccordionChevron,{...W("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})})]})});an.classes=gu;an.displayName="@mantine/dates/CalendarHeader";function Mp(n){const e=fu(n);return[e[0][0],e[3][0]]}const wp={decadeLabelFormat:"YYYY"},go=v.factory((n,e)=>{const t=v.useProps("DecadeLevel",wp,n),{decade:r,locale:s,minDate:o,maxDate:i,yearsListFormat:l,getYearControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,withCellSpacing:h,__preventFocus:p,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:C,onPrevious:E,nextDisabled:w,previousDisabled:S,levelControlAriaLabel:M,withNext:O,withPrevious:A,decadeLabelFormat:$,classNames:W,styles:U,unstyled:_,__staticSelector:J,__stopPropagation:G,size:Q,...V}=t,ne=it(),[L,le]=Mp(r),j={__staticSelector:J||"DecadeLevel",classNames:W,styles:U,unstyled:_,size:Q},q=typeof w=="boolean"?w:i?!I(le).endOf("year").isBefore(i):!1,pe=typeof S=="boolean"?S:o?!I(L).startOf("year").isAfter(o):!1,ce=(P,te)=>I(P).locale(s||ne.locale).format(te);return m.jsxs(v.Box,{"data-decade-level":!0,size:Q,ref:e,...V,children:[m.jsx(an,{label:typeof $=="function"?$(L,le):`${ce(L,$)} – ${ce(le,$)}`,__preventFocus:p,__stopPropagation:G,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:C,onPrevious:E,nextDisabled:q,previousDisabled:pe,hasNextLevel:!1,levelControlAriaLabel:M,withNext:O,withPrevious:A,...j}),m.jsx(po,{decade:r,locale:s,minDate:o,maxDate:i,yearsListFormat:l,getYearControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:p,__stopPropagation:G,withCellSpacing:h,...j})]})});go.classes={...po.classes,...an.classes};go.displayName="@mantine/dates/DecadeLevel";const Ep={yearLabelFormat:"YYYY"},yo=v.factory((n,e)=>{const t=v.useProps("YearLevel",Ep,n),{year:r,locale:s,minDate:o,maxDate:i,monthsListFormat:l,getMonthControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,withCellSpacing:h,__preventFocus:p,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:C,onPrevious:E,onLevelClick:w,nextDisabled:S,previousDisabled:M,hasNextLevel:O,levelControlAriaLabel:A,withNext:$,withPrevious:W,yearLabelFormat:U,__staticSelector:_,__stopPropagation:J,size:G,classNames:Q,styles:V,unstyled:ne,...L}=t,le=it(),j={__staticSelector:_||"YearLevel",classNames:Q,styles:V,unstyled:ne,size:G},q=typeof S=="boolean"?S:i?!I(r).endOf("year").isBefore(i):!1,pe=typeof M=="boolean"?M:o?!I(r).startOf("year").isAfter(o):!1;return m.jsxs(v.Box,{"data-year-level":!0,size:G,ref:e,...L,children:[m.jsx(an,{label:typeof U=="function"?U(r):I(r).locale(s||le.locale).format(U),__preventFocus:p,__stopPropagation:J,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:C,onPrevious:E,onLevelClick:w,nextDisabled:q,previousDisabled:pe,hasNextLevel:O,levelControlAriaLabel:A,withNext:$,withPrevious:W,...j}),m.jsx(mo,{year:r,locale:s,minDate:o,maxDate:i,monthsListFormat:l,getMonthControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:p,__stopPropagation:J,withCellSpacing:h,...j})]})});yo.classes={...an.classes,...mo.classes};yo.displayName="@mantine/dates/YearLevel";const Tp={monthLabelFormat:"MMMM YYYY"},bo=v.factory((n,e)=>{const t=v.useProps("MonthLevel",Tp,n),{month:r,locale:s,firstDayOfWeek:o,weekdayFormat:i,weekendDays:l,getDayProps:a,excludeDate:c,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:g,__getDayRef:y,__onDayKeyDown:b,__onDayClick:k,__onDayMouseEnter:C,withCellSpacing:E,highlightToday:w,withWeekNumbers:S,__preventFocus:M,__stopPropagation:O,nextIcon:A,previousIcon:$,nextLabel:W,previousLabel:U,onNext:_,onPrevious:J,onLevelClick:G,nextDisabled:Q,previousDisabled:V,hasNextLevel:ne,levelControlAriaLabel:L,withNext:le,withPrevious:j,monthLabelFormat:q,classNames:pe,styles:ce,unstyled:P,__staticSelector:te,size:se,static:ae,...X}=t,ke=it(),re={__staticSelector:te||"MonthLevel",classNames:pe,styles:ce,unstyled:P,size:se},we=typeof Q=="boolean"?Q:d?!I(r).endOf("month").isBefore(d):!1,H=typeof V=="boolean"?V:u?!I(r).startOf("month").isAfter(u):!1;return m.jsxs(v.Box,{"data-month-level":!0,size:se,ref:e,...X,children:[m.jsx(an,{label:typeof q=="function"?q(r):I(r).locale(s||ke.locale).format(q),__preventFocus:M,__stopPropagation:O,nextIcon:A,previousIcon:$,nextLabel:W,previousLabel:U,onNext:_,onPrevious:J,onLevelClick:G,nextDisabled:we,previousDisabled:H,hasNextLevel:ne,levelControlAriaLabel:L,withNext:le,withPrevious:j,...re}),m.jsx(fo,{month:r,locale:s,firstDayOfWeek:o,weekdayFormat:i,weekendDays:l,getDayProps:a,excludeDate:c,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:g,__getDayRef:y,__onDayKeyDown:b,__onDayClick:k,__onDayMouseEnter:C,__preventFocus:M,__stopPropagation:O,static:ae,withCellSpacing:E,highlightToday:w,withWeekNumbers:S,...re})]})});bo.classes={...fo.classes,...an.classes};bo.displayName="@mantine/dates/MonthLevel";var yu={levelsGroup:"m_30b26e33"};const Op={},cn=v.factory((n,e)=>{const t=v.useProps("LevelsGroup",Op,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,__staticSelector:c,...u}=t,d=v.useStyles({name:c||"LevelsGroup",classes:yu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a,rootSelector:"levelsGroup"});return m.jsx(v.Box,{ref:e,...d("levelsGroup"),...u})});cn.classes=yu;cn.displayName="@mantine/dates/LevelsGroup";const Dp={numberOfColumns:1},xo=v.factory((n,e)=>{const t=v.useProps("DecadeLevelGroup",Dp,n),{decade:r,locale:s,minDate:o,maxDate:i,yearsListFormat:l,getYearControlProps:a,__onControlClick:c,__onControlMouseEnter:u,withCellSpacing:d,__preventFocus:f,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,nextDisabled:C,previousDisabled:E,classNames:w,styles:S,unstyled:M,__staticSelector:O,__stopPropagation:A,numberOfColumns:$,levelControlAriaLabel:W,decadeLabelFormat:U,size:_,vars:J,...G}=t,Q=T.useRef([]),V=Array($).fill(0).map((ne,L)=>{const le=I(r).add(L*10,"years").toDate();return m.jsx(go,{size:_,yearsListFormat:l,decade:le,withNext:L===$-1,withPrevious:L===0,decadeLabelFormat:U,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(j,q)=>ll({levelIndex:L,rowIndex:q.rowIndex,cellIndex:q.cellIndex,event:j,controlsRef:Q}),__getControlRef:(j,q,pe)=>{Array.isArray(Q.current[L])||(Q.current[L]=[]),Array.isArray(Q.current[L][j])||(Q.current[L][j]=[]),Q.current[L][j][q]=pe},levelControlAriaLabel:typeof W=="function"?W(le):W,locale:s,minDate:o,maxDate:i,__preventFocus:f,__stopPropagation:A,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,nextDisabled:C,previousDisabled:E,getYearControlProps:a,__staticSelector:O||"DecadeLevelGroup",classNames:w,styles:S,unstyled:M,withCellSpacing:d},L)});return m.jsx(cn,{classNames:w,styles:S,__staticSelector:O||"DecadeLevelGroup",ref:e,size:_,unstyled:M,...G,children:V})});xo.classes={...cn.classes,...go.classes};xo.displayName="@mantine/dates/DecadeLevelGroup";const Ap={numberOfColumns:1},ko=v.factory((n,e)=>{const t=v.useProps("YearLevelGroup",Ap,n),{year:r,locale:s,minDate:o,maxDate:i,monthsListFormat:l,getMonthControlProps:a,__onControlClick:c,__onControlMouseEnter:u,withCellSpacing:d,__preventFocus:f,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,onLevelClick:C,nextDisabled:E,previousDisabled:w,hasNextLevel:S,classNames:M,styles:O,unstyled:A,__staticSelector:$,__stopPropagation:W,numberOfColumns:U,levelControlAriaLabel:_,yearLabelFormat:J,size:G,vars:Q,...V}=t,ne=T.useRef([]),L=Array(U).fill(0).map((le,j)=>{const q=I(r).add(j,"years").toDate();return m.jsx(yo,{size:G,monthsListFormat:l,year:q,withNext:j===U-1,withPrevious:j===0,yearLabelFormat:J,__stopPropagation:W,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(pe,ce)=>ll({levelIndex:j,rowIndex:ce.rowIndex,cellIndex:ce.cellIndex,event:pe,controlsRef:ne}),__getControlRef:(pe,ce,P)=>{Array.isArray(ne.current[j])||(ne.current[j]=[]),Array.isArray(ne.current[j][pe])||(ne.current[j][pe]=[]),ne.current[j][pe][ce]=P},levelControlAriaLabel:typeof _=="function"?_(q):_,locale:s,minDate:o,maxDate:i,__preventFocus:f,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,onLevelClick:C,nextDisabled:E,previousDisabled:w,hasNextLevel:S,getMonthControlProps:a,classNames:M,styles:O,unstyled:A,__staticSelector:$||"YearLevelGroup",withCellSpacing:d},j)});return m.jsx(cn,{classNames:M,styles:O,__staticSelector:$||"YearLevelGroup",ref:e,size:G,unstyled:A,...V,children:L})});ko.classes={...yo.classes,...cn.classes};ko.displayName="@mantine/dates/YearLevelGroup";const Np={numberOfColumns:1},vo=v.factory((n,e)=>{const t=v.useProps("MonthLevelGroup",Np,n),{month:r,locale:s,firstDayOfWeek:o,weekdayFormat:i,weekendDays:l,getDayProps:a,excludeDate:c,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:g,__onDayClick:y,__onDayMouseEnter:b,withCellSpacing:k,highlightToday:C,withWeekNumbers:E,__preventFocus:w,nextIcon:S,previousIcon:M,nextLabel:O,previousLabel:A,onNext:$,onPrevious:W,onLevelClick:U,nextDisabled:_,previousDisabled:J,hasNextLevel:G,classNames:Q,styles:V,unstyled:ne,numberOfColumns:L,levelControlAriaLabel:le,monthLabelFormat:j,__staticSelector:q,__stopPropagation:pe,size:ce,static:P,vars:te,...se}=t,ae=T.useRef([]),X=Array(L).fill(0).map((ke,re)=>{const we=I(r).add(re,"months").toDate();return m.jsx(bo,{month:we,withNext:re===L-1,withPrevious:re===0,monthLabelFormat:j,__stopPropagation:pe,__onDayClick:y,__onDayMouseEnter:b,__onDayKeyDown:(H,me)=>ll({levelIndex:re,rowIndex:me.rowIndex,cellIndex:me.cellIndex,event:H,controlsRef:ae}),__getDayRef:(H,me,ue)=>{Array.isArray(ae.current[re])||(ae.current[re]=[]),Array.isArray(ae.current[re][H])||(ae.current[re][H]=[]),ae.current[re][H][me]=ue},levelControlAriaLabel:typeof le=="function"?le(we):le,locale:s,firstDayOfWeek:o,weekdayFormat:i,weekendDays:l,getDayProps:a,excludeDate:c,minDate:u,maxDate:d,renderDay:f,hideOutsideDates:h,hideWeekdays:p,getDayAriaLabel:g,__preventFocus:w,nextIcon:S,previousIcon:M,nextLabel:O,previousLabel:A,onNext:$,onPrevious:W,onLevelClick:U,nextDisabled:_,previousDisabled:J,hasNextLevel:G,classNames:Q,styles:V,unstyled:ne,__staticSelector:q||"MonthLevelGroup",size:ce,static:P,withCellSpacing:k,highlightToday:C,withWeekNumbers:E},re)});return m.jsx(cn,{classNames:Q,styles:V,__staticSelector:q||"MonthLevelGroup",ref:e,size:ce,...se,children:X})});vo.classes={...cn.classes,...bo.classes};vo.displayName="@mantine/dates/MonthLevelGroup";var bu={input:"m_6fa5e2aa"};const Rp={},So=v.factory((n,e)=>{const{inputProps:t,wrapperProps:r,placeholder:s,classNames:o,styles:i,unstyled:l,popoverProps:a,modalProps:c,dropdownType:u,children:d,formattedValue:f,dropdownHandlers:h,dropdownOpened:p,onClick:g,clearable:y,onClear:b,clearButtonProps:k,rightSection:C,shouldClear:E,readOnly:w,disabled:S,value:M,name:O,form:A,type:$,...W}=v.useInputProps("PickerInputBase",Rp,n),U=m.jsx(v.Input.ClearButton,{onClick:b,unstyled:l,...k}),_=()=>{$==="range"&&Array.isArray(M)&&M[0]&&!M[1]&&b(),h.close()};return m.jsxs(m.Fragment,{children:[u==="modal"&&!w&&m.jsx(v.Modal,{opened:p,onClose:_,withCloseButton:!1,size:"auto","data-dates-modal":!0,unstyled:l,...c,children:d}),m.jsx(v.Input.Wrapper,{...r,children:m.jsxs(v.Popover,{position:"bottom-start",opened:p,trapFocus:!0,returnFocus:!1,unstyled:l,...a,disabled:(a==null?void 0:a.disabled)||u==="modal"||w,onChange:J=>{var G;J||((G=a==null?void 0:a.onClose)==null||G.call(a),_())},children:[m.jsx(v.Popover.Target,{children:m.jsx(v.Input,{"data-dates-input":!0,"data-read-only":w||void 0,disabled:S,component:"button",type:"button",multiline:!0,onClick:J=>{g==null||g(J),h.toggle()},__clearSection:U,__clearable:y&&E&&!w&&!S,rightSection:C,...t,ref:e,classNames:{...o,input:ru(bu.input,o==null?void 0:o.input)},...W,children:f||m.jsx(v.Input.Placeholder,{error:t.error,unstyled:l,className:o==null?void 0:o.placeholder,style:i==null?void 0:i.placeholder,children:s})})}),m.jsx(v.Popover.Dropdown,{"data-dates-dropdown":!0,children:d})]})}),m.jsx(al,{value:M,name:O,form:A,type:$})]})});So.classes=bu;So.displayName="@mantine/dates/PickerInputBase";function Lp(n,e,t){return e===void 0&&t===void 0?n:e!==void 0&&t===void 0?Math.max(n,e):Math.min(e===void 0&&t!==void 0?n:Math.max(n,e),t)}const ba=["mousedown","touchstart"];function Ip(n,e,t){const r=T.useRef(null);return T.useEffect(()=>{const s=o=>{const{target:i}=o??{};if(Array.isArray(t)){const l=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";t.every(c=>!!c&&!o.composedPath().includes(c))&&!l&&n()}else r.current&&!r.current.contains(i)&&n()};return ba.forEach(o=>document.addEventListener(o,s)),()=>{ba.forEach(o=>document.removeEventListener(o,s))}},[r,n,t]),r}function Ai(n,e){const t=T.useRef(!1);T.useEffect(()=>()=>{t.current=!1},[]),T.useEffect(()=>{if(t.current)return n();t.current=!0},e)}function jp(n,e,t){T.useEffect(()=>(window.addEventListener(n,e,t),()=>window.removeEventListener(n,e,t)),[n,e])}function xa(n,e){if(typeof n=="function")return n(e);typeof n=="object"&&n!==null&&"current"in n&&(n.current=e)}function Pp(...n){const e=new Map;return t=>{if(n.forEach(r=>{const s=xa(r,t);s&&e.set(r,s)}),e.size>0)return()=>{n.forEach(r=>{const s=e.get(r);s?s():xa(r,null)}),e.clear()}}}function _p(...n){return T.useCallback(Pp(...n),n)}function xu({value:n,defaultValue:e,finalValue:t,onChange:r=()=>{}}){const[s,o]=T.useState(e!==void 0?e:t),i=(l,...a)=>{o(l),r==null||r(l,...a)};return n!==void 0?[n,r,!0]:[s,i,!1]}function Bp(n){return e=>{if(!e)n(e);else if(typeof e=="function")n(e);else if(typeof e=="object"&&"nativeEvent"in e){const{currentTarget:t}=e;t.type==="checkbox"?n(t.checked):n(t.value)}else n(e)}}function zp(n){const[e,t]=T.useState(n);return[e,Bp(t)]}function dl(n=!1,e){const{onOpen:t,onClose:r}={},[s,o]=T.useState(n),i=T.useCallback(()=>{o(c=>c||(t==null||t(),!0))},[t]),l=T.useCallback(()=>{o(c=>c&&(r==null||r(),!1))},[r]),a=T.useCallback(()=>{s?l():i()},[l,i,s]);return[s,{open:i,close:l,toggle:a}]}const ka=n=>n==="range"?[null,null]:n==="multiple"?[]:null;function Er({type:n,value:e,defaultValue:t,onChange:r,applyTimezone:s=!0}){const o=T.useRef(n),i=it(),[l,a,c]=xu({value:Et("add",e,i.getTimezone(),!s),defaultValue:Et("add",t,i.getTimezone(),!s),finalValue:ka(n),onChange:d=>{r==null||r(Et("remove",d,i.getTimezone(),!s))}});let u=l;if(o.current!==n){if(o.current=n,e===void 0)u=t!==void 0?t:ka(n),a(u);else if(process.env.NODE_ENV==="development")switch(n){case"default":e!==null&&typeof e!="string"&&console.error("[@mantine/dates/use-uncontrolled-dates] Value must be type of `null` or `string`");break;case"multiple":e instanceof Array||console.error("[@mantine/dates/use-uncontrolled-dates] Value must be type of `string[]`");break;case"range":(!(e instanceof Array)||e.length!==2)&&console.error("[@mantine/dates/use-uncontrolled-dates] Value must be type of `[string, string]`");break}}return[u,a,c]}function qo(n,e){return n?n==="month"?0:n==="year"?1:2:e||0}function Fp(n){return n===0?"month":n===1?"year":"decade"}function cr(n,e,t){return Fp(Lp(qo(n,0),qo(e,0),qo(t,2)))}const $p={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0},Zn=v.factory((n,e)=>{const t=v.useProps("Calendar",$p,n),{vars:r,maxLevel:s,minLevel:o,defaultLevel:i,level:l,onLevelChange:a,date:c,defaultDate:u,onDateChange:d,numberOfColumns:f,columnsToScroll:h,ariaLabels:p,nextLabel:g,previousLabel:y,onYearSelect:b,onMonthSelect:k,onYearMouseEnter:C,onMonthMouseEnter:E,__updateDateOnYearSelect:w,__updateDateOnMonthSelect:S,firstDayOfWeek:M,weekdayFormat:O,weekendDays:A,getDayProps:$,excludeDate:W,renderDay:U,hideOutsideDates:_,hideWeekdays:J,getDayAriaLabel:G,monthLabelFormat:Q,nextIcon:V,previousIcon:ne,__onDayClick:L,__onDayMouseEnter:le,withCellSpacing:j,highlightToday:q,withWeekNumbers:pe,monthsListFormat:ce,getMonthControlProps:P,yearLabelFormat:te,yearsListFormat:se,getYearControlProps:ae,decadeLabelFormat:X,classNames:ke,styles:re,unstyled:we,minDate:H,maxDate:me,locale:ue,__staticSelector:Ce,size:At,__preventFocus:vt,__stopPropagation:qe,onNextDecade:fn,onPreviousDecade:hn,onNextYear:ge,onPreviousYear:nt,onNextMonth:ut,onPreviousMonth:Nt,static:pn,__timezoneApplied:mn,...zo}=t,{resolvedClassNames:Wr,resolvedStyles:Ur}=v.useResolvedStylesApi({classNames:ke,styles:re,props:t}),[nr,jn]=xu({value:l?cr(l,o,s):void 0,defaultValue:i?cr(i,o,s):void 0,finalValue:cr(void 0,o,s),onChange:a}),[Fo,St]=Er({type:"default",value:c,defaultValue:u,onChange:d,applyTimezone:!mn}),rr={__staticSelector:Ce||"Calendar",styles:Ur,classNames:Wr,unstyled:we,size:At},$o=it(),Vt=h||f||1,Pn=new Date,qr=H&&H>Pn?H:Pn,Ke=Fo||Et("add",qr,$o.getTimezone()),sr=()=>{const Oe=I(Ke).add(Vt,"month").toDate();ut==null||ut(Oe),St(Oe)},or=()=>{const Oe=I(Ke).subtract(Vt,"month").toDate();Nt==null||Nt(Oe),St(Oe)},Kr=()=>{const Oe=I(Ke).add(Vt,"year").toDate();ge==null||ge(Oe),St(Oe)},Vo=()=>{const Oe=I(Ke).subtract(Vt,"year").toDate();nt==null||nt(Oe),St(Oe)},Yr=()=>{const Oe=I(Ke).add(10*Vt,"year").toDate();fn==null||fn(Oe),St(Oe)},Ho=()=>{const Oe=I(Ke).subtract(10*Vt,"year").toDate();hn==null||hn(Oe),St(Oe)};return m.jsxs(v.Box,{ref:e,size:At,"data-calendar":!0,...zo,children:[nr==="month"&&m.jsx(vo,{month:Ke,minDate:H,maxDate:me,firstDayOfWeek:M,weekdayFormat:O,weekendDays:A,getDayProps:$,excludeDate:W,renderDay:U,hideOutsideDates:_,hideWeekdays:J,getDayAriaLabel:G,onNext:sr,onPrevious:or,hasNextLevel:s!=="month",onLevelClick:()=>jn("year"),numberOfColumns:f,locale:ue,levelControlAriaLabel:p==null?void 0:p.monthLevelControl,nextLabel:(p==null?void 0:p.nextMonth)??g,nextIcon:V,previousLabel:(p==null?void 0:p.previousMonth)??y,previousIcon:ne,monthLabelFormat:Q,__onDayClick:L,__onDayMouseEnter:le,__preventFocus:vt,__stopPropagation:qe,static:pn,withCellSpacing:j,highlightToday:q,withWeekNumbers:pe,...rr}),nr==="year"&&m.jsx(ko,{year:Ke,numberOfColumns:f,minDate:H,maxDate:me,monthsListFormat:ce,getMonthControlProps:P,locale:ue,onNext:Kr,onPrevious:Vo,hasNextLevel:s!=="month"&&s!=="year",onLevelClick:()=>jn("decade"),levelControlAriaLabel:p==null?void 0:p.yearLevelControl,nextLabel:(p==null?void 0:p.nextYear)??g,nextIcon:V,previousLabel:(p==null?void 0:p.previousYear)??y,previousIcon:ne,yearLabelFormat:te,__onControlMouseEnter:E,__onControlClick:(Oe,Ht)=>{S&&St(Ht),jn(cr("month",o,s)),k==null||k(Ht)},__preventFocus:vt,__stopPropagation:qe,withCellSpacing:j,...rr}),nr==="decade"&&m.jsx(xo,{decade:Ke,minDate:H,maxDate:me,yearsListFormat:se,getYearControlProps:ae,locale:ue,onNext:Yr,onPrevious:Ho,numberOfColumns:f,nextLabel:(p==null?void 0:p.nextDecade)??g,nextIcon:V,previousLabel:(p==null?void 0:p.previousDecade)??y,previousIcon:ne,decadeLabelFormat:X,__onControlMouseEnter:C,__onControlClick:(Oe,Ht)=>{w&&St(Ht),jn(cr("year",o,s)),b==null||b(Ht)},__preventFocus:vt,__stopPropagation:qe,withCellSpacing:j,...rr})]})});Zn.classes={...xo.classes,...ko.classes,...vo.classes};Zn.displayName="@mantine/dates/Calendar";function ku(n){const{maxLevel:e,minLevel:t,defaultLevel:r,level:s,onLevelChange:o,nextIcon:i,previousIcon:l,date:a,defaultDate:c,onDateChange:u,numberOfColumns:d,columnsToScroll:f,ariaLabels:h,nextLabel:p,previousLabel:g,onYearSelect:y,onMonthSelect:b,onYearMouseEnter:k,onMonthMouseEnter:C,onNextMonth:E,onPreviousMonth:w,onNextYear:S,onPreviousYear:M,onNextDecade:O,onPreviousDecade:A,withCellSpacing:$,highlightToday:W,__updateDateOnYearSelect:U,__updateDateOnMonthSelect:_,withWeekNumbers:J,firstDayOfWeek:G,weekdayFormat:Q,weekendDays:V,getDayProps:ne,excludeDate:L,renderDay:le,hideOutsideDates:j,hideWeekdays:q,getDayAriaLabel:pe,monthLabelFormat:ce,monthsListFormat:P,getMonthControlProps:te,yearLabelFormat:se,yearsListFormat:ae,getYearControlProps:X,decadeLabelFormat:ke,allowSingleDateInRange:re,allowDeselect:we,minDate:H,maxDate:me,locale:ue,...Ce}=n;return{calendarProps:{maxLevel:e,minLevel:t,defaultLevel:r,level:s,onLevelChange:o,nextIcon:i,previousIcon:l,date:a,defaultDate:c,onDateChange:u,numberOfColumns:d,columnsToScroll:f,ariaLabels:h,nextLabel:p,previousLabel:g,onYearSelect:y,onMonthSelect:b,onYearMouseEnter:k,onMonthMouseEnter:C,onNextMonth:E,onPreviousMonth:w,onNextYear:S,onPreviousYear:M,onNextDecade:O,onPreviousDecade:A,withCellSpacing:$,highlightToday:W,__updateDateOnYearSelect:U,__updateDateOnMonthSelect:_,withWeekNumbers:J,firstDayOfWeek:G,weekdayFormat:Q,weekendDays:V,getDayProps:ne,excludeDate:L,renderDay:le,hideOutsideDates:j,hideWeekdays:q,getDayAriaLabel:pe,monthLabelFormat:ce,monthsListFormat:P,getMonthControlProps:te,yearLabelFormat:se,yearsListFormat:ae,getYearControlProps:X,decadeLabelFormat:ke,allowSingleDateInRange:re,allowDeselect:we,minDate:H,maxDate:me,locale:ue},others:Ce}}function va(n,e){const t=[...e].sort((r,s)=>r.getTime()-s.getTime());return I(t[0]).startOf("day").subtract(1,"ms").isBefore(n)&&I(t[1]).endOf("day").add(1,"ms").isAfter(n)}function Vp({type:n,level:e,value:t,defaultValue:r,onChange:s,allowSingleDateInRange:o,allowDeselect:i,onMouseLeave:l,applyTimezone:a=!0}){const[c,u]=Er({type:n,value:t,defaultValue:r,onChange:s,applyTimezone:a}),[d,f]=T.useState(n==="range"&&c[0]&&!c[1]?c[0]:null),[h,p]=T.useState(null),g=S=>{if(n==="range"){if(d instanceof Date&&!c[1]){if(I(S).isSame(d,e)&&!o){f(null),p(null),u([null,null]);return}const M=[S,d];M.sort((O,A)=>O.getTime()-A.getTime()),u(M),p(null),f(null);return}if(c[0]&&!c[1]&&I(S).isSame(c[0],e)&&!o){f(null),p(null),u([null,null]);return}u([S,null]),p(null),f(S);return}if(n==="multiple"){c.some(M=>I(M).isSame(S,e))?u(c.filter(M=>!I(M).isSame(S,e))):u([...c,S]);return}c&&i&&I(S).isSame(c,e)?u(null):u(S)},y=S=>d instanceof Date&&h instanceof Date?va(S,[h,d]):c[0]instanceof Date&&c[1]instanceof Date?va(S,c):!1,b=n==="range"?S=>{l==null||l(S),p(null)}:l,k=S=>c[0]instanceof Date&&I(S).isSame(c[0],e)?!(h&&I(h).isBefore(c[0])):!1,C=S=>c[1]instanceof Date?I(S).isSame(c[1],e):!(c[0]instanceof Date)||!h?!1:I(h).isBefore(c[0])&&I(S).isSame(c[0],e),E=S=>{if(n==="range")return{selected:c.some(O=>O&&I(O).isSame(S,e)),inRange:y(S),firstInRange:k(S),lastInRange:C(S),"data-autofocus":!!c[0]&&I(c[0]).isSame(S,e)||void 0};if(n==="multiple")return{selected:c.some(O=>O&&I(O).isSame(S,e)),"data-autofocus":!!c[0]&&I(c[0]).isSame(S,e)||void 0};const M=I(c).isSame(S,e);return{selected:M,"data-autofocus":M||void 0}},w=n==="range"&&d?p:()=>{};return T.useEffect(()=>{if(n==="range")if(c[0]&&!c[1]&&(d==null?void 0:d.getTime())!==c[0].getTime())f(c[0]);else{const S=c[0]==null&&c[1]==null,M=c[0]!=null&&c[1]!=null;(S||M)&&(f(null),p(null))}},[c]),{onDateChange:g,onRootMouseLeave:b,onHoveredDateChange:w,getControlProps:E,_value:c,setValue:u}}const Hp={type:"default",defaultLevel:"month",numberOfColumns:1},Co=v.factory((n,e)=>{const t=v.useProps("DatePicker",Hp,n),{classNames:r,styles:s,vars:o,type:i,defaultValue:l,value:a,onChange:c,__staticSelector:u,getDayProps:d,allowSingleDateInRange:f,allowDeselect:h,onMouseLeave:p,numberOfColumns:g,hideOutsideDates:y,__onDayMouseEnter:b,__onDayClick:k,__timezoneApplied:C,...E}=t,{onDateChange:w,onRootMouseLeave:S,onHoveredDateChange:M,getControlProps:O}=Vp({type:i,level:"day",allowDeselect:h,allowSingleDateInRange:f,value:a,defaultValue:l,onChange:c,onMouseLeave:p,applyTimezone:!C}),{resolvedClassNames:A,resolvedStyles:$}=v.useResolvedStylesApi({classNames:r,styles:s,props:t}),W=it();return m.jsx(Zn,{ref:e,minLevel:"month",classNames:A,styles:$,__staticSelector:u||"DatePicker",onMouseLeave:S,numberOfColumns:g,hideOutsideDates:y??g!==1,__onDayMouseEnter:(U,_)=>{M(_),b==null||b(U,_)},__onDayClick:(U,_)=>{w(_),k==null||k(U,_)},getDayProps:U=>({...O(U),...d==null?void 0:d(U)}),...E,date:Et("add",E.date,W.getTimezone(),C),__timezoneApplied:!0})});Co.classes=Zn.classes;Co.displayName="@mantine/dates/DatePicker";function Wp(n,e){if(n===null)return null;const t=Et("add",new Date(n),e);return Number.isNaN(t.getTime())||!n?null:t}function Up({date:n,maxDate:e,minDate:t}){return!(n==null||Number.isNaN(n.getTime())||e&&I(n).isAfter(e,"date")||t&&I(n).isBefore(t,"date"))}const qp={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,preserveTime:!0},vs=v.factory((n,e)=>{const t=v.useInputProps("DateInput",qp,n),{inputProps:r,wrapperProps:s,value:o,defaultValue:i,onChange:l,clearable:a,clearButtonProps:c,popoverProps:u,getDayProps:d,locale:f,valueFormat:h,dateParser:p,minDate:g,maxDate:y,fixOnBlur:b,onFocus:k,onBlur:C,onClick:E,readOnly:w,name:S,form:M,rightSection:O,unstyled:A,classNames:$,styles:W,allowDeselect:U,preserveTime:_,date:J,defaultDate:G,onDateChange:Q,...V}=t,ne=T.useRef(null),L=T.useRef(null),[le,j]=T.useState(!1),{calendarProps:q,others:pe}=ku(V),ce=it(),te=p||(ge=>{const nt=I(ge,h,ce.getLocale(f)).toDate();return Number.isNaN(nt.getTime())?Wp(ge,ce.getTimezone()):nt}),se=U!==void 0?U:a,ae=ge=>ge?I(ge).locale(ce.getLocale(f)).format(h):"",[X,ke,re]=Er({type:"default",value:o,defaultValue:i,onChange:l}),[we,H]=Er({type:"default",value:J,defaultValue:i||G,onChange:Q});T.useEffect(()=>{re&&o!==null&&H(o)},[re,o]);const[me,ue]=T.useState(ae(X));T.useEffect(()=>{ue(ae(X))},[ce.getLocale(f)]);const Ce=ge=>{const nt=ge.currentTarget.value;if(ue(nt),j(!0),nt.trim()===""&&a)ke(null);else{const ut=te(nt);Up({date:ut,minDate:g,maxDate:y})&&(ke(ut),H(ut))}},At=ge=>{C==null||C(ge),j(!1),b&&ue(ae(X))},vt=ge=>{k==null||k(ge),j(!0)},qe=ge=>{E==null||E(ge),j(!0)},fn=ge=>({...d==null?void 0:d(ge),selected:I(X).isSame(ge,"day"),onClick:nt=>{var pn,mn;(mn=d==null?void 0:(pn=d(ge)).onClick)==null||mn.call(pn,nt);const ut=_?Di(X,ge):ge,Nt=a&&se&&I(X).isSame(ge,"day")?null:ut;ke(Nt),!re&&ue(ae(Nt)),j(!1)}}),hn=O||(a&&X&&!w?m.jsx(v.CloseButton,{variant:"transparent",onMouseDown:ge=>ge.preventDefault(),tabIndex:-1,onClick:()=>{ke(null),!re&&ue(""),j(!1)},unstyled:A,size:r.size||"sm",...c}):null);return Ai(()=>{X!==void 0&&!le&&ue(ae(X))},[X]),Ip(()=>j(!1),void 0,[ne.current,L.current]),m.jsxs(m.Fragment,{children:[m.jsx(v.Input.Wrapper,{...s,__staticSelector:"DateInput",ref:ne,children:m.jsxs(v.Popover,{opened:le,trapFocus:!1,position:"bottom-start",disabled:w,withRoles:!1,unstyled:A,...u,children:[m.jsx(v.Popover.Target,{children:m.jsx(v.Input,{"data-dates-input":!0,"data-read-only":w||void 0,autoComplete:"off",ref:e,value:me,onChange:Ce,onBlur:At,onFocus:vt,onClick:qe,readOnly:w,rightSection:hn,...r,...pe,__staticSelector:"DateInput"})}),m.jsx(v.Popover.Dropdown,{onMouseDown:ge=>ge.preventDefault(),"data-dates-dropdown":!0,ref:L,children:m.jsx(Zn,{__staticSelector:"DateInput",__timezoneApplied:!0,...q,classNames:$,styles:W,unstyled:A,__preventFocus:!0,minDate:g,maxDate:y,locale:f,getDayProps:fn,size:r.size,date:we,onDateChange:H})})]})}),m.jsx(al,{name:S,form:M,value:X,type:"default"})]})});vs.classes={...v.Input.classes,...Zn.classes};vs.displayName="@mantine/dates/DateInput";var vu={timeWrapper:"m_208d2562",timeInput:"m_62ee059"};const Kp={dropdownType:"popover"},Ss=v.factory((n,e)=>{const t=v.useProps("DateTimePicker",Kp,n),{value:r,defaultValue:s,onChange:o,valueFormat:i,locale:l,classNames:a,styles:c,unstyled:u,timeInputProps:d,submitButtonProps:f,withSeconds:h,level:p,defaultLevel:g,size:y,variant:b,dropdownType:k,vars:C,minDate:E,maxDate:w,...S}=t,M=v.useStyles({name:"DateTimePicker",classes:vu,props:t,classNames:a,styles:c,unstyled:u,vars:C}),{resolvedClassNames:O,resolvedStyles:A}=v.useResolvedStylesApi({classNames:a,styles:c,props:t}),$=i||(h?"DD/MM/YYYY HH:mm:ss":"DD/MM/YYYY HH:mm"),W=T.useRef(null),U=_p(W,d==null?void 0:d.ref),{calendarProps:{allowSingleDateInRange:_,...J},others:G}=ku(S),Q=it(),[V,ne]=Er({type:"default",value:r,defaultValue:s,onChange:o}),L=H=>H?I(H).format(h?"HH:mm:ss":"HH:mm"):"",[le,j]=T.useState(L(V)),[q,pe]=T.useState(p||g||"month"),[ce,P]=dl(!1),te=V?I(V).locale(Q.getLocale(l)).tz(Q.getTimezone(),!0).format($):"",se=H=>{var ue;(ue=d==null?void 0:d.onChange)==null||ue.call(d,H);const me=H.currentTarget.value;if(j(me),me){const[Ce,At,vt]=me.split(":").map(Number),qe=Et("add",new Date,Q.getTimezone());qe.setHours(Ce),qe.setMinutes(At),qe.setSeconds(vt||0),qe.setMilliseconds(0),ne(Di(qe,V||Et("add",new Date,Q.getTimezone())))}},ae=H=>{var me;H&&ne(Di(V,H)),(me=W.current)==null||me.focus()},X=H=>{var me;(me=d==null?void 0:d.onKeyDown)==null||me.call(d,H),H.key==="Enter"&&(H.preventDefault(),P.close())};Ai(()=>{ce||j(L(V))},[V,ce]),Ai(()=>{ce&&pe("month")},[ce]);const ke=E?I(E).format("HH:mm:ss"):null,re=w?I(w).format("HH:mm:ss"):null,we=k==="popover";return m.jsxs(So,{formattedValue:te,dropdownOpened:S.disabled?!1:ce,dropdownHandlers:P,classNames:O,styles:A,unstyled:u,ref:e,onClear:()=>ne(null),shouldClear:!!V,value:V,size:y,variant:b,dropdownType:k,...G,type:"default",__staticSelector:"DateTimePicker",children:[m.jsx(Co,{...J,maxDate:w,minDate:E,size:y,variant:b,type:"default",value:V,defaultDate:V,onChange:ae,locale:l,classNames:O,styles:A,unstyled:u,__staticSelector:"DateTimePicker",__stopPropagation:we,level:p,defaultLevel:g,onLevelChange:H=>{var me;pe(H),(me=J.onLevelChange)==null||me.call(J,H)},__timezoneApplied:!0}),q==="month"&&m.jsxs("div",{...M("timeWrapper"),children:[m.jsx(wr,{value:le,withSeconds:h,ref:U,unstyled:u,minTime:V&&E&&V.toDateString()===E.toDateString()?ke??void 0:void 0,maxTime:V&&w&&V.toDateString()===w.toDateString()?re??void 0:void 0,...d,...M("timeInput",{className:d==null?void 0:d.className,style:d==null?void 0:d.style}),onChange:se,onKeyDown:X,size:y,"data-mantine-stop-propagation":we||void 0}),m.jsx(v.ActionIcon,{variant:"default",size:`input-${y||"sm"}`,...M("submitButton",{className:f==null?void 0:f.className,style:f==null?void 0:f.style}),unstyled:u,"data-mantine-stop-propagation":we||void 0,children:m.jsx(v.CheckIcon,{size:"30%"}),...f,onClick:H=>{var me;(me=f==null?void 0:f.onClick)==null||me.call(f,H),P.close()}})]})]})});Ss.classes={...vu,...So.classes,...Co.classes};Ss.displayName="@mantine/dates/DateTimePicker";function Yp({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=t.value?typeof t.value=="string"?new Date(t.value):t.value:null,i=l=>{const a=l?l.toISOString():null;t.onFieldChange(a)};return r||s?m.jsx(vs,{valueFormat:"YYYY-MMM-DD",value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(vs,{valueFormat:"YYYY-MMM-DD",value:o,onChange:i,required:n.required,placeholder:n.placeholder,error:void 0})}function Jp({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=t.value?typeof t.value=="string"?new Date(t.value):t.value:null,i=l=>{const a=l?l.toISOString():null;t.onFieldChange(a)};return r||s?m.jsx(Ss,{valueFormat:"DD-MMM-YYYY hh:mm A",value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(Ss,{value:o,valueFormat:"DD-MMM-YYYY hh:mm A",onChange:i,required:n.required,placeholder:n.placeholder,error:void 0})}function Gp({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.NumberInput,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.NumberInput,{...t,onChange:o=>t.onFieldChange(Number(o)),required:n.required,placeholder:n.placeholder,error:void 0})}function Xp({field:n,form:e,layout:t="vertical"}){var s;const r=n;return m.jsx(m.Fragment,{children:(s=r.fields)==null?void 0:s.map(o=>m.jsx(ta,{field:{...o,name:`${n.name}.${o.name}`},form:e,layout:t},`${n.name}.${o.name}`))})}var Zr={exports:{}},Ko={};/**
|
|
31
|
+
* @license React
|
|
32
|
+
* use-sync-external-store-shim.production.js
|
|
33
|
+
*
|
|
34
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/var Sa;function Qp(){if(Sa)return Ko;Sa=1;var n=T;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,s=n.useEffect,o=n.useLayoutEffect,i=n.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),g=p[0].inst,y=p[1];return o(function(){g.value=h,g.getSnapshot=f,a(g)&&y({inst:g})},[d,h,f]),s(function(){return a(g)&&y({inst:g}),d(function(){a(g)&&y({inst:g})})},[d]),i(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 Ko.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Ko}var Yo={};/**
|
|
39
|
+
* @license React
|
|
40
|
+
* use-sync-external-store-shim.development.js
|
|
41
|
+
*
|
|
42
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the MIT license found in the
|
|
45
|
+
* LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/var Ca;function Zp(){return Ca||(Ca=1,process.env.NODE_ENV!=="production"&&function(){function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=p();if(!d){var y=p();o(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=i({inst:{value:g,getSnapshot:p}});var b=y[0].inst,k=y[1];return a(function(){b.value=g,b.getSnapshot=p,t(b)&&k({inst:b})},[h,g,p]),l(function(){return t(b)&&k({inst:b}),h(function(){t(b)&&k({inst:b})})},[h]),c(g),g}function t(h){var p=h.getSnapshot;h=h.value;try{var g=p();return!o(h,g)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=T,o=typeof Object.is=="function"?Object.is:n,i=s.useState,l=s.useEffect,a=s.useLayoutEffect,c=s.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;Yo.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Yo}var Ma;function fl(){return Ma||(Ma=1,process.env.NODE_ENV==="production"?Zr.exports=Qp():Zr.exports=Zp()),Zr.exports}var Su=fl();function Ve(n){this.content=n}Ve.prototype={constructor:Ve,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,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new Ve(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 Ve(t)},addToStart:function(n,e){return new Ve([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ve(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new Ve(s)},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=Ve.from(n),n.size?new Ve(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ve.from(n),n.size?new Ve(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ve.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}};Ve.from=function(n){if(n instanceof Ve)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ve(e)};function Cu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=Cu(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function Mu(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=Mu(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class D{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,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!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,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new D(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new D(r,s)}cutByIndex(e,t){return e==t?D.empty:e==0&&t==this.content.length?this:new D(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new D(s,o)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(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 s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Cu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Mu(this,e,t,r)}findIndex(e){if(e==0)return es(0,e);if(e==this.size)return es(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?es(t+1,o):es(t,r);r=o}}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 D.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new D(t||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const Jo={index:0,offset:0};function es(n,e){return Jo.index=n,Jo.offset=e,Jo}function Cs(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(!Cs(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Cs(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Se=class Ni{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),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&&Cs(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 s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}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 Ni.none;if(e instanceof Ni)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Se.none=[];class Ms extends Error{}class z{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Eu(this.content,e+this.openStart,t);return r&&new z(r,this.openStart,this.openEnd)}removeBetween(e,t){return new z(wu(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 z.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new z(D.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=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)s++;return new z(e,r,s)}}z.empty=new z(D.empty,0,0);function wu(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(wu(o.content,e-s-1,t-s-1)))}function Eu(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Eu(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function em(n,e,t){if(t.openStart>n.depth)throw new Ms("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ms("Inconsistent open depths");return Tu(n,e,t,0)}function Tu(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=Tu(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Mn(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=tm(t,n);return Mn(o,Du(n,i,l,e,r))}else return Mn(o,ws(n,e,r))}function Ou(n,e){if(!e.type.compatibleContent(n.type))throw new Ms("Cannot join "+e.type.name+" onto "+n.type.name)}function Ri(n,e,t){let r=n.node(t);return Ou(r,e.node(t)),r}function Cn(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 gr(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Cn(n.nodeAfter,r),o++));for(let l=o;l<i;l++)Cn(s.child(l),r);e&&e.depth==t&&e.textOffset&&Cn(e.nodeBefore,r)}function Mn(n,e){return n.type.checkContent(e),n.copy(e)}function Du(n,e,t,r,s){let o=n.depth>s&&Ri(n,e,s+1),i=r.depth>s&&Ri(t,r,s+1),l=[];return gr(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(Ou(o,i),Cn(Mn(o,Du(n,e,t,r,s+1)),l)):(o&&Cn(Mn(o,ws(n,e,s+1)),l),gr(e,t,s,l),i&&Cn(Mn(i,ws(t,r,s+1)),l)),gr(r,null,s,l),new D(l)}function ws(n,e,t){let r=[];if(gr(null,n,t,r),n.depth>t){let s=Ri(n,e,t+1);Cn(Mn(s,ws(n,e,t+1)),r)}return gr(e,null,t,r),new D(r)}function tm(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(D.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Tr{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],s=e.child(t);return r?e.child(t).cut(r):s}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],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.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 Es(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=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new Tr(t,r,o)}static resolveCached(e,t){let r=wa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else wa.set(e,r=new nm);let s=r.elts[r.i]=Tr.resolve(e,t);return r.i=(r.i+1)%rm,s}}class nm{constructor(){this.elts=[],this.i=0}}const rm=12,wa=new WeakMap;class Es{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 sm=Object.create(null);class kt{constructor(e,t,r,s=Se.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||D.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,s=0){this.content.nodesBetween(e,t,r,s,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,s){return this.content.textBetween(e,t,r,s)}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&&Cs(this.attrs,t||e.defaultAttrs||sm)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new kt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new kt(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 z.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new z(c,s.depth-i,o.depth-i)}replace(e,t,r){return em(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+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 s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Tr.resolveCached(this,e)}resolveNoCache(e){return Tr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}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()+")"),Au(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=D.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Se.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(!Se.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 s=D.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}kt.prototype.text=void 0;class Ts extends kt{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Au(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 Ts(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ts(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 Au(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class On{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new om(e,t);if(r.next==null)return On.empty;let s=Nu(r);r.next&&r.err("Unexpected trailing text");let o=fm(dm(s));return hm(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 s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}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 s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return D.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.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 s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),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 s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
47
|
+
`)}}On.empty=new On(!0);class om{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 Nu(n){let e=[];do e.push(im(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function im(n){let e=[];do e.push(lm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function lm(n){let e=um(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=am(n,e);else break;return e}function Ea(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function am(n,e){let t=Ea(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ea(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function cm(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let o in t){let i=t[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function um(n){if(n.eat("(")){let e=Nu(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=cm(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 dm(n){let e=[[]];return s(o(n,0),t()),e;function t(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function o(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=o(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=t())}else if(i.type=="star"){let a=t();return r(l,a),s(o(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=t();return s(o(i.expr,l),a),s(o(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(o(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=t();s(o(i.expr,a),u),a=u}if(i.max==-1)s(o(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=t();r(a,u),s(o(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Ru(n,e){return e-n}function Ta(n,e){let t=[];return r(e),t.sort(Ru);function r(s){let o=n[s];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(s);for(let i=0;i<o.length;i++){let{term:l,to:a}=o[i];!l&&t.indexOf(a)==-1&&r(a)}}}function fm(n){let e=Object.create(null);return t(Ta(n,0));function t(r){let s=[];r.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Ta(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new On(r.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(Ru);o.next.push({type:s[i][0],next:e[l.join(",")]||t(l)})}return o}}function hm(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],o=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Lu(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 Iu(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let o=n[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function ju(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let o=n[s];o.validate&&o.validate(e[s])}}function Pu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new mm(n,r,e[r]);return t}let Oa=class _u{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=Pu(e,r.attrs),this.defaultAttrs=Lu(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==On.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:Iu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new kt(this,this.computeAttrs(e),D.from(t),Se.setFrom(r))}createChecked(e=null,t,r){return t=D.from(t),this.checkContent(t),new kt(this,this.computeAttrs(e),t,Se.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=D.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let s=this.contentMatch.matchFragment(t),o=s&&s.fillBefore(D.empty,!0);return o?new kt(this,e,t.append(o),Se.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){ju(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:Se.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,i)=>r[o]=new _u(o,t,i));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");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 pm(n,e,t){let r=t.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class mm{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?pm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Mo{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Pu(e,s.attrs),this.excluded=null;let o=Lu(this.attrs);this.instance=o?new Se(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Se(this,Iu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new Mo(o,s++,t,i)),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){ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Bu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ve.from(e.nodes),t.marks=Ve.from(e.marks||{}),this.nodes=Oa.compile(this.spec.nodes,this),this.marks=Mo.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=On.parse(i,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?Da(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:Da(this,i.split(" "))}this.nodeFromJSON=s=>kt.fromJSON(this,s),this.markFromJSON=s=>Se.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Oa){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,s)}text(e,t){let r=this.nodes.text;return new Ts(r,r.defaultAttrs,e,Se.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Da(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],o=n.marks[s],i=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function gm(n){return n.tag!=null}function ym(n){return n.style!=null}class en{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(gm(s))this.tags.push(s);else if(ym(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new Na(this,t,!1);return r.addAll(e,Se.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Na(this,t,!0);return r.addAll(e,Se.none,t.from,t.to),z.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(km(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,t,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<o)break}t.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=Ra(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=Ra(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new en(e,en.schemaRules(e)))}}const zu={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},bm={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Fu={ol:!0,ul:!0},Or=1,Li=2,ms=4;function Aa(n,e,t){return e!=null?(e?Or:0)|(e==="full"?Li:0):n&&n.whitespace=="pre"?Or|Li:t&-5}class ts{constructor(e,t,r,s,o,i){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=Se.none,this.match=o||(i&ms?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(D.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Or)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let t=D.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(D.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&&!zu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Na{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,o,i=Aa(null,t.preserveWhitespace,0)|(r?ms:0);s?o=new ts(s.type,s.attrs,Se.none,!0,t.topMatch||s.type.contentMatch,i):r?o=new ts(null,null,Se.none,!0,null,i):o=new ts(e.schema.topNodeType,null,Se.none,!0,null,i),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,s=this.top,o=s.options&Li?"full":this.localPreserveWS||(s.options&Or)>0;if(o==="full"||s.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,`
|
|
48
|
+
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let i=s.content[s.content.length-1],l=e.previousSibling;(!i||l&&l.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;Fu.hasOwnProperty(i)&&this.parser.normalizeLists&&xm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:bm.hasOwnProperty(i))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(zu.hasOwnProperty(i))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=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
49
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(o,i,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,s){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,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(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));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,s){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];i!=l;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,r){let s,o;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)t=this.enterInner(s[i],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=Se.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):La(l.type,e.type))&&(i=l.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,r,s){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,s)),o}enterInner(e,t,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=Aa(e,o,i.options);i.options&ms&&i.content.length==0&&(l|=ms);let a=Se.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):La(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new ts(e,t,a,s,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|=Or)}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 s=r.length-1;s>=0;s--)e+=r[s].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 s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(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(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?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 i(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 xm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Fu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function km(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Ra(n){let e={};for(let t in n)e[t]=n[t];return e}function La(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let o=[],i=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&&i(u))return!0}};if(i(s.contentMatch))return!0}}class Ln{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Go(t).createDocumentFragment());let s=r,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let l=0,a=0;for(;l<o.length&&a<i.marks.length;){let c=i.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;)s=o.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,t);u&&(o.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(i,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=gs(Go(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&gs(Go(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return gs(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ln(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ia(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Ia(e.marks)}}function Ia(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Go(n){return n.document||window.document}const ja=new WeakMap;function vm(n){let e=ja.get(n);return e===void 0&&ja.set(n,e=Sm(n)),e}function Sm(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 s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function gs(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 s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=vm(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 i=s.indexOf(" ");i>0&&(t=s.slice(0,i),s=s.slice(i+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=gs(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 $u=65535,Vu=Math.pow(2,16);function Cm(n,e){return n+e*Vu}function Pa(n){return n&$u}function Mm(n){return(n-(n&$u))/Vu}const Hu=1,Wu=2,ys=4,Uu=8;class Ii{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Uu)>0}get deletedBefore(){return(this.delInfo&(Hu|ys))>0}get deletedAfter(){return(this.delInfo&(Wu|ys))>0}get deletedAcross(){return(this.delInfo&ys)>0}}class lt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&<.empty)return lt.empty}recover(e){let t=0,r=Pa(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Mm(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 s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+i],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Cm(l/3,e-a),g=e==a?Wu:e==d?Hu:ys;return(t<0?e!=a:e!=d)&&(g|=Uu),new Ii(h,g,p)}s+=u-c}return r?e+s:new Ii(e+s,0,null)}touches(e,t){let r=0,s=Pa(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new lt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?lt.empty:new lt(e<0?[0,-e,0]:[0,0,e])}}lt.empty=new lt([]);class Dr{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Dr(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 s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s: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 s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Dr;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 s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],l=i.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}}s|=l.delInfo,e=l.pos}return r?e:new Ii(e,s,null)}}const Xo=Object.create(null);class Ge{getMap(){return lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Xo[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 Xo)throw new RangeError("Duplicate use of step JSON ID "+e);return Xo[e]=t,t.prototype.jsonID=e,t}}class je{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new je(e,null)}static fail(e){return new je(null,e)}static fromReplace(e,t,r,s){try{return je.ok(e.replace(t,r,s))}catch(o){if(o instanceof Ms)return je.fail(o.message);throw o}}}function hl(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(hl(o.content,e,o))),o.isInline&&(o=e(o,t,s)),r.push(o)}return D.fromArray(r)}class Xt extends Ge{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),s=r.node(r.sharedDepth(this.to)),o=new z(hl(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),t.openStart,t.openEnd);return je.fromReplace(e,this.from,this.to,o)}invert(){return new xt(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 Xt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Xt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xt(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 Xt(t.from,t.to,e.markFromJSON(t.mark))}}Ge.jsonID("addMark",Xt);class xt extends Ge{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 z(hl(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return je.fromReplace(e,this.from,this.to,r)}invert(){return new Xt(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 xt(t.pos,r.pos,this.mark)}merge(e){return e instanceof xt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xt(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 xt(t.from,t.to,e.markFromJSON(t.mark))}}Ge.jsonID("removeMark",xt);class Qt extends Ge{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return je.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return je.fromReplace(e,this.pos,this.pos+1,new z(D.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 s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Qt(this.pos,t.marks[s]);return new Qt(this.pos,this.mark)}}return new Dn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Qt(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 Qt(t.pos,e.markFromJSON(t.mark))}}Ge.jsonID("addNodeMark",Qt);class Dn extends Ge{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return je.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return je.fromReplace(e,this.pos,this.pos+1,new z(D.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Qt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Dn(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 Dn(t.pos,e.markFromJSON(t.mark))}}Ge.jsonID("removeNodeMark",Dn);class _e extends Ge{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&ji(e,this.from,this.to)?je.fail("Structure replace would overwrite content"):je.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new lt([this.from,this.to-this.from,this.slice.size])}invert(e){return new _e(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 _e(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _e)||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?z.empty:new z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _e(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?z.empty:new z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _e(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 _e(t.from,t.to,z.fromJSON(e,t.slice),!!t.structure)}}Ge.jsonID("replace",_e);class Be extends Ge{constructor(e,t,r,s,o,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=l}apply(e){if(this.structure&&(ji(e,this.from,this.gapFrom)||ji(e,this.gapTo,this.to)))return je.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return je.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?je.fromReplace(e,this.from,this.to,r):je.fail("Content does not fit in gap")}getMap(){return new lt([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 Be(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),s=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||s<t.pos||o>r.pos?null:new Be(t.pos,r.pos,s,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 Be(t.from,t.to,t.gapFrom,t.gapTo,z.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ge.jsonID("replaceAround",Be);function ji(n,e,t){let r=n.resolve(e),s=t-e,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function wm(n,e,t,r){let s=[],o=[],i,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 g=0;g<d.length;g++)d[g].isInSet(p)||(i&&i.to==f&&i.mark.eq(d[g])?i.to=h:s.push(i=new xt(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new Xt(f,h,r))}}),s.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Em(n,e,t,r){let s=[],o=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof Mo){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==o-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=o):s.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),s.forEach(i=>n.step(new xt(i.from,i.to,i.style)))}function pl(n,e,t,r=t.contentMatch,s=!0){let o=n.doc.nodeAt(e),i=[],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)i.push(new _e(l,u,z.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new xt(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new z(D.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new _e(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(D.empty,!0);n.replace(l,l,new z(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function Tm(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function er(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let s=n.$from.node(r),o=n.$from.index(r),i=n.$to.indexAfter(r);if(r<n.depth&&s.canReplace(o,i,t))return r;if(r==0||s.type.spec.isolating||!Tm(s,o,i))break}return null}function Om(n,e,t){let{$from:r,$to:s,depth:o}=e,i=r.before(o+1),l=s.after(o+1),a=i,c=l,u=D.empty,d=0;for(let p=o,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=D.from(r.node(p).copy(u)),d++):a--;let f=D.empty,h=0;for(let p=o,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,f=D.from(s.node(p).copy(f)),h++):c++;n.step(new Be(a,c,i,l,new z(u.append(f),d,h),u.size-d,!0))}function ml(n,e,t=null,r=n){let s=Dm(n,e),o=s&&Am(r,e);return o?s.map(_a).concat({type:e,attrs:t}).concat(o.map(_a)):null}function _a(n){return{type:n,attrs:null}}function Dm(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return t.canReplaceWith(r,s,i)?o:null}function Am(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.child(r),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:i}function Nm(n,e,t){let r=D.empty;for(let i=t.length-1;i>=0;i--){if(r.size){let l=t[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=D.from(t[i].type.create(t[i].attrs,r))}let s=e.start,o=e.end;n.step(new Be(s,o,s,o,new z(r,0,0),t.length,!0))}function Rm(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,a)&&Lm(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&&Ku(n,i,l,o),pl(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+i.nodeSize,1);return n.step(new Be(d,f,d+1,f-1,new z(D.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&qu(n,i,l,o),!1}})}function qu(n,e,t,r){e.forEach((s,o)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+o+i.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Ku(n,e,t,r){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=n.mapping.slice(r).map(t+1+o);n.replaceWith(i,i+1,e.type.schema.text(`
|
|
50
|
+
`))}})}function Lm(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function Im(n,e,t,r,s){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let i=t.create(r,null,s||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,i);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Be(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new z(D.from(i),0,0),1,!0))}function Bt(n,e,t=1,r){let s=n.resolve(e),o=s.depth-t,i=r&&r[r.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!i.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=t-2;c>o;c--,u--){let d=s.node(c),f=s.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 g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let l=s.indexAfter(o),a=r&&r[0];return s.node(o).canReplaceWith(l,l,a?a.type:s.node(o+1).type)}function jm(n,e,t=1,r){let s=n.doc.resolve(e),o=D.empty,i=D.empty;for(let l=s.depth,a=s.depth-t,c=t-1;l>a;l--,c--){o=D.from(s.node(l).copy(o));let u=r&&r[c];i=D.from(u?u.type.create(u.attrs,i):s.node(l).copy(i))}n.step(new _e(e,e,new z(o.append(i),t,t),!0))}function un(n,e){let t=n.resolve(e),r=t.index();return Yu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Pm(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let o=e.child(s),i=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(i),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function Yu(n,e){return!!(n&&e&&!n.isLeaf&&Pm(n,e))}function wo(n,e,t=-1){let r=n.resolve(e);for(let s=r.depth;;s--){let o,i,l=r.index(s);if(s==r.depth?(o=r.nodeBefore,i=r.nodeAfter):t>0?(o=r.node(s+1),l++,i=r.node(s).maybeChild(l)):(o=r.node(s).maybeChild(l-1),i=r.node(s+1)),o&&!o.isTextblock&&Yu(o,i)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function _m(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,o=n.doc.resolve(e-t),i=o.node().type;if(s&&i.inlineContent){let u=i.whitespace=="pre",d=!!i.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Ku(n,u.node(),u.before(),l)}i.inlineContent&&pl(n,e+t-1,i,o.node().contentMatchAt(o.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new _e(c,a.map(e+t,-1),z.empty,!0)),r===!0){let u=n.doc.resolve(c);qu(n,u.node(),u.before(),n.steps.length)}return n}function Bm(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 s=r.depth-1;s>=0;s--){let o=r.index(s);if(r.node(s).canReplaceWith(o,o,t))return r.before(s+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let o=r.indexAfter(s);if(r.node(s).canReplaceWith(o,o,t))return r.after(s+1);if(o<r.node(s).childCount)return null}return null}function Ju(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let o=0;o<t.openStart;o++)s=s.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),c=r.node(i),u=!1;if(o==1)u=c.canReplace(a,a,s);else{let d=c.contentMatchAt(a).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function Eo(n,e,t=e,r=z.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),o=n.resolve(t);return Gu(s,o,r)?new _e(e,t,r):new zm(s,o,r).fit()}function Gu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class zm{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=D.empty;for(let s=0;s<=e.depth;s++){let o=e.node(s);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=D.from(e.node(s).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,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let o=this.placed,i=r.depth,l=s.depth;for(;i&&l&&o.childCount==1;)o=o.firstChild.content,i--,l--;let a=new z(o,i,l);return e>-1?new Be(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new _e(r.pos,s.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(s=0),o.type.spec.isolating&&s<=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 s,o=null;r?(o=Qo(this.unplaced.content,r-1).firstChild,s=o.content):s=this.unplaced.content;let i=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(i?c.matchType(i.type)||(d=c.fillBefore(D.from(i),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:d};if(t==2&&i&&(u=c.findWrapping(i.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,s=Qo(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new z(e,t+1,Math.max(r,s.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=Qo(e,t);if(s.childCount<=1&&t>0){let o=e.size-t<=t+s.size;this.unplaced=new z(fr(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new z(fr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(s){for(let g=0;g<s.childCount;g++)u.push(s.child(g));d=d.matchFragment(s)}let h=l.size+e-(i.content.size-i.openEnd);for(;c<l.childCount;){let g=l.child(c),y=d.matchType(g.type);if(!y)break;c++,(c>1||a==0||g.content.size)&&(d=y,u.push(Xu(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=hr(this.placed,t,D.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 g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=p?e==0?z.empty:new z(fr(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new z(fr(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Zo(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,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Zo(e,t,s,r,o);if(i){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Zo(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:i,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=hr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let s=e.node(r),o=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,o)}return e}openFrontierNode(e,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=hr(this.placed,this.depth,D.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(D.empty,!0);t.childCount&&(this.placed=hr(this.placed,this.frontier.length,t))}}function fr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(fr(n.firstChild.content,e-1,t)))}function hr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(hr(n.lastChild.content,e-1,t)))}function Qo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Xu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Xu(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(D.empty,!0)))),n.copy(r)}function Zo(n,e,t,r,s){let o=n.node(e),i=s?n.indexAfter(e):n.index(e);if(i==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,i);return l&&!Fm(t,o.content,i)?l:null}function Fm(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function $m(n){return n.spec.defining||n.spec.definingForContent}function Vm(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),o=n.doc.resolve(t);if(Gu(s,o,r))return n.step(new _e(e,t,r));let i=Zu(s,n.doc.resolve(t));i[i.length-1]==0&&i.pop();let l=-(s.depth+1);i.unshift(l);for(let f=s.depth,h=s.pos-1;f>0;f--,h--){let p=s.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;i.indexOf(f)>-1?l=f:s.before(f)==h&&i.splice(1,0,-f)}let a=i.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=$m(h.type);if(p&&!h.sameMarkup(s.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 g=0;g<i.length;g++){let y=i[(g+a)%i.length],b=!0;y<0&&(b=!1,y=-y);let k=s.node(y-1),C=s.index(y-1);if(k.canReplaceWith(C,C,p.type,p.marks))return n.replace(s.before(y),b?o.after(y):t,new z(Qu(r.content,0,r.openStart,h),h,r.openEnd))}}let d=n.steps.length;for(let f=i.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=i[f];h<0||(e=s.before(h),t=o.after(h))}}function Qu(n,e,t,r,s){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Qu(o.content,e+1,t,r,o)))}if(e>r){let o=s.contentMatchAt(0),i=o.fillBefore(n).append(n);n=i.append(o.matchFragment(i).fillBefore(D.empty,!0))}return n}function Hm(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=Bm(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new z(D.from(r),0,0))}function Wm(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t),o=Zu(r,s);for(let i=0;i<o.length;i++){let l=o[i],a=i==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),s.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return n.delete(r.before(l),s.after(l))}for(let i=1;i<=r.depth&&i<=s.depth;i++)if(e-r.start(i)==r.depth-i&&t>r.end(i)&&s.end(i)-t!=s.depth-i&&r.start(i-1)==s.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),s.index(i-1)))return n.delete(r.before(i),t);n.delete(e,t)}function Zu(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let o=n.start(s);if(o<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(o==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==o-1)&&t.push(s)}return t}class qn extends Ge{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 je.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 s=t.type.create(r,null,t.marks);return je.fromReplace(e,this.pos,this.pos+1,new z(D.from(s),0,t.isLeaf?0:1))}getMap(){return lt.empty}invert(e){return new qn(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 qn(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 qn(t.pos,t.attr,t.value)}}Ge.jsonID("attr",qn);class Ar extends Ge{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return je.ok(r)}getMap(){return lt.empty}invert(e){return new Ar(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 Ar(t.attr,t.value)}}Ge.jsonID("docAttr",Ar);let Yn=class extends Error{};Yn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Yn.prototype=Object.create(Error.prototype);Yn.prototype.constructor=Yn;Yn.prototype.name="TransformError";class ed{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Dr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Yn(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=z.empty){let s=Eo(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new z(D.from(r),0,0))}delete(e,t){return this.replace(e,t,z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Vm(this,e,t,r),this}replaceRangeWith(e,t,r){return Hm(this,e,t,r),this}deleteRange(e,t){return Wm(this,e,t),this}lift(e,t){return Om(this,e,t),this}join(e,t=1){return _m(this,e,t),this}wrap(e,t){return Nm(this,e,t),this}setBlockType(e,t=e,r,s=null){return Rm(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return Im(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new qn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Ar(e,t)),this}addNodeMark(e,t){return this.step(new Qt(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Se)t.isInSet(r.marks)&&this.step(new Dn(e,t));else{let s=r.marks,o,i=[];for(;o=t.isInSet(s);)i.push(new Dn(e,o)),s=o.removeFromSet(s);for(let l=i.length-1;l>=0;l--)this.step(i[l])}return this}split(e,t=1,r){return jm(this,e,t,r),this}addMark(e,t,r){return wm(this,e,t,r),this}removeMark(e,t,r){return Em(this,e,t,r),this}clearIncompatible(e,t,r){return pl(this,e,t,r),this}}const ei=Object.create(null);class ie{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Um(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=z.empty){let r=t.content.lastChild,s=null;for(let l=0;l<t.openEnd;l++)s=r,r=r.lastChild;let o=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:c}=i[l],u=e.mapping.slice(o);e.replaceRange(u.map(a.pos),u.map(c.pos),l?z.empty:t),l==0&&Fa(e,o,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:i,$to:l}=s[o],a=e.mapping.slice(r),c=a.map(i.pos),u=a.map(l.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Fa(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new ee(e):Fn(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let o=e.depth-1;o>=0;o--){let i=t<0?Fn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Fn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new at(e.node(0))}static atStart(e){return Fn(e,e,0,0,1)||new at(e)}static atEnd(e){return Fn(e,e,e.content.size,e.childCount,-1)||new at(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ei[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ei)throw new RangeError("Duplicate use of selection JSON ID "+e);return ei[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ee.between(this.$anchor,this.$head).getBookmark()}}ie.prototype.visible=!0;class Um{constructor(e,t){this.$from=e,this.$to=t}}let Ba=!1;function za(n){!Ba&&!n.parent.inlineContent&&(Ba=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ee extends ie{constructor(e,t=e){za(e),za(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 ie.near(r);let s=e.resolve(t.map(this.anchor));return new ee(s.parent.inlineContent?s:r,r)}replace(e,t=z.empty){if(super.replace(e,t),t==z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ee&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new To(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 ee(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let o=ie.findFrom(t,r,!0)||ie.findFrom(t,-r,!0);if(o)t=o.$head;else return ie.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(ie.findFrom(e,-r,!0)||ie.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new ee(e,t)}}ie.jsonID("text",ee);class To{constructor(e,t){this.anchor=e,this.head=t}map(e){return new To(e.map(this.anchor),e.map(this.head))}resolve(e){return ee.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends ie{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:s}=t.mapResult(this.anchor),o=e.resolve(s);return r?ie.near(o):new Y(o)}content(){return new z(D.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new gl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(t.anchor))}static create(e,t){return new Y(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1;ie.jsonID("node",Y);class gl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new To(r,r):new gl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Y.isSelectable(r)?new Y(t):ie.near(t)}}class at extends ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=z.empty){if(t==z.empty){e.delete(0,e.doc.content.size);let r=ie.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new at(e)}map(e){return new at(e)}eq(e){return e instanceof at}getBookmark(){return qm}}ie.jsonID("all",at);const qm={map(){return this},resolve(n){return new at(n)}};function Fn(n,e,t,r,s,o=!1){if(e.inlineContent)return ee.create(n,t);for(let i=r-(s>0?0:1);s>0?i<e.childCount:i>=0;i+=s){let l=e.child(i);if(l.isAtom){if(!o&&Y.isSelectable(l))return Y.create(n,t-(s<0?l.nodeSize:0))}else{let a=Fn(n,l,t+s,s<0?l.childCount:0,s,o);if(a)return a}t+=l.nodeSize*s}return null}function Fa(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof _e||s instanceof Be))return;let o=n.mapping.maps[r],i;o.forEach((l,a,c,u)=>{i==null&&(i=u)}),n.setSelection(ie.near(n.doc.resolve(i),t))}const $a=1,Va=2,Ha=4;class Km extends ed{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|$a)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&$a)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Va,this}ensureMarks(e){return Se.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&Va)>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)||Se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.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 i=this.doc.resolve(t);o=r==t?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,o)),this.selection.empty||this.setSelection(ie.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|=Ha,this}get scrolledIntoView(){return(this.updated&Ha)>0}}function Wa(n,e){return!e||!n?n:n.bind(e)}class pr{constructor(e,t,r){this.name=e,this.init=Wa(t.init,r),this.apply=Wa(t.apply,r)}}const Ym=[new pr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new pr("selection",{init(n,e){return n.selection||ie.atStart(e.doc)},apply(n){return n.selection}}),new pr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new pr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class ti{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ym.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 pr(r.key,r.spec.state,r))})}}class Un{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 s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),s=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=s?s[i].n:0,c=s?s[i].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<i?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}s&&(s[i]={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 Un(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let o=r[s];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Km(this)}static create(e){let t=new ti(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Un(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new ti(this.schema,e.plugins),r=t.fields,s=new Un(t);for(let o=0;o<r.length;o++){let i=r[o].name;s[i]=this.hasOwnProperty(i)?this[i]:r[o].init(e,s)}return s}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 s=e[r],o=s.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(s,this[s.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 s=new ti(e.schema,e.plugins),o=new Un(s);return s.fields.forEach(i=>{if(i.name=="doc")o.doc=kt.fromJSON(e.schema,t.doc);else if(i.name=="selection")o.selection=ie.fromJSON(o.doc,t.selection);else if(i.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==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[i.name]=c.fromJSON.call(a,e,t[l],o);return}}o[i.name]=i.init(e,o)}}),o}}function td(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=td(s,e,{})),t[r]=s}return t}class Ne{constructor(e){this.spec=e,this.props={},e.props&&td(e.props,this,this.props),this.key=e.key?e.key.key:nd("plugin")}getState(e){return e[this.key]}}const ni=Object.create(null);function nd(n){return n in ni?n+"$"+ ++ni[n]:(ni[n]=0,n+"$")}class Fe{constructor(e="key"){this.key=nd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const He=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Jn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Pi=null;const Pt=function(n,e,t){let r=Pi||(Pi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Jm=function(){Pi=null},An=function(n,e,t,r){return t&&(Ua(n,e,t,r,-1)||Ua(n,e,t,r,1))},Gm=/^(img|br|input|textarea|hr)$/i;function Ua(n,e,t,r,s){for(var o;;){if(n==t&&e==r)return!0;if(e==(s<0?0:mt(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Fr(n)||Gm.test(n.nodeName)||n.contentEditable=="false")return!1;e=He(n)+(s<0?0:1),n=i}else if(n.nodeType==1){let i=n.childNodes[e+(s<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((o=i.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=s;else return!1;else n=i,e=s<0?mt(n):0}else return!1}}function mt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Xm(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=mt(n)}else if(n.parentNode&&!Fr(n))e=He(n),n=n.parentNode;else return null}}function Qm(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&&!Fr(n))e=He(n)+1,n=n.parentNode;else return null}}function Zm(n,e,t){for(let r=e==0,s=e==mt(n);r||s;){if(n==t)return!0;let o=He(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,s=s&&o==mt(n)}}function Fr(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 Oo=function(n){return n.focusNode&&An(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function bn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function eg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function tg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(mt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(mt(r.startContainer),r.startOffset)}}}const Tt=typeof navigator<"u"?navigator:null,qa=typeof document<"u"?document:null,dn=Tt&&Tt.userAgent||"",_i=/Edge\/(\d+)/.exec(dn),rd=/MSIE \d/.exec(dn),Bi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn),ot=!!(rd||Bi||_i),tn=rd?document.documentMode:Bi?+Bi[1]:_i?+_i[1]:0,gt=!ot&&/gecko\/(\d+)/i.test(dn);gt&&+(/Firefox\/(\d+)/.exec(dn)||[0,0])[1];const zi=!ot&&/Chrome\/(\d+)/.exec(dn),Je=!!zi,sd=zi?+zi[1]:0,Ze=!ot&&!!Tt&&/Apple Computer/.test(Tt.vendor),Gn=Ze&&(/Mobile\/\w+/.test(dn)||!!Tt&&Tt.maxTouchPoints>2),pt=Gn||(Tt?/Mac/.test(Tt.platform):!1),ng=Tt?/Win/.test(Tt.platform):!1,_t=/Android \d/.test(dn),$r=!!qa&&"webkitFontSmoothing"in qa.documentElement.style,rg=$r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function sg(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 Rt(n,e){return typeof n=="number"?n:n[e]}function og(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 Ka(n,e,t){let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let i=t||n.dom;i;){if(i.nodeType!=1){i=Jn(i);continue}let l=i,a=l==o.body,c=a?sg(o):og(l),u=0,d=0;if(e.top<c.top+Rt(r,"top")?d=-(c.top-e.top+Rt(s,"top")):e.bottom>c.bottom-Rt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Rt(s,"top")-c.top:e.bottom-c.bottom+Rt(s,"bottom")),e.left<c.left+Rt(r,"left")?u=-(c.left-e.left+Rt(s,"left")):e.right>c.right-Rt(r,"right")&&(u=e.right-c.right+Rt(s,"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 g=l.scrollLeft-h,y=l.scrollTop-p;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(f))break;i=f=="absolute"?i.offsetParent:Jn(i)}}function ig(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let o=(e.left+e.right)/2,i=t+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=n.root.elementFromPoint(o,i);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:od(n.dom)}}function od(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Jn(r));return e}function lg({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;id(t,r==0?0:r-e)}function id(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:o}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Bn=null;function ag(n){if(n.setActive)return n.setActive();if(Bn)return n.focus(Bn);let e=od(n);n.focus(Bn==null?{get preventScroll(){return Bn={preventScroll:!0},!0}}:void 0),Bn||(Bn=!1,id(e,0))}function ld(n,e){let t,r=2e8,s,o=0,i=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=Pt(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=i&&p.bottom>=l){i=Math.max(p.bottom,i),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=u,r=g,s=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(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,s=c,r=0),t&&t.nodeType==3?cg(t,s):!t||r&&t.nodeType==1?{node:n,offset:o}:ld(t,s)}function cg(n,e){let t=n.nodeValue.length,r=document.createRange();for(let s=0;s<t;s++){r.setEnd(n,s+1),r.setStart(n,s);let o=Ut(r,1);if(o.top!=o.bottom&&yl(e,o))return{node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function yl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function ug(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function dg(n,e,t){let{node:r,offset:s}=ld(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();o=i.left!=i.right&&t.left>(i.left+i.right)/2?1:-1}return n.docView.posFromDOM(r,s,o)}function fg(n,e,t,r){let s=-1;for(let o=e,i=!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&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!i&&a.left>r.left||a.top>r.top?s=l.posBefore:(!i&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),i=!0),!l.contentDOM&&s<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 s>-1?s:n.docView.posFromDOM(e,t,-1)}function ad(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=s;;){let i=n.childNodes[o];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(yl(e,c))return ad(i,e,c)}}if((o=(o+1)%r)==s)break}return n}function hg(n,e){let t=n.dom.ownerDocument,r,s=0,o=tg(t,e.left,e.top);o&&({node:r,offset:s}=o);let i=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!i||!n.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=n.dom.getBoundingClientRect();if(!yl(e,c)||(i=ad(n.dom,e,c),!i))return null}if(Ze)for(let c=i;r&&c;c=Jn(c))c.draggable&&(r=void 0);if(i=ug(i,e),r){if(gt&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;$r&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=fg(n,r,s,e))}l==null&&(l=dg(n,i,e));let a=n.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ya(n){return n.top<n.bottom||n.left<n.right}function Ut(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ya(r))return r}return Array.prototype.find.call(t,Ya)||n.getBoundingClientRect()}const pg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function cd(n,e,t){let{node:r,offset:s,atom:o}=n.docView.domFromPos(e,t<0?-1:1),i=$r||gt;if(r.nodeType==3)if(i&&(pg.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let a=Ut(Pt(r,s,s),t);if(gt&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Ut(Pt(r,s-1,s-1),-1);if(c.top==a.top){let u=Ut(Pt(r,s,s+1),-1);if(u.top!=a.top)return ur(u,u.left<c.left)}}return a}else{let a=s,c=s,u=t<0?1:-1;return t<0&&!s?(c++,u=-1):t>=0&&s==r.nodeValue.length?(a--,u=1):t<0?a--:c++,ur(Ut(Pt(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&s&&(t<0||s==mt(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return ri(a.getBoundingClientRect(),!1)}if(o==null&&s<mt(r)){let a=r.childNodes[s];if(a.nodeType==1)return ri(a.getBoundingClientRect(),!0)}return ri(r.getBoundingClientRect(),t>=0)}if(o==null&&s&&(t<0||s==mt(r))){let a=r.childNodes[s-1],c=a.nodeType==3?Pt(a,mt(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return ur(Ut(c,1),!1)}if(o==null&&s<mt(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Pt(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return ur(Ut(c,-1),!0)}return ur(Ut(r.nodeType==3?Pt(r):r,-t),t>=0)}function ur(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 ri(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 ud(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function mg(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return ud(n,e,()=>{let{node:o}=n.docView.domFromPos(s.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 i=cd(n,s.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=Pt(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"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const gg=/[\u0590-\u08ac]/;function yg(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,o=!s,i=s==r.parent.content.size,l=n.domSelection();return l?!gg.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:i:ud(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:g}=n.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Ja=null,Ga=null,Xa=!1;function bg(n,e,t){return Ja==e&&Ga==t?Xa:(Ja=e,Ga=t,Xa=t=="up"||t=="down"?mg(n,e,t):yg(n,e,t))}const yt=0,Qa=1,xn=2,Ot=3;class Vr{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=yt,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 s=this.children[t];if(s==e)return r;r+=s.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,i;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(i)+i.size:this.posAtStart}else{let o,i;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(i):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>He(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!1;break}if(o.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!0;break}if(o.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let o=this.getDesc(s),i;if(o&&(!t||o.node))if(r&&(i=o.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==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 s=e;s;s=s.parentNode){let o=this.getDesc(s);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],o=r+s.size;if(r==e&&o!=r){for(;!s.border&&s.children.length;)for(let i=0;i<s.children.length;i++){let l=s.children[i];if(l.size){s=l;break}}return s}if(e<o)return s.descAt(e-r-s.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let o=0;r<this.children.length;r++){let i=this.children[r],l=o+i.size;if(l>e||i instanceof fd){s=e-o;break}o=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof dd&&o.side>=0;r--);if(t<=0){let o,i=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,i=!1);return o&&t&&i&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?He(o.dom)+1:0}}else{let o,i=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,i=!1);return o&&i&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?He(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 s=-1,o=-1;for(let i=r,l=0;;l++){let a=this.children[l],c=i+a.size;if(s==-1&&e<=c){let u=i+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=i;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=He(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-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=He(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:t,fromOffset:s,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,s=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],y=p+g.size;if(o>p&&i<y)return g.setSelection(e-p-g.border,t-p-g.border,r,s);p=y}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((gt||Ze)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
51
|
+
`),d&&p==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:He(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(gt&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||d&&Ze)&&An(l.node,l.offset,u.anchorNode,u.anchorOffset)&&An(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,s=0;s<this.children.length;s++){let o=this.children[s],i=r+o.size;if(r==i?e<=i&&t>=r:e<i&&t>r){let l=r+o.border,a=i-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==i?xn:Qa,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ot:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?xn:Ot}r=i}this.dirty=xn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?xn:Qa;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class dd extends Vr{constructor(e,t,r,s){let o,i=t.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!o)return s;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(i.nodeType!=1){let l=document.createElement("span");l.appendChild(i),i=l}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==yt&&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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class xg extends Vr{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}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 Nn extends Vr{constructor(e,t,r,s,o){super(e,[],r,s),this.mark=t,this.spec=o}static create(e,t,r,s){let o=s.nodeViews[t.type.name],i=o&&o(t,s,r);return(!i||!i.dom)&&(i=Ln.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Nn(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&Ot||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ot&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=yt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=yt}}slice(e,t,r){let s=Nn.create(this.parent,this.mark,!0,r),o=this.children,i=this.size;t<i&&(o=$i(o,t,i,r)),e>0&&(o=$i(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=s;return s.children=o,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class nn extends Vr{constructor(e,t,r,s,o,i,l,a,c){super(e,[],o,i),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,t,r,s,o,i){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)},r,s),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}=Ln.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=md(u,r,t),c?a=new kg(e,t,r,s,u,d||null,f,c,o,i+1):t.isText?new Do(e,t,r,s,u,f,o):new nn(e,t,r,s,u,d||null,f,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let 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=()=>D.empty)}return e}matchesNode(e,t,r){return this.dirty==yt&&e.eq(this.node)&&Os(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,s=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Sg(this,i&&i.node,e);wg(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?Se.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,s)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,s)||a.addNode(c,u,d,e,s),s+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==xn)&&(i&&this.protectLocalComposition(e,i),hd(this.contentDOM,this.children,e),Gn&&Eg(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof ee)||r<t||s>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 i=o.nodeValue,l=Tg(this.node.content,i,r-t,s-t);return l<0?null:{node:o,pos:l,text:i}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){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 i=new xg(this,o,t,s);e.input.compositionNodes.push(i),this.children=$i(this.children,r,r+s.length,e,i)}update(e,t,r,s){return this.dirty==Ot||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=yt}updateOuterDeco(e){if(Os(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=pd(this.dom,this.nodeDOM,Fi(this.outerDeco,this.node,t),Fi(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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Za(n,e,t,r,s){md(r,e,n);let o=new nn(void 0,n,e,t,r,r,r,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class Do extends nn{constructor(e,t,r,s,o,i,l){super(e,t,r,s,o,null,i,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==Ot||this.dirty!=yt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=yt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=yt,!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 s=this.node.cut(e,t),o=document.createTextNode(s.text);return new Do(this.parent,s,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=Ot)}get domAtom(){return!1}isText(e){return this.node.text==e}}class fd extends Vr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==yt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class kg extends nn{constructor(e,t,r,s,o,i,l,a,c,u){super(e,t,r,s,o,i,l,c,u),this.spec=a}update(e,t,r,s){if(this.dirty==Ot)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,s),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}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 hd(n,e,t){let r=n.firstChild,s=!1;for(let o=0;o<e.length;o++){let i=e[o],l=i.dom;if(l.parentNode==n){for(;l!=r;)r=ec(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(l,r);if(i instanceof Nn){let a=r?r.previousSibling:n.lastChild;hd(i.contentDOM,i.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=ec(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const yr=function(n){n&&(this.nodeName=n)};yr.prototype=Object.create(null);const kn=[new yr];function Fi(n,e,t){if(n.length==0)return kn;let r=t?kn[0]:new yr,s=[r];for(let o=0;o<n.length;o++){let i=n[o].type.attrs;if(i){i.nodeName&&s.push(r=new yr(i.nodeName));for(let l in i){let a=i[l];a!=null&&(t&&s.length==1&&s.push(r=new yr(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 s}function pd(n,e,t,r){if(t==kn&&r==kn)return e;let s=e;for(let o=0;o<r.length;o++){let i=r[o],l=t[o];if(o){let a;l&&l.nodeName==i.nodeName&&s!=n&&(a=s.parentNode)&&a.nodeName.toLowerCase()==i.nodeName||(a=document.createElement(i.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=kn[0]),s=a}vg(s,l||kn[0],i)}return s}function vg(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):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)s.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<s.length;o++)r.indexOf(s[o])==-1&&n.classList.add(s[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function md(n,e,t){return pd(n,n,kn,Fi(e,t,n.nodeType!=1))}function Os(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 ec(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Sg{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Cg(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 s=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;s<i&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=yt,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=Nn.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,s){let o=-1,i;if(s>=this.preMatch.index&&(i=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,r))o=this.top.children.indexOf(i,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,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,s,o){let i=this.top.children[s];return i.dirty==Ot&&i.dom==i.contentDOM&&(i.dirty=xn),i.update(e,t,r,o)?(this.destroyBetween(this.index,s),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 s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,o,i){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof nn){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!=Ot&&Os(t,a.outerDeco));if(!f&&a.update(e,t,r,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,s,i)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=xn,d.updateChildren(s,i+1),d.dirty=yt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Os(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=nn.create(this.top,t,r,s,o,i);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,s,o){let i=nn.create(this.top,e,t,r,s,o);i.contentDOM&&i.updateChildren(s,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let o=new dd(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 Nn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Do)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ze||Je)&&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 s=new fd(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Cg(n,e){let t=e,r=t.children.length,s=n.childCount,o=new Map,i=[];e:for(;s>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Nn)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(s-1))break;--s,o.set(l,s),i.push(l)}}return{index:s,matched:o,matches:i.reverse()}}function Mg(n,e){return n.type.side-e.type.side}function wg(n,e,t,r){let s=e.locals(n),o=0;if(s.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,s,e.forChild(o,u),c),o+=u.nodeSize}return}let i=0,l=[],a=null;for(let c=0;;){let u,d;for(;i<s.length&&s[i].to==o;){let y=s[i++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(Mg);for(let y=0;y<d.length;y++)t(d[y],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 y=0;y<l.length;y++)l[y].to<=o&&l.splice(y--,1);for(;i<s.length&&s[i].from<=o&&s[i].to>o;)l.push(s[i++]);let p=o+f.nodeSize;if(f.isText){let y=p;i<s.length&&s[i].from<y&&(y=s[i].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<p&&(a=f.cut(y-o),f=f.cut(0,y-o),p=y,h=-1)}else for(;i<s.length&&s[i].to<p;)i++;let g=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,g,e.forChild(o,f),h),o=p}}function Eg(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 Tg(n,e,t,r){for(let s=0,o=0;s<n.childCount&&o<=r;){let i=n.child(s++),l=o;if(o+=i.nodeSize,!i.isText)continue;let a=i.text;for(;s<n.childCount;){let c=n.child(s++);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 $i(n,e,t,r,s){let o=[];for(let i=0,l=0;i<n.length;i++){let a=n[i],c=l,u=l+=a.size;c>=t||u<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),s&&(o.push(s),s=void 0),u>t&&o.push(a.slice(t-c,a.size,r)))}return o}function bl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),o=s&&s.size==0,i=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(i<0)return null;let l=r.resolve(i),a,c;if(Oo(t)){for(a=i;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&Y.isSelectable(d)&&s.parent&&!(d.isInline&&Zm(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;c=new Y(i==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=i,f=i;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,i]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(i)}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=xl(n,u,l,d)}return c}function gd(n){return n.editable?n.hasFocus():bd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function zt(n,e=!1){let t=n.state.selection;if(yd(n,t),!!gd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Je){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&An(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Dg(n);else{let{anchor:r,head:s}=t,o,i;tc&&!(t instanceof ee)&&(t.$from.parent.inlineContent||(o=nc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(i=nc(n,t.to))),n.docView.setSelection(r,s,n,e),tc&&(o&&rc(o),i&&rc(i)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Og(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const tc=Ze||Je&&sd<63;function nc(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Ze&&s&&s.contentEditable=="false")return si(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return si(s);if(o)return si(o)}}function si(n){return n.contentEditable="true",Ze&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function rc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Og(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!gd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Dg(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,He(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&ot&&tn<=11&&(t.disabled=!0,t.disabled=!1)}function yd(n,e){if(e instanceof Y){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(sc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else sc(n)}function sc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function xl(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||ee.between(e,t,r)}function oc(n){return n.editable&&!n.hasFocus()?!1:bd(n)}function bd(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 Ag(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return An(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Vi(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),o=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return o&&ie.findFrom(o,e)}function qt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ic(n,e,t){let r=n.state.selection;if(r instanceof ee)if(t.indexOf("s")>-1){let{$head:s}=r,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=n.state.doc.resolve(s.pos+o.nodeSize*(e<0?-1:1));return qt(n,new ee(r.$anchor,i))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Vi(n.state,e);return s&&s instanceof Y?qt(n,s):!1}else if(!(pt&&t.indexOf("m")>-1)){let s=r.$head,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,i;if(!o||o.isText)return!1;let l=e<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(i=n.docView.descAt(l))&&!i.contentDOM?Y.isSelectable(o)?qt(n,new Y(e<0?n.state.doc.resolve(s.pos-o.nodeSize):s)):$r?qt(n,new ee(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return qt(n,new ee(e>0?r.$to:r.$from));{let s=Vi(n.state,e);return s?qt(n,s):!1}}}function Ds(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function br(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function zn(n,e){return e<0?Ng(n):Rg(n)}function Ng(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,o,i=!1;for(gt&&t.nodeType==1&&r<Ds(t)&&br(t.childNodes[r],-1)&&(i=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(br(l,-1))s=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(xd(t))break;{let l=t.previousSibling;for(;l&&br(l,-1);)s=t.parentNode,o=He(l),l=l.previousSibling;if(l)t=l,r=Ds(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}i?Hi(n,t,r):s&&Hi(n,s,o)}function Rg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Ds(t),o,i;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(br(l,1))o=t,i=++r;else break}else{if(xd(t))break;{let l=t.nextSibling;for(;l&&br(l,1);)o=l.parentNode,i=He(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=Ds(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}o&&Hi(n,o,i)}function xd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Lg(n,e){for(;n&&e==n.childNodes.length&&!Fr(n);)e=He(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 Ig(n,e){for(;n&&!e&&!Fr(n);)e=He(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 Hi(n,e,t){if(e.nodeType!=3){let o,i;(i=Lg(e,t))?(e=i,t=0):(o=Ig(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Oo(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:s}=n;setTimeout(()=>{n.state==s&&zt(n)},50)}function lc(n,e){let t=n.state.doc.resolve(e);if(!(Je||ng)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function ac(n,e,t){let r=n.state.selection;if(r instanceof ee&&!r.empty||t.indexOf("s")>-1||pt&&t.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let i=Vi(n.state,e);if(i&&i instanceof Y)return qt(n,i)}if(!s.parent.inlineContent){let i=e<0?s:o,l=r instanceof at?ie.near(i,e):ie.findFrom(i,e);return l?qt(n,l):!1}return!1}function cc(n,e){if(!(n.state.selection instanceof ee))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)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 i=n.state.tr;return e<0?i.delete(t.pos-o.nodeSize,t.pos):i.delete(t.pos,t.pos+o.nodeSize),n.dispatch(i),!0}return!1}function uc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function jg(n){if(!Ze||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;uc(n,r,"true"),setTimeout(()=>uc(n,r,"false"),20)}return!1}function Pg(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function _g(n,e){let t=e.keyCode,r=Pg(e);if(t==8||pt&&t==72&&r=="c")return cc(n,-1)||zn(n,-1);if(t==46&&!e.shiftKey||pt&&t==68&&r=="c")return cc(n,1)||zn(n,1);if(t==13||t==27)return!0;if(t==37||pt&&t==66&&r=="c"){let s=t==37?lc(n,n.state.selection.from)=="ltr"?-1:1:-1;return ic(n,s,r)||zn(n,s)}else if(t==39||pt&&t==70&&r=="c"){let s=t==39?lc(n,n.state.selection.from)=="ltr"?1:-1:1;return ic(n,s,r)||zn(n,s)}else{if(t==38||pt&&t==80&&r=="c")return ac(n,-1,r)||zn(n,-1);if(t==40||pt&&t==78&&r=="c")return jg(n)||ac(n,1,r)||zn(n,1);if(r==(pt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function kl(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:s,openEnd:o}=e;for(;s>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,o--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let i=n.someProp("clipboardSerializer")||Ln.fromSchema(n.state.schema),l=wd(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Md[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",`${s} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
52
|
+
|
|
53
|
+
`);return{dom:a,text:f,slice:e}}function kd(n,e,t,r,s){let o=s.parent.type.spec.code,i,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 l=new z(D.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
54
|
+
`))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(d)l=d;else{let f=s.marks(),{schema:h}=n.state,p=Ln.fromSchema(h);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=i.appendChild(document.createElement("p"));g&&y.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),i=$g(t),$r&&Vg(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=i.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;i=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||en.fromSchema(n.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Bg.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Hg(dc(l,+u[1],+u[2]),u[4]);else if(l=z.maxOpen(zg(l.content,s),!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=dc(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const Bg=/^(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 zg(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),o,i=[];if(n.forEach(l=>{if(!i)return;let a=s.findWrapping(l.type),c;if(!a)return i=null;if(c=i.length&&o.length&&Sd(a,o,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Cd(i[i.length-1],o.length));let u=vd(l,a);i.push(u),s=s.matchType(u.type),o=a}}),i)return D.from(i)}return n}function vd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,D.from(n));return n}function Sd(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let o=Sd(n,e,t,r.lastChild,s+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(D.from(vd(t,n,s+1))))}}function Cd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Cd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(D.empty,!0);return n.copy(t.append(r))}function Wi(n,e,t,r,s,o){let i=e<0?n.firstChild:n.lastChild,l=i.content;return n.childCount>1&&(o=0),s<r-1&&(l=Wi(l,e,t,r,s+1,o)),s>=t&&(l=e<0?i.contentMatchAt(0).fillBefore(l,o<=s).append(l):l.append(i.contentMatchAt(i.childCount).fillBefore(D.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,i.copy(l))}function dc(n,e,t){return e<n.openStart&&(n=new z(Wi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new z(Wi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Md={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 fc=null;function wd(){return fc||(fc=document.implementation.createHTMLDocument("title"))}let oi=null;function Fg(n){let e=window.trustedTypes;return e?(oi||(oi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),oi.createHTML(n)):n}function $g(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=wd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Md[r[1].toLowerCase()])&&(n=s.map(o=>"<"+o+">").join("")+n+s.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=Fg(n),s)for(let o=0;o<s.length;o++)t=t.querySelector(s[o])||t;return t}function Vg(n){let e=n.querySelectorAll(Je?"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 Hg(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:s,openStart:o,openEnd:i}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=D.from(a.create(r[l+1],s)),o++,i++}return new z(s,o,i)}const et={},tt={},Wg={touchstart:!0,touchmove:!0};class Ug{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function qg(n){for(let e in et){let t=et[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Yg(n,r)&&!vl(n,r)&&(n.editable||!(r.type in tt))&&t(n,r)},Wg[e]?{passive:!0}:void 0)}Ze&&n.dom.addEventListener("input",()=>null),Ui(n)}function Zt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Kg(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 Ui(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>vl(n,r))})}function vl(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Yg(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 Jg(n,e){!vl(n,e)&&et[e.type]&&(n.editable||!(e.type in tt))&&et[e.type](n,e)}tt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Td(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(_t&&Je&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Gn&&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",s=>s(n,bn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||_g(n,t)?t.preventDefault():Zt(n,"key")};tt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};tt.keypress=(n,e)=>{let t=e;if(Td(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||pt&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ee)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),o=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",i=>i(n,r.$from.pos,r.$to.pos,s,o))&&n.dispatch(o()),t.preventDefault()}};function Ao(n){return{left:n.clientX,top:n.clientY}}function Gg(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Sl(n,e,t,r,s){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let i=o.depth+1;i>0;i--)if(n.someProp(e,l=>i>o.depth?l(n,t,o.nodeAfter,o.before(i),s,!0):l(n,t,o.node(i),o.before(i),s,!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 Xg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(Kn(n,new Y(t)),!0):!1}function Qg(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof Y&&(r=t.node);let o=n.state.doc.resolve(e);for(let i=o.depth+1;i>0;i--){let l=i>o.depth?o.nodeAfter:o.node(i);if(Y.isSelectable(l)){r&&t.$from.depth>0&&i>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?s=o.before(t.$from.depth):s=o.before(i);break}}return s!=null?(Kn(n,Y.create(n.state.doc,s)),!0):!1}function Zg(n,e,t,r,s){return Sl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(s?Qg(n,t):Xg(n,t))}function ey(n,e,t,r){return Sl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function ty(n,e,t,r){return Sl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||ny(n,t,r)}function ny(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Kn(n,ee.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let o=s.depth+1;o>0;o--){let i=o>s.depth?s.nodeAfter:s.node(o),l=s.before(o);if(i.inlineContent)Kn(n,ee.create(r,l+1,l+1+i.content.size));else if(Y.isSelectable(i))Kn(n,Y.create(r,l));else continue;return!0}}function Cl(n){return As(n)}const Ed=pt?"metaKey":"ctrlKey";et.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Cl(n),s=Date.now(),o="singleClick";s-n.input.lastClick.time<500&&Gg(t,n.input.lastClick)&&!t[Ed]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:o,button:t.button};let i=n.posAtCoords(Ao(t));i&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ry(n,i,t,!!r)):(o=="doubleClick"?ey:ty)(n,i.pos,i.inside,t)?t.preventDefault():Zt(n,"pointer"))};class ry{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ed],this.allowDefault=r.shiftKey;let o,i;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,i=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof Y&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&>&&!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)),Zt(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(()=>zt(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(Ao(e))),this.updateAllowDefault(e),this.allowDefault||!t?Zt(this.view,"pointer"):Zg(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ze&&this.mightDrag&&!this.mightDrag.node.isAtom||Je&&!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,ie.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Zt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zt(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)}}et.touchstart=n=>{n.input.lastTouch=Date.now(),Cl(n),Zt(n,"pointer")};et.touchmove=n=>{n.input.lastTouch=Date.now(),Zt(n,"pointer")};et.contextmenu=n=>Cl(n);function Td(n,e){return n.composing?!0:Ze&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const sy=_t?5e3:-1;tt.compositionstart=tt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ee&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),As(n,!0),n.markCursor=null;else if(As(n,!e.selection.empty),gt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,o=r.focusOffset;s&&s.nodeType==1&&o!=0;){let i=o<0?s.lastChild:s.childNodes[o-1];if(!i)break;if(i.nodeType==3){let l=n.domSelection();l&&l.collapse(i,i.nodeValue.length);break}else s=i,o=-1}}n.input.composing=!0}Od(n,sy)};tt.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++,Od(n,20))};function Od(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>As(n),e))}function Dd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=iy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function oy(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Xm(e.focusNode,e.focusOffset),r=Qm(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let i=t.pmViewDesc;if(!(!i||!i.isText(t.nodeValue)))return r}}return t||r}function iy(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function As(n,e=!1){if(!(_t&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Dd(n),e||n.docView&&n.docView.dirty){let t=bl(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function ly(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(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Nr=ot&&tn<15||Gn&&rg<604;et.copy=tt.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let o=Nr?null:t.clipboardData,i=r.content(),{dom:l,text:a}=kl(n,i);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):ly(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ay(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function cy(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 s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Rr(n,r.value,null,s,e):Rr(n,r.textContent,r.innerHTML,s,e)},50)}function Rr(n,e,t,r,s){let o=kd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,s,o||z.empty)))return!0;if(!o)return!1;let i=ay(o),l=i?n.state.tr.replaceSelectionWith(i,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ad(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," "):""}tt.paste=(n,e)=>{let t=e;if(n.composing&&!_t)return;let r=Nr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Rr(n,Ad(r),r.getData("text/html"),s,t)?t.preventDefault():cy(n,t)};class Nd{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const uy=pt?"altKey":"ctrlKey";function Rd(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[uy]}et.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,o=s.empty?null:n.posAtCoords(Ao(t)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof Y?s.to-1:s.to))){if(r&&r.mightDrag)i=Y.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&&(i=Y.create(n.state.doc,d.posBefore))}}let l=(i||n.state.selection).content(),{dom:a,text:c,slice:u}=kl(n,l);(!t.dataTransfer.files.length||!Je||sd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Nr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Nr||t.dataTransfer.setData("text/plain",c),n.dragging=new Nd(u,Rd(n,t),i)};et.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};tt.dragover=tt.dragenter=(n,e)=>e.preventDefault();tt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let s=n.posAtCoords(Ao(t));if(!s)return;let o=n.state.doc.resolve(s.pos),i=r&&r.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=kd(n,Ad(t.dataTransfer),Nr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&Rd(n,t));if(n.someProp("handleDrop",p=>p(n,t,i||z.empty,l))){t.preventDefault();return}if(!i)return;t.preventDefault();let a=i?Ju(n.state.doc,o.pos,i):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=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&Y.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Y(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,y,b,k)=>p=k),c.setSelection(xl(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};et.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())&&zt(n)},20))};et.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)};et.beforeinput=(n,e)=>{if(Je&&_t&&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,bn(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in tt)et[n]=tt[n];function Lr(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 Ns{constructor(e,t){this.toDOM=e,this.spec=t||wn,this.side=this.spec.side||0}map(e,t,r,s){let{pos:o,deleted:i}=e.mapResult(t.from+s,this.side<0?-1:1);return i?null:new Qe(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ns&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Lr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class rn{constructor(e,t){this.attrs=e,this.spec=t||wn}map(e,t,r,s){let o=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,i=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return o>=i?null:new Qe(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof rn&&Lr(this.attrs,e.attrs)&&Lr(this.spec,e.spec)}static is(e){return e.type instanceof rn}destroy(){}}class Ml{constructor(e,t){this.attrs=e,this.spec=t||wn}map(e,t,r,s){let o=e.mapResult(t.from+s,1);if(o.deleted)return null;let i=e.mapResult(t.to+s,-1);return i.deleted||i.pos<=o.pos?null:new Qe(o.pos-r,i.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),o;return s==t.from&&!(o=e.child(r)).isText&&s+o.nodeSize==t.to}eq(e){return this==e||e instanceof Ml&&Lr(this.attrs,e.attrs)&&Lr(this.spec,e.spec)}destroy(){}}class Qe{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Qe(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 Qe(e,e,new Ns(t,r))}static inline(e,t,r,s){return new Qe(e,t,new rn(r,s))}static node(e,t,r,s){return new Qe(e,t,new Ml(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof rn}get widget(){return this.type instanceof Ns}}const $n=[],wn={};class Ee{constructor(e,t){this.local=e.length?e:$n,this.children=t.length?t:$n}static create(e,t){return t.length?Rs(t,e,0,wn):Ye}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,o){for(let i=0;i<this.local.length;i++){let l=this.local[i];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let l=this.children[i]+1;this.children[i+2].findInner(e-l,t-l,r,s+l,o)}}map(e,t,r){return this==Ye||e.maps.length==0?this:this.mapInner(e,t,0,0,r||wn)}mapInner(e,t,r,s,o){let i;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?dy(this.children,i||[],e,t,r,s,o):i?new Ee(i.sort(En),$n):Ye}add(e,t){return t.length?this==Ye?Ee.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,o=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Id(t,l,c)){for(s||(s=this.children.slice());o<s.length&&s[o]<a;)o+=3;s[o]==a?s[o+2]=s[o+2].addInner(l,u,c+1):s.splice(o,0,a,a+l.nodeSize,Rs(u,l,c+1,wn)),o+=3}});let i=Ld(o?jd(t):t,-r);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new Ee(i.length?this.local.concat(i).sort(En):this.local,s||this.children)}remove(e){return e.length==0||this==Ye?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let o=0;o<r.length;o+=3){let i,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,(i||(i=[])).push(d));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(i,l+1);c!=Ye?r[o+2]=c:(r.splice(o,3),o-=3)}if(s.length){for(let o=0,i;o<e.length;o++)if(i=e[o])for(let l=0;l<s.length;l++)s[l].eq(i,t)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Ee(s,r):Ye}forChild(e,t){if(this==Ye)return this;if(t.isLeaf)return Ee.empty;let r,s;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,i=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<i&&a.to>o&&a.type instanceof rn){let c=Math.max(o,a.from)-o,u=Math.min(i,a.to)-o;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new Ee(s.sort(En),$n);return r?new Jt([l,r]):l}return r||Ye}eq(e){if(this==e)return!0;if(!(e instanceof Ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let 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 wl(this.localsInner(e))}localsInner(e){if(this==Ye)return $n;if(e.inlineContent||!this.local.some(rn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof rn||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Ee.empty=new Ee([],[]);Ee.removeOverlap=wl;const Ye=Ee.empty;class Jt{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,wn));return Jt.from(r)}forChild(e,t){if(t.isLeaf)return Ee.empty;let r=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,t);o!=Ye&&(o instanceof Jt?r=r.concat(o.members):r.push(o))}return Jt.from(r)}eq(e){if(!(e instanceof Jt)||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 s=0;s<this.members.length;s++){let o=this.members[s].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let i=0;i<o.length;i++)t.push(o[i])}}return t?wl(r?t:t.sort(En)):$n}static from(e){switch(e.length){case 0:return Ye;case 1:return e[0];default:return new Jt(e.every(t=>t instanceof Ee)?e:e.reduce((t,r)=>t.concat(r instanceof Ee?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function dy(n,e,t,r,s,o,i){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,g)=>{let y=g-p-(h-f);for(let b=0;b<l.length;b+=3){let k=l[b+1];if(k<0||f>k+u-d)continue;let C=l[b]+u-d;h>=C?l[b+1]=f<=C?-2:-1:f>=u&&y&&(l[b]+=y,l[b+1]+=y)}d+=y}),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-s;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+o,-1),h=f-s,{index:p,offset:g}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&g==d&&g+y.nodeSize==h){let b=l[c+2].mapInner(t,y,u+1,n[c]+o+1,i);b!=Ye?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=fy(l,n,e,t,s,o,i),u=Rs(c,r,0,i);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Ee(e.sort(En),l)}function Ld(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new Qe(s.from+e,s.to+e,s.type))}return t}function fy(n,e,t,r,s,o,i){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?t.push(d):i.onRemove&&i.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+o+1);return t}function Id(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let o=0,i;o<n.length;o++)(i=n[o])&&i.from>t&&i.to<r&&((s||(s=[])).push(i),n[o]=null);return s}function jd(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Rs(n,e,t,r){let s=[],o=!1;e.forEach((l,a)=>{let c=Id(n,l,a+t);if(c){o=!0;let u=Rs(c,l,t+a+1,r);u!=Ye&&s.push(a,a+l.nodeSize,u)}});let i=Ld(o?jd(n):n,-t).sort(En);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||(r.onRemove&&r.onRemove(i[l].spec),i.splice(l--,1));return i.length||s.length?new Ee(i,s):Ye}function En(n,e){return n.from-e.from||n.to-e.to}function wl(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let o=e[s];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[s]=o.copy(o.from,r.to),hc(e,s+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),hc(e,s,r.copy(o.from,r.to)));break}}}return e}function hc(n,e,t){for(;e<n.length&&En(t,n[e])>0;)e++;n.splice(e,0,t)}function ii(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ye&&e.push(r)}),n.cursorWrapper&&e.push(Ee.create(n.state.doc,[n.cursorWrapper.deco])),Jt.from(e)}const hy={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},py=ot&&tn<=11;class my{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 gy{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new my,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);ot&&tn<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),py&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,hy)),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(oc(this.view)){if(this.suppressingSelectionUpdates)return zt(this.view);if(ot&&tn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&An(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=Jn(o))t.add(o);for(let o=e.anchorNode;o;o=Jn(o))if(t.has(o)){r=o;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&oc(e)&&!this.ignoreSelectionChange(r),o=-1,i=-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),i=i<0?d.to:Math.max(d.to,i),d.typeOver&&(l=!0))}if(gt&&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||xy(e,d)!=h)&&f.remove()}}}let c=null;o<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Oo(r)&&(c=bl(e))&&c.eq(ie.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||s)&&(o>-1&&(e.docView.markDirty(o,i),yy(e)),this.handleDOMChange(o,i,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||zt(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 s=e.previousSibling,o=e.nextSibling;if(ot&&tn<=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)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let i=s&&s.parentNode==e.target?He(s)+1:0,l=r.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?He(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 pc=new WeakMap,mc=!1;function yy(n){if(!pc.has(n)&&(pc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=gt,mc)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."),mc=!0}}function gc(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,o=e.endOffset,i=n.domAtPos(n.state.selection.anchor);return An(i.node,i.offset,s,o)&&([t,r,s,o]=[s,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:o}}function by(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return gc(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?gc(n,t):null}function xy(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 ky(n,e,t){let{node:r,fromOffset:s,toOffset:o,from:i,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}],Oo(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Je&&n.input.lastKeyCode===8)for(let y=o;y>s;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){o=y;break}if(!k||k.size)break}let d=n.state.doc,f=n.someProp("domParser")||en.fromSchema(n.state.schema),h=d.resolve(i),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:vy,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),p={anchor:y+i,head:b+i}}return{doc:g,sel:p,from:i,to:l}}function vy(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ze&&/^(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||Ze&&/^(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 Sy=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Cy(n,e,t,r,s){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,O=bl(n,M);if(O&&!n.state.selection.eq(O)){if(Je&&_t&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",$=>$(n,bn(13,"Enter"))))return;let A=n.state.tr.setSelection(O);M=="pointer"?A.setMeta("pointer",!0):M=="key"&&A.scrollIntoView(),o&&A.setMeta("composition",o),n.dispatch(A)}return}let i=n.state.doc.resolve(e),l=i.sharedDepth(t);e=i.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=ky(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=Ey(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Gn&&n.input.lastIOSEnter>Date.now()-225||_t)&&s.some(M=>M.nodeType==1&&!Sy.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,bn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof ee&&!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 M=yc(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let O=n.state.tr.setSelection(M);o&&O.setMeta("composition",o),n.dispatch(O)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof ee&&(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)),ot&&tn<=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 g=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=p.endA;if((Gn&&n.input.lastIOSEnter>Date.now()-225&&(!k||s.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!k&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,bn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&wy(u,p.start,p.endA,g,y)&&n.someProp("handleKeyDown",M=>M(n,bn(8,"Backspace")))){_t&&Je&&n.domObserver.suppressSelectionUpdates();return}Je&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),_t&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,bn(13,"Enter"))})},20));let C=p.start,E=p.endA,w=M=>{let O=M||n.state.tr.replace(C,E,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let A=yc(n,O.doc,c.sel);A&&!(Je&&n.composing&&A.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(A.head==C||A.head==O.mapping.map(E)-1)||ot&&A.empty&&A.head==C)&&O.setSelection(A)}return o&&O.setMeta("composition",o),O.scrollIntoView()},S;if(k)if(g.pos==y.pos){ot&&tn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>zt(n),20));let M=w(n.state.tr.delete(C,E)),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));O&&M.ensureMarks(O),n.dispatch(M)}else if(p.endA==p.endB&&(S=My(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let M=w(n.state.tr);S.type=="add"?M.addMark(C,E,S.mark):M.removeMark(C,E,S.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,y.parentOffset),O=()=>w(n.state.tr.insertText(M,C,E));n.someProp("handleTextInput",A=>A(n,C,E,M,O))||n.dispatch(O())}else n.dispatch(w());else n.dispatch(w())}function yc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:xl(n,e.resolve(t.anchor),e.resolve(t.head))}function My(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,o=r,i,l,a;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(s.length==1&&o.length==0)l=s[0],i="add",a=u=>u.mark(l.addToSet(u.marks));else if(s.length==0&&o.length==1)l=o[0],i="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(D.from(c).eq(n))return{mark:l,type:i}}function wy(n,e,t,r,s){if(t-e<=s.pos-r.pos||li(r,!0,!1)<s.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 i=n.resolve(li(o,!0,!0));return!i.parent.isTextblock||i.pos>t||li(i,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function li(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,s++}return s}function Ey(n,e,t,r,s){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:i,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(s=="end"){let a=Math.max(0,o-Math.min(i,l));r-=i+a-o}if(i<o&&n.size<e.size){let a=r<=o&&r>=i?o-r:0;o-=a,o&&o<e.size&&bc(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-i),i=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&bc(n.textBetween(o-1,o+1))&&(o+=a?1:-1),i=o+(i-l),l=o}return{start:o,endA:i,endB:l}}function bc(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 Pd{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 Ug,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Cc),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=vc(this),kc(this),this.nodeViews=Sc(this),this.docView=Za(this.state.doc,xc(this),ii(this),this.dom,this),this.domObserver=new gy(this,(r,s,o,i)=>Cy(this,r,s,o,i)),this.domObserver.start(),qg(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&&Ui(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Cc),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 s=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(Dd(this),i=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Sc(this);Oy(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ui(this),this.editable=vc(this),kc(this);let a=ii(this),c=xc(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(s.selection))&&(i=!0);let f=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&ig(this);if(i){this.domObserver.stop();let h=d&&(ot||Je)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Ty(s.selection,e.selection);if(d){let p=Je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=oy(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Za(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ag(this))?zt(this,h):(yd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&lg(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 Y){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ka(this,t.getBoundingClientRect(),e)}else Ka(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,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=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&&(s=o)}this.dragging=new Nd(e.slice,e.move,s<0?void 0:Y.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let i=0;i<this.directPlugins.length;i++){let l=this.directPlugins[i].props[e];if(l!=null&&(s=t?t(l):l))return s}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let l=o[i].props[e];if(l!=null&&(s=t?t(l):l))return s}}hasFocus(){if(ot){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&&ag(this.dom),zt(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 hg(this,e)}coordsAtPos(e,t=1){return cd(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 s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return bg(this,t||this.state,e)}pasteHTML(e,t){return Rr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Rr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return kl(this,e)}destroy(){this.docView&&(Kg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ii(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Jm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Jg(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ze&&this.root.nodeType===11&&eg(this.dom.ownerDocument)==this.dom&&by(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Pd.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function xc(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"),[Qe.node(0,n.state.doc.content.size,e)]}function kc(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:Qe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function vc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ty(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 Sc(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Oy(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function Cc(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 sn={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:"'"},Ls={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Dy=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ay=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var We=0;We<10;We++)sn[48+We]=sn[96+We]=String(We);for(var We=1;We<=24;We++)sn[We+111]="F"+We;for(var We=65;We<=90;We++)sn[We]=String.fromCharCode(We+32),Ls[We]=String.fromCharCode(We);for(var ai in sn)Ls.hasOwnProperty(ai)||(Ls[ai]=sn[ai]);function Ny(n){var e=Dy&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ay&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ls:sn)[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 Ry=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ly=typeof navigator<"u"&&/Win/.test(navigator.platform);function Iy(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,o,i;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Ry?i=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),i&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function jy(n){let e=Object.create(null);for(let t in n)e[Iy(t)]=n[t];return e}function ci(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 Py(n){return new Ne({props:{handleKeyDown:_d(n)}})}function _d(n){let e=jy(n);return function(t,r){let s=Ny(r),o,i=e[ci(s,r)];if(i&&i(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[ci(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ly&&r.ctrlKey&&r.altKey)&&(o=sn[r.keyCode])&&o!=s){let l=e[ci(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const El=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Bd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const zd=(n,e,t)=>{let r=Bd(n,t);if(!r)return!1;let s=Tl(r);if(!s){let i=r.blockRange(),l=i&&er(i);return l==null?!1:(e&&e(n.tr.lift(i,l).scrollIntoView()),!0)}let o=s.nodeBefore;if(Yd(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Xn(o,"end")||Y.isSelectable(o)))for(let i=r.depth;;i--){let l=Eo(n.doc,r.before(i),r.after(i),z.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Xn(o,"end")?ie.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):Y.create(a.doc,s.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return o.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0):!1},_y=(n,e,t)=>{let r=Bd(n,t);if(!r)return!1;let s=Tl(r);return s?Fd(n,s,e):!1},By=(n,e,t)=>{let r=Vd(n,t);if(!r)return!1;let s=Ol(r);return s?Fd(n,s,e):!1};function Fd(n,e,t){let r=e.nodeBefore,s=r,o=e.pos-1;for(;!s.isTextblock;o--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let i=e.nodeAfter,l=i,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Eo(n.doc,o,a,z.empty);if(!c||c.from!=o||c instanceof _e&&c.slice.size>=a-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(ee.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Xn(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 $d=(n,e,t)=>{let{$head:r,empty:s}=n.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Tl(r)}let i=o&&o.nodeBefore;return!i||!Y.isSelectable(i)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)};function Tl(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 Vd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Hd=(n,e,t)=>{let r=Vd(n,t);if(!r)return!1;let s=Ol(r);if(!s)return!1;let o=s.nodeAfter;if(Yd(n,s,e,1))return!0;if(r.parent.content.size==0&&(Xn(o,"start")||Y.isSelectable(o))){let i=Eo(n.doc,r.before(),r.after(),z.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=n.tr.step(i);l.setSelection(Xn(o,"start")?ie.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):Y.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0):!1},Wd=(n,e,t)=>{let{$head:r,empty:s}=n.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Ol(r)}let i=o&&o.nodeAfter;return!i||!Y.isSelectable(i)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos)).scrollIntoView()),!0)};function Ol(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 zy=(n,e)=>{let t=n.selection,r=t instanceof Y,s;if(r){if(t.node.isTextblock||!un(n.doc,t.from))return!1;s=t.from}else if(s=wo(n.doc,t.from,-1),s==null)return!1;if(e){let o=n.tr.join(s);r&&o.setSelection(Y.create(o.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Fy=(n,e)=>{let t=n.selection,r;if(t instanceof Y){if(t.node.isTextblock||!un(n.doc,t.to))return!1;r=t.to}else if(r=wo(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},$y=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),o=s&&er(s);return o==null?!1:(e&&e(n.tr.lift(s,o).scrollIntoView()),!0)},Ud=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
55
|
+
`).scrollIntoView()),!0)};function Dl(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 Vy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),o=t.indexAfter(-1),i=Dl(s.contentMatchAt(o));if(!i||!s.canReplaceWith(o,o,i))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,i.createAndFill());a.setSelection(ie.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},qd=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof at||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=Dl(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let i=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=n.tr.insert(i,o.createAndFill());l.setSelection(ee.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},Kd=(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(Bt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),s=r&&er(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function Hy(n){return(e,t)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!r.parentOffset||!Bt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],i,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Dl(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(a&&l?{type:l}:null),i=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof ee||e.selection instanceof at)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Bt(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Bt(u.doc,d,o.length,o)),!f)return!1;if(u.split(d,o.length,o),!a&&c&&r.node(i).type!=l){let h=u.mapping.map(r.before(i)),p=u.doc.resolve(h);l&&r.node(i-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(i)),l)}return t&&t(u.scrollIntoView()),!0}}const Wy=Hy(),Uy=(n,e)=>{let{$from:t,to:r}=n.selection,s,o=t.sharedDepth(r);return o==0?!1:(s=t.before(o),e&&e(n.tr.setSelection(Y.create(n.doc,s))),!0)};function qy(n,e,t){let r=e.nodeBefore,s=e.nodeAfter,o=e.index();return!r||!s||!r.type.compatibleContent(s.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)||!(s.isTextblock||un(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Yd(n,e,t,r){let s=e.nodeBefore,o=e.nodeAfter,i,l,a=s.type.spec.isolating||o.type.spec.isolating;if(!a&&qy(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(l=s.contentMatchAt(s.childCount)).findWrapping(o.type))&&l.matchType(i[0]||o.type).validEnd){if(t){let h=e.pos+o.nodeSize,p=D.empty;for(let b=i.length-1;b>=0;b--)p=D.from(i[b].create(null,p));p=D.from(s.copy(p));let g=n.tr.step(new Be(e.pos-1,h,e.pos,h,new z(p,1,0),i.length,!0)),y=g.doc.resolve(h+2*i.length);y.nodeAfter&&y.nodeAfter.type==s.type&&un(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:ie.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&er(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Xn(o,"start",!0)&&Xn(s,"end")){let h=s,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=D.empty;for(let C=p.length-1;C>=0;C--)b=D.from(p[C].copy(b));let k=n.tr.step(new Be(e.pos-p.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new z(b,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Jd(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return s.node(o).isTextblock?(t&&t(e.tr.setSelection(ee.create(e.doc,n<0?s.start(o):s.end(o)))),!0):!1}}const Ky=Jd(-1),Yy=Jd(1);function Jy(n,e=null){return function(t,r){let{$from:s,$to:o}=t.selection,i=s.blockRange(o),l=i&&ml(i,n,e);return l?(r&&r(t.tr.wrap(i,l).scrollIntoView()),!0):!1}}function Mc(n,e=null){return function(t,r){let s=!1;for(let o=0;o<t.selection.ranges.length&&!s;o++){let{$from:{pos:i},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(i,l,(a,c)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)s=!0;else{let u=t.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,n)}})}if(!s)return!1;if(r){let o=t.tr;for(let i=0;i<t.selection.ranges.length;i++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[i];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}function Al(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}Al(El,zd,$d);Al(El,Hd,Wd);Al(Ud,qd,Kd,Wy);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Gy(n,e=null){return function(t,r){let{$from:s,$to:o}=t.selection,i=s.blockRange(o);if(!i)return!1;let l=r?t.tr:null;return Xy(l,i,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Xy(n,e,t,r=null){let s=!1,o=e,i=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=i.resolve(e.start-2);o=new Es(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Es(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=ml(o,t,r,e);return l?(n&&Qy(n,e,l,s,t),!0):!1}function Qy(n,e,t,r,s){let o=D.empty;for(let u=t.length-1;u>=0;u--)o=D.from(t[u].type.create(t[u].attrs,o));n.step(new Be(e.start-(r?2:0),e.end,e.start,e.end,new z(o,0,0),t.length,!0));let i=0;for(let u=0;u<t.length;u++)t[u].type==s&&(i=u+1);let l=t.length-i,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&&Bt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function Zy(n){return function(e,t){let{$from:r,$to:s}=e.selection,o=r.blockRange(s,i=>i.childCount>0&&i.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?e0(e,t,n,o):t0(e,t,o):!0:!1}}function e0(n,e,t,r){let s=n.tr,o=r.end,i=r.$to.end(r.depth);o<i&&(s.step(new Be(o-1,i,o,i,new z(D.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Es(s.doc.resolve(r.$from.pos),s.doc.resolve(i),r.depth));const l=er(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(o,-1)-1);return un(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function t0(n,e,t){let r=n.tr,s=t.parent;for(let h=t.end,p=t.endIndex-1,g=t.startIndex;p>g;p--)h-=s.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(t.start),i=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==s.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,i.content.append(a?D.empty:D.from(s))))return!1;let d=o.pos,f=d+i.nodeSize;return r.step(new Be(d-(l?1:0),f+(a?1:0),d+1,f-1,new z((l?D.empty:D.from(s.copy(D.empty))).append(a?D.empty:D.from(s.copy(D.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function n0(n){return function(e,t){let{$from:r,$to:s}=e.selection,o=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let i=o.startIndex;if(i==0)return!1;let l=o.parent,a=l.child(i-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=D.from(c?n.create():null),d=new z(D.from(n.create(null,D.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new Be(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}var r0=Object.defineProperty,Gd=(n,e)=>{for(var t in e)r0(n,t,{get:e[t],enumerable:!0})};function No(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=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 s},get tr(){return r=t.selection,s=t.doc,o=t.storedMarks,t}}}var Ro=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:s}=t,o=this.buildProps(s);return Object.fromEntries(Object.entries(n).map(([i,l])=>[i,(...c)=>{const u=l(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:o}=r,i=[],l=!!n,a=n||s.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(a),i.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,f])=>[d,(...p)=>{const g=this.buildProps(a,e),y=f(...p)(g);return i.push(y),u}])),run:c};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,s=n||t.tr,o=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:o}=r,i={tr:n,editor:r,view:o,state:No({state:s,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>a(...c)(i)]))}};return i}},s0=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function Xd(n,e){const t=new ed(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}var Qd=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&&Qd(r)}return n};function ns(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Qd(t)}function Ir(n,e,t){if(n instanceof kt||n instanceof D)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return D.fromArray(n.map(l=>e.nodeFromJSON(l)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}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),Ir("",e,t)}if(s){if(t.errorOnInvalidContent){let i=!1,l="";const a=new Bu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?en.fromSchema(a).parseSlice(ns(n),t.parseOptions):en.fromSchema(a).parse(ns(n),t.parseOptions),t.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=en.fromSchema(e);return t.slice?o.parseSlice(ns(n),t.parseOptions).content:o.parse(ns(n),t.parseOptions)}return Ir("",e,t)}function qi(n,e,t={},r={}){return Ir(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}function o0(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 i0(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,o)=>{t(s)&&r.push({node:s,pos:o})}),r}function l0(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 Lo(n){return e=>l0(e.$from,n)}function K(n,e,t){return n.config[e]===void 0&&n.parent?K(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?K(n.parent,e,t):null}):n.config[e]}function Nl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=K(e,"addExtensions",t);return r?[e,...Nl(r())]:e}).flat(10)}function Rl(n,e){const t=Ln.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}function Zd(n){return typeof n=="function"}function xe(n,e=void 0,...t){return Zd(n)?e?n.bind(e)(...t):n(...t):n}function a0(n={}){return Object.keys(n).length===0&&n.constructor===Object}function jr(n){const e=n.filter(s=>s.type==="extension"),t=n.filter(s=>s.type==="node"),r=n.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function ef(n){const e=[],{nodeExtensions:t,markExtensions:r}=jr(n),s=[...t,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage,extensions:s},a=K(i,"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}})})})})}),s.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage},a=K(i,"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:i.name,name:u,attribute:f})})}),e}function Te(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,o])=>{if(!r[s]){r[s]=o;return}if(s==="class"){const l=o?String(o).split(" "):[],a=r[s]?r[s].split(" "):[],c=l.filter(u=>!a.includes(u));r[s]=[...a,...c].join(" ")}else if(s==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[s]?r[s].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[s]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=o}),r},{})}function Is(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)=>Te(t,r),{})}function c0(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function wc(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 s=e.reduce((o,i)=>{const l=i.attribute.parseHTML?i.attribute.parseHTML(t):c0(t.getAttribute(i.name));return l==null?o:{...o,[i.name]:l}},{});return{...r,...s}}}}function Ec(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&a0(t)?!1:t!=null))}function u0(n,e){var t;const r=ef(n),{nodeExtensions:s,markExtensions:o}=jr(n),i=(t=s.find(c=>K(c,"topNode")))==null?void 0:t.name,l=Object.fromEntries(s.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,k)=>{const C=K(k,"extendNodeSchema",d);return{...b,...C?C(c):{}}},{}),h=Ec({...f,content:xe(K(c,"content",d)),marks:xe(K(c,"marks",d)),group:xe(K(c,"group",d)),inline:xe(K(c,"inline",d)),atom:xe(K(c,"atom",d)),selectable:xe(K(c,"selectable",d)),draggable:xe(K(c,"draggable",d)),code:xe(K(c,"code",d)),whitespace:xe(K(c,"whitespace",d)),linebreakReplacement:xe(K(c,"linebreakReplacement",d)),defining:xe(K(c,"defining",d)),isolating:xe(K(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var k,C;return[b.name,{default:(k=b==null?void 0:b.attribute)==null?void 0:k.default,validate:(C=b==null?void 0:b.attribute)==null?void 0:C.validate}]}))}),p=xe(K(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>wc(b,u)));const g=K(c,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Is(b,u)}));const y=K(c,"renderText",d);return y&&(h.toText=y),[c.name,h]})),a=Object.fromEntries(o.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((y,b)=>{const k=K(b,"extendMarkSchema",d);return{...y,...k?k(c):{}}},{}),h=Ec({...f,inclusive:xe(K(c,"inclusive",d)),excludes:xe(K(c,"excludes",d)),group:xe(K(c,"group",d)),spanning:xe(K(c,"spanning",d)),code:xe(K(c,"code",d)),attrs:Object.fromEntries(u.map(y=>{var b,k;return[y.name,{default:(b=y==null?void 0:y.attribute)==null?void 0:b.default,validate:(k=y==null?void 0:y.attribute)==null?void 0:k.validate}]}))}),p=xe(K(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>wc(y,u)));const g=K(c,"renderHTML",d);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Is(y,u)})),[c.name,h]}));return new Bu({topNode:i,nodes:l,marks:a})}function d0(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Ll(n){return n.sort((t,r)=>{const s=K(t,"priority")||100,o=K(r,"priority")||100;return s>o?-1:s<o?1:0})}function tf(n){const e=Ll(Nl(n)),t=d0(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function nf(n,e,t){const{from:r,to:s}=e,{blockSeparator:o=`
|
|
56
|
+
|
|
57
|
+
`,textSerializers:i={}}=t||{};let l="";return n.nodesBetween(r,s,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=o);const h=i==null?void 0:i[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)==null?void 0:f.slice(Math.max(r,c)-c,s-c))}),l}function f0(n,e){const t={from:0,to:n.content.size};return nf(n,t,e)}function rf(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}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}function sf(n,e){const t=Ft(e,n.schema),{from:r,to:s,empty:o}=n.selection,i=[];o?(n.storedMarks&&i.push(...n.storedMarks),i.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,a=>{i.push(...a.marks)});const l=i.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Pe(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 h0(n,e){const t=Pe(e,n.schema),{from:r,to:s}=n.selection,o=[];n.doc.nodesBetween(r,s,l=>{o.push(l)});const i=o.reverse().find(l=>l.type.name===t.name);return i?{...i.attrs}:{}}function Io(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function of(n,e){const t=Io(typeof e=="string"?e:e.name,n.schema);return t==="node"?h0(n,e):t==="mark"?sf(n,e):{}}function p0(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function m0(n){const e=p0(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,i)=>i!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function lf(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,o)=>{const i=[];if(s.ranges.length)s.forEach((l,a)=>{i.push({from:l,to:a})});else{const{from:l,to:a}=t[o];if(l===void 0||a===void 0)return;i.push({from:l,to:a})}i.forEach(({from:l,to:a})=>{const c=e.slice(o).map(l,-1),u=e.slice(o).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),m0(r)}function Il(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function js(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:Il(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function af(n,e,t={}){return n.find(r=>r.type===e&&js(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Tc(n,e,t={}){return!!af(n,e,t)}function jl(n,e,t){var r;if(!n||!e)return;let s=n.parent.childAfter(n.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===e))&&(s=n.parent.childBefore(n.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===e)||(t=t||((r=s.node.marks[0])==null?void 0:r.attrs),!af([...s.node.marks],e,t)))return;let i=s.index,l=n.start()+s.offset,a=i+1,c=l+s.node.nodeSize;for(;i>0&&Tc([...n.parent.child(i-1).marks],e,t);)i-=1,l-=n.parent.child(i).nodeSize;for(;a<n.parent.childCount&&Tc([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Pl(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const o=t.resolve(n),i=jl(o,s.type);i&&r.push({mark:s,...i})}):t.nodesBetween(n,e,(s,o)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(i=>({from:o,to:o+s.nodeSize,mark:i})))}),r}var g0=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let o=r,i=null;for(;o>0&&i===null;){const l=s.node(o);(l==null?void 0:l.type.name)===e?i=l:o-=1}return[i,o]};function ui(n,e){return e.nodes[n]||e.marks[n]||null}function bs(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(o=>o.type===e&&o.name===r);return s?s.attribute.keepOnSplit:!1}))}var y0=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,o,i,l)=>{var a,c;const u=((c=(a=s.type.spec).toText)==null?void 0:c.call(a,{node:s,pos:o,parent:i,index:l}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-o))}),t};function Ki(n,e,t={}){const{empty:r,ranges:s}=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=>js(d.attrs,t,{strict:!1}));let i=0;const l=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),k=Math.min(p,y+g.nodeSize),C=k-b;i+=C,l.push(...g.marks.map(E=>({mark:E,from:b,to:k})))})}),i===0)return!1;const a=l.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>js(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)>=i}function on(n,e,t={}){const{from:r,to:s,empty:o}=n.selection,i=e?Pe(e,n.schema):null,l=[];n.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(s,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=s-r,c=l.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>js(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}function b0(n,e,t={}){if(!e)return on(n,null,t)||Ki(n,null,t);const r=Io(e,n.schema);return r==="node"?on(n,e,t):r==="mark"?Ki(n,e,t):!1}var x0=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const o=Lo(l=>l.type.name===e)(n.selection);if(!o)return!1;const i=n.doc.resolve(o.pos+1);return s.pos+1===i.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},k0=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Oc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Dc(n,e){const{nodeExtensions:t}=jr(e),r=t.find(i=>i.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},o=xe(K(r,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function jo(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:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(o=>{s!==!1&&(jo(o,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function cf(n){return n instanceof Y}function uf(n){return n instanceof ee}function vn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function df(n,e=null){if(!e)return null;const t=ie.atStart(n),r=ie.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,o=r.to;return e==="all"?ee.create(n,vn(0,s,o),vn(n.content.size,s,o)):ee.create(n,vn(e,s,o),vn(e,s,o))}function v0(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof _e||s instanceof Be))return;const o=n.mapping.maps[r];let i=0;o.forEach((l,a,c,u)=>{i===0&&(i=u)}),n.setSelection(ie.near(n.doc.resolve(i),t))}var Po=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},S0=(n,e)=>{if(Il(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 rs(n){var e;const{editor:t,from:r,to:s,text:o,rules:i,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.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=y0(c)+o;return i.forEach(f=>{if(u)return;const h=S0(d,f.find);if(!h)return;const p=a.state.tr,g=No({state:a.state,transaction:p}),y={from:r-(h[0].length-o.length),to:s},{commands:b,chain:k,can:C}=new Ro({editor:t,state:g});f.handler({state:g,range:y,match:h,commands:b,chain:k,can:C})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:s,text:o}),a.dispatch(p),u=!0)}),u}function C0(n){const{editor:e,rules:t}=n,r=new Ne({state:{init(){return null},apply(s,o,i){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Rl(D.from(u),i.schema);const{from:d}=a,f=d+u.length;rs({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,i,l){return rs({editor:e,from:o,to:i,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&rs({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:i}=s.state.selection;return i?rs({editor:e,from:i.pos,to:i.pos,text:`
|
|
58
|
+
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function M0(n){return Object.prototype.toString.call(n).slice(8,-1)}function ss(n){return M0(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ff(n,e){const t={...n};return ss(n)&&ss(e)&&Object.keys(e).forEach(r=>{ss(e[r])&&ss(n[r])?t[r]=ff(n[r],e[r]):t[r]=e[r]}),t}var _l=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...xe(K(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...xe(K(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>ff(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Dt=class hf extends _l{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new hf(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!!!i.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const a=i.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function w0(n){return typeof n=="number"}var E0=class{constructor(n){this.find=n.find,this.handler=n.handler}},T0=(n,e,t)=>{if(Il(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const o=[s.text];return o.index=s.index,o.input=n,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function O0(n){const{editor:e,state:t,from:r,to:s,rule:o,pasteEvent:i,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Ro({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,s,(h,p)=>{var g,y,b,k,C;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const E=(C=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?C:0,w=Math.max(r,p),S=Math.min(s,p+E);if(w>=S)return;const M=h.isText?h.text||"":h.textBetween(w-p,S-p,void 0,"");T0(M,o.find,i).forEach(A=>{if(A.index===void 0)return;const $=w+A.index+1,W=$+A[0].length,U={from:t.tr.mapping.map($),to:t.tr.mapping.map(W)},_=o.handler({state:t,range:U,match:A,commands:a,chain:c,can:u,pasteEvent:i,dropEvent:l});d.push(_)})}),d.every(h=>h!==null)}var is=null,D0=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function A0(n){const{editor:e,rules:t}=n;let r=null,s=!1,o=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const g=u.tr,y=No({state:u,transaction:g});if(!(!O0({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Ne({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(is=e)},h=()=>{is&&(is=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=is;h!=null&&h.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return i=f,s=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!s,y=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:w}=b;typeof w=="string"?w=w:w=Rl(D.from(w),h.schema);const{from:S}=b,M=S+w.length,O=D0(w);return a({rule:u,state:h,from:S,to:{b:M},pasteEvt:O})}const C=f.doc.content.findDiffStart(h.doc.content),E=f.doc.content.findDiffEnd(h.doc.content);if(!(!w0(C)||!E||C===E.b))return a({rule:u,state:h,from:C,to:E,pasteEvt:i})}}))}var _o=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.extensions=tf(n),this.schema=u0(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ui(e.name,this.schema)},r=K(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Ll([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:ui(r.name,this.schema)},o=[],i=K(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&K(r,"exitable",s)&&(l.ArrowRight=()=>Dt.handleExit({editor:n,mark:r})),i){const f=Object.fromEntries(Object.entries(i()).map(([h,p])=>[h,()=>p({editor:n})]));l={...l,...f}}const a=Py(l);o.push(a);const c=K(r,"addInputRules",s);if(Oc(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=C0({editor:n,rules:f}),p=Array.isArray(h)?h:[h];o.push(...p)}}const u=K(r,"addPasteRules",s);if(Oc(r,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=A0({editor:n,rules:f});o.push(...h)}}const d=K(r,"addProseMirrorPlugins",s);if(d){const f=d();o.push(...f)}return o})}get attributes(){return ef(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=jr(this.extensions);return Object.fromEntries(e.filter(t=>!!K(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Pe(t.name,this.schema)},o=K(t,"addNodeView",s);if(!o)return[];const i=(l,a,c,u,d)=>{const f=Is(l,r);return o()({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:n,extension:t,HTMLAttributes:f})};return[t.name,i]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=jr(this.extensions);return Object.fromEntries(e.filter(t=>!!K(t,"addMarkView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ft(t.name,this.schema)},o=K(t,"addMarkView",s);if(!o)return[];const i=(l,a,c)=>{const u=Is(l,r);return o()({mark:l,view:a,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{qb(l,n,d)}})};return[t.name,i]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ui(e.name,this.schema)};e.type==="mark"&&((t=xe(K(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=K(e,"onBeforeCreate",r),o=K(e,"onCreate",r),i=K(e,"onUpdate",r),l=K(e,"onSelectionUpdate",r),a=K(e,"onTransaction",r),c=K(e,"onFocus",r),u=K(e,"onBlur",r),d=K(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),i&&this.editor.on("update",i),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};_o.resolve=tf;_o.sort=Ll;_o.flatten=Nl;var N0={};Gd(N0,{ClipboardTextSerializer:()=>mf,Commands:()=>bf,Delete:()=>xf,Drop:()=>kf,Editable:()=>vf,FocusEvents:()=>Cf,Keymap:()=>Mf,Paste:()=>wf,Tabindex:()=>Ef,focusEventsPluginKey:()=>Sf});var Le=class pf extends _l{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new pf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},mf=Le.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ne({key:new Fe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,{ranges:o}=s,i=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),a=rf(t);return nf(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),gf={};Gd(gf,{blur:()=>R0,clearContent:()=>L0,clearNodes:()=>I0,command:()=>j0,createParagraphNear:()=>P0,cut:()=>_0,deleteCurrentNode:()=>B0,deleteNode:()=>z0,deleteRange:()=>F0,deleteSelection:()=>$0,enter:()=>V0,exitCode:()=>H0,extendMarkRange:()=>W0,first:()=>U0,focus:()=>K0,forEach:()=>Y0,insertContent:()=>J0,insertContentAt:()=>X0,joinBackward:()=>eb,joinDown:()=>Z0,joinForward:()=>tb,joinItemBackward:()=>nb,joinItemForward:()=>rb,joinTextblockBackward:()=>sb,joinTextblockForward:()=>ob,joinUp:()=>Q0,keyboardShortcut:()=>lb,lift:()=>ab,liftEmptyBlock:()=>cb,liftListItem:()=>ub,newlineInCode:()=>db,resetAttributes:()=>fb,scrollIntoView:()=>hb,selectAll:()=>pb,selectNodeBackward:()=>mb,selectNodeForward:()=>gb,selectParentNode:()=>yb,selectTextblockEnd:()=>bb,selectTextblockStart:()=>xb,setContent:()=>kb,setMark:()=>Sb,setMeta:()=>Cb,setNode:()=>Mb,setNodeSelection:()=>wb,setTextSelection:()=>Eb,sinkListItem:()=>Tb,splitBlock:()=>Ob,splitListItem:()=>Db,toggleList:()=>Ab,toggleMark:()=>Nb,toggleNode:()=>Rb,toggleWrap:()=>Lb,undoInputRule:()=>Ib,unsetAllMarks:()=>jb,unsetMark:()=>Pb,updateAttributes:()=>_b,wrapIn:()=>Bb,wrapInList:()=>zb});var R0=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),L0=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),I0=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:o,$to:i})=>{n.doc.nodesBetween(o.pos,i.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=er(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},j0=n=>e=>n(e),P0=()=>({state:n,dispatch:e})=>qd(n,e),_0=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,o=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const i=r.mapping.map(e);return r.insert(i,o.content),r.setSelection(new ee(r.doc.resolve(Math.max(i-1,0)))),!0},B0=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===r.type){if(e){const l=s.before(o),a=s.after(o);n.delete(l,a).scrollIntoView()}return!0}return!1},z0=n=>({tr:e,state:t,dispatch:r})=>{const s=Pe(n,t.schema),o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===s){if(r){const a=o.before(i),c=o.after(i);e.delete(a,c).scrollIntoView()}return!0}return!1},F0=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},$0=()=>({state:n,dispatch:e})=>El(n,e),V0=()=>({commands:n})=>n.keyboardShortcut("Enter"),H0=()=>({state:n,dispatch:e})=>Vy(n,e),W0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const o=Ft(n,r.schema),{doc:i,selection:l}=t,{$from:a,from:c,to:u}=l;if(s){const d=jl(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=ee.create(i,d.from,d.to);t.setSelection(f)}}return!0},U0=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 q0(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Bl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var K0=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:o})=>{e={scrollIntoView:!0,...e};const i=()=>{(Bl()||q0())&&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&&!uf(t.state.selection))return i(),!0;const l=df(s.doc,n)||t.state.selection,a=t.state.selection.eq(l);return o&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),i()),!0},Y0=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),J0=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),G0=n=>!("type"in n),X0=(n,e,t)=>({tr:r,dispatch:s,editor:o})=>{var i;if(s){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=y=>{o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Ir(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Ir(e,o.schema,{parseOptions:c,errorOnInvalidContent:(i=t.errorOnInvalidContent)!=null?i:o.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;if((G0(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof D){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=l;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,C=b.isText||b.isTextblock,E=b.content.size>0;k&&C&&E&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}t.updateSelection&&v0(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},Q0=()=>({state:n,dispatch:e})=>zy(n,e),Z0=()=>({state:n,dispatch:e})=>Fy(n,e),eb=()=>({state:n,dispatch:e})=>zd(n,e),tb=()=>({state:n,dispatch:e})=>Hd(n,e),nb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=wo(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},rb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=wo(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},sb=()=>({state:n,dispatch:e})=>_y(n,e),ob=()=>({state:n,dispatch:e})=>By(n,e);function yf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ib(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,o,i;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Bl()||yf()?i=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),i&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}var lb=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const o=ib(n).split(/-(?!$)/),i=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,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&&s&&r.maybeStep(u)}),!0},ab=(n,e={})=>({state:t,dispatch:r})=>{const s=Pe(n,t.schema);return on(t,s,e)?$y(t,r):!1},cb=()=>({state:n,dispatch:e})=>Kd(n,e),ub=n=>({state:e,dispatch:t})=>{const r=Pe(n,e.schema);return Zy(r)(e,t)},db=()=>({state:n,dispatch:e})=>Ud(n,e);function Ac(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}var fb=(n,e)=>({tr:t,state:r,dispatch:s})=>{let o=null,i=null;const l=Io(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Pe(n,r.schema)),l==="mark"&&(i=Ft(n,r.schema)),s&&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,Ac(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(d=>{i===d.type&&t.addMark(u,u+c.nodeSize,i.create(Ac(d.attrs,e)))})})}),!0):!1},hb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),pb=()=>({tr:n,dispatch:e})=>{if(e){const t=new at(n.doc);n.setSelection(t)}return!0},mb=()=>({state:n,dispatch:e})=>$d(n,e),gb=()=>({state:n,dispatch:e})=>Wd(n,e),yb=()=>({state:n,dispatch:e})=>Uy(n,e),bb=()=>({state:n,dispatch:e})=>Yy(n,e),xb=()=>({state:n,dispatch:e})=>Ky(n,e),kb=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:o,dispatch:i,commands:l})=>{const{doc:a}=o;if(r.preserveWhitespace!=="full"){const c=qi(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return i&&o.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!t),!0}return i&&o.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function vb(n,e,t){var r;const{selection:s}=e;let o=null;if(uf(s)&&(o=s.$cursor),o){const l=(r=n.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(c=>c.type.excludes(t)))}const{ranges:i}=s;return i.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(g=>g.type.excludes(t));c=h&&p}return!c}),c})}var Sb=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:o}=t,{empty:i,ranges:l}=o,a=Ft(n,r.schema);if(s)if(i){const c=sf(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),g=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&t.addMark(p,g,a.create({...b.attrs,...e}))}):t.addMark(p,g,a.create(e))})});return vb(r,t,a)},Cb=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Mb=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const o=Pe(n,t.schema);let i;return t.selection.$anchor.sameParent(t.selection.$head)&&(i=t.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:l})=>Mc(o,{...i,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Mc(o,{...i,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},wb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=vn(n,0,r.content.size),o=Y.create(r,s);e.setSelection(o)}return!0},Eb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:o}=typeof n=="number"?{from:n,to:n}:n,i=ee.atStart(r).from,l=ee.atEnd(r).to,a=vn(s,i,l),c=vn(o,i,l),u=ee.create(r,a,c);e.setSelection(u)}return!0},Tb=n=>({state:e,dispatch:t})=>{const r=Pe(n,e.schema);return n0(r)(e,t)};function Nc(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e==null?void 0:e.includes(s.type.name));n.tr.ensureMarks(r)}}var Ob=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:o,doc:i}=e,{$from:l,$to:a}=o,c=s.extensionManager.attributes,u=bs(c,l.node().type.name,l.node().attrs);if(o instanceof Y&&o.node.isBlock)return!l.parentOffset||!Bt(i,l.pos)?!1:(r&&(n&&Nc(t,s.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:o0(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Bt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Bt(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 ee&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&Nc(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},Db=(n,e={})=>({tr:t,state:r,dispatch:s,editor:o})=>{var i;const l=Pe(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(s){let b=D.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let O=a.depth-k;O>=a.depth-3;O-=1)b=D.from(a.node(O).copy(b));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...bs(f,a.node().type.name,a.node().attrs),...e},w=((i=l.contentMatch.defaultType)==null?void 0:i.createAndFill(E))||void 0;b=b.append(D.from(l.createAndFill(null,w)||void 0));const S=a.before(a.depth-(k-1));t.replace(S,a.after(-C),new z(b,4-k,0));let M=-1;t.doc.nodesBetween(S,t.doc.content.size,(O,A)=>{if(M>-1)return!1;O.isTextblock&&O.content.size===0&&(M=A+1)}),M>-1&&t.setSelection(ee.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...bs(f,d.type.name,d.attrs),...e},g={...bs(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const y=h?[{type:l,attrs:p},{type:h,attrs:g}]:[{type:l,attrs:p}];if(!Bt(t.doc,a.pos,2))return!1;if(s){const{selection:b,storedMarks:k}=r,{splittableMarks:C}=o.extensionManager,E=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!E||!s)return!0;const w=E.filter(S=>C.includes(S.type.name));t.ensureMarks(w)}return!0},di=(n,e)=>{const t=Lo(i=>i.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 s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&un(n.doc,t.pos)&&n.join(t.pos),!0},fi=(n,e)=>{const t=Lo(i=>i.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 s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&un(n.doc,r)&&n.join(r),!0},Ab=(n,e,t,r={})=>({editor:s,tr:o,state:i,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=Pe(n,i.schema),p=Pe(e,i.schema),{selection:g,storedMarks:y}=i,{$from:b,$to:k}=g,C=b.blockRange(k),E=y||g.$to.parentOffset&&g.$from.marks();if(!C)return!1;const w=Lo(S=>Dc(S.type.name,d))(g);if(C.depth>=1&&w&&C.depth-w.depth<=1){if(w.node.type===h)return c.liftListItem(p);if(Dc(w.node.type.name,d)&&h.validContent(w.node.content)&&l)return a().command(()=>(o.setNodeMarkup(w.pos,h),!0)).command(()=>di(o,h)).command(()=>fi(o,h)).run()}return!t||!E||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>di(o,h)).command(()=>fi(o,h)).run():a().command(()=>{const S=u().wrapInList(h,r),M=E.filter(O=>f.includes(O.type.name));return o.ensureMarks(M),S?!0:c.clearNodes()}).wrapInList(h,r).command(()=>di(o,h)).command(()=>fi(o,h)).run()},Nb=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=t,i=Ft(n,r.schema);return Ki(r,i,e)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,e)},Rb=(n,e,t={})=>({state:r,commands:s})=>{const o=Pe(n,r.schema),i=Pe(e,r.schema),l=on(r,o,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(i,a):s.setNode(o,{...a,...t})},Lb=(n,e={})=>({state:t,commands:r})=>{const s=Pe(n,t.schema);return on(t,s,e)?r.lift(s):r.wrapIn(s,e)},Ib=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let o;if(s.spec.isInputRules&&(o=s.getState(n))){if(e){const i=n.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)i.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=i.doc.resolve(o.from).marks();i.replaceWith(o.from,o.to,n.schema.text(o.text,a))}else i.delete(o.from,o.to)}return!0}}return!1},jb=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:s}=t;return r||e&&s.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Pb=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=e,{selection:l}=t,a=Ft(n,r.schema),{$from:c,empty:u,ranges:d}=l;if(!s)return!0;if(u&&i){let{from:f,to:h}=l;const p=(o=c.marks().find(y=>y.type===a))==null?void 0:o.attrs,g=jl(c,a,p);g&&(f=g.from,h=g.to),t.removeMark(f,h,a)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},_b=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let o=null,i=null;const l=Io(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Pe(n,r.schema)),l==="mark"&&(i=Ft(n,r.schema)),s&&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,(g,y)=>{o&&o===g.type&&(h=Math.max(y,c),p=Math.min(y+g.nodeSize,u),d=y,f=g)}):r.doc.nodesBetween(c,u,(g,y)=>{y<c&&o&&o===g.type&&(h=Math.max(y,c),p=Math.min(y+g.nodeSize,u),d=y,f=g),y>=c&&y<=u&&(o&&o===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),i&&g.marks.length&&g.marks.forEach(b=>{if(i===b.type){const k=Math.max(y,c),C=Math.min(y+g.nodeSize,u);t.addMark(k,C,i.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),i&&f.marks.length&&f.marks.forEach(g=>{i===g.type&&t.addMark(h,p,i.create({...g.attrs,...e}))}))}),!0):!1},Bb=(n,e={})=>({state:t,dispatch:r})=>{const s=Pe(n,t.schema);return Jy(s,e)(t,r)},zb=(n,e={})=>({state:t,dispatch:r})=>{const s=Pe(n,t.schema);return Gy(s,e)(t,r)},bf=Le.create({name:"commands",addCommands(){return{...gf}}}),xf=Le.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,s;const o=()=>{var i,l,a,c;if((c=(a=(l=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?c:n.getMeta("y-sync$"))return;const u=Xd(n.before,[n,...e]);lf(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const y=g+p.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var g,y;if(h instanceof xt){const b=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),C=f.invert().map(b,-1),E=f.invert().map(k),w=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(M=>M.eq(h.mark)),S=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(M=>M.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:C,to:E},newRange:{from:b,to:k},partial:!!(S||w),editor:this.editor,transaction:n,combinedTransform:u})}})};(s=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||s?setTimeout(o,0):o()}}),kf=Le.create({name:"drop",addProseMirrorPlugins(){return[new Ne({key:new Fe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),vf=Le.create({name:"editable",addProseMirrorPlugins(){return[new Ne({key:new Fe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Sf=new Fe("focusEvents"),Cf=Le.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ne({key:Sf,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}}}})]}}),Mf=Le.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,b=g&&p.parent.childCount===1?y===d.pos:ie.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...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 Bl()||yf()?o:s},addProseMirrorPlugins(){return[new Ne({key:new Fe("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),s=n.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:o,from:i,to:l}=e.selection,a=ie.atStart(e.doc).from,c=ie.atEnd(e.doc).to;if(o||!(i===a&&l===c)||!jo(t.doc))return;const f=t.tr,h=No({state:t,transaction:f}),{commands:p}=new Ro({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),wf=Le.create({name:"paste",addProseMirrorPlugins(){return[new Ne({key:new Fe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ef=Le.create({name:"tabindex",addProseMirrorPlugins(){return[new Ne({key:new Fe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Fb=class Vn{constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let 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 Vn(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 Vn(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 Vn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,i=this.pos+r+(o?0:1);if(i<0||i>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(i);if(!s&&l.depth<=this.depth)return;const a=new Vn(l,this.editor,s,s?t:null);s&&(a.actualDepth=this.depth+1),e.push(new Vn(l,this.editor,s,s?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,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const o=s.node.attrs,i=Object.keys(t);for(let l=0;l<i.length;l+=1){const a=i[l];if(o[a]!==t[a])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(t);return this.children.forEach(i=>{r&&s.length>0||(i.node.type.name===e&&o.every(a=>t[a]===i.node.attrs[a])&&s.push(i),!(r&&s.length>0)&&(s=s.concat(i.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},$b=`.ProseMirror {
|
|
59
|
+
position: relative;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ProseMirror {
|
|
63
|
+
word-wrap: break-word;
|
|
64
|
+
white-space: pre-wrap;
|
|
65
|
+
white-space: break-spaces;
|
|
66
|
+
-webkit-font-variant-ligatures: none;
|
|
67
|
+
font-variant-ligatures: none;
|
|
68
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ProseMirror [contenteditable="false"] {
|
|
72
|
+
white-space: normal;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
76
|
+
white-space: pre-wrap;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ProseMirror pre {
|
|
80
|
+
white-space: pre-wrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
img.ProseMirror-separator {
|
|
84
|
+
display: inline !important;
|
|
85
|
+
border: none !important;
|
|
86
|
+
margin: 0 !important;
|
|
87
|
+
width: 0 !important;
|
|
88
|
+
height: 0 !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ProseMirror-gapcursor {
|
|
92
|
+
display: none;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
position: absolute;
|
|
95
|
+
margin: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ProseMirror-gapcursor:after {
|
|
99
|
+
content: "";
|
|
100
|
+
display: block;
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: -2px;
|
|
103
|
+
width: 20px;
|
|
104
|
+
border-top: 1px solid black;
|
|
105
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@keyframes ProseMirror-cursor-blink {
|
|
109
|
+
to {
|
|
110
|
+
visibility: hidden;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.ProseMirror-hideselection *::selection {
|
|
115
|
+
background: transparent;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
119
|
+
background: transparent;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ProseMirror-hideselection * {
|
|
123
|
+
caret-color: transparent;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
127
|
+
display: block;
|
|
128
|
+
}`;function Vb(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}var Hb=class extends s0{constructor(n={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:o})=>this.options.onDrop(r,s,o)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=df(e,this.options.autofocus);this.editorState=Un.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n!=null&&n.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Vb($b,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=Zd(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;t=t.filter(i=>!i.key.startsWith(o))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[vf,mf.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),bf,Cf,Mf,Ef,kf,wf,xf].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new _o(r,this)}createCommandManager(){this.commandManager=new Ro({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=qi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=qi(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){var e;this.editorView=new Pd(n,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),s=t.includes(n),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const i=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=i==null?void 0:i.getMeta("focus"),a=i==null?void 0:i.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:i}),a&&this.emit("blur",{editor:this,event:a.event,transaction:i}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return of(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return b0(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Rl(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
|
|
129
|
+
|
|
130
|
+
`,textSerializers:t={}}=n||{};return f0(this.state.doc,{blockSeparator:e,textSerializers:{...rf(this.schema),...t}})}get isEmpty(){return jo(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new Fb(e,this)}get $doc(){return this.$pos(0)}};function Rn(n){return new Po({find:n.find,handler:({state:e,range:t,match:r})=>{const s=xe(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=e,i=r[r.length-1],l=r[0];if(i){const a=l.search(/\S/),c=t.from+l.indexOf(i),u=c+i.length;if(Pl(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==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+i.length;o.addMark(t.from+a,f,n.type.create(s||{})),o.removeStoredMark(n.type)}},undoable:n.undoable})}function Wb(n){return new Po({find:n.find,handler:({state:e,range:t,match:r})=>{const s=xe(n.getAttributes,void 0,r)||{},{tr:o}=e,i=t.from;let l=t.to;const a=n.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=i+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,i+r[0].length-1),o.replaceWith(u,l,a)}else if(r[0]){const c=n.type.isInline?i:i-1;o.insert(c,n.type.create(s)).delete(o.mapping.map(i),o.mapping.map(l))}o.scrollIntoView()},undoable:n.undoable})}function Yi(n){return new Po({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),o=xe(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)},undoable:n.undoable})}function Qn(n){return new Po({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const o=xe(n.getAttributes,void 0,r)||{},i=e.tr.delete(t.from,t.to),a=i.doc.resolve(t.from).blockRange(),c=a&&ml(a,n.type,o);if(!c)return null;if(i.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 g=p.filter(y=>h.includes(y.type.name));i.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,o).run()}const u=i.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&un(i.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&i.join(t.from-1)},undoable:n.undoable})}function Ub(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof Y){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let s=r.depth;for(;s>=0;){const o=r.index(s);if(r.node(s).contentMatchAt(o).matchType(e))return!0;s-=1}return!1}function qb(n,e,t={}){const{state:r}=e,{doc:s,tr:o}=r,i=n;s.descendants((l,a)=>{const c=o.mapping.map(a),u=o.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==i)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=n.type.create({...n.attrs,...t});o.removeMark(c,u,n.type),o.addMark(c,u,h)}}),o.docChanged&&e.view.dispatch(o)}var ct=class Tf extends _l{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Tf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function ln(n){return new E0({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const o=xe(n.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:i}=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(Pl(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===n.type&&y!==p.mark.type)).filter(p=>p.to>d).length)return null;f<t.to&&i.delete(f,t.to),d>t.from&&i.delete(t.from+u,d),c=t.from+u+l.length,i.addMark(t.from+u,c,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}var hi,Rc;function Kb(){return Rc||(Rc=1,hi=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,s,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(s=r;s--!==0;)if(!n(e[s],t[s]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(s of e.entries())if(!t.has(s[0]))return!1;for(s of e.entries())if(!n(s[1],t.get(s[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(s of e.entries())if(!t.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(s=r;s--!==0;)if(e[s]!==t[s])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(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!n(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}),hi}var Yb=Kb();const Jb=Br(Yb);var ls={exports:{}},pi={};/**
|
|
131
|
+
* @license React
|
|
132
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
133
|
+
*
|
|
134
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the MIT license found in the
|
|
137
|
+
* LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/var Lc;function Gb(){if(Lc)return pi;Lc=1;var n=T,e=fl();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,s=e.useSyncExternalStore,o=n.useRef,i=n.useEffect,l=n.useMemo,a=n.useDebugValue;return pi.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function b(S){if(!k){if(k=!0,C=S,S=f(S),h!==void 0&&g.hasValue){var M=g.value;if(h(M,S))return E=M}return E=S}if(M=E,r(C,S))return M;var O=f(S);return h!==void 0&&h(M,O)?(C=S,M):(C=S,E=O)}var k=!1,C,E,w=d===void 0?null:d;return[function(){return b(u())},w===null?void 0:function(){return b(w())}]},[u,d,f,h]);var y=s(c,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),a(y),y},pi}var mi={};/**
|
|
139
|
+
* @license React
|
|
140
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
141
|
+
*
|
|
142
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the MIT license found in the
|
|
145
|
+
* LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/var Ic;function Xb(){return Ic||(Ic=1,process.env.NODE_ENV!=="production"&&function(){function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=T,t=fl(),r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,a=e.useDebugValue;mi.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function b(S){if(!k){if(k=!0,C=S,S=f(S),h!==void 0&&g.hasValue){var M=g.value;if(h(M,S))return E=M}return E=S}if(M=E,r(C,S))return M;var O=f(S);return h!==void 0&&h(M,O)?(C=S,M):(C=S,E=O)}var k=!1,C,E,w=d===void 0?null:d;return[function(){return b(u())},w===null?void 0:function(){return b(w())}]},[u,d,f,h]);var y=s(c,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),a(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),mi}var jc;function Qb(){return jc||(jc=1,process.env.NODE_ENV==="production"?ls.exports=Gb():ls.exports=Xb()),ls.exports}var Zb=Qb(),ex=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},tx=({contentComponent:n})=>{const e=Su.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(e)})};function nx(){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]:dh.createPortal(r.reactElement,r.element,t)},n.forEach(s=>s())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(s=>s())}}}var rx=class extends T.Component{constructor(n){var e;super(n),this.editorContentRef=T.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=n.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const n=this.props.editor;if(n&&!n.isDestroyed&&n.options.element){if(n.contentComponent)return;const e=this.editorContentRef.current;e.append(n.view.dom),n.setOptions({element:e}),n.contentComponent=nx(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=n.contentComponent.subscribe(()=>{this.setState(t=>t.hasContentComponentInitialized?t:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),n.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var n;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((n=e.view.dom)!=null&&n.firstChild))return;const t=document.createElement("div");t.append(e.view.dom),e.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:ex(e,this.editorContentRef),...t}),(n==null?void 0:n.contentComponent)&&m.jsx(tx,{contentComponent:n.contentComponent})]})}},sx=T.forwardRef((n,e)=>{const t=T.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return T.createElement(rx,{key:t,innerRef:e,...n})}),Pc=T.memo(sx),ox=typeof window<"u"?T.useLayoutEffect:T.useEffect,ix=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,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(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function lx(n){var e;const[t]=T.useState(()=>new ix(n.editor)),r=Zb.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:Jb);return ox(()=>t.watch(n.editor),[n.editor,t]),T.useDebugValue(r),r}var _c=process.env.NODE_ENV!=="production",Ji=typeof window>"u",ax=Ji||!!(typeof window<"u"&&window.next),cx=class Of{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){if(Ji||ax){if(_c)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&Ji&&_c)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 s,o;return(o=(s=this.options.current).onBeforeCreate)==null?void 0:o.call(s,...r)},onBlur:(...r)=>{var s,o;return(o=(s=this.options.current).onBlur)==null?void 0:o.call(s,...r)},onCreate:(...r)=>{var s,o;return(o=(s=this.options.current).onCreate)==null?void 0:o.call(s,...r)},onDestroy:(...r)=>{var s,o;return(o=(s=this.options.current).onDestroy)==null?void 0:o.call(s,...r)},onFocus:(...r)=>{var s,o;return(o=(s=this.options.current).onFocus)==null?void 0:o.call(s,...r)},onSelectionUpdate:(...r)=>{var s,o;return(o=(s=this.options.current).onSelectionUpdate)==null?void 0:o.call(s,...r)},onTransaction:(...r)=>{var s,o;return(o=(s=this.options.current).onTransaction)==null?void 0:o.call(s,...r)},onUpdate:(...r)=>{var s,o;return(o=(s=this.options.current).onUpdate)==null?void 0:o.call(s,...r)},onContentError:(...r)=>{var s,o;return(o=(s=this.options.current).onContentError)==null?void 0:o.call(s,...r)},onDrop:(...r)=>{var s,o;return(o=(s=this.options.current).onDrop)==null?void 0:o.call(s,...r)},onPaste:(...r)=>{var s,o;return(o=(s=this.options.current).onPaste)==null?void 0:o.call(s,...r)},onDelete:(...r)=>{var s,o;return(o=(s=this.options.current).onDelete)==null?void 0:o.call(s,...r)}};return new Hb(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((s,o)=>{var i;return s===((i=t.extensions)==null?void 0:i[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Of.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,s)=>r===e[s]))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 ux(n={},e=[]){const t=T.useRef(n);t.current=n;const[r]=T.useState(()=>new cx(t)),s=Su.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return T.useDebugValue(s),T.useEffect(r.onRender(e)),lx({editor:s,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&o===0?0:o+1}),s}var dx=T.createContext({editor:null});dx.Consumer;var fx=T.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),hx=()=>T.useContext(fx);T.forwardRef((n,e)=>{const{onDragStart:t}=hx(),r=n.as||"div";return m.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});T.createContext({markViewContentRef:()=>{}});var Ps=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},px=/^\s*>\s$/,mx=ct.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Ps("blockquote",{...Te(this.options.HTMLAttributes,n),children:Ps("slot",{})})},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[Qn({find:px,type:this.type})]}}),gx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,yx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,bx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,xx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,kx=Dt.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 Ps("strong",{...Te(this.options.HTMLAttributes,n),children:Ps("slot",{})})},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[Rn({find:gx,type:this.type}),Rn({find:bx,type:this.type})]},addPasteRules(){return[ln({find:yx,type:this.type}),ln({find:xx,type:this.type})]}}),vx=/(^|[^`])`([^`]+)`(?!`)$/,Sx=/(^|[^`])`([^`]+)`(?!`)/g,Cx=Dt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Te(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[Rn({find:vx,type:this.type})]},addPasteRules(){return[ln({find:Sx,type:this.type})]}}),gi=4,Mx=/^```([a-z]+)?[\s\n]$/,wx=/^~~~([a-z]+)?[\s\n]$/,Ex=ct.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:gi,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;if(!t)return null;const o=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(i=>i.startsWith(t)).map(i=>i.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Te(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},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:gi,{state:r}=n,{selection:s}=r,{$from:o,empty:i}=s;if(o.parent.type!==this.type)return!1;const l=" ".repeat(t);return i?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:c,to:u}=s,h=r.doc.textBetween(c,u,`
|
|
147
|
+
`,`
|
|
148
|
+
`).split(`
|
|
149
|
+
`).map(p=>l+p).join(`
|
|
150
|
+
`);return a.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:gi,{state:r}=n,{selection:s}=r,{$from:o,empty:i}=s;return o.parent.type!==this.type?!1:i?n.commands.command(({tr:l})=>{var a;const{pos:c}=o,u=o.start(),d=o.end(),h=r.doc.textBetween(u,d,`
|
|
151
|
+
`,`
|
|
152
|
+
`).split(`
|
|
153
|
+
`);let p=0,g=0;const y=c-u;for(let S=0;S<h.length;S+=1){if(g+h[S].length>=y){p=S;break}g+=h[S].length+1}const k=((a=h[p].match(/^ */))==null?void 0:a[0])||"",C=Math.min(k.length,t);if(C===0)return!0;let E=u;for(let S=0;S<p;S+=1)E+=h[S].length+1;return l.delete(E,E+C),c-E<=C&&l.setSelection(ee.create(l.doc,E)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:c}=s,f=r.doc.textBetween(a,c,`
|
|
154
|
+
`,`
|
|
155
|
+
`).split(`
|
|
156
|
+
`).map(h=>{var p;const g=((p=h.match(/^ */))==null?void 0:p[0])||"",y=Math.min(g.length,t);return h.slice(y)}).join(`
|
|
157
|
+
`);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
|
|
158
|
+
|
|
159
|
+
`);return!o||!i?!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:s,empty:o}=t;if(!o||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(ie.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Yi({find:Mx,type:this.type,getAttributes:n=>({language:n[1]})}),Yi({find:wx,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Ne({key:new Fe("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"),s=r?JSON.parse(r):void 0,o=s==null?void 0:s.mode;if(!t||!o)return!1;const{tr:i,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
|
|
160
|
+
`));return i.replaceSelectionWith(this.type.create({language:o},a)),i.selection.$from.parent.type!==this.type&&i.setSelection(ee.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),n.dispatch(i),!0}}})]}}),Tx=ct.create({name:"doc",topNode:!0,content:"block+"}),Ox=ct.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",Te(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
161
|
+
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:o}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=r.extensionManager,a=o||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&i){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Dx=ct.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]}`,Te(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=>Yi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Ax=ct.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Te(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Ub(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return cf(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:o,tr:i,dispatch:l})=>{if(l){const{$to:a}=i.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(ee.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(Y.create(i.doc,a.pos)):i.setSelection(ee.create(i.doc,a.pos));else{const u=o.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(i.insert(c,d),i.setSelection(ee.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Wb({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Nx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Rx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Lx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ix=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,jx=Dt.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",Te(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[Rn({find:Nx,type:this.type}),Rn({find:Lx,type:this.type})]},addPasteRules(){return[ln({find:Rx,type:this.type}),ln({find:Ix,type:this.type})]}});const Px="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",_x="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Gi="numeric",Xi="ascii",Qi="alpha",xr="asciinumeric",mr="alphanumeric",Zi="domain",Df="emoji",Bx="scheme",zx="slashscheme",yi="whitespace";function Fx(n,e){return n in e||(e[n]=[]),e[n]}function Sn(n,e,t){e[Gi]&&(e[xr]=!0,e[mr]=!0),e[Xi]&&(e[xr]=!0,e[Qi]=!0),e[xr]&&(e[mr]=!0),e[Qi]&&(e[mr]=!0),e[mr]&&(e[Zi]=!0),e[Df]&&(e[Zi]=!0);for(const r in e){const s=Fx(r,t);s.indexOf(n)<0&&s.push(n)}}function $x(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function st(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}st.groups={};st.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],o=e.jr[r][1];if(o&&s.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||st.groups;let s;return e&&e.j?s=e:(s=new st(e),t&&r&&Sn(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const o=n.length;if(!o)return s;for(let i=0;i<o-1;i++)s=s.tt(n[i]);return s.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||st.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const o=e;let i,l=s.go(n);if(l?(i=new st,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new st,o){if(r)if(i.t&&typeof i.t=="string"){const a=Object.assign($x(i.t,r),t);Sn(o,a,r)}else t&&Sn(o,t,r);i.t=o}return s.j[n]=i,i}};const oe=(n,e,t,r,s)=>n.ta(e,t,r,s),De=(n,e,t,r,s)=>n.tr(e,t,r,s),Bc=(n,e,t,r,s)=>n.ts(e,t,r,s),R=(n,e,t,r,s)=>n.tt(e,t,r,s),jt="WORD",el="UWORD",Af="ASCIINUMERICAL",Nf="ALPHANUMERICAL",Pr="LOCALHOST",tl="TLD",nl="UTLD",xs="SCHEME",Hn="SLASH_SCHEME",zl="NUM",rl="WS",Fl="NL",kr="OPENBRACE",vr="CLOSEBRACE",_s="OPENBRACKET",Bs="CLOSEBRACKET",zs="OPENPAREN",Fs="CLOSEPAREN",$s="OPENANGLEBRACKET",Vs="CLOSEANGLEBRACKET",Hs="FULLWIDTHLEFTPAREN",Ws="FULLWIDTHRIGHTPAREN",Us="LEFTCORNERBRACKET",qs="RIGHTCORNERBRACKET",Ks="LEFTWHITECORNERBRACKET",Ys="RIGHTWHITECORNERBRACKET",Js="FULLWIDTHLESSTHAN",Gs="FULLWIDTHGREATERTHAN",Xs="AMPERSAND",Qs="APOSTROPHE",Zs="ASTERISK",Kt="AT",eo="BACKSLASH",to="BACKTICK",no="CARET",Gt="COLON",$l="COMMA",ro="DOLLAR",Ct="DOT",so="EQUALS",Vl="EXCLAMATION",ht="HYPHEN",Sr="PERCENT",oo="PIPE",io="PLUS",lo="POUND",Cr="QUERY",Hl="QUOTE",Rf="FULLWIDTHMIDDLEDOT",Wl="SEMI",Mt="SLASH",Mr="TILDE",ao="UNDERSCORE",Lf="EMOJI",co="SYM";var If=Object.freeze({__proto__:null,ALPHANUMERICAL:Nf,AMPERSAND:Xs,APOSTROPHE:Qs,ASCIINUMERICAL:Af,ASTERISK:Zs,AT:Kt,BACKSLASH:eo,BACKTICK:to,CARET:no,CLOSEANGLEBRACKET:Vs,CLOSEBRACE:vr,CLOSEBRACKET:Bs,CLOSEPAREN:Fs,COLON:Gt,COMMA:$l,DOLLAR:ro,DOT:Ct,EMOJI:Lf,EQUALS:so,EXCLAMATION:Vl,FULLWIDTHGREATERTHAN:Gs,FULLWIDTHLEFTPAREN:Hs,FULLWIDTHLESSTHAN:Js,FULLWIDTHMIDDLEDOT:Rf,FULLWIDTHRIGHTPAREN:Ws,HYPHEN:ht,LEFTCORNERBRACKET:Us,LEFTWHITECORNERBRACKET:Ks,LOCALHOST:Pr,NL:Fl,NUM:zl,OPENANGLEBRACKET:$s,OPENBRACE:kr,OPENBRACKET:_s,OPENPAREN:zs,PERCENT:Sr,PIPE:oo,PLUS:io,POUND:lo,QUERY:Cr,QUOTE:Hl,RIGHTCORNERBRACKET:qs,RIGHTWHITECORNERBRACKET:Ys,SCHEME:xs,SEMI:Wl,SLASH:Mt,SLASH_SCHEME:Hn,SYM:co,TILDE:Mr,TLD:tl,UNDERSCORE:ao,UTLD:nl,UWORD:el,WORD:jt,WS:rl});const Lt=/[a-z]/,dr=new RegExp("\\p{L}","u"),bi=new RegExp("\\p{Emoji}","u"),It=/\d/,xi=/\s/,zc="\r",ki=`
|
|
162
|
+
`,Vx="️",Hx="",vi="";let as=null,cs=null;function Wx(n=[]){const e={};st.groups=e;const t=new st;as==null&&(as=Fc(Px)),cs==null&&(cs=Fc(_x)),R(t,"'",Qs),R(t,"{",kr),R(t,"}",vr),R(t,"[",_s),R(t,"]",Bs),R(t,"(",zs),R(t,")",Fs),R(t,"<",$s),R(t,">",Vs),R(t,"(",Hs),R(t,")",Ws),R(t,"「",Us),R(t,"」",qs),R(t,"『",Ks),R(t,"』",Ys),R(t,"<",Js),R(t,">",Gs),R(t,"&",Xs),R(t,"*",Zs),R(t,"@",Kt),R(t,"`",to),R(t,"^",no),R(t,":",Gt),R(t,",",$l),R(t,"$",ro),R(t,".",Ct),R(t,"=",so),R(t,"!",Vl),R(t,"-",ht),R(t,"%",Sr),R(t,"|",oo),R(t,"+",io),R(t,"#",lo),R(t,"?",Cr),R(t,'"',Hl),R(t,"/",Mt),R(t,";",Wl),R(t,"~",Mr),R(t,"_",ao),R(t,"\\",eo),R(t,"・",Rf);const r=De(t,It,zl,{[Gi]:!0});De(r,It,r);const s=De(r,Lt,Af,{[xr]:!0}),o=De(r,dr,Nf,{[mr]:!0}),i=De(t,Lt,jt,{[Xi]:!0});De(i,It,s),De(i,Lt,i),De(s,It,s),De(s,Lt,s);const l=De(t,dr,el,{[Qi]:!0});De(l,Lt),De(l,It,o),De(l,dr,l),De(o,It,o),De(o,Lt),De(o,dr,o);const a=R(t,ki,Fl,{[yi]:!0}),c=R(t,zc,rl,{[yi]:!0}),u=De(t,xi,rl,{[yi]:!0});R(t,vi,u),R(c,ki,a),R(c,vi,u),De(c,xi,u),R(u,zc),R(u,ki),De(u,xi,u),R(u,vi,u);const d=De(t,bi,Lf,{[Df]:!0});R(d,"#"),De(d,bi,d),R(d,Vx,d);const f=R(d,Hx);R(f,"#"),De(f,bi,d);const h=[[Lt,i],[It,s]],p=[[Lt,null],[dr,l],[It,o]];for(let g=0;g<as.length;g++)Wt(t,as[g],tl,jt,h);for(let g=0;g<cs.length;g++)Wt(t,cs[g],nl,el,p);Sn(tl,{tld:!0,ascii:!0},e),Sn(nl,{utld:!0,alpha:!0},e),Wt(t,"file",xs,jt,h),Wt(t,"mailto",xs,jt,h),Wt(t,"http",Hn,jt,h),Wt(t,"https",Hn,jt,h),Wt(t,"ftp",Hn,jt,h),Wt(t,"ftps",Hn,jt,h),Sn(xs,{scheme:!0,ascii:!0},e),Sn(Hn,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[Bx]:!0}:{[zx]:!0};y.indexOf("-")>=0?k[Zi]=!0:Lt.test(y)?It.test(y)?k[xr]=!0:k[Xi]=!0:k[Gi]=!0,Bc(t,y,y,k)}return Bc(t,"localhost",Pr,{ascii:!0}),t.jd=new st(co),{start:t,tokens:Object.assign({groups:e},If)}}function jf(n,e){const t=Ux(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,s=[];let o=0,i=0;for(;i<r;){let l=n,a=null,c=0,u=null,d=-1,f=-1;for(;i<r&&(a=l.go(t[i]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=t[i].length,f++),c+=t[i].length,o+=t[i].length,i++;o-=d,i-=f,c-=d,s.push({t:u.t,v:e.slice(o-c,o),s:o-c,e:o})}return s}function Ux(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),o,i=s<55296||s>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(i),r+=i.length}return e}function Wt(n,e,t,r,s){let o;const i=e.length;for(let l=0;l<i-1;l++){const a=e[l];n.j[a]?o=n.j[a]:(o=new st(r),o.jr=s.slice(),n.j[a]=o),n=o}return o=new st(t),o.jr=s.slice(),n.j[e[i-1]]=o,o}function Fc(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let o=0;for(;s.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let i=parseInt(n.substring(r,r+o),10);i>0;i--)t.pop();r+=o}else t.push(n[r]),r++}return e}const _r={defaultProtocol:"http",events:null,format:$c,formatHref:$c,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ul(n,e=null){let t=Object.assign({},_r);n&&(t=Object.assign(t,n instanceof Ul?n.o:n));const r=t.ignoreTags,s=[];for(let o=0;o<r.length;o++)s.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Ul.prototype={o:_r,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:_r[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function $c(n){return n}function Pf(n,e){this.t="token",this.v=n,this.tk=e}Pf.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=_r.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),o=this.toFormattedString(n),i={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return i.href=r,l&&(i.class=l),a&&(i.target=a),c&&(i.rel=c),u&&Object.assign(i,u),{tagName:s,attributes:i,content:o,eventListeners:d}}};function Bo(n,e){class t extends Pf{constructor(s,o){super(s,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Vc=Bo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Hc=Bo("text"),qx=Bo("nl"),us=Bo("url",{isLink:!0,toHref(n=_r.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Pr&&n[1].t===Gt}}),ft=n=>new st(n);function Kx({groups:n}){const e=n.domain.concat([Xs,Zs,Kt,eo,to,no,ro,so,ht,zl,Sr,oo,io,lo,Mt,co,Mr,ao]),t=[Qs,Gt,$l,Ct,Vl,Sr,Cr,Hl,Wl,$s,Vs,kr,vr,Bs,_s,zs,Fs,Hs,Ws,Us,qs,Ks,Ys,Js,Gs],r=[Xs,Qs,Zs,eo,to,no,ro,so,ht,kr,vr,Sr,oo,io,lo,Cr,Mt,co,Mr,ao],s=ft(),o=R(s,Mr);oe(o,r,o),oe(o,n.domain,o);const i=ft(),l=ft(),a=ft();oe(s,n.domain,i),oe(s,n.scheme,l),oe(s,n.slashscheme,a),oe(i,r,o),oe(i,n.domain,i);const c=R(i,Kt);R(o,Kt,c),R(l,Kt,c),R(a,Kt,c);const u=R(o,Ct);oe(u,r,o),oe(u,n.domain,o);const d=ft();oe(c,n.domain,d),oe(d,n.domain,d);const f=R(d,Ct);oe(f,n.domain,d);const h=ft(Vc);oe(f,n.tld,h),oe(f,n.utld,h),R(c,Pr,h);const p=R(d,ht);R(p,ht,p),oe(p,n.domain,d),oe(h,n.domain,d),R(h,Ct,f),R(h,ht,p);const g=R(h,Gt);oe(g,n.numeric,Vc);const y=R(i,ht),b=R(i,Ct);R(y,ht,y),oe(y,n.domain,i),oe(b,r,o),oe(b,n.domain,i);const k=ft(us);oe(b,n.tld,k),oe(b,n.utld,k),oe(k,n.domain,i),oe(k,r,o),R(k,Ct,b),R(k,ht,y),R(k,Kt,c);const C=R(k,Gt),E=ft(us);oe(C,n.numeric,E);const w=ft(us),S=ft();oe(w,e,w),oe(w,t,S),oe(S,e,w),oe(S,t,S),R(k,Mt,w),R(E,Mt,w);const M=R(l,Gt),O=R(a,Gt),A=R(O,Mt),$=R(A,Mt);oe(l,n.domain,i),R(l,Ct,b),R(l,ht,y),oe(a,n.domain,i),R(a,Ct,b),R(a,ht,y),oe(M,n.domain,w),R(M,Mt,w),R(M,Cr,w),oe($,n.domain,w),oe($,e,w),R($,Mt,w);const W=[[kr,vr],[_s,Bs],[zs,Fs],[$s,Vs],[Hs,Ws],[Us,qs],[Ks,Ys],[Js,Gs]];for(let U=0;U<W.length;U++){const[_,J]=W[U],G=R(w,_);R(S,_,G),R(G,J,w);const Q=ft(us);oe(G,e,Q);const V=ft();oe(G,t),oe(Q,e,Q),oe(Q,t,V),oe(V,e,Q),oe(V,t,V),R(Q,J,w),R(V,J,w)}return R(s,Pr,k),R(s,Fl,qx),{start:s,tokens:If}}function Yx(n,e,t){let r=t.length,s=0,o=[],i=[];for(;s<r;){let l=n,a=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(a=l.go(t[s].t));)i.push(t[s++]);for(;s<r&&(c=a||l.go(t[s].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(i.push(t[s]),s++);else{i.length>0&&(o.push(Si(Hc,e,i)),i=[]),s-=f,u-=f;const h=d.t,p=t.slice(s-u,s);o.push(Si(h,e,p))}}return i.length>0&&o.push(Si(Hc,e,i)),o}function Si(n,e,t){const r=t[0].s,s=t[t.length-1].e,o=e.slice(r,s);return new n(o,t)}const Jx=typeof console<"u"&&console&&console.warn||(()=>{}),Gx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Me={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Xx(){return st.groups={},Me.scanner=null,Me.parser=null,Me.tokenQueue=[],Me.pluginQueue=[],Me.customSchemes=[],Me.initialized=!1,Me}function Wc(n,e=!1){if(Me.initialized&&Jx(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Gx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
163
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
164
|
+
2. Cannot start or end with "-"
|
|
165
|
+
3. "-" cannot repeat`);Me.customSchemes.push([n,e])}function Qx(){Me.scanner=Wx(Me.customSchemes);for(let n=0;n<Me.tokenQueue.length;n++)Me.tokenQueue[n][1]({scanner:Me.scanner});Me.parser=Kx(Me.scanner.tokens);for(let n=0;n<Me.pluginQueue.length;n++)Me.pluginQueue[n][1]({scanner:Me.scanner,parser:Me.parser});return Me.initialized=!0,Me}function ql(n){return Me.initialized||Qx(),Yx(Me.parser.start,n,jf(Me.scanner.start,n))}ql.scan=jf;function _f(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Ul(t),s=ql(n),o=[];for(let i=0;i<s.length;i++){const l=s[i];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Kl="[\0- -\u2029 ]",Zx=new RegExp(Kl),e1=new RegExp(`${Kl}$`),t1=new RegExp(Kl,"g");function n1(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function r1(n){return new Ne({key:new Fe("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!s||o)return;const{tr:i}=r,l=Xd(t.doc,[...e]);if(lf(l).forEach(({newRange:c})=>{const u=i0(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!e1.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Zx).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const y=ql(p).map(b=>b.toObject(n.defaultProtocol));if(!n1(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Pl(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||i.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!i.steps.length)return i}})}function s1(n){return new Ne({key:new Fe("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,o;if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;i=d.find(f=>f.nodeName==="A")}if(!i)return!1;const l=of(e.state,n.type.name),a=(s=i==null?void 0:i.href)!=null?s:l.href,c=(o=i==null?void 0:i.target)!=null?o:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),i&&a?(window.open(a,c),!0):!1}}})}function o1(n){return new Ne({key:new Fe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:s}=e,{selection:o}=s,{empty:i}=o;if(i)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=_f(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:n.editor.commands.setMark(n.type,{href:a.href})}}})}function yn(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(t1,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Bf=Dt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Wc(n);return}Wc(n.scheme,n.optionalSlashes)})},onDestroy(){Xx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!yn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!yn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!yn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Te(this.options.HTMLAttributes,n),0]:["a",Te(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!yn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!yn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ln({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=_f(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!yn(i,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(r1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!yn(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(s1({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(o1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),i1=Bf,l1=Object.defineProperty,a1=(n,e)=>{for(var t in e)l1(n,t,{get:e[t],enumerable:!0})},c1="listItem",Uc="textStyle",qc=/^\s*([-+*])\s$/,zf=ct.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",Te(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(c1,this.editor.getAttributes(Uc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Qn({find:qc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Qn({find:qc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Uc),editor:this.editor})),[n]}}),Ff=ct.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Te(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)}}}),u1={};a1(u1,{findListItemPos:()=>Hr,getNextListDepth:()=>Yl,handleBackspace:()=>sl,handleDelete:()=>ol,hasListBefore:()=>$f,hasListItemAfter:()=>d1,hasListItemBefore:()=>Vf,listItemHasSubList:()=>Hf,nextListIsDeeper:()=>Wf,nextListIsHigher:()=>Uf});var Hr=(n,e)=>{const{$from:t}=e.selection,r=Pe(n,e.schema);let s=null,o=t.depth,i=t.pos,l=null;for(;o>0&&l===null;)s=t.node(o),s.type===r?l=o:(o-=1,i-=1);return l===null?null:{$pos:e.doc.resolve(i),depth:l}},Yl=(n,e)=>{const t=Hr(n,e);if(!t)return!1;const[,r]=g0(e,n,t.$pos.pos+4);return r},$f=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),o=n.doc.resolve(s).node();return!(!o||!t.includes(o.type.name))},Vf=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((t=s.nodeBefore)==null?void 0:t.type.name)!==n)},Hf=(n,e,t)=>{if(!t)return!1;const r=Pe(n,e.schema);let s=!1;return t.descendants(o=>{o.type===r&&(s=!0)}),s},sl=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!on(n.state,e)&&$f(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=n.state.doc.resolve(a.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!on(n.state,e)||!k0(n.state))return!1;const r=Hr(e,n.state);if(!r)return!1;const o=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Hf(e,n.state,o);return Vf(e,n.state)&&!i?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Wf=(n,e)=>{const t=Yl(n,e),r=Hr(n,e);return!r||!t?!1:t>r.depth},Uf=(n,e)=>{const t=Yl(n,e),r=Hr(n,e);return!r||!t?!1:t<r.depth},ol=(n,e)=>{if(!on(n.state,e)||!x0(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:Wf(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Uf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},d1=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((t=s.nodeAfter)==null?void 0:t.type.name)!==n)},qf=Le.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ol(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ol(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&sl(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&sl(n,t,r)&&(e=!0)}),e}}}}),f1="listItem",Kc="textStyle",Yc=/^(\d+)\.\s$/,Kf=ct.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:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Te(this.options.HTMLAttributes,t),0]:["ol",Te(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(f1,this.editor.getAttributes(Kc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Qn({find:Yc,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=Qn({find:Yc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Kc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),h1=/^\s*(\[([( |x])?\])\s$/,p1=ct.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML: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",Te(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 s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var d,f;l.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(n),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p==null?void 0:p.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,i),s.append(o,a),Object.entries(e).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:a,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[Qn({find:h1,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),m1=ct.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",Te(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()}}});Le.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(zf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Ff.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(qf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Kf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(p1.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(m1.configure(this.options.taskList)),n}});var g1=ct.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Te(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),y1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,b1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,x1=Dt.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",Te(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[Rn({find:y1,type:this.type})]},addPasteRules(){return[ln({find:b1,type:this.type})]}}),k1=ct.create({name:"text",group:"inline"}),Yf=Dt.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",Te(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()}}}),v1=Yf;function S1(n={}){return new Ne({view(e){return new C1(e,n)}})}class C1{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(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,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,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!o){let i=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ju(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Ae extends ie{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Ae.valid(r)?new Ae(r):ie.near(r)}content(){return z.empty}eq(e){return e instanceof Ae&&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 Ae(e.resolve(t.pos))}getBookmark(){return new Jl(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!M1(e)||!w1(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Ae.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(t>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(t>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=t;let a=e.doc.resolve(s);if(Ae.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Y.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*t),r=!1;continue e}break}o=i,s+=t;let l=e.doc.resolve(s);if(Ae.valid(l))return l}return null}}}Ae.prototype.visible=!1;Ae.findFrom=Ae.findGapCursorFrom;ie.jsonID("gapcursor",Ae);class Jl{constructor(e){this.pos=e}map(e){return new Jl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ae.valid(t)?new Ae(t):ie.near(t)}}function M1(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 s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function w1(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 s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function E1(){return new Ne({props:{decorations:A1,createSelectionBetween(n,e,t){return e.pos==t.pos&&Ae.valid(t)?new Ae(t):null},handleClick:O1,handleKeyDown:T1,handleDOMEvents:{beforeinput:D1}}})}const T1=_d({ArrowLeft:ds("horiz",-1),ArrowRight:ds("horiz",1),ArrowUp:ds("vert",-1),ArrowDown:ds("vert",1)});function ds(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof ee){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Ae.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new Ae(c))),!0):!1}}function O1(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Ae.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&Y.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Ae(r))),!0)}function D1(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Ae))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 s=D.empty;for(let i=r.length-1;i>=0;i--)s=D.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new z(s,0,0));return o.setSelection(ee.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function A1(n){if(!(n.selection instanceof Ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ee.create(n.doc,[Qe.widget(n.selection.head,e,{key:"gapcursor"})])}var uo=200,ze=function(){};ze.prototype.append=function(e){return e.length?(e=ze.from(e),!this.length&&e||e.length<uo&&this.leafAppend(e)||this.length<uo&&e.leafPrepend(this)||this.appendInner(e)):this};ze.prototype.prepend=function(e){return e.length?ze.from(e).append(this):this};ze.prototype.appendInner=function(e){return new N1(this,e)};ze.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ze.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ze.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ze.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)};ze.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},t,r),s};ze.from=function(e){return e instanceof ze?e:e&&e.length?new Jf(e):ze.empty};var Jf=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(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=uo)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=uo)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ze);ze.empty=new Jf([]);var N1=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,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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}(ze);const R1=500;class bt{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 s,o;t&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,u.push(d);return}if(s){u.push(new wt(d.map));let h=d.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new wt(p,void 0,void 0,c.length+u.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(o)):d.selection,a=new bt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,t,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new wt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(i++,t=void 0),s||(a=f)}let c=i-r.depth;return c>I1&&(l=L1(l,c),i-=c),new bt(l.append(o),i)}remapping(e,t){let r=new Dr;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,t),r}addMaps(e){return this.eventCount==0?this:new bt(this.items.append(e.map(t=>new wt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new wt(p,g,y))}else r.push(new wt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new wt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new bt(u,l);return d.emptyItemCount()>R1&&(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,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=i.selection&&i.selection.map(t.slice(r));u&&o++;let d=new wt(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else i.map&&r--},this.items.length,0),new bt(ze.from(s.reverse()),o)}}bt.empty=new bt(ze.empty,0);function L1(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class wt{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new wt(t.getMap().invert(),t,this.selection)}}}class Yt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const I1=20;function j1(n,e,t,r){let s=t.getMeta(Tn),o;if(s)return s.historyState;t.getMeta(B1)&&(n=new Yt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(Tn))return i.getMeta(Tn).redo?new Yt(n.done.addTransform(t,void 0,r,ks(e)),n.undone,Jc(t.mapping.maps),n.prevTime,n.prevComposition):new Yt(n.done,n.undone.addTransform(t,void 0,r,ks(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!i&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!P1(t,n.prevRanges)),c=i?Ci(n.prevRanges,t.mapping):Jc(t.mapping.maps);return new Yt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ks(e)),bt.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new Yt(n.done.rebased(t,o),n.undone.rebased(t,o),Ci(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Yt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ci(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function P1(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(t=!0)}),t}function Jc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,o,i)=>e.push(o,i));return e}function Ci(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),o=e.map(n[r+1],-1);s<=o&&t.push(s,o)}return t}function _1(n,e,t){let r=ks(e),s=Tn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new Yt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(Tn,{redo:t,historyState:a})}let Mi=!1,Gc=null;function ks(n){let e=n.plugins;if(Gc!=e){Mi=!1,Gc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Mi=!0;break}}return Mi}const Tn=new Fe("history"),B1=new Fe("closeHistory");function z1(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ne({key:Tn,state:{init(){return new Yt(bt.empty,bt.empty,null,0,-1)},apply(e,t,r){return j1(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Xf:r=="historyRedo"?Qf:null;return s?(t.preventDefault(),s(e.state,e.dispatch)):!1}}}})}function Gf(n,e){return(t,r)=>{let s=Tn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=_1(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Xf=Gf(!1,!0),Qf=Gf(!0,!0);Le.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Ne({key:new Fe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var F1=Le.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[S1(this.options)]}});Le.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ne({key:new Fe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return Ee.create(n,[]);let i=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(Qe.node(c,c+a.nodeSize,{class:this.options.className}))}),Ee.create(n,o)}}})]}});var $1=Le.create({name:"gapCursor",addProseMirrorPlugins(){return[E1()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=xe(K(n,"allowGapCursor",t)))!=null?e:null}}});Le.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ne({key:new Fe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&jo(i);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=Qe.node(l,l+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),Ee.create(n,s)}}})]}});Le.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Ne({key:new Fe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||cf(t.selection)||n.view.dragging?null:Ee.create(t.doc,[Qe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Xc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var V1=Le.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new Fe(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new Ne({key:n,appendTransaction:(t,r,s)=>{const{doc:o,tr:i,schema:l}=s,a=n.getState(s),c=o.content.size,u=l.nodes[this.options.node];if(a)return i.insert(c,u.create())},state:{init:(t,r)=>{const s=r.tr.doc.lastChild;return!Xc({node:s,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const s=t.doc.lastChild;return!Xc({node:s,types:e})}}})]}}),H1=Le.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Xf(n,e),redo:()=>({state:n,dispatch:e})=>Qf(n,e)}},addProseMirrorPlugins(){return[z1(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()}}}),W1=Le.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(kx.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(mx.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(zf.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Cx.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(Ex.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(Tx.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(F1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push($1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Ox.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Dx.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(H1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(Ax.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(jx.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Ff.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(qf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Bf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Kf.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(g1.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(x1.configure(this.options.strike)),this.options.text!==!1&&s.push(k1.configure(this.options.text)),this.options.underline!==!1&&s.push(Yf.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(V1.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),U1=W1,q1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,K1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Y1=Dt.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",Te(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[Rn({find:q1,type:this.type})]},addPasteRules(){return[ln({find:K1,type:this.type})]}}),J1=Y1,G1=Le.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),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),X1=G1,Q1=Dt.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",Te(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()}}}),Z1=Q1,ek=Dt.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",Te(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()}}}),tk=ek,In={root:"m_dd3f7539",typographyStylesProvider:"m_d37966d9",content:"m_c2204cc2",linkEditorDropdown:"m_8a991b4f",control:"m_c2207da6",controlIcon:"m_9cdfeb3f",controlsGroup:"m_2ab47ef2",linkEditor:"m_b67b711e",linkEditorInput:"m_296cf94c",linkEditorExternalControl:"m_cfef614",linkEditorSave:"m_3b28e7bb",toolbar:"m_4574a3c4",taskList:"m_8b44009a"};const nk={linkControlLabel:"Link",colorPickerControlLabel:"Text color",highlightControlLabel:"Highlight text",colorControlLabel:n=>`Set text color ${n}`,boldControlLabel:"Bold",italicControlLabel:"Italic",underlineControlLabel:"Underline",strikeControlLabel:"Strikethrough",clearFormattingControlLabel:"Clear formatting",unlinkControlLabel:"Remove link",bulletListControlLabel:"Bullet list",orderedListControlLabel:"Ordered list",h1ControlLabel:"Heading 1",h2ControlLabel:"Heading 2",h3ControlLabel:"Heading 3",h4ControlLabel:"Heading 4",h5ControlLabel:"Heading 5",h6ControlLabel:"Heading 6",blockquoteControlLabel:"Blockquote",alignLeftControlLabel:"Align text: left",alignCenterControlLabel:"Align text: center",alignRightControlLabel:"Align text: right",alignJustifyControlLabel:"Align text: justify",codeControlLabel:"Code",codeBlockControlLabel:"Code block",subscriptControlLabel:"Subscript",superscriptControlLabel:"Superscript",unsetColorControlLabel:"Unset color",hrControlLabel:"Horizontal line",undoControlLabel:"Undo",redoControlLabel:"Redo",tasksControlLabel:"Task list",tasksSinkLabel:"Decrease task level",tasksLiftLabel:"Increase task level",linkEditorInputLabel:"Enter URL",linkEditorInputPlaceholder:"https://example.com/",linkEditorExternalLink:"Open link in a new tab",linkEditorInternalLink:"Open link in the same tab",linkEditorSave:"Save",colorPickerCancel:"Cancel",colorPickerClear:"Clear color",colorPickerColorPicker:"Color picker",colorPickerPalette:"Color palette",colorPickerSave:"Save",colorPickerColorLabel:n=>`Set text color ${n}`},[rk,$t]=v.createSafeContext("RichTextEditor component was not found in tree"),sk={},Gl=v.factory((n,e)=>{const t=v.useProps("RichTextEditorContent",sk,n),{classNames:r,className:s,style:o,styles:i,vars:l,...a}=t,c=$t();return c.withTypographyStyles?m.jsx(v.TypographyStylesProvider,{...c.getStyles("typographyStylesProvider",{className:s,style:o,styles:i,classNames:r}),unstyled:c.unstyled,ref:e,children:m.jsx(v.Box,{component:Pc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i}),...a})}):m.jsx(v.Box,{component:Pc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i,className:s,style:o}),...a})});Gl.classes=In;Gl.displayName="@mantine/tiptap/RichTextEditorContent";function fe(n){return m.jsx("svg",{...n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}function ok(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),m.jsx("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})]})}function ik(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 5l6 0"}),m.jsx("path",{d:"M7 19l6 0"}),m.jsx("path",{d:"M14 5l-4 14"})]})}function lk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),m.jsx("path",{d:"M5 19h14"})]})}function ak(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12l14 0"}),m.jsx("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})]})}function ck(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 15l4 4m0 -4l-4 4"}),m.jsx("path",{d:"M7 6v-1h11v1"}),m.jsx("path",{d:"M7 19l4 0"}),m.jsx("path",{d:"M13 5l-4 14"})]})}function uk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 18v-8l-2 2"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function dk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function fk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),m.jsx("path",{d:"M17 16a2 2 0 1 0 2 -2"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function hk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 18v-8l-4 6h5"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function pk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function mk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z"}),m.jsx("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function gk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 6l11 0"}),m.jsx("path",{d:"M9 12l11 0"}),m.jsx("path",{d:"M9 18l11 0"}),m.jsx("path",{d:"M5 6l0 .01"}),m.jsx("path",{d:"M5 12l0 .01"}),m.jsx("path",{d:"M5 18l0 .01"})]})}function yk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 6h9"}),m.jsx("path",{d:"M11 12h9"}),m.jsx("path",{d:"M12 18h8"}),m.jsx("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),m.jsx("path",{d:"M6 10v-6l-2 2"})]})}function bk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 22v-2"}),m.jsx("path",{d:"M9 15l6 -6"}),m.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),m.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}),m.jsx("path",{d:"M20 17h2"}),m.jsx("path",{d:"M2 7h2"}),m.jsx("path",{d:"M7 2v2"})]})}function xk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M6 15h15"}),m.jsx("path",{d:"M21 19h-15"}),m.jsx("path",{d:"M15 11h6"}),m.jsx("path",{d:"M21 7h-6"}),m.jsx("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),m.jsx("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})]})}function kk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M4 12l10 0"}),m.jsx("path",{d:"M4 18l14 0"})]})}function vk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M10 12l10 0"}),m.jsx("path",{d:"M6 18l14 0"})]})}function Sk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M8 12l8 0"}),m.jsx("path",{d:"M6 18l12 0"})]})}function Ck(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M4 12l16 0"}),m.jsx("path",{d:"M4 18l12 0"})]})}function Mk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),m.jsx("path",{d:"M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function wk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),m.jsx("path",{d:"M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function Zf(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 8l-4 4l4 4"}),m.jsx("path",{d:"M17 8l4 4l-4 4"}),m.jsx("path",{d:"M14 4l-4 16"})]})}function Ek(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),m.jsx("path",{d:"M12.5 5.5l4 4"}),m.jsx("path",{d:"M4.5 13.5l4 4"}),m.jsx("path",{d:"M21 15v4h-8l4 -4z"})]})}function Tk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12h2"}),m.jsx("path",{d:"M17 12h2"}),m.jsx("path",{d:"M11 12h2"})]})}function eh(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73"}),m.jsx("path",{d:"M3 3l18 18"})]})}function Ok(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 7l6 6"}),m.jsx("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]})}function Dk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M18 6l-12 12"}),m.jsx("path",{d:"M6 6l12 12"})]})}function Ak(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"}),m.jsx("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),m.jsx("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),m.jsx("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}function Nk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12l5 5l10 -10"})]})}function Rk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 15l6 -6"}),m.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),m.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"})]})}function Lk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),m.jsx("path",{d:"M11 13l9 -9"}),m.jsx("path",{d:"M15 4h5v5"})]})}function Ik(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 14l-4 -4l4 -4"}),m.jsx("path",{d:"M5 10h11a4 4 0 1 1 0 8h-1"})]})}function jk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M15 14l4 -4l-4 -4"}),m.jsx("path",{d:"M19 10h-11a4 4 0 1 0 0 8h1"})]})}function Pk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M11 6l9 0"}),m.jsx("path",{d:"M11 12l9 0"}),m.jsx("path",{d:"M11 18l9 0"})]})}function _k(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 6l-11 0"}),m.jsx("path",{d:"M20 12l-7 0"}),m.jsx("path",{d:"M20 18l-11 0"}),m.jsx("path",{d:"M4 8l4 4l-4 4"})]})}function Bk(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 6l-7 0"}),m.jsx("path",{d:"M20 12l-9 0"}),m.jsx("path",{d:"M20 18l-7 0"}),m.jsx("path",{d:"M8 8l-4 4l4 4"})]})}const zk={interactive:!0},tr=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControl",zk,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=$t();return m.jsx(v.UnstyledButton,{...f,...h.getStyles("control",{className:s,style:o,classNames:r,styles:i}),disabled:d,"data-rich-text-editor-control":!0,tabIndex:a?0:-1,"data-interactive":a||void 0,"data-disabled":d||void 0,"data-active":c||void 0,"aria-pressed":c&&a||void 0,"aria-hidden":!a||void 0,ref:e,unstyled:h.unstyled,variant:h.variant||"default",onMouseDown:p=>{p.preventDefault(),u==null||u(p)}})});tr.classes=In;tr.displayName="@mantine/tiptap/RichTextEditorControl";const Xl=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=$t();return m.jsx(tr,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});Xl.displayName="@mantine/tiptap/RichTextEditorControlBase";function ye({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=$t(),u=c[n];return m.jsx(Xl,{...i,"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run(),icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1})});return o.displayName=`@mantine/tiptap/${n}`,o}const Fk=ye({label:"boldControlLabel",icon:n=>m.jsx(ok,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),$k=ye({label:"italicControlLabel",icon:n=>m.jsx(ik,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),Vk=ye({label:"underlineControlLabel",icon:n=>m.jsx(lk,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Hk=ye({label:"strikeControlLabel",icon:n=>m.jsx(ak,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Wk=ye({label:"clearFormattingControlLabel",icon:n=>m.jsx(ck,{...n}),operation:{name:"unsetAllMarks"}}),Uk=ye({label:"unlinkControlLabel",icon:n=>m.jsx(bk,{...n}),operation:{name:"unsetLink"}}),qk=ye({label:"bulletListControlLabel",icon:n=>m.jsx(gk,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Kk=ye({label:"orderedListControlLabel",icon:n=>m.jsx(yk,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Yk=ye({label:"h1ControlLabel",icon:n=>m.jsx(uk,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Jk=ye({label:"h2ControlLabel",icon:n=>m.jsx(dk,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Gk=ye({label:"h3ControlLabel",icon:n=>m.jsx(fk,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),Xk=ye({label:"h4ControlLabel",icon:n=>m.jsx(hk,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Qk=ye({label:"h5ControlLabel",icon:n=>m.jsx(pk,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),Zk=ye({label:"h6ControlLabel",icon:n=>m.jsx(mk,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),ev=ye({label:"blockquoteControlLabel",icon:n=>m.jsx(xk,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),tv=ye({label:"alignLeftControlLabel",icon:n=>m.jsx(kk,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),nv=ye({label:"alignRightControlLabel",icon:n=>m.jsx(vk,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),rv=ye({label:"alignCenterControlLabel",icon:n=>m.jsx(Sk,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),sv=ye({label:"alignJustifyControlLabel",icon:n=>m.jsx(Ck,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),ov=ye({label:"subscriptControlLabel",icon:n=>m.jsx(Mk,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),iv=ye({label:"superscriptControlLabel",icon:n=>m.jsx(wk,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),lv=ye({label:"codeControlLabel",icon:n=>m.jsx(Zf,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),av=ye({label:"codeBlockControlLabel",icon:n=>m.jsx(Zf,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),cv=ye({label:"highlightControlLabel",icon:n=>m.jsx(Ek,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),uv=ye({label:"hrControlLabel",icon:n=>m.jsx(Tk,{...n}),operation:{name:"setHorizontalRule"}}),dv=ye({label:"unsetColorControlLabel",icon:n=>m.jsx(eh,{...n}),operation:{name:"unsetColor"}}),fv=ye({label:"undoControlLabel",icon:n=>m.jsx(Ik,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),hv=ye({label:"redoControlLabel",icon:n=>m.jsx(jk,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),pv=ye({label:"tasksControlLabel",icon:n=>m.jsx(Pk,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),mv=ye({label:"tasksSinkLabel",icon:n=>m.jsx(_k,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),gv=ye({label:"tasksLiftLabel",icon:n=>m.jsx(Bk,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),yv=n=>m.jsx(Rk,{...n}),bv={},Ql=v.factory((n,e)=>{var U;const t=v.useProps("RichTextEditorLinkControl",bv,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=$t(),p={classNames:r,styles:i},[g,y]=zp(""),[b,k]=T.useState(d),[C,{open:E,close:w}]=dl(!1),S=()=>{var J;E();const _=(J=h.editor)==null?void 0:J.getAttributes("link");y((_==null?void 0:_.href)||""),k(_!=null&&_.href?(_==null?void 0:_.target)==="_blank":d)},M=()=>{w(),y(""),k(d)},O=()=>{var _,J;M(),g===""?(_=h.editor)==null||_.chain().focus().extendMarkRange("link").unsetLink().run():(J=h.editor)==null||J.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},A=_=>{_.key==="Enter"&&(_.preventDefault(),O())};jp("edit-link",S,!1);const{resolvedClassNames:$,resolvedStyles:W}=v.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(v.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:C,onChange:_=>!_&&M(),offset:-44,zIndex:1e4,...c,children:[m.jsx(v.Popover.Target,{children:m.jsx(Xl,{icon:a||yv,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:S,active:(U=h.editor)==null?void 0:U.isActive("link"),ref:e,classNames:$,styles:W,className:s,style:o,variant:h.variant})}),m.jsx(v.Popover.Dropdown,{...h.getStyles("linkEditorDropdown",p),children:m.jsxs("div",{...h.getStyles("linkEditor",p),children:[m.jsx(v.TextInput,{placeholder:h.labels.linkEditorInputPlaceholder,"aria-label":h.labels.linkEditorInputLabel,type:"url",value:g,onChange:y,classNames:{input:h.getStyles("linkEditorInput",p).className},onKeyDown:A,rightSection:m.jsx(v.Tooltip,{label:b?h.labels.linkEditorExternalLink:h.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:u,zIndex:1e4,children:m.jsx(v.UnstyledButton,{onClick:()=>k(_=>!_),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(Lk,{style:{width:v.rem(14),height:v.rem(14)}})})})}),m.jsx(v.Button,{variant:"default",onClick:O,...h.getStyles("linkEditorSave",p),children:h.labels.linkEditorSave})]})})]})});Ql.classes=In;Ql.displayName="@mantine/tiptap/RichTextEditorLinkControl";const xv={},th=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=v.useProps("RichTextEditorColorPickerControl",xv,n),{editor:i,labels:l,getStyles:a,variant:c}=$t(),[u,{toggle:d,close:f}]=dl(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(C,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(C).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((C,E)=>m.jsx(v.ColorSwatch,{component:"button",color:C,onClick:()=>y(C),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(C),"aria-label":l.colorPickerColorLabel(C)},E));return m.jsxs(v.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:C=>!C&&f(),...t,children:[m.jsx(v.Popover.Target,{children:m.jsx(tr,{...o,variant:c,"aria-label":l.colorPickerControlLabel,title:l.colorPickerControlLabel,ref:e,onClick:d,children:m.jsx(v.ColorSwatch,{color:g,size:14})})}),m.jsxs(v.Popover.Dropdown,{...a("linkEditorDropdown"),children:[h==="palette"&&m.jsx(v.SimpleGrid,{cols:7,spacing:2,children:k}),h==="colorPicker"&&m.jsx(v.ColorPicker,{defaultValue:g,onChange:C=>y(C,!1),...s}),m.jsx(v.Tooltip.Group,{closeDelay:200,children:m.jsxs(v.Group,{justify:"flex-end",gap:"xs",mt:"sm",children:[h==="palette"&&m.jsx(v.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerCancel,"aria-label":l.colorPickerCancel,children:m.jsx(Dk,{style:{width:v.rem(16),height:v.rem(16)}})}),m.jsx(v.ActionIcon,{variant:"default",onClick:b,title:l.colorPickerClear,"aria-label":l.colorPickerClear,children:m.jsx(eh,{style:{width:v.rem(16),height:v.rem(16)}})}),h==="palette"?m.jsx(v.ActionIcon,{variant:"default",onClick:()=>p("colorPicker"),title:l.colorPickerColorPicker,"aria-label":l.colorPickerColorPicker,children:m.jsx(Ok,{style:{width:v.rem(16),height:v.rem(16)}})}):m.jsx(v.ActionIcon,{variant:"default",onClick:()=>p("palette"),"aria-label":l.colorPickerPalette,title:l.colorPickerPalette,children:m.jsx(Ak,{style:{width:v.rem(16),height:v.rem(16)}})}),h==="colorPicker"&&m.jsx(v.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerSave,"aria-label":l.colorPickerSave,children:m.jsx(Nk,{style:{width:v.rem(16),height:v.rem(16)}})})]})})]})]})});th.displayName="@mantine/tiptap/ColorPickerControl";const kv={},nh=T.forwardRef((n,e)=>{const{color:t,...r}=v.useProps("RichTextEditorColorControl",kv,n),{editor:s,labels:o,variant:i}=$t(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(tr,{...r,variant:i,active:l===t,"aria-label":a,title:a,onClick:()=>(s==null?void 0:s.chain()).focus().setColor(t).run(),ref:e,children:m.jsx(v.ColorSwatch,{color:t,size:14})})});nh.displayName="@mantine/tiptap/RichTextEditorColorControl";const vv={},Zl=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControlsGroup",vv,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=$t();return m.jsx(v.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});Zl.classes=In;Zl.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const Sv={},ea=v.factory((n,e)=>{const t=v.useProps("RichTextEditorToolbar",Sv,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=$t();return m.jsx(v.Box,{ref:e,mod:[{sticky:a},u],variant:d||h.variant,...h.getStyles("toolbar",{className:s,style:o,styles:i,classNames:r}),...f,__vars:{"--rte-sticky-offset":v.rem(c)}})});ea.classes=In;ea.displayName="@mantine/tiptap/RichTextEditorToolbar";const Cv={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},B=v.factory((n,e)=>{const t=v.useProps("RichTextEditor",Cv,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,labels:f,children:h,variant:p,...g}=t,y=v.useStyles({name:"RichTextEditor",classes:In,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,vars:a}),b=T.useMemo(()=>({...nk,...f}),[f]);return m.jsx(rk,{value:{editor:c,getStyles:y,labels:b,withCodeHighlightStyles:u,withTypographyStyles:d,unstyled:l,variant:p},children:m.jsx(v.Box,{...y("root"),...g,ref:e,children:h})})});B.classes=In;B.displayName="@mantine/tiptap/RichTextEditor";B.Content=Gl;B.Control=tr;B.Toolbar=ea;B.ControlsGroup=Zl;B.Bold=Fk;B.Italic=$k;B.Strikethrough=Hk;B.Underline=Vk;B.ClearFormatting=Wk;B.H1=Yk;B.H2=Jk;B.H3=Gk;B.H4=Xk;B.H5=Qk;B.H6=Zk;B.BulletList=qk;B.OrderedList=Kk;B.Link=Ql;B.Unlink=Uk;B.Blockquote=ev;B.AlignLeft=tv;B.AlignRight=nv;B.AlignCenter=rv;B.AlignJustify=sv;B.Superscript=iv;B.Subscript=ov;B.Code=lv;B.CodeBlock=av;B.ColorPicker=th;B.Color=nh;B.Highlight=cv;B.Hr=uv;B.UnsetColor=dv;B.Undo=fv;B.Redo=hv;B.TaskList=pv;B.TaskListSink=mv;B.TaskListLift=gv;function Mv({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=ux({editable:!r&&!s,extensions:[U1,v1,i1,Z1,tk,J1,X1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs(B,{editor:o,h:400,children:[m.jsxs(B.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs(B.ControlsGroup,{children:[m.jsx(B.Bold,{}),m.jsx(B.Italic,{}),m.jsx(B.Underline,{}),m.jsx(B.Strikethrough,{}),m.jsx(B.ClearFormatting,{}),m.jsx(B.Highlight,{}),m.jsx(B.Code,{})]}),m.jsxs(B.ControlsGroup,{children:[m.jsx(B.H1,{}),m.jsx(B.H2,{}),m.jsx(B.H3,{}),m.jsx(B.H4,{})]}),m.jsxs(B.ControlsGroup,{children:[m.jsx(B.Blockquote,{}),m.jsx(B.Hr,{}),m.jsx(B.BulletList,{}),m.jsx(B.OrderedList,{}),m.jsx(B.Subscript,{}),m.jsx(B.Superscript,{})]}),m.jsxs(B.ControlsGroup,{children:[m.jsx(B.Link,{}),m.jsx(B.Unlink,{})]}),m.jsxs(B.ControlsGroup,{children:[m.jsx(B.AlignLeft,{}),m.jsx(B.AlignCenter,{}),m.jsx(B.AlignJustify,{}),m.jsx(B.AlignRight,{})]}),m.jsxs(B.ControlsGroup,{children:[m.jsx(B.Undo,{}),m.jsx(B.Redo,{})]})]}),m.jsx(B.Content,{})]})}function wv({field:n,form:e}){const t=n,r=e.getInputProps(t.name),s=t.readOnly===!0,o=t.disabled===!0;return s||o?m.jsx(v.Select,{data:t.data,value:r.value,disabled:o||s,readOnly:s,placeholder:t.placeholder,required:t.required,variant:s?"filled":"default",error:void 0}):m.jsx(v.Select,{...r,data:t.data,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function Ev({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.Switch,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0,checked:t.value}):m.jsx(v.Switch,{...t,checked:t.value,onChange:o=>t.onFieldChange(o.target.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function Tv({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.TagsInput,{value:t.value||[],readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.TagsInput,{value:t.value||[],onChange:o=>t.onChange(o),required:n.required,placeholder:n.placeholder,error:void 0})}function Ov({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.TextInput,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.TextInput,{...t,onChange:o=>t.onFieldChange(o.target.value),required:n.required,placeholder:n.placeholder,error:void 0})}function Dv({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=typeof t.value=="string"?t.value:"",i=T.useRef(null),l=m.jsx(v.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>{var a;return(a=i.current)==null?void 0:a.showPicker()},children:"⏰"});return r||s?m.jsx(wr,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(wr,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}function Av({field:n,form:e,children:t}){const{error:r}=e.getInputProps(n.name);return m.jsxs(v.Stack,{gap:4,children:[n.label&&m.jsxs(v.Text,{fw:500,size:"sm",mb:2,component:"label",htmlFor:n.name,style:{display:"block"},children:[n.label," ",n.required&&m.jsx(v.Text,{component:"span",c:"red",fz:"sm",children:"*"})]}),m.jsx(v.Box,{children:t}),n.description&&m.jsx(v.Text,{size:"xs",c:"dimmed",mt:2,style:{lineHeight:1.4},children:n.description}),r&&m.jsx(v.Text,{size:"xs",c:"red",mt:2,style:{fontWeight:500},children:r})]})}function Qc({field:n,layout:e,children:t}){if(e==="grid"){const r=n.column??6;return m.jsx(v.Grid.Col,{span:{base:12,md:r},children:t})}return e==="horizontal"?m.jsx(v.Box,{style:{display:"flex",alignItems:"center",gap:12},children:t}):m.jsx(v.Stack,{gap:"xs",children:t})}function ta(n){const{layout:e,field:t,form:r,customRenderers:s,readOnly:o}=n,i={...t,readOnly:t.readOnly||o};let l=null;if(s){const a=s(r,i);if(a)return m.jsx(Qc,{field:i,layout:e,children:a})}switch(i.type){case"text":l=m.jsx(Ov,{field:i,form:n.form});break;case"select":l=m.jsx(wv,{field:i,form:n.form});break;case"object":l=m.jsx(Xp,{field:i,form:r,layout:e});break;case"array":l=m.jsx(Ih,{field:i,form:r,layout:e});break;case"checkbox":l=m.jsx(jh,{field:i,form:r});break;case"number":l=m.jsx(Gp,{field:i,form:r});break;case"date":l=m.jsx(Yp,{field:i,form:r});break;case"datetime":l=m.jsx(Jp,{field:i,form:r});break;case"switch":l=m.jsx(Ev,{field:i,form:r});break;case"texteditor":l=m.jsx(Mv,{field:i,form:r});break;case"time":l=m.jsx(Dv,{field:i,form:r});break;case"tags":l=m.jsx(Tv,{field:i,form:r});break;default:l=m.jsxs("div",{children:["Unsupported field type: ",i.type]})}return m.jsx(Qc,{field:i,layout:e,children:m.jsx(Av,{field:i,form:r,children:l})})}function Nv({schema:n,values:e,layout:t="vertical",readOnly:r,validate:s,onSubmit:o,onFieldChange:i,customRenderers:l,updateFieldSchema:a,transformBeforeSubmit:c=f=>f,transformAfterSubmit:u=()=>{},submitButton:d=!0}){const f=Rh({initialValues:il(n),validate:s,transformValues:c,enhanceGetInputProps(y){return{onFieldChange:async b=>{var k;y.inputProps.onChange(b),await((k=i==null?void 0:i[y.field])==null?void 0:k.call(i,b,f))}}}}),h=eu[t],p=T.useMemo(()=>{if(!a)return n;const y=f.getValues();return n.map(b=>{const k=a[b.name];return k?k(b,y):b})},[n,f.values,a]),g=f.onSubmit(async y=>{await o(y),u(y)});return T.useEffect(()=>{e&&(f.setValues(e),f.resetDirty(e))},[e]),m.jsxs("form",{onSubmit:g,children:[h(m.jsx(m.Fragment,{children:p.map(y=>m.jsx(ta,{field:y,form:f,layout:t,readOnly:r,customRenderers:l==null?void 0:l[y.name]},y.name))})),typeof d=="boolean"?d?m.jsx(v.Group,{justify:"flex-end",mt:"md",children:m.jsx(v.Button,{type:"submit",children:"Submit"})}):null:d]})}exports.AutoForm=Nv;
|