autoforma 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AutoForm/AutoForm.types.d.ts +3 -8
- package/dist/fields/FieldRenderer/DefaultFieldRender.d.ts +8 -0
- package/dist/fields/renderer-resolver/FieldFieldTypeHandler.d.ts +10 -0
- package/dist/fields/renderer-resolver/RendererHandler.d.ts +1 -1
- package/dist/fields/renderer-resolver/RendererResolverChain.d.ts +1 -1
- package/dist/index.cjs.js +35 -35
- package/dist/index.d.ts +3 -2
- package/dist/index.es.js +1210 -1177
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ah=Object.defineProperty;var Oh=(n,e,t)=>e in n?Ah(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ha=(n,e,t)=>Oh(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),v=require("@mantine/core"),R=require("dayjs"),Dh=require("react-dom");function rl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Br={exports:{}},Xn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.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 pa;function
|
|
9
|
+
*/var pa;function Nh(){if(pa)return Xn;pa=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var l in s)l!=="key"&&(o[l]=s[l])}else o=s;return s=o.ref,{$$typeof:n,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Xn.Fragment=e,Xn.jsx=t,Xn.jsxs=t,Xn}var Qn={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,12 +14,12 @@
|
|
|
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 ma;function
|
|
17
|
+
*/var ma;function Rh(){return ma||(ma=1,process.env.NODE_ENV!=="production"&&(function(){function n(S){if(S==null)return null;if(typeof S=="function")return S.$$typeof===Y?null:S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case y:return"Fragment";case k:return"Profiler";case b:return"StrictMode";case x:return"Suspense";case M:return"SuspenseList";case B:return"Activity"}if(typeof S=="object")switch(typeof S.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),S.$$typeof){case g:return"Portal";case E:return S.displayName||"Context";case w:return(S._context.displayName||"Context")+".Consumer";case C:var A=S.render;return S=S.displayName,S||(S=A.displayName||A.name||"",S=S!==""?"ForwardRef("+S+")":"ForwardRef"),S;case O:return A=S.displayName||null,A!==null?A:n(S.type)||"Memo";case j:A=S._payload,S=S._init;try{return n(S(A))}catch{}}return null}function e(S){return""+S}function t(S){try{e(S);var A=!1}catch{A=!0}if(A){A=console;var D=A.error,P=typeof Symbol=="function"&&Symbol.toStringTag&&S[Symbol.toStringTag]||S.constructor.name||"Object";return D.call(A,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",P),e(S)}}function r(S){if(S===y)return"<>";if(typeof S=="object"&&S!==null&&S.$$typeof===j)return"<...>";try{var A=n(S);return A?"<"+A+">":"<...>"}catch{return"<...>"}}function s(){var S=V.A;return S===null?null:S.getOwner()}function o(){return Error("react-stack-top-frame")}function i(S){if(F.call(S,"key")){var A=Object.getOwnPropertyDescriptor(S,"key").get;if(A&&A.isReactWarning)return!1}return S.key!==void 0}function l(S,A){function D(){J||(J=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",A))}D.isReactWarning=!0,Object.defineProperty(S,"key",{get:D,configurable:!0})}function a(){var S=n(this.type);return X[S]||(X[S]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),S=this.props.ref,S!==void 0?S:null}function c(S,A,D,P,K,de){var N=D.ref;return S={$$typeof:p,type:S,key:A,props:D,_owner:P},(N!==void 0?N:null)!==null?Object.defineProperty(S,"ref",{enumerable:!1,get:a}):Object.defineProperty(S,"ref",{enumerable:!1,value:null}),S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(S,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(S,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(S,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:de}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S}function u(S,A,D,P,K,de){var N=A.children;if(N!==void 0)if(P)if(q(N)){for(P=0;P<N.length;P++)d(N[P]);Object.freeze&&Object.freeze(N)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(N);if(F.call(A,"key")){N=n(S);var Q=Object.keys(A).filter(function(te){return te!=="key"});P=0<Q.length?"{key: someKey, "+Q.join(": ..., ")+": ...}":"{key: someKey}",I[N+P]||(Q=0<Q.length?"{"+Q.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,P,N,Q,N),I[N+P]=!0)}if(N=null,D!==void 0&&(t(D),N=""+D),i(A)&&(t(A.key),N=""+A.key),"key"in A){D={};for(var oe in A)oe!=="key"&&(D[oe]=A[oe])}else D=A;return N&&l(D,typeof S=="function"?S.displayName||S.name||"Unknown":S),c(S,N,D,s(),K,de)}function d(S){f(S)?S._store&&(S._store.validated=1):typeof S=="object"&&S!==null&&S.$$typeof===j&&(S._payload.status==="fulfilled"?f(S._payload.value)&&S._payload.value._store&&(S._payload.value._store.validated=1):S._store&&(S._store.validated=1))}function f(S){return typeof S=="object"&&S!==null&&S.$$typeof===p}var h=T,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),E=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),V=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,q=Array.isArray,G=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(S){return S()}};var J,X={},W=h.react_stack_bottom_frame.bind(h,o)(),U=G(r(o)),I={};Qn.Fragment=y,Qn.jsx=function(S,A,D){var P=1e4>V.recentlyCreatedOwnerStacks++;return u(S,A,D,!1,P?Error("react-stack-top-frame"):W,P?G(r(S)):U)},Qn.jsxs=function(S,A,D){var P=1e4>V.recentlyCreatedOwnerStacks++;return u(S,A,D,!0,P?Error("react-stack-top-frame"):W,P?G(r(S)):U)}})()),Qn}var ga;function Rh(){return ga||(ga=1,process.env.NODE_ENV==="production"?Br.exports=Dh():Br.exports=Nh()),Br.exports}var m=Rh();function Lh(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 Ih=typeof window<"u"?T.useLayoutEffect:T.useEffect;function _e(n,e){Ih(()=>{if(n)return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[n])}function jh(n,e){n&&Lh(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 Ph(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 Si(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 _h(n){const[e,t]=T.useState(Si(n)),r=T.useRef(e),s=T.useCallback(a=>{t(c=>{const u=Si(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 Ci(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 ya(n,e){const t=n.substring(e.length+1).split(".")[0];return parseInt(t,10)}function ba(n,e,t,r){if(e===void 0)return t;const s=`${String(n)}`;let o=t;r===-1&&(o=Ci(`${s}.${e}`,o));const i={...o},l=new Set;return Object.entries(o).filter(([a])=>{if(!a.startsWith(`${s}.`))return!1;const c=ya(a,s);return Number.isNaN(c)?!1:c>=e}).forEach(([a,c])=>{const u=ya(a,s),d=a.replace(`${s}.${u}`,`${s}.${u+r}`);i[d]=c,l.add(d),l.has(a)||delete i[a]}),i}function Bh(n,{from:e,to:t},r){const s=`${n}.${e}`,o=`${n}.${t}`,i={...r},l=new Set;return Object.keys(r).forEach(a=>{if(l.has(a))return;let c,u;if(a.startsWith(s)?(c=a,u=a.replace(s,o)):a.startsWith(o)&&(c=a.replace(o,s),u=a),c&&u){const d=i[c],f=i[u];f===void 0?delete i[c]:i[c]=f,d===void 0?delete i[u]:i[u]=d,l.add(c),l.add(u)}}),i}function ka(n,e,t){typeof t.value=="object"&&(t.value=Bn(t.value)),!t.enumerable||t.get||t.set||!t.configurable||!t.writable||e==="__proto__"?Object.defineProperty(n,e,t):n[e]=t.value}function Bn(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(Bn(i))})):o==="[object Map]"?(s=new Map,n.forEach(function(i,l){s.set(Bn(l),Bn(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(Bn(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++)ka(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]||ka(s,t,Object.getOwnPropertyDescriptor(n,t))}return s||n}function lu(n){return typeof n!="string"?[]:n.split(".")}function De(n,e){const t=lu(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 Nr(n,e,t){const r=lu(n);if(r.length===0)return t;const s=Bn(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 Fh(n,{from:e,to:t},r){const s=De(n,r);if(!Array.isArray(s))return r;const o=[...s],i=s[e];return o.splice(e,1),o.splice(t,0,i),Nr(n,o,r)}function zh(n,e,t,r){const s=De(n,r);if(!Array.isArray(s))return r;const o=[...s];return o.splice(typeof t=="number"?t:o.length,0,e),Nr(n,o,r)}function $h(n,e,t){const r=De(n,t);return Array.isArray(r)?Nr(n,r.filter((s,o)=>o!==e),t):t}function Vh(n,e,t,r){const s=De(n,r);if(!Array.isArray(s)||s.length<=t)return r;const o=[...s];return o[t]=e,Nr(n,o,r)}function Hh({$values:n,$errors:e,$status:t}){const r=T.useCallback((l,a)=>{t.clearFieldDirty(l),e.setErrors(c=>Bh(l,a,c)),n.setValues({values:Fh(l,a,n.refValues.current),updateState:!0})},[]),s=T.useCallback((l,a)=>{t.clearFieldDirty(l),e.setErrors(c=>ba(l,a,c,-1)),n.setValues({values:$h(l,a,n.refValues.current),updateState:!0})},[]),o=T.useCallback((l,a,c)=>{t.clearFieldDirty(l),e.setErrors(u=>ba(l,c,u,1)),n.setValues({values:zh(l,a,c,n.refValues.current),updateState:!0})},[]),i=T.useCallback((l,a,c)=>{t.clearFieldDirty(l),n.setValues({values:Vh(l,c,a,n.refValues.current),updateState:!0})},[]);return{reorderListItem:r,removeListItem:s,insertListItem:o,replaceListItem:i}}var zo,xa;function Wh(){return xa||(xa=1,zo=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}),zo}var Yh=Wh();const Fr=rl(Yh);function Zn(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 Uh({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(x=>{const M=typeof x=="function"?x(a.current):x;a.current=M,t==="controlled"&&o(M)},[]),d=T.useCallback((x,M=!1)=>{const O=typeof x=="function"?x(c.current):x;c.current=O,(t==="controlled"||M)&&l(O)},[]),f=T.useCallback(()=>u({}),[]),h=T.useCallback(x=>{const M=x?{...r.refValues.current,...x}:r.refValues.current;r.setValuesSnapshot(M),d({})},[]),p=T.useCallback((x,M)=>{u(O=>Zn(O,x)===M?O:{...O,[x]:M})},[]),g=T.useCallback((x,M,O)=>{d(j=>Zn(j,x)===M?j:{...j,[x]:M},O)},[]),y=T.useCallback((x,M)=>{const O=Zn(c.current,x),j=!Fr(De(x,r.getValuesSnapshot()),M),B=Ci(x,c.current);B[x]=j,d(B,O!==j)},[]),b=T.useCallback(x=>Zn(a.current,x),[]),k=T.useCallback(x=>d(M=>{if(typeof x!="string")return M;const O=Ci(x,M);return delete O[x],Fr(O,M)?M:O}),[]),w=T.useCallback(x=>{if(x){const O=De(x,c.current);if(typeof O=="boolean")return O;const j=De(x,r.refValues.current),B=De(x,r.valuesSnapshot.current);return!Fr(j,B)}return Object.keys(c.current).length>0?Zn(c.current):!Fr(r.refValues.current,r.valuesSnapshot.current)},[]),E=T.useCallback(()=>c.current,[]),C=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:w,getDirty:E,getTouched:C,setCalculatedFieldDirty:y}}function qh({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:y,subscribers:b,updateState:k=!0,mergeWithPreviousValues:w=!0})=>{const E=i.current,C=y instanceof Function?y(i.current):y,x=w?{...E,...C}:C;i.current=x,k&&(o(x),t==="uncontrolled"&&(i.current=x)),e==null||e(x,E),b==null||b.filter(Boolean).forEach(M=>M({updatedValues:x,previousValues:E}))},[e]),c=T.useCallback(y=>{var w;const b=De(y.path,i.current),k=y.value instanceof Function?y.value(b):y.value;if(b!==k){const E=i.current,C=Nr(y.path,k,i.current);a({values:C,updateState:y.updateState}),(w=y.subscribers)==null||w.filter(Boolean).forEach(x=>x({path:y.path,updatedValues:C,previousValues:E}))}},[a]),u=T.useCallback(y=>{l.current=y},[]),d=T.useCallback((y,b)=>{r.current||(r.current=!0,a({values:y,updateState:t==="controlled"}),u(y),b())},[a]),f=T.useCallback(()=>{a({values:l.current,updateState:!0,mergeWithPreviousValues:!1})},[a]),h=T.useCallback(()=>i.current,[]),p=T.useCallback(()=>l.current,[]),g=T.useCallback((y,b)=>{const k=De(y,l.current);typeof k>"u"||c({path:y,value:k,updateState:t==="controlled",subscribers:b})},[c,t]);return{initialized:r,stateValues:s,refValues:i,valuesSnapshot:l,setValues:a,setFieldValue:c,resetValues:f,setValuesSnapshot:u,initialize:d,getValues:h,getValuesSnapshot:p,resetField:g}}function Kh({$status:n,cascadeUpdates:e}){const t=T.useRef({}),r=T.useCallback((o,i)=>{T.useEffect(()=>(t.current[o]=t.current[o]||[],t.current[o].push(i),()=>{t.current[o]=t.current[o].filter(l=>l!==i)}),[i])},[]),s=T.useCallback(o=>{var l;const i=((l=t.current[o])==null?void 0:l.map(a=>c=>a({previousValue:De(o,c.previousValues),value:De(o,c.updatedValues),touched:n.isTouched(o),dirty:n.isDirty(o)})))??[];if(e)for(const a in t.current)(a.startsWith(`${o}.`)||o.startsWith(`${a}.`))&&i.push(...t.current[a].map(c=>u=>c({previousValue:De(a,u.previousValues),value:De(a,u.updatedValues),touched:n.isTouched(a),dirty:n.isDirty(a)})));return i},[]);return{subscribers:t,watch:r,getFieldSubscribers:s}}function va(n,e){return n?`${n}-${e.toString()}`:e.toString()}const zr=Symbol("root-rule");function Sa(n){const e=Si(n);return{hasErrors:Object.keys(e).length>0,errors:e}}function Mi(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=De(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)=>Mi(i,e,`${l}.${d}`,s)),zr in i&&(s[l]=i[zr](a,e,l))),typeof i=="object"&&typeof a=="object"&&a!==null&&(c||Mi(i,e,l,s),zr in i&&(s[l]=i[zr](a,e,l))),s},r)}function wi(n,e){return Sa(typeof n=="function"?n(e):Mi(n,e))}function $r(n,e,t){if(typeof n!="string")return{hasError:!1,error:null};const r=wi(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 Jh="__MANTINE_FORM_INDEX__";function Ca(n,e){return e?typeof e=="boolean"?e:Array.isArray(e)?e.includes(n.replace(/[.][0-9]+/g,`.${Jh}`)):!1:!1}function Gh({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=(y=>y),enhanceGetInputProps:d,validate:f,onSubmitPreventDefault:h="always",touchTrigger:p="change",cascadeUpdates:g=!1}={}){const y=_h(r),b=qh({initialValues:t,onValuesChange:c,mode:e}),k=Uh({initialDirty:s,initialTouched:o,$values:b,mode:e}),w=Hh({$values:b,$errors:y,$status:k}),E=Kh({$status:k,cascadeUpdates:g}),[C,x]=T.useState(0),[M,O]=T.useState({}),[j,B]=T.useState(!1),Y=T.useCallback(()=>{b.resetValues(),y.clearErrors(),k.resetDirty(),k.resetTouched(),e==="uncontrolled"&&x(N=>N+1)},[]),V=T.useCallback(N=>{i&&y.clearErrors(),e==="uncontrolled"&&x(Q=>Q+1),Object.keys(E.subscribers.current).forEach(Q=>{const oe=De(Q,b.refValues.current),te=De(Q,N);oe!==te&&E.getFieldSubscribers(Q).forEach(pe=>pe({previousValues:N,updatedValues:b.refValues.current}))})},[i]),F=T.useCallback(N=>{const Q=b.refValues.current;b.initialize(N,()=>e==="uncontrolled"&&x(oe=>oe+1)),V(Q)},[V]),q=T.useCallback((N,Q,oe)=>{const te=Ca(N,l),pe=Q instanceof Function?Q(De(N,b.refValues.current)):Q;k.setCalculatedFieldDirty(N,pe),p==="change"&&k.setFieldTouched(N,!0),!te&&i&&y.clearFieldError(N),b.setFieldValue({path:N,value:Q,updateState:e==="controlled",subscribers:[...E.getFieldSubscribers(N),te?he=>{const ae=$r(N,f,he.updatedValues);ae.hasError?y.setFieldError(N,ae.error):y.clearFieldError(N)}:null,(oe==null?void 0:oe.forceUpdate)!==!1&&e!=="controlled"?()=>O(he=>({...he,[N]:(he[N]||0)+1})):null]})},[c,f]),G=T.useCallback(N=>{const Q=b.refValues.current;b.setValues({values:N,updateState:e==="controlled"}),V(Q)},[c,V]),J=T.useCallback(()=>{const N=wi(f,b.refValues.current);return y.setErrors(N.errors),N},[f]),X=T.useCallback(N=>{const Q=$r(N,f,b.refValues.current);return Q.hasError?y.setFieldError(N,Q.error):y.clearFieldError(N),Q},[f]),W=(N,{type:Q="input",withError:oe=!0,withFocus:te=!0,...pe}={})=>{const ae={onChange:Ph(se=>q(N,se,{forceUpdate:!1})),"data-path":va(n,N)};return oe&&(ae.error=y.errorsState[N]),Q==="checkbox"?ae[e==="controlled"?"checked":"defaultChecked"]=De(N,b.refValues.current):ae[e==="controlled"?"value":"defaultValue"]=De(N,b.refValues.current),te&&(ae.onFocus=()=>k.setFieldTouched(N,!0),ae.onBlur=()=>{if(Ca(N,a)){const se=$r(N,f,b.refValues.current);se.hasError?y.setFieldError(N,se.error):y.clearFieldError(N)}}),Object.assign(ae,d==null?void 0:d({inputProps:ae,field:N,options:{type:Q,withError:oe,withFocus:te,...pe},form:de}))},U=(N,Q)=>oe=>{h==="always"&&(oe==null||oe.preventDefault());const te=J();if(te.hasErrors)h==="validation-failed"&&(oe==null||oe.preventDefault()),Q==null||Q(te.errors,b.refValues.current,oe);else{const pe=N==null?void 0:N(u(b.refValues.current),oe);pe instanceof Promise&&(B(!0),pe.finally(()=>B(!1)))}},I=N=>u(N||b.refValues.current),S=T.useCallback(N=>{N.preventDefault(),Y()},[]),A=T.useCallback(N=>N?!$r(N,f,b.refValues.current).hasError:!wi(f,b.refValues.current).hasErrors,[f]),D=N=>`${C}-${String(N)}-${M[String(N)]||0}`,P=T.useCallback(N=>document.querySelector(`[data-path="${va(n,N)}"]`),[]),K=T.useCallback(N=>{b.resetField(N,[e!=="controlled"?()=>O(Q=>({...Q,[N]:(Q[N]||0)+1})):null])},[b.resetField,e,O]),de={watch:E.watch,initialized:b.initialized.current,values:e==="uncontrolled"?b.refValues.current:b.stateValues,getValues:b.getValues,getInitialValues:b.getValuesSnapshot,setInitialValues:b.setValuesSnapshot,resetField:K,initialize:F,setValues:G,setFieldValue:q,submitting:j,setSubmitting:B,errors:y.errorsState,setErrors:y.setErrors,setFieldError:y.setFieldError,clearFieldError:y.clearFieldError,clearErrors:y.clearErrors,resetDirty:k.resetDirty,setTouched:k.setTouched,setDirty:k.setDirty,isTouched:k.isTouched,resetTouched:k.resetTouched,isDirty:k.isDirty,getTouched:k.getTouched,getDirty:k.getDirty,reorderListItem:w.reorderListItem,insertListItem:w.insertListItem,removeListItem:w.removeListItem,replaceListItem:w.replaceListItem,reset:Y,validate:J,validateField:X,getInputProps:W,onSubmit:U,onReset:S,isValid:A,getTransformedValues:I,key:D,getInputNode:P};return jh(n,de),de}function Xh(){const n=T.createContext(null);function e({form:r,children:s}){return m.jsx(n.Provider,{value:r,children:s})}function t(){const r=T.useContext(n);if(!r)throw new Error("useFormContext was called outside of FormProvider context");return r}return[e,t,Gh]}const[Qh,au,Zh]=Xh(),cu=T.createContext(null),ep=({children:n,value:e})=>m.jsx(cu.Provider,{value:e,children:n}),tp=()=>{const n=T.useContext(cu);if(!n)throw new Error("useRenderers must be used inside <RendererProvider>");return n},uu=T.createContext(null),np=({children:n,value:e})=>m.jsx(uu.Provider,{value:e,children:n}),rp=()=>{const n=T.useContext(uu);if(!n)throw new Error("useUpdateFieldSchema must be used inside <UpdateFieldSchemaProvider>");return n},so=n=>{const{fieldSchema:e}=n,t=tp(),r=rp(),s=au(),[o,i]=T.useState(e);if(T.useEffect(()=>{let a=!1;async function c(){const u=e.name.replace(/\.\d+/g,""),d=r==null?void 0:r[u];if(typeof d=="function"){const f=await d(e.name,e,s.getValues());!a&&f&&i(f);return}a||i(e)}return c(),()=>{a=!0}},[e,r]),!o)return null;const l=t==null?void 0:t.resolve(o);return l?m.jsx(l,{field:o,form:s}):null};function sp({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.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function op({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 du({controlsRef:n,direction:e,levelIndex:t,rowIndex:r,cellIndex:s,size:o}){var a,c,u;const i=op({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")?du({controlsRef:n,direction:e,levelIndex:i.levelIndex,cellIndex:i.cellIndex,rowIndex:i.rowIndex,size:o}):l.focus())}function ip(n){switch(n){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function lp(n){var e;return(e=n.current)==null?void 0:e.map(t=>t.map(r=>r.length))}function sl({controlsRef:n,levelIndex:e,rowIndex:t,cellIndex:r,event:s}){const o=ip(s.key);if(o){s.preventDefault();const i=lp(n);du({controlsRef:n,direction:o,levelIndex:e,rowIndex:t,cellIndex:r,size:i})}}function Ma(n,e){let t=n?R(n):R();if(e==="")return t.format("YYYY-MM-DD HH:mm:ss");const[r,s,o=0]=e.split(":").map(Number);return t=t.set("hour",r),t=t.set("minute",s),t=t.set("second",o),t=t.set("millisecond",0),t.format("YYYY-MM-DD HH:mm:ss")}function He(n){return n==null||n===""?n:R(n).format("YYYY-MM-DD")}function Fn(n){return n==null||n===""?n:R(n).format("YYYY-MM-DD HH:mm:ss")}function ap({minDate:n,maxDate:e}){const t=R();return!n&&!e?He(t):n&&R(t).isBefore(n)?He(n):e&&R(t).isAfter(e)?He(e):He(t)}function $o(n,e,t){return!n&&!e?Fn(t):n&&R(t).isBefore(n)?Fn(n):e&&R(t).isAfter(e)?Fn(e):Fn(t)}const cp={locale:"en",firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:"–",consistentWeeks:!1},up=T.createContext(cp);function Rt(){const n=T.useContext(up),e=T.useCallback(o=>o||n.locale,[n.locale]),t=T.useCallback(o=>typeof o=="number"?o:n.firstDayOfWeek,[n.firstDayOfWeek]),r=T.useCallback(o=>Array.isArray(o)?o:n.weekendDays,[n.weekendDays]),s=T.useCallback(o=>typeof o=="string"?o:n.labelSeparator,[n.labelSeparator]);return{...n,getLocale:e,getFirstDayOfWeek:t,getWeekendDays:r,getLabelSeparator:s}}function dp({value:n,type:e,withTime:t}){const r=t?Fn:He;if(e==="range"&&Array.isArray(n)){const s=r(n[0]),o=r(n[1]);return s?o?`${s} – ${o}`:`${s} –`:""}return e==="multiple"&&Array.isArray(n)?n.filter(Boolean).join(", "):!Array.isArray(n)&&n?r(n):""}function ol({value:n,type:e,name:t,form:r,withTime:s=!1}){return m.jsx("input",{type:"hidden",value:dp({value:n,type:e,withTime:s}),name:t,form:r})}ol.displayName="@mantine/dates/HiddenDatesInput";function fu(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=fu(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function hu(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=fu(n))&&(r&&(r+=" "),r+=e);return r}var fp={input:"m_468e7eda"};const fs=v.factory((n,e)=>{const t=v.useProps("TimeInput",null,n),{classNames:r,styles:s,unstyled:o,vars:i,withSeconds:l,minTime:a,maxTime:c,value:u,onChange:d,step:f,...h}=t,{resolvedClassNames:p,resolvedStyles:g}=v.useResolvedStylesApi({classNames:r,styles:s,props:t}),y=k=>{if(a!==void 0||c!==void 0){const[w,E,C]=k.split(":").map(Number);if(a){const[x,M,O]=a.split(":").map(Number);if(w<x||w===x&&E<M||l&&w===x&&E===M&&C<O)return-1}if(c){const[x,M,O]=c.split(":").map(Number);if(w>x||w===x&&E>M||l&&w===x&&E===M&&C>O)return 1}}return 0},b=k=>{var w,E,C;if((w=t.onBlur)==null||w.call(t,k),a!==void 0||c!==void 0){const x=k.currentTarget.value;if(x){const M=y(x);M===1?(c&&(k.currentTarget.value=c),(E=t.onChange)==null||E.call(t,k)):M===-1&&(a&&(k.currentTarget.value=a),(C=t.onChange)==null||C.call(t,k))}}};return m.jsx(v.InputBase,{classNames:{...p,input:hu(fp.input,p==null?void 0:p.input)},styles:g,unstyled:o,ref:e,value:u,step:f??(l?1:60),...h,onChange:d,onBlur:b,type:"time",__staticSelector:"TimeInput"})});fs.classes=v.InputBase.classes;fs.displayName="@mantine/dates/TimeInput";function ts(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)}function hp(n="mantine-"){return`${n}${Math.random().toString(36).slice(2,11)}`}const pp=["mousedown","touchstart"];function mp(n,e,t){const r=T.useRef(null),s=pp;return T.useEffect(()=>{const o=i=>{const{target:l}=i??{};if(Array.isArray(t)){const a=!document.body.contains(l)&&(l==null?void 0:l.tagName)!=="HTML";t.every(u=>!!u&&!i.composedPath().includes(u))&&!a&&n(i)}else r.current&&!r.current.contains(l)&&n(i)};return s.forEach(i=>document.addEventListener(i,o)),()=>{s.forEach(i=>document.removeEventListener(i,o))}},[r,n,t]),r}const gp=typeof document<"u"?T.useLayoutEffect:T.useEffect;function hs(n,e){const t=T.useRef(!1);T.useEffect(()=>()=>{t.current=!1},[]),T.useEffect(()=>{if(t.current)return n();t.current=!0},e)}const yp=T.useId||(()=>{});function bp(){const n=yp();return n?`mantine-${n.replace(/:/g,"")}`:""}function kp(n){const e=bp(),[t,r]=T.useState(e);return gp(()=>{r(hp())},[]),typeof window>"u"?e:t}function xp(n,e,t){T.useEffect(()=>(window.addEventListener(n,e,t),()=>window.removeEventListener(n,e,t)),[n,e])}function wa(n,e){if(typeof n=="function")return n(e);typeof n=="object"&&n!==null&&"current"in n&&(n.current=e)}function vp(...n){const e=new Map;return t=>{if(n.forEach(r=>{const s=wa(r,t);s&&e.set(r,s)}),e.size>0)return()=>{n.forEach(r=>{const s=e.get(r);s&&typeof s=="function"?s():wa(r,null)}),e.clear()}}}function rr(...n){return T.useCallback(vp(...n),n)}function pu({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 Sp(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 Cp(n){const[e,t]=T.useState(n);return[e,Sp(t)]}function il(n=!1,e={}){const[t,r]=T.useState(n),s=T.useCallback(()=>{r(l=>{var a;return l||((a=e.onOpen)==null||a.call(e),!0)})},[e.onOpen]),o=T.useCallback(()=>{r(l=>{var a;return l&&((a=e.onClose)==null||a.call(e),!1)})},[e.onClose]),i=T.useCallback(()=>{t?o():s()},[o,s,t]);return[t,{open:s,close:o,toggle:i}]}function Ve(n){return n<10?`0${n}`:`${n}`}const Mp=n=>Number(n.toFixed(0)[0]),ns=T.forwardRef(({value:n,min:e,max:t,onChange:r,focusable:s,step:o,onNextInput:i,onPreviousInput:l,onFocus:a,readOnly:c,allowTemporaryZero:u=!1,placeholder:d="--",...f},h)=>{const p=Mp(t),g=t+1-o,y=k=>{if(c)return;const w=k.replace(/\D/g,"");if(w!==""){const E=parseInt(w,10),C=u&&E===0&&e>0?0:ts(E,e,t);r(C),(C>p||k.startsWith("00"))&&(i==null||i())}},b=k=>{if(!c){if((k.key==="0"||k.key==="Num0")&&n===0&&(k.preventDefault(),i==null||i()),k.key==="Home"&&(k.preventDefault(),r(e)),k.key==="End"&&(k.preventDefault(),r(t)),(k.key==="Backspace"||k.key==="Delete")&&(k.preventDefault(),n!==null?r(null):l==null||l()),k.key==="ArrowRight"&&(k.preventDefault(),i==null||i()),k.key==="ArrowLeft"&&(k.preventDefault(),l==null||l()),k.key==="ArrowUp"){k.preventDefault();const w=n===null?e:ts(n+o,e,g);r(w)}if(k.key==="ArrowDown"){k.preventDefault();const w=n===null?g:ts(n-o,e,g);r(w)}}};return m.jsx("input",{ref:h,type:"text",role:"spinbutton","aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":n===null?0:n,"data-empty":n===null||void 0,inputMode:"numeric",placeholder:d,value:n===null?"":Ve(n),onChange:k=>y(k.currentTarget.value),onKeyDown:b,onFocus:k=>{k.currentTarget.select(),a==null||a(k)},onClick:k=>{k.stopPropagation(),k.currentTarget.select()},onMouseDown:k=>k.stopPropagation(),...f})});ns.displayName="@mantine/dates/SpinInput";const[wp,Tn]=v.createSafeContext("TimeInput component was not found in the component tree"),mu=T.forwardRef(({labels:n,value:e,onChange:t,className:r,style:s,onPreviousInput:o,readOnly:i,onMouseDown:l,onTouchStart:a,inputType:c,...u},d)=>{const f=Tn(),h=p=>{i||(p.key==="Home"&&(p.preventDefault(),t(n.am)),p.key==="End"&&(p.preventDefault(),t(n.pm)),(p.key==="Backspace"||p.key==="Delete")&&(p.preventDefault(),e===null?o==null||o():t(null)),p.key==="ArrowLeft"&&(p.preventDefault(),o==null||o()),(p.key==="ArrowUp"||p.key==="ArrowDown")&&(p.preventDefault(),t(e===n.am?n.pm:n.am)),p.code==="KeyA"&&(p.preventDefault(),t(n.am)),p.code==="KeyP"&&(p.preventDefault(),t(n.pm)))};if(c==="input"){const p=e||"--",g=p.length+1;return m.jsx("input",{...f.getStyles("field",{className:r,style:s}),ref:d,value:p,size:g,onChange:y=>!i&&t(y.target.value||null),onClick:(y=>y.stopPropagation()),onKeyDown:h,onMouseDown:y=>{y.stopPropagation(),l==null||l(y)},"data-am-pm":!0,...u})}return m.jsxs("select",{...f.getStyles("field",{className:r,style:s}),ref:d,value:e||"",onChange:p=>!i&&t(p.target.value||null),onClick:p=>p.stopPropagation(),onKeyDown:h,onMouseDown:p=>{p.stopPropagation(),l==null||l(p)},"data-am-pm":!0,...u,children:[m.jsx("option",{value:"",children:"--"}),m.jsx("option",{value:n.am,children:n.am}),m.jsx("option",{value:n.pm,children:n.pm})]})});mu.displayName="@mantine/dates/AmPmInput";function ll({value:n,active:e,onSelect:t}){const r=Tn();return m.jsx(v.UnstyledButton,{mod:{active:e},onClick:()=>t(n),onMouseDown:s=>s.preventDefault(),"data-value":n,tabIndex:-1,...r.getStyles("control"),children:typeof n=="number"?Ve(n):n})}ll.displayName="@mantine/dates/TimeControl";function gu({labels:n,value:e,onSelect:t}){const r=Tn(),s=[n.am,n.pm].map(o=>m.jsx(ll,{value:o,active:e===o,onSelect:t},o));return m.jsx("div",{...r.getStyles("controlsList"),children:s})}gu.displayName="@mantine/dates/AmPmControlsList";function Tp(n,e){if(!n||!e)return!1;const t=n.getBoundingClientRect(),r=e.getBoundingClientRect();return t.top>=r.top&&t.bottom<=r.bottom&&t.left>=r.left&&t.right<=r.right}function Ep(n,e,t){const r=[];for(let s=n;s<=e;s+=t)r.push(s);return r}function rs({min:n,max:e,step:t,value:r,onSelect:s,reversed:o}){const i=Tn(),l=T.useRef(null),a=Ep(n,e,t),c=(o?a.reverse():a).map(u=>m.jsx(ll,{value:u,active:r===u,onSelect:s},u));return T.useEffect(()=>{r!==null&&requestAnimationFrame(()=>{var f;const d=(f=l.current)==null?void 0:f.querySelector(`[data-value="${r}"]`);Tp(d,l.current)||d==null||d.scrollIntoView({block:"nearest"})})},[r]),m.jsx(v.ScrollArea,{h:i.maxDropdownContentHeight,type:"never",viewportRef:l,...i.getStyles("scrollarea"),...i.scrollAreaProps,children:m.jsx("div",{...i.getStyles("controlsList"),children:c})})}rs.displayName="@mantine/dates/TimeControlsList";function ps(n){const[e=null,t=null,r=null]=n.split(":").map(Number);return{hours:e,minutes:t,seconds:r}}function yu({time:n,compare:e,withSeconds:t}){const r=ps(n),s=ps(e);return t?r.hours===s.hours&&r.minutes===s.minutes&&r.seconds===s.seconds:r.hours===s.hours&&r.minutes===s.minutes}function Ap(n,e){return`${n.getHours()}:${n.getMinutes()}${e?`:${n.getSeconds()}`:""}`}function Op({value:n,format:e,amPmLabels:t,withSeconds:r}){const s=ps(typeof n=="string"?n:Ap(n,r));if(s.hours===null||s.minutes===null)return null;if(e==="24h")return`${Ve(s.hours)}:${Ve(s.minutes)}${r?`:${Ve(s.seconds||0)}`:""}`;const o=s.hours>=12;return`${s.hours%12===0?12:s.hours%12}:${Ve(s.minutes)}${r?`:${Ve(s.seconds||0)}`:""} ${o?t.pm:t.am}`}function bu({value:n,format:e="24h",amPmLabels:t={am:"AM",pm:"PM"},withSeconds:r=!1}){return m.jsx(m.Fragment,{children:Op({value:n,format:e,amPmLabels:t,withSeconds:r})})}bu.displayName="@mantine/dates/TimeValue";function al({value:n,active:e,onChange:t,format:r,amPmLabels:s,withSeconds:o}){const i=Tn();return m.jsx(v.UnstyledButton,{mod:{active:e},onClick:()=>t(n),...i.getStyles("presetControl"),children:m.jsx(bu,{withSeconds:o,value:n,format:r,amPmLabels:s})})}al.displayName="@mantine/dates/TimePresetControl";function ku({value:n,data:e,onChange:t,format:r,amPmLabels:s,withSeconds:o}){const i=Tn(),l=e.values.map(a=>m.jsx(al,{value:a,format:r,amPmLabels:s,withSeconds:o,active:yu({time:a,compare:n,withSeconds:o}),onChange:t},a));return m.jsxs("div",{...i.getStyles("presetsGroup"),children:[m.jsx("div",{...i.getStyles("presetsGroupLabel"),children:e.label}),m.jsx(v.SimpleGrid,{cols:o?2:3,spacing:4,children:l})]})}ku.displayName="@mantine/dates/TimePresetGroup";function xu({presets:n,format:e,amPmLabels:t,withSeconds:r,value:s,onChange:o}){const i=Tn();if(n.length===0)return null;if(typeof n[0]=="string"){const a=n.map(c=>m.jsx(al,{value:c,format:e,amPmLabels:t,withSeconds:r,active:yu({time:c,compare:s,withSeconds:r}),onChange:o},c));return m.jsx(v.ScrollArea.Autosize,{mah:i.maxDropdownContentHeight,type:"never",...i.getStyles("scrollarea"),...i.scrollAreaProps,children:m.jsx("div",{...i.getStyles("presetsRoot"),children:m.jsx(v.SimpleGrid,{cols:r?2:3,spacing:4,children:a})})})}const l=n.map((a,c)=>m.jsx(ku,{data:a,value:s,format:e,amPmLabels:t,withSeconds:r,onChange:o},c));return m.jsx(v.ScrollArea.Autosize,{mah:i.maxDropdownContentHeight,type:"never",...i.getStyles("scrollarea"),...i.scrollAreaProps,children:m.jsx("div",{...i.getStyles("presetsRoot"),children:l})})}xu.displayName="@mantine/dates/TimePresets";function Vo(n){const[e=0,t=0,r=0]=n.split(":").map(Number);return e*3600+t*60+r}function Dp(n){const e=Math.floor(n/3600),t=Math.floor(n%3600/60),r=n%60;return{timeString:`${Ve(e)}:${Ve(t)}:${Ve(r)}`,hours:e,minutes:t,seconds:r}}function vu(n,e,t){const r=Vo(n),s=e?Vo(e):-1/0,o=t?Vo(t):1/0,i=Math.max(s,Math.min(r,o));return Dp(i)}function Np({hours:n,minutes:e,seconds:t,amPmLabels:r}){if(n===null)return{hours:null,minutes:null,seconds:null,amPm:null};const s=n>=12?r.pm:r.am;return{hours:n%12===0?12:n%12,minutes:typeof e=="number"?e:null,seconds:typeof t=="number"?t:null,amPm:s}}function sr({time:n,format:e,amPmLabels:t}){if(n==="")return{hours:null,minutes:null,seconds:null,amPm:null};const{hours:r,minutes:s,seconds:o}=ps(n),i={hours:r,minutes:s,seconds:o};return e==="12h"?Np({...i,amPmLabels:t}):{...i,amPm:null}}function Rp({hours:n,minutes:e,seconds:t,amPm:r,amPmLabels:s,withSeconds:o}){let i=n;return r===s.pm&&n!==12?i+=12:r===s.am&&n===12&&(i=0),`${Ve(i)}:${Ve(e)}${o?`:${Ve(t||0)}`:""}`}function ss({hours:n,minutes:e,seconds:t,format:r,withSeconds:s,amPm:o,amPmLabels:i}){return n===null||e===null?{valid:!1,value:""}:s&&t===null?{valid:!1,value:""}:r==="24h"?{valid:!0,value:`${Ve(n)}:${Ve(e)}${s?`:${Ve(t)}`:""}`}:o===null?{valid:!1,value:""}:{valid:!0,value:Rp({hours:n,minutes:e,seconds:t,amPm:o,amPmLabels:i,withSeconds:s})}}function Lp({value:n,defaultValue:e,onChange:t,format:r,amPmLabels:s,withSeconds:o=!1,min:i,max:l,clearable:a,readOnly:c,disabled:u,pasteSplit:d}){const f=sr({time:n||e||"",amPmLabels:s,format:r}),h=T.useRef(!0),[p,g]=T.useState(f.hours),[y,b]=T.useState(f.minutes),[k,w]=T.useState(f.seconds),[E,C]=T.useState(f.amPm),x=a&&!c&&!u&&(p!==null||y!==null||k!==null||E!==null),M=T.useRef(null),O=T.useRef(null),j=T.useRef(null),B=T.useRef(null),Y=S=>{var A,D,P,K;S==="hours"&&((A=M.current)==null||A.focus()),S==="minutes"&&((D=O.current)==null||D.focus()),S==="seconds"&&((P=j.current)==null||P.focus()),S==="amPm"&&((K=B.current)==null||K.focus())},V=(S,A)=>{const D={hours:p,minutes:y,seconds:k,amPm:E,[S]:A},P=ss({...D,format:r,withSeconds:o,amPmLabels:s});P.valid?(h.current=!1,S==="hours"&&g(A),S==="minutes"&&b(A),S==="seconds"&&w(A),S==="amPm"&&C(A),t==null||t(P.value)):(h.current=!1,typeof n=="string"&&n!==""&&(t==null||t("")))},F=S=>{h.current=!1;const A=sr({time:S,amPmLabels:s,format:r});g(A.hours),b(A.minutes),w(A.seconds),C(A.amPm),t==null||t(S)},q=S=>{let A=S;r==="12h"&&typeof S=="number"&&S>12&&(A=(S-1)%12+1),g(A),V("hours",A),Y("hours")},G=S=>{b(S),V("minutes",S),Y("minutes")},J=S=>{w(S),V("seconds",S),Y("seconds")},X=S=>{C(S),V("amPm",S),Y("amPm")},W=()=>{h.current=!1,g(null),b(null),w(null),C(null),t==null||t(""),Y("hours")},U=S=>{S.preventDefault();const A=S.clipboardData.getData("text"),D=(d||sr)({time:A,format:r,amPmLabels:s}),P=ss({...D,format:r,withSeconds:o,amPmLabels:s});if(P.valid){h.current=!1;const K=vu(P.value,i||"00:00:00",l||"23:59:59");t==null||t(K.timeString),g(D.hours),b(D.minutes),w(D.seconds),C(D.amPm)}},I=ss({hours:p,minutes:y,seconds:k,format:r,withSeconds:o,amPm:E,amPmLabels:s});return hs(()=>{if(n===""){h.current=!1,g(null),b(null),w(null),C(null),h.current=!0;return}if(h.current&&typeof n=="string"){const S=sr({time:n||"",amPmLabels:s,format:r});g(S.hours),b(S.minutes),w(S.seconds),C(S.amPm)}h.current=!0},[n]),{refs:{hours:M,minutes:O,seconds:j,amPm:B},values:{hours:p,minutes:y,seconds:k,amPm:E},setHours:q,setMinutes:G,setSeconds:J,setAmPm:X,focus:Y,clear:W,onPaste:U,setTimeString:F,isClearable:x,hiddenInputValue:I.value}}var Su={fieldsRoot:"m_7a8f1e6d",fieldsGroup:"m_d6bb0a54",controlsList:"m_b97ecb26",controlsListGroup:"m_31fe42f9",dropdown:"m_9c4817c3",control:"m_154c536b",presetControl:"m_7be09d0c",presetsGroup:"m_7d00001d",presetsGroupLabel:"m_d8d918d7",field:"m_6b43ba88"};const Ip={hoursStep:1,minutesStep:1,secondsStep:1,format:"24h",amPmLabels:{am:"AM",pm:"PM"},pasteSplit:sr,maxDropdownContentHeight:200,hoursPlaceholder:"--",minutesPlaceholder:"--",secondsPlaceholder:"--"},jp=v.createVarsResolver((n,{size:e})=>({dropdown:{"--control-font-size":v.getFontSize(e)}})),cl=v.factory((n,e)=>{const t=v.useProps("TimePicker",Ip,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,onClick:c,format:u,value:d,defaultValue:f,onChange:h,hoursStep:p,minutesStep:g,secondsStep:y,withSeconds:b,hoursInputLabel:k,minutesInputLabel:w,secondsInputLabel:E,amPmInputLabel:C,amPmLabels:x,clearable:M,onMouseDown:O,onFocusCapture:j,onBlurCapture:B,min:Y,max:V,popoverProps:F,withDropdown:q,rightSection:G,onFocus:J,onBlur:X,clearButtonProps:W,hoursInputProps:U,minutesInputProps:I,secondsInputProps:S,amPmSelectProps:A,readOnly:D,disabled:P,size:K,name:de,form:N,hiddenInputProps:Q,labelProps:oe,pasteSplit:te,hoursRef:pe,minutesRef:he,secondsRef:ae,amPmRef:se,presets:Oe,maxDropdownContentHeight:ue,scrollAreaProps:ke,attributes:ce,reverseTimeControlsList:Ee,hoursPlaceholder:Dn,minutesPlaceholder:rn,secondsPlaceholder:sn,...on}=t,{resolvedClassNames:ln,resolvedStyles:an}=v.useResolvedStylesApi({classNames:r,styles:i,props:t}),Xe=v.useStyles({name:"TimePicker",classes:Su,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:ce,vars:a,varsResolver:jp}),z=Lp({value:d,defaultValue:f,onChange:h,format:u,amPmLabels:x,withSeconds:b,min:Y,max:V,clearable:M,disabled:P,readOnly:D,pasteSplit:te}),Qe=rr(z.refs.hours,pe),Ze=rr(z.refs.minutes,he),cn=rr(z.refs.seconds,ae),Nn=rr(z.refs.amPm,se),Pr=kp(),Gn=T.useRef(!1),[Io,It]=T.useState(!1),ft=ne=>{Gn.current||(Gn.current=!0,J==null||J(ne))},jo=ne=>{if(!ne.currentTarget.contains(ne.relatedTarget)){const xe=z.values,ot=ss({...xe,format:u,amPmLabels:x,withSeconds:!!b});if(ot.valid&&(Y||V)){const jt=vu(ot.value,Y,V);jt.timeString!==ot.value&&z.setTimeString(jt.timeString)}Gn.current=!1,X==null||X(ne)}};return m.jsx(wp,{value:{getStyles:Xe,scrollAreaProps:ke,maxDropdownContentHeight:ue},children:m.jsxs(v.Popover,{opened:Io,transitionProps:{duration:0},position:"bottom-start",withRoles:!1,disabled:P||D||!q,...F,children:[m.jsx(v.Popover.Target,{children:m.jsxs(v.InputBase,{component:"div",size:K,disabled:P,ref:e,onClick:ne=>{c==null||c(ne),z.focus("hours")},onMouseDown:ne=>{ne.preventDefault(),O==null||O(ne)},onFocusCapture:ne=>{It(!0),j==null||j(ne)},onBlurCapture:ne=>{It(!1),B==null||B(ne)},rightSection:G||z.isClearable&&m.jsx(v.CloseButton,{...W,size:K,onClick:ne=>{var xe;z.clear(),(xe=W==null?void 0:W.onClick)==null||xe.call(W,ne)},onMouseDown:ne=>{var xe;ne.preventDefault(),(xe=W==null?void 0:W.onMouseDown)==null||xe.call(W,ne)}}),labelProps:{htmlFor:Pr,...oe},style:o,className:s,classNames:ln,styles:an,__staticSelector:"TimePicker",...on,children:[m.jsx("div",{...Xe("fieldsRoot"),dir:"ltr",children:m.jsxs("div",{...Xe("fieldsGroup"),onBlur:jo,children:[m.jsx(ns,{id:Pr,...U,...Xe("field",{className:U==null?void 0:U.className,style:U==null?void 0:U.style}),value:z.values.hours,onChange:z.setHours,onNextInput:()=>z.focus("minutes"),min:u==="12h"?1:0,max:u==="12h"?12:23,allowTemporaryZero:u==="12h",focusable:!0,step:p,ref:Qe,"aria-label":k,readOnly:D,disabled:P,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=U==null?void 0:U.onFocus)==null||xe.call(U,ne)},onBlur:ne=>{var jt;const xe=ne.currentTarget.value,ot=xe?parseInt(xe,10):null;u==="12h"&&ot===0&&z.setHours(12),(jt=U==null?void 0:U.onBlur)==null||jt.call(U,ne)},placeholder:Dn}),m.jsx("span",{children:":"}),m.jsx(ns,{...I,...Xe("field",{className:I==null?void 0:I.className,style:I==null?void 0:I.style}),value:z.values.minutes,onChange:z.setMinutes,min:0,max:59,focusable:!0,step:g,ref:Ze,onPreviousInput:()=>z.focus("hours"),onNextInput:()=>b?z.focus("seconds"):z.focus("amPm"),"aria-label":w,tabIndex:-1,readOnly:D,disabled:P,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=I==null?void 0:I.onFocus)==null||xe.call(I,ne)},placeholder:rn}),b&&m.jsxs(m.Fragment,{children:[m.jsx("span",{children:":"}),m.jsx(ns,{...S,...Xe("field",{className:S==null?void 0:S.className,style:S==null?void 0:S.style}),value:z.values.seconds,onChange:z.setSeconds,min:0,max:59,focusable:!0,step:y,ref:cn,onPreviousInput:()=>z.focus("minutes"),onNextInput:()=>z.focus("amPm"),"aria-label":E,tabIndex:-1,readOnly:D,disabled:P,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=S==null?void 0:S.onFocus)==null||xe.call(S,ne)},placeholder:sn})]}),u==="12h"&&m.jsx(mu,{...A,inputType:q?"input":"select",labels:x,value:z.values.amPm,onChange:z.setAmPm,ref:Nn,"aria-label":C,onPreviousInput:()=>b?z.focus("seconds"):z.focus("minutes"),readOnly:D,disabled:P,tabIndex:-1,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=A==null?void 0:A.onFocus)==null||xe.call(A,ne)}})]})}),m.jsx("input",{type:"hidden",name:de,form:N,value:z.hiddenInputValue,...Q})]})}),m.jsx(v.Popover.Dropdown,{...Xe("dropdown"),onMouseDown:ne=>ne.preventDefault(),children:Oe?m.jsx(xu,{value:z.hiddenInputValue,onChange:z.setTimeString,format:u,presets:Oe,amPmLabels:x,withSeconds:b||!1}):m.jsxs("div",{...Xe("controlsListGroup"),children:[m.jsx(rs,{min:u==="12h"?1:0,max:u==="12h"?12:23,step:p,value:z.values.hours,onSelect:z.setHours,reversed:Ee}),m.jsx(rs,{min:0,max:59,step:g,value:z.values.minutes,onSelect:z.setMinutes,reversed:Ee}),b&&m.jsx(rs,{min:0,max:59,step:y,value:z.values.seconds,onSelect:z.setSeconds,reversed:Ee}),u==="12h"&&m.jsx(gu,{labels:x,value:z.values.amPm,onSelect:z.setAmPm})]})})]})})});cl.displayName="@mantine/dates/TimePicker";cl.classes=Su;var Cu={day:"m_396ce5cb"};const Pp=v.createVarsResolver((n,{size:e})=>({day:{"--day-size":v.getSize(e,"day-size")}})),ul=v.factory((n,e)=>{const t=v.useProps("Day",null,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:w,static:E,highlightToday:C,attributes:x,...M}=t,O=v.useStyles({name:d||"Day",classes:Cu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:x,vars:a,varsResolver:Pp,rootSelector:"day"});return m.jsx(v.UnstyledButton,{...O("day",{style:w?{display:"none"}:void 0}),component:E?"div":"button",ref:e,disabled:u,"data-today":R(c).isSame(new Date,"day")||void 0,"data-hidden":w||void 0,"data-highlight-today":C||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,...M,children:(g==null?void 0:g(c))||R(c).date()})});ul.classes=Cu;ul.displayName="@mantine/dates/Day";function _p({locale:n,format:e="dd",firstDayOfWeek:t=1}){const r=R().day(t),s=[];for(let o=0;o<7;o+=1)typeof e=="string"?s.push(R(r).add(o,"days").locale(n).format(e)):s.push(e(R(r).add(o,"days").format("YYYY-MM-DD")));return s}var Mu={weekday:"m_18a3eca"};const Bp=v.createVarsResolver((n,{size:e})=>({weekdaysRow:{"--wr-fz":v.getFontSize(e),"--wr-spacing":v.getSpacing(e)}})),dl=v.factory((n,e)=>{const t=v.useProps("WeekdaysRow",null,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,attributes:g,...y}=t,b=v.useStyles({name:h||"WeekdaysRow",classes:Mu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:g,vars:a,varsResolver:Bp,rootSelector:"weekdaysRow"}),k=Rt(),w=_p({locale:k.getLocale(c),format:d,firstDayOfWeek:k.getFirstDayOfWeek(u)}).map((E,C)=>m.jsx(f,{...b("weekday"),children:E},C));return m.jsxs(v.Box,{component:"tr",ref:e,...b("weekdaysRow"),...y,children:[p&&m.jsx(f,{...b("weekday"),children:"#"}),w]})});dl.classes=Mu;dl.displayName="@mantine/dates/WeekdaysRow";function Fp(n,e=1){let t=R(n);if(!t.isValid())return t;const r=e===0?6:e-1;for(;t.day()!==r;)t=t.add(1,"day");return t.format("YYYY-MM-DD")}function zp(n,e=1){let t=R(n);for(;t.day()!==e;)t=t.subtract(1,"day");return t.format("YYYY-MM-DD")}function $p({month:n,firstDayOfWeek:e=1,consistentWeeks:t}){const r=R(n).subtract(R(n).date()-1,"day"),s=R(r.format("YYYY-M-D")),o=s.format("YYYY-MM-DD"),i=s.add(+s.daysInMonth()-1,"day").format("YYYY-MM-DD"),l=Fp(i,e),a=[];let c=R(zp(o,e));for(;R(c).isBefore(l,"day");){const u=[];for(let d=0;d<7;d+=1)u.push(c.format("YYYY-MM-DD")),c=c.add(1,"day");a.push(u)}if(t&&a.length<6){const u=a[a.length-1],d=u[u.length-1];let f=R(d).add(1,"day");for(;a.length<6;){const h=[];for(let p=0;p<7;p+=1)h.push(f.format("YYYY-MM-DD")),f=f.add(1,"day");a.push(h)}}return a}function oo(n,e){return R(n).format("YYYY-MM")===R(e).format("YYYY-MM")}function wu(n,e){return e?R(n).isAfter(R(e).subtract(1,"day"),"day"):!0}function Tu(n,e){return e?R(n).isBefore(R(e).add(1,"day"),"day"):!0}function Vp({dates:n,minDate:e,maxDate:t,getDayProps:r,excludeDate:s,hideOutsideDates:o,month:i}){const l=n.flat().filter(u=>{var d;return Tu(u,t)&&wu(u,e)&&!(s!=null&&s(u))&&!((d=r==null?void 0:r(u))!=null&&d.disabled)&&(!o||oo(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=>R().isSame(u,"date"));return c||l[0]}var is={exports:{}},Hp=is.exports,Ta;function Wp(){return Ta||(Ta=1,(function(n,e){(function(t,r){n.exports=r()})(Hp,(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)}}}))})(is)),is.exports}var Yp=Wp();const Up=rl(Yp);R.extend(Up);function qp(n){const e=n.find(t=>R(t).day()===1);return R(e).isoWeek()}var Eu={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const Kp={withCellSpacing:!0},Jp=v.createVarsResolver((n,{size:e})=>({weekNumber:{"--wn-fz":v.getFontSize(e),"--wn-size":v.getSize(e,"wn-size")}})),io=v.factory((n,e)=>{const t=v.useProps("Month",Kp,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:w,hideOutsideDates:E,hideWeekdays:C,getDayAriaLabel:x,static:M,__getDayRef:O,__onDayKeyDown:j,__onDayClick:B,__onDayMouseEnter:Y,__preventFocus:V,__stopPropagation:F,withCellSpacing:q,size:G,highlightToday:J,withWeekNumbers:X,attributes:W,...U}=t,I=v.useStyles({name:c||"Month",classes:Eu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:W,vars:a,varsResolver:Jp,rootSelector:"month"}),S=Rt(),A=$p({month:h,firstDayOfWeek:S.getFirstDayOfWeek(d),consistentWeeks:S.consistentWeeks}),D=Vp({dates:A,minDate:He(b),maxDate:He(k),getDayProps:g,excludeDate:y,hideOutsideDates:E,month:h}),{resolvedClassNames:P,resolvedStyles:K}=v.useResolvedStylesApi({classNames:r,styles:i,props:t}),de=A.map((N,Q)=>{const oe=N.map((te,pe)=>{const he=!oo(te,h),ae=(x==null?void 0:x(te))||R(te).locale(u||S.locale).format("D MMMM YYYY"),se=g==null?void 0:g(te),Oe=R(te).isSame(D,"date");return m.jsx("td",{...I("monthCell"),"data-with-spacing":q||void 0,children:m.jsx(ul,{__staticSelector:c||"Month",classNames:P,styles:K,unstyled:l,"data-mantine-stop-propagation":F||void 0,highlightToday:J,renderDay:w,date:te,size:G,weekend:S.getWeekendDays(p).includes(R(te).get("day")),outside:he,hidden:E?he:!1,"aria-label":ae,static:M,disabled:(y==null?void 0:y(te))||!Tu(te,He(k))||!wu(te,He(b)),ref:ue=>{ue&&(O==null||O(Q,pe,ue))},...se,onKeyDown:ue=>{var ke;(ke=se==null?void 0:se.onKeyDown)==null||ke.call(se,ue),j==null||j(ue,{rowIndex:Q,cellIndex:pe,date:te})},onMouseEnter:ue=>{var ke;(ke=se==null?void 0:se.onMouseEnter)==null||ke.call(se,ue),Y==null||Y(ue,te)},onClick:ue=>{var ke;(ke=se==null?void 0:se.onClick)==null||ke.call(se,ue),B==null||B(ue,te)},onMouseDown:ue=>{var ke;(ke=se==null?void 0:se.onMouseDown)==null||ke.call(se,ue),V&&ue.preventDefault()},tabIndex:V||!Oe?-1:0})},te.toString())});return m.jsxs("tr",{...I("monthRow"),children:[X&&m.jsx("td",{...I("weekNumber"),children:qp(N)}),oe]},Q)});return m.jsxs(v.Box,{component:"table",...I("month"),size:G,ref:e,...U,children:[!C&&m.jsx("thead",{...I("monthThead"),children:m.jsx(dl,{__staticSelector:c||"Month",locale:u,firstDayOfWeek:d,weekdayFormat:f,size:G,classNames:P,styles:K,unstyled:l,withWeekNumbers:X})}),m.jsx("tbody",{...I("monthTbody"),children:de})]})});io.classes=Eu;io.displayName="@mantine/dates/Month";var Au={pickerControl:"m_dc6a3c71"};const Gp=v.createVarsResolver((n,{size:e})=>({pickerControl:{"--dpc-fz":v.getFontSize(e),"--dpc-size":v.getSize(e,"dpc-size")}})),lo=v.factory((n,e)=>{const t=v.useProps("PickerControl",null,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,attributes:g,...y}=t,b=v.useStyles({name:f||"PickerControl",classes:Au,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:g,vars:a,varsResolver:Gp,rootSelector:"pickerControl"});return m.jsx(v.UnstyledButton,{...b("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,...y})});lo.classes=Au;lo.displayName="@mantine/dates/PickerControl";function Ou({year:n,minDate:e,maxDate:t}){return!e&&!t?!1:!!(e&&R(n).isBefore(e,"year")||t&&R(n).isAfter(t,"year"))}function Xp({years:n,minDate:e,maxDate:t,getYearControlProps:r}){const s=n.flat().filter(l=>{var a;return!Ou({year:l,minDate:e,maxDate: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=>R().isSame(l,"year"));return i||s[0]}function Du(n){const e=R(n).year(),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(R(new Date(t+r,0)).format("YYYY-MM-DD")),r+=1}return s}var Nu={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const Qp={yearsListFormat:"YYYY",withCellSpacing:!0},ao=v.factory((n,e)=>{const t=v.useProps("YearsList",Qp,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:w,__preventFocus:E,__stopPropagation:C,withCellSpacing:x,size:M,attributes:O,...j}=t,B=v.useStyles({name:g||"YearsList",classes:Nu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:O,vars:a,rootSelector:"yearsList"}),Y=Rt(),V=Du(c),F=Xp({years:V,minDate:f,maxDate:h,getYearControlProps:p}),q=V.map((G,J)=>{const X=G.map((W,U)=>{const I=p==null?void 0:p(W),S=R(W).isSame(F,"year");return m.jsx("td",{...B("yearsListCell"),"data-with-spacing":x||void 0,children:m.jsx(lo,{...B("yearsListControl"),size:M,unstyled:l,"data-mantine-stop-propagation":C||void 0,disabled:Ou({year:W,minDate:f,maxDate:h}),ref:A=>{A&&(y==null||y(J,U,A))},...I,onKeyDown:A=>{var D;(D=I==null?void 0:I.onKeyDown)==null||D.call(I,A),b==null||b(A,{rowIndex:J,cellIndex:U,date:W})},onClick:A=>{var D;(D=I==null?void 0:I.onClick)==null||D.call(I,A),k==null||k(A,W)},onMouseEnter:A=>{var D;(D=I==null?void 0:I.onMouseEnter)==null||D.call(I,A),w==null||w(A,W)},onMouseDown:A=>{var D;(D=I==null?void 0:I.onMouseDown)==null||D.call(I,A),E&&A.preventDefault()},tabIndex:E||!S?-1:0,children:R(W).locale(Y.getLocale(d)).format(u)})},U)});return m.jsx("tr",{...B("yearsListRow"),children:X},J)});return m.jsx(v.Box,{component:"table",ref:e,size:M,...B("yearsList"),...j,children:m.jsx("tbody",{children:q})})});ao.classes=Nu;ao.displayName="@mantine/dates/YearsList";function Ru({month:n,minDate:e,maxDate:t}){return!e&&!t?!1:!!(e&&R(n).isBefore(e,"month")||t&&R(n).isAfter(t,"month"))}function Zp({months:n,minDate:e,maxDate:t,getMonthControlProps:r}){const s=n.flat().filter(l=>{var a;return!Ru({month:l,minDate:e,maxDate: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=>R().isSame(l,"month"));return i||s[0]}function em(n){const e=R(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(R(e).add(r,"months").format("YYYY-MM-DD")),r+=1;return t}var Lu={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const tm={monthsListFormat:"MMM",withCellSpacing:!0},co=v.factory((n,e)=>{const t=v.useProps("MonthsList",tm,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:w,__preventFocus:E,__stopPropagation:C,withCellSpacing:x,size:M,attributes:O,...j}=t,B=v.useStyles({name:c||"MonthsList",classes:Lu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:O,vars:a,rootSelector:"monthsList"}),Y=Rt(),V=em(u),F=Zp({months:V,minDate:He(h),maxDate:He(p),getMonthControlProps:g}),q=V.map((G,J)=>{const X=G.map((W,U)=>{const I=g==null?void 0:g(W),S=R(W).isSame(F,"month");return m.jsx("td",{...B("monthsListCell"),"data-with-spacing":x||void 0,children:m.jsx(lo,{...B("monthsListControl"),size:M,unstyled:l,__staticSelector:c||"MonthsList","data-mantine-stop-propagation":C||void 0,disabled:Ru({month:W,minDate:He(h),maxDate:He(p)}),ref:A=>{A&&(y==null||y(J,U,A))},...I,onKeyDown:A=>{var D;(D=I==null?void 0:I.onKeyDown)==null||D.call(I,A),b==null||b(A,{rowIndex:J,cellIndex:U,date:W})},onClick:A=>{var D;(D=I==null?void 0:I.onClick)==null||D.call(I,A),k==null||k(A,W)},onMouseEnter:A=>{var D;(D=I==null?void 0:I.onMouseEnter)==null||D.call(I,A),w==null||w(A,W)},onMouseDown:A=>{var D;(D=I==null?void 0:I.onMouseDown)==null||D.call(I,A),E&&A.preventDefault()},tabIndex:E||!S?-1:0,children:R(W).locale(Y.getLocale(f)).format(d)})},U)});return m.jsx("tr",{...B("monthsListRow"),children:X},J)});return m.jsx(v.Box,{component:"table",ref:e,size:M,...B("monthsList"),...j,children:m.jsx("tbody",{children:q})})});co.classes=Lu;co.displayName="@mantine/dates/MonthsList";var Iu={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const nm={hasNextLevel:!0,withNext:!0,withPrevious:!0,headerControlsOrder:["previous","level","next"]},rm=v.createVarsResolver((n,{size:e})=>({calendarHeader:{"--dch-control-size":v.getSize(e,"dch-control-size"),"--dch-fz":v.getFontSize(e)}})),Zt=v.factory((n,e)=>{const t=v.useProps("CalendarHeader",nm,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:w,levelControlAriaLabel:E,withNext:C,withPrevious:x,headerControlsOrder:M,__staticSelector:O,__preventFocus:j,__stopPropagation:B,attributes:Y,...V}=t,F=v.useStyles({name:O||"CalendarHeader",classes:Iu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:Y,vars:a,varsResolver:rm,rootSelector:"calendarHeader"}),q=j?U=>U.preventDefault():void 0,G=x&&T.createElement(v.UnstyledButton,{...F("calendarHeaderControl"),key:"previous","data-direction":"previous","aria-label":f,onClick:p,unstyled:l,onMouseDown:q,disabled:k,"data-disabled":k||void 0,tabIndex:j||k?-1:0,"data-mantine-stop-propagation":B||void 0},u||m.jsx(v.AccordionChevron,{...F("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})),J=T.createElement(v.UnstyledButton,{component:w?"button":"div",...F("calendarHeaderLevel"),key:"level",onClick:w?g:void 0,unstyled:l,onMouseDown:w?q:void 0,disabled:!w,"data-static":!w||void 0,"aria-label":E,tabIndex:j||!w?-1:0,"data-mantine-stop-propagation":B||void 0},y),X=C&&T.createElement(v.UnstyledButton,{...F("calendarHeaderControl"),key:"next","data-direction":"next","aria-label":d,onClick:h,unstyled:l,onMouseDown:q,disabled:b,"data-disabled":b||void 0,tabIndex:j||b?-1:0,"data-mantine-stop-propagation":B||void 0},c||m.jsx(v.AccordionChevron,{...F("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})),W=M.map(U=>U==="previous"?G:U==="level"?J:U==="next"?X:null);return m.jsx(v.Box,{...F("calendarHeader"),ref:e,...V,children:W})});Zt.classes=Iu;Zt.displayName="@mantine/dates/CalendarHeader";function sm(n){const e=Du(n);return[e[0][0],e[3][0]]}const om={decadeLabelFormat:"YYYY"},uo=v.factory((n,e)=>{const t=v.useProps("DecadeLevel",om,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:w,onPrevious:E,nextDisabled:C,previousDisabled:x,levelControlAriaLabel:M,withNext:O,withPrevious:j,headerControlsOrder:B,decadeLabelFormat:Y,classNames:V,styles:F,unstyled:q,__staticSelector:G,__stopPropagation:J,size:X,attributes:W,...U}=t,I=Rt(),[S,A]=sm(r),D={__staticSelector:G||"DecadeLevel",classNames:V,styles:F,unstyled:q,size:X,attributes:W},P=typeof C=="boolean"?C:i?!R(A).endOf("year").isBefore(i):!1,K=typeof x=="boolean"?x:o?!R(S).startOf("year").isAfter(o):!1,de=(N,Q)=>R(N).locale(s||I.locale).format(Q);return m.jsxs(v.Box,{"data-decade-level":!0,size:X,ref:e,...U,children:[m.jsx(Zt,{label:typeof Y=="function"?Y(S,A):`${de(S,Y)} – ${de(A,Y)}`,__preventFocus:p,__stopPropagation:J,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:w,onPrevious:E,nextDisabled:P,previousDisabled:K,hasNextLevel:!1,levelControlAriaLabel:M,withNext:O,withPrevious:j,headerControlsOrder:B,...D}),m.jsx(ao,{decade:r,locale:s,minDate:o,maxDate:i,yearsListFormat:l,getYearControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:p,__stopPropagation:J,withCellSpacing:h,...D})]})});uo.classes={...ao.classes,...Zt.classes};uo.displayName="@mantine/dates/DecadeLevel";const im={yearLabelFormat:"YYYY"},fo=v.factory((n,e)=>{const t=v.useProps("YearLevel",im,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:w,onPrevious:E,onLevelClick:C,nextDisabled:x,previousDisabled:M,hasNextLevel:O,levelControlAriaLabel:j,withNext:B,withPrevious:Y,headerControlsOrder:V,yearLabelFormat:F,__staticSelector:q,__stopPropagation:G,size:J,classNames:X,styles:W,unstyled:U,attributes:I,...S}=t,A=Rt(),D={__staticSelector:q||"YearLevel",classNames:X,styles:W,unstyled:U,size:J,attributes:I},P=typeof x=="boolean"?x:i?!R(r).endOf("year").isBefore(i):!1,K=typeof M=="boolean"?M:o?!R(r).startOf("year").isAfter(o):!1;return m.jsxs(v.Box,{"data-year-level":!0,size:J,ref:e,...S,children:[m.jsx(Zt,{label:typeof F=="function"?F(r):R(r).locale(s||A.locale).format(F),__preventFocus:p,__stopPropagation:G,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:w,onPrevious:E,onLevelClick:C,nextDisabled:P,previousDisabled:K,hasNextLevel:O,levelControlAriaLabel:j,withNext:B,withPrevious:Y,headerControlsOrder:V,...D}),m.jsx(co,{year:r,locale:s,minDate:o,maxDate:i,monthsListFormat:l,getMonthControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:p,__stopPropagation:G,withCellSpacing:h,...D})]})});fo.classes={...Zt.classes,...co.classes};fo.displayName="@mantine/dates/YearLevel";const lm={monthLabelFormat:"MMMM YYYY"},ho=v.factory((n,e)=>{const t=v.useProps("MonthLevel",lm,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:w,withCellSpacing:E,highlightToday:C,withWeekNumbers:x,__preventFocus:M,__stopPropagation:O,nextIcon:j,previousIcon:B,nextLabel:Y,previousLabel:V,onNext:F,onPrevious:q,onLevelClick:G,nextDisabled:J,previousDisabled:X,hasNextLevel:W,levelControlAriaLabel:U,withNext:I,withPrevious:S,headerControlsOrder:A,monthLabelFormat:D,classNames:P,styles:K,unstyled:de,__staticSelector:N,size:Q,static:oe,attributes:te,...pe}=t,he=Rt(),ae={__staticSelector:N||"MonthLevel",classNames:P,styles:K,unstyled:de,size:Q,attributes:te},se=typeof J=="boolean"?J:d?!R(r).endOf("month").isBefore(d):!1,Oe=typeof X=="boolean"?X:u?!R(r).startOf("month").isAfter(u):!1;return m.jsxs(v.Box,{"data-month-level":!0,size:Q,ref:e,...pe,children:[m.jsx(Zt,{label:typeof D=="function"?D(r):R(r).locale(s||he.locale).format(D),__preventFocus:M,__stopPropagation:O,nextIcon:j,previousIcon:B,nextLabel:Y,previousLabel:V,onNext:F,onPrevious:q,onLevelClick:G,nextDisabled:se,previousDisabled:Oe,hasNextLevel:W,levelControlAriaLabel:U,withNext:I,withPrevious:S,headerControlsOrder:A,...ae}),m.jsx(io,{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:w,__preventFocus:M,__stopPropagation:O,static:oe,withCellSpacing:E,highlightToday:C,withWeekNumbers:x,...ae})]})});ho.classes={...io.classes,...Zt.classes};ho.displayName="@mantine/dates/MonthLevel";var ju={levelsGroup:"m_30b26e33"};const en=v.factory((n,e)=>{const t=v.useProps("LevelsGroup",null,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,__staticSelector:c,attributes:u,...d}=t,f=v.useStyles({name:c||"LevelsGroup",classes:ju,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:u,vars:a,rootSelector:"levelsGroup"});return m.jsx(v.Box,{ref:e,...f("levelsGroup"),...d})});en.classes=ju;en.displayName="@mantine/dates/LevelsGroup";const am={numberOfColumns:1},po=v.factory((n,e)=>{const t=v.useProps("DecadeLevelGroup",am,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:w,previousDisabled:E,headerControlsOrder:C,classNames:x,styles:M,unstyled:O,__staticSelector:j,__stopPropagation:B,numberOfColumns:Y,levelControlAriaLabel:V,decadeLabelFormat:F,size:q,vars:G,attributes:J,...X}=t,W=T.useRef([]),U=Array(Y).fill(0).map((I,S)=>{const A=R(r).add(S*10,"years").format("YYYY-MM-DD");return m.jsx(uo,{size:q,yearsListFormat:l,decade:A,withNext:S===Y-1,withPrevious:S===0,decadeLabelFormat:F,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(D,P)=>sl({levelIndex:S,rowIndex:P.rowIndex,cellIndex:P.cellIndex,event:D,controlsRef:W}),__getControlRef:(D,P,K)=>{Array.isArray(W.current[S])||(W.current[S]=[]),Array.isArray(W.current[S][D])||(W.current[S][D]=[]),W.current[S][D][P]=K},levelControlAriaLabel:typeof V=="function"?V(A):V,locale:s,minDate:o,maxDate:i,__preventFocus:f,__stopPropagation:B,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,nextDisabled:w,previousDisabled:E,getYearControlProps:a,__staticSelector:j||"DecadeLevelGroup",classNames:x,styles:M,unstyled:O,withCellSpacing:d,headerControlsOrder:C,attributes:J},S)});return m.jsx(en,{classNames:x,styles:M,__staticSelector:j||"DecadeLevelGroup",ref:e,size:q,unstyled:O,attributes:J,...X,children:U})});po.classes={...en.classes,...uo.classes};po.displayName="@mantine/dates/DecadeLevelGroup";const cm={numberOfColumns:1},mo=v.factory((n,e)=>{const t=v.useProps("YearLevelGroup",cm,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:w,nextDisabled:E,previousDisabled:C,hasNextLevel:x,headerControlsOrder:M,classNames:O,styles:j,unstyled:B,__staticSelector:Y,__stopPropagation:V,numberOfColumns:F,levelControlAriaLabel:q,yearLabelFormat:G,size:J,vars:X,attributes:W,...U}=t,I=T.useRef([]),S=Array(F).fill(0).map((A,D)=>{const P=R(r).add(D,"years").format("YYYY-MM-DD");return m.jsx(fo,{size:J,monthsListFormat:l,year:P,withNext:D===F-1,withPrevious:D===0,yearLabelFormat:G,__stopPropagation:V,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(K,de)=>sl({levelIndex:D,rowIndex:de.rowIndex,cellIndex:de.cellIndex,event:K,controlsRef:I}),__getControlRef:(K,de,N)=>{Array.isArray(I.current[D])||(I.current[D]=[]),Array.isArray(I.current[D][K])||(I.current[D][K]=[]),I.current[D][K][de]=N},levelControlAriaLabel:typeof q=="function"?q(P):q,locale:s,minDate:o,maxDate:i,__preventFocus:f,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,onLevelClick:w,nextDisabled:E,previousDisabled:C,hasNextLevel:x,getMonthControlProps:a,classNames:O,styles:j,unstyled:B,__staticSelector:Y||"YearLevelGroup",withCellSpacing:d,headerControlsOrder:M,attributes:W},D)});return m.jsx(en,{classNames:O,styles:j,__staticSelector:Y||"YearLevelGroup",ref:e,size:J,unstyled:B,attributes:W,...U,children:S})});mo.classes={...fo.classes,...en.classes};mo.displayName="@mantine/dates/YearLevelGroup";const um={numberOfColumns:1},go=v.factory((n,e)=>{const t=v.useProps("MonthLevelGroup",um,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:w,withWeekNumbers:E,__preventFocus:C,nextIcon:x,previousIcon:M,nextLabel:O,previousLabel:j,onNext:B,onPrevious:Y,onLevelClick:V,nextDisabled:F,previousDisabled:q,hasNextLevel:G,headerControlsOrder:J,classNames:X,styles:W,unstyled:U,numberOfColumns:I,levelControlAriaLabel:S,monthLabelFormat:A,__staticSelector:D,__stopPropagation:P,size:K,static:de,vars:N,attributes:Q,...oe}=t,te=T.useRef([]),pe=Array(I).fill(0).map((he,ae)=>{const se=R(r).add(ae,"months").format("YYYY-MM-DD");return m.jsx(ho,{month:se,withNext:ae===I-1,withPrevious:ae===0,monthLabelFormat:A,__stopPropagation:P,__onDayClick:y,__onDayMouseEnter:b,__onDayKeyDown:(Oe,ue)=>sl({levelIndex:ae,rowIndex:ue.rowIndex,cellIndex:ue.cellIndex,event:Oe,controlsRef:te}),__getDayRef:(Oe,ue,ke)=>{Array.isArray(te.current[ae])||(te.current[ae]=[]),Array.isArray(te.current[ae][Oe])||(te.current[ae][Oe]=[]),te.current[ae][Oe][ue]=ke},levelControlAriaLabel:typeof S=="function"?S(se):S,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:C,nextIcon:x,previousIcon:M,nextLabel:O,previousLabel:j,onNext:B,onPrevious:Y,onLevelClick:V,nextDisabled:F,previousDisabled:q,hasNextLevel:G,classNames:X,styles:W,unstyled:U,__staticSelector:D||"MonthLevelGroup",size:K,static:de,withCellSpacing:k,highlightToday:w,withWeekNumbers:E,headerControlsOrder:J,attributes:Q},ae)});return m.jsx(en,{classNames:X,styles:W,__staticSelector:D||"MonthLevelGroup",ref:e,size:K,attributes:Q,...oe,children:pe})});go.classes={...en.classes,...ho.classes};go.displayName="@mantine/dates/MonthLevelGroup";var Pu={input:"m_6fa5e2aa"};const yo=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:w,shouldClear:E,readOnly:C,disabled:x,value:M,name:O,form:j,type:B,onDropdownClose:Y,withTime:V,...F}=v.useInputProps("PickerInputBase",{size:"sm"},n),q=m.jsx(v.Input.ClearButton,{onClick:b,unstyled:l,...k}),G=()=>{B==="range"&&Array.isArray(M)&&M[0]&&!M[1]&&b(),h.close()};return m.jsxs(m.Fragment,{children:[u==="modal"&&!C&&m.jsx(v.Modal,{opened:p,onClose:G,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,onClose:Y,...a,disabled:(a==null?void 0:a.disabled)||u==="modal"||C,onChange:J=>{var X;J||((X=a==null?void 0:a.onClose)==null||X.call(a),G())},children:[m.jsx(v.Popover.Target,{children:m.jsx(v.Input,{"data-dates-input":!0,"data-read-only":C||void 0,disabled:x,component:"button",type:"button",multiline:!0,onClick:J=>{g==null||g(J),h.toggle()},__clearSection:q,__clearable:y&&E&&!C&&!x,rightSection:w,...t,ref:e,classNames:{...o,input:hu(Pu.input,o==null?void 0:o.input)},...F,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(ol,{value:M,name:O,form:j,type:B,withTime:V})]})});yo.classes=Pu;yo.displayName="@mantine/dates/PickerInputBase";const Ea=n=>n==="range"?[null,null]:n==="multiple"?[]:null,Aa=(n,e)=>{const t=e?Fn:He;return Array.isArray(n)?n.map(t):t(n)};function kr({type:n,value:e,defaultValue:t,onChange:r,withTime:s=!1}){const o=T.useRef(n),[i,l,a]=pu({value:Aa(e,s),defaultValue:Aa(t,s),finalValue:Ea(n),onChange:r});let c=i;return o.current!==n&&(o.current=n,e===void 0&&(c=t!==void 0?t:Ea(n),l(c))),[c,l,a]}function Ho(n,e){return n?n==="month"?0:n==="year"?1:2:e||0}function dm(n){return n===0?"month":n===1?"year":"decade"}function er(n,e,t){return dm(ts(Ho(n,0),Ho(e,0),Ho(t,2)))}const fm={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0,enableKeyboardNavigation:!0},Kn=v.factory((n,e)=>{const t=v.useProps("Calendar",fm,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:w,onMonthMouseEnter:E,headerControlsOrder:C,__updateDateOnYearSelect:x,__updateDateOnMonthSelect:M,__setDateRef:O,__setLevelRef:j,firstDayOfWeek:B,weekdayFormat:Y,weekendDays:V,getDayProps:F,excludeDate:q,renderDay:G,hideOutsideDates:J,hideWeekdays:X,getDayAriaLabel:W,monthLabelFormat:U,nextIcon:I,previousIcon:S,__onDayClick:A,__onDayMouseEnter:D,withCellSpacing:P,highlightToday:K,withWeekNumbers:de,monthsListFormat:N,getMonthControlProps:Q,yearLabelFormat:oe,yearsListFormat:te,getYearControlProps:pe,decadeLabelFormat:he,classNames:ae,styles:se,unstyled:Oe,minDate:ue,maxDate:ke,locale:ce,__staticSelector:Ee,size:Dn,__preventFocus:rn,__stopPropagation:sn,onNextDecade:on,onPreviousDecade:ln,onNextYear:an,onPreviousYear:Xe,onNextMonth:z,onPreviousMonth:Qe,static:Ze,enableKeyboardNavigation:cn,attributes:Nn,...Pr}=t,{resolvedClassNames:Gn,resolvedStyles:Io}=v.useResolvedStylesApi({classNames:ae,styles:se,props:t}),[It,ft]=pu({value:l?er(l,o,s):void 0,defaultValue:i?er(i,o,s):void 0,finalValue:er(void 0,o,s),onChange:a}),[jo,ne]=kr({type:"default",value:He(c),defaultValue:He(u),onChange:d});T.useImperativeHandle(O,()=>ge=>{ne(ge)}),T.useImperativeHandle(j,()=>ge=>{ft(ge)});const xe={__staticSelector:Ee||"Calendar",styles:Io,classNames:Gn,unstyled:Oe,size:Dn,attributes:Nn},ot=h||f||1,jt=new Date,Ch=ue&&R(jt).isAfter(ue)?ue:R(jt).format("YYYY-MM-DD"),Ct=jo||Ch,Mh=()=>{const ge=R(Ct).add(ot,"month").format("YYYY-MM-DD");z==null||z(ge),ne(ge)},wh=()=>{const ge=R(Ct).subtract(ot,"month").format("YYYY-MM-DD");Qe==null||Qe(ge),ne(ge)},Po=()=>{const ge=R(Ct).add(ot,"year").format("YYYY-MM-DD");an==null||an(ge),ne(ge)},_o=()=>{const ge=R(Ct).subtract(ot,"year").format("YYYY-MM-DD");Xe==null||Xe(ge),ne(ge)},Bo=()=>{const ge=R(Ct).add(10*ot,"year").format("YYYY-MM-DD");on==null||on(ge),ne(ge)},Fo=()=>{const ge=R(Ct).subtract(10*ot,"year").format("YYYY-MM-DD");ln==null||ln(ge),ne(ge)},ua=T.useRef(null);T.useEffect(()=>{if(!cn||Ze)return;const ge=Ue=>{var fa;if(!((fa=ua.current)!=null&&fa.contains(document.activeElement)))return;const _r=Ue.ctrlKey||Ue.metaKey,da=Ue.shiftKey;switch(Ue.key){case"ArrowUp":_r&&da?(Ue.preventDefault(),Fo()):_r&&(Ue.preventDefault(),_o());break;case"ArrowDown":_r&&da?(Ue.preventDefault(),Bo()):_r&&(Ue.preventDefault(),Po());break;case"y":case"Y":It==="month"&&(Ue.preventDefault(),ft("year"));break}};return document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)}},[cn,Ze,It,Po,_o,Bo,Fo]);const Th=ge=>{ua.current=ge,typeof e=="function"?e(ge):e&&(e.current=ge)};return m.jsxs(v.Box,{ref:Th,size:Dn,"data-calendar":!0,...Pr,children:[It==="month"&&m.jsx(go,{month:Ct,minDate:ue,maxDate:ke,firstDayOfWeek:B,weekdayFormat:Y,weekendDays:V,getDayProps:F,excludeDate:q,renderDay:G,hideOutsideDates:J,hideWeekdays:X,getDayAriaLabel:W,onNext:Mh,onPrevious:wh,hasNextLevel:s!=="month",onLevelClick:()=>ft("year"),numberOfColumns:f,locale:ce,levelControlAriaLabel:p==null?void 0:p.monthLevelControl,nextLabel:(p==null?void 0:p.nextMonth)??g,nextIcon:I,previousLabel:(p==null?void 0:p.previousMonth)??y,previousIcon:S,monthLabelFormat:U,__onDayClick:A,__onDayMouseEnter:D,__preventFocus:rn,__stopPropagation:sn,static:Ze,withCellSpacing:P,highlightToday:K,withWeekNumbers:de,headerControlsOrder:C,...xe}),It==="year"&&m.jsx(mo,{year:Ct,numberOfColumns:f,minDate:ue,maxDate:ke,monthsListFormat:N,getMonthControlProps:Q,locale:ce,onNext:Po,onPrevious:_o,hasNextLevel:s!=="month"&&s!=="year",onLevelClick:()=>ft("decade"),levelControlAriaLabel:p==null?void 0:p.yearLevelControl,nextLabel:(p==null?void 0:p.nextYear)??g,nextIcon:I,previousLabel:(p==null?void 0:p.previousYear)??y,previousIcon:S,yearLabelFormat:oe,__onControlMouseEnter:E,__onControlClick:(ge,Ue)=>{M&&ne(Ue),ft(er("month",o,s)),k==null||k(Ue)},__preventFocus:rn,__stopPropagation:sn,withCellSpacing:P,headerControlsOrder:C,...xe}),It==="decade"&&m.jsx(po,{decade:Ct,minDate:ue,maxDate:ke,yearsListFormat:te,getYearControlProps:pe,locale:ce,onNext:Bo,onPrevious:Fo,numberOfColumns:f,nextLabel:(p==null?void 0:p.nextDecade)??g,nextIcon:I,previousLabel:(p==null?void 0:p.previousDecade)??y,previousIcon:S,decadeLabelFormat:he,__onControlMouseEnter:w,__onControlClick:(ge,Ue)=>{x&&ne(Ue),ft(er("year",o,s)),b==null||b(Ue)},__preventFocus:rn,__stopPropagation:sn,withCellSpacing:P,headerControlsOrder:C,...xe})]})});Kn.classes={...po.classes,...mo.classes,...go.classes};Kn.displayName="@mantine/dates/Calendar";function fl(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:w,onNextMonth:E,onPreviousMonth:C,onNextYear:x,onPreviousYear:M,onNextDecade:O,onPreviousDecade:j,withCellSpacing:B,highlightToday:Y,__updateDateOnYearSelect:V,__updateDateOnMonthSelect:F,__setDateRef:q,__setLevelRef:G,withWeekNumbers:J,headerControlsOrder:X,firstDayOfWeek:W,weekdayFormat:U,weekendDays:I,getDayProps:S,excludeDate:A,renderDay:D,hideOutsideDates:P,hideWeekdays:K,getDayAriaLabel:de,monthLabelFormat:N,monthsListFormat:Q,getMonthControlProps:oe,yearLabelFormat:te,yearsListFormat:pe,getYearControlProps:he,decadeLabelFormat:ae,allowSingleDateInRange:se,allowDeselect:Oe,minDate:ue,maxDate:ke,locale:ce,...Ee}=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:w,onNextMonth:E,onPreviousMonth:C,onNextYear:x,onPreviousYear:M,onNextDecade:O,onPreviousDecade:j,withCellSpacing:B,highlightToday:Y,__updateDateOnYearSelect:V,__updateDateOnMonthSelect:F,__setDateRef:q,withWeekNumbers:J,headerControlsOrder:X,firstDayOfWeek:W,weekdayFormat:U,weekendDays:I,getDayProps:S,excludeDate:A,renderDay:D,hideOutsideDates:P,hideWeekdays:K,getDayAriaLabel:de,monthLabelFormat:N,monthsListFormat:Q,getMonthControlProps:oe,yearLabelFormat:te,yearsListFormat:pe,getYearControlProps:he,decadeLabelFormat:ae,allowSingleDateInRange:se,allowDeselect:Oe,minDate:ue,maxDate:ke,locale:ce},others:Ee}}function Oa(n,e){const t=[...e].sort((r,s)=>R(r).isAfter(R(s))?1:-1);return R(t[0]).startOf("day").subtract(1,"ms").isBefore(n)&&R(t[1]).endOf("day").add(1,"ms").isAfter(n)}function hm({type:n,level:e,value:t,defaultValue:r,onChange:s,allowSingleDateInRange:o,allowDeselect:i,onMouseLeave:l}){const[a,c]=kr({type:n,value:t,defaultValue:r,onChange:s}),[u,d]=T.useState(n==="range"&&a[0]&&!a[1]?a[0]:null),[f,h]=T.useState(null),p=C=>{if(n==="range"){if(u&&!a[1]){if(R(C).isSame(u,e)&&!o){d(null),h(null),c([null,null]);return}const x=[C,u];x.sort((M,O)=>R(M).isAfter(R(O))?1:-1),c(x),h(null),d(null);return}if(a[0]&&!a[1]&&R(C).isSame(a[0],e)&&!o){d(null),h(null),c([null,null]);return}c([C,null]),h(null),d(C);return}if(n==="multiple"){a.some(x=>R(x).isSame(C,e))?c(a.filter(x=>!R(x).isSame(C,e))):c([...a,C]);return}a&&i&&R(C).isSame(a,e)?c(null):c(C)},g=C=>u&&f?Oa(C,[f,u]):a[0]&&a[1]?Oa(C,a):!1,y=n==="range"?C=>{l==null||l(C),h(null)}:l,b=C=>a[0]&&R(C).isSame(a[0],e)?!(f&&R(f).isBefore(a[0])):!1,k=C=>a[1]?R(C).isSame(a[1],e):!a[0]||!f?!1:R(f).isBefore(a[0])&&R(C).isSame(a[0],e),w=C=>{if(n==="range")return{selected:a.some(M=>M&&R(M).isSame(C,e)),inRange:g(C),firstInRange:b(C),lastInRange:k(C),"data-autofocus":!!a[0]&&R(a[0]).isSame(C,e)||void 0};if(n==="multiple")return{selected:a.some(M=>M&&R(M).isSame(C,e)),"data-autofocus":!!a[0]&&R(a[0]).isSame(C,e)||void 0};const x=R(a).isSame(C,e);return{selected:x,"data-autofocus":x||void 0}},E=n==="range"&&u?h:()=>{};return T.useEffect(()=>{if(n==="range")if(a[0]&&!a[1])d(a[0]);else{const C=a[0]==null&&a[1]==null,x=a[0]!=null&&a[1]!=null;(C||x)&&(d(null),h(null))}},[a]),{onDateChange:p,onRootMouseLeave:y,onHoveredDateChange:E,getControlProps:w,_value:a,setValue:c}}var pm={datePickerRoot:"m_765a40cf",presetsList:"m_d6a681e1",presetButton:"m_acd30b22"};const mm=v.createVarsResolver((n,{size:e})=>({datePickerRoot:{"--preset-font-size":v.getFontSize(e)}})),gm={type:"default",defaultLevel:"month",numberOfColumns:1,size:"sm"},bo=v.factory((n,e)=>{const t=v.useProps("DatePicker",gm,n),{allowDeselect:r,allowSingleDateInRange:s,value:o,defaultValue:i,onChange:l,onMouseLeave:a,classNames:c,styles:u,__staticSelector:d,__onDayClick:f,__onDayMouseEnter:h,__onPresetSelect:p,__stopPropagation:g,presets:y,className:b,style:k,unstyled:w,size:E,vars:C,attributes:x,...M}=t,{calendarProps:O,others:j}=fl(M),B=T.useRef(null),Y=T.useRef(null),V=v.useStyles({name:d||"DatePicker",classes:pm,props:t,className:b,style:k,classNames:c,styles:u,unstyled:w,attributes:x,rootSelector:y?"datePickerRoot":void 0,varsResolver:mm,vars:C}),{onDateChange:F,onRootMouseLeave:q,onHoveredDateChange:G,getControlProps:J,_value:X,setValue:W}=hm({type:j.type,level:"day",allowDeselect:r,allowSingleDateInRange:s,value:o,defaultValue:i,onChange:l,onMouseLeave:a}),{resolvedClassNames:U,resolvedStyles:I}=v.useResolvedStylesApi({classNames:c,styles:u,props:t}),S=m.jsx(Kn,{ref:e,classNames:U,styles:I,__staticSelector:d||"DatePicker",onMouseLeave:q,size:E,...O,...y?{}:j,__stopPropagation:g,__setDateRef:B,__setLevelRef:Y,minLevel:O.minLevel||"month",__onDayMouseEnter:(P,K)=>{G(K),h==null||h(P,K)},__onDayClick:(P,K)=>{F(K),f==null||f(P,K)},getDayProps:P=>{var K;return{...J(P),...(K=O.getDayProps)==null?void 0:K.call(O,P)}},getMonthControlProps:P=>{var K;return{selected:typeof X=="string"?oo(P,X):!1,...(K=O.getMonthControlProps)==null?void 0:K.call(O,P)}},getYearControlProps:P=>{var K;return{selected:typeof X=="string"?R(P).isSame(X,"year"):!1,...(K=O.getYearControlProps)==null?void 0:K.call(O,P)}},hideOutsideDates:O.hideOutsideDates??O.numberOfColumns!==1,...y?{}:{className:b,style:k,attributes:x}});if(!y)return S;const A=P=>{var de,N;const K=Array.isArray(P)?P[0]:P;K!==void 0&&((de=B.current)==null||de.call(B,K),(N=Y.current)==null||N.call(Y,"month"),p?p(K):W(P))},D=y.map((P,K)=>m.jsx(v.UnstyledButton,{...V("presetButton"),onClick:()=>A(P.value),onMouseDown:de=>de.preventDefault(),"data-mantine-stop-propagation":g||void 0,children:P.label},K));return m.jsxs(v.Box,{...V("datePickerRoot"),size:E,...j,children:[m.jsx("div",{...V("presetsList"),children:D}),S]})});bo.classes=Kn.classes;bo.displayName="@mantine/dates/DatePicker";function ym(n){if(n===null)return null;const e=new Date(n);return Number.isNaN(e.getTime())||!n?null:R(e).format("YYYY-MM-DD")}function bm({date:n,maxDate:e,minDate:t}){return!(n==null||Number.isNaN(new Date(n).getTime())||e&&R(n).isAfter(e,"date")||t&&R(n).isBefore(t,"date"))}const km={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,size:"sm"},hl=v.factory((n,e)=>{const t=v.useInputProps("DateInput",km,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:w,onClick:E,onKeyDown:C,readOnly:x,name:M,form:O,rightSection:j,unstyled:B,classNames:Y,styles:V,allowDeselect:F,date:q,defaultDate:G,onDateChange:J,getMonthControlProps:X,getYearControlProps:W,disabled:U,...I}=t,S=T.useRef(null),A=T.useRef(null),[D,P]=T.useState(!1),{calendarProps:K,others:de}=fl(I),N=Rt(),oe=p||(z=>{const Qe=R(z,h,N.getLocale(f)).toDate();return Number.isNaN(Qe.getTime())?ym(z):R(Qe).format("YYYY-MM-DD")}),te=F!==void 0?F:a,pe=z=>z?R(z).locale(N.getLocale(f)).format(h):"",[he,ae,se]=kr({type:"default",value:o,defaultValue:i,onChange:l}),[Oe,ue]=kr({type:"default",value:q,defaultValue:i||G,onChange:J});T.useEffect(()=>{se&&o!==null&&ue(o)},[se,o]);const[ke,ce]=T.useState(pe(he));T.useEffect(()=>{ce(pe(he))},[N.getLocale(f)]);const Ee=z=>{const Qe=z.currentTarget.value;if(ce(Qe),P(!0),Qe.trim()===""&&(F||a))ae(null);else{const Ze=oe(Qe);Ze&&bm({date:Ze,minDate:g,maxDate:y})&&(ae(Ze),ue(Ze))}},Dn=z=>{w==null||w(z),P(!1),b&&ce(pe(he))},rn=z=>{k==null||k(z),P(!0)},sn=z=>{E==null||E(z),P(!0)},on=z=>{z.key==="Escape"&&P(!1),C==null||C(z)},ln=z=>({...d==null?void 0:d(z),selected:R(he).isSame(z,"day"),onClick:Qe=>{var cn,Nn;(Nn=d==null?void 0:(cn=d(z)).onClick)==null||Nn.call(cn,Qe);const Ze=te&&R(he).isSame(z,"day")?null:z;ae(Ze),!se&&Ze&&ce(pe(Ze)),P(!1)}}),an=m.jsx(v.Input.ClearButton,{onClick:()=>{ae(null),!se&&ce(""),P(!1)},unstyled:B,...c}),Xe=a&&!!he&&!x&&!U;return hs(()=>{he!==void 0&&!D&&ce(pe(he))},[he]),mp(()=>P(!1),void 0,[S.current,A.current]),m.jsxs(m.Fragment,{children:[m.jsx(v.Input.Wrapper,{...s,__staticSelector:"DateInput",ref:S,children:m.jsxs(v.Popover,{opened:D,trapFocus:!1,position:"bottom-start",disabled:x||U,withRoles:!1,unstyled:B,...u,children:[m.jsx(v.Popover.Target,{children:m.jsx(v.Input,{"data-dates-input":!0,"data-read-only":x||void 0,autoComplete:"off",ref:e,value:ke,onChange:Ee,onBlur:Dn,onFocus:rn,onClick:sn,onKeyDown:on,readOnly:x,rightSection:j,__clearSection:an,__clearable:Xe,...r,...de,disabled:U,__staticSelector:"DateInput"})}),m.jsx(v.Popover.Dropdown,{onMouseDown:z=>z.preventDefault(),"data-dates-dropdown":!0,ref:A,children:m.jsx(Kn,{__staticSelector:"DateInput",...K,classNames:Y,styles:V,unstyled:B,__preventFocus:!0,minDate:g,maxDate:y,locale:f,getDayProps:ln,size:r.size,date:Oe,onDateChange:ue,getMonthControlProps:z=>({selected:typeof he=="string"?oo(z,he):!1,...X==null?void 0:X(z)}),getYearControlProps:z=>({selected:typeof he=="string"?R(z).isSame(he,"year"):!1,...W==null?void 0:W(z)}),attributes:s.attributes})})]})}),m.jsx(ol,{name:M,form:O,value:he,type:"default"})]})});hl.classes={...v.Input.classes,...Kn.classes};hl.displayName="@mantine/dates/DateInput";function xm({minDate:n,value:e}){const t=n?R(n).format("HH:mm:ss"):null;return e&&n&&e===n?t??void 0:void 0}function vm({maxDate:n,value:e}){const t=n?R(n).format("HH:mm:ss"):null;return e&&n&&e===n?t??void 0:void 0}var _u={timeWrapper:"m_208d2562",timeInput:"m_62ee059"};const Sm={dropdownType:"popover",size:"sm"},pl=v.factory((n,e)=>{const t=v.useProps("DateTimePicker",Sm,n),{value:r,defaultValue:s,onChange:o,valueFormat:i,locale:l,classNames:a,styles:c,unstyled:u,timePickerProps:d,submitButtonProps:f,withSeconds:h,level:p,defaultLevel:g,size:y,variant:b,dropdownType:k,vars:w,minDate:E,maxDate:C,defaultDate:x,defaultTimeValue:M,presets:O,attributes:j,onDropdownClose:B,...Y}=t,V=v.useStyles({name:"DateTimePicker",classes:_u,props:t,classNames:a,styles:c,unstyled:u,attributes:j,vars:w}),{resolvedClassNames:F,resolvedStyles:q}=v.useResolvedStylesApi({classNames:a,styles:c,props:t}),G=i||(h?"DD/MM/YYYY HH:mm:ss":"DD/MM/YYYY HH:mm"),J=T.useRef(null),X=rr(J,d==null?void 0:d.hoursRef),{calendarProps:{allowSingleDateInRange:W,...U},others:I}=fl(Y),S=Rt(),[A,D]=kr({type:"default",value:r,defaultValue:s,onChange:o,withTime:!0}),P=x||A,K=ce=>ce?R(ce).format(h?"HH:mm:ss":"HH:mm"):"",[de,N]=T.useState(M||K(A)),[Q,oe]=T.useState(p||g||"month"),[te,pe]=il(!1),he=A?R(A).locale(S.getLocale(l)).format(G):"",ae=ce=>{var Ee;(Ee=d==null?void 0:d.onChange)==null||Ee.call(d,ce),N(ce),ce&&D(Ma(A,ce))},se=ce=>{var Ee;ce&&D(Ma($o(E,C,ce),de||M||"")),(Ee=J.current)==null||Ee.focus()},Oe=ce=>{ce.key==="Enter"&&(ce.preventDefault(),pe.close())};hs(()=>{te||N(K(A))},[A,te]),hs(()=>{te&&oe("month")},[te]);const ue=k==="popover",ke=()=>{const ce=$o(E,C,A);A&&A!==ce&&D($o(E,C,A)),B==null||B()};return m.jsxs(yo,{formattedValue:he,dropdownOpened:Y.disabled?!1:te,dropdownHandlers:pe,classNames:F,styles:q,unstyled:u,ref:e,onClear:()=>D(null),shouldClear:!!A,value:A,size:y,variant:b,dropdownType:k,...I,type:"default",__staticSelector:"DateTimePicker",onDropdownClose:ke,withTime:!0,attributes:j,children:[m.jsx(bo,{...U,maxDate:C,minDate:E,size:y,variant:b,type:"default",value:A,defaultDate:P||ap({maxDate:C,minDate:E}),onChange:se,locale:l,classNames:F,styles:q,unstyled:u,__staticSelector:"DateTimePicker",__stopPropagation:ue,level:p,defaultLevel:g,onLevelChange:ce=>{var Ee;oe(ce),(Ee=U.onLevelChange)==null||Ee.call(U,ce)},presets:O,__onPresetSelect:ce=>{D(ce),ce&&N(K(ce))},attributes:j}),Q==="month"&&m.jsxs("div",{...V("timeWrapper"),children:[m.jsx(cl,{value:de,withSeconds:h,unstyled:u,min:xm({minDate:E,value:A}),max:vm({maxDate:C,value:A}),...d,...V("timeInput",{className:d==null?void 0:d.className,style:d==null?void 0:d.style}),onChange:ae,onKeyDown:Oe,size:y,"data-mantine-stop-propagation":ue||void 0,hoursRef:X,attributes:j}),m.jsx(v.ActionIcon,{variant:"default",size:`input-${y||"sm"}`,...V("submitButton",{className:f==null?void 0:f.className,style:f==null?void 0:f.style}),unstyled:u,"data-mantine-stop-propagation":ue||void 0,children:m.jsx(v.CheckIcon,{size:"30%"}),...f,onClick:ce=>{var Ee;(Ee=f==null?void 0:f.onClick)==null||Ee.call(f,ce),pe.close(),ke()}})]})]})});pl.classes={..._u,...yo.classes,...bo.classes};pl.displayName="@mantine/dates/DateTimePicker";function Cm({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=i=>{t.onFieldChange(R(i,"YYYY-MM-DD").toDate())};return m.jsx(hl,{value:t.value??null,onChange:r||s?void 0:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,valueFormat:"YYYY-MM-DD",error:void 0})}const Mm=n=>n&&n instanceof Date?n:null;function wm({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=Mm(t.value),i=l=>{t.onFieldChange(R(l,"YYYY-MM-DD HH:mm:ss").toDate())};return m.jsx(pl,{value:o,onChange:r||s?void 0:i,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,valueFormat:"DD-MM-YYYY hh:mm A",variant:r?"filled":"default",error:void 0})}function Tm({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})}var Vr={exports:{}},Wo={};/**
|
|
22
|
+
<%s key={someKey} {...props} />`,P,N,Q,N),I[N+P]=!0)}if(N=null,D!==void 0&&(t(D),N=""+D),i(A)&&(t(A.key),N=""+A.key),"key"in A){D={};for(var oe in A)oe!=="key"&&(D[oe]=A[oe])}else D=A;return N&&l(D,typeof S=="function"?S.displayName||S.name||"Unknown":S),c(S,N,D,s(),K,de)}function d(S){f(S)?S._store&&(S._store.validated=1):typeof S=="object"&&S!==null&&S.$$typeof===j&&(S._payload.status==="fulfilled"?f(S._payload.value)&&S._payload.value._store&&(S._payload.value._store.validated=1):S._store&&(S._store.validated=1))}function f(S){return typeof S=="object"&&S!==null&&S.$$typeof===p}var h=T,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),E=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),V=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,q=Array.isArray,G=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(S){return S()}};var J,X={},W=h.react_stack_bottom_frame.bind(h,o)(),U=G(r(o)),I={};Qn.Fragment=y,Qn.jsx=function(S,A,D){var P=1e4>V.recentlyCreatedOwnerStacks++;return u(S,A,D,!1,P?Error("react-stack-top-frame"):W,P?G(r(S)):U)},Qn.jsxs=function(S,A,D){var P=1e4>V.recentlyCreatedOwnerStacks++;return u(S,A,D,!0,P?Error("react-stack-top-frame"):W,P?G(r(S)):U)}})()),Qn}var ga;function Lh(){return ga||(ga=1,process.env.NODE_ENV==="production"?Br.exports=Nh():Br.exports=Rh()),Br.exports}var m=Lh();function Ih(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 jh=typeof window<"u"?T.useLayoutEffect:T.useEffect;function _e(n,e){jh(()=>{if(n)return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[n])}function Ph(n,e){n&&Ih(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 _h(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 Si(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 Bh(n){const[e,t]=T.useState(Si(n)),r=T.useRef(e),s=T.useCallback(a=>{t(c=>{const u=Si(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 Ci(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 ya(n,e){const t=n.substring(e.length+1).split(".")[0];return parseInt(t,10)}function ba(n,e,t,r){if(e===void 0)return t;const s=`${String(n)}`;let o=t;r===-1&&(o=Ci(`${s}.${e}`,o));const i={...o},l=new Set;return Object.entries(o).filter(([a])=>{if(!a.startsWith(`${s}.`))return!1;const c=ya(a,s);return Number.isNaN(c)?!1:c>=e}).forEach(([a,c])=>{const u=ya(a,s),d=a.replace(`${s}.${u}`,`${s}.${u+r}`);i[d]=c,l.add(d),l.has(a)||delete i[a]}),i}function Fh(n,{from:e,to:t},r){const s=`${n}.${e}`,o=`${n}.${t}`,i={...r},l=new Set;return Object.keys(r).forEach(a=>{if(l.has(a))return;let c,u;if(a.startsWith(s)?(c=a,u=a.replace(s,o)):a.startsWith(o)&&(c=a.replace(o,s),u=a),c&&u){const d=i[c],f=i[u];f===void 0?delete i[c]:i[c]=f,d===void 0?delete i[u]:i[u]=d,l.add(c),l.add(u)}}),i}function ka(n,e,t){typeof t.value=="object"&&(t.value=Bn(t.value)),!t.enumerable||t.get||t.set||!t.configurable||!t.writable||e==="__proto__"?Object.defineProperty(n,e,t):n[e]=t.value}function Bn(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(Bn(i))})):o==="[object Map]"?(s=new Map,n.forEach(function(i,l){s.set(Bn(l),Bn(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(Bn(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++)ka(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]||ka(s,t,Object.getOwnPropertyDescriptor(n,t))}return s||n}function lu(n){return typeof n!="string"?[]:n.split(".")}function De(n,e){const t=lu(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 Nr(n,e,t){const r=lu(n);if(r.length===0)return t;const s=Bn(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 zh(n,{from:e,to:t},r){const s=De(n,r);if(!Array.isArray(s))return r;const o=[...s],i=s[e];return o.splice(e,1),o.splice(t,0,i),Nr(n,o,r)}function $h(n,e,t,r){const s=De(n,r);if(!Array.isArray(s))return r;const o=[...s];return o.splice(typeof t=="number"?t:o.length,0,e),Nr(n,o,r)}function Vh(n,e,t){const r=De(n,t);return Array.isArray(r)?Nr(n,r.filter((s,o)=>o!==e),t):t}function Hh(n,e,t,r){const s=De(n,r);if(!Array.isArray(s)||s.length<=t)return r;const o=[...s];return o[t]=e,Nr(n,o,r)}function Wh({$values:n,$errors:e,$status:t}){const r=T.useCallback((l,a)=>{t.clearFieldDirty(l),e.setErrors(c=>Fh(l,a,c)),n.setValues({values:zh(l,a,n.refValues.current),updateState:!0})},[]),s=T.useCallback((l,a)=>{t.clearFieldDirty(l),e.setErrors(c=>ba(l,a,c,-1)),n.setValues({values:Vh(l,a,n.refValues.current),updateState:!0})},[]),o=T.useCallback((l,a,c)=>{t.clearFieldDirty(l),e.setErrors(u=>ba(l,c,u,1)),n.setValues({values:$h(l,a,c,n.refValues.current),updateState:!0})},[]),i=T.useCallback((l,a,c)=>{t.clearFieldDirty(l),n.setValues({values:Hh(l,c,a,n.refValues.current),updateState:!0})},[]);return{reorderListItem:r,removeListItem:s,insertListItem:o,replaceListItem:i}}var zo,xa;function Yh(){return xa||(xa=1,zo=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}),zo}var Uh=Yh();const Fr=rl(Uh);function Zn(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 qh({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(x=>{const M=typeof x=="function"?x(a.current):x;a.current=M,t==="controlled"&&o(M)},[]),d=T.useCallback((x,M=!1)=>{const O=typeof x=="function"?x(c.current):x;c.current=O,(t==="controlled"||M)&&l(O)},[]),f=T.useCallback(()=>u({}),[]),h=T.useCallback(x=>{const M=x?{...r.refValues.current,...x}:r.refValues.current;r.setValuesSnapshot(M),d({})},[]),p=T.useCallback((x,M)=>{u(O=>Zn(O,x)===M?O:{...O,[x]:M})},[]),g=T.useCallback((x,M,O)=>{d(j=>Zn(j,x)===M?j:{...j,[x]:M},O)},[]),y=T.useCallback((x,M)=>{const O=Zn(c.current,x),j=!Fr(De(x,r.getValuesSnapshot()),M),B=Ci(x,c.current);B[x]=j,d(B,O!==j)},[]),b=T.useCallback(x=>Zn(a.current,x),[]),k=T.useCallback(x=>d(M=>{if(typeof x!="string")return M;const O=Ci(x,M);return delete O[x],Fr(O,M)?M:O}),[]),w=T.useCallback(x=>{if(x){const O=De(x,c.current);if(typeof O=="boolean")return O;const j=De(x,r.refValues.current),B=De(x,r.valuesSnapshot.current);return!Fr(j,B)}return Object.keys(c.current).length>0?Zn(c.current):!Fr(r.refValues.current,r.valuesSnapshot.current)},[]),E=T.useCallback(()=>c.current,[]),C=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:w,getDirty:E,getTouched:C,setCalculatedFieldDirty:y}}function Kh({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:y,subscribers:b,updateState:k=!0,mergeWithPreviousValues:w=!0})=>{const E=i.current,C=y instanceof Function?y(i.current):y,x=w?{...E,...C}:C;i.current=x,k&&(o(x),t==="uncontrolled"&&(i.current=x)),e==null||e(x,E),b==null||b.filter(Boolean).forEach(M=>M({updatedValues:x,previousValues:E}))},[e]),c=T.useCallback(y=>{var w;const b=De(y.path,i.current),k=y.value instanceof Function?y.value(b):y.value;if(b!==k){const E=i.current,C=Nr(y.path,k,i.current);a({values:C,updateState:y.updateState}),(w=y.subscribers)==null||w.filter(Boolean).forEach(x=>x({path:y.path,updatedValues:C,previousValues:E}))}},[a]),u=T.useCallback(y=>{l.current=y},[]),d=T.useCallback((y,b)=>{r.current||(r.current=!0,a({values:y,updateState:t==="controlled"}),u(y),b())},[a]),f=T.useCallback(()=>{a({values:l.current,updateState:!0,mergeWithPreviousValues:!1})},[a]),h=T.useCallback(()=>i.current,[]),p=T.useCallback(()=>l.current,[]),g=T.useCallback((y,b)=>{const k=De(y,l.current);typeof k>"u"||c({path:y,value:k,updateState:t==="controlled",subscribers:b})},[c,t]);return{initialized:r,stateValues:s,refValues:i,valuesSnapshot:l,setValues:a,setFieldValue:c,resetValues:f,setValuesSnapshot:u,initialize:d,getValues:h,getValuesSnapshot:p,resetField:g}}function Jh({$status:n,cascadeUpdates:e}){const t=T.useRef({}),r=T.useCallback((o,i)=>{T.useEffect(()=>(t.current[o]=t.current[o]||[],t.current[o].push(i),()=>{t.current[o]=t.current[o].filter(l=>l!==i)}),[i])},[]),s=T.useCallback(o=>{var l;const i=((l=t.current[o])==null?void 0:l.map(a=>c=>a({previousValue:De(o,c.previousValues),value:De(o,c.updatedValues),touched:n.isTouched(o),dirty:n.isDirty(o)})))??[];if(e)for(const a in t.current)(a.startsWith(`${o}.`)||o.startsWith(`${a}.`))&&i.push(...t.current[a].map(c=>u=>c({previousValue:De(a,u.previousValues),value:De(a,u.updatedValues),touched:n.isTouched(a),dirty:n.isDirty(a)})));return i},[]);return{subscribers:t,watch:r,getFieldSubscribers:s}}function va(n,e){return n?`${n}-${e.toString()}`:e.toString()}const zr=Symbol("root-rule");function Sa(n){const e=Si(n);return{hasErrors:Object.keys(e).length>0,errors:e}}function Mi(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=De(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)=>Mi(i,e,`${l}.${d}`,s)),zr in i&&(s[l]=i[zr](a,e,l))),typeof i=="object"&&typeof a=="object"&&a!==null&&(c||Mi(i,e,l,s),zr in i&&(s[l]=i[zr](a,e,l))),s},r)}function wi(n,e){return Sa(typeof n=="function"?n(e):Mi(n,e))}function $r(n,e,t){if(typeof n!="string")return{hasError:!1,error:null};const r=wi(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 Gh="__MANTINE_FORM_INDEX__";function Ca(n,e){return e?typeof e=="boolean"?e:Array.isArray(e)?e.includes(n.replace(/[.][0-9]+/g,`.${Gh}`)):!1:!1}function Xh({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=(y=>y),enhanceGetInputProps:d,validate:f,onSubmitPreventDefault:h="always",touchTrigger:p="change",cascadeUpdates:g=!1}={}){const y=Bh(r),b=Kh({initialValues:t,onValuesChange:c,mode:e}),k=qh({initialDirty:s,initialTouched:o,$values:b,mode:e}),w=Wh({$values:b,$errors:y,$status:k}),E=Jh({$status:k,cascadeUpdates:g}),[C,x]=T.useState(0),[M,O]=T.useState({}),[j,B]=T.useState(!1),Y=T.useCallback(()=>{b.resetValues(),y.clearErrors(),k.resetDirty(),k.resetTouched(),e==="uncontrolled"&&x(N=>N+1)},[]),V=T.useCallback(N=>{i&&y.clearErrors(),e==="uncontrolled"&&x(Q=>Q+1),Object.keys(E.subscribers.current).forEach(Q=>{const oe=De(Q,b.refValues.current),te=De(Q,N);oe!==te&&E.getFieldSubscribers(Q).forEach(pe=>pe({previousValues:N,updatedValues:b.refValues.current}))})},[i]),F=T.useCallback(N=>{const Q=b.refValues.current;b.initialize(N,()=>e==="uncontrolled"&&x(oe=>oe+1)),V(Q)},[V]),q=T.useCallback((N,Q,oe)=>{const te=Ca(N,l),pe=Q instanceof Function?Q(De(N,b.refValues.current)):Q;k.setCalculatedFieldDirty(N,pe),p==="change"&&k.setFieldTouched(N,!0),!te&&i&&y.clearFieldError(N),b.setFieldValue({path:N,value:Q,updateState:e==="controlled",subscribers:[...E.getFieldSubscribers(N),te?he=>{const ae=$r(N,f,he.updatedValues);ae.hasError?y.setFieldError(N,ae.error):y.clearFieldError(N)}:null,(oe==null?void 0:oe.forceUpdate)!==!1&&e!=="controlled"?()=>O(he=>({...he,[N]:(he[N]||0)+1})):null]})},[c,f]),G=T.useCallback(N=>{const Q=b.refValues.current;b.setValues({values:N,updateState:e==="controlled"}),V(Q)},[c,V]),J=T.useCallback(()=>{const N=wi(f,b.refValues.current);return y.setErrors(N.errors),N},[f]),X=T.useCallback(N=>{const Q=$r(N,f,b.refValues.current);return Q.hasError?y.setFieldError(N,Q.error):y.clearFieldError(N),Q},[f]),W=(N,{type:Q="input",withError:oe=!0,withFocus:te=!0,...pe}={})=>{const ae={onChange:_h(se=>q(N,se,{forceUpdate:!1})),"data-path":va(n,N)};return oe&&(ae.error=y.errorsState[N]),Q==="checkbox"?ae[e==="controlled"?"checked":"defaultChecked"]=De(N,b.refValues.current):ae[e==="controlled"?"value":"defaultValue"]=De(N,b.refValues.current),te&&(ae.onFocus=()=>k.setFieldTouched(N,!0),ae.onBlur=()=>{if(Ca(N,a)){const se=$r(N,f,b.refValues.current);se.hasError?y.setFieldError(N,se.error):y.clearFieldError(N)}}),Object.assign(ae,d==null?void 0:d({inputProps:ae,field:N,options:{type:Q,withError:oe,withFocus:te,...pe},form:de}))},U=(N,Q)=>oe=>{h==="always"&&(oe==null||oe.preventDefault());const te=J();if(te.hasErrors)h==="validation-failed"&&(oe==null||oe.preventDefault()),Q==null||Q(te.errors,b.refValues.current,oe);else{const pe=N==null?void 0:N(u(b.refValues.current),oe);pe instanceof Promise&&(B(!0),pe.finally(()=>B(!1)))}},I=N=>u(N||b.refValues.current),S=T.useCallback(N=>{N.preventDefault(),Y()},[]),A=T.useCallback(N=>N?!$r(N,f,b.refValues.current).hasError:!wi(f,b.refValues.current).hasErrors,[f]),D=N=>`${C}-${String(N)}-${M[String(N)]||0}`,P=T.useCallback(N=>document.querySelector(`[data-path="${va(n,N)}"]`),[]),K=T.useCallback(N=>{b.resetField(N,[e!=="controlled"?()=>O(Q=>({...Q,[N]:(Q[N]||0)+1})):null])},[b.resetField,e,O]),de={watch:E.watch,initialized:b.initialized.current,values:e==="uncontrolled"?b.refValues.current:b.stateValues,getValues:b.getValues,getInitialValues:b.getValuesSnapshot,setInitialValues:b.setValuesSnapshot,resetField:K,initialize:F,setValues:G,setFieldValue:q,submitting:j,setSubmitting:B,errors:y.errorsState,setErrors:y.setErrors,setFieldError:y.setFieldError,clearFieldError:y.clearFieldError,clearErrors:y.clearErrors,resetDirty:k.resetDirty,setTouched:k.setTouched,setDirty:k.setDirty,isTouched:k.isTouched,resetTouched:k.resetTouched,isDirty:k.isDirty,getTouched:k.getTouched,getDirty:k.getDirty,reorderListItem:w.reorderListItem,insertListItem:w.insertListItem,removeListItem:w.removeListItem,replaceListItem:w.replaceListItem,reset:Y,validate:J,validateField:X,getInputProps:W,onSubmit:U,onReset:S,isValid:A,getTransformedValues:I,key:D,getInputNode:P};return Ph(n,de),de}function Qh(){const n=T.createContext(null);function e({form:r,children:s}){return m.jsx(n.Provider,{value:r,children:s})}function t(){const r=T.useContext(n);if(!r)throw new Error("useFormContext was called outside of FormProvider context");return r}return[e,t,Xh]}const[Zh,au,ep]=Qh(),cu=T.createContext(null),tp=({children:n,value:e})=>m.jsx(cu.Provider,{value:e,children:n}),np=()=>{const n=T.useContext(cu);if(!n)throw new Error("useRenderers must be used inside <RendererProvider>");return n},uu=T.createContext(null),rp=({children:n,value:e})=>m.jsx(uu.Provider,{value:e,children:n}),sp=()=>{const n=T.useContext(uu);if(!n)throw new Error("useUpdateFieldSchema must be used inside <UpdateFieldSchemaProvider>");return n},so=n=>{const{fieldSchema:e}=n,t=np(),r=sp(),s=au(),[o,i]=T.useState(e);if(T.useEffect(()=>{let a=!1;async function c(){const u=e.name.replace(/\.\d+/g,""),d=r==null?void 0:r[u];if(typeof d=="function"){const f=await d(e.name,e,s.getValues());!a&&f&&i(f);return}a||i(e)}return c(),()=>{a=!0}},[e,r]),!o)return null;const l=t==null?void 0:t.resolve(o);return l?m.jsx(l,{field:o,form:s}):null};function op({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.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function ip({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 du({controlsRef:n,direction:e,levelIndex:t,rowIndex:r,cellIndex:s,size:o}){var a,c,u;const i=ip({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")?du({controlsRef:n,direction:e,levelIndex:i.levelIndex,cellIndex:i.cellIndex,rowIndex:i.rowIndex,size:o}):l.focus())}function lp(n){switch(n){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function ap(n){var e;return(e=n.current)==null?void 0:e.map(t=>t.map(r=>r.length))}function sl({controlsRef:n,levelIndex:e,rowIndex:t,cellIndex:r,event:s}){const o=lp(s.key);if(o){s.preventDefault();const i=ap(n);du({controlsRef:n,direction:o,levelIndex:e,rowIndex:t,cellIndex:r,size:i})}}function Ma(n,e){let t=n?R(n):R();if(e==="")return t.format("YYYY-MM-DD HH:mm:ss");const[r,s,o=0]=e.split(":").map(Number);return t=t.set("hour",r),t=t.set("minute",s),t=t.set("second",o),t=t.set("millisecond",0),t.format("YYYY-MM-DD HH:mm:ss")}function He(n){return n==null||n===""?n:R(n).format("YYYY-MM-DD")}function Fn(n){return n==null||n===""?n:R(n).format("YYYY-MM-DD HH:mm:ss")}function cp({minDate:n,maxDate:e}){const t=R();return!n&&!e?He(t):n&&R(t).isBefore(n)?He(n):e&&R(t).isAfter(e)?He(e):He(t)}function $o(n,e,t){return!n&&!e?Fn(t):n&&R(t).isBefore(n)?Fn(n):e&&R(t).isAfter(e)?Fn(e):Fn(t)}const up={locale:"en",firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:"–",consistentWeeks:!1},dp=T.createContext(up);function Rt(){const n=T.useContext(dp),e=T.useCallback(o=>o||n.locale,[n.locale]),t=T.useCallback(o=>typeof o=="number"?o:n.firstDayOfWeek,[n.firstDayOfWeek]),r=T.useCallback(o=>Array.isArray(o)?o:n.weekendDays,[n.weekendDays]),s=T.useCallback(o=>typeof o=="string"?o:n.labelSeparator,[n.labelSeparator]);return{...n,getLocale:e,getFirstDayOfWeek:t,getWeekendDays:r,getLabelSeparator:s}}function fp({value:n,type:e,withTime:t}){const r=t?Fn:He;if(e==="range"&&Array.isArray(n)){const s=r(n[0]),o=r(n[1]);return s?o?`${s} – ${o}`:`${s} –`:""}return e==="multiple"&&Array.isArray(n)?n.filter(Boolean).join(", "):!Array.isArray(n)&&n?r(n):""}function ol({value:n,type:e,name:t,form:r,withTime:s=!1}){return m.jsx("input",{type:"hidden",value:fp({value:n,type:e,withTime:s}),name:t,form:r})}ol.displayName="@mantine/dates/HiddenDatesInput";function fu(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=fu(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function hu(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=fu(n))&&(r&&(r+=" "),r+=e);return r}var hp={input:"m_468e7eda"};const fs=v.factory((n,e)=>{const t=v.useProps("TimeInput",null,n),{classNames:r,styles:s,unstyled:o,vars:i,withSeconds:l,minTime:a,maxTime:c,value:u,onChange:d,step:f,...h}=t,{resolvedClassNames:p,resolvedStyles:g}=v.useResolvedStylesApi({classNames:r,styles:s,props:t}),y=k=>{if(a!==void 0||c!==void 0){const[w,E,C]=k.split(":").map(Number);if(a){const[x,M,O]=a.split(":").map(Number);if(w<x||w===x&&E<M||l&&w===x&&E===M&&C<O)return-1}if(c){const[x,M,O]=c.split(":").map(Number);if(w>x||w===x&&E>M||l&&w===x&&E===M&&C>O)return 1}}return 0},b=k=>{var w,E,C;if((w=t.onBlur)==null||w.call(t,k),a!==void 0||c!==void 0){const x=k.currentTarget.value;if(x){const M=y(x);M===1?(c&&(k.currentTarget.value=c),(E=t.onChange)==null||E.call(t,k)):M===-1&&(a&&(k.currentTarget.value=a),(C=t.onChange)==null||C.call(t,k))}}};return m.jsx(v.InputBase,{classNames:{...p,input:hu(hp.input,p==null?void 0:p.input)},styles:g,unstyled:o,ref:e,value:u,step:f??(l?1:60),...h,onChange:d,onBlur:b,type:"time",__staticSelector:"TimeInput"})});fs.classes=v.InputBase.classes;fs.displayName="@mantine/dates/TimeInput";function ts(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)}function pp(n="mantine-"){return`${n}${Math.random().toString(36).slice(2,11)}`}const mp=["mousedown","touchstart"];function gp(n,e,t){const r=T.useRef(null),s=mp;return T.useEffect(()=>{const o=i=>{const{target:l}=i??{};if(Array.isArray(t)){const a=!document.body.contains(l)&&(l==null?void 0:l.tagName)!=="HTML";t.every(u=>!!u&&!i.composedPath().includes(u))&&!a&&n(i)}else r.current&&!r.current.contains(l)&&n(i)};return s.forEach(i=>document.addEventListener(i,o)),()=>{s.forEach(i=>document.removeEventListener(i,o))}},[r,n,t]),r}const yp=typeof document<"u"?T.useLayoutEffect:T.useEffect;function hs(n,e){const t=T.useRef(!1);T.useEffect(()=>()=>{t.current=!1},[]),T.useEffect(()=>{if(t.current)return n();t.current=!0},e)}const bp=T.useId||(()=>{});function kp(){const n=bp();return n?`mantine-${n.replace(/:/g,"")}`:""}function xp(n){const e=kp(),[t,r]=T.useState(e);return yp(()=>{r(pp())},[]),typeof window>"u"?e:t}function vp(n,e,t){T.useEffect(()=>(window.addEventListener(n,e,t),()=>window.removeEventListener(n,e,t)),[n,e])}function wa(n,e){if(typeof n=="function")return n(e);typeof n=="object"&&n!==null&&"current"in n&&(n.current=e)}function Sp(...n){const e=new Map;return t=>{if(n.forEach(r=>{const s=wa(r,t);s&&e.set(r,s)}),e.size>0)return()=>{n.forEach(r=>{const s=e.get(r);s&&typeof s=="function"?s():wa(r,null)}),e.clear()}}}function rr(...n){return T.useCallback(Sp(...n),n)}function pu({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 Cp(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 Mp(n){const[e,t]=T.useState(n);return[e,Cp(t)]}function il(n=!1,e={}){const[t,r]=T.useState(n),s=T.useCallback(()=>{r(l=>{var a;return l||((a=e.onOpen)==null||a.call(e),!0)})},[e.onOpen]),o=T.useCallback(()=>{r(l=>{var a;return l&&((a=e.onClose)==null||a.call(e),!1)})},[e.onClose]),i=T.useCallback(()=>{t?o():s()},[o,s,t]);return[t,{open:s,close:o,toggle:i}]}function Ve(n){return n<10?`0${n}`:`${n}`}const wp=n=>Number(n.toFixed(0)[0]),ns=T.forwardRef(({value:n,min:e,max:t,onChange:r,focusable:s,step:o,onNextInput:i,onPreviousInput:l,onFocus:a,readOnly:c,allowTemporaryZero:u=!1,placeholder:d="--",...f},h)=>{const p=wp(t),g=t+1-o,y=k=>{if(c)return;const w=k.replace(/\D/g,"");if(w!==""){const E=parseInt(w,10),C=u&&E===0&&e>0?0:ts(E,e,t);r(C),(C>p||k.startsWith("00"))&&(i==null||i())}},b=k=>{if(!c){if((k.key==="0"||k.key==="Num0")&&n===0&&(k.preventDefault(),i==null||i()),k.key==="Home"&&(k.preventDefault(),r(e)),k.key==="End"&&(k.preventDefault(),r(t)),(k.key==="Backspace"||k.key==="Delete")&&(k.preventDefault(),n!==null?r(null):l==null||l()),k.key==="ArrowRight"&&(k.preventDefault(),i==null||i()),k.key==="ArrowLeft"&&(k.preventDefault(),l==null||l()),k.key==="ArrowUp"){k.preventDefault();const w=n===null?e:ts(n+o,e,g);r(w)}if(k.key==="ArrowDown"){k.preventDefault();const w=n===null?g:ts(n-o,e,g);r(w)}}};return m.jsx("input",{ref:h,type:"text",role:"spinbutton","aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":n===null?0:n,"data-empty":n===null||void 0,inputMode:"numeric",placeholder:d,value:n===null?"":Ve(n),onChange:k=>y(k.currentTarget.value),onKeyDown:b,onFocus:k=>{k.currentTarget.select(),a==null||a(k)},onClick:k=>{k.stopPropagation(),k.currentTarget.select()},onMouseDown:k=>k.stopPropagation(),...f})});ns.displayName="@mantine/dates/SpinInput";const[Tp,Tn]=v.createSafeContext("TimeInput component was not found in the component tree"),mu=T.forwardRef(({labels:n,value:e,onChange:t,className:r,style:s,onPreviousInput:o,readOnly:i,onMouseDown:l,onTouchStart:a,inputType:c,...u},d)=>{const f=Tn(),h=p=>{i||(p.key==="Home"&&(p.preventDefault(),t(n.am)),p.key==="End"&&(p.preventDefault(),t(n.pm)),(p.key==="Backspace"||p.key==="Delete")&&(p.preventDefault(),e===null?o==null||o():t(null)),p.key==="ArrowLeft"&&(p.preventDefault(),o==null||o()),(p.key==="ArrowUp"||p.key==="ArrowDown")&&(p.preventDefault(),t(e===n.am?n.pm:n.am)),p.code==="KeyA"&&(p.preventDefault(),t(n.am)),p.code==="KeyP"&&(p.preventDefault(),t(n.pm)))};if(c==="input"){const p=e||"--",g=p.length+1;return m.jsx("input",{...f.getStyles("field",{className:r,style:s}),ref:d,value:p,size:g,onChange:y=>!i&&t(y.target.value||null),onClick:(y=>y.stopPropagation()),onKeyDown:h,onMouseDown:y=>{y.stopPropagation(),l==null||l(y)},"data-am-pm":!0,...u})}return m.jsxs("select",{...f.getStyles("field",{className:r,style:s}),ref:d,value:e||"",onChange:p=>!i&&t(p.target.value||null),onClick:p=>p.stopPropagation(),onKeyDown:h,onMouseDown:p=>{p.stopPropagation(),l==null||l(p)},"data-am-pm":!0,...u,children:[m.jsx("option",{value:"",children:"--"}),m.jsx("option",{value:n.am,children:n.am}),m.jsx("option",{value:n.pm,children:n.pm})]})});mu.displayName="@mantine/dates/AmPmInput";function ll({value:n,active:e,onSelect:t}){const r=Tn();return m.jsx(v.UnstyledButton,{mod:{active:e},onClick:()=>t(n),onMouseDown:s=>s.preventDefault(),"data-value":n,tabIndex:-1,...r.getStyles("control"),children:typeof n=="number"?Ve(n):n})}ll.displayName="@mantine/dates/TimeControl";function gu({labels:n,value:e,onSelect:t}){const r=Tn(),s=[n.am,n.pm].map(o=>m.jsx(ll,{value:o,active:e===o,onSelect:t},o));return m.jsx("div",{...r.getStyles("controlsList"),children:s})}gu.displayName="@mantine/dates/AmPmControlsList";function Ep(n,e){if(!n||!e)return!1;const t=n.getBoundingClientRect(),r=e.getBoundingClientRect();return t.top>=r.top&&t.bottom<=r.bottom&&t.left>=r.left&&t.right<=r.right}function Ap(n,e,t){const r=[];for(let s=n;s<=e;s+=t)r.push(s);return r}function rs({min:n,max:e,step:t,value:r,onSelect:s,reversed:o}){const i=Tn(),l=T.useRef(null),a=Ap(n,e,t),c=(o?a.reverse():a).map(u=>m.jsx(ll,{value:u,active:r===u,onSelect:s},u));return T.useEffect(()=>{r!==null&&requestAnimationFrame(()=>{var f;const d=(f=l.current)==null?void 0:f.querySelector(`[data-value="${r}"]`);Ep(d,l.current)||d==null||d.scrollIntoView({block:"nearest"})})},[r]),m.jsx(v.ScrollArea,{h:i.maxDropdownContentHeight,type:"never",viewportRef:l,...i.getStyles("scrollarea"),...i.scrollAreaProps,children:m.jsx("div",{...i.getStyles("controlsList"),children:c})})}rs.displayName="@mantine/dates/TimeControlsList";function ps(n){const[e=null,t=null,r=null]=n.split(":").map(Number);return{hours:e,minutes:t,seconds:r}}function yu({time:n,compare:e,withSeconds:t}){const r=ps(n),s=ps(e);return t?r.hours===s.hours&&r.minutes===s.minutes&&r.seconds===s.seconds:r.hours===s.hours&&r.minutes===s.minutes}function Op(n,e){return`${n.getHours()}:${n.getMinutes()}${e?`:${n.getSeconds()}`:""}`}function Dp({value:n,format:e,amPmLabels:t,withSeconds:r}){const s=ps(typeof n=="string"?n:Op(n,r));if(s.hours===null||s.minutes===null)return null;if(e==="24h")return`${Ve(s.hours)}:${Ve(s.minutes)}${r?`:${Ve(s.seconds||0)}`:""}`;const o=s.hours>=12;return`${s.hours%12===0?12:s.hours%12}:${Ve(s.minutes)}${r?`:${Ve(s.seconds||0)}`:""} ${o?t.pm:t.am}`}function bu({value:n,format:e="24h",amPmLabels:t={am:"AM",pm:"PM"},withSeconds:r=!1}){return m.jsx(m.Fragment,{children:Dp({value:n,format:e,amPmLabels:t,withSeconds:r})})}bu.displayName="@mantine/dates/TimeValue";function al({value:n,active:e,onChange:t,format:r,amPmLabels:s,withSeconds:o}){const i=Tn();return m.jsx(v.UnstyledButton,{mod:{active:e},onClick:()=>t(n),...i.getStyles("presetControl"),children:m.jsx(bu,{withSeconds:o,value:n,format:r,amPmLabels:s})})}al.displayName="@mantine/dates/TimePresetControl";function ku({value:n,data:e,onChange:t,format:r,amPmLabels:s,withSeconds:o}){const i=Tn(),l=e.values.map(a=>m.jsx(al,{value:a,format:r,amPmLabels:s,withSeconds:o,active:yu({time:a,compare:n,withSeconds:o}),onChange:t},a));return m.jsxs("div",{...i.getStyles("presetsGroup"),children:[m.jsx("div",{...i.getStyles("presetsGroupLabel"),children:e.label}),m.jsx(v.SimpleGrid,{cols:o?2:3,spacing:4,children:l})]})}ku.displayName="@mantine/dates/TimePresetGroup";function xu({presets:n,format:e,amPmLabels:t,withSeconds:r,value:s,onChange:o}){const i=Tn();if(n.length===0)return null;if(typeof n[0]=="string"){const a=n.map(c=>m.jsx(al,{value:c,format:e,amPmLabels:t,withSeconds:r,active:yu({time:c,compare:s,withSeconds:r}),onChange:o},c));return m.jsx(v.ScrollArea.Autosize,{mah:i.maxDropdownContentHeight,type:"never",...i.getStyles("scrollarea"),...i.scrollAreaProps,children:m.jsx("div",{...i.getStyles("presetsRoot"),children:m.jsx(v.SimpleGrid,{cols:r?2:3,spacing:4,children:a})})})}const l=n.map((a,c)=>m.jsx(ku,{data:a,value:s,format:e,amPmLabels:t,withSeconds:r,onChange:o},c));return m.jsx(v.ScrollArea.Autosize,{mah:i.maxDropdownContentHeight,type:"never",...i.getStyles("scrollarea"),...i.scrollAreaProps,children:m.jsx("div",{...i.getStyles("presetsRoot"),children:l})})}xu.displayName="@mantine/dates/TimePresets";function Vo(n){const[e=0,t=0,r=0]=n.split(":").map(Number);return e*3600+t*60+r}function Np(n){const e=Math.floor(n/3600),t=Math.floor(n%3600/60),r=n%60;return{timeString:`${Ve(e)}:${Ve(t)}:${Ve(r)}`,hours:e,minutes:t,seconds:r}}function vu(n,e,t){const r=Vo(n),s=e?Vo(e):-1/0,o=t?Vo(t):1/0,i=Math.max(s,Math.min(r,o));return Np(i)}function Rp({hours:n,minutes:e,seconds:t,amPmLabels:r}){if(n===null)return{hours:null,minutes:null,seconds:null,amPm:null};const s=n>=12?r.pm:r.am;return{hours:n%12===0?12:n%12,minutes:typeof e=="number"?e:null,seconds:typeof t=="number"?t:null,amPm:s}}function sr({time:n,format:e,amPmLabels:t}){if(n==="")return{hours:null,minutes:null,seconds:null,amPm:null};const{hours:r,minutes:s,seconds:o}=ps(n),i={hours:r,minutes:s,seconds:o};return e==="12h"?Rp({...i,amPmLabels:t}):{...i,amPm:null}}function Lp({hours:n,minutes:e,seconds:t,amPm:r,amPmLabels:s,withSeconds:o}){let i=n;return r===s.pm&&n!==12?i+=12:r===s.am&&n===12&&(i=0),`${Ve(i)}:${Ve(e)}${o?`:${Ve(t||0)}`:""}`}function ss({hours:n,minutes:e,seconds:t,format:r,withSeconds:s,amPm:o,amPmLabels:i}){return n===null||e===null?{valid:!1,value:""}:s&&t===null?{valid:!1,value:""}:r==="24h"?{valid:!0,value:`${Ve(n)}:${Ve(e)}${s?`:${Ve(t)}`:""}`}:o===null?{valid:!1,value:""}:{valid:!0,value:Lp({hours:n,minutes:e,seconds:t,amPm:o,amPmLabels:i,withSeconds:s})}}function Ip({value:n,defaultValue:e,onChange:t,format:r,amPmLabels:s,withSeconds:o=!1,min:i,max:l,clearable:a,readOnly:c,disabled:u,pasteSplit:d}){const f=sr({time:n||e||"",amPmLabels:s,format:r}),h=T.useRef(!0),[p,g]=T.useState(f.hours),[y,b]=T.useState(f.minutes),[k,w]=T.useState(f.seconds),[E,C]=T.useState(f.amPm),x=a&&!c&&!u&&(p!==null||y!==null||k!==null||E!==null),M=T.useRef(null),O=T.useRef(null),j=T.useRef(null),B=T.useRef(null),Y=S=>{var A,D,P,K;S==="hours"&&((A=M.current)==null||A.focus()),S==="minutes"&&((D=O.current)==null||D.focus()),S==="seconds"&&((P=j.current)==null||P.focus()),S==="amPm"&&((K=B.current)==null||K.focus())},V=(S,A)=>{const D={hours:p,minutes:y,seconds:k,amPm:E,[S]:A},P=ss({...D,format:r,withSeconds:o,amPmLabels:s});P.valid?(h.current=!1,S==="hours"&&g(A),S==="minutes"&&b(A),S==="seconds"&&w(A),S==="amPm"&&C(A),t==null||t(P.value)):(h.current=!1,typeof n=="string"&&n!==""&&(t==null||t("")))},F=S=>{h.current=!1;const A=sr({time:S,amPmLabels:s,format:r});g(A.hours),b(A.minutes),w(A.seconds),C(A.amPm),t==null||t(S)},q=S=>{let A=S;r==="12h"&&typeof S=="number"&&S>12&&(A=(S-1)%12+1),g(A),V("hours",A),Y("hours")},G=S=>{b(S),V("minutes",S),Y("minutes")},J=S=>{w(S),V("seconds",S),Y("seconds")},X=S=>{C(S),V("amPm",S),Y("amPm")},W=()=>{h.current=!1,g(null),b(null),w(null),C(null),t==null||t(""),Y("hours")},U=S=>{S.preventDefault();const A=S.clipboardData.getData("text"),D=(d||sr)({time:A,format:r,amPmLabels:s}),P=ss({...D,format:r,withSeconds:o,amPmLabels:s});if(P.valid){h.current=!1;const K=vu(P.value,i||"00:00:00",l||"23:59:59");t==null||t(K.timeString),g(D.hours),b(D.minutes),w(D.seconds),C(D.amPm)}},I=ss({hours:p,minutes:y,seconds:k,format:r,withSeconds:o,amPm:E,amPmLabels:s});return hs(()=>{if(n===""){h.current=!1,g(null),b(null),w(null),C(null),h.current=!0;return}if(h.current&&typeof n=="string"){const S=sr({time:n||"",amPmLabels:s,format:r});g(S.hours),b(S.minutes),w(S.seconds),C(S.amPm)}h.current=!0},[n]),{refs:{hours:M,minutes:O,seconds:j,amPm:B},values:{hours:p,minutes:y,seconds:k,amPm:E},setHours:q,setMinutes:G,setSeconds:J,setAmPm:X,focus:Y,clear:W,onPaste:U,setTimeString:F,isClearable:x,hiddenInputValue:I.value}}var Su={fieldsRoot:"m_7a8f1e6d",fieldsGroup:"m_d6bb0a54",controlsList:"m_b97ecb26",controlsListGroup:"m_31fe42f9",dropdown:"m_9c4817c3",control:"m_154c536b",presetControl:"m_7be09d0c",presetsGroup:"m_7d00001d",presetsGroupLabel:"m_d8d918d7",field:"m_6b43ba88"};const jp={hoursStep:1,minutesStep:1,secondsStep:1,format:"24h",amPmLabels:{am:"AM",pm:"PM"},pasteSplit:sr,maxDropdownContentHeight:200,hoursPlaceholder:"--",minutesPlaceholder:"--",secondsPlaceholder:"--"},Pp=v.createVarsResolver((n,{size:e})=>({dropdown:{"--control-font-size":v.getFontSize(e)}})),cl=v.factory((n,e)=>{const t=v.useProps("TimePicker",jp,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,onClick:c,format:u,value:d,defaultValue:f,onChange:h,hoursStep:p,minutesStep:g,secondsStep:y,withSeconds:b,hoursInputLabel:k,minutesInputLabel:w,secondsInputLabel:E,amPmInputLabel:C,amPmLabels:x,clearable:M,onMouseDown:O,onFocusCapture:j,onBlurCapture:B,min:Y,max:V,popoverProps:F,withDropdown:q,rightSection:G,onFocus:J,onBlur:X,clearButtonProps:W,hoursInputProps:U,minutesInputProps:I,secondsInputProps:S,amPmSelectProps:A,readOnly:D,disabled:P,size:K,name:de,form:N,hiddenInputProps:Q,labelProps:oe,pasteSplit:te,hoursRef:pe,minutesRef:he,secondsRef:ae,amPmRef:se,presets:Oe,maxDropdownContentHeight:ue,scrollAreaProps:ke,attributes:ce,reverseTimeControlsList:Ee,hoursPlaceholder:Dn,minutesPlaceholder:rn,secondsPlaceholder:sn,...on}=t,{resolvedClassNames:ln,resolvedStyles:an}=v.useResolvedStylesApi({classNames:r,styles:i,props:t}),Xe=v.useStyles({name:"TimePicker",classes:Su,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:ce,vars:a,varsResolver:Pp}),z=Ip({value:d,defaultValue:f,onChange:h,format:u,amPmLabels:x,withSeconds:b,min:Y,max:V,clearable:M,disabled:P,readOnly:D,pasteSplit:te}),Qe=rr(z.refs.hours,pe),Ze=rr(z.refs.minutes,he),cn=rr(z.refs.seconds,ae),Nn=rr(z.refs.amPm,se),Pr=xp(),Gn=T.useRef(!1),[Io,It]=T.useState(!1),ft=ne=>{Gn.current||(Gn.current=!0,J==null||J(ne))},jo=ne=>{if(!ne.currentTarget.contains(ne.relatedTarget)){const xe=z.values,ot=ss({...xe,format:u,amPmLabels:x,withSeconds:!!b});if(ot.valid&&(Y||V)){const jt=vu(ot.value,Y,V);jt.timeString!==ot.value&&z.setTimeString(jt.timeString)}Gn.current=!1,X==null||X(ne)}};return m.jsx(Tp,{value:{getStyles:Xe,scrollAreaProps:ke,maxDropdownContentHeight:ue},children:m.jsxs(v.Popover,{opened:Io,transitionProps:{duration:0},position:"bottom-start",withRoles:!1,disabled:P||D||!q,...F,children:[m.jsx(v.Popover.Target,{children:m.jsxs(v.InputBase,{component:"div",size:K,disabled:P,ref:e,onClick:ne=>{c==null||c(ne),z.focus("hours")},onMouseDown:ne=>{ne.preventDefault(),O==null||O(ne)},onFocusCapture:ne=>{It(!0),j==null||j(ne)},onBlurCapture:ne=>{It(!1),B==null||B(ne)},rightSection:G||z.isClearable&&m.jsx(v.CloseButton,{...W,size:K,onClick:ne=>{var xe;z.clear(),(xe=W==null?void 0:W.onClick)==null||xe.call(W,ne)},onMouseDown:ne=>{var xe;ne.preventDefault(),(xe=W==null?void 0:W.onMouseDown)==null||xe.call(W,ne)}}),labelProps:{htmlFor:Pr,...oe},style:o,className:s,classNames:ln,styles:an,__staticSelector:"TimePicker",...on,children:[m.jsx("div",{...Xe("fieldsRoot"),dir:"ltr",children:m.jsxs("div",{...Xe("fieldsGroup"),onBlur:jo,children:[m.jsx(ns,{id:Pr,...U,...Xe("field",{className:U==null?void 0:U.className,style:U==null?void 0:U.style}),value:z.values.hours,onChange:z.setHours,onNextInput:()=>z.focus("minutes"),min:u==="12h"?1:0,max:u==="12h"?12:23,allowTemporaryZero:u==="12h",focusable:!0,step:p,ref:Qe,"aria-label":k,readOnly:D,disabled:P,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=U==null?void 0:U.onFocus)==null||xe.call(U,ne)},onBlur:ne=>{var jt;const xe=ne.currentTarget.value,ot=xe?parseInt(xe,10):null;u==="12h"&&ot===0&&z.setHours(12),(jt=U==null?void 0:U.onBlur)==null||jt.call(U,ne)},placeholder:Dn}),m.jsx("span",{children:":"}),m.jsx(ns,{...I,...Xe("field",{className:I==null?void 0:I.className,style:I==null?void 0:I.style}),value:z.values.minutes,onChange:z.setMinutes,min:0,max:59,focusable:!0,step:g,ref:Ze,onPreviousInput:()=>z.focus("hours"),onNextInput:()=>b?z.focus("seconds"):z.focus("amPm"),"aria-label":w,tabIndex:-1,readOnly:D,disabled:P,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=I==null?void 0:I.onFocus)==null||xe.call(I,ne)},placeholder:rn}),b&&m.jsxs(m.Fragment,{children:[m.jsx("span",{children:":"}),m.jsx(ns,{...S,...Xe("field",{className:S==null?void 0:S.className,style:S==null?void 0:S.style}),value:z.values.seconds,onChange:z.setSeconds,min:0,max:59,focusable:!0,step:y,ref:cn,onPreviousInput:()=>z.focus("minutes"),onNextInput:()=>z.focus("amPm"),"aria-label":E,tabIndex:-1,readOnly:D,disabled:P,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=S==null?void 0:S.onFocus)==null||xe.call(S,ne)},placeholder:sn})]}),u==="12h"&&m.jsx(mu,{...A,inputType:q?"input":"select",labels:x,value:z.values.amPm,onChange:z.setAmPm,ref:Nn,"aria-label":C,onPreviousInput:()=>b?z.focus("seconds"):z.focus("minutes"),readOnly:D,disabled:P,tabIndex:-1,onPaste:z.onPaste,onFocus:ne=>{var xe;ft(ne),(xe=A==null?void 0:A.onFocus)==null||xe.call(A,ne)}})]})}),m.jsx("input",{type:"hidden",name:de,form:N,value:z.hiddenInputValue,...Q})]})}),m.jsx(v.Popover.Dropdown,{...Xe("dropdown"),onMouseDown:ne=>ne.preventDefault(),children:Oe?m.jsx(xu,{value:z.hiddenInputValue,onChange:z.setTimeString,format:u,presets:Oe,amPmLabels:x,withSeconds:b||!1}):m.jsxs("div",{...Xe("controlsListGroup"),children:[m.jsx(rs,{min:u==="12h"?1:0,max:u==="12h"?12:23,step:p,value:z.values.hours,onSelect:z.setHours,reversed:Ee}),m.jsx(rs,{min:0,max:59,step:g,value:z.values.minutes,onSelect:z.setMinutes,reversed:Ee}),b&&m.jsx(rs,{min:0,max:59,step:y,value:z.values.seconds,onSelect:z.setSeconds,reversed:Ee}),u==="12h"&&m.jsx(gu,{labels:x,value:z.values.amPm,onSelect:z.setAmPm})]})})]})})});cl.displayName="@mantine/dates/TimePicker";cl.classes=Su;var Cu={day:"m_396ce5cb"};const _p=v.createVarsResolver((n,{size:e})=>({day:{"--day-size":v.getSize(e,"day-size")}})),ul=v.factory((n,e)=>{const t=v.useProps("Day",null,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:w,static:E,highlightToday:C,attributes:x,...M}=t,O=v.useStyles({name:d||"Day",classes:Cu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:x,vars:a,varsResolver:_p,rootSelector:"day"});return m.jsx(v.UnstyledButton,{...O("day",{style:w?{display:"none"}:void 0}),component:E?"div":"button",ref:e,disabled:u,"data-today":R(c).isSame(new Date,"day")||void 0,"data-hidden":w||void 0,"data-highlight-today":C||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,...M,children:(g==null?void 0:g(c))||R(c).date()})});ul.classes=Cu;ul.displayName="@mantine/dates/Day";function Bp({locale:n,format:e="dd",firstDayOfWeek:t=1}){const r=R().day(t),s=[];for(let o=0;o<7;o+=1)typeof e=="string"?s.push(R(r).add(o,"days").locale(n).format(e)):s.push(e(R(r).add(o,"days").format("YYYY-MM-DD")));return s}var Mu={weekday:"m_18a3eca"};const Fp=v.createVarsResolver((n,{size:e})=>({weekdaysRow:{"--wr-fz":v.getFontSize(e),"--wr-spacing":v.getSpacing(e)}})),dl=v.factory((n,e)=>{const t=v.useProps("WeekdaysRow",null,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,attributes:g,...y}=t,b=v.useStyles({name:h||"WeekdaysRow",classes:Mu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:g,vars:a,varsResolver:Fp,rootSelector:"weekdaysRow"}),k=Rt(),w=Bp({locale:k.getLocale(c),format:d,firstDayOfWeek:k.getFirstDayOfWeek(u)}).map((E,C)=>m.jsx(f,{...b("weekday"),children:E},C));return m.jsxs(v.Box,{component:"tr",ref:e,...b("weekdaysRow"),...y,children:[p&&m.jsx(f,{...b("weekday"),children:"#"}),w]})});dl.classes=Mu;dl.displayName="@mantine/dates/WeekdaysRow";function zp(n,e=1){let t=R(n);if(!t.isValid())return t;const r=e===0?6:e-1;for(;t.day()!==r;)t=t.add(1,"day");return t.format("YYYY-MM-DD")}function $p(n,e=1){let t=R(n);for(;t.day()!==e;)t=t.subtract(1,"day");return t.format("YYYY-MM-DD")}function Vp({month:n,firstDayOfWeek:e=1,consistentWeeks:t}){const r=R(n).subtract(R(n).date()-1,"day"),s=R(r.format("YYYY-M-D")),o=s.format("YYYY-MM-DD"),i=s.add(+s.daysInMonth()-1,"day").format("YYYY-MM-DD"),l=zp(i,e),a=[];let c=R($p(o,e));for(;R(c).isBefore(l,"day");){const u=[];for(let d=0;d<7;d+=1)u.push(c.format("YYYY-MM-DD")),c=c.add(1,"day");a.push(u)}if(t&&a.length<6){const u=a[a.length-1],d=u[u.length-1];let f=R(d).add(1,"day");for(;a.length<6;){const h=[];for(let p=0;p<7;p+=1)h.push(f.format("YYYY-MM-DD")),f=f.add(1,"day");a.push(h)}}return a}function oo(n,e){return R(n).format("YYYY-MM")===R(e).format("YYYY-MM")}function wu(n,e){return e?R(n).isAfter(R(e).subtract(1,"day"),"day"):!0}function Tu(n,e){return e?R(n).isBefore(R(e).add(1,"day"),"day"):!0}function Hp({dates:n,minDate:e,maxDate:t,getDayProps:r,excludeDate:s,hideOutsideDates:o,month:i}){const l=n.flat().filter(u=>{var d;return Tu(u,t)&&wu(u,e)&&!(s!=null&&s(u))&&!((d=r==null?void 0:r(u))!=null&&d.disabled)&&(!o||oo(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=>R().isSame(u,"date"));return c||l[0]}var is={exports:{}},Wp=is.exports,Ta;function Yp(){return Ta||(Ta=1,(function(n,e){(function(t,r){n.exports=r()})(Wp,(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)}}}))})(is)),is.exports}var Up=Yp();const qp=rl(Up);R.extend(qp);function Kp(n){const e=n.find(t=>R(t).day()===1);return R(e).isoWeek()}var Eu={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const Jp={withCellSpacing:!0},Gp=v.createVarsResolver((n,{size:e})=>({weekNumber:{"--wn-fz":v.getFontSize(e),"--wn-size":v.getSize(e,"wn-size")}})),io=v.factory((n,e)=>{const t=v.useProps("Month",Jp,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:w,hideOutsideDates:E,hideWeekdays:C,getDayAriaLabel:x,static:M,__getDayRef:O,__onDayKeyDown:j,__onDayClick:B,__onDayMouseEnter:Y,__preventFocus:V,__stopPropagation:F,withCellSpacing:q,size:G,highlightToday:J,withWeekNumbers:X,attributes:W,...U}=t,I=v.useStyles({name:c||"Month",classes:Eu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:W,vars:a,varsResolver:Gp,rootSelector:"month"}),S=Rt(),A=Vp({month:h,firstDayOfWeek:S.getFirstDayOfWeek(d),consistentWeeks:S.consistentWeeks}),D=Hp({dates:A,minDate:He(b),maxDate:He(k),getDayProps:g,excludeDate:y,hideOutsideDates:E,month:h}),{resolvedClassNames:P,resolvedStyles:K}=v.useResolvedStylesApi({classNames:r,styles:i,props:t}),de=A.map((N,Q)=>{const oe=N.map((te,pe)=>{const he=!oo(te,h),ae=(x==null?void 0:x(te))||R(te).locale(u||S.locale).format("D MMMM YYYY"),se=g==null?void 0:g(te),Oe=R(te).isSame(D,"date");return m.jsx("td",{...I("monthCell"),"data-with-spacing":q||void 0,children:m.jsx(ul,{__staticSelector:c||"Month",classNames:P,styles:K,unstyled:l,"data-mantine-stop-propagation":F||void 0,highlightToday:J,renderDay:w,date:te,size:G,weekend:S.getWeekendDays(p).includes(R(te).get("day")),outside:he,hidden:E?he:!1,"aria-label":ae,static:M,disabled:(y==null?void 0:y(te))||!Tu(te,He(k))||!wu(te,He(b)),ref:ue=>{ue&&(O==null||O(Q,pe,ue))},...se,onKeyDown:ue=>{var ke;(ke=se==null?void 0:se.onKeyDown)==null||ke.call(se,ue),j==null||j(ue,{rowIndex:Q,cellIndex:pe,date:te})},onMouseEnter:ue=>{var ke;(ke=se==null?void 0:se.onMouseEnter)==null||ke.call(se,ue),Y==null||Y(ue,te)},onClick:ue=>{var ke;(ke=se==null?void 0:se.onClick)==null||ke.call(se,ue),B==null||B(ue,te)},onMouseDown:ue=>{var ke;(ke=se==null?void 0:se.onMouseDown)==null||ke.call(se,ue),V&&ue.preventDefault()},tabIndex:V||!Oe?-1:0})},te.toString())});return m.jsxs("tr",{...I("monthRow"),children:[X&&m.jsx("td",{...I("weekNumber"),children:Kp(N)}),oe]},Q)});return m.jsxs(v.Box,{component:"table",...I("month"),size:G,ref:e,...U,children:[!C&&m.jsx("thead",{...I("monthThead"),children:m.jsx(dl,{__staticSelector:c||"Month",locale:u,firstDayOfWeek:d,weekdayFormat:f,size:G,classNames:P,styles:K,unstyled:l,withWeekNumbers:X})}),m.jsx("tbody",{...I("monthTbody"),children:de})]})});io.classes=Eu;io.displayName="@mantine/dates/Month";var Au={pickerControl:"m_dc6a3c71"};const Xp=v.createVarsResolver((n,{size:e})=>({pickerControl:{"--dpc-fz":v.getFontSize(e),"--dpc-size":v.getSize(e,"dpc-size")}})),lo=v.factory((n,e)=>{const t=v.useProps("PickerControl",null,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,attributes:g,...y}=t,b=v.useStyles({name:f||"PickerControl",classes:Au,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:g,vars:a,varsResolver:Xp,rootSelector:"pickerControl"});return m.jsx(v.UnstyledButton,{...b("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,...y})});lo.classes=Au;lo.displayName="@mantine/dates/PickerControl";function Ou({year:n,minDate:e,maxDate:t}){return!e&&!t?!1:!!(e&&R(n).isBefore(e,"year")||t&&R(n).isAfter(t,"year"))}function Qp({years:n,minDate:e,maxDate:t,getYearControlProps:r}){const s=n.flat().filter(l=>{var a;return!Ou({year:l,minDate:e,maxDate: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=>R().isSame(l,"year"));return i||s[0]}function Du(n){const e=R(n).year(),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(R(new Date(t+r,0)).format("YYYY-MM-DD")),r+=1}return s}var Nu={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const Zp={yearsListFormat:"YYYY",withCellSpacing:!0},ao=v.factory((n,e)=>{const t=v.useProps("YearsList",Zp,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:w,__preventFocus:E,__stopPropagation:C,withCellSpacing:x,size:M,attributes:O,...j}=t,B=v.useStyles({name:g||"YearsList",classes:Nu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:O,vars:a,rootSelector:"yearsList"}),Y=Rt(),V=Du(c),F=Qp({years:V,minDate:f,maxDate:h,getYearControlProps:p}),q=V.map((G,J)=>{const X=G.map((W,U)=>{const I=p==null?void 0:p(W),S=R(W).isSame(F,"year");return m.jsx("td",{...B("yearsListCell"),"data-with-spacing":x||void 0,children:m.jsx(lo,{...B("yearsListControl"),size:M,unstyled:l,"data-mantine-stop-propagation":C||void 0,disabled:Ou({year:W,minDate:f,maxDate:h}),ref:A=>{A&&(y==null||y(J,U,A))},...I,onKeyDown:A=>{var D;(D=I==null?void 0:I.onKeyDown)==null||D.call(I,A),b==null||b(A,{rowIndex:J,cellIndex:U,date:W})},onClick:A=>{var D;(D=I==null?void 0:I.onClick)==null||D.call(I,A),k==null||k(A,W)},onMouseEnter:A=>{var D;(D=I==null?void 0:I.onMouseEnter)==null||D.call(I,A),w==null||w(A,W)},onMouseDown:A=>{var D;(D=I==null?void 0:I.onMouseDown)==null||D.call(I,A),E&&A.preventDefault()},tabIndex:E||!S?-1:0,children:R(W).locale(Y.getLocale(d)).format(u)})},U)});return m.jsx("tr",{...B("yearsListRow"),children:X},J)});return m.jsx(v.Box,{component:"table",ref:e,size:M,...B("yearsList"),...j,children:m.jsx("tbody",{children:q})})});ao.classes=Nu;ao.displayName="@mantine/dates/YearsList";function Ru({month:n,minDate:e,maxDate:t}){return!e&&!t?!1:!!(e&&R(n).isBefore(e,"month")||t&&R(n).isAfter(t,"month"))}function em({months:n,minDate:e,maxDate:t,getMonthControlProps:r}){const s=n.flat().filter(l=>{var a;return!Ru({month:l,minDate:e,maxDate: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=>R().isSame(l,"month"));return i||s[0]}function tm(n){const e=R(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(R(e).add(r,"months").format("YYYY-MM-DD")),r+=1;return t}var Lu={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const nm={monthsListFormat:"MMM",withCellSpacing:!0},co=v.factory((n,e)=>{const t=v.useProps("MonthsList",nm,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:w,__preventFocus:E,__stopPropagation:C,withCellSpacing:x,size:M,attributes:O,...j}=t,B=v.useStyles({name:c||"MonthsList",classes:Lu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:O,vars:a,rootSelector:"monthsList"}),Y=Rt(),V=tm(u),F=em({months:V,minDate:He(h),maxDate:He(p),getMonthControlProps:g}),q=V.map((G,J)=>{const X=G.map((W,U)=>{const I=g==null?void 0:g(W),S=R(W).isSame(F,"month");return m.jsx("td",{...B("monthsListCell"),"data-with-spacing":x||void 0,children:m.jsx(lo,{...B("monthsListControl"),size:M,unstyled:l,__staticSelector:c||"MonthsList","data-mantine-stop-propagation":C||void 0,disabled:Ru({month:W,minDate:He(h),maxDate:He(p)}),ref:A=>{A&&(y==null||y(J,U,A))},...I,onKeyDown:A=>{var D;(D=I==null?void 0:I.onKeyDown)==null||D.call(I,A),b==null||b(A,{rowIndex:J,cellIndex:U,date:W})},onClick:A=>{var D;(D=I==null?void 0:I.onClick)==null||D.call(I,A),k==null||k(A,W)},onMouseEnter:A=>{var D;(D=I==null?void 0:I.onMouseEnter)==null||D.call(I,A),w==null||w(A,W)},onMouseDown:A=>{var D;(D=I==null?void 0:I.onMouseDown)==null||D.call(I,A),E&&A.preventDefault()},tabIndex:E||!S?-1:0,children:R(W).locale(Y.getLocale(f)).format(d)})},U)});return m.jsx("tr",{...B("monthsListRow"),children:X},J)});return m.jsx(v.Box,{component:"table",ref:e,size:M,...B("monthsList"),...j,children:m.jsx("tbody",{children:q})})});co.classes=Lu;co.displayName="@mantine/dates/MonthsList";var Iu={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const rm={hasNextLevel:!0,withNext:!0,withPrevious:!0,headerControlsOrder:["previous","level","next"]},sm=v.createVarsResolver((n,{size:e})=>({calendarHeader:{"--dch-control-size":v.getSize(e,"dch-control-size"),"--dch-fz":v.getFontSize(e)}})),Zt=v.factory((n,e)=>{const t=v.useProps("CalendarHeader",rm,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:w,levelControlAriaLabel:E,withNext:C,withPrevious:x,headerControlsOrder:M,__staticSelector:O,__preventFocus:j,__stopPropagation:B,attributes:Y,...V}=t,F=v.useStyles({name:O||"CalendarHeader",classes:Iu,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:Y,vars:a,varsResolver:sm,rootSelector:"calendarHeader"}),q=j?U=>U.preventDefault():void 0,G=x&&T.createElement(v.UnstyledButton,{...F("calendarHeaderControl"),key:"previous","data-direction":"previous","aria-label":f,onClick:p,unstyled:l,onMouseDown:q,disabled:k,"data-disabled":k||void 0,tabIndex:j||k?-1:0,"data-mantine-stop-propagation":B||void 0},u||m.jsx(v.AccordionChevron,{...F("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})),J=T.createElement(v.UnstyledButton,{component:w?"button":"div",...F("calendarHeaderLevel"),key:"level",onClick:w?g:void 0,unstyled:l,onMouseDown:w?q:void 0,disabled:!w,"data-static":!w||void 0,"aria-label":E,tabIndex:j||!w?-1:0,"data-mantine-stop-propagation":B||void 0},y),X=C&&T.createElement(v.UnstyledButton,{...F("calendarHeaderControl"),key:"next","data-direction":"next","aria-label":d,onClick:h,unstyled:l,onMouseDown:q,disabled:b,"data-disabled":b||void 0,tabIndex:j||b?-1:0,"data-mantine-stop-propagation":B||void 0},c||m.jsx(v.AccordionChevron,{...F("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})),W=M.map(U=>U==="previous"?G:U==="level"?J:U==="next"?X:null);return m.jsx(v.Box,{...F("calendarHeader"),ref:e,...V,children:W})});Zt.classes=Iu;Zt.displayName="@mantine/dates/CalendarHeader";function om(n){const e=Du(n);return[e[0][0],e[3][0]]}const im={decadeLabelFormat:"YYYY"},uo=v.factory((n,e)=>{const t=v.useProps("DecadeLevel",im,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:w,onPrevious:E,nextDisabled:C,previousDisabled:x,levelControlAriaLabel:M,withNext:O,withPrevious:j,headerControlsOrder:B,decadeLabelFormat:Y,classNames:V,styles:F,unstyled:q,__staticSelector:G,__stopPropagation:J,size:X,attributes:W,...U}=t,I=Rt(),[S,A]=om(r),D={__staticSelector:G||"DecadeLevel",classNames:V,styles:F,unstyled:q,size:X,attributes:W},P=typeof C=="boolean"?C:i?!R(A).endOf("year").isBefore(i):!1,K=typeof x=="boolean"?x:o?!R(S).startOf("year").isAfter(o):!1,de=(N,Q)=>R(N).locale(s||I.locale).format(Q);return m.jsxs(v.Box,{"data-decade-level":!0,size:X,ref:e,...U,children:[m.jsx(Zt,{label:typeof Y=="function"?Y(S,A):`${de(S,Y)} – ${de(A,Y)}`,__preventFocus:p,__stopPropagation:J,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:w,onPrevious:E,nextDisabled:P,previousDisabled:K,hasNextLevel:!1,levelControlAriaLabel:M,withNext:O,withPrevious:j,headerControlsOrder:B,...D}),m.jsx(ao,{decade:r,locale:s,minDate:o,maxDate:i,yearsListFormat:l,getYearControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:p,__stopPropagation:J,withCellSpacing:h,...D})]})});uo.classes={...ao.classes,...Zt.classes};uo.displayName="@mantine/dates/DecadeLevel";const lm={yearLabelFormat:"YYYY"},fo=v.factory((n,e)=>{const t=v.useProps("YearLevel",lm,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:w,onPrevious:E,onLevelClick:C,nextDisabled:x,previousDisabled:M,hasNextLevel:O,levelControlAriaLabel:j,withNext:B,withPrevious:Y,headerControlsOrder:V,yearLabelFormat:F,__staticSelector:q,__stopPropagation:G,size:J,classNames:X,styles:W,unstyled:U,attributes:I,...S}=t,A=Rt(),D={__staticSelector:q||"YearLevel",classNames:X,styles:W,unstyled:U,size:J,attributes:I},P=typeof x=="boolean"?x:i?!R(r).endOf("year").isBefore(i):!1,K=typeof M=="boolean"?M:o?!R(r).startOf("year").isAfter(o):!1;return m.jsxs(v.Box,{"data-year-level":!0,size:J,ref:e,...S,children:[m.jsx(Zt,{label:typeof F=="function"?F(r):R(r).locale(s||A.locale).format(F),__preventFocus:p,__stopPropagation:G,nextIcon:g,previousIcon:y,nextLabel:b,previousLabel:k,onNext:w,onPrevious:E,onLevelClick:C,nextDisabled:P,previousDisabled:K,hasNextLevel:O,levelControlAriaLabel:j,withNext:B,withPrevious:Y,headerControlsOrder:V,...D}),m.jsx(co,{year:r,locale:s,minDate:o,maxDate:i,monthsListFormat:l,getMonthControlProps:a,__getControlRef:c,__onControlKeyDown:u,__onControlClick:d,__onControlMouseEnter:f,__preventFocus:p,__stopPropagation:G,withCellSpacing:h,...D})]})});fo.classes={...Zt.classes,...co.classes};fo.displayName="@mantine/dates/YearLevel";const am={monthLabelFormat:"MMMM YYYY"},ho=v.factory((n,e)=>{const t=v.useProps("MonthLevel",am,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:w,withCellSpacing:E,highlightToday:C,withWeekNumbers:x,__preventFocus:M,__stopPropagation:O,nextIcon:j,previousIcon:B,nextLabel:Y,previousLabel:V,onNext:F,onPrevious:q,onLevelClick:G,nextDisabled:J,previousDisabled:X,hasNextLevel:W,levelControlAriaLabel:U,withNext:I,withPrevious:S,headerControlsOrder:A,monthLabelFormat:D,classNames:P,styles:K,unstyled:de,__staticSelector:N,size:Q,static:oe,attributes:te,...pe}=t,he=Rt(),ae={__staticSelector:N||"MonthLevel",classNames:P,styles:K,unstyled:de,size:Q,attributes:te},se=typeof J=="boolean"?J:d?!R(r).endOf("month").isBefore(d):!1,Oe=typeof X=="boolean"?X:u?!R(r).startOf("month").isAfter(u):!1;return m.jsxs(v.Box,{"data-month-level":!0,size:Q,ref:e,...pe,children:[m.jsx(Zt,{label:typeof D=="function"?D(r):R(r).locale(s||he.locale).format(D),__preventFocus:M,__stopPropagation:O,nextIcon:j,previousIcon:B,nextLabel:Y,previousLabel:V,onNext:F,onPrevious:q,onLevelClick:G,nextDisabled:se,previousDisabled:Oe,hasNextLevel:W,levelControlAriaLabel:U,withNext:I,withPrevious:S,headerControlsOrder:A,...ae}),m.jsx(io,{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:w,__preventFocus:M,__stopPropagation:O,static:oe,withCellSpacing:E,highlightToday:C,withWeekNumbers:x,...ae})]})});ho.classes={...io.classes,...Zt.classes};ho.displayName="@mantine/dates/MonthLevel";var ju={levelsGroup:"m_30b26e33"};const en=v.factory((n,e)=>{const t=v.useProps("LevelsGroup",null,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,__staticSelector:c,attributes:u,...d}=t,f=v.useStyles({name:c||"LevelsGroup",classes:ju,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:u,vars:a,rootSelector:"levelsGroup"});return m.jsx(v.Box,{ref:e,...f("levelsGroup"),...d})});en.classes=ju;en.displayName="@mantine/dates/LevelsGroup";const cm={numberOfColumns:1},po=v.factory((n,e)=>{const t=v.useProps("DecadeLevelGroup",cm,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:w,previousDisabled:E,headerControlsOrder:C,classNames:x,styles:M,unstyled:O,__staticSelector:j,__stopPropagation:B,numberOfColumns:Y,levelControlAriaLabel:V,decadeLabelFormat:F,size:q,vars:G,attributes:J,...X}=t,W=T.useRef([]),U=Array(Y).fill(0).map((I,S)=>{const A=R(r).add(S*10,"years").format("YYYY-MM-DD");return m.jsx(uo,{size:q,yearsListFormat:l,decade:A,withNext:S===Y-1,withPrevious:S===0,decadeLabelFormat:F,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(D,P)=>sl({levelIndex:S,rowIndex:P.rowIndex,cellIndex:P.cellIndex,event:D,controlsRef:W}),__getControlRef:(D,P,K)=>{Array.isArray(W.current[S])||(W.current[S]=[]),Array.isArray(W.current[S][D])||(W.current[S][D]=[]),W.current[S][D][P]=K},levelControlAriaLabel:typeof V=="function"?V(A):V,locale:s,minDate:o,maxDate:i,__preventFocus:f,__stopPropagation:B,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,nextDisabled:w,previousDisabled:E,getYearControlProps:a,__staticSelector:j||"DecadeLevelGroup",classNames:x,styles:M,unstyled:O,withCellSpacing:d,headerControlsOrder:C,attributes:J},S)});return m.jsx(en,{classNames:x,styles:M,__staticSelector:j||"DecadeLevelGroup",ref:e,size:q,unstyled:O,attributes:J,...X,children:U})});po.classes={...en.classes,...uo.classes};po.displayName="@mantine/dates/DecadeLevelGroup";const um={numberOfColumns:1},mo=v.factory((n,e)=>{const t=v.useProps("YearLevelGroup",um,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:w,nextDisabled:E,previousDisabled:C,hasNextLevel:x,headerControlsOrder:M,classNames:O,styles:j,unstyled:B,__staticSelector:Y,__stopPropagation:V,numberOfColumns:F,levelControlAriaLabel:q,yearLabelFormat:G,size:J,vars:X,attributes:W,...U}=t,I=T.useRef([]),S=Array(F).fill(0).map((A,D)=>{const P=R(r).add(D,"years").format("YYYY-MM-DD");return m.jsx(fo,{size:J,monthsListFormat:l,year:P,withNext:D===F-1,withPrevious:D===0,yearLabelFormat:G,__stopPropagation:V,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(K,de)=>sl({levelIndex:D,rowIndex:de.rowIndex,cellIndex:de.cellIndex,event:K,controlsRef:I}),__getControlRef:(K,de,N)=>{Array.isArray(I.current[D])||(I.current[D]=[]),Array.isArray(I.current[D][K])||(I.current[D][K]=[]),I.current[D][K][de]=N},levelControlAriaLabel:typeof q=="function"?q(P):q,locale:s,minDate:o,maxDate:i,__preventFocus:f,nextIcon:h,previousIcon:p,nextLabel:g,previousLabel:y,onNext:b,onPrevious:k,onLevelClick:w,nextDisabled:E,previousDisabled:C,hasNextLevel:x,getMonthControlProps:a,classNames:O,styles:j,unstyled:B,__staticSelector:Y||"YearLevelGroup",withCellSpacing:d,headerControlsOrder:M,attributes:W},D)});return m.jsx(en,{classNames:O,styles:j,__staticSelector:Y||"YearLevelGroup",ref:e,size:J,unstyled:B,attributes:W,...U,children:S})});mo.classes={...fo.classes,...en.classes};mo.displayName="@mantine/dates/YearLevelGroup";const dm={numberOfColumns:1},go=v.factory((n,e)=>{const t=v.useProps("MonthLevelGroup",dm,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:w,withWeekNumbers:E,__preventFocus:C,nextIcon:x,previousIcon:M,nextLabel:O,previousLabel:j,onNext:B,onPrevious:Y,onLevelClick:V,nextDisabled:F,previousDisabled:q,hasNextLevel:G,headerControlsOrder:J,classNames:X,styles:W,unstyled:U,numberOfColumns:I,levelControlAriaLabel:S,monthLabelFormat:A,__staticSelector:D,__stopPropagation:P,size:K,static:de,vars:N,attributes:Q,...oe}=t,te=T.useRef([]),pe=Array(I).fill(0).map((he,ae)=>{const se=R(r).add(ae,"months").format("YYYY-MM-DD");return m.jsx(ho,{month:se,withNext:ae===I-1,withPrevious:ae===0,monthLabelFormat:A,__stopPropagation:P,__onDayClick:y,__onDayMouseEnter:b,__onDayKeyDown:(Oe,ue)=>sl({levelIndex:ae,rowIndex:ue.rowIndex,cellIndex:ue.cellIndex,event:Oe,controlsRef:te}),__getDayRef:(Oe,ue,ke)=>{Array.isArray(te.current[ae])||(te.current[ae]=[]),Array.isArray(te.current[ae][Oe])||(te.current[ae][Oe]=[]),te.current[ae][Oe][ue]=ke},levelControlAriaLabel:typeof S=="function"?S(se):S,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:C,nextIcon:x,previousIcon:M,nextLabel:O,previousLabel:j,onNext:B,onPrevious:Y,onLevelClick:V,nextDisabled:F,previousDisabled:q,hasNextLevel:G,classNames:X,styles:W,unstyled:U,__staticSelector:D||"MonthLevelGroup",size:K,static:de,withCellSpacing:k,highlightToday:w,withWeekNumbers:E,headerControlsOrder:J,attributes:Q},ae)});return m.jsx(en,{classNames:X,styles:W,__staticSelector:D||"MonthLevelGroup",ref:e,size:K,attributes:Q,...oe,children:pe})});go.classes={...en.classes,...ho.classes};go.displayName="@mantine/dates/MonthLevelGroup";var Pu={input:"m_6fa5e2aa"};const yo=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:w,shouldClear:E,readOnly:C,disabled:x,value:M,name:O,form:j,type:B,onDropdownClose:Y,withTime:V,...F}=v.useInputProps("PickerInputBase",{size:"sm"},n),q=m.jsx(v.Input.ClearButton,{onClick:b,unstyled:l,...k}),G=()=>{B==="range"&&Array.isArray(M)&&M[0]&&!M[1]&&b(),h.close()};return m.jsxs(m.Fragment,{children:[u==="modal"&&!C&&m.jsx(v.Modal,{opened:p,onClose:G,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,onClose:Y,...a,disabled:(a==null?void 0:a.disabled)||u==="modal"||C,onChange:J=>{var X;J||((X=a==null?void 0:a.onClose)==null||X.call(a),G())},children:[m.jsx(v.Popover.Target,{children:m.jsx(v.Input,{"data-dates-input":!0,"data-read-only":C||void 0,disabled:x,component:"button",type:"button",multiline:!0,onClick:J=>{g==null||g(J),h.toggle()},__clearSection:q,__clearable:y&&E&&!C&&!x,rightSection:w,...t,ref:e,classNames:{...o,input:hu(Pu.input,o==null?void 0:o.input)},...F,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(ol,{value:M,name:O,form:j,type:B,withTime:V})]})});yo.classes=Pu;yo.displayName="@mantine/dates/PickerInputBase";const Ea=n=>n==="range"?[null,null]:n==="multiple"?[]:null,Aa=(n,e)=>{const t=e?Fn:He;return Array.isArray(n)?n.map(t):t(n)};function kr({type:n,value:e,defaultValue:t,onChange:r,withTime:s=!1}){const o=T.useRef(n),[i,l,a]=pu({value:Aa(e,s),defaultValue:Aa(t,s),finalValue:Ea(n),onChange:r});let c=i;return o.current!==n&&(o.current=n,e===void 0&&(c=t!==void 0?t:Ea(n),l(c))),[c,l,a]}function Ho(n,e){return n?n==="month"?0:n==="year"?1:2:e||0}function fm(n){return n===0?"month":n===1?"year":"decade"}function er(n,e,t){return fm(ts(Ho(n,0),Ho(e,0),Ho(t,2)))}const hm={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0,enableKeyboardNavigation:!0},Kn=v.factory((n,e)=>{const t=v.useProps("Calendar",hm,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:w,onMonthMouseEnter:E,headerControlsOrder:C,__updateDateOnYearSelect:x,__updateDateOnMonthSelect:M,__setDateRef:O,__setLevelRef:j,firstDayOfWeek:B,weekdayFormat:Y,weekendDays:V,getDayProps:F,excludeDate:q,renderDay:G,hideOutsideDates:J,hideWeekdays:X,getDayAriaLabel:W,monthLabelFormat:U,nextIcon:I,previousIcon:S,__onDayClick:A,__onDayMouseEnter:D,withCellSpacing:P,highlightToday:K,withWeekNumbers:de,monthsListFormat:N,getMonthControlProps:Q,yearLabelFormat:oe,yearsListFormat:te,getYearControlProps:pe,decadeLabelFormat:he,classNames:ae,styles:se,unstyled:Oe,minDate:ue,maxDate:ke,locale:ce,__staticSelector:Ee,size:Dn,__preventFocus:rn,__stopPropagation:sn,onNextDecade:on,onPreviousDecade:ln,onNextYear:an,onPreviousYear:Xe,onNextMonth:z,onPreviousMonth:Qe,static:Ze,enableKeyboardNavigation:cn,attributes:Nn,...Pr}=t,{resolvedClassNames:Gn,resolvedStyles:Io}=v.useResolvedStylesApi({classNames:ae,styles:se,props:t}),[It,ft]=pu({value:l?er(l,o,s):void 0,defaultValue:i?er(i,o,s):void 0,finalValue:er(void 0,o,s),onChange:a}),[jo,ne]=kr({type:"default",value:He(c),defaultValue:He(u),onChange:d});T.useImperativeHandle(O,()=>ge=>{ne(ge)}),T.useImperativeHandle(j,()=>ge=>{ft(ge)});const xe={__staticSelector:Ee||"Calendar",styles:Io,classNames:Gn,unstyled:Oe,size:Dn,attributes:Nn},ot=h||f||1,jt=new Date,Mh=ue&&R(jt).isAfter(ue)?ue:R(jt).format("YYYY-MM-DD"),Ct=jo||Mh,wh=()=>{const ge=R(Ct).add(ot,"month").format("YYYY-MM-DD");z==null||z(ge),ne(ge)},Th=()=>{const ge=R(Ct).subtract(ot,"month").format("YYYY-MM-DD");Qe==null||Qe(ge),ne(ge)},Po=()=>{const ge=R(Ct).add(ot,"year").format("YYYY-MM-DD");an==null||an(ge),ne(ge)},_o=()=>{const ge=R(Ct).subtract(ot,"year").format("YYYY-MM-DD");Xe==null||Xe(ge),ne(ge)},Bo=()=>{const ge=R(Ct).add(10*ot,"year").format("YYYY-MM-DD");on==null||on(ge),ne(ge)},Fo=()=>{const ge=R(Ct).subtract(10*ot,"year").format("YYYY-MM-DD");ln==null||ln(ge),ne(ge)},ua=T.useRef(null);T.useEffect(()=>{if(!cn||Ze)return;const ge=Ue=>{var fa;if(!((fa=ua.current)!=null&&fa.contains(document.activeElement)))return;const _r=Ue.ctrlKey||Ue.metaKey,da=Ue.shiftKey;switch(Ue.key){case"ArrowUp":_r&&da?(Ue.preventDefault(),Fo()):_r&&(Ue.preventDefault(),_o());break;case"ArrowDown":_r&&da?(Ue.preventDefault(),Bo()):_r&&(Ue.preventDefault(),Po());break;case"y":case"Y":It==="month"&&(Ue.preventDefault(),ft("year"));break}};return document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)}},[cn,Ze,It,Po,_o,Bo,Fo]);const Eh=ge=>{ua.current=ge,typeof e=="function"?e(ge):e&&(e.current=ge)};return m.jsxs(v.Box,{ref:Eh,size:Dn,"data-calendar":!0,...Pr,children:[It==="month"&&m.jsx(go,{month:Ct,minDate:ue,maxDate:ke,firstDayOfWeek:B,weekdayFormat:Y,weekendDays:V,getDayProps:F,excludeDate:q,renderDay:G,hideOutsideDates:J,hideWeekdays:X,getDayAriaLabel:W,onNext:wh,onPrevious:Th,hasNextLevel:s!=="month",onLevelClick:()=>ft("year"),numberOfColumns:f,locale:ce,levelControlAriaLabel:p==null?void 0:p.monthLevelControl,nextLabel:(p==null?void 0:p.nextMonth)??g,nextIcon:I,previousLabel:(p==null?void 0:p.previousMonth)??y,previousIcon:S,monthLabelFormat:U,__onDayClick:A,__onDayMouseEnter:D,__preventFocus:rn,__stopPropagation:sn,static:Ze,withCellSpacing:P,highlightToday:K,withWeekNumbers:de,headerControlsOrder:C,...xe}),It==="year"&&m.jsx(mo,{year:Ct,numberOfColumns:f,minDate:ue,maxDate:ke,monthsListFormat:N,getMonthControlProps:Q,locale:ce,onNext:Po,onPrevious:_o,hasNextLevel:s!=="month"&&s!=="year",onLevelClick:()=>ft("decade"),levelControlAriaLabel:p==null?void 0:p.yearLevelControl,nextLabel:(p==null?void 0:p.nextYear)??g,nextIcon:I,previousLabel:(p==null?void 0:p.previousYear)??y,previousIcon:S,yearLabelFormat:oe,__onControlMouseEnter:E,__onControlClick:(ge,Ue)=>{M&&ne(Ue),ft(er("month",o,s)),k==null||k(Ue)},__preventFocus:rn,__stopPropagation:sn,withCellSpacing:P,headerControlsOrder:C,...xe}),It==="decade"&&m.jsx(po,{decade:Ct,minDate:ue,maxDate:ke,yearsListFormat:te,getYearControlProps:pe,locale:ce,onNext:Bo,onPrevious:Fo,numberOfColumns:f,nextLabel:(p==null?void 0:p.nextDecade)??g,nextIcon:I,previousLabel:(p==null?void 0:p.previousDecade)??y,previousIcon:S,decadeLabelFormat:he,__onControlMouseEnter:w,__onControlClick:(ge,Ue)=>{x&&ne(Ue),ft(er("year",o,s)),b==null||b(Ue)},__preventFocus:rn,__stopPropagation:sn,withCellSpacing:P,headerControlsOrder:C,...xe})]})});Kn.classes={...po.classes,...mo.classes,...go.classes};Kn.displayName="@mantine/dates/Calendar";function fl(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:w,onNextMonth:E,onPreviousMonth:C,onNextYear:x,onPreviousYear:M,onNextDecade:O,onPreviousDecade:j,withCellSpacing:B,highlightToday:Y,__updateDateOnYearSelect:V,__updateDateOnMonthSelect:F,__setDateRef:q,__setLevelRef:G,withWeekNumbers:J,headerControlsOrder:X,firstDayOfWeek:W,weekdayFormat:U,weekendDays:I,getDayProps:S,excludeDate:A,renderDay:D,hideOutsideDates:P,hideWeekdays:K,getDayAriaLabel:de,monthLabelFormat:N,monthsListFormat:Q,getMonthControlProps:oe,yearLabelFormat:te,yearsListFormat:pe,getYearControlProps:he,decadeLabelFormat:ae,allowSingleDateInRange:se,allowDeselect:Oe,minDate:ue,maxDate:ke,locale:ce,...Ee}=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:w,onNextMonth:E,onPreviousMonth:C,onNextYear:x,onPreviousYear:M,onNextDecade:O,onPreviousDecade:j,withCellSpacing:B,highlightToday:Y,__updateDateOnYearSelect:V,__updateDateOnMonthSelect:F,__setDateRef:q,withWeekNumbers:J,headerControlsOrder:X,firstDayOfWeek:W,weekdayFormat:U,weekendDays:I,getDayProps:S,excludeDate:A,renderDay:D,hideOutsideDates:P,hideWeekdays:K,getDayAriaLabel:de,monthLabelFormat:N,monthsListFormat:Q,getMonthControlProps:oe,yearLabelFormat:te,yearsListFormat:pe,getYearControlProps:he,decadeLabelFormat:ae,allowSingleDateInRange:se,allowDeselect:Oe,minDate:ue,maxDate:ke,locale:ce},others:Ee}}function Oa(n,e){const t=[...e].sort((r,s)=>R(r).isAfter(R(s))?1:-1);return R(t[0]).startOf("day").subtract(1,"ms").isBefore(n)&&R(t[1]).endOf("day").add(1,"ms").isAfter(n)}function pm({type:n,level:e,value:t,defaultValue:r,onChange:s,allowSingleDateInRange:o,allowDeselect:i,onMouseLeave:l}){const[a,c]=kr({type:n,value:t,defaultValue:r,onChange:s}),[u,d]=T.useState(n==="range"&&a[0]&&!a[1]?a[0]:null),[f,h]=T.useState(null),p=C=>{if(n==="range"){if(u&&!a[1]){if(R(C).isSame(u,e)&&!o){d(null),h(null),c([null,null]);return}const x=[C,u];x.sort((M,O)=>R(M).isAfter(R(O))?1:-1),c(x),h(null),d(null);return}if(a[0]&&!a[1]&&R(C).isSame(a[0],e)&&!o){d(null),h(null),c([null,null]);return}c([C,null]),h(null),d(C);return}if(n==="multiple"){a.some(x=>R(x).isSame(C,e))?c(a.filter(x=>!R(x).isSame(C,e))):c([...a,C]);return}a&&i&&R(C).isSame(a,e)?c(null):c(C)},g=C=>u&&f?Oa(C,[f,u]):a[0]&&a[1]?Oa(C,a):!1,y=n==="range"?C=>{l==null||l(C),h(null)}:l,b=C=>a[0]&&R(C).isSame(a[0],e)?!(f&&R(f).isBefore(a[0])):!1,k=C=>a[1]?R(C).isSame(a[1],e):!a[0]||!f?!1:R(f).isBefore(a[0])&&R(C).isSame(a[0],e),w=C=>{if(n==="range")return{selected:a.some(M=>M&&R(M).isSame(C,e)),inRange:g(C),firstInRange:b(C),lastInRange:k(C),"data-autofocus":!!a[0]&&R(a[0]).isSame(C,e)||void 0};if(n==="multiple")return{selected:a.some(M=>M&&R(M).isSame(C,e)),"data-autofocus":!!a[0]&&R(a[0]).isSame(C,e)||void 0};const x=R(a).isSame(C,e);return{selected:x,"data-autofocus":x||void 0}},E=n==="range"&&u?h:()=>{};return T.useEffect(()=>{if(n==="range")if(a[0]&&!a[1])d(a[0]);else{const C=a[0]==null&&a[1]==null,x=a[0]!=null&&a[1]!=null;(C||x)&&(d(null),h(null))}},[a]),{onDateChange:p,onRootMouseLeave:y,onHoveredDateChange:E,getControlProps:w,_value:a,setValue:c}}var mm={datePickerRoot:"m_765a40cf",presetsList:"m_d6a681e1",presetButton:"m_acd30b22"};const gm=v.createVarsResolver((n,{size:e})=>({datePickerRoot:{"--preset-font-size":v.getFontSize(e)}})),ym={type:"default",defaultLevel:"month",numberOfColumns:1,size:"sm"},bo=v.factory((n,e)=>{const t=v.useProps("DatePicker",ym,n),{allowDeselect:r,allowSingleDateInRange:s,value:o,defaultValue:i,onChange:l,onMouseLeave:a,classNames:c,styles:u,__staticSelector:d,__onDayClick:f,__onDayMouseEnter:h,__onPresetSelect:p,__stopPropagation:g,presets:y,className:b,style:k,unstyled:w,size:E,vars:C,attributes:x,...M}=t,{calendarProps:O,others:j}=fl(M),B=T.useRef(null),Y=T.useRef(null),V=v.useStyles({name:d||"DatePicker",classes:mm,props:t,className:b,style:k,classNames:c,styles:u,unstyled:w,attributes:x,rootSelector:y?"datePickerRoot":void 0,varsResolver:gm,vars:C}),{onDateChange:F,onRootMouseLeave:q,onHoveredDateChange:G,getControlProps:J,_value:X,setValue:W}=pm({type:j.type,level:"day",allowDeselect:r,allowSingleDateInRange:s,value:o,defaultValue:i,onChange:l,onMouseLeave:a}),{resolvedClassNames:U,resolvedStyles:I}=v.useResolvedStylesApi({classNames:c,styles:u,props:t}),S=m.jsx(Kn,{ref:e,classNames:U,styles:I,__staticSelector:d||"DatePicker",onMouseLeave:q,size:E,...O,...y?{}:j,__stopPropagation:g,__setDateRef:B,__setLevelRef:Y,minLevel:O.minLevel||"month",__onDayMouseEnter:(P,K)=>{G(K),h==null||h(P,K)},__onDayClick:(P,K)=>{F(K),f==null||f(P,K)},getDayProps:P=>{var K;return{...J(P),...(K=O.getDayProps)==null?void 0:K.call(O,P)}},getMonthControlProps:P=>{var K;return{selected:typeof X=="string"?oo(P,X):!1,...(K=O.getMonthControlProps)==null?void 0:K.call(O,P)}},getYearControlProps:P=>{var K;return{selected:typeof X=="string"?R(P).isSame(X,"year"):!1,...(K=O.getYearControlProps)==null?void 0:K.call(O,P)}},hideOutsideDates:O.hideOutsideDates??O.numberOfColumns!==1,...y?{}:{className:b,style:k,attributes:x}});if(!y)return S;const A=P=>{var de,N;const K=Array.isArray(P)?P[0]:P;K!==void 0&&((de=B.current)==null||de.call(B,K),(N=Y.current)==null||N.call(Y,"month"),p?p(K):W(P))},D=y.map((P,K)=>m.jsx(v.UnstyledButton,{...V("presetButton"),onClick:()=>A(P.value),onMouseDown:de=>de.preventDefault(),"data-mantine-stop-propagation":g||void 0,children:P.label},K));return m.jsxs(v.Box,{...V("datePickerRoot"),size:E,...j,children:[m.jsx("div",{...V("presetsList"),children:D}),S]})});bo.classes=Kn.classes;bo.displayName="@mantine/dates/DatePicker";function bm(n){if(n===null)return null;const e=new Date(n);return Number.isNaN(e.getTime())||!n?null:R(e).format("YYYY-MM-DD")}function km({date:n,maxDate:e,minDate:t}){return!(n==null||Number.isNaN(new Date(n).getTime())||e&&R(n).isAfter(e,"date")||t&&R(n).isBefore(t,"date"))}const xm={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,size:"sm"},hl=v.factory((n,e)=>{const t=v.useInputProps("DateInput",xm,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:w,onClick:E,onKeyDown:C,readOnly:x,name:M,form:O,rightSection:j,unstyled:B,classNames:Y,styles:V,allowDeselect:F,date:q,defaultDate:G,onDateChange:J,getMonthControlProps:X,getYearControlProps:W,disabled:U,...I}=t,S=T.useRef(null),A=T.useRef(null),[D,P]=T.useState(!1),{calendarProps:K,others:de}=fl(I),N=Rt(),oe=p||(z=>{const Qe=R(z,h,N.getLocale(f)).toDate();return Number.isNaN(Qe.getTime())?bm(z):R(Qe).format("YYYY-MM-DD")}),te=F!==void 0?F:a,pe=z=>z?R(z).locale(N.getLocale(f)).format(h):"",[he,ae,se]=kr({type:"default",value:o,defaultValue:i,onChange:l}),[Oe,ue]=kr({type:"default",value:q,defaultValue:i||G,onChange:J});T.useEffect(()=>{se&&o!==null&&ue(o)},[se,o]);const[ke,ce]=T.useState(pe(he));T.useEffect(()=>{ce(pe(he))},[N.getLocale(f)]);const Ee=z=>{const Qe=z.currentTarget.value;if(ce(Qe),P(!0),Qe.trim()===""&&(F||a))ae(null);else{const Ze=oe(Qe);Ze&&km({date:Ze,minDate:g,maxDate:y})&&(ae(Ze),ue(Ze))}},Dn=z=>{w==null||w(z),P(!1),b&&ce(pe(he))},rn=z=>{k==null||k(z),P(!0)},sn=z=>{E==null||E(z),P(!0)},on=z=>{z.key==="Escape"&&P(!1),C==null||C(z)},ln=z=>({...d==null?void 0:d(z),selected:R(he).isSame(z,"day"),onClick:Qe=>{var cn,Nn;(Nn=d==null?void 0:(cn=d(z)).onClick)==null||Nn.call(cn,Qe);const Ze=te&&R(he).isSame(z,"day")?null:z;ae(Ze),!se&&Ze&&ce(pe(Ze)),P(!1)}}),an=m.jsx(v.Input.ClearButton,{onClick:()=>{ae(null),!se&&ce(""),P(!1)},unstyled:B,...c}),Xe=a&&!!he&&!x&&!U;return hs(()=>{he!==void 0&&!D&&ce(pe(he))},[he]),gp(()=>P(!1),void 0,[S.current,A.current]),m.jsxs(m.Fragment,{children:[m.jsx(v.Input.Wrapper,{...s,__staticSelector:"DateInput",ref:S,children:m.jsxs(v.Popover,{opened:D,trapFocus:!1,position:"bottom-start",disabled:x||U,withRoles:!1,unstyled:B,...u,children:[m.jsx(v.Popover.Target,{children:m.jsx(v.Input,{"data-dates-input":!0,"data-read-only":x||void 0,autoComplete:"off",ref:e,value:ke,onChange:Ee,onBlur:Dn,onFocus:rn,onClick:sn,onKeyDown:on,readOnly:x,rightSection:j,__clearSection:an,__clearable:Xe,...r,...de,disabled:U,__staticSelector:"DateInput"})}),m.jsx(v.Popover.Dropdown,{onMouseDown:z=>z.preventDefault(),"data-dates-dropdown":!0,ref:A,children:m.jsx(Kn,{__staticSelector:"DateInput",...K,classNames:Y,styles:V,unstyled:B,__preventFocus:!0,minDate:g,maxDate:y,locale:f,getDayProps:ln,size:r.size,date:Oe,onDateChange:ue,getMonthControlProps:z=>({selected:typeof he=="string"?oo(z,he):!1,...X==null?void 0:X(z)}),getYearControlProps:z=>({selected:typeof he=="string"?R(z).isSame(he,"year"):!1,...W==null?void 0:W(z)}),attributes:s.attributes})})]})}),m.jsx(ol,{name:M,form:O,value:he,type:"default"})]})});hl.classes={...v.Input.classes,...Kn.classes};hl.displayName="@mantine/dates/DateInput";function vm({minDate:n,value:e}){const t=n?R(n).format("HH:mm:ss"):null;return e&&n&&e===n?t??void 0:void 0}function Sm({maxDate:n,value:e}){const t=n?R(n).format("HH:mm:ss"):null;return e&&n&&e===n?t??void 0:void 0}var _u={timeWrapper:"m_208d2562",timeInput:"m_62ee059"};const Cm={dropdownType:"popover",size:"sm"},pl=v.factory((n,e)=>{const t=v.useProps("DateTimePicker",Cm,n),{value:r,defaultValue:s,onChange:o,valueFormat:i,locale:l,classNames:a,styles:c,unstyled:u,timePickerProps:d,submitButtonProps:f,withSeconds:h,level:p,defaultLevel:g,size:y,variant:b,dropdownType:k,vars:w,minDate:E,maxDate:C,defaultDate:x,defaultTimeValue:M,presets:O,attributes:j,onDropdownClose:B,...Y}=t,V=v.useStyles({name:"DateTimePicker",classes:_u,props:t,classNames:a,styles:c,unstyled:u,attributes:j,vars:w}),{resolvedClassNames:F,resolvedStyles:q}=v.useResolvedStylesApi({classNames:a,styles:c,props:t}),G=i||(h?"DD/MM/YYYY HH:mm:ss":"DD/MM/YYYY HH:mm"),J=T.useRef(null),X=rr(J,d==null?void 0:d.hoursRef),{calendarProps:{allowSingleDateInRange:W,...U},others:I}=fl(Y),S=Rt(),[A,D]=kr({type:"default",value:r,defaultValue:s,onChange:o,withTime:!0}),P=x||A,K=ce=>ce?R(ce).format(h?"HH:mm:ss":"HH:mm"):"",[de,N]=T.useState(M||K(A)),[Q,oe]=T.useState(p||g||"month"),[te,pe]=il(!1),he=A?R(A).locale(S.getLocale(l)).format(G):"",ae=ce=>{var Ee;(Ee=d==null?void 0:d.onChange)==null||Ee.call(d,ce),N(ce),ce&&D(Ma(A,ce))},se=ce=>{var Ee;ce&&D(Ma($o(E,C,ce),de||M||"")),(Ee=J.current)==null||Ee.focus()},Oe=ce=>{ce.key==="Enter"&&(ce.preventDefault(),pe.close())};hs(()=>{te||N(K(A))},[A,te]),hs(()=>{te&&oe("month")},[te]);const ue=k==="popover",ke=()=>{const ce=$o(E,C,A);A&&A!==ce&&D($o(E,C,A)),B==null||B()};return m.jsxs(yo,{formattedValue:he,dropdownOpened:Y.disabled?!1:te,dropdownHandlers:pe,classNames:F,styles:q,unstyled:u,ref:e,onClear:()=>D(null),shouldClear:!!A,value:A,size:y,variant:b,dropdownType:k,...I,type:"default",__staticSelector:"DateTimePicker",onDropdownClose:ke,withTime:!0,attributes:j,children:[m.jsx(bo,{...U,maxDate:C,minDate:E,size:y,variant:b,type:"default",value:A,defaultDate:P||cp({maxDate:C,minDate:E}),onChange:se,locale:l,classNames:F,styles:q,unstyled:u,__staticSelector:"DateTimePicker",__stopPropagation:ue,level:p,defaultLevel:g,onLevelChange:ce=>{var Ee;oe(ce),(Ee=U.onLevelChange)==null||Ee.call(U,ce)},presets:O,__onPresetSelect:ce=>{D(ce),ce&&N(K(ce))},attributes:j}),Q==="month"&&m.jsxs("div",{...V("timeWrapper"),children:[m.jsx(cl,{value:de,withSeconds:h,unstyled:u,min:vm({minDate:E,value:A}),max:Sm({maxDate:C,value:A}),...d,...V("timeInput",{className:d==null?void 0:d.className,style:d==null?void 0:d.style}),onChange:ae,onKeyDown:Oe,size:y,"data-mantine-stop-propagation":ue||void 0,hoursRef:X,attributes:j}),m.jsx(v.ActionIcon,{variant:"default",size:`input-${y||"sm"}`,...V("submitButton",{className:f==null?void 0:f.className,style:f==null?void 0:f.style}),unstyled:u,"data-mantine-stop-propagation":ue||void 0,children:m.jsx(v.CheckIcon,{size:"30%"}),...f,onClick:ce=>{var Ee;(Ee=f==null?void 0:f.onClick)==null||Ee.call(f,ce),pe.close(),ke()}})]})]})});pl.classes={..._u,...yo.classes,...bo.classes};pl.displayName="@mantine/dates/DateTimePicker";function Mm({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=i=>{t.onFieldChange(R(i,"YYYY-MM-DD").toDate())};return m.jsx(hl,{value:t.value??null,onChange:r||s?void 0:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,valueFormat:"YYYY-MM-DD",error:void 0})}const wm=n=>n&&n instanceof Date?n:null;function Tm({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=wm(t.value),i=l=>{t.onFieldChange(R(l,"YYYY-MM-DD HH:mm:ss").toDate())};return m.jsx(pl,{value:o,onChange:r||s?void 0:i,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,valueFormat:"DD-MM-YYYY hh:mm A",variant:r?"filled":"default",error:void 0})}function Em({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})}var Vr={exports:{}},Wo={};/**
|
|
23
23
|
* @license React
|
|
24
24
|
* use-sync-external-store-shim.production.js
|
|
25
25
|
*
|
|
@@ -27,7 +27,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
27
27
|
*
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*/var Da;function
|
|
30
|
+
*/var Da;function Am(){if(Da)return Wo;Da=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 Wo.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Wo}var Yo={};/**
|
|
31
31
|
* @license React
|
|
32
32
|
* use-sync-external-store-shim.development.js
|
|
33
33
|
*
|
|
@@ -35,19 +35,19 @@ React keys must be passed directly to JSX without using spread:
|
|
|
35
35
|
*
|
|
36
36
|
* This source code is licensed under the MIT license found in the
|
|
37
37
|
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/var Na;function Am(){return Na||(Na=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 Ra;function ml(){return Ra||(Ra=1,process.env.NODE_ENV==="production"?Vr.exports=Em():Vr.exports=Am()),Vr.exports}var Bu=ml();function Be(n){this.content=n}Be.prototype={constructor:Be,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 Be(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 Be(t)},addToStart:function(n,e){return new Be([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Be(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 Be(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=Be.from(n),n.size?new Be(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Be.from(n),n.size?new Be(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Be.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}};Be.from=function(n){if(n instanceof Be)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Be(e)};function Fu(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=Fu(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function zu(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=zu(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class L{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 L(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 L(r,s)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(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 L(s,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(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 Fu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return zu(this,e,t,r)}findIndex(e){if(e==0)return Hr(0,e);if(e==this.size)return Hr(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?Hr(t+1,o):Hr(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 L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.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 L(t||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Uo={index:0,offset:0};function Hr(n,e){return Uo.index=n,Uo.offset=e,Uo}function ms(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(!ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let be=class Ti{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&&ms(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 Ti.none;if(e instanceof Ti)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};be.none=[];class gs extends Error{}class H{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=Vu(this.content,e+this.openStart,t);return r&&new H(r,this.openStart,this.openEnd)}removeBetween(e,t){return new H($u(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 H.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 H(L.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 H(e,r,s)}}H.empty=new H(L.empty,0,0);function $u(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($u(o.content,e-s-1,t-s-1)))}function Vu(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=Vu(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function Om(n,e,t){if(t.openStart>n.depth)throw new gs("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gs("Inconsistent open depths");return Hu(n,e,t,0)}function Hu(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=Hu(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 yn(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Dm(t,n);return yn(o,Yu(n,i,l,e,r))}else return yn(o,ys(n,e,r))}function Wu(n,e){if(!e.type.compatibleContent(n.type))throw new gs("Cannot join "+e.type.name+" onto "+n.type.name)}function Ei(n,e,t){let r=n.node(t);return Wu(r,e.node(t)),r}function gn(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 cr(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&&(gn(n.nodeAfter,r),o++));for(let l=o;l<i;l++)gn(s.child(l),r);e&&e.depth==t&&e.textOffset&&gn(e.nodeBefore,r)}function yn(n,e){return n.type.checkContent(e),n.copy(e)}function Yu(n,e,t,r,s){let o=n.depth>s&&Ei(n,e,s+1),i=r.depth>s&&Ei(t,r,s+1),l=[];return cr(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(Wu(o,i),gn(yn(o,Yu(n,e,t,r,s+1)),l)):(o&&gn(yn(o,ys(n,e,s+1)),l),cr(e,t,s,l),i&&gn(yn(i,ys(t,r,s+1)),l)),cr(r,null,s,l),new L(l)}function ys(n,e,t){let r=[];if(cr(null,n,t,r),n.depth>t){let s=Ei(n,e,t+1);gn(yn(s,ys(n,e,t+1)),r)}return cr(e,null,t,r),new L(r)}function Dm(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(L.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class xr{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 be.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 bs(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 xr(t,r,o)}static resolveCached(e,t){let r=La.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 La.set(e,r=new Nm);let s=r.elts[r.i]=xr.resolve(e,t);return r.i=(r.i+1)%Rm,s}}class Nm{constructor(){this.elts=[],this.i=0}}const Rm=12,La=new WeakMap;class bs{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 Lm=Object.create(null);class mt{constructor(e,t,r,s=be.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||L.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&&ms(this.attrs,t||e.defaultAttrs||Lm)&&be.sameSet(this.marks,r||be.none)}copy(e=null){return e==this.content?this:new mt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new mt(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 H.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 H(c,s.depth-i,o.depth-i)}replace(e,t,r){return Om(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 xr.resolveCached(this,e)}resolveNoCache(e){return xr.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()+")"),Uu(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=L.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=be.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(!be.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=L.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}mt.prototype.text=void 0;class ks extends mt{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):Uu(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 ks(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ks(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 Uu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class vn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Im(e,t);if(r.next==null)return vn.empty;let s=qu(r);r.next&&r.err("Unexpected trailing text");let o=$m(zm(s));return Vm(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 L.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(`
|
|
39
|
-
`)}}vn.empty=new vn(!0);class Im{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 qu(n){let e=[];do e.push(jm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jm(n){let e=[];do e.push(Pm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Pm(n){let e=Fm(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=_m(n,e);else break;return e}function Ia(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function _m(n,e){let t=Ia(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ia(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Bm(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 Fm(n){if(n.eat("(")){let e=qu(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=Bm(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 zm(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 Ku(n,e){return e-n}function ja(n,e){let t=[];return r(e),t.sort(Ku);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 $m(n){let e=Object.create(null);return t(ja(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]);ja(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new vn(r.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(Ku);o.next.push({type:s[i][0],next:e[l.join(",")]||t(l)})}return o}}function Vm(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 Ju(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 Gu(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 Xu(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 Qu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Wm(n,r,e[r]);return t}let Pa=class Zu{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=Qu(e,r.attrs),this.defaultAttrs=Ju(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==vn.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:Gu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mt(this,this.computeAttrs(e),L.from(t),be.setFrom(r))}createChecked(e=null,t,r){return t=L.from(t),this.checkContent(t),new mt(this,this.computeAttrs(e),t,be.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=L.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(L.empty,!0);return o?new mt(this,e,t.append(o),be.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){Xu(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:be.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,i)=>r[o]=new Zu(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 Hm(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 Wm{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Hm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ko{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Qu(e,s.attrs),this.excluded=null;let o=Ju(this.attrs);this.instance=o?new be(this,o):null}create(e=null){return!e&&this.instance?this.instance:new be(this,Gu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new ko(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){Xu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ed{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=Be.from(e.nodes),t.marks=Be.from(e.marks||{}),this.nodes=Pa.compile(this.spec.nodes,this),this.marks=ko.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]=vn.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?_a(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==""?[]:_a(this,i.split(" "))}this.nodeFromJSON=s=>mt.fromJSON(this,s),this.markFromJSON=s=>be.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 Pa){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 ks(r,r.defaultAttrs,e,be.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 _a(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 Ym(n){return n.tag!=null}function Um(n){return n.style!=null}class Ut{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Ym(s))this.tags.push(s);else if(Um(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 Fa(this,t,!1);return r.addAll(e,be.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Fa(this,t,!0);return r.addAll(e,be.none,t.from,t.to),H.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(Jm(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=za(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=za(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ut(e,Ut.schemaRules(e)))}}const td={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},qm={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nd={ol:!0,ul:!0},vr=1,Ai=2,ur=4;function Ba(n,e,t){return e!=null?(e?vr:0)|(e==="full"?Ai:0):n&&n.whitespace=="pre"?vr|Ai:t&~ur}class Wr{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=be.none,this.match=o||(i&ur?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.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&vr)){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=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.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&&!td.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Fa{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=Ba(null,t.preserveWhitespace,0)|(r?ur:0);s?o=new Wr(s.type,s.attrs,be.none,!0,t.topMatch||s.type.contentMatch,i):r?o=new Wr(null,null,be.none,!0,null,i):o=new Wr(e.schema.topNodeType,null,be.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&Ai?"full":this.localPreserveWS||(s.options&vr)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
40
|
-
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(i.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),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;nd.hasOwnProperty(i)&&this.parser.normalizeLists&&
|
|
41
|
-
`),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=be.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):$a(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=Ba(e,o,i.options);i.options&ur&&i.content.length==0&&(l|=ur);let a=be.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):$a(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Wr(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|=vr)}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 Km(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&nd.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Jm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function za(n){let e={};for(let t in n)e[t]=n[t];return e}function $a(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 En{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=qo(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}=ls(qo(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&&ls(qo(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return ls(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new En(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Va(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Va(e.marks)}}function Va(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function qo(n){return n.document||window.document}const Ha=new WeakMap;function Gm(n){let e=Ha.get(n);return e===void 0&&Ha.set(n,e=Xm(n)),e}function Xm(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 ls(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=Gm(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}=ls(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 rd=65535,sd=Math.pow(2,16);function Qm(n,e){return n+e*sd}function Wa(n){return n&rd}function Zm(n){return(n-(n&rd))/sd}const od=1,id=2,as=4,ld=8;class Oi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ld)>0}get deletedBefore(){return(this.delInfo&(od|as))>0}get deletedAfter(){return(this.delInfo&(id|as))>0}get deletedAcross(){return(this.delInfo&as)>0}}class nt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&nt.empty)return nt.empty}recover(e){let t=0,r=Wa(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+Zm(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:Qm(l/3,e-a),g=e==a?id:e==d?od:as;return(t<0?e!=a:e!=d)&&(g|=ld),new Oi(h,g,p)}s+=u-c}return r?e+s:new Oi(e+s,0,null)}touches(e,t){let r=0,s=Wa(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 nt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?nt.empty:new nt(e<0?[0,-e,0]:[0,0,e])}}nt.empty=new nt([]);class Sr{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 Sr(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 Sr;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 Oi(e,s,null)}}const Ko=Object.create(null);class Ye{getMap(){return nt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ko[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 Ko)throw new RangeError("Duplicate use of step JSON ID "+e);return Ko[e]=t,t.prototype.jsonID=e,t}}class Ne{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Ne(e,null)}static fail(e){return new Ne(null,e)}static fromReplace(e,t,r,s){try{return Ne.ok(e.replace(t,r,s))}catch(o){if(o instanceof gs)return Ne.fail(o.message);throw o}}}function gl(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(gl(o.content,e,o))),o.isInline&&(o=e(o,t,s)),r.push(o)}return L.fromArray(r)}class Ht extends Ye{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 H(gl(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 Ne.fromReplace(e,this.from,this.to,o)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ht(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ht(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 Ht(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("addMark",Ht);class pt extends Ye{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 H(gl(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Ne.fromReplace(e,this.from,this.to,r)}invert(){return new Ht(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 pt(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("removeMark",pt);class Wt extends Ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new H(L.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 Wt(this.pos,t.marks[s]);return new Wt(this.pos,this.mark)}}return new Sn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wt(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 Wt(t.pos,e.markFromJSON(t.mark))}}Ye.jsonID("addNodeMark",Wt);class Sn extends Ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new H(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sn(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 Sn(t.pos,e.markFromJSON(t.mark))}}Ye.jsonID("removeNodeMark",Sn);class Le extends Ye{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Di(e,this.from,this.to)?Ne.fail("Structure replace would overwrite content"):Ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Le(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 Le(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Le)||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?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Le(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?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Le(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 Le(t.from,t.to,H.fromJSON(e,t.slice),!!t.structure)}}Ye.jsonID("replace",Le);class Ie extends Ye{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&&(Di(e,this.from,this.gapFrom)||Di(e,this.gapTo,this.to)))return Ne.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Ne.fromReplace(e,this.from,this.to,r):Ne.fail("Content does not fit in gap")}getMap(){return new nt([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 Ie(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 Ie(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 Ie(t.from,t.to,t.gapFrom,t.gapTo,H.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ye.jsonID("replaceAround",Ie);function Di(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 eg(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 pt(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new Ht(f,h,r))}}),s.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function tg(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 ko){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 pt(i.from,i.to,i.style)))}function yl(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 Le(l,u,H.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new pt(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 H(L.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new Le(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(L.empty,!0);n.replace(l,l,new H(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function ng(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Jn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,o=0;;--r){let i=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-o;if(r<n.depth&&i.canReplace(l,a,t))return r;if(r==0||i.type.spec.isolating||!ng(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function rg(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=L.empty,d=0;for(let p=o,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=L.from(r.node(p).copy(u)),d++):a--;let f=L.empty,h=0;for(let p=o,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,f=L.from(s.node(p).copy(f)),h++):c++;n.step(new Ie(a,c,i,l,new H(u.append(f),d,h),u.size-d,!0))}function bl(n,e,t=null,r=n){let s=sg(n,e),o=s&&og(r,e);return o?s.map(Ya).concat({type:e,attrs:t}).concat(o.map(Ya)):null}function Ya(n){return{type:n,attrs:null}}function sg(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 og(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 ig(n,e,t){let r=L.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=L.from(t[i].type.create(t[i].attrs,r))}let s=e.start,o=e.end;n.step(new Ie(s,o,s,o,new H(r,0,0),t.length,!0))}function lg(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)&&ag(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&&cd(n,i,l,o),yl(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 Ie(d,f,d+1,f-1,new H(L.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&ad(n,i,l,o),!1}})}function ad(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 cd(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(`
|
|
42
|
-
`))}})}function ag(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function cg(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 Ie(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new H(L.from(i),0,0),1,!0))}function Dt(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 ug(n,e,t=1,r){let s=n.doc.resolve(e),o=L.empty,i=L.empty;for(let l=s.depth,a=s.depth-t,c=t-1;l>a;l--,c--){o=L.from(s.node(l).copy(o));let u=r&&r[c];i=L.from(u?u.type.create(u.attrs,i):s.node(l).copy(i))}n.step(new Le(e,e,new H(o.append(i),t,t),!0))}function tn(n,e){let t=n.resolve(e),r=t.index();return ud(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function dg(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 ud(n,e){return!!(n&&e&&!n.isLeaf&&dg(n,e))}function xo(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&&ud(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 fg(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);cd(n,u.node(),u.before(),l)}i.inlineContent&&yl(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 Le(c,a.map(e+t,-1),H.empty,!0)),r===!0){let u=n.doc.resolve(c);ad(n,u.node(),u.before(),n.steps.length)}return n}function hg(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 dd(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 vo(n,e,t=e,r=H.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),o=n.resolve(t);return fd(s,o,r)?new Le(e,t,r):new pg(s,o,r).fit()}function fd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class pg{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=L.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=L.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 H(o,i,l);return e>-1?new Ie(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Le(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=Jo(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(L.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=Jo(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new H(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=Jo(e,t);if(s.childCount<=1&&t>0){let o=e.size-t<=t+s.size;this.unplaced=new H(or(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new H(or(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(hd(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=ir(this.placed,t,L.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?H.empty:new H(or(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new H(or(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||!Go(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=Go(e,t,s,r,o);if(i){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Go(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=ir(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=ir(this.placed,this.depth,L.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=ir(this.placed,this.frontier.length,t))}}function or(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(or(n.firstChild.content,e-1,t)))}function ir(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ir(n.lastChild.content,e-1,t)))}function Jo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function hd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,hd(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(L.empty,!0)))),n.copy(r)}function Go(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&&!mg(t,o.content,i)?l:null}function mg(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function gg(n){return n.spec.defining||n.spec.definingForContent}function yg(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),o=n.doc.resolve(t);if(fd(s,o,r))return n.step(new Le(e,t,r));let i=md(s,o);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=gg(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),w=s.index(y-1);if(k.canReplaceWith(w,w,p.type,p.marks))return n.replace(s.before(y),b?o.after(y):t,new H(pd(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 pd(n,e,t,r,s){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(pd(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(L.empty,!0))}return n}function bg(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=hg(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new H(L.from(r),0,0))}function kg(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t),o=md(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 md(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 $n extends Ye{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 Ne.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 Ne.fromReplace(e,this.pos,this.pos+1,new H(L.from(s),0,t.isLeaf?0:1))}getMap(){return nt.empty}invert(e){return new $n(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 $n(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 $n(t.pos,t.attr,t.value)}}Ye.jsonID("attr",$n);class Cr extends Ye{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 Ne.ok(r)}getMap(){return nt.empty}invert(e){return new Cr(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 Cr(t.attr,t.value)}}Ye.jsonID("docAttr",Cr);let Hn=class extends Error{};Hn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Hn.prototype=Object.create(Error.prototype);Hn.prototype.constructor=Hn;Hn.prototype.name="TransformError";class gd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Sr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Hn(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=H.empty){let s=vo(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new H(L.from(r),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return yg(this,e,t,r),this}replaceRangeWith(e,t,r){return bg(this,e,t,r),this}deleteRange(e,t){return kg(this,e,t),this}lift(e,t){return rg(this,e,t),this}join(e,t=1){return fg(this,e,t),this}wrap(e,t){return ig(this,e,t),this}setBlockType(e,t=e,r,s=null){return lg(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return cg(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new $n(e,t,r)),this}setDocAttribute(e,t){return this.step(new Cr(e,t)),this}addNodeMark(e,t){return this.step(new Wt(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 be)t.isInSet(r.marks)&&this.step(new Sn(e,t));else{let s=r.marks,o,i=[];for(;o=t.isInSet(s);)i.push(new Sn(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 ug(this,e,t,r),this}addMark(e,t,r){return eg(this,e,t,r),this}removeMark(e,t,r){return tg(this,e,t,r),this}clearIncompatible(e,t,r){return yl(this,e,t,r),this}}const Xo=Object.create(null);class le{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new xg(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=H.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?H.empty:t),l==0&&Ka(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),Ka(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new re(e):In(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?In(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):In(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 rt(e.node(0))}static atStart(e){return In(e,e,0,0,1)||new rt(e)}static atEnd(e){return In(e,e,e.content.size,e.childCount,-1)||new rt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xo[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 Xo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return re.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class xg{constructor(e,t){this.$from=e,this.$to=t}}let Ua=!1;function qa(n){!Ua&&!n.parent.inlineContent&&(Ua=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class re extends le{constructor(e,t=e){qa(e),qa(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 le.near(r);let s=e.resolve(t.map(this.anchor));return new re(s.parent.inlineContent?s:r,r)}replace(e,t=H.empty){if(super.replace(e,t),t==H.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof re&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new So(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 re(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=le.findFrom(t,r,!0)||le.findFrom(t,-r,!0);if(o)t=o.$head;else return le.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new re(e,t)}}le.jsonID("text",re);class So{constructor(e,t){this.anchor=e,this.head=t}map(e){return new So(e.map(this.anchor),e.map(this.head))}resolve(e){return re.between(e.resolve(this.anchor),e.resolve(this.head))}}class ee extends le{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?le.near(o):new ee(o)}content(){return new H(L.from(this.node),0,0)}eq(e){return e instanceof ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new kl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ee(e.resolve(t.anchor))}static create(e,t){return new ee(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ee.prototype.visible=!1;le.jsonID("node",ee);class kl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new So(r,r):new kl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&ee.isSelectable(r)?new ee(t):le.near(t)}}class rt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new rt(e)}map(e){return new rt(e)}eq(e){return e instanceof rt}getBookmark(){return vg}}le.jsonID("all",rt);const vg={map(){return this},resolve(n){return new rt(n)}};function In(n,e,t,r,s,o=!1){if(e.inlineContent)return re.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&&ee.isSelectable(l))return ee.create(n,t-(s<0?l.nodeSize:0))}else{let a=In(n,l,t+s,s<0?l.childCount:0,s,o);if(a)return a}t+=l.nodeSize*s}return null}function Ka(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof Le||s instanceof Ie))return;let o=n.mapping.maps[r],i;o.forEach((l,a,c,u)=>{i==null&&(i=u)}),n.setSelection(le.near(n.doc.resolve(i),t))}const Ja=1,Yr=2,Ga=4;class Sg extends gd{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|Ja)&~Yr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ja)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Yr,this}ensureMarks(e){return be.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&Yr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Yr,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)||be.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),!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.selection.to==t+e.length&&this.setSelection(le.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|=Ga,this}get scrolledIntoView(){return(this.updated&Ga)>0}}function Xa(n,e){return!e||!n?n:n.bind(e)}class lr{constructor(e,t,r){this.name=e,this.init=Xa(t.init,r),this.apply=Xa(t.apply,r)}}const Cg=[new lr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new lr("selection",{init(n,e){return n.selection||le.atStart(e.doc)},apply(n){return n.selection}}),new lr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new lr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Qo{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Cg.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 lr(r.key,r.spec.state,r))})}}class zn{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 zn(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 Sg(this)}static create(e){let t=new Qo(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zn(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 Qo(this.schema,e.plugins),r=t.fields,s=new zn(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 Qo(e.schema,e.plugins),o=new zn(s);return s.fields.forEach(i=>{if(i.name=="doc")o.doc=mt.fromJSON(e.schema,t.doc);else if(i.name=="selection")o.selection=le.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 yd(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=yd(s,e,{})),t[r]=s}return t}class Te{constructor(e){this.spec=e,this.props={},e.props&&yd(e.props,this,this.props),this.key=e.key?e.key.key:bd("plugin")}getState(e){return e[this.key]}}const Zo=Object.create(null);function bd(n){return n in Zo?n+"$"+ ++Zo[n]:(Zo[n]=0,n+"$")}class Pe{constructor(e="key"){this.key=bd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const xl=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function kd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const xd=(n,e,t)=>{let r=kd(n,t);if(!r)return!1;let s=vl(r);if(!s){let i=r.blockRange(),l=i&&Jn(i);return l==null?!1:(e&&e(n.tr.lift(i,l).scrollIntoView()),!0)}let o=s.nodeBefore;if(Od(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Wn(o,"end")||ee.isSelectable(o)))for(let i=r.depth;;i--){let l=vo(n.doc,r.before(i),r.after(i),H.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Wn(o,"end")?le.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):ee.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},Mg=(n,e,t)=>{let r=kd(n,t);if(!r)return!1;let s=vl(r);return s?vd(n,s,e):!1},wg=(n,e,t)=>{let r=Cd(n,t);if(!r)return!1;let s=Sl(r);return s?vd(n,s,e):!1};function vd(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=vo(n.doc,o,a,H.empty);if(!c||c.from!=o||c instanceof Le&&c.slice.size>=a-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(re.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Wn(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 Sd=(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=vl(r)}let i=o&&o.nodeBefore;return!i||!ee.isSelectable(i)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)};function vl(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 Cd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Md=(n,e,t)=>{let r=Cd(n,t);if(!r)return!1;let s=Sl(r);if(!s)return!1;let o=s.nodeAfter;if(Od(n,s,e,1))return!0;if(r.parent.content.size==0&&(Wn(o,"start")||ee.isSelectable(o))){let i=vo(n.doc,r.before(),r.after(),H.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=n.tr.step(i);l.setSelection(Wn(o,"start")?le.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):ee.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=Sl(r)}let i=o&&o.nodeAfter;return!i||!ee.isSelectable(i)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos)).scrollIntoView()),!0)};function Sl(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 Tg=(n,e)=>{let t=n.selection,r=t instanceof ee,s;if(r){if(t.node.isTextblock||!tn(n.doc,t.from))return!1;s=t.from}else if(s=xo(n.doc,t.from,-1),s==null)return!1;if(e){let o=n.tr.join(s);r&&o.setSelection(ee.create(o.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Eg=(n,e)=>{let t=n.selection,r;if(t instanceof ee){if(t.node.isTextblock||!tn(n.doc,t.to))return!1;r=t.to}else if(r=xo(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Ag=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),o=s&&Jn(s);return o==null?!1:(e&&e(n.tr.lift(s,o).scrollIntoView()),!0)},Td=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
43
|
-
`).scrollIntoView()),!0)};function Cl(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 Og=(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=Cl(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(le.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ed=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof rt||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=Cl(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(re.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},Ad=(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(Dt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),s=r&&Jn(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function Dg(n){return(e,t)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof ee&&e.selection.node.isBlock)return!r.parentOffset||!Dt(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=Cl(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 re||e.selection instanceof rt)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Dt(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Dt(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 Ng=Dg(),Rg=(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(ee.create(n.doc,s))),!0)};function Lg(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||tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Od(n,e,t,r){let s=e.nodeBefore,o=e.nodeAfter,i,l,a=s.type.spec.isolating||o.type.spec.isolating;if(!a&&Lg(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=L.empty;for(let b=i.length-1;b>=0;b--)p=L.from(i[b].create(null,p));p=L.from(s.copy(p));let g=n.tr.step(new Ie(e.pos-1,h,e.pos,h,new H(p,1,0),i.length,!0)),y=g.doc.resolve(h+2*i.length);y.nodeAfter&&y.nodeAfter.type==s.type&&tn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:le.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Jn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Wn(o,"start",!0)&&Wn(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=L.empty;for(let w=p.length-1;w>=0;w--)b=L.from(p[w].copy(b));let k=n.tr.step(new Ie(e.pos-p.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new H(b,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Dd(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(re.create(e.doc,n<0?s.start(o):s.end(o)))),!0):!1}}const Ig=Dd(-1),jg=Dd(1);function Pg(n,e=null){return function(t,r){let{$from:s,$to:o}=t.selection,i=s.blockRange(o),l=i&&bl(i,n,e);return l?(r&&r(t.tr.wrap(i,l).scrollIntoView()),!0):!1}}function Qa(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 Ml(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}Ml(xl,xd,Sd);Ml(xl,Md,wd);Ml(Td,Ed,Ad,Ng);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function _g(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 Bg(l,i,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Bg(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 bs(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new bs(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=bl(o,t,r,e);return l?(n&&Fg(n,e,l,s,t),!0):!1}function Fg(n,e,t,r,s){let o=L.empty;for(let u=t.length-1;u>=0;u--)o=L.from(t[u].type.create(t[u].attrs,o));n.step(new Ie(e.start-(r?2:0),e.end,e.start,e.end,new H(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&&Dt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function zg(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?$g(e,t,n,o):Vg(e,t,o):!0:!1}}function $g(n,e,t,r){let s=n.tr,o=r.end,i=r.$to.end(r.depth);o<i&&(s.step(new Ie(o-1,i,o,i,new H(L.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new bs(s.doc.resolve(r.$from.pos),s.doc.resolve(i),r.depth));const l=Jn(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(o,-1)-1);return tn(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function Vg(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?L.empty:L.from(s))))return!1;let d=o.pos,f=d+i.nodeSize;return r.step(new Ie(d-(l?1:0),f+(a?1:0),d+1,f-1,new H((l?L.empty:L.from(s.copy(L.empty))).append(a?L.empty:L.from(s.copy(L.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Hg(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=L.from(c?n.create():null),d=new H(L.from(n.create(null,L.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new Ie(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Fe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Yn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ni=null;const At=function(n,e,t){let r=Ni||(Ni=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Wg=function(){Ni=null},Cn=function(n,e,t,r){return t&&(Za(n,e,t,r,-1)||Za(n,e,t,r,1))},Yg=/^(img|br|input|textarea|hr)$/i;function Za(n,e,t,r,s){for(var o;;){if(n==t&&e==r)return!0;if(e==(s<0?0:ct(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Rr(n)||Yg.test(n.nodeName)||n.contentEditable=="false")return!1;e=Fe(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?ct(n):0}else return!1}}function ct(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ug(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=ct(n)}else if(n.parentNode&&!Rr(n))e=Fe(n),n=n.parentNode;else return null}}function qg(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&&!Rr(n))e=Fe(n)+1,n=n.parentNode;else return null}}function Kg(n,e,t){for(let r=e==0,s=e==ct(n);r||s;){if(n==t)return!0;let o=Fe(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,s=s&&o==ct(n)}}function Rr(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 Co=function(n){return n.focusNode&&Cn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function dn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Jg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Gg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(ct(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(ct(r.startContainer),r.startOffset)}}}const kt=typeof navigator<"u"?navigator:null,ec=typeof document<"u"?document:null,nn=kt&&kt.userAgent||"",Ri=/Edge\/(\d+)/.exec(nn),Nd=/MSIE \d/.exec(nn),Li=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nn),tt=!!(Nd||Li||Ri),qt=Nd?document.documentMode:Li?+Li[1]:Ri?+Ri[1]:0,ut=!tt&&/gecko\/(\d+)/i.test(nn);ut&&+(/Firefox\/(\d+)/.exec(nn)||[0,0])[1];const Ii=!tt&&/Chrome\/(\d+)/.exec(nn),We=!!Ii,Rd=Ii?+Ii[1]:0,Ke=!tt&&!!kt&&/Apple Computer/.test(kt.vendor),Un=Ke&&(/Mobile\/\w+/.test(nn)||!!kt&&kt.maxTouchPoints>2),at=Un||(kt?/Mac/.test(kt.platform):!1),Xg=kt?/Win/.test(kt.platform):!1,Ot=/Android \d/.test(nn),Lr=!!ec&&"webkitFontSmoothing"in ec.documentElement.style,Qg=Lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Zg(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 Mt(n,e){return typeof n=="number"?n:n[e]}function ey(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 tc(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=Yn(i);continue}let l=i,a=l==o.body,c=a?Zg(o):ey(l),u=0,d=0;if(e.top<c.top+Mt(r,"top")?d=-(c.top-e.top+Mt(s,"top")):e.bottom>c.bottom-Mt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Mt(s,"top")-c.top:e.bottom-c.bottom+Mt(s,"bottom")),e.left<c.left+Mt(r,"left")?u=-(c.left-e.left+Mt(s,"left")):e.right>c.right-Mt(r,"right")&&(u=e.right-c.right+Mt(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:Yn(i)}}function ty(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:Ld(n.dom)}}function Ld(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Yn(r));return e}function ny({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 Rn=null;function ry(n){if(n.setActive)return n.setActive();if(Rn)return n.focus(Rn);let e=Ld(n);n.focus(Rn==null?{get preventScroll(){return Rn={preventScroll:!0},!0}}:void 0),Rn||(Rn=!1,Id(e,0))}function jd(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=At(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?sy(t,s):!t||r&&t.nodeType==1?{node:n,offset:o}:jd(t,s)}function sy(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=_t(r,1);if(o.top!=o.bottom&&wl(e,o))return{node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function wl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function oy(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function iy(n,e,t){let{node:r,offset:s}=jd(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 ly(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 Pd(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(wl(e,c))return Pd(i,e,c)}}if((o=(o+1)%r)==s)break}return n}function ay(n,e){let t=n.dom.ownerDocument,r,s=0,o=Gg(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(!wl(e,c)||(i=Pd(n.dom,e,c),!i))return null}if(Ke)for(let c=i;r&&c;c=Yn(c))c.draggable&&(r=void 0);if(i=oy(i,e),r){if(ut&&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;Lr&&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=ly(n,r,s,e))}l==null&&(l=iy(n,i,e));let a=n.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function nc(n){return n.top<n.bottom||n.left<n.right}function _t(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(nc(r))return r}return Array.prototype.find.call(t,nc)||n.getBoundingClientRect()}const cy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _d(n,e,t){let{node:r,offset:s,atom:o}=n.docView.domFromPos(e,t<0?-1:1),i=Lr||ut;if(r.nodeType==3)if(i&&(cy.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let a=_t(At(r,s,s),t);if(ut&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=_t(At(r,s-1,s-1),-1);if(c.top==a.top){let u=_t(At(r,s,s+1),-1);if(u.top!=a.top)return tr(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++,tr(_t(At(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&s&&(t<0||s==ct(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return ei(a.getBoundingClientRect(),!1)}if(o==null&&s<ct(r)){let a=r.childNodes[s];if(a.nodeType==1)return ei(a.getBoundingClientRect(),!0)}return ei(r.getBoundingClientRect(),t>=0)}if(o==null&&s&&(t<0||s==ct(r))){let a=r.childNodes[s-1],c=a.nodeType==3?At(a,ct(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return tr(_t(c,1),!1)}if(o==null&&s<ct(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?At(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return tr(_t(c,-1),!0)}return tr(_t(r.nodeType==3?At(r):r,-t),t>=0)}function tr(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 ei(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 Bd(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 uy(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return Bd(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=_d(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=At(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 dy=/[\u0590-\u08ac]/;function fy(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?!dy.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:i:Bd(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 rc=null,sc=null,oc=!1;function hy(n,e,t){return rc==e&&sc==t?oc:(rc=e,sc=t,oc=t=="up"||t=="down"?uy(n,e,t):fy(n,e,t))}const dt=0,ic=1,fn=2,xt=3;class Ir{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=dt,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>Fe(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 zd){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 Fd&&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?Fe(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?Fe(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=Fe(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=Fe(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((ut||Ke)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
44
|
-
`),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:Fe(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(ut&&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&&Ke)&&Cn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Cn(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&ut)){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?fn:ic,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=xt:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?fn:xt}r=i}this.dirty=fn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?fn:ic;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Fd extends Ir{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==dt&&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 py extends Ir{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 Mn extends Ir{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=En.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Mn(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=dt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=dt}}slice(e,t,r){let s=Mn.create(this.parent,this.mark,!0,r),o=this.children,i=this.size;t<i&&(o=Pi(o,t,i,r)),e>0&&(o=Pi(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 Kt extends Ir{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}=En.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=Hd(u,r,t),c?a=new my(e,t,r,s,u,d||null,f,c,o,i+1):t.isText?new Mo(e,t,r,s,u,f,o):new Kt(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=()=>L.empty)}return e}matchesNode(e,t,r){return this.dirty==dt&&e.eq(this.node)&&xs(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 yy(this,i&&i.node,e);xy(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?be.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==fn)&&(i&&this.protectLocalComposition(e,i),$d(this.contentDOM,this.children,e),Un&&vy(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof re)||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=Sy(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 py(this,o,t,s);e.input.compositionNodes.push(i),this.children=Pi(this.children,r,r+s.length,e,i)}update(e,t,r,s){return this.dirty==xt||!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=dt}updateOuterDeco(e){if(xs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Vd(this.dom,this.nodeDOM,ji(this.outerDeco,this.node,t),ji(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 lc(n,e,t,r,s){Hd(r,e,n);let o=new Kt(void 0,n,e,t,r,r,r,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class Mo extends Kt{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==xt||this.dirty!=dt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=dt||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=dt,!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 Mo(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=xt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zd extends Ir{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==dt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class my extends Kt{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==xt)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 $d(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=ac(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(l,r);if(i instanceof Mn){let a=r?r.previousSibling:n.lastChild;$d(i.contentDOM,i.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=ac(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const dr=function(n){n&&(this.nodeName=n)};dr.prototype=Object.create(null);const hn=[new dr];function ji(n,e,t){if(n.length==0)return hn;let r=t?hn[0]:new dr,s=[r];for(let o=0;o<n.length;o++){let i=n[o].type.attrs;if(i){i.nodeName&&s.push(r=new dr(i.nodeName));for(let l in i){let a=i[l];a!=null&&(t&&s.length==1&&s.push(r=new dr(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 Vd(n,e,t,r){if(t==hn&&r==hn)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=hn[0]),s=a}gy(s,l||hn[0],i)}return s}function gy(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 Hd(n,e,t){return Vd(n,n,hn,ji(e,t,n.nodeType!=1))}function xs(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 ac(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class yy{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=by(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=dt,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=Mn.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==xt&&i.dom==i.contentDOM&&(i.dirty=fn),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 Kt){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!=xt&&xs(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=fn,d.updateChildren(s,i+1),d.dirty=dt),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)||!xs(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=Kt.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=Kt.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 Fd(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 Mn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Mo)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ke||We)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new zd(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 by(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 Mn)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 ky(n,e){return n.type.side-e.type.side}function xy(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(ky);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 vy(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 Sy(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 Pi(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 Tl(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(Co(t)){for(a=i;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&ee.isSelectable(d)&&s.parent&&!(d.isInline&&Kg(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;c=new ee(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=El(n,u,l,d)}return c}function Wd(n){return n.editable?n.hasFocus():Ud(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Nt(n,e=!1){let t=n.state.selection;if(Yd(n,t),!!Wd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&We){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Cn(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)My(n);else{let{anchor:r,head:s}=t,o,i;cc&&!(t instanceof re)&&(t.$from.parent.inlineContent||(o=uc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(i=uc(n,t.to))),n.docView.setSelection(r,s,n,e),cc&&(o&&dc(o),i&&dc(i)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Cy(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const cc=Ke||We&&Rd<63;function uc(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(Ke&&s&&s.contentEditable=="false")return ti(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return ti(s);if(o)return ti(o)}}function ti(n){return n.contentEditable="true",Ke&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function dc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Cy(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(()=>{(!Wd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function My(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Fe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&tt&&qt<=11&&(t.disabled=!0,t.disabled=!1)}function Yd(n,e){if(e instanceof ee){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(fc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else fc(n)}function fc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function El(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||re.between(e,t,r)}function hc(n){return n.editable&&!n.hasFocus()?!1:Ud(n)}function Ud(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 wy(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Cn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function _i(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&&le.findFrom(o,e)}function Bt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function pc(n,e,t){let r=n.state.selection;if(r instanceof re)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 Bt(n,new re(r.$anchor,i))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=_i(n.state,e);return s&&s instanceof ee?Bt(n,s):!1}else if(!(at&&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?ee.isSelectable(o)?Bt(n,new ee(e<0?n.state.doc.resolve(s.pos-o.nodeSize):s)):Lr?Bt(n,new re(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ee&&r.node.isInline)return Bt(n,new re(e>0?r.$to:r.$from));{let s=_i(n.state,e);return s?Bt(n,s):!1}}}function vs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function fr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ln(n,e){return e<0?Ty(n):Ey(n)}function Ty(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,o,i=!1;for(ut&&t.nodeType==1&&r<vs(t)&&fr(t.childNodes[r],-1)&&(i=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(fr(l,-1))s=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(qd(t))break;{let l=t.previousSibling;for(;l&&fr(l,-1);)s=t.parentNode,o=Fe(l),l=l.previousSibling;if(l)t=l,r=vs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}i?Bi(n,t,r):s&&Bi(n,s,o)}function Ey(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=vs(t),o,i;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(fr(l,1))o=t,i=++r;else break}else{if(qd(t))break;{let l=t.nextSibling;for(;l&&fr(l,1);)o=l.parentNode,i=Fe(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=vs(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}o&&Bi(n,o,i)}function qd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ay(n,e){for(;n&&e==n.childNodes.length&&!Rr(n);)e=Fe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Oy(n,e){for(;n&&!e&&!Rr(n);)e=Fe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Bi(n,e,t){if(e.nodeType!=3){let o,i;(i=Ay(e,t))?(e=i,t=0):(o=Oy(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Co(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&&Nt(n)},50)}function mc(n,e){let t=n.state.doc.resolve(e);if(!(We||Xg)&&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 gc(n,e,t){let r=n.state.selection;if(r instanceof re&&!r.empty||t.indexOf("s")>-1||at&&t.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let i=_i(n.state,e);if(i&&i instanceof ee)return Bt(n,i)}if(!s.parent.inlineContent){let i=e<0?s:o,l=r instanceof rt?le.near(i,e):le.findFrom(i,e);return l?Bt(n,l):!1}return!1}function yc(n,e){if(!(n.state.selection instanceof re))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 bc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Dy(n){if(!Ke||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;bc(n,r,"true"),setTimeout(()=>bc(n,r,"false"),20)}return!1}function Ny(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ry(n,e){let t=e.keyCode,r=Ny(e);if(t==8||at&&t==72&&r=="c")return yc(n,-1)||Ln(n,-1);if(t==46&&!e.shiftKey||at&&t==68&&r=="c")return yc(n,1)||Ln(n,1);if(t==13||t==27)return!0;if(t==37||at&&t==66&&r=="c"){let s=t==37?mc(n,n.state.selection.from)=="ltr"?-1:1:-1;return pc(n,s,r)||Ln(n,s)}else if(t==39||at&&t==70&&r=="c"){let s=t==39?mc(n,n.state.selection.from)=="ltr"?1:-1:1;return pc(n,s,r)||Ln(n,s)}else{if(t==38||at&&t==80&&r=="c")return gc(n,-1,r)||Ln(n,-1);if(t==40||at&&t==78&&r=="c")return Dy(n)||gc(n,1,r)||Ln(n,1);if(r==(at?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Al(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")||En.fromSchema(n.state.schema),l=Zd(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Qd[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,`
|
|
38
|
+
*/var Na;function Om(){return Na||(Na=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 Ra;function ml(){return Ra||(Ra=1,process.env.NODE_ENV==="production"?Vr.exports=Am():Vr.exports=Om()),Vr.exports}var Bu=ml();function Be(n){this.content=n}Be.prototype={constructor:Be,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 Be(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 Be(t)},addToStart:function(n,e){return new Be([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Be(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 Be(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=Be.from(n),n.size?new Be(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Be.from(n),n.size?new Be(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Be.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}};Be.from=function(n){if(n instanceof Be)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Be(e)};function Fu(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=Fu(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function zu(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=zu(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class L{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 L(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 L(r,s)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(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 L(s,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(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 Fu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return zu(this,e,t,r)}findIndex(e){if(e==0)return Hr(0,e);if(e==this.size)return Hr(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?Hr(t+1,o):Hr(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 L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.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 L(t||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Uo={index:0,offset:0};function Hr(n,e){return Uo.index=n,Uo.offset=e,Uo}function ms(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(!ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let be=class Ti{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&&ms(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 Ti.none;if(e instanceof Ti)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};be.none=[];class gs extends Error{}class H{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=Vu(this.content,e+this.openStart,t);return r&&new H(r,this.openStart,this.openEnd)}removeBetween(e,t){return new H($u(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 H.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 H(L.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 H(e,r,s)}}H.empty=new H(L.empty,0,0);function $u(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($u(o.content,e-s-1,t-s-1)))}function Vu(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=Vu(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function Dm(n,e,t){if(t.openStart>n.depth)throw new gs("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new gs("Inconsistent open depths");return Hu(n,e,t,0)}function Hu(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=Hu(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 yn(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Nm(t,n);return yn(o,Yu(n,i,l,e,r))}else return yn(o,ys(n,e,r))}function Wu(n,e){if(!e.type.compatibleContent(n.type))throw new gs("Cannot join "+e.type.name+" onto "+n.type.name)}function Ei(n,e,t){let r=n.node(t);return Wu(r,e.node(t)),r}function gn(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 cr(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&&(gn(n.nodeAfter,r),o++));for(let l=o;l<i;l++)gn(s.child(l),r);e&&e.depth==t&&e.textOffset&&gn(e.nodeBefore,r)}function yn(n,e){return n.type.checkContent(e),n.copy(e)}function Yu(n,e,t,r,s){let o=n.depth>s&&Ei(n,e,s+1),i=r.depth>s&&Ei(t,r,s+1),l=[];return cr(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(Wu(o,i),gn(yn(o,Yu(n,e,t,r,s+1)),l)):(o&&gn(yn(o,ys(n,e,s+1)),l),cr(e,t,s,l),i&&gn(yn(i,ys(t,r,s+1)),l)),cr(r,null,s,l),new L(l)}function ys(n,e,t){let r=[];if(cr(null,n,t,r),n.depth>t){let s=Ei(n,e,t+1);gn(yn(s,ys(n,e,t+1)),r)}return cr(e,null,t,r),new L(r)}function Nm(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(L.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class xr{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 be.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 bs(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 xr(t,r,o)}static resolveCached(e,t){let r=La.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 La.set(e,r=new Rm);let s=r.elts[r.i]=xr.resolve(e,t);return r.i=(r.i+1)%Lm,s}}class Rm{constructor(){this.elts=[],this.i=0}}const Lm=12,La=new WeakMap;class bs{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 Im=Object.create(null);class mt{constructor(e,t,r,s=be.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||L.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&&ms(this.attrs,t||e.defaultAttrs||Im)&&be.sameSet(this.marks,r||be.none)}copy(e=null){return e==this.content?this:new mt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new mt(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 H.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 H(c,s.depth-i,o.depth-i)}replace(e,t,r){return Dm(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 xr.resolveCached(this,e)}resolveNoCache(e){return xr.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()+")"),Uu(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=L.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=be.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(!be.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=L.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}mt.prototype.text=void 0;class ks extends mt{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):Uu(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 ks(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ks(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 Uu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class vn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jm(e,t);if(r.next==null)return vn.empty;let s=qu(r);r.next&&r.err("Unexpected trailing text");let o=Vm($m(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 L.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(`
|
|
39
|
+
`)}}vn.empty=new vn(!0);class jm{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 qu(n){let e=[];do e.push(Pm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Pm(n){let e=[];do e.push(_m(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _m(n){let e=zm(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=Bm(n,e);else break;return e}function Ia(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Bm(n,e){let t=Ia(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ia(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Fm(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 zm(n){if(n.eat("(")){let e=qu(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=Fm(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 $m(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 Ku(n,e){return e-n}function ja(n,e){let t=[];return r(e),t.sort(Ku);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 Vm(n){let e=Object.create(null);return t(ja(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]);ja(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new vn(r.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(Ku);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 Ju(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 Gu(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 Xu(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 Qu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Ym(n,r,e[r]);return t}let Pa=class Zu{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=Qu(e,r.attrs),this.defaultAttrs=Ju(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==vn.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:Gu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mt(this,this.computeAttrs(e),L.from(t),be.setFrom(r))}createChecked(e=null,t,r){return t=L.from(t),this.checkContent(t),new mt(this,this.computeAttrs(e),t,be.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=L.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(L.empty,!0);return o?new mt(this,e,t.append(o),be.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){Xu(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:be.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,i)=>r[o]=new Zu(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 Wm(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 Ym{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Wm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ko{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Qu(e,s.attrs),this.excluded=null;let o=Ju(this.attrs);this.instance=o?new be(this,o):null}create(e=null){return!e&&this.instance?this.instance:new be(this,Gu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new ko(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){Xu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ed{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=Be.from(e.nodes),t.marks=Be.from(e.marks||{}),this.nodes=Pa.compile(this.spec.nodes,this),this.marks=ko.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]=vn.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?_a(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==""?[]:_a(this,i.split(" "))}this.nodeFromJSON=s=>mt.fromJSON(this,s),this.markFromJSON=s=>be.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 Pa){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 ks(r,r.defaultAttrs,e,be.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 _a(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 Um(n){return n.tag!=null}function qm(n){return n.style!=null}class Ut{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Um(s))this.tags.push(s);else if(qm(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 Fa(this,t,!1);return r.addAll(e,be.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Fa(this,t,!0);return r.addAll(e,be.none,t.from,t.to),H.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(Gm(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=za(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=za(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ut(e,Ut.schemaRules(e)))}}const td={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},Km={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nd={ol:!0,ul:!0},vr=1,Ai=2,ur=4;function Ba(n,e,t){return e!=null?(e?vr:0)|(e==="full"?Ai:0):n&&n.whitespace=="pre"?vr|Ai:t&~ur}class Wr{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=be.none,this.match=o||(i&ur?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.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&vr)){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=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.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&&!td.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Fa{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=Ba(null,t.preserveWhitespace,0)|(r?ur:0);s?o=new Wr(s.type,s.attrs,be.none,!0,t.topMatch||s.type.contentMatch,i):r?o=new Wr(null,null,be.none,!0,null,i):o=new Wr(e.schema.topNodeType,null,be.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&Ai?"full":this.localPreserveWS||(s.options&vr)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
40
|
+
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(i.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),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;nd.hasOwnProperty(i)&&this.parser.normalizeLists&&Jm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Km.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(td.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(`
|
|
41
|
+
`),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=be.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):$a(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=Ba(e,o,i.options);i.options&ur&&i.content.length==0&&(l|=ur);let a=be.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):$a(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Wr(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|=vr)}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 Jm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&nd.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Gm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function za(n){let e={};for(let t in n)e[t]=n[t];return e}function $a(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 En{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=qo(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}=ls(qo(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&&ls(qo(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return ls(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new En(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Va(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Va(e.marks)}}function Va(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function qo(n){return n.document||window.document}const Ha=new WeakMap;function Xm(n){let e=Ha.get(n);return e===void 0&&Ha.set(n,e=Qm(n)),e}function Qm(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 ls(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=Xm(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}=ls(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 rd=65535,sd=Math.pow(2,16);function Zm(n,e){return n+e*sd}function Wa(n){return n&rd}function eg(n){return(n-(n&rd))/sd}const od=1,id=2,as=4,ld=8;class Oi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ld)>0}get deletedBefore(){return(this.delInfo&(od|as))>0}get deletedAfter(){return(this.delInfo&(id|as))>0}get deletedAcross(){return(this.delInfo&as)>0}}class nt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&nt.empty)return nt.empty}recover(e){let t=0,r=Wa(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+eg(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:Zm(l/3,e-a),g=e==a?id:e==d?od:as;return(t<0?e!=a:e!=d)&&(g|=ld),new Oi(h,g,p)}s+=u-c}return r?e+s:new Oi(e+s,0,null)}touches(e,t){let r=0,s=Wa(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 nt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?nt.empty:new nt(e<0?[0,-e,0]:[0,0,e])}}nt.empty=new nt([]);class Sr{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 Sr(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 Sr;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 Oi(e,s,null)}}const Ko=Object.create(null);class Ye{getMap(){return nt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ko[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 Ko)throw new RangeError("Duplicate use of step JSON ID "+e);return Ko[e]=t,t.prototype.jsonID=e,t}}class Ne{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Ne(e,null)}static fail(e){return new Ne(null,e)}static fromReplace(e,t,r,s){try{return Ne.ok(e.replace(t,r,s))}catch(o){if(o instanceof gs)return Ne.fail(o.message);throw o}}}function gl(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(gl(o.content,e,o))),o.isInline&&(o=e(o,t,s)),r.push(o)}return L.fromArray(r)}class Ht extends Ye{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 H(gl(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 Ne.fromReplace(e,this.from,this.to,o)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ht(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ht(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 Ht(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("addMark",Ht);class pt extends Ye{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 H(gl(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Ne.fromReplace(e,this.from,this.to,r)}invert(){return new Ht(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 pt(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("removeMark",pt);class Wt extends Ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new H(L.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 Wt(this.pos,t.marks[s]);return new Wt(this.pos,this.mark)}}return new Sn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wt(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 Wt(t.pos,e.markFromJSON(t.mark))}}Ye.jsonID("addNodeMark",Wt);class Sn extends Ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new H(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sn(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 Sn(t.pos,e.markFromJSON(t.mark))}}Ye.jsonID("removeNodeMark",Sn);class Le extends Ye{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Di(e,this.from,this.to)?Ne.fail("Structure replace would overwrite content"):Ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Le(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 Le(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Le)||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?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Le(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?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Le(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 Le(t.from,t.to,H.fromJSON(e,t.slice),!!t.structure)}}Ye.jsonID("replace",Le);class Ie extends Ye{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&&(Di(e,this.from,this.gapFrom)||Di(e,this.gapTo,this.to)))return Ne.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Ne.fromReplace(e,this.from,this.to,r):Ne.fail("Content does not fit in gap")}getMap(){return new nt([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 Ie(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 Ie(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 Ie(t.from,t.to,t.gapFrom,t.gapTo,H.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ye.jsonID("replaceAround",Ie);function Di(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 tg(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 pt(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new Ht(f,h,r))}}),s.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function ng(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 ko){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 pt(i.from,i.to,i.style)))}function yl(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 Le(l,u,H.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new pt(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 H(L.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new Le(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(L.empty,!0);n.replace(l,l,new H(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function rg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Jn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,o=0;;--r){let i=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-o;if(r<n.depth&&i.canReplace(l,a,t))return r;if(r==0||i.type.spec.isolating||!rg(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function sg(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=L.empty,d=0;for(let p=o,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=L.from(r.node(p).copy(u)),d++):a--;let f=L.empty,h=0;for(let p=o,g=!1;p>t;p--)g||s.after(p+1)<s.end(p)?(g=!0,f=L.from(s.node(p).copy(f)),h++):c++;n.step(new Ie(a,c,i,l,new H(u.append(f),d,h),u.size-d,!0))}function bl(n,e,t=null,r=n){let s=og(n,e),o=s&&ig(r,e);return o?s.map(Ya).concat({type:e,attrs:t}).concat(o.map(Ya)):null}function Ya(n){return{type:n,attrs:null}}function og(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 ig(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 lg(n,e,t){let r=L.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=L.from(t[i].type.create(t[i].attrs,r))}let s=e.start,o=e.end;n.step(new Ie(s,o,s,o,new H(r,0,0),t.length,!0))}function ag(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)&&cg(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&&cd(n,i,l,o),yl(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 Ie(d,f,d+1,f-1,new H(L.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&ad(n,i,l,o),!1}})}function ad(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 cd(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(`
|
|
42
|
+
`))}})}function cg(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function ug(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 Ie(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new H(L.from(i),0,0),1,!0))}function Dt(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 dg(n,e,t=1,r){let s=n.doc.resolve(e),o=L.empty,i=L.empty;for(let l=s.depth,a=s.depth-t,c=t-1;l>a;l--,c--){o=L.from(s.node(l).copy(o));let u=r&&r[c];i=L.from(u?u.type.create(u.attrs,i):s.node(l).copy(i))}n.step(new Le(e,e,new H(o.append(i),t,t),!0))}function tn(n,e){let t=n.resolve(e),r=t.index();return ud(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function fg(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 ud(n,e){return!!(n&&e&&!n.isLeaf&&fg(n,e))}function xo(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&&ud(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 hg(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);cd(n,u.node(),u.before(),l)}i.inlineContent&&yl(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 Le(c,a.map(e+t,-1),H.empty,!0)),r===!0){let u=n.doc.resolve(c);ad(n,u.node(),u.before(),n.steps.length)}return n}function pg(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 dd(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 vo(n,e,t=e,r=H.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),o=n.resolve(t);return fd(s,o,r)?new Le(e,t,r):new mg(s,o,r).fit()}function fd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class mg{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=L.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=L.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 H(o,i,l);return e>-1?new Ie(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Le(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=Jo(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(L.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=Jo(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new H(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=Jo(e,t);if(s.childCount<=1&&t>0){let o=e.size-t<=t+s.size;this.unplaced=new H(or(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new H(or(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(hd(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=ir(this.placed,t,L.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?H.empty:new H(or(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new H(or(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||!Go(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=Go(e,t,s,r,o);if(i){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Go(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=ir(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=ir(this.placed,this.depth,L.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=ir(this.placed,this.frontier.length,t))}}function or(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(or(n.firstChild.content,e-1,t)))}function ir(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ir(n.lastChild.content,e-1,t)))}function Jo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function hd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,hd(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(L.empty,!0)))),n.copy(r)}function Go(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&&!gg(t,o.content,i)?l:null}function gg(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function yg(n){return n.spec.defining||n.spec.definingForContent}function bg(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),o=n.doc.resolve(t);if(fd(s,o,r))return n.step(new Le(e,t,r));let i=md(s,o);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=yg(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),w=s.index(y-1);if(k.canReplaceWith(w,w,p.type,p.marks))return n.replace(s.before(y),b?o.after(y):t,new H(pd(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 pd(n,e,t,r,s){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(pd(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(L.empty,!0))}return n}function kg(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=pg(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new H(L.from(r),0,0))}function xg(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t),o=md(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 md(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 $n extends Ye{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 Ne.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 Ne.fromReplace(e,this.pos,this.pos+1,new H(L.from(s),0,t.isLeaf?0:1))}getMap(){return nt.empty}invert(e){return new $n(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 $n(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 $n(t.pos,t.attr,t.value)}}Ye.jsonID("attr",$n);class Cr extends Ye{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 Ne.ok(r)}getMap(){return nt.empty}invert(e){return new Cr(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 Cr(t.attr,t.value)}}Ye.jsonID("docAttr",Cr);let Hn=class extends Error{};Hn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Hn.prototype=Object.create(Error.prototype);Hn.prototype.constructor=Hn;Hn.prototype.name="TransformError";class gd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Sr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Hn(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=H.empty){let s=vo(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new H(L.from(r),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return bg(this,e,t,r),this}replaceRangeWith(e,t,r){return kg(this,e,t,r),this}deleteRange(e,t){return xg(this,e,t),this}lift(e,t){return sg(this,e,t),this}join(e,t=1){return hg(this,e,t),this}wrap(e,t){return lg(this,e,t),this}setBlockType(e,t=e,r,s=null){return ag(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return ug(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new $n(e,t,r)),this}setDocAttribute(e,t){return this.step(new Cr(e,t)),this}addNodeMark(e,t){return this.step(new Wt(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 be)t.isInSet(r.marks)&&this.step(new Sn(e,t));else{let s=r.marks,o,i=[];for(;o=t.isInSet(s);)i.push(new Sn(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 dg(this,e,t,r),this}addMark(e,t,r){return tg(this,e,t,r),this}removeMark(e,t,r){return ng(this,e,t,r),this}clearIncompatible(e,t,r){return yl(this,e,t,r),this}}const Xo=Object.create(null);class le{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new vg(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=H.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?H.empty:t),l==0&&Ka(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),Ka(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new re(e):In(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?In(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):In(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 rt(e.node(0))}static atStart(e){return In(e,e,0,0,1)||new rt(e)}static atEnd(e){return In(e,e,e.content.size,e.childCount,-1)||new rt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xo[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 Xo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return re.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class vg{constructor(e,t){this.$from=e,this.$to=t}}let Ua=!1;function qa(n){!Ua&&!n.parent.inlineContent&&(Ua=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class re extends le{constructor(e,t=e){qa(e),qa(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 le.near(r);let s=e.resolve(t.map(this.anchor));return new re(s.parent.inlineContent?s:r,r)}replace(e,t=H.empty){if(super.replace(e,t),t==H.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof re&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new So(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 re(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=le.findFrom(t,r,!0)||le.findFrom(t,-r,!0);if(o)t=o.$head;else return le.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new re(e,t)}}le.jsonID("text",re);class So{constructor(e,t){this.anchor=e,this.head=t}map(e){return new So(e.map(this.anchor),e.map(this.head))}resolve(e){return re.between(e.resolve(this.anchor),e.resolve(this.head))}}class ee extends le{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?le.near(o):new ee(o)}content(){return new H(L.from(this.node),0,0)}eq(e){return e instanceof ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new kl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ee(e.resolve(t.anchor))}static create(e,t){return new ee(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ee.prototype.visible=!1;le.jsonID("node",ee);class kl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new So(r,r):new kl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&ee.isSelectable(r)?new ee(t):le.near(t)}}class rt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new rt(e)}map(e){return new rt(e)}eq(e){return e instanceof rt}getBookmark(){return Sg}}le.jsonID("all",rt);const Sg={map(){return this},resolve(n){return new rt(n)}};function In(n,e,t,r,s,o=!1){if(e.inlineContent)return re.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&&ee.isSelectable(l))return ee.create(n,t-(s<0?l.nodeSize:0))}else{let a=In(n,l,t+s,s<0?l.childCount:0,s,o);if(a)return a}t+=l.nodeSize*s}return null}function Ka(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof Le||s instanceof Ie))return;let o=n.mapping.maps[r],i;o.forEach((l,a,c,u)=>{i==null&&(i=u)}),n.setSelection(le.near(n.doc.resolve(i),t))}const Ja=1,Yr=2,Ga=4;class Cg extends gd{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|Ja)&~Yr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ja)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Yr,this}ensureMarks(e){return be.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&Yr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Yr,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)||be.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),!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.selection.to==t+e.length&&this.setSelection(le.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|=Ga,this}get scrolledIntoView(){return(this.updated&Ga)>0}}function Xa(n,e){return!e||!n?n:n.bind(e)}class lr{constructor(e,t,r){this.name=e,this.init=Xa(t.init,r),this.apply=Xa(t.apply,r)}}const Mg=[new lr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new lr("selection",{init(n,e){return n.selection||le.atStart(e.doc)},apply(n){return n.selection}}),new lr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new lr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Qo{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Mg.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 lr(r.key,r.spec.state,r))})}}class zn{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 zn(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 Cg(this)}static create(e){let t=new Qo(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zn(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 Qo(this.schema,e.plugins),r=t.fields,s=new zn(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 Qo(e.schema,e.plugins),o=new zn(s);return s.fields.forEach(i=>{if(i.name=="doc")o.doc=mt.fromJSON(e.schema,t.doc);else if(i.name=="selection")o.selection=le.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 yd(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=yd(s,e,{})),t[r]=s}return t}class Te{constructor(e){this.spec=e,this.props={},e.props&&yd(e.props,this,this.props),this.key=e.key?e.key.key:bd("plugin")}getState(e){return e[this.key]}}const Zo=Object.create(null);function bd(n){return n in Zo?n+"$"+ ++Zo[n]:(Zo[n]=0,n+"$")}class Pe{constructor(e="key"){this.key=bd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const xl=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function kd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const xd=(n,e,t)=>{let r=kd(n,t);if(!r)return!1;let s=vl(r);if(!s){let i=r.blockRange(),l=i&&Jn(i);return l==null?!1:(e&&e(n.tr.lift(i,l).scrollIntoView()),!0)}let o=s.nodeBefore;if(Od(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Wn(o,"end")||ee.isSelectable(o)))for(let i=r.depth;;i--){let l=vo(n.doc,r.before(i),r.after(i),H.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Wn(o,"end")?le.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):ee.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},wg=(n,e,t)=>{let r=kd(n,t);if(!r)return!1;let s=vl(r);return s?vd(n,s,e):!1},Tg=(n,e,t)=>{let r=Cd(n,t);if(!r)return!1;let s=Sl(r);return s?vd(n,s,e):!1};function vd(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=vo(n.doc,o,a,H.empty);if(!c||c.from!=o||c instanceof Le&&c.slice.size>=a-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(re.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Wn(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 Sd=(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=vl(r)}let i=o&&o.nodeBefore;return!i||!ee.isSelectable(i)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)};function vl(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 Cd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Md=(n,e,t)=>{let r=Cd(n,t);if(!r)return!1;let s=Sl(r);if(!s)return!1;let o=s.nodeAfter;if(Od(n,s,e,1))return!0;if(r.parent.content.size==0&&(Wn(o,"start")||ee.isSelectable(o))){let i=vo(n.doc,r.before(),r.after(),H.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=n.tr.step(i);l.setSelection(Wn(o,"start")?le.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):ee.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=Sl(r)}let i=o&&o.nodeAfter;return!i||!ee.isSelectable(i)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos)).scrollIntoView()),!0)};function Sl(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 Eg=(n,e)=>{let t=n.selection,r=t instanceof ee,s;if(r){if(t.node.isTextblock||!tn(n.doc,t.from))return!1;s=t.from}else if(s=xo(n.doc,t.from,-1),s==null)return!1;if(e){let o=n.tr.join(s);r&&o.setSelection(ee.create(o.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Ag=(n,e)=>{let t=n.selection,r;if(t instanceof ee){if(t.node.isTextblock||!tn(n.doc,t.to))return!1;r=t.to}else if(r=xo(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Og=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),o=s&&Jn(s);return o==null?!1:(e&&e(n.tr.lift(s,o).scrollIntoView()),!0)},Td=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
43
|
+
`).scrollIntoView()),!0)};function Cl(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 Dg=(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=Cl(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(le.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ed=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof rt||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=Cl(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(re.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},Ad=(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(Dt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),s=r&&Jn(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function Ng(n){return(e,t)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof ee&&e.selection.node.isBlock)return!r.parentOffset||!Dt(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=Cl(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 re||e.selection instanceof rt)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Dt(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Dt(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 Rg=Ng(),Lg=(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(ee.create(n.doc,s))),!0)};function Ig(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||tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Od(n,e,t,r){let s=e.nodeBefore,o=e.nodeAfter,i,l,a=s.type.spec.isolating||o.type.spec.isolating;if(!a&&Ig(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=L.empty;for(let b=i.length-1;b>=0;b--)p=L.from(i[b].create(null,p));p=L.from(s.copy(p));let g=n.tr.step(new Ie(e.pos-1,h,e.pos,h,new H(p,1,0),i.length,!0)),y=g.doc.resolve(h+2*i.length);y.nodeAfter&&y.nodeAfter.type==s.type&&tn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:le.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Jn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Wn(o,"start",!0)&&Wn(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=L.empty;for(let w=p.length-1;w>=0;w--)b=L.from(p[w].copy(b));let k=n.tr.step(new Ie(e.pos-p.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new H(b,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Dd(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(re.create(e.doc,n<0?s.start(o):s.end(o)))),!0):!1}}const jg=Dd(-1),Pg=Dd(1);function _g(n,e=null){return function(t,r){let{$from:s,$to:o}=t.selection,i=s.blockRange(o),l=i&&bl(i,n,e);return l?(r&&r(t.tr.wrap(i,l).scrollIntoView()),!0):!1}}function Qa(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 Ml(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}Ml(xl,xd,Sd);Ml(xl,Md,wd);Ml(Td,Ed,Ad,Rg);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Bg(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 Fg(l,i,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Fg(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 bs(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new bs(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=bl(o,t,r,e);return l?(n&&zg(n,e,l,s,t),!0):!1}function zg(n,e,t,r,s){let o=L.empty;for(let u=t.length-1;u>=0;u--)o=L.from(t[u].type.create(t[u].attrs,o));n.step(new Ie(e.start-(r?2:0),e.end,e.start,e.end,new H(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&&Dt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function $g(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?Vg(e,t,n,o):Hg(e,t,o):!0:!1}}function Vg(n,e,t,r){let s=n.tr,o=r.end,i=r.$to.end(r.depth);o<i&&(s.step(new Ie(o-1,i,o,i,new H(L.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new bs(s.doc.resolve(r.$from.pos),s.doc.resolve(i),r.depth));const l=Jn(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(o,-1)-1);return tn(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function Hg(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?L.empty:L.from(s))))return!1;let d=o.pos,f=d+i.nodeSize;return r.step(new Ie(d-(l?1:0),f+(a?1:0),d+1,f-1,new H((l?L.empty:L.from(s.copy(L.empty))).append(a?L.empty:L.from(s.copy(L.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Wg(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=L.from(c?n.create():null),d=new H(L.from(n.create(null,L.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new Ie(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Fe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Yn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ni=null;const At=function(n,e,t){let r=Ni||(Ni=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Yg=function(){Ni=null},Cn=function(n,e,t,r){return t&&(Za(n,e,t,r,-1)||Za(n,e,t,r,1))},Ug=/^(img|br|input|textarea|hr)$/i;function Za(n,e,t,r,s){for(var o;;){if(n==t&&e==r)return!0;if(e==(s<0?0:ct(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Rr(n)||Ug.test(n.nodeName)||n.contentEditable=="false")return!1;e=Fe(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?ct(n):0}else return!1}}function ct(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function qg(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=ct(n)}else if(n.parentNode&&!Rr(n))e=Fe(n),n=n.parentNode;else return null}}function Kg(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&&!Rr(n))e=Fe(n)+1,n=n.parentNode;else return null}}function Jg(n,e,t){for(let r=e==0,s=e==ct(n);r||s;){if(n==t)return!0;let o=Fe(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,s=s&&o==ct(n)}}function Rr(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 Co=function(n){return n.focusNode&&Cn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function dn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Gg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Xg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(ct(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(ct(r.startContainer),r.startOffset)}}}const kt=typeof navigator<"u"?navigator:null,ec=typeof document<"u"?document:null,nn=kt&&kt.userAgent||"",Ri=/Edge\/(\d+)/.exec(nn),Nd=/MSIE \d/.exec(nn),Li=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nn),tt=!!(Nd||Li||Ri),qt=Nd?document.documentMode:Li?+Li[1]:Ri?+Ri[1]:0,ut=!tt&&/gecko\/(\d+)/i.test(nn);ut&&+(/Firefox\/(\d+)/.exec(nn)||[0,0])[1];const Ii=!tt&&/Chrome\/(\d+)/.exec(nn),We=!!Ii,Rd=Ii?+Ii[1]:0,Ke=!tt&&!!kt&&/Apple Computer/.test(kt.vendor),Un=Ke&&(/Mobile\/\w+/.test(nn)||!!kt&&kt.maxTouchPoints>2),at=Un||(kt?/Mac/.test(kt.platform):!1),Qg=kt?/Win/.test(kt.platform):!1,Ot=/Android \d/.test(nn),Lr=!!ec&&"webkitFontSmoothing"in ec.documentElement.style,Zg=Lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ey(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 Mt(n,e){return typeof n=="number"?n:n[e]}function ty(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 tc(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=Yn(i);continue}let l=i,a=l==o.body,c=a?ey(o):ty(l),u=0,d=0;if(e.top<c.top+Mt(r,"top")?d=-(c.top-e.top+Mt(s,"top")):e.bottom>c.bottom-Mt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Mt(s,"top")-c.top:e.bottom-c.bottom+Mt(s,"bottom")),e.left<c.left+Mt(r,"left")?u=-(c.left-e.left+Mt(s,"left")):e.right>c.right-Mt(r,"right")&&(u=e.right-c.right+Mt(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:Yn(i)}}function ny(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:Ld(n.dom)}}function Ld(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Yn(r));return e}function ry({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 Rn=null;function sy(n){if(n.setActive)return n.setActive();if(Rn)return n.focus(Rn);let e=Ld(n);n.focus(Rn==null?{get preventScroll(){return Rn={preventScroll:!0},!0}}:void 0),Rn||(Rn=!1,Id(e,0))}function jd(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=At(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?oy(t,s):!t||r&&t.nodeType==1?{node:n,offset:o}:jd(t,s)}function oy(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=_t(r,1);if(o.top!=o.bottom&&wl(e,o))return{node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function wl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function iy(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function ly(n,e,t){let{node:r,offset:s}=jd(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 ay(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 Pd(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(wl(e,c))return Pd(i,e,c)}}if((o=(o+1)%r)==s)break}return n}function cy(n,e){let t=n.dom.ownerDocument,r,s=0,o=Xg(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(!wl(e,c)||(i=Pd(n.dom,e,c),!i))return null}if(Ke)for(let c=i;r&&c;c=Yn(c))c.draggable&&(r=void 0);if(i=iy(i,e),r){if(ut&&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;Lr&&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=ay(n,r,s,e))}l==null&&(l=ly(n,i,e));let a=n.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function nc(n){return n.top<n.bottom||n.left<n.right}function _t(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(nc(r))return r}return Array.prototype.find.call(t,nc)||n.getBoundingClientRect()}const uy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _d(n,e,t){let{node:r,offset:s,atom:o}=n.docView.domFromPos(e,t<0?-1:1),i=Lr||ut;if(r.nodeType==3)if(i&&(uy.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let a=_t(At(r,s,s),t);if(ut&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=_t(At(r,s-1,s-1),-1);if(c.top==a.top){let u=_t(At(r,s,s+1),-1);if(u.top!=a.top)return tr(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++,tr(_t(At(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&s&&(t<0||s==ct(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return ei(a.getBoundingClientRect(),!1)}if(o==null&&s<ct(r)){let a=r.childNodes[s];if(a.nodeType==1)return ei(a.getBoundingClientRect(),!0)}return ei(r.getBoundingClientRect(),t>=0)}if(o==null&&s&&(t<0||s==ct(r))){let a=r.childNodes[s-1],c=a.nodeType==3?At(a,ct(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return tr(_t(c,1),!1)}if(o==null&&s<ct(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?At(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return tr(_t(c,-1),!0)}return tr(_t(r.nodeType==3?At(r):r,-t),t>=0)}function tr(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 ei(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 Bd(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 dy(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return Bd(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=_d(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=At(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 fy=/[\u0590-\u08ac]/;function hy(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?!fy.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:i:Bd(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 rc=null,sc=null,oc=!1;function py(n,e,t){return rc==e&&sc==t?oc:(rc=e,sc=t,oc=t=="up"||t=="down"?dy(n,e,t):hy(n,e,t))}const dt=0,ic=1,fn=2,xt=3;class Ir{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=dt,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>Fe(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 zd){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 Fd&&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?Fe(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?Fe(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=Fe(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=Fe(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((ut||Ke)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
44
|
+
`),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:Fe(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(ut&&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&&Ke)&&Cn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Cn(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&ut)){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?fn:ic,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=xt:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?fn:xt}r=i}this.dirty=fn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?fn:ic;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Fd extends Ir{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==dt&&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 my extends Ir{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 Mn extends Ir{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=En.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Mn(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=dt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=dt}}slice(e,t,r){let s=Mn.create(this.parent,this.mark,!0,r),o=this.children,i=this.size;t<i&&(o=Pi(o,t,i,r)),e>0&&(o=Pi(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 Kt extends Ir{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}=En.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=Hd(u,r,t),c?a=new gy(e,t,r,s,u,d||null,f,c,o,i+1):t.isText?new Mo(e,t,r,s,u,f,o):new Kt(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=()=>L.empty)}return e}matchesNode(e,t,r){return this.dirty==dt&&e.eq(this.node)&&xs(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 by(this,i&&i.node,e);vy(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?be.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==fn)&&(i&&this.protectLocalComposition(e,i),$d(this.contentDOM,this.children,e),Un&&Sy(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof re)||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=Cy(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 my(this,o,t,s);e.input.compositionNodes.push(i),this.children=Pi(this.children,r,r+s.length,e,i)}update(e,t,r,s){return this.dirty==xt||!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=dt}updateOuterDeco(e){if(xs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Vd(this.dom,this.nodeDOM,ji(this.outerDeco,this.node,t),ji(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 lc(n,e,t,r,s){Hd(r,e,n);let o=new Kt(void 0,n,e,t,r,r,r,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class Mo extends Kt{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==xt||this.dirty!=dt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=dt||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=dt,!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 Mo(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=xt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zd extends Ir{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==dt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class gy extends Kt{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==xt)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 $d(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=ac(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(l,r);if(i instanceof Mn){let a=r?r.previousSibling:n.lastChild;$d(i.contentDOM,i.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=ac(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const dr=function(n){n&&(this.nodeName=n)};dr.prototype=Object.create(null);const hn=[new dr];function ji(n,e,t){if(n.length==0)return hn;let r=t?hn[0]:new dr,s=[r];for(let o=0;o<n.length;o++){let i=n[o].type.attrs;if(i){i.nodeName&&s.push(r=new dr(i.nodeName));for(let l in i){let a=i[l];a!=null&&(t&&s.length==1&&s.push(r=new dr(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 Vd(n,e,t,r){if(t==hn&&r==hn)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=hn[0]),s=a}yy(s,l||hn[0],i)}return s}function yy(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 Hd(n,e,t){return Vd(n,n,hn,ji(e,t,n.nodeType!=1))}function xs(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 ac(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class by{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ky(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=dt,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=Mn.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==xt&&i.dom==i.contentDOM&&(i.dirty=fn),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 Kt){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!=xt&&xs(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=fn,d.updateChildren(s,i+1),d.dirty=dt),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)||!xs(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=Kt.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=Kt.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 Fd(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 Mn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Mo)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ke||We)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new zd(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 ky(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 Mn)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 xy(n,e){return n.type.side-e.type.side}function vy(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(xy);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 Sy(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 Cy(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 Pi(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 Tl(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(Co(t)){for(a=i;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&ee.isSelectable(d)&&s.parent&&!(d.isInline&&Jg(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;c=new ee(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=El(n,u,l,d)}return c}function Wd(n){return n.editable?n.hasFocus():Ud(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Nt(n,e=!1){let t=n.state.selection;if(Yd(n,t),!!Wd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&We){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Cn(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)wy(n);else{let{anchor:r,head:s}=t,o,i;cc&&!(t instanceof re)&&(t.$from.parent.inlineContent||(o=uc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(i=uc(n,t.to))),n.docView.setSelection(r,s,n,e),cc&&(o&&dc(o),i&&dc(i)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&My(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const cc=Ke||We&&Rd<63;function uc(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(Ke&&s&&s.contentEditable=="false")return ti(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return ti(s);if(o)return ti(o)}}function ti(n){return n.contentEditable="true",Ke&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function dc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function My(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(()=>{(!Wd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function wy(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Fe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&tt&&qt<=11&&(t.disabled=!0,t.disabled=!1)}function Yd(n,e){if(e instanceof ee){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(fc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else fc(n)}function fc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function El(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||re.between(e,t,r)}function hc(n){return n.editable&&!n.hasFocus()?!1:Ud(n)}function Ud(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 Ty(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Cn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function _i(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&&le.findFrom(o,e)}function Bt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function pc(n,e,t){let r=n.state.selection;if(r instanceof re)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 Bt(n,new re(r.$anchor,i))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=_i(n.state,e);return s&&s instanceof ee?Bt(n,s):!1}else if(!(at&&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?ee.isSelectable(o)?Bt(n,new ee(e<0?n.state.doc.resolve(s.pos-o.nodeSize):s)):Lr?Bt(n,new re(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ee&&r.node.isInline)return Bt(n,new re(e>0?r.$to:r.$from));{let s=_i(n.state,e);return s?Bt(n,s):!1}}}function vs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function fr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ln(n,e){return e<0?Ey(n):Ay(n)}function Ey(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,o,i=!1;for(ut&&t.nodeType==1&&r<vs(t)&&fr(t.childNodes[r],-1)&&(i=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(fr(l,-1))s=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(qd(t))break;{let l=t.previousSibling;for(;l&&fr(l,-1);)s=t.parentNode,o=Fe(l),l=l.previousSibling;if(l)t=l,r=vs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}i?Bi(n,t,r):s&&Bi(n,s,o)}function Ay(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=vs(t),o,i;for(;;)if(r<s){if(t.nodeType!=1)break;let l=t.childNodes[r];if(fr(l,1))o=t,i=++r;else break}else{if(qd(t))break;{let l=t.nextSibling;for(;l&&fr(l,1);)o=l.parentNode,i=Fe(l)+1,l=l.nextSibling;if(l)t=l,r=0,s=vs(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}o&&Bi(n,o,i)}function qd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Oy(n,e){for(;n&&e==n.childNodes.length&&!Rr(n);)e=Fe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Dy(n,e){for(;n&&!e&&!Rr(n);)e=Fe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Bi(n,e,t){if(e.nodeType!=3){let o,i;(i=Oy(e,t))?(e=i,t=0):(o=Dy(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Co(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&&Nt(n)},50)}function mc(n,e){let t=n.state.doc.resolve(e);if(!(We||Qg)&&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 gc(n,e,t){let r=n.state.selection;if(r instanceof re&&!r.empty||t.indexOf("s")>-1||at&&t.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let i=_i(n.state,e);if(i&&i instanceof ee)return Bt(n,i)}if(!s.parent.inlineContent){let i=e<0?s:o,l=r instanceof rt?le.near(i,e):le.findFrom(i,e);return l?Bt(n,l):!1}return!1}function yc(n,e){if(!(n.state.selection instanceof re))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 bc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ny(n){if(!Ke||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;bc(n,r,"true"),setTimeout(()=>bc(n,r,"false"),20)}return!1}function Ry(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ly(n,e){let t=e.keyCode,r=Ry(e);if(t==8||at&&t==72&&r=="c")return yc(n,-1)||Ln(n,-1);if(t==46&&!e.shiftKey||at&&t==68&&r=="c")return yc(n,1)||Ln(n,1);if(t==13||t==27)return!0;if(t==37||at&&t==66&&r=="c"){let s=t==37?mc(n,n.state.selection.from)=="ltr"?-1:1:-1;return pc(n,s,r)||Ln(n,s)}else if(t==39||at&&t==70&&r=="c"){let s=t==39?mc(n,n.state.selection.from)=="ltr"?1:-1:1;return pc(n,s,r)||Ln(n,s)}else{if(t==38||at&&t==80&&r=="c")return gc(n,-1,r)||Ln(n,-1);if(t==40||at&&t==78&&r=="c")return Ny(n)||gc(n,1,r)||Ln(n,1);if(r==(at?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Al(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")||En.fromSchema(n.state.schema),l=Zd(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Qd[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,`
|
|
45
45
|
|
|
46
46
|
`);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 H(L.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
47
|
-
`))),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=En.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=Py(t),Lr&&_y(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")||Ut.fromSchema(n.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Ly.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=By(kc(l,+u[1],+u[2]),u[4]);else if(l=H.maxOpen(Iy(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=kc(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const Ly=/^(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 Iy(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&&Gd(a,o,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Xd(i[i.length-1],o.length));let u=Jd(l,a);i.push(u),s=s.matchType(u.type),o=a}}),i)return L.from(i)}return n}function Jd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,L.from(n));return n}function Gd(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let o=Gd(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(L.from(Jd(t,n,s+1))))}}function Xd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Xd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(r))}function Fi(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=Fi(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(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,i.copy(l))}function kc(n,e,t){return e<n.openStart&&(n=new H(Fi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new H(Fi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Qd={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 xc=null;function Zd(){return xc||(xc=document.implementation.createHTMLDocument("title"))}let ni=null;function jy(n){let e=window.trustedTypes;return e?(ni||(ni=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ni.createHTML(n)):n}function Py(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Zd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Qd[r[1].toLowerCase()])&&(n=s.map(o=>"<"+o+">").join("")+n+s.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=jy(n),s)for(let o=0;o<s.length;o++)t=t.querySelector(s[o])||t;return t}function _y(n){let e=n.querySelectorAll(We?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function By(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=L.from(a.create(r[l+1],s)),o++,i++}return new H(s,o,i)}const Je={},Ge={},Fy={touchstart:!0,touchmove:!0};class zy{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 $y(n){for(let e in Je){let t=Je[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Hy(n,r)&&!Ol(n,r)&&(n.editable||!(r.type in Ge))&&t(n,r)},Fy[e]?{passive:!0}:void 0)}Ke&&n.dom.addEventListener("input",()=>null),zi(n)}function Yt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Vy(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 zi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ol(n,r))})}function Ol(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Hy(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 Wy(n,e){!Ol(n,e)&&Je[e.type]&&(n.editable||!(e.type in Ge))&&Je[e.type](n,e)}Ge.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!tf(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ot&&We&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Un&&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,dn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ry(n,t)?t.preventDefault():Yt(n,"key")};Ge.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ge.keypress=(n,e)=>{let t=e;if(tf(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||at&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof re)||!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 wo(n){return{left:n.clientX,top:n.clientY}}function Yy(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Dl(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 Vn(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 Uy(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(Vn(n,new ee(t)),!0):!1}function qy(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof ee&&(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(ee.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?(Vn(n,ee.create(n.state.doc,s)),!0):!1}function Ky(n,e,t,r,s){return Dl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(s?qy(n,t):Uy(n,t))}function Jy(n,e,t,r){return Dl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function Gy(n,e,t,r){return Dl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Xy(n,t,r)}function Xy(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Vn(n,re.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)Vn(n,re.create(r,l+1,l+1+i.content.size));else if(ee.isSelectable(i))Vn(n,ee.create(r,l));else continue;return!0}}function Nl(n){return Ss(n)}const ef=at?"metaKey":"ctrlKey";Je.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Nl(n),s=Date.now(),o="singleClick";s-n.input.lastClick.time<500&&Yy(t,n.input.lastClick)&&!t[ef]&&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(wo(t));i&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Qy(n,i,t,!!r)):(o=="doubleClick"?Jy:Gy)(n,i.pos,i.inside,t)?t.preventDefault():Yt(n,"pointer"))};class Qy{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[ef],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 ee&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ut&&!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)),Yt(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(()=>Nt(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(wo(e))),this.updateAllowDefault(e),this.allowDefault||!t?Yt(this.view,"pointer"):Ky(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ke&&this.mightDrag&&!this.mightDrag.node.isAtom||We&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Vn(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yt(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)}}Je.touchstart=n=>{n.input.lastTouch=Date.now(),Nl(n),Yt(n,"pointer")};Je.touchmove=n=>{n.input.lastTouch=Date.now(),Yt(n,"pointer")};Je.contextmenu=n=>Nl(n);function tf(n,e){return n.composing?!0:Ke&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Zy=Ot?5e3:-1;Ge.compositionstart=Ge.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof re&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ss(n,!0),n.markCursor=null;else if(Ss(n,!e.selection.empty),ut&&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}nf(n,Zy)};Ge.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++,nf(n,20))};function nf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ss(n),e))}function rf(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=t0());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function e0(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Ug(e.focusNode,e.focusOffset),r=qg(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 t0(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ss(n,e=!1){if(!(Ot&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),rf(n),e||n.docView&&n.docView.dirty){let t=Tl(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 n0(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 Mr=tt&&qt<15||Un&&Qg<604;Je.copy=Ge.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let o=Mr?null:t.clipboardData,i=r.content(),{dom:l,text:a}=Al(n,i);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):n0(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function r0(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function s0(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?wr(n,r.value,null,s,e):wr(n,r.textContent,r.innerHTML,s,e)},50)}function wr(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||H.empty)))return!0;if(!o)return!1;let i=r0(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 sf(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," "):""}Ge.paste=(n,e)=>{let t=e;if(n.composing&&!Ot)return;let r=Mr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&wr(n,sf(r),r.getData("text/html"),s,t)?t.preventDefault():s0(n,t)};class of{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const o0=at?"altKey":"ctrlKey";function lf(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[o0]}Je.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(wo(t)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof ee?s.to-1:s.to))){if(r&&r.mightDrag)i=ee.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=ee.create(n.state.doc,d.posBefore))}}let l=(i||n.state.selection).content(),{dom:a,text:c,slice:u}=Al(n,l);(!t.dataTransfer.files.length||!We||Rd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Mr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Mr||t.dataTransfer.setData("text/plain",c),n.dragging=new of(u,lf(n,t),i)};Je.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ge.dragover=Ge.dragenter=(n,e)=>e.preventDefault();Ge.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let s=n.posAtCoords(wo(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,sf(t.dataTransfer),Mr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&lf(n,t));if(n.someProp("handleDrop",p=>p(n,t,i||H.empty,l))){t.preventDefault();return}if(!i)return;t.preventDefault();let a=i?dd(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&&ee.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ee(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(El(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Je.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())&&Nt(n)},20))};Je.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)};Je.beforeinput=(n,e)=>{if(We&&Ot&&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,dn(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 Ge)Je[n]=Ge[n];function Tr(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 Cs{constructor(e,t){this.toDOM=e,this.spec=t||bn,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 Cs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Jt{constructor(e,t){this.attrs=e,this.spec=t||bn}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 Jt&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}static is(e){return e.type instanceof Jt}destroy(){}}class Rl{constructor(e,t){this.attrs=e,this.spec=t||bn}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 Rl&&Tr(this.attrs,e.attrs)&&Tr(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 Cs(t,r))}static inline(e,t,r,s){return new qe(e,t,new Jt(r,s))}static node(e,t,r,s){return new qe(e,t,new Rl(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jt}get widget(){return this.type instanceof Cs}}const jn=[],bn={};class Se{constructor(e,t){this.local=e.length?e:jn,this.children=t.length?t:jn}static create(e,t){return t.length?Ms(t,e,0,bn):$e}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==$e||e.maps.length==0?this:this.mapInner(e,t,0,0,r||bn)}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?i0(this.children,i||[],e,t,r,s,o):i?new Se(i.sort(kn),jn):$e}add(e,t){return t.length?this==$e?Se.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=cf(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,Ms(u,l,c+1,bn)),o+=3}});let i=af(o?uf(t):t,-r);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new Se(i.length?this.local.concat(i).sort(kn):this.local,s||this.children)}remove(e){return e.length==0||this==$e?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!=$e?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 Se(s,r):$e}forChild(e,t){if(this==$e)return this;if(t.isLeaf)return Se.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 Jt){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 Se(s.sort(kn),jn);return r?new $t([l,r]):l}return r||$e}eq(e){if(this==e)return!0;if(!(e instanceof Se)||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 Ll(this.localsInner(e))}localsInner(e){if(this==$e)return jn;if(e.inlineContent||!this.local.some(Jt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Se.empty=new Se([],[]);Se.removeOverlap=Ll;const $e=Se.empty;class $t{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,bn));return $t.from(r)}forChild(e,t){if(t.isLeaf)return Se.empty;let r=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,t);o!=$e&&(o instanceof $t?r=r.concat(o.members):r.push(o))}return $t.from(r)}eq(e){if(!(e instanceof $t)||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?Ll(r?t:t.sort(kn)):jn}static from(e){switch(e.length){case 0:return $e;case 1:return e[0];default:return new $t(e.every(t=>t instanceof Se)?e:e.reduce((t,r)=>t.concat(r instanceof Se?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function i0(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 w=l[b]+u-d;h>=w?l[b+1]=f<=w?-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!=$e?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=l0(l,n,e,t,s,o,i),u=Ms(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 Se(e.sort(kn),l)}function af(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 l0(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 cf(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 uf(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ms(n,e,t,r){let s=[],o=!1;e.forEach((l,a)=>{let c=cf(n,l,a+t);if(c){o=!0;let u=Ms(c,l,t+a+1,r);u!=$e&&s.push(a,a+l.nodeSize,u)}});let i=af(o?uf(n):n,-t).sort(kn);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 Se(i,s):$e}function kn(n,e){return n.from-e.from||n.to-e.to}function Ll(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),vc(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),vc(e,s,r.copy(o.from,r.to)));break}}}return e}function vc(n,e,t){for(;e<n.length&&kn(t,n[e])>0;)e++;n.splice(e,0,t)}function ri(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=$e&&e.push(r)}),n.cursorWrapper&&e.push(Se.create(n.state.doc,[n.cursorWrapper.deco])),$t.from(e)}const a0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},c0=tt&&qt<=11;class u0{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 d0{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new u0,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]);tt&&qt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),c0&&(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,a0)),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(hc(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(tt&&qt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Cn(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=Yn(o))t.add(o);for(let o=e.anchorNode;o;o=Yn(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)&&hc(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(ut&&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||p0(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&&Co(r)&&(c=Tl(e))&&c.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Nt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||s)&&(o>-1&&(e.docView.markDirty(o,i),f0(e)),this.handleDOMChange(o,i,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Nt(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(tt&&qt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let i=s&&s.parentNode==e.target?Fe(s)+1:0,l=r.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Fe(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 Sc=new WeakMap,Cc=!1;function f0(n){if(!Sc.has(n)&&(Sc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ut,Cc)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."),Cc=!0}}function Mc(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,o=e.endOffset,i=n.domAtPos(n.state.selection.anchor);return Cn(i.node,i.offset,s,o)&&([t,r,s,o]=[s,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:o}}function h0(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Mc(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?Mc(n,t):null}function p0(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 m0(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}],Co(a)||c.push({node:a.focusNode,offset:a.focusOffset})),We&&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")||Ut.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:g0,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 g0(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ke&&/^(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||Ke&&/^(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 y0=/^(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 b0(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=Tl(n,M);if(O&&!n.state.selection.eq(O)){if(We&&Ot&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",B=>B(n,dn(13,"Enter"))))return;let j=n.state.tr.setSelection(O);M=="pointer"?j.setMeta("pointer",!0):M=="key"&&j.scrollIntoView(),o&&j.setMeta("composition",o),n.dispatch(j)}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=m0(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=v0(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Un&&n.input.lastIOSEnter>Date.now()-225||Ot)&&s.some(M=>M.nodeType==1&&!y0.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof re&&!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=wc(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 re&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),tt&&qt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let 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((Un&&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,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&x0(u,p.start,p.endA,g,y)&&n.someProp("handleKeyDown",M=>M(n,dn(8,"Backspace")))){Ot&&We&&n.domObserver.suppressSelectionUpdates();return}We&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Ot&&!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,dn(13,"Enter"))})},20));let w=p.start,E=p.endA,C=M=>{let O=M||n.state.tr.replace(w,E,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let j=wc(n,O.doc,c.sel);j&&!(We&&n.composing&&j.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(j.head==w||j.head==O.mapping.map(E)-1)||tt&&j.empty&&j.head==w)&&O.setSelection(j)}return o&&O.setMeta("composition",o),O.scrollIntoView()},x;if(k)if(g.pos==y.pos){tt&&qt<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(n),20));let M=C(n.state.tr.delete(w,E)),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));O&&M.ensureMarks(O),n.dispatch(M)}else if(p.endA==p.endB&&(x=k0(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let M=C(n.state.tr);x.type=="add"?M.addMark(w,E,x.mark):M.removeMark(w,E,x.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=()=>C(n.state.tr.insertText(M,w,E));n.someProp("handleTextInput",j=>j(n,w,E,M,O))||n.dispatch(O())}else n.dispatch(C());else n.dispatch(C())}function wc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:El(n,e.resolve(t.anchor),e.resolve(t.head))}function k0(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(L.from(c).eq(n))return{mark:l,type:i}}function x0(n,e,t,r,s){if(t-e<=s.pos-r.pos||si(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(si(o,!0,!0));return!i.parent.isTextblock||i.pos>t||si(i,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function si(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 v0(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&&Tc(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&&Tc(n.textBetween(o-1,o+1))&&(o+=a?1:-1),i=o+(i-l),l=o}return{start:o,endA:i,endB:l}}function Tc(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 df{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 zy,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Nc),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=Oc(this),Ac(this),this.nodeViews=Dc(this),this.docView=lc(this.state.doc,Ec(this),ri(this),this.dom,this),this.domObserver=new d0(this,(r,s,o,i)=>b0(this,r,s,o,i)),this.domObserver.start(),$y(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&&zi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Nc),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&&(rf(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=Dc(this);C0(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&zi(this),this.editable=Oc(this),Ac(this);let a=ri(this),c=Ec(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&&ty(this);if(i){this.domObserver.stop();let h=d&&(tt||We)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&S0(s.selection,e.selection);if(d){let p=We?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=e0(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=lc(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wy(this))?Nt(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&&ny(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 ee){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&tc(this,t.getBoundingClientRect(),e)}else tc(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 of(e.slice,e.move,s<0?void 0:ee.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(tt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ry(this.dom),Nt(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 ay(this,e)}coordsAtPos(e,t=1){return _d(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 hy(this,t||this.state,e)}pasteHTML(e,t){return wr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return wr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Al(this,e)}destroy(){this.docView&&(Vy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ri(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Wg())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Wy(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ke&&this.root.nodeType===11&&Jg(this.dom.ownerDocument)==this.dom&&h0(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}df.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Ec(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 Ac(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 Oc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function S0(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 Dc(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 C0(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 Nc(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 Gt={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:"'"},ws={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},M0=typeof navigator<"u"&&/Mac/.test(navigator.platform),w0=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ze=0;ze<10;ze++)Gt[48+ze]=Gt[96+ze]=String(ze);for(var ze=1;ze<=24;ze++)Gt[ze+111]="F"+ze;for(var ze=65;ze<=90;ze++)Gt[ze]=String.fromCharCode(ze+32),ws[ze]=String.fromCharCode(ze);for(var oi in Gt)ws.hasOwnProperty(oi)||(ws[oi]=Gt[oi]);function T0(n){var e=M0&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||w0&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ws:Gt)[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 E0=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),A0=typeof navigator<"u"&&/Win/.test(navigator.platform);function O0(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))E0?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 D0(n){let e=Object.create(null);for(let t in n)e[O0(t)]=n[t];return e}function ii(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function N0(n){return new Te({props:{handleKeyDown:ff(n)}})}function ff(n){let e=D0(n);return function(t,r){let s=T0(r),o,i=e[ii(s,r)];if(i&&i(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[ii(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(A0&&r.ctrlKey&&r.altKey)&&(o=Gt[r.keyCode])&&o!=s){let l=e[ii(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var R0=Object.defineProperty,Il=(n,e)=>{for(var t in e)R0(n,t,{get:e[t],enumerable:!0})};function To(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 Eo=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:To({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}},hf={};Il(hf,{blur:()=>L0,clearContent:()=>I0,clearNodes:()=>j0,command:()=>P0,createParagraphNear:()=>_0,cut:()=>B0,deleteCurrentNode:()=>F0,deleteNode:()=>z0,deleteRange:()=>$0,deleteSelection:()=>V0,enter:()=>H0,exitCode:()=>W0,extendMarkRange:()=>Y0,first:()=>U0,focus:()=>K0,forEach:()=>J0,insertContent:()=>G0,insertContentAt:()=>Z0,joinBackward:()=>nb,joinDown:()=>tb,joinForward:()=>rb,joinItemBackward:()=>sb,joinItemForward:()=>ob,joinTextblockBackward:()=>ib,joinTextblockForward:()=>lb,joinUp:()=>eb,keyboardShortcut:()=>cb,lift:()=>ub,liftEmptyBlock:()=>db,liftListItem:()=>fb,newlineInCode:()=>hb,resetAttributes:()=>pb,scrollIntoView:()=>mb,selectAll:()=>gb,selectNodeBackward:()=>yb,selectNodeForward:()=>bb,selectParentNode:()=>kb,selectTextblockEnd:()=>xb,selectTextblockStart:()=>vb,setContent:()=>Sb,setMark:()=>zb,setMeta:()=>$b,setNode:()=>Vb,setNodeSelection:()=>Hb,setTextSelection:()=>Wb,sinkListItem:()=>Yb,splitBlock:()=>Ub,splitListItem:()=>qb,toggleList:()=>Kb,toggleMark:()=>Jb,toggleNode:()=>Gb,toggleWrap:()=>Xb,undoInputRule:()=>Qb,unsetAllMarks:()=>Zb,unsetMark:()=>ek,updateAttributes:()=>tk,wrapIn:()=>nk,wrapInList:()=>rk});var L0=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),I0=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),j0=()=>({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=Jn(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},P0=n=>e=>n(e),_0=()=>({state:n,dispatch:e})=>Ed(n,e),B0=(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 re(r.doc.resolve(Math.max(i-1,0)))),!0},F0=()=>({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};function Re(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}var z0=n=>({tr:e,state:t,dispatch:r})=>{const s=Re(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},$0=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},V0=()=>({state:n,dispatch:e})=>xl(n,e),H0=()=>({commands:n})=>n.keyboardShortcut("Enter"),W0=()=>({state:n,dispatch:e})=>Og(n,e);function jl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ts(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:jl(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function pf(n,e,t={}){return n.find(r=>r.type===e&&Ts(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Rc(n,e,t={}){return!!pf(n,e,t)}function Pl(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),!pf([...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&&Rc([...n.parent.child(i-1).marks],e,t);)i-=1,l-=n.parent.child(i).nodeSize;for(;a<n.parent.childCount&&Rc([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Lt(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}var Y0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const o=Lt(n,r.schema),{doc:i,selection:l}=t,{$from:a,from:c,to:u}=l;if(s){const d=Pl(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=re.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 mf(n){return n instanceof re}function pn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function gf(n,e=null){if(!e)return null;const t=le.atStart(n),r=le.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,o=r.to;return e==="all"?re.create(n,pn(0,s,o),pn(n.content.size,s,o)):re.create(n,pn(e,s,o),pn(e,s,o))}function q0(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function _l(){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=()=>{(_l()||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&&!mf(t.state.selection))return i(),!0;const l=gf(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},J0=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),G0=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),yf=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&&yf(r)}return n};function Ur(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 yf(t)}function Er(n,e,t){if(n instanceof mt||n instanceof L)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 L.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),Er("",e,t)}if(s){if(t.errorOnInvalidContent){let i=!1,l="";const a=new ed({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?Ut.fromSchema(a).parseSlice(Ur(n),t.parseOptions):Ut.fromSchema(a).parse(Ur(n),t.parseOptions),t.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=Ut.fromSchema(e);return t.slice?o.parseSlice(Ur(n),t.parseOptions).content:o.parse(Ur(n),t.parseOptions)}return Er("",e,t)}function X0(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof Le||s instanceof Ie))return;const o=n.mapping.maps[r];let i=0;o.forEach((l,a,c,u)=>{i===0&&(i=u)}),n.setSelection(le.near(n.doc.resolve(i),t))}var Q0=n=>!("type"in n),Z0=(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{Er(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Er(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((Q0(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 L){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,w=b.isText||b.isTextblock,E=b.content.size>0;k&&w&&E&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}t.updateSelection&&X0(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},eb=()=>({state:n,dispatch:e})=>Tg(n,e),tb=()=>({state:n,dispatch:e})=>Eg(n,e),nb=()=>({state:n,dispatch:e})=>xd(n,e),rb=()=>({state:n,dispatch:e})=>Md(n,e),sb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xo(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ob=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xo(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ib=()=>({state:n,dispatch:e})=>Mg(n,e),lb=()=>({state:n,dispatch:e})=>wg(n,e);function bf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ab(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))_l()||bf()?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 cb=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const o=ab(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};function Xt(n,e,t={}){const{from:r,to:s,empty:o}=n.selection,i=e?Re(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=>Ts(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var ub=(n,e={})=>({state:t,dispatch:r})=>{const s=Re(n,t.schema);return Xt(t,s,e)?Ag(t,r):!1},db=()=>({state:n,dispatch:e})=>Ad(n,e),fb=n=>({state:e,dispatch:t})=>{const r=Re(n,e.schema);return zg(r)(e,t)},hb=()=>({state:n,dispatch:e})=>Td(n,e);function Ao(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Lc(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 pb=(n,e)=>({tr:t,state:r,dispatch:s})=>{let o=null,i=null;const l=Ao(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Re(n,r.schema)),l==="mark"&&(i=Lt(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,Lc(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(d=>{i===d.type&&t.addMark(u,u+c.nodeSize,i.create(Lc(d.attrs,e)))})})}),!0):!1},mb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),gb=()=>({tr:n,dispatch:e})=>{if(e){const t=new rt(n.doc);n.setSelection(t)}return!0},yb=()=>({state:n,dispatch:e})=>Sd(n,e),bb=()=>({state:n,dispatch:e})=>wd(n,e),kb=()=>({state:n,dispatch:e})=>Rg(n,e),xb=()=>({state:n,dispatch:e})=>jg(n,e),vb=()=>({state:n,dispatch:e})=>Ig(n,e);function $i(n,e,t={},r={}){return Er(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Sb=(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=$i(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 kf(n,e){const t=Lt(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 xf(n,e){const t=new gd(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function Cb(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 Mb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,o)=>{t(s)&&r.push({node:s,pos:o})}),r}function wb(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 Oo(n){return e=>wb(e.$from,n)}function Z(n,e,t){return n.config[e]===void 0&&n.parent?Z(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Z(n.parent,e,t):null}):n.config[e]}function Bl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=Z(e,"addExtensions",t);return r?[e,...Bl(r())]:e}).flat(10)}function Fl(n,e){const t=En.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}function vf(n){return typeof n=="function"}function ye(n,e=void 0,...t){return vf(n)?e?n.bind(e)(...t):n(...t):n}function Tb(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ar(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 Sf(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ar(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=Z(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=Z(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 Ce(...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 Es(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)=>Ce(t,r),{})}function Eb(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Ic(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):Eb(t.getAttribute(i.name));return l==null?o:{...o,[i.name]:l}},{});return{...r,...s}}}}function jc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Tb(t)?!1:t!=null))}function Pc(n){var e,t,r;const s={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&((t=n==null?void 0:n.attribute)==null?void 0:t.default)!==void 0&&(s.default=n.attribute.default),((r=n==null?void 0:n.attribute)==null?void 0:r.validate)!==void 0&&(s.validate=n.attribute.validate),[n.name,s]}function Ab(n,e){var t;const r=Sf(n),{nodeExtensions:s,markExtensions:o}=Ar(n),i=(t=s.find(c=>Z(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 w=Z(k,"extendNodeSchema",d);return{...b,...w?w(c):{}}},{}),h=jc({...f,content:ye(Z(c,"content",d)),marks:ye(Z(c,"marks",d)),group:ye(Z(c,"group",d)),inline:ye(Z(c,"inline",d)),atom:ye(Z(c,"atom",d)),selectable:ye(Z(c,"selectable",d)),draggable:ye(Z(c,"draggable",d)),code:ye(Z(c,"code",d)),whitespace:ye(Z(c,"whitespace",d)),linebreakReplacement:ye(Z(c,"linebreakReplacement",d)),defining:ye(Z(c,"defining",d)),isolating:ye(Z(c,"isolating",d)),attrs:Object.fromEntries(u.map(Pc))}),p=ye(Z(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>Ic(b,u)));const g=Z(c,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Es(b,u)}));const y=Z(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=Z(b,"extendMarkSchema",d);return{...y,...k?k(c):{}}},{}),h=jc({...f,inclusive:ye(Z(c,"inclusive",d)),excludes:ye(Z(c,"excludes",d)),group:ye(Z(c,"group",d)),spanning:ye(Z(c,"spanning",d)),code:ye(Z(c,"code",d)),attrs:Object.fromEntries(u.map(Pc))}),p=ye(Z(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Ic(y,u)));const g=Z(c,"renderHTML",d);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Es(y,u)})),[c.name,h]}));return new ed({topNode:i,nodes:l,marks:a})}function Ob(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function zl(n){return n.sort((t,r)=>{const s=Z(t,"priority")||100,o=Z(r,"priority")||100;return s>o?-1:s<o?1:0})}function Cf(n){const e=zl(Bl(n)),t=Ob(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 Mf(n,e,t){const{from:r,to:s}=e,{blockSeparator:o=`
|
|
47
|
+
`))),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=En.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=_y(t),Lr&&By(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")||Ut.fromSchema(n.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Iy.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Fy(kc(l,+u[1],+u[2]),u[4]);else if(l=H.maxOpen(jy(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=kc(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,a)}),l}const Iy=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function jy(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&&Gd(a,o,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Xd(i[i.length-1],o.length));let u=Jd(l,a);i.push(u),s=s.matchType(u.type),o=a}}),i)return L.from(i)}return n}function Jd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,L.from(n));return n}function Gd(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let o=Gd(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(L.from(Jd(t,n,s+1))))}}function Xd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Xd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(r))}function Fi(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=Fi(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(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,i.copy(l))}function kc(n,e,t){return e<n.openStart&&(n=new H(Fi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new H(Fi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Qd={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 xc=null;function Zd(){return xc||(xc=document.implementation.createHTMLDocument("title"))}let ni=null;function Py(n){let e=window.trustedTypes;return e?(ni||(ni=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ni.createHTML(n)):n}function _y(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Zd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Qd[r[1].toLowerCase()])&&(n=s.map(o=>"<"+o+">").join("")+n+s.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=Py(n),s)for(let o=0;o<s.length;o++)t=t.querySelector(s[o])||t;return t}function By(n){let e=n.querySelectorAll(We?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Fy(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=L.from(a.create(r[l+1],s)),o++,i++}return new H(s,o,i)}const Je={},Ge={},zy={touchstart:!0,touchmove:!0};class $y{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 Vy(n){for(let e in Je){let t=Je[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Wy(n,r)&&!Ol(n,r)&&(n.editable||!(r.type in Ge))&&t(n,r)},zy[e]?{passive:!0}:void 0)}Ke&&n.dom.addEventListener("input",()=>null),zi(n)}function Yt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Hy(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function zi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ol(n,r))})}function Ol(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Wy(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 Yy(n,e){!Ol(n,e)&&Je[e.type]&&(n.editable||!(e.type in Ge))&&Je[e.type](n,e)}Ge.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!tf(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ot&&We&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Un&&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,dn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ly(n,t)?t.preventDefault():Yt(n,"key")};Ge.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ge.keypress=(n,e)=>{let t=e;if(tf(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||at&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof re)||!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 wo(n){return{left:n.clientX,top:n.clientY}}function Uy(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Dl(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 Vn(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 qy(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(Vn(n,new ee(t)),!0):!1}function Ky(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof ee&&(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(ee.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?(Vn(n,ee.create(n.state.doc,s)),!0):!1}function Jy(n,e,t,r,s){return Dl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(s?Ky(n,t):qy(n,t))}function Gy(n,e,t,r){return Dl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function Xy(n,e,t,r){return Dl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||Qy(n,t,r)}function Qy(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Vn(n,re.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)Vn(n,re.create(r,l+1,l+1+i.content.size));else if(ee.isSelectable(i))Vn(n,ee.create(r,l));else continue;return!0}}function Nl(n){return Ss(n)}const ef=at?"metaKey":"ctrlKey";Je.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Nl(n),s=Date.now(),o="singleClick";s-n.input.lastClick.time<500&&Uy(t,n.input.lastClick)&&!t[ef]&&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(wo(t));i&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Zy(n,i,t,!!r)):(o=="doubleClick"?Gy:Xy)(n,i.pos,i.inside,t)?t.preventDefault():Yt(n,"pointer"))};class Zy{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[ef],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 ee&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ut&&!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)),Yt(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(()=>Nt(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(wo(e))),this.updateAllowDefault(e),this.allowDefault||!t?Yt(this.view,"pointer"):Jy(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ke&&this.mightDrag&&!this.mightDrag.node.isAtom||We&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Vn(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yt(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)}}Je.touchstart=n=>{n.input.lastTouch=Date.now(),Nl(n),Yt(n,"pointer")};Je.touchmove=n=>{n.input.lastTouch=Date.now(),Yt(n,"pointer")};Je.contextmenu=n=>Nl(n);function tf(n,e){return n.composing?!0:Ke&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const e0=Ot?5e3:-1;Ge.compositionstart=Ge.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof re&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ss(n,!0),n.markCursor=null;else if(Ss(n,!e.selection.empty),ut&&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}nf(n,e0)};Ge.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++,nf(n,20))};function nf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ss(n),e))}function rf(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=n0());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function t0(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=qg(e.focusNode,e.focusOffset),r=Kg(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 n0(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ss(n,e=!1){if(!(Ot&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),rf(n),e||n.docView&&n.docView.dirty){let t=Tl(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 r0(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 Mr=tt&&qt<15||Un&&Zg<604;Je.copy=Ge.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let o=Mr?null:t.clipboardData,i=r.content(),{dom:l,text:a}=Al(n,i);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):r0(n,l),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function s0(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function o0(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?wr(n,r.value,null,s,e):wr(n,r.textContent,r.innerHTML,s,e)},50)}function wr(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||H.empty)))return!0;if(!o)return!1;let i=s0(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 sf(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," "):""}Ge.paste=(n,e)=>{let t=e;if(n.composing&&!Ot)return;let r=Mr?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&wr(n,sf(r),r.getData("text/html"),s,t)?t.preventDefault():o0(n,t)};class of{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const i0=at?"altKey":"ctrlKey";function lf(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[i0]}Je.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(wo(t)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof ee?s.to-1:s.to))){if(r&&r.mightDrag)i=ee.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=ee.create(n.state.doc,d.posBefore))}}let l=(i||n.state.selection).content(),{dom:a,text:c,slice:u}=Al(n,l);(!t.dataTransfer.files.length||!We||Rd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Mr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Mr||t.dataTransfer.setData("text/plain",c),n.dragging=new of(u,lf(n,t),i)};Je.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ge.dragover=Ge.dragenter=(n,e)=>e.preventDefault();Ge.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let s=n.posAtCoords(wo(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,sf(t.dataTransfer),Mr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&lf(n,t));if(n.someProp("handleDrop",p=>p(n,t,i||H.empty,l))){t.preventDefault();return}if(!i)return;t.preventDefault();let a=i?dd(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&&ee.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ee(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(El(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Je.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())&&Nt(n)},20))};Je.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)};Je.beforeinput=(n,e)=>{if(We&&Ot&&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,dn(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 Ge)Je[n]=Ge[n];function Tr(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 Cs{constructor(e,t){this.toDOM=e,this.spec=t||bn,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 Cs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Jt{constructor(e,t){this.attrs=e,this.spec=t||bn}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 Jt&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}static is(e){return e.type instanceof Jt}destroy(){}}class Rl{constructor(e,t){this.attrs=e,this.spec=t||bn}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 Rl&&Tr(this.attrs,e.attrs)&&Tr(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 Cs(t,r))}static inline(e,t,r,s){return new qe(e,t,new Jt(r,s))}static node(e,t,r,s){return new qe(e,t,new Rl(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jt}get widget(){return this.type instanceof Cs}}const jn=[],bn={};class Se{constructor(e,t){this.local=e.length?e:jn,this.children=t.length?t:jn}static create(e,t){return t.length?Ms(t,e,0,bn):$e}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==$e||e.maps.length==0?this:this.mapInner(e,t,0,0,r||bn)}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?l0(this.children,i||[],e,t,r,s,o):i?new Se(i.sort(kn),jn):$e}add(e,t){return t.length?this==$e?Se.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=cf(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,Ms(u,l,c+1,bn)),o+=3}});let i=af(o?uf(t):t,-r);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new Se(i.length?this.local.concat(i).sort(kn):this.local,s||this.children)}remove(e){return e.length==0||this==$e?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!=$e?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 Se(s,r):$e}forChild(e,t){if(this==$e)return this;if(t.isLeaf)return Se.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 Jt){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 Se(s.sort(kn),jn);return r?new $t([l,r]):l}return r||$e}eq(e){if(this==e)return!0;if(!(e instanceof Se)||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 Ll(this.localsInner(e))}localsInner(e){if(this==$e)return jn;if(e.inlineContent||!this.local.some(Jt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Se.empty=new Se([],[]);Se.removeOverlap=Ll;const $e=Se.empty;class $t{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,bn));return $t.from(r)}forChild(e,t){if(t.isLeaf)return Se.empty;let r=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,t);o!=$e&&(o instanceof $t?r=r.concat(o.members):r.push(o))}return $t.from(r)}eq(e){if(!(e instanceof $t)||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?Ll(r?t:t.sort(kn)):jn}static from(e){switch(e.length){case 0:return $e;case 1:return e[0];default:return new $t(e.every(t=>t instanceof Se)?e:e.reduce((t,r)=>t.concat(r instanceof Se?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function l0(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 w=l[b]+u-d;h>=w?l[b+1]=f<=w?-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!=$e?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=a0(l,n,e,t,s,o,i),u=Ms(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 Se(e.sort(kn),l)}function af(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 a0(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 cf(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 uf(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ms(n,e,t,r){let s=[],o=!1;e.forEach((l,a)=>{let c=cf(n,l,a+t);if(c){o=!0;let u=Ms(c,l,t+a+1,r);u!=$e&&s.push(a,a+l.nodeSize,u)}});let i=af(o?uf(n):n,-t).sort(kn);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 Se(i,s):$e}function kn(n,e){return n.from-e.from||n.to-e.to}function Ll(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),vc(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),vc(e,s,r.copy(o.from,r.to)));break}}}return e}function vc(n,e,t){for(;e<n.length&&kn(t,n[e])>0;)e++;n.splice(e,0,t)}function ri(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=$e&&e.push(r)}),n.cursorWrapper&&e.push(Se.create(n.state.doc,[n.cursorWrapper.deco])),$t.from(e)}const c0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},u0=tt&&qt<=11;class d0{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 f0{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new d0,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]);tt&&qt<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),u0&&(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,c0)),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(hc(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(tt&&qt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Cn(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=Yn(o))t.add(o);for(let o=e.anchorNode;o;o=Yn(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)&&hc(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(ut&&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||m0(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&&Co(r)&&(c=Tl(e))&&c.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Nt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||s)&&(o>-1&&(e.docView.markDirty(o,i),h0(e)),this.handleDOMChange(o,i,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Nt(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(tt&&qt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let i=s&&s.parentNode==e.target?Fe(s)+1:0,l=r.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Fe(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 Sc=new WeakMap,Cc=!1;function h0(n){if(!Sc.has(n)&&(Sc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ut,Cc)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."),Cc=!0}}function Mc(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,o=e.endOffset,i=n.domAtPos(n.state.selection.anchor);return Cn(i.node,i.offset,s,o)&&([t,r,s,o]=[s,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:o}}function p0(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Mc(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?Mc(n,t):null}function m0(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 g0(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}],Co(a)||c.push({node:a.focusNode,offset:a.focusOffset})),We&&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")||Ut.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:y0,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 y0(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ke&&/^(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||Ke&&/^(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 b0=/^(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 k0(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=Tl(n,M);if(O&&!n.state.selection.eq(O)){if(We&&Ot&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",B=>B(n,dn(13,"Enter"))))return;let j=n.state.tr.setSelection(O);M=="pointer"?j.setMeta("pointer",!0):M=="key"&&j.scrollIntoView(),o&&j.setMeta("composition",o),n.dispatch(j)}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=g0(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=S0(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Un&&n.input.lastIOSEnter>Date.now()-225||Ot)&&s.some(M=>M.nodeType==1&&!b0.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof re&&!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=wc(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 re&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),tt&&qt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let 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((Un&&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,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&v0(u,p.start,p.endA,g,y)&&n.someProp("handleKeyDown",M=>M(n,dn(8,"Backspace")))){Ot&&We&&n.domObserver.suppressSelectionUpdates();return}We&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Ot&&!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,dn(13,"Enter"))})},20));let w=p.start,E=p.endA,C=M=>{let O=M||n.state.tr.replace(w,E,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let j=wc(n,O.doc,c.sel);j&&!(We&&n.composing&&j.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(j.head==w||j.head==O.mapping.map(E)-1)||tt&&j.empty&&j.head==w)&&O.setSelection(j)}return o&&O.setMeta("composition",o),O.scrollIntoView()},x;if(k)if(g.pos==y.pos){tt&&qt<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(n),20));let M=C(n.state.tr.delete(w,E)),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));O&&M.ensureMarks(O),n.dispatch(M)}else if(p.endA==p.endB&&(x=x0(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let M=C(n.state.tr);x.type=="add"?M.addMark(w,E,x.mark):M.removeMark(w,E,x.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=()=>C(n.state.tr.insertText(M,w,E));n.someProp("handleTextInput",j=>j(n,w,E,M,O))||n.dispatch(O())}else n.dispatch(C());else n.dispatch(C())}function wc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:El(n,e.resolve(t.anchor),e.resolve(t.head))}function x0(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(L.from(c).eq(n))return{mark:l,type:i}}function v0(n,e,t,r,s){if(t-e<=s.pos-r.pos||si(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(si(o,!0,!0));return!i.parent.isTextblock||i.pos>t||si(i,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function si(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 S0(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&&Tc(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&&Tc(n.textBetween(o-1,o+1))&&(o+=a?1:-1),i=o+(i-l),l=o}return{start:o,endA:i,endB:l}}function Tc(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 df{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 $y,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Nc),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=Oc(this),Ac(this),this.nodeViews=Dc(this),this.docView=lc(this.state.doc,Ec(this),ri(this),this.dom,this),this.domObserver=new f0(this,(r,s,o,i)=>k0(this,r,s,o,i)),this.domObserver.start(),Vy(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&&zi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Nc),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&&(rf(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=Dc(this);M0(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&zi(this),this.editable=Oc(this),Ac(this);let a=ri(this),c=Ec(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&&ny(this);if(i){this.domObserver.stop();let h=d&&(tt||We)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&C0(s.selection,e.selection);if(d){let p=We?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=t0(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=lc(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ty(this))?Nt(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&&ry(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 ee){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&tc(this,t.getBoundingClientRect(),e)}else tc(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 of(e.slice,e.move,s<0?void 0:ee.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(tt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&sy(this.dom),Nt(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 cy(this,e)}coordsAtPos(e,t=1){return _d(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 py(this,t||this.state,e)}pasteHTML(e,t){return wr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return wr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Al(this,e)}destroy(){this.docView&&(Hy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ri(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Yg())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Yy(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ke&&this.root.nodeType===11&&Gg(this.dom.ownerDocument)==this.dom&&p0(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}df.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Ec(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 Ac(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 Oc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function C0(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 Dc(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 M0(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 Nc(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 Gt={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:"'"},ws={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},w0=typeof navigator<"u"&&/Mac/.test(navigator.platform),T0=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ze=0;ze<10;ze++)Gt[48+ze]=Gt[96+ze]=String(ze);for(var ze=1;ze<=24;ze++)Gt[ze+111]="F"+ze;for(var ze=65;ze<=90;ze++)Gt[ze]=String.fromCharCode(ze+32),ws[ze]=String.fromCharCode(ze);for(var oi in Gt)ws.hasOwnProperty(oi)||(ws[oi]=Gt[oi]);function E0(n){var e=w0&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||T0&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ws:Gt)[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 A0=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),O0=typeof navigator<"u"&&/Win/.test(navigator.platform);function D0(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))A0?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 N0(n){let e=Object.create(null);for(let t in n)e[D0(t)]=n[t];return e}function ii(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function R0(n){return new Te({props:{handleKeyDown:ff(n)}})}function ff(n){let e=N0(n);return function(t,r){let s=E0(r),o,i=e[ii(s,r)];if(i&&i(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[ii(s,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(O0&&r.ctrlKey&&r.altKey)&&(o=Gt[r.keyCode])&&o!=s){let l=e[ii(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var L0=Object.defineProperty,Il=(n,e)=>{for(var t in e)L0(n,t,{get:e[t],enumerable:!0})};function To(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 Eo=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:To({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}},hf={};Il(hf,{blur:()=>I0,clearContent:()=>j0,clearNodes:()=>P0,command:()=>_0,createParagraphNear:()=>B0,cut:()=>F0,deleteCurrentNode:()=>z0,deleteNode:()=>$0,deleteRange:()=>V0,deleteSelection:()=>H0,enter:()=>W0,exitCode:()=>Y0,extendMarkRange:()=>U0,first:()=>q0,focus:()=>J0,forEach:()=>G0,insertContent:()=>X0,insertContentAt:()=>eb,joinBackward:()=>rb,joinDown:()=>nb,joinForward:()=>sb,joinItemBackward:()=>ob,joinItemForward:()=>ib,joinTextblockBackward:()=>lb,joinTextblockForward:()=>ab,joinUp:()=>tb,keyboardShortcut:()=>ub,lift:()=>db,liftEmptyBlock:()=>fb,liftListItem:()=>hb,newlineInCode:()=>pb,resetAttributes:()=>mb,scrollIntoView:()=>gb,selectAll:()=>yb,selectNodeBackward:()=>bb,selectNodeForward:()=>kb,selectParentNode:()=>xb,selectTextblockEnd:()=>vb,selectTextblockStart:()=>Sb,setContent:()=>Cb,setMark:()=>$b,setMeta:()=>Vb,setNode:()=>Hb,setNodeSelection:()=>Wb,setTextSelection:()=>Yb,sinkListItem:()=>Ub,splitBlock:()=>qb,splitListItem:()=>Kb,toggleList:()=>Jb,toggleMark:()=>Gb,toggleNode:()=>Xb,toggleWrap:()=>Qb,undoInputRule:()=>Zb,unsetAllMarks:()=>ek,unsetMark:()=>tk,updateAttributes:()=>nk,wrapIn:()=>rk,wrapInList:()=>sk});var I0=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),j0=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),P0=()=>({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=Jn(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},_0=n=>e=>n(e),B0=()=>({state:n,dispatch:e})=>Ed(n,e),F0=(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 re(r.doc.resolve(Math.max(i-1,0)))),!0},z0=()=>({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};function Re(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}var $0=n=>({tr:e,state:t,dispatch:r})=>{const s=Re(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},V0=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},H0=()=>({state:n,dispatch:e})=>xl(n,e),W0=()=>({commands:n})=>n.keyboardShortcut("Enter"),Y0=()=>({state:n,dispatch:e})=>Dg(n,e);function jl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ts(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:jl(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function pf(n,e,t={}){return n.find(r=>r.type===e&&Ts(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Rc(n,e,t={}){return!!pf(n,e,t)}function Pl(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),!pf([...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&&Rc([...n.parent.child(i-1).marks],e,t);)i-=1,l-=n.parent.child(i).nodeSize;for(;a<n.parent.childCount&&Rc([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Lt(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}var U0=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const o=Lt(n,r.schema),{doc:i,selection:l}=t,{$from:a,from:c,to:u}=l;if(s){const d=Pl(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=re.create(i,d.from,d.to);t.setSelection(f)}}return!0},q0=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 mf(n){return n instanceof re}function pn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function gf(n,e=null){if(!e)return null;const t=le.atStart(n),r=le.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,o=r.to;return e==="all"?re.create(n,pn(0,s,o),pn(n.content.size,s,o)):re.create(n,pn(e,s,o),pn(e,s,o))}function K0(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function _l(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var J0=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:o})=>{e={scrollIntoView:!0,...e};const i=()=>{(_l()||K0())&&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&&!mf(t.state.selection))return i(),!0;const l=gf(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},G0=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),X0=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),yf=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&&yf(r)}return n};function Ur(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 yf(t)}function Er(n,e,t){if(n instanceof mt||n instanceof L)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 L.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),Er("",e,t)}if(s){if(t.errorOnInvalidContent){let i=!1,l="";const a=new ed({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?Ut.fromSchema(a).parseSlice(Ur(n),t.parseOptions):Ut.fromSchema(a).parse(Ur(n),t.parseOptions),t.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=Ut.fromSchema(e);return t.slice?o.parseSlice(Ur(n),t.parseOptions).content:o.parse(Ur(n),t.parseOptions)}return Er("",e,t)}function Q0(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof Le||s instanceof Ie))return;const o=n.mapping.maps[r];let i=0;o.forEach((l,a,c,u)=>{i===0&&(i=u)}),n.setSelection(le.near(n.doc.resolve(i),t))}var Z0=n=>!("type"in n),eb=(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{Er(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Er(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((Z0(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 L){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,w=b.isText||b.isTextblock,E=b.content.size>0;k&&w&&E&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}t.updateSelection&&Q0(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},tb=()=>({state:n,dispatch:e})=>Eg(n,e),nb=()=>({state:n,dispatch:e})=>Ag(n,e),rb=()=>({state:n,dispatch:e})=>xd(n,e),sb=()=>({state:n,dispatch:e})=>Md(n,e),ob=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xo(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ib=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xo(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},lb=()=>({state:n,dispatch:e})=>wg(n,e),ab=()=>({state:n,dispatch:e})=>Tg(n,e);function bf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function cb(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))_l()||bf()?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 ub=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const o=cb(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};function Xt(n,e,t={}){const{from:r,to:s,empty:o}=n.selection,i=e?Re(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=>Ts(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var db=(n,e={})=>({state:t,dispatch:r})=>{const s=Re(n,t.schema);return Xt(t,s,e)?Og(t,r):!1},fb=()=>({state:n,dispatch:e})=>Ad(n,e),hb=n=>({state:e,dispatch:t})=>{const r=Re(n,e.schema);return $g(r)(e,t)},pb=()=>({state:n,dispatch:e})=>Td(n,e);function Ao(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Lc(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 mb=(n,e)=>({tr:t,state:r,dispatch:s})=>{let o=null,i=null;const l=Ao(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Re(n,r.schema)),l==="mark"&&(i=Lt(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,Lc(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(d=>{i===d.type&&t.addMark(u,u+c.nodeSize,i.create(Lc(d.attrs,e)))})})}),!0):!1},gb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),yb=()=>({tr:n,dispatch:e})=>{if(e){const t=new rt(n.doc);n.setSelection(t)}return!0},bb=()=>({state:n,dispatch:e})=>Sd(n,e),kb=()=>({state:n,dispatch:e})=>wd(n,e),xb=()=>({state:n,dispatch:e})=>Lg(n,e),vb=()=>({state:n,dispatch:e})=>Pg(n,e),Sb=()=>({state:n,dispatch:e})=>jg(n,e);function $i(n,e,t={},r={}){return Er(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Cb=(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=$i(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 kf(n,e){const t=Lt(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 xf(n,e){const t=new gd(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function Mb(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 wb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,o)=>{t(s)&&r.push({node:s,pos:o})}),r}function Tb(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 Oo(n){return e=>Tb(e.$from,n)}function Z(n,e,t){return n.config[e]===void 0&&n.parent?Z(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Z(n.parent,e,t):null}):n.config[e]}function Bl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=Z(e,"addExtensions",t);return r?[e,...Bl(r())]:e}).flat(10)}function Fl(n,e){const t=En.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}function vf(n){return typeof n=="function"}function ye(n,e=void 0,...t){return vf(n)?e?n.bind(e)(...t):n(...t):n}function Eb(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ar(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 Sf(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ar(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=Z(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=Z(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 Ce(...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 Es(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)=>Ce(t,r),{})}function Ab(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Ic(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):Ab(t.getAttribute(i.name));return l==null?o:{...o,[i.name]:l}},{});return{...r,...s}}}}function jc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Eb(t)?!1:t!=null))}function Pc(n){var e,t,r;const s={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&((t=n==null?void 0:n.attribute)==null?void 0:t.default)!==void 0&&(s.default=n.attribute.default),((r=n==null?void 0:n.attribute)==null?void 0:r.validate)!==void 0&&(s.validate=n.attribute.validate),[n.name,s]}function Ob(n,e){var t;const r=Sf(n),{nodeExtensions:s,markExtensions:o}=Ar(n),i=(t=s.find(c=>Z(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 w=Z(k,"extendNodeSchema",d);return{...b,...w?w(c):{}}},{}),h=jc({...f,content:ye(Z(c,"content",d)),marks:ye(Z(c,"marks",d)),group:ye(Z(c,"group",d)),inline:ye(Z(c,"inline",d)),atom:ye(Z(c,"atom",d)),selectable:ye(Z(c,"selectable",d)),draggable:ye(Z(c,"draggable",d)),code:ye(Z(c,"code",d)),whitespace:ye(Z(c,"whitespace",d)),linebreakReplacement:ye(Z(c,"linebreakReplacement",d)),defining:ye(Z(c,"defining",d)),isolating:ye(Z(c,"isolating",d)),attrs:Object.fromEntries(u.map(Pc))}),p=ye(Z(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>Ic(b,u)));const g=Z(c,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Es(b,u)}));const y=Z(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=Z(b,"extendMarkSchema",d);return{...y,...k?k(c):{}}},{}),h=jc({...f,inclusive:ye(Z(c,"inclusive",d)),excludes:ye(Z(c,"excludes",d)),group:ye(Z(c,"group",d)),spanning:ye(Z(c,"spanning",d)),code:ye(Z(c,"code",d)),attrs:Object.fromEntries(u.map(Pc))}),p=ye(Z(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Ic(y,u)));const g=Z(c,"renderHTML",d);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Es(y,u)})),[c.name,h]}));return new ed({topNode:i,nodes:l,marks:a})}function Db(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function zl(n){return n.sort((t,r)=>{const s=Z(t,"priority")||100,o=Z(r,"priority")||100;return s>o?-1:s<o?1:0})}function Cf(n){const e=zl(Bl(n)),t=Db(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 Mf(n,e,t){const{from:r,to:s}=e,{blockSeparator:o=`
|
|
48
48
|
|
|
49
|
-
`,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 Db(n,e){const t={from:0,to:n.content.size};return Mf(n,t,e)}function wf(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Nb(n,e){const t=Re(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 Tf(n,e){const t=Ao(typeof e=="string"?e:e.name,n.schema);return t==="node"?Nb(n,e):t==="mark"?kf(n,e):{}}function Rb(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 Lb(n){const e=Rb(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 Ef(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}})})}),Lb(r)}function $l(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const o=t.resolve(n),i=Pl(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 Ib=(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 li(n,e){return e.nodes[n]||e.marks[n]||null}function cs(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 jb=(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 Vi(n,e,t={}){const{empty:r,ranges:s}=n.selection,o=e?Lt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>Ts(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),w=k-b;i+=w,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=>Ts(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 Pb(n,e,t={}){if(!e)return Xt(n,null,t)||Vi(n,null,t);const r=Ao(e,n.schema);return r==="node"?Xt(n,e,t):r==="mark"?Vi(n,e,t):!1}var _b=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const o=Oo(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)},Bb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function _c(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Bc(n,e){const{nodeExtensions:t}=Ar(e),r=t.find(i=>i.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},o=ye(Z(r,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function Do(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&&(Do(o,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Af(n){return n instanceof ee}function Fb(n,e,t){var r;const{selection:s}=e;let o=null;if(mf(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 zb=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:o}=t,{empty:i,ranges:l}=o,a=Lt(n,r.schema);if(s)if(i){const c=kf(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 Fb(r,t,a)},$b=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Vb=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const o=Re(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})=>Qa(o,{...i,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Qa(o,{...i,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Hb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=pn(n,0,r.content.size),o=ee.create(r,s);e.setSelection(o)}return!0},Wb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:o}=typeof n=="number"?{from:n,to:n}:n,i=re.atStart(r).from,l=re.atEnd(r).to,a=pn(s,i,l),c=pn(o,i,l),u=re.create(r,a,c);e.setSelection(u)}return!0},Yb=n=>({state:e,dispatch:t})=>{const r=Re(n,e.schema);return Hg(r)(e,t)};function Fc(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 Ub=({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=cs(c,l.node().type.name,l.node().attrs);if(o instanceof ee&&o.node.isBlock)return!l.parentOffset||!Dt(i,l.pos)?!1:(r&&(n&&Fc(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:Cb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Dt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Dt(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 re&&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&&Fc(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},qb=(n,e={})=>({tr:t,state:r,dispatch:s,editor:o})=>{var i;const l=Re(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=L.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=L.from(a.node(O).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...cs(f,a.node().type.name,a.node().attrs),...e},C=((i=l.contentMatch.defaultType)==null?void 0:i.createAndFill(E))||void 0;b=b.append(L.from(l.createAndFill(null,C)||void 0));const x=a.before(a.depth-(k-1));t.replace(x,a.after(-w),new H(b,4-k,0));let M=-1;t.doc.nodesBetween(x,t.doc.content.size,(O,j)=>{if(M>-1)return!1;O.isTextblock&&O.content.size===0&&(M=j+1)}),M>-1&&t.setSelection(re.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...cs(f,d.type.name,d.attrs),...e},g={...cs(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(!Dt(t.doc,a.pos,2))return!1;if(s){const{selection:b,storedMarks:k}=r,{splittableMarks:w}=o.extensionManager,E=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!E||!s)return!0;const C=E.filter(x=>w.includes(x.type.name));t.ensureMarks(C)}return!0},ai=(n,e)=>{const t=Oo(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)&&tn(n.doc,t.pos)&&n.join(t.pos),!0},ci=(n,e)=>{const t=Oo(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)&&tn(n.doc,r)&&n.join(r),!0},Kb=(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=Re(n,i.schema),p=Re(e,i.schema),{selection:g,storedMarks:y}=i,{$from:b,$to:k}=g,w=b.blockRange(k),E=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const C=Oo(x=>Bc(x.type.name,d))(g);if(w.depth>=1&&C&&w.depth-C.depth<=1){if(C.node.type===h)return c.liftListItem(p);if(Bc(C.node.type.name,d)&&h.validContent(C.node.content)&&l)return a().command(()=>(o.setNodeMarkup(C.pos,h),!0)).command(()=>ai(o,h)).command(()=>ci(o,h)).run()}return!t||!E||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>ai(o,h)).command(()=>ci(o,h)).run():a().command(()=>{const x=u().wrapInList(h,r),M=E.filter(O=>f.includes(O.type.name));return o.ensureMarks(M),x?!0:c.clearNodes()}).wrapInList(h,r).command(()=>ai(o,h)).command(()=>ci(o,h)).run()},Jb=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=t,i=Lt(n,r.schema);return Vi(r,i,e)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,e)},Gb=(n,e,t={})=>({state:r,commands:s})=>{const o=Re(n,r.schema),i=Re(e,r.schema),l=Xt(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})},Xb=(n,e={})=>({state:t,commands:r})=>{const s=Re(n,t.schema);return Xt(t,s,e)?r.lift(s):r.wrapIn(s,e)},Qb=()=>({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},Zb=()=>({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},ek=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=e,{selection:l}=t,a=Lt(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=Pl(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},tk=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let o=null,i=null;const l=Ao(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Re(n,r.schema)),l==="mark"&&(i=Lt(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),w=Math.min(y+g.nodeSize,u);t.addMark(k,w,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},nk=(n,e={})=>({state:t,dispatch:r})=>{const s=Re(n,t.schema);return Pg(s,e)(t,r)},rk=(n,e={})=>({state:t,dispatch:r})=>{const s=Re(n,t.schema);return _g(s,e)(t,r)},sk=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={}}},No=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},ok=(n,e)=>{if(jl(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 qr(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=jb(c)+o;return i.forEach(f=>{if(u)return;const h=ok(d,f.find);if(!h)return;const p=a.state.tr,g=To({state:a.state,transaction:p}),y={from:r-(h[0].length-o.length),to:s},{commands:b,chain:k,can:w}=new Eo({editor:t,state:g});f.handler({state:g,range:y,match:h,commands:b,chain:k,can:w})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:s,text:o}),a.dispatch(p),u=!0)}),u}function ik(n){const{editor:e,rules:t}=n,r=new Te({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=Fl(L.from(u),i.schema);const{from:d}=a,f=d+u.length;qr({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 qr({editor:e,from:o,to:i,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&qr({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?qr({editor:e,from:i.pos,to:i.pos,text:`
|
|
50
|
-
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function lk(n){return Object.prototype.toString.call(n).slice(8,-1)}function Kr(n){return lk(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Of(n,e){const t={...n};return Kr(n)&&Kr(e)&&Object.keys(e).forEach(r=>{Kr(e[r])&&Kr(n[r])?t[r]=Of(n[r],e[r]):t[r]=e[r]}),t}var Vl=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{...ye(Z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ye(Z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Of(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}},vt=class Df extends Vl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Df(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 ak(n){return typeof n=="number"}var ck=class{constructor(n){this.find=n.find,this.handler=n.handler}},uk=(n,e,t)=>{if(jl(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 dk(n){const{editor:e,state:t,from:r,to:s,rule:o,pasteEvent:i,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Eo({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,s,(h,p)=>{var g,y,b,k,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const E=(w=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?w:0,C=Math.max(r,p),x=Math.min(s,p+E);if(C>=x)return;const M=h.isText?h.text||"":h.textBetween(C-p,x-p,void 0,"");uk(M,o.find,i).forEach(j=>{if(j.index===void 0)return;const B=C+j.index+1,Y=B+j[0].length,V={from:t.tr.mapping.map(B),to:t.tr.mapping.map(Y)},F=o.handler({state:t,range:V,match:j,commands:a,chain:c,can:u,pasteEvent:i,dropEvent:l});d.push(F)})}),d.every(h=>h!==null)}var Jr=null,fk=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function hk(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=To({state:u,transaction:g});if(!(!dk({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 Te({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(Jr=e)},h=()=>{Jr&&(Jr=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=Jr;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:C}=b;typeof C=="string"?C=C:C=Fl(L.from(C),h.schema);const{from:x}=b,M=x+C.length,O=fk(C);return a({rule:u,state:h,from:x,to:{b:M},pasteEvt:O})}const w=f.doc.content.findDiffStart(h.doc.content),E=f.doc.content.findDiffEnd(h.doc.content);if(!(!ak(w)||!E||w===E.b))return a({rule:u,state:h,from:w,to:E,pasteEvt:i})}}))}var Ro=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Cf(n),this.schema=Ab(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:li(e.name,this.schema)},r=Z(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return zl([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:li(r.name,this.schema)},o=[],i=Z(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&Z(r,"exitable",s)&&(l.ArrowRight=()=>vt.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=N0(l);o.push(a);const c=Z(r,"addInputRules",s);if(_c(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=ik({editor:n,rules:f}),p=Array.isArray(h)?h:[h];o.push(...p)}}const u=Z(r,"addPasteRules",s);if(_c(r,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=hk({editor:n,rules:f});o.push(...h)}}const d=Z(r,"addProseMirrorPlugins",s);if(d){const f=d();o.push(...f)}return o})}get attributes(){return Sf(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Ar(this.extensions);return Object.fromEntries(e.filter(t=>!!Z(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Re(t.name,this.schema)},o=Z(t,"addNodeView",s);if(!o)return[];const i=o();if(!i)return[];const l=(a,c,u,d,f)=>{const h=Es(a,r);return i({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Ar(this.extensions);return Object.fromEntries(e.filter(t=>!!Z(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:Lt(t.name,this.schema)},o=Z(t,"addMarkView",s);if(!o)return[];const i=(l,a,c)=>{const u=Es(l,r);return o()({mark:l,view:a,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{Ek(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:li(e.name,this.schema)};e.type==="mark"&&((t=ye(Z(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=Z(e,"onBeforeCreate",r),o=Z(e,"onCreate",r),i=Z(e,"onUpdate",r),l=Z(e,"onSelectionUpdate",r),a=Z(e,"onTransaction",r),c=Z(e,"onFocus",r),u=Z(e,"onBlur",r),d=Z(e,"onDestroy",r);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)})}};Ro.resolve=Cf;Ro.sort=zl;Ro.flatten=Bl;var pk={};Il(pk,{ClipboardTextSerializer:()=>Rf,Commands:()=>Lf,Delete:()=>If,Drop:()=>jf,Editable:()=>Pf,FocusEvents:()=>Bf,Keymap:()=>Ff,Paste:()=>zf,Tabindex:()=>$f,focusEventsPluginKey:()=>_f});var Ae=class Nf extends Vl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Nf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Rf=Ae.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Te({key:new Pe("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=wf(t);return Mf(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Lf=Ae.create({name:"commands",addCommands(){return{...hf}}}),If=Ae.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=xf(n.before,[n,...e]);Ef(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 pt){const b=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),w=f.invert().map(b,-1),E=f.invert().map(k),C=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(M=>M.eq(h.mark)),x=(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:w,to:E},newRange:{from:b,to:k},partial:!!(x||C),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()}}),jf=Ae.create({name:"drop",addProseMirrorPlugins(){return[new Te({key:new Pe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Pf=Ae.create({name:"editable",addProseMirrorPlugins(){return[new Te({key:new Pe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),_f=new Pe("focusEvents"),Bf=Ae.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Te({key:_f,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}}}})]}}),Ff=Ae.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:le.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 _l()||bf()?o:s},addProseMirrorPlugins(){return[new Te({key:new Pe("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=le.atStart(e.doc).from,c=le.atEnd(e.doc).to;if(o||!(i===a&&l===c)||!Do(t.doc))return;const f=t.tr,h=To({state:t,transaction:f}),{commands:p}=new Eo({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),zf=Ae.create({name:"paste",addProseMirrorPlugins(){return[new Te({key:new Pe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),$f=Ae.create({name:"tabindex",addProseMirrorPlugins(){return[new Te({key:new Pe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),mk=class Pn{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 Pn(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 Pn(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 Pn(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 Pn(l,this.editor,s,s?t:null);s&&(a.actualDepth=this.depth+1),e.push(new Pn(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)}},gk=`.ProseMirror {
|
|
49
|
+
`,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 Nb(n,e){const t={from:0,to:n.content.size};return Mf(n,t,e)}function wf(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Rb(n,e){const t=Re(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 Tf(n,e){const t=Ao(typeof e=="string"?e:e.name,n.schema);return t==="node"?Rb(n,e):t==="mark"?kf(n,e):{}}function Lb(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 Ib(n){const e=Lb(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 Ef(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}})})}),Ib(r)}function $l(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const o=t.resolve(n),i=Pl(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 jb=(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 li(n,e){return e.nodes[n]||e.marks[n]||null}function cs(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 Pb=(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 Vi(n,e,t={}){const{empty:r,ranges:s}=n.selection,o=e?Lt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>Ts(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),w=k-b;i+=w,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=>Ts(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 _b(n,e,t={}){if(!e)return Xt(n,null,t)||Vi(n,null,t);const r=Ao(e,n.schema);return r==="node"?Xt(n,e,t):r==="mark"?Vi(n,e,t):!1}var Bb=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const o=Oo(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)},Fb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function _c(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Bc(n,e){const{nodeExtensions:t}=Ar(e),r=t.find(i=>i.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},o=ye(Z(r,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function Do(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&&(Do(o,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Af(n){return n instanceof ee}function zb(n,e,t){var r;const{selection:s}=e;let o=null;if(mf(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 $b=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:o}=t,{empty:i,ranges:l}=o,a=Lt(n,r.schema);if(s)if(i){const c=kf(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 zb(r,t,a)},Vb=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Hb=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const o=Re(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})=>Qa(o,{...i,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Qa(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=pn(n,0,r.content.size),o=ee.create(r,s);e.setSelection(o)}return!0},Yb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:o}=typeof n=="number"?{from:n,to:n}:n,i=re.atStart(r).from,l=re.atEnd(r).to,a=pn(s,i,l),c=pn(o,i,l),u=re.create(r,a,c);e.setSelection(u)}return!0},Ub=n=>({state:e,dispatch:t})=>{const r=Re(n,e.schema);return Wg(r)(e,t)};function Fc(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 qb=({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=cs(c,l.node().type.name,l.node().attrs);if(o instanceof ee&&o.node.isBlock)return!l.parentOffset||!Dt(i,l.pos)?!1:(r&&(n&&Fc(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:Mb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Dt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Dt(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 re&&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&&Fc(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},Kb=(n,e={})=>({tr:t,state:r,dispatch:s,editor:o})=>{var i;const l=Re(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=L.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=L.from(a.node(O).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...cs(f,a.node().type.name,a.node().attrs),...e},C=((i=l.contentMatch.defaultType)==null?void 0:i.createAndFill(E))||void 0;b=b.append(L.from(l.createAndFill(null,C)||void 0));const x=a.before(a.depth-(k-1));t.replace(x,a.after(-w),new H(b,4-k,0));let M=-1;t.doc.nodesBetween(x,t.doc.content.size,(O,j)=>{if(M>-1)return!1;O.isTextblock&&O.content.size===0&&(M=j+1)}),M>-1&&t.setSelection(re.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...cs(f,d.type.name,d.attrs),...e},g={...cs(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(!Dt(t.doc,a.pos,2))return!1;if(s){const{selection:b,storedMarks:k}=r,{splittableMarks:w}=o.extensionManager,E=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!E||!s)return!0;const C=E.filter(x=>w.includes(x.type.name));t.ensureMarks(C)}return!0},ai=(n,e)=>{const t=Oo(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)&&tn(n.doc,t.pos)&&n.join(t.pos),!0},ci=(n,e)=>{const t=Oo(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)&&tn(n.doc,r)&&n.join(r),!0},Jb=(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=Re(n,i.schema),p=Re(e,i.schema),{selection:g,storedMarks:y}=i,{$from:b,$to:k}=g,w=b.blockRange(k),E=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const C=Oo(x=>Bc(x.type.name,d))(g);if(w.depth>=1&&C&&w.depth-C.depth<=1){if(C.node.type===h)return c.liftListItem(p);if(Bc(C.node.type.name,d)&&h.validContent(C.node.content)&&l)return a().command(()=>(o.setNodeMarkup(C.pos,h),!0)).command(()=>ai(o,h)).command(()=>ci(o,h)).run()}return!t||!E||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>ai(o,h)).command(()=>ci(o,h)).run():a().command(()=>{const x=u().wrapInList(h,r),M=E.filter(O=>f.includes(O.type.name));return o.ensureMarks(M),x?!0:c.clearNodes()}).wrapInList(h,r).command(()=>ai(o,h)).command(()=>ci(o,h)).run()},Gb=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=t,i=Lt(n,r.schema);return Vi(r,i,e)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,e)},Xb=(n,e,t={})=>({state:r,commands:s})=>{const o=Re(n,r.schema),i=Re(e,r.schema),l=Xt(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})},Qb=(n,e={})=>({state:t,commands:r})=>{const s=Re(n,t.schema);return Xt(t,s,e)?r.lift(s):r.wrapIn(s,e)},Zb=()=>({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},ek=()=>({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},tk=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=e,{selection:l}=t,a=Lt(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=Pl(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},nk=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let o=null,i=null;const l=Ao(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Re(n,r.schema)),l==="mark"&&(i=Lt(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),w=Math.min(y+g.nodeSize,u);t.addMark(k,w,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},rk=(n,e={})=>({state:t,dispatch:r})=>{const s=Re(n,t.schema);return _g(s,e)(t,r)},sk=(n,e={})=>({state:t,dispatch:r})=>{const s=Re(n,t.schema);return Bg(s,e)(t,r)},ok=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={}}},No=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},ik=(n,e)=>{if(jl(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 qr(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=Pb(c)+o;return i.forEach(f=>{if(u)return;const h=ik(d,f.find);if(!h)return;const p=a.state.tr,g=To({state:a.state,transaction:p}),y={from:r-(h[0].length-o.length),to:s},{commands:b,chain:k,can:w}=new Eo({editor:t,state:g});f.handler({state:g,range:y,match:h,commands:b,chain:k,can:w})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:s,text:o}),a.dispatch(p),u=!0)}),u}function lk(n){const{editor:e,rules:t}=n,r=new Te({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=Fl(L.from(u),i.schema);const{from:d}=a,f=d+u.length;qr({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 qr({editor:e,from:o,to:i,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&qr({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?qr({editor:e,from:i.pos,to:i.pos,text:`
|
|
50
|
+
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function ak(n){return Object.prototype.toString.call(n).slice(8,-1)}function Kr(n){return ak(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Of(n,e){const t={...n};return Kr(n)&&Kr(e)&&Object.keys(e).forEach(r=>{Kr(e[r])&&Kr(n[r])?t[r]=Of(n[r],e[r]):t[r]=e[r]}),t}var Vl=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{...ye(Z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ye(Z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Of(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}},vt=class Df extends Vl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Df(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 ck(n){return typeof n=="number"}var uk=class{constructor(n){this.find=n.find,this.handler=n.handler}},dk=(n,e,t)=>{if(jl(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 fk(n){const{editor:e,state:t,from:r,to:s,rule:o,pasteEvent:i,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Eo({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,s,(h,p)=>{var g,y,b,k,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const E=(w=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?w:0,C=Math.max(r,p),x=Math.min(s,p+E);if(C>=x)return;const M=h.isText?h.text||"":h.textBetween(C-p,x-p,void 0,"");dk(M,o.find,i).forEach(j=>{if(j.index===void 0)return;const B=C+j.index+1,Y=B+j[0].length,V={from:t.tr.mapping.map(B),to:t.tr.mapping.map(Y)},F=o.handler({state:t,range:V,match:j,commands:a,chain:c,can:u,pasteEvent:i,dropEvent:l});d.push(F)})}),d.every(h=>h!==null)}var Jr=null,hk=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function pk(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=To({state:u,transaction:g});if(!(!fk({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 Te({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(Jr=e)},h=()=>{Jr&&(Jr=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=Jr;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:C}=b;typeof C=="string"?C=C:C=Fl(L.from(C),h.schema);const{from:x}=b,M=x+C.length,O=hk(C);return a({rule:u,state:h,from:x,to:{b:M},pasteEvt:O})}const w=f.doc.content.findDiffStart(h.doc.content),E=f.doc.content.findDiffEnd(h.doc.content);if(!(!ck(w)||!E||w===E.b))return a({rule:u,state:h,from:w,to:E,pasteEvt:i})}}))}var Ro=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Cf(n),this.schema=Ob(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:li(e.name,this.schema)},r=Z(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return zl([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:li(r.name,this.schema)},o=[],i=Z(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&Z(r,"exitable",s)&&(l.ArrowRight=()=>vt.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=R0(l);o.push(a);const c=Z(r,"addInputRules",s);if(_c(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=lk({editor:n,rules:f}),p=Array.isArray(h)?h:[h];o.push(...p)}}const u=Z(r,"addPasteRules",s);if(_c(r,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=pk({editor:n,rules:f});o.push(...h)}}const d=Z(r,"addProseMirrorPlugins",s);if(d){const f=d();o.push(...f)}return o})}get attributes(){return Sf(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Ar(this.extensions);return Object.fromEntries(e.filter(t=>!!Z(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Re(t.name,this.schema)},o=Z(t,"addNodeView",s);if(!o)return[];const i=o();if(!i)return[];const l=(a,c,u,d,f)=>{const h=Es(a,r);return i({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Ar(this.extensions);return Object.fromEntries(e.filter(t=>!!Z(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:Lt(t.name,this.schema)},o=Z(t,"addMarkView",s);if(!o)return[];const i=(l,a,c)=>{const u=Es(l,r);return o()({mark:l,view:a,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{Ak(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:li(e.name,this.schema)};e.type==="mark"&&((t=ye(Z(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=Z(e,"onBeforeCreate",r),o=Z(e,"onCreate",r),i=Z(e,"onUpdate",r),l=Z(e,"onSelectionUpdate",r),a=Z(e,"onTransaction",r),c=Z(e,"onFocus",r),u=Z(e,"onBlur",r),d=Z(e,"onDestroy",r);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)})}};Ro.resolve=Cf;Ro.sort=zl;Ro.flatten=Bl;var mk={};Il(mk,{ClipboardTextSerializer:()=>Rf,Commands:()=>Lf,Delete:()=>If,Drop:()=>jf,Editable:()=>Pf,FocusEvents:()=>Bf,Keymap:()=>Ff,Paste:()=>zf,Tabindex:()=>$f,focusEventsPluginKey:()=>_f});var Ae=class Nf extends Vl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Nf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Rf=Ae.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Te({key:new Pe("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=wf(t);return Mf(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Lf=Ae.create({name:"commands",addCommands(){return{...hf}}}),If=Ae.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=xf(n.before,[n,...e]);Ef(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 pt){const b=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),w=f.invert().map(b,-1),E=f.invert().map(k),C=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(M=>M.eq(h.mark)),x=(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:w,to:E},newRange:{from:b,to:k},partial:!!(x||C),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()}}),jf=Ae.create({name:"drop",addProseMirrorPlugins(){return[new Te({key:new Pe("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Pf=Ae.create({name:"editable",addProseMirrorPlugins(){return[new Te({key:new Pe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),_f=new Pe("focusEvents"),Bf=Ae.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Te({key:_f,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}}}})]}}),Ff=Ae.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:le.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 _l()||bf()?o:s},addProseMirrorPlugins(){return[new Te({key:new Pe("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=le.atStart(e.doc).from,c=le.atEnd(e.doc).to;if(o||!(i===a&&l===c)||!Do(t.doc))return;const f=t.tr,h=To({state:t,transaction:f}),{commands:p}=new Eo({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),zf=Ae.create({name:"paste",addProseMirrorPlugins(){return[new Te({key:new Pe("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),$f=Ae.create({name:"tabindex",addProseMirrorPlugins(){return[new Te({key:new Pe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),gk=class Pn{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 Pn(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 Pn(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 Pn(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 Pn(l,this.editor,s,s?t:null);s&&(a.actualDepth=this.depth+1),e.push(new Pn(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)}},yk=`.ProseMirror {
|
|
51
51
|
position: relative;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -117,15 +117,15 @@ img.ProseMirror-separator {
|
|
|
117
117
|
|
|
118
118
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
119
119
|
display: block;
|
|
120
|
-
}`;function
|
|
120
|
+
}`;function bk(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 kk=class extends ok{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,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=gf(e,this.options.autofocus);this.editorState=zn.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.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n!=null&&n.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(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=bk(yk,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=vf(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?[Pf,Rf.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Lf,Bf,Ff,$f,jf,zf,If].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 Ro(r,this)}createCommandManager(){this.commandManager=new Eo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=$i(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=$i(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){var e;this.editorView=new df(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=`${this.className} ${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 Tf(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return _b(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Fl(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
|
|
121
121
|
|
|
122
|
-
`,textSerializers:t={}}=n||{};return
|
|
122
|
+
`,textSerializers:t={}}=n||{};return Nb(this.state.doc,{blockSeparator:e,textSerializers:{...wf(this.schema),...t}})}get isEmpty(){return Do(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 gk(e,this)}get $doc(){return this.$pos(0)}};function wn(n){return new No({find:n.find,handler:({state:e,range:t,match:r})=>{const s=ye(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($l(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 xk(n){return new No({find:n.find,handler:({state:e,range:t,match:r})=>{const s=ye(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 Hi(n){return new No({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),o=ye(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 No({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const o=ye(n.getAttributes,void 0,r)||{},i=e.tr.delete(t.from,t.to),a=i.doc.resolve(t.from).blockRange(),c=a&&bl(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&&tn(i.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&i.join(t.from-1)},undoable:n.undoable})}function vk(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof ee){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}var Sk={};Il(Sk,{createAtomBlockMarkdownSpec:()=>Ck,createBlockMarkdownSpec:()=>Mk,createInlineMarkdownSpec:()=>Ek,parseAttributes:()=>Hl,parseIndentedBlocks:()=>Wi,renderNestedMarkdownContent:()=>Yl,serializeAttributes:()=>Wl});function Hl(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(u=>u.trim().slice(1));e.class=c.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(i)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=t[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Wl(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Ck(n){const{nodeName:e,name:t,parseAttributes:r=Hl,serializeAttributes:s=Wl,defaultAttributes:o={},requiredAttributes:i=[],allowedAttributes:l}=n,a=t||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...o,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",y=r(g);if(!i.find(k=>!(k in y)))return{type:e,raw:p[0],attributes:y}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=s(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function Mk(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=Hl,serializeAttributes:o=Wl,defaultAttributes:i={},content:l="block",allowedAttributes:a}=n,c=t||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...i,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(g);if(!y)return;const[b,k=""]=y,w=s(k);let E=1;const C=b.length;let x="";const M=/^:::([\w-]*)(\s.*)?/gm,O=d.slice(C);for(M.lastIndex=0;;){const j=M.exec(O);if(j===null)break;const B=j.index,Y=j[1];if(!((p=j[2])!=null&&p.endsWith(":::"))){if(Y)E+=1;else if(E-=1,E===0){const V=O.slice(0,B);x=V.trim();const F=d.slice(0,C+B+j[0].length);let q=[];if(x)if(l==="block")for(q=h.blockTokens(V),q.forEach(G=>{G.text&&(!G.tokens||G.tokens.length===0)&&(G.tokens=h.inlineTokens(G.text))});q.length>0;){const G=q[q.length-1];if(G.type==="paragraph"&&(!G.text||G.text.trim()===""))q.pop();else break}else q=h.inlineTokens(x);return{type:e,raw:F,attributes:w,content:x,tokens:q}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=o(h),g=p?` {${p}}`:"",y=f.renderChildren(d.content||[],`
|
|
123
123
|
|
|
124
124
|
`);return`:::${c}${g}
|
|
125
125
|
|
|
126
126
|
${y}
|
|
127
127
|
|
|
128
|
-
:::`}}}function
|
|
128
|
+
:::`}}}function wk(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,o,i]=r;e[s]=o||i,r=t.exec(n)}return e}function Tk(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Ek(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=wk,serializeAttributes:o=Tk,defaultAttributes:i={},selfClosing:l=!1,allowedAttributes:a}=n,c=t||e,u=f=>{if(!a)return f;const h={};return a.forEach(p=>{p in f&&(h[p]=f[p])}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...i,...f.attributes};if(l)return h.createNode(e,p);const g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p==null?void 0:p.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=f.match(g);if(!y)return;let b="",k="";if(l){const[,E]=y;k=E}else{const[,E,C]=y;k=E,b=C||""}const w=s(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=u(f.attrs||{}),g=o(p),y=g?` ${g}`:"";return l?`[${c}${y}]`:`[${c}${y}]${h}[/${c}]`}}}function Wi(n,e,t){var r,s,o,i;const l=n.split(`
|
|
129
129
|
`),a=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<l.length;){const f=l[u],h=f.match(e.itemPattern);if(!h){if(a.length>0)break;if(f.trim()===""){u+=1;continue}else return}const p=e.extractItemData(h),{indentLevel:g,mainContent:y}=p;c=`${c}${f}
|
|
130
130
|
`;const b=[y];for(u+=1;u<l.length;){const C=l[u];if(C.trim()===""){const M=l.slice(u+1).findIndex(B=>B.trim()!=="");if(M===-1)break;if((((s=(r=l[u+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){b.push(C),c=`${c}${C}
|
|
131
131
|
`,u+=1;continue}else break}if((((i=(o=C.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:i.length)||0)>g)b.push(C),c=`${c}${C}
|
|
@@ -133,7 +133,7 @@ ${y}
|
|
|
133
133
|
`);C.trim()&&(e.customNestedParser?k=e.customNestedParser(C):k=t.blockTokens(C))}const E=e.createToken(p,k);a.push(E)}if(a.length!==0)return{items:a,raw:c.trim()}}function Yl(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const s=typeof t=="function"?t(r):t,[o,...i]=n.content,l=e.renderChildren([o]),a=[`${s}${l}`];return i&&i.length>0&&i.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
|
|
134
134
|
`).map(f=>f?e.indent(f):"").join(`
|
|
135
135
|
`);a.push(d)}}),a.join(`
|
|
136
|
-
`)}function
|
|
136
|
+
`)}function Ak(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 st=class Vf extends Vl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Vf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Qt(n){return new uk({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const o=ye(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($l(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 ui,zc;function Ok(){return zc||(zc=1,ui=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}),ui}var Dk=Ok();const Nk=rl(Dk);var Gr={exports:{}},di={};/**
|
|
137
137
|
* @license React
|
|
138
138
|
* use-sync-external-store-shim/with-selector.production.js
|
|
139
139
|
*
|
|
@@ -141,7 +141,7 @@ ${y}
|
|
|
141
141
|
*
|
|
142
142
|
* This source code is licensed under the MIT license found in the
|
|
143
143
|
* LICENSE file in the root directory of this source tree.
|
|
144
|
-
*/var $c;function
|
|
144
|
+
*/var $c;function Rk(){if($c)return di;$c=1;var n=T,e=ml();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 di.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(x){if(!k){if(k=!0,w=x,x=f(x),h!==void 0&&g.hasValue){var M=g.value;if(h(M,x))return E=M}return E=x}if(M=E,r(w,x))return M;var O=f(x);return h!==void 0&&h(M,O)?(w=x,M):(w=x,E=O)}var k=!1,w,E,C=d===void 0?null:d;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[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},di}var fi={};/**
|
|
145
145
|
* @license React
|
|
146
146
|
* use-sync-external-store-shim/with-selector.development.js
|
|
147
147
|
*
|
|
@@ -149,11 +149,11 @@ ${y}
|
|
|
149
149
|
*
|
|
150
150
|
* This source code is licensed under the MIT license found in the
|
|
151
151
|
* LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/var Vc;function Rk(){return Vc||(Vc=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=ml(),r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,a=e.useDebugValue;fi.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(x){if(!k){if(k=!0,w=x,x=f(x),h!==void 0&&g.hasValue){var M=g.value;if(h(M,x))return E=M}return E=x}if(M=E,r(w,x))return M;var O=f(x);return h!==void 0&&h(M,O)?(w=x,M):(w=x,E=O)}var k=!1,w,E,C=d===void 0?null:d;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[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())})()),fi}var Hc;function Lk(){return Hc||(Hc=1,process.env.NODE_ENV==="production"?Gr.exports=Nk():Gr.exports=Rk()),Gr.exports}var Ik=Lk(),jk=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Pk=({contentComponent:n})=>{const e=Bu.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(e)})};function _k(){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]:Oh.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 Bk=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=_k(),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:jk(e,this.editorContentRef),...t}),(n==null?void 0:n.contentComponent)&&m.jsx(Pk,{contentComponent:n.contentComponent})]})}},Fk=T.forwardRef((n,e)=>{const t=T.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return T.createElement(Bk,{key:t,innerRef:e,...n})}),Wc=T.memo(Fk),zk=typeof window<"u"?T.useLayoutEffect:T.useEffect,$k=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 Vk(n){var e;const[t]=T.useState(()=>new $k(n.editor)),r=Ik.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:Dk);return zk(()=>t.watch(n.editor),[n.editor,t]),T.useDebugValue(r),r}var Yc=process.env.NODE_ENV!=="production",Yi=typeof window>"u",Hk=Yi||!!(typeof window<"u"&&window.next),Wk=class Hf{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(Yi||Hk){if(Yc)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&&Yi&&Yc)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 bk(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?Hf.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 Yk(n={},e=[]){const t=T.useRef(n);t.current=n;const[r]=T.useState(()=>new Wk(t)),s=Bu.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return T.useDebugValue(s),T.useEffect(r.onRender(e)),Vk({editor:s,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&o===0?0:o+1}),s}var Uk=T.createContext({editor:null});Uk.Consumer;var qk=T.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Kk=()=>T.useContext(qk);T.forwardRef((n,e)=>{const{onDragStart:t}=Kk(),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 As=(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]},Jk=/^\s*>\s$/,Gk=st.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return As("blockquote",{...Ce(this.options.HTMLAttributes,n),children:As("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(s=>{const l=e.renderChildren([s]).split(`
|
|
152
|
+
*/var Vc;function Lk(){return Vc||(Vc=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=ml(),r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,a=e.useDebugValue;fi.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(x){if(!k){if(k=!0,w=x,x=f(x),h!==void 0&&g.hasValue){var M=g.value;if(h(M,x))return E=M}return E=x}if(M=E,r(w,x))return M;var O=f(x);return h!==void 0&&h(M,O)?(w=x,M):(w=x,E=O)}var k=!1,w,E,C=d===void 0?null:d;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[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())})()),fi}var Hc;function Ik(){return Hc||(Hc=1,process.env.NODE_ENV==="production"?Gr.exports=Rk():Gr.exports=Lk()),Gr.exports}var jk=Ik(),Pk=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},_k=({contentComponent:n})=>{const e=Bu.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(e)})};function Bk(){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 Fk=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=Bk(),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:Pk(e,this.editorContentRef),...t}),(n==null?void 0:n.contentComponent)&&m.jsx(_k,{contentComponent:n.contentComponent})]})}},zk=T.forwardRef((n,e)=>{const t=T.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return T.createElement(Fk,{key:t,innerRef:e,...n})}),Wc=T.memo(zk),$k=typeof window<"u"?T.useLayoutEffect:T.useEffect,Vk=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 Hk(n){var e;const[t]=T.useState(()=>new Vk(n.editor)),r=jk.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:Nk);return $k(()=>t.watch(n.editor),[n.editor,t]),T.useDebugValue(r),r}var Yc=process.env.NODE_ENV!=="production",Yi=typeof window>"u",Wk=Yi||!!(typeof window<"u"&&window.next),Yk=class Hf{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(Yi||Wk){if(Yc)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&&Yi&&Yc)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 kk(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?Hf.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 Uk(n={},e=[]){const t=T.useRef(n);t.current=n;const[r]=T.useState(()=>new Yk(t)),s=Bu.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return T.useDebugValue(s),T.useEffect(r.onRender(e)),Hk({editor:s,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&o===0?0:o+1}),s}var qk=T.createContext({editor:null});qk.Consumer;var Kk=T.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Jk=()=>T.useContext(Kk);T.forwardRef((n,e)=>{const{onDragStart:t}=Jk(),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 As=(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]},Gk=/^\s*>\s$/,Xk=st.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return As("blockquote",{...Ce(this.options.HTMLAttributes,n),children:As("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(s=>{const l=e.renderChildren([s]).split(`
|
|
153
153
|
`).map(a=>a.trim()===""?t:`${t} ${a}`);r.push(l.join(`
|
|
154
154
|
`))}),r.join(`
|
|
155
155
|
${t}
|
|
156
|
-
`)},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:
|
|
156
|
+
`)},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:Gk,type:this.type})]}}),Qk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Zk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ex=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,tx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,nx=vt.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 As("strong",{...Ce(this.options.HTMLAttributes,n),children:As("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,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[wn({find:Qk,type:this.type}),wn({find:ex,type:this.type})]},addPasteRules(){return[Qt({find:Zk,type:this.type}),Qt({find:tx,type:this.type})]}}),rx=/(^|[^`])`([^`]+)`(?!`)$/,sx=/(^|[^`])`([^`]+)`(?!`)/g,ox=vt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",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[wn({find:rx,type:this.type})]},addPasteRules(){return[Qt({find:sx,type:this.type})]}}),hi=4,ix=/^```([a-z]+)?[\s\n]$/,lx=/^~~~([a-z]+)?[\s\n]$/,ax=st.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:hi,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",Ce(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const s=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${s}`,e.renderChildren(n.content),"```"].join(`
|
|
157
157
|
`):r=`\`\`\`${s}
|
|
158
158
|
|
|
159
159
|
\`\`\``,r},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:hi,{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,`
|
|
@@ -169,26 +169,26 @@ ${t}
|
|
|
169
169
|
`).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(`
|
|
170
170
|
`);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(`
|
|
171
171
|
|
|
172
|
-
`);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(le.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Hi({find:
|
|
173
|
-
`));return i.replaceSelectionWith(this.type.create({language:o},a)),i.selection.$from.parent.type!==this.type&&i.setSelection(re.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),n.dispatch(i),!0}}})]}}),
|
|
172
|
+
`);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(le.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Hi({find:ix,type:this.type,getAttributes:n=>({language:n[1]})}),Hi({find:lx,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Te({key:new Pe("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,`
|
|
173
|
+
`));return i.replaceSelectionWith(this.type.create({language:o},a)),i.selection.$from.parent.type!==this.type&&i.setSelection(re.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),n.dispatch(i),!0}}})]}}),cx=st.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
174
174
|
|
|
175
|
-
`):""}),
|
|
175
|
+
`):""}),ux=st.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Ce(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
176
176
|
`},renderMarkdown:()=>`
|
|
177
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),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()}}}),ux=st.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]}`,Ce(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},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=>Hi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),dx=st.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Ce(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!xk(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Af(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(re.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(ee.create(i.doc,a.pos)):i.setSelection(re.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(re.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[kk({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),fx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,hx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,px=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,gx=vt.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",Ce(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)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[wn({find:fx,type:this.type}),wn({find:px,type:this.type})]},addPasteRules(){return[Qt({find:hx,type:this.type}),Qt({find:mx,type:this.type})]}});const yx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",bx="ελ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",Ui="numeric",qi="ascii",Ki="alpha",hr="asciinumeric",ar="alphanumeric",Ji="domain",Wf="emoji",kx="scheme",xx="slashscheme",pi="whitespace";function vx(n,e){return n in e||(e[n]=[]),e[n]}function mn(n,e,t){e[Ui]&&(e[hr]=!0,e[ar]=!0),e[qi]&&(e[hr]=!0,e[Ki]=!0),e[hr]&&(e[ar]=!0),e[Ki]&&(e[ar]=!0),e[ar]&&(e[Ji]=!0),e[Wf]&&(e[Ji]=!0);for(const r in e){const s=vx(r,t);s.indexOf(n)<0&&s.push(n)}}function Sx(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function et(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}et.groups={};et.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||et.groups;let s;return e&&e.j?s=e:(s=new et(e),t&&r&&mn(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||et.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 et,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new et,o){if(r)if(i.t&&typeof i.t=="string"){const a=Object.assign(Sx(i.t,r),t);mn(o,a,r)}else t&&mn(o,t,r);i.t=o}return s.j[n]=i,i}};const ie=(n,e,t,r,s)=>n.ta(e,t,r,s),Me=(n,e,t,r,s)=>n.tr(e,t,r,s),Uc=(n,e,t,r,s)=>n.ts(e,t,r,s),_=(n,e,t,r,s)=>n.tt(e,t,r,s),Et="WORD",Gi="UWORD",Yf="ASCIINUMERICAL",Uf="ALPHANUMERICAL",Or="LOCALHOST",Xi="TLD",Qi="UTLD",us="SCHEME",_n="SLASH_SCHEME",Ul="NUM",Zi="WS",ql="NL",pr="OPENBRACE",mr="CLOSEBRACE",Os="OPENBRACKET",Ds="CLOSEBRACKET",Ns="OPENPAREN",Rs="CLOSEPAREN",Ls="OPENANGLEBRACKET",Is="CLOSEANGLEBRACKET",js="FULLWIDTHLEFTPAREN",Ps="FULLWIDTHRIGHTPAREN",_s="LEFTCORNERBRACKET",Bs="RIGHTCORNERBRACKET",Fs="LEFTWHITECORNERBRACKET",zs="RIGHTWHITECORNERBRACKET",$s="FULLWIDTHLESSTHAN",Vs="FULLWIDTHGREATERTHAN",Hs="AMPERSAND",Ws="APOSTROPHE",Ys="ASTERISK",Ft="AT",Us="BACKSLASH",qs="BACKTICK",Ks="CARET",Vt="COLON",Kl="COMMA",Js="DOLLAR",gt="DOT",Gs="EQUALS",Jl="EXCLAMATION",lt="HYPHEN",gr="PERCENT",Xs="PIPE",Qs="PLUS",Zs="POUND",yr="QUERY",Gl="QUOTE",qf="FULLWIDTHMIDDLEDOT",Xl="SEMI",yt="SLASH",br="TILDE",eo="UNDERSCORE",Kf="EMOJI",to="SYM";var Jf=Object.freeze({__proto__:null,ALPHANUMERICAL:Uf,AMPERSAND:Hs,APOSTROPHE:Ws,ASCIINUMERICAL:Yf,ASTERISK:Ys,AT:Ft,BACKSLASH:Us,BACKTICK:qs,CARET:Ks,CLOSEANGLEBRACKET:Is,CLOSEBRACE:mr,CLOSEBRACKET:Ds,CLOSEPAREN:Rs,COLON:Vt,COMMA:Kl,DOLLAR:Js,DOT:gt,EMOJI:Kf,EQUALS:Gs,EXCLAMATION:Jl,FULLWIDTHGREATERTHAN:Vs,FULLWIDTHLEFTPAREN:js,FULLWIDTHLESSTHAN:$s,FULLWIDTHMIDDLEDOT:qf,FULLWIDTHRIGHTPAREN:Ps,HYPHEN:lt,LEFTCORNERBRACKET:_s,LEFTWHITECORNERBRACKET:Fs,LOCALHOST:Or,NL:ql,NUM:Ul,OPENANGLEBRACKET:Ls,OPENBRACE:pr,OPENBRACKET:Os,OPENPAREN:Ns,PERCENT:gr,PIPE:Xs,PLUS:Qs,POUND:Zs,QUERY:yr,QUOTE:Gl,RIGHTCORNERBRACKET:Bs,RIGHTWHITECORNERBRACKET:zs,SCHEME:us,SEMI:Xl,SLASH:yt,SLASH_SCHEME:_n,SYM:to,TILDE:br,TLD:Xi,UNDERSCORE:eo,UTLD:Qi,UWORD:Gi,WORD:Et,WS:Zi});const wt=/[a-z]/,nr=new RegExp("\\p{L}","u"),mi=new RegExp("\\p{Emoji}","u"),Tt=/\d/,gi=/\s/,qc="\r",yi=`
|
|
178
|
-
`,
|
|
177
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),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=st.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]}`,Ce(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},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=>Hi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),fx=st.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Ce(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!vk(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Af(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(re.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(ee.create(i.doc,a.pos)):i.setSelection(re.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(re.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xk({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),hx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,px=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,gx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,yx=vt.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",Ce(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)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[wn({find:hx,type:this.type}),wn({find:mx,type:this.type})]},addPasteRules(){return[Qt({find:px,type:this.type}),Qt({find:gx,type:this.type})]}});const bx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",kx="ελ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",Ui="numeric",qi="ascii",Ki="alpha",hr="asciinumeric",ar="alphanumeric",Ji="domain",Wf="emoji",xx="scheme",vx="slashscheme",pi="whitespace";function Sx(n,e){return n in e||(e[n]=[]),e[n]}function mn(n,e,t){e[Ui]&&(e[hr]=!0,e[ar]=!0),e[qi]&&(e[hr]=!0,e[Ki]=!0),e[hr]&&(e[ar]=!0),e[Ki]&&(e[ar]=!0),e[ar]&&(e[Ji]=!0),e[Wf]&&(e[Ji]=!0);for(const r in e){const s=Sx(r,t);s.indexOf(n)<0&&s.push(n)}}function Cx(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function et(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}et.groups={};et.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||et.groups;let s;return e&&e.j?s=e:(s=new et(e),t&&r&&mn(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||et.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 et,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new et,o){if(r)if(i.t&&typeof i.t=="string"){const a=Object.assign(Cx(i.t,r),t);mn(o,a,r)}else t&&mn(o,t,r);i.t=o}return s.j[n]=i,i}};const ie=(n,e,t,r,s)=>n.ta(e,t,r,s),Me=(n,e,t,r,s)=>n.tr(e,t,r,s),Uc=(n,e,t,r,s)=>n.ts(e,t,r,s),_=(n,e,t,r,s)=>n.tt(e,t,r,s),Et="WORD",Gi="UWORD",Yf="ASCIINUMERICAL",Uf="ALPHANUMERICAL",Or="LOCALHOST",Xi="TLD",Qi="UTLD",us="SCHEME",_n="SLASH_SCHEME",Ul="NUM",Zi="WS",ql="NL",pr="OPENBRACE",mr="CLOSEBRACE",Os="OPENBRACKET",Ds="CLOSEBRACKET",Ns="OPENPAREN",Rs="CLOSEPAREN",Ls="OPENANGLEBRACKET",Is="CLOSEANGLEBRACKET",js="FULLWIDTHLEFTPAREN",Ps="FULLWIDTHRIGHTPAREN",_s="LEFTCORNERBRACKET",Bs="RIGHTCORNERBRACKET",Fs="LEFTWHITECORNERBRACKET",zs="RIGHTWHITECORNERBRACKET",$s="FULLWIDTHLESSTHAN",Vs="FULLWIDTHGREATERTHAN",Hs="AMPERSAND",Ws="APOSTROPHE",Ys="ASTERISK",Ft="AT",Us="BACKSLASH",qs="BACKTICK",Ks="CARET",Vt="COLON",Kl="COMMA",Js="DOLLAR",gt="DOT",Gs="EQUALS",Jl="EXCLAMATION",lt="HYPHEN",gr="PERCENT",Xs="PIPE",Qs="PLUS",Zs="POUND",yr="QUERY",Gl="QUOTE",qf="FULLWIDTHMIDDLEDOT",Xl="SEMI",yt="SLASH",br="TILDE",eo="UNDERSCORE",Kf="EMOJI",to="SYM";var Jf=Object.freeze({__proto__:null,ALPHANUMERICAL:Uf,AMPERSAND:Hs,APOSTROPHE:Ws,ASCIINUMERICAL:Yf,ASTERISK:Ys,AT:Ft,BACKSLASH:Us,BACKTICK:qs,CARET:Ks,CLOSEANGLEBRACKET:Is,CLOSEBRACE:mr,CLOSEBRACKET:Ds,CLOSEPAREN:Rs,COLON:Vt,COMMA:Kl,DOLLAR:Js,DOT:gt,EMOJI:Kf,EQUALS:Gs,EXCLAMATION:Jl,FULLWIDTHGREATERTHAN:Vs,FULLWIDTHLEFTPAREN:js,FULLWIDTHLESSTHAN:$s,FULLWIDTHMIDDLEDOT:qf,FULLWIDTHRIGHTPAREN:Ps,HYPHEN:lt,LEFTCORNERBRACKET:_s,LEFTWHITECORNERBRACKET:Fs,LOCALHOST:Or,NL:ql,NUM:Ul,OPENANGLEBRACKET:Ls,OPENBRACE:pr,OPENBRACKET:Os,OPENPAREN:Ns,PERCENT:gr,PIPE:Xs,PLUS:Qs,POUND:Zs,QUERY:yr,QUOTE:Gl,RIGHTCORNERBRACKET:Bs,RIGHTWHITECORNERBRACKET:zs,SCHEME:us,SEMI:Xl,SLASH:yt,SLASH_SCHEME:_n,SYM:to,TILDE:br,TLD:Xi,UNDERSCORE:eo,UTLD:Qi,UWORD:Gi,WORD:Et,WS:Zi});const wt=/[a-z]/,nr=new RegExp("\\p{L}","u"),mi=new RegExp("\\p{Emoji}","u"),Tt=/\d/,gi=/\s/,qc="\r",yi=`
|
|
178
|
+
`,Mx="️",wx="",bi="";let Xr=null,Qr=null;function Tx(n=[]){const e={};et.groups=e;const t=new et;Xr==null&&(Xr=Kc(bx)),Qr==null&&(Qr=Kc(kx)),_(t,"'",Ws),_(t,"{",pr),_(t,"}",mr),_(t,"[",Os),_(t,"]",Ds),_(t,"(",Ns),_(t,")",Rs),_(t,"<",Ls),_(t,">",Is),_(t,"(",js),_(t,")",Ps),_(t,"「",_s),_(t,"」",Bs),_(t,"『",Fs),_(t,"』",zs),_(t,"<",$s),_(t,">",Vs),_(t,"&",Hs),_(t,"*",Ys),_(t,"@",Ft),_(t,"`",qs),_(t,"^",Ks),_(t,":",Vt),_(t,",",Kl),_(t,"$",Js),_(t,".",gt),_(t,"=",Gs),_(t,"!",Jl),_(t,"-",lt),_(t,"%",gr),_(t,"|",Xs),_(t,"+",Qs),_(t,"#",Zs),_(t,"?",yr),_(t,'"',Gl),_(t,"/",yt),_(t,";",Xl),_(t,"~",br),_(t,"_",eo),_(t,"\\",Us),_(t,"・",qf);const r=Me(t,Tt,Ul,{[Ui]:!0});Me(r,Tt,r);const s=Me(r,wt,Yf,{[hr]:!0}),o=Me(r,nr,Uf,{[ar]:!0}),i=Me(t,wt,Et,{[qi]:!0});Me(i,Tt,s),Me(i,wt,i),Me(s,Tt,s),Me(s,wt,s);const l=Me(t,nr,Gi,{[Ki]:!0});Me(l,wt),Me(l,Tt,o),Me(l,nr,l),Me(o,Tt,o),Me(o,wt),Me(o,nr,o);const a=_(t,yi,ql,{[pi]:!0}),c=_(t,qc,Zi,{[pi]:!0}),u=Me(t,gi,Zi,{[pi]:!0});_(t,bi,u),_(c,yi,a),_(c,bi,u),Me(c,gi,u),_(u,qc),_(u,yi),Me(u,gi,u),_(u,bi,u);const d=Me(t,mi,Kf,{[Wf]:!0});_(d,"#"),Me(d,mi,d),_(d,Mx,d);const f=_(d,wx);_(f,"#"),Me(f,mi,d);const h=[[wt,i],[Tt,s]],p=[[wt,null],[nr,l],[Tt,o]];for(let g=0;g<Xr.length;g++)Pt(t,Xr[g],Xi,Et,h);for(let g=0;g<Qr.length;g++)Pt(t,Qr[g],Qi,Gi,p);mn(Xi,{tld:!0,ascii:!0},e),mn(Qi,{utld:!0,alpha:!0},e),Pt(t,"file",us,Et,h),Pt(t,"mailto",us,Et,h),Pt(t,"http",_n,Et,h),Pt(t,"https",_n,Et,h),Pt(t,"ftp",_n,Et,h),Pt(t,"ftps",_n,Et,h),mn(us,{scheme:!0,ascii:!0},e),mn(_n,{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]?{[xx]:!0}:{[vx]:!0};y.indexOf("-")>=0?k[Ji]=!0:wt.test(y)?Tt.test(y)?k[hr]=!0:k[qi]=!0:k[Ui]=!0,Uc(t,y,y,k)}return Uc(t,"localhost",Or,{ascii:!0}),t.jd=new et(to),{start:t,tokens:Object.assign({groups:e},Jf)}}function Gf(n,e){const t=Ex(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 Ex(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 Pt(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 et(r),o.jr=s.slice(),n.j[a]=o),n=o}return o=new et(t),o.jr=s.slice(),n.j[e[i-1]]=o,o}function Kc(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 Dr={defaultProtocol:"http",events:null,format:Jc,formatHref:Jc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ql(n,e=null){let t=Object.assign({},Dr);n&&(t=Object.assign(t,n instanceof Ql?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}Ql.prototype={o:Dr,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]:Dr[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 Jc(n){return n}function Xf(n,e){this.t="token",this.v=n,this.tk=e}Xf.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=Dr.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 Lo(n,e){class t extends Xf{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 Gc=Lo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Xc=Lo("text"),Ax=Lo("nl"),Zr=Lo("url",{isLink:!0,toHref(n=Dr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Or&&n[1].t===Vt}}),it=n=>new et(n);function Ox({groups:n}){const e=n.domain.concat([Hs,Ys,Ft,Us,qs,Ks,Js,Gs,lt,Ul,gr,Xs,Qs,Zs,yt,to,br,eo]),t=[Ws,Vt,Kl,gt,Jl,gr,yr,Gl,Xl,Ls,Is,pr,mr,Ds,Os,Ns,Rs,js,Ps,_s,Bs,Fs,zs,$s,Vs],r=[Hs,Ws,Ys,Us,qs,Ks,Js,Gs,lt,pr,mr,gr,Xs,Qs,Zs,yr,yt,to,br,eo],s=it(),o=_(s,br);ie(o,r,o),ie(o,n.domain,o);const i=it(),l=it(),a=it();ie(s,n.domain,i),ie(s,n.scheme,l),ie(s,n.slashscheme,a),ie(i,r,o),ie(i,n.domain,i);const c=_(i,Ft);_(o,Ft,c),_(l,Ft,c),_(a,Ft,c);const u=_(o,gt);ie(u,r,o),ie(u,n.domain,o);const d=it();ie(c,n.domain,d),ie(d,n.domain,d);const f=_(d,gt);ie(f,n.domain,d);const h=it(Gc);ie(f,n.tld,h),ie(f,n.utld,h),_(c,Or,h);const p=_(d,lt);_(p,lt,p),ie(p,n.domain,d),ie(h,n.domain,d),_(h,gt,f),_(h,lt,p);const g=_(h,Vt);ie(g,n.numeric,Gc);const y=_(i,lt),b=_(i,gt);_(y,lt,y),ie(y,n.domain,i),ie(b,r,o),ie(b,n.domain,i);const k=it(Zr);ie(b,n.tld,k),ie(b,n.utld,k),ie(k,n.domain,i),ie(k,r,o),_(k,gt,b),_(k,lt,y),_(k,Ft,c);const w=_(k,Vt),E=it(Zr);ie(w,n.numeric,E);const C=it(Zr),x=it();ie(C,e,C),ie(C,t,x),ie(x,e,C),ie(x,t,x),_(k,yt,C),_(E,yt,C);const M=_(l,Vt),O=_(a,Vt),j=_(O,yt),B=_(j,yt);ie(l,n.domain,i),_(l,gt,b),_(l,lt,y),ie(a,n.domain,i),_(a,gt,b),_(a,lt,y),ie(M,n.domain,C),_(M,yt,C),_(M,yr,C),ie(B,n.domain,C),ie(B,e,C),_(B,yt,C);const Y=[[pr,mr],[Os,Ds],[Ns,Rs],[Ls,Is],[js,Ps],[_s,Bs],[Fs,zs],[$s,Vs]];for(let V=0;V<Y.length;V++){const[F,q]=Y[V],G=_(C,F);_(x,F,G),_(G,q,C);const J=it(Zr);ie(G,e,J);const X=it();ie(G,t),ie(J,e,J),ie(J,t,X),ie(X,e,J),ie(X,t,X),_(J,q,C),_(X,q,C)}return _(s,Or,k),_(s,ql,Ax),{start:s,tokens:Jf}}function Dx(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(ki(Xc,e,i)),i=[]),s-=f,u-=f;const h=d.t,p=t.slice(s-u,s);o.push(ki(h,e,p))}}return i.length>0&&o.push(ki(Xc,e,i)),o}function ki(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 Nx=typeof console<"u"&&console&&console.warn||(()=>{}),Rx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ve={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Lx(){return et.groups={},ve.scanner=null,ve.parser=null,ve.tokenQueue=[],ve.pluginQueue=[],ve.customSchemes=[],ve.initialized=!1,ve}function Qc(n,e=!1){if(ve.initialized&&Nx(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Rx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
179
179
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
180
180
|
2. Cannot start or end with "-"
|
|
181
|
-
3. "-" cannot repeat`);ve.customSchemes.push([n,e])}function
|
|
182
|
-
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
183
|
-
`,d+=1;else if(h.match(
|
|
181
|
+
3. "-" cannot repeat`);ve.customSchemes.push([n,e])}function Ix(){ve.scanner=Tx(ve.customSchemes);for(let n=0;n<ve.tokenQueue.length;n++)ve.tokenQueue[n][1]({scanner:ve.scanner});ve.parser=Ox(ve.scanner.tokens);for(let n=0;n<ve.pluginQueue.length;n++)ve.pluginQueue[n][1]({scanner:ve.scanner,parser:ve.parser});return ve.initialized=!0,ve}function Zl(n){return ve.initialized||Ix(),Dx(ve.parser.start,n,Gf(ve.scanner.start,n))}Zl.scan=Gf;function Qf(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 Ql(t),s=Zl(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 ea="[\0- -\u2029 ]",jx=new RegExp(ea),Px=new RegExp(`${ea}$`),_x=new RegExp(ea,"g");function Bx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Fx(n){return new Te({key:new Pe("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=xf(t.doc,[...e]);if(Ef(l).forEach(({newRange:c})=>{const u=wb(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(!Px.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(jx).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=Zl(p).map(b=>b.toObject(n.defaultProtocol));if(!Bx(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=>{$l(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 zx(n){return new Te({key:new Pe("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=Tf(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 $x(n){return new Te({key:new Pe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:o}=e,{selection:i}=o,{empty:l}=i;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Qf(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||s!==void 0&&!s(c.href)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function un(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(_x,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Zf=vt.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"){Qc(n);return}Qc(n.scheme,n.optionalSlashes)})},onDestroy(){Lx()},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)=>!!un(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=>!!un(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=>!!un(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ce(this.options.HTMLAttributes,n),0]:["a",Ce(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!un(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=>!!un(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[Qt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=Qf(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!un(i,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(o=>{this.options.shouldAutoLink(o.value)&&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(Fx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!un(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(zx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push($x({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Vx=Zf,Hx=Object.defineProperty,Wx=(n,e)=>{for(var t in e)Hx(n,t,{get:e[t],enumerable:!0})},Yx="listItem",Zc="textStyle",eu=/^\s*([-+*])\s$/,eh=st.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",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
182
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Yx,this.editor.getAttributes(Zc)).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:eu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=qn({find:eu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Zc),editor:this.editor})),[n]}}),th=st.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(s=>s.type==="paragraph"))t=e.parseChildren(n.tokens);else{const s=n.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(s.tokens)}],n.tokens.length>1){const i=n.tokens.slice(1),l=e.parseChildren(i);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Yl(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Ux={};Wx(Ux,{findListItemPos:()=>jr,getNextListDepth:()=>ta,handleBackspace:()=>el,handleDelete:()=>tl,hasListBefore:()=>nh,hasListItemAfter:()=>qx,hasListItemBefore:()=>rh,listItemHasSubList:()=>sh,nextListIsDeeper:()=>oh,nextListIsHigher:()=>ih});var jr=(n,e)=>{const{$from:t}=e.selection,r=Re(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}},ta=(n,e)=>{const t=jr(n,e);if(!t)return!1;const[,r]=jb(e,n,t.$pos.pos+4);return r},nh=(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))},rh=(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)},sh=(n,e,t)=>{if(!t)return!1;const r=Re(n,e.schema);let s=!1;return t.descendants(o=>{o.type===r&&(s=!0)}),s},el=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Xt(n.state,e)&&nh(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(!Xt(n.state,e)||!Fb(n.state))return!1;const r=jr(e,n.state);if(!r)return!1;const o=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=sh(e,n.state,o);return rh(e,n.state)&&!i?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},oh=(n,e)=>{const t=ta(n,e),r=jr(n,e);return!r||!t?!1:t>r.depth},ih=(n,e)=>{const t=ta(n,e),r=jr(n,e);return!r||!t?!1:t<r.depth},tl=(n,e)=>{if(!Xt(n.state,e)||!Bb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:oh(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():ih(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},qx=(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)},lh=Ae.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&&tl(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&&tl(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&&el(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&&el(n,t,r)&&(e=!0)}),e}}}}),tu=/^(\s*)(\d+)\.\s+(.*)$/,Kx=/^\s/;function Jx(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],o=s.match(tu);if(!o)break;const[,i,l,a]=o,c=i.length;let u=a,d=t+1;const f=[s];for(;d<n.length;){const h=n[d];if(h.match(tu))break;if(h.trim()==="")f.push(h),u+=`
|
|
183
|
+
`,d+=1;else if(h.match(Kx))f.push(h),u+=`
|
|
184
184
|
${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:u.trim(),raw:f.join(`
|
|
185
185
|
`)}),r=d,t=d}return[e,r]}function ah(n,e,t){var r;const s=[];let o=0;for(;o<n.length;){const i=n[o];if(i.indent===e){const l=i.content.split(`
|
|
186
186
|
`),a=((r=l[0])==null?void 0:r.trim())||"",c=[];a&&c.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const u=l.slice(1).join(`
|
|
187
187
|
`).trim();if(u){const h=t.blockTokens(u);c.push(...h)}let d=o+1;const f=[];for(;d<n.length&&n[d].indent>e;)f.push(n[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(g=>g.indent)),p=ah(f,h,t);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(g=>g.raw).join(`
|
|
188
|
-
`)})}s.push({type:"list_item",raw:i.raw,tokens:c}),o=d}else o+=1}return s}function
|
|
188
|
+
`)})}s.push({type:"list_item",raw:i.raw,tokens:c}),o=d}else o+=1}return s}function Gx(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const o=e.parseChildren([s]);r.push({type:"paragraph",content:o})}else{const o=e.parseChildren([s]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}var Xx="listItem",nu="textStyle",ru=/^(\d+)\.\s$/,ch=st.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",Ce(this.options.HTMLAttributes,t),0]:["ol",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?Gx(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
189
189
|
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const s=n.split(`
|
|
190
|
-
`),[o,i]=
|
|
191
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
192
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const i=Wi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return i?[{type:"taskList",raw:i.raw,items:i.items}]:t.blockTokens(o)},s=Wi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ae.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(eh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(th.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(lh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(ch.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Qx.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Zx.configure(this.options.taskList)),n}});var e1=st.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),t1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,n1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,r1=vt.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",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,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[wn({find:t1,type:this.type})]},addPasteRules(){return[Qt({find:n1,type:this.type})]}}),s1=st.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uh=vt.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",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:t.inlineTokens(o)}}},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()}}}),o1=uh;function i1(n={}){return new Te({view(e){return new l1(e,n)}})}class l1{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=dd(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 we extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return we.valid(r)?new we(r):le.near(r)}content(){return H.empty}eq(e){return e instanceof we&&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 we(e.resolve(t.pos))}getBookmark(){return new na(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!a1(e)||!c1(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&&we.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(we.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!ee.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(we.valid(l))return l}return null}}}we.prototype.visible=!1;we.findFrom=we.findGapCursorFrom;le.jsonID("gapcursor",we);class na{constructor(e){this.pos=e}map(e){return new na(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return we.valid(t)?new we(t):le.near(t)}}function dh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function a1(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||dh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function c1(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||dh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function u1(){return new Te({props:{decorations:p1,createSelectionBetween(n,e,t){return e.pos==t.pos&&we.valid(t)?new we(t):null},handleClick:f1,handleKeyDown:d1,handleDOMEvents:{beforeinput:h1}}})}const d1=ff({ArrowLeft:es("horiz",-1),ArrowRight:es("horiz",1),ArrowUp:es("vert",-1),ArrowDown:es("vert",1)});function es(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 re){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=we.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new we(c))),!0):!1}}function f1(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!we.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&ee.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new we(r))),!0)}function h1(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof we))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=L.empty;for(let i=r.length-1;i>=0;i--)s=L.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new H(s,0,0));return o.setSelection(re.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function p1(n){if(!(n.selection instanceof we))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[qe.widget(n.selection.head,e,{key:"gapcursor"})])}var no=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length<no&&this.leafAppend(e)||this.length<no&&e.leafPrepend(this)||this.appendInner(e)):this};je.prototype.prepend=function(e){return e.length?je.from(e).append(this):this};je.prototype.appendInner=function(e){return new m1(this,e)};je.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.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)};je.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};je.from=function(e){return e instanceof je?e:e&&e.length?new fh(e):je.empty};var fh=(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<=no)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=no)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})(je);je.empty=new fh([]);var m1=(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})(je);const g1=500;class ht{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 bt(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 bt(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 ht(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 bt(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>b1&&(l=y1(l,c),i-=c),new ht(l.append(o),i)}remapping(e,t){let r=new Sr;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 ht(this.items.append(e.map(t=>new bt(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 bt(p,g,y))}else r.push(new bt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new bt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new ht(u,l);return d.emptyItemCount()>g1&&(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 bt(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 ht(je.from(s.reverse()),o)}}ht.empty=new ht(je.empty,0);function y1(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class bt{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 bt(t.getMap().invert(),t,this.selection)}}}class zt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const b1=20;function k1(n,e,t,r){let s=t.getMeta(xn),o;if(s)return s.historyState;t.getMeta(S1)&&(n=new zt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(xn))return i.getMeta(xn).redo?new zt(n.done.addTransform(t,void 0,r,ds(e)),n.undone,su(t.mapping.maps),n.prevTime,n.prevComposition):new zt(n.done,n.undone.addTransform(t,void 0,r,ds(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||!x1(t,n.prevRanges)),c=i?xi(n.prevRanges,t.mapping):su(t.mapping.maps);return new zt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ds(e)),ht.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new zt(n.done.rebased(t,o),n.undone.rebased(t,o),xi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new zt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),xi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function x1(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 su(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 xi(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 v1(n,e,t){let r=ds(e),s=xn.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 zt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(xn,{redo:t,historyState:a})}let vi=!1,ou=null;function ds(n){let e=n.plugins;if(ou!=e){vi=!1,ou=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){vi=!0;break}}return vi}const xn=new Pe("history"),S1=new Pe("closeHistory");function C1(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Te({key:xn,state:{init(){return new zt(ht.empty,ht.empty,null,0,-1)},apply(e,t,r){return k1(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?ph:r=="historyRedo"?mh:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function hh(n,e){return(t,r)=>{let s=xn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=v1(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ph=hh(!1,!0),mh=hh(!0,!0);Ae.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 Te({key:new Pe("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 M1=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[i1(this.options)]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Te({key:new Pe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return Se.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}))}),Se.create(n,o)}}})]}});var w1=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[u1()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ye(Z(n,"allowGapCursor",t)))!=null?e:null}}});Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Te({key:new Pe("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&&Do(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}),Se.create(n,s)}}})]}});Ae.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Te({key:new Pe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Af(t.selection)||n.view.dragging?null:Se.create(t.doc,[qe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function iu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var T1=Ae.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Pe(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new Te({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[t];if(u)return a.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!iu({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!iu({node:i,types:r})}}})]}}),E1=Ae.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ph(n,e),redo:()=>({state:n,dispatch:e})=>mh(n,e)}},addProseMirrorPlugins(){return[C1(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()}}}),A1=Ae.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(tx.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Gk.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(eh.configure(this.options.bulletList)),this.options.code!==!1&&s.push(sx.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(lx.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(ax.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(M1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(w1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(cx.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(ux.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(E1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(dx.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(gx.configure(this.options.italic)),this.options.listItem!==!1&&s.push(th.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(lh.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Zf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(ch.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(e1.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(r1.configure(this.options.strike)),this.options.text!==!1&&s.push(s1.configure(this.options.text)),this.options.underline!==!1&&s.push(uh.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(T1.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),O1=A1,D1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,N1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,R1=vt.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",Ce(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const s=/^(==)([^=]+)(==)/.exec(n);if(s){const o=s[2].trim(),i=t.inlineTokens(o);return{type:"highlight",raw:s[0],text:o,tokens:i}}}},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[wn({find:D1,type:this.type})]},addPasteRules(){return[Qt({find:N1,type:this.type})]}}),L1=R1,I1=Ae.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")}}}),j1=I1,P1=vt.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",Ce(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()}}}),_1=P1,B1=vt.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",Ce(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()}}}),F1=B1,An={root:"m_dd3f7539",Typography:"m_f2016866",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 z1={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",sourceCodeControlLabel:"Switch between text/source code",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}`},[$1,St]=v.createSafeContext("RichTextEditor component was not found in tree"),ra=v.factory((n,e)=>{const t=v.useProps("RichTextEditorContent",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,...a}=t,c=St();return c.withTypographyStyles?m.jsx(v.Typography,{...c.getStyles("Typography",{className:s,style:o,styles:i,classNames:r}),unstyled:c.unstyled,ref:e,children:m.jsx(v.Box,{component:Wc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i}),...a})}):m.jsx(v.Box,{component:Wc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i,className:s,style:o}),...a})});ra.classes=An;ra.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 V1(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 H1(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 W1(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 Y1(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 U1(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 q1(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 K1(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 J1(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 G1(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 X1(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 Q1(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 Z1(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 ev(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 tv(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 nv(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 rv(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 sv(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 ov(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 iv(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 lv(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 av(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 gh(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 cv(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 uv(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 yh(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 dv(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 fv(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 hv(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 pv(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 mv(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 gv(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 yv(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 bv(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 kv(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 xv(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 vv(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"})]})}function Sv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914
|
|
190
|
+
`),[o,i]=Jx(s);if(o.length===0)return;const l=ah(o,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,i).join(`
|
|
191
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Xx,this.editor.getAttributes(nu)).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:ru,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:ru,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nu)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Qx=/^\s*(\[([( |x])?\])\s$/,Zx=st.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",Ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Yl(n,e,s)},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:Qx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),e1=st.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",Ce(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
192
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const i=Wi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return i?[{type:"taskList",raw:i.raw,items:i.items}]:t.blockTokens(o)},s=Wi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ae.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(eh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(th.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(lh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(ch.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Zx.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(e1.configure(this.options.taskList)),n}});var t1=st.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),n1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,r1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,s1=vt.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",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,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[wn({find:n1,type:this.type})]},addPasteRules(){return[Qt({find:r1,type:this.type})]}}),o1=st.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uh=vt.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",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:t.inlineTokens(o)}}},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()}}}),i1=uh;function l1(n={}){return new Te({view(e){return new a1(e,n)}})}class a1{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=dd(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 we extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return we.valid(r)?new we(r):le.near(r)}content(){return H.empty}eq(e){return e instanceof we&&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 we(e.resolve(t.pos))}getBookmark(){return new na(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!c1(e)||!u1(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&&we.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(we.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!ee.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(we.valid(l))return l}return null}}}we.prototype.visible=!1;we.findFrom=we.findGapCursorFrom;le.jsonID("gapcursor",we);class na{constructor(e){this.pos=e}map(e){return new na(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return we.valid(t)?new we(t):le.near(t)}}function dh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function c1(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||dh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function u1(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||dh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function d1(){return new Te({props:{decorations:m1,createSelectionBetween(n,e,t){return e.pos==t.pos&&we.valid(t)?new we(t):null},handleClick:h1,handleKeyDown:f1,handleDOMEvents:{beforeinput:p1}}})}const f1=ff({ArrowLeft:es("horiz",-1),ArrowRight:es("horiz",1),ArrowUp:es("vert",-1),ArrowDown:es("vert",1)});function es(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 re){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=we.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new we(c))),!0):!1}}function h1(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!we.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&ee.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new we(r))),!0)}function p1(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof we))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=L.empty;for(let i=r.length-1;i>=0;i--)s=L.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new H(s,0,0));return o.setSelection(re.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function m1(n){if(!(n.selection instanceof we))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[qe.widget(n.selection.head,e,{key:"gapcursor"})])}var no=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length<no&&this.leafAppend(e)||this.length<no&&e.leafPrepend(this)||this.appendInner(e)):this};je.prototype.prepend=function(e){return e.length?je.from(e).append(this):this};je.prototype.appendInner=function(e){return new g1(this,e)};je.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.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)};je.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};je.from=function(e){return e instanceof je?e:e&&e.length?new fh(e):je.empty};var fh=(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<=no)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=no)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})(je);je.empty=new fh([]);var g1=(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})(je);const y1=500;class ht{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 bt(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 bt(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 ht(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 bt(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>k1&&(l=b1(l,c),i-=c),new ht(l.append(o),i)}remapping(e,t){let r=new Sr;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 ht(this.items.append(e.map(t=>new bt(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 bt(p,g,y))}else r.push(new bt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new bt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new ht(u,l);return d.emptyItemCount()>y1&&(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 bt(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 ht(je.from(s.reverse()),o)}}ht.empty=new ht(je.empty,0);function b1(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class bt{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 bt(t.getMap().invert(),t,this.selection)}}}class zt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const k1=20;function x1(n,e,t,r){let s=t.getMeta(xn),o;if(s)return s.historyState;t.getMeta(C1)&&(n=new zt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(xn))return i.getMeta(xn).redo?new zt(n.done.addTransform(t,void 0,r,ds(e)),n.undone,su(t.mapping.maps),n.prevTime,n.prevComposition):new zt(n.done,n.undone.addTransform(t,void 0,r,ds(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||!v1(t,n.prevRanges)),c=i?xi(n.prevRanges,t.mapping):su(t.mapping.maps);return new zt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ds(e)),ht.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new zt(n.done.rebased(t,o),n.undone.rebased(t,o),xi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new zt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),xi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function v1(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 su(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 xi(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 S1(n,e,t){let r=ds(e),s=xn.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 zt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(xn,{redo:t,historyState:a})}let vi=!1,ou=null;function ds(n){let e=n.plugins;if(ou!=e){vi=!1,ou=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){vi=!0;break}}return vi}const xn=new Pe("history"),C1=new Pe("closeHistory");function M1(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Te({key:xn,state:{init(){return new zt(ht.empty,ht.empty,null,0,-1)},apply(e,t,r){return x1(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?ph:r=="historyRedo"?mh:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function hh(n,e){return(t,r)=>{let s=xn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=S1(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ph=hh(!1,!0),mh=hh(!0,!0);Ae.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 Te({key:new Pe("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 w1=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[l1(this.options)]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Te({key:new Pe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return Se.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}))}),Se.create(n,o)}}})]}});var T1=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[d1()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ye(Z(n,"allowGapCursor",t)))!=null?e:null}}});Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Te({key:new Pe("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&&Do(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}),Se.create(n,s)}}})]}});Ae.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Te({key:new Pe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Af(t.selection)||n.view.dragging?null:Se.create(t.doc,[qe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function iu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var E1=Ae.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Pe(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new Te({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[t];if(u)return a.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!iu({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!iu({node:i,types:r})}}})]}}),A1=Ae.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ph(n,e),redo:()=>({state:n,dispatch:e})=>mh(n,e)}},addProseMirrorPlugins(){return[M1(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()}}}),O1=Ae.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(nx.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Xk.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(eh.configure(this.options.bulletList)),this.options.code!==!1&&s.push(ox.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(ax.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(cx.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(w1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(T1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(ux.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(dx.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(A1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(fx.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(yx.configure(this.options.italic)),this.options.listItem!==!1&&s.push(th.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(lh.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Zf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(ch.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(t1.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(s1.configure(this.options.strike)),this.options.text!==!1&&s.push(o1.configure(this.options.text)),this.options.underline!==!1&&s.push(uh.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(E1.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),D1=O1,N1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,R1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,L1=vt.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",Ce(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const s=/^(==)([^=]+)(==)/.exec(n);if(s){const o=s[2].trim(),i=t.inlineTokens(o);return{type:"highlight",raw:s[0],text:o,tokens:i}}}},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[wn({find:N1,type:this.type})]},addPasteRules(){return[Qt({find:R1,type:this.type})]}}),I1=L1,j1=Ae.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")}}}),P1=j1,_1=vt.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",Ce(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()}}}),B1=_1,F1=vt.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",Ce(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()}}}),z1=F1,An={root:"m_dd3f7539",Typography:"m_f2016866",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 $1={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",sourceCodeControlLabel:"Switch between text/source code",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}`},[V1,St]=v.createSafeContext("RichTextEditor component was not found in tree"),ra=v.factory((n,e)=>{const t=v.useProps("RichTextEditorContent",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,...a}=t,c=St();return c.withTypographyStyles?m.jsx(v.Typography,{...c.getStyles("Typography",{className:s,style:o,styles:i,classNames:r}),unstyled:c.unstyled,ref:e,children:m.jsx(v.Box,{component:Wc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i}),...a})}):m.jsx(v.Box,{component:Wc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i,className:s,style:o}),...a})});ra.classes=An;ra.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 H1(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 W1(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 Y1(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 U1(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 q1(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 K1(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 J1(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 G1(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 X1(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 Q1(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 Z1(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 ev(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 tv(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 nv(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 rv(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 sv(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 ov(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 iv(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 lv(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 av(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 cv(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 gh(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 uv(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 dv(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 yh(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 fv(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 hv(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 pv(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 mv(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 gv(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 yv(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 bv(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 kv(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 xv(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 vv(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 Sv(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"})]})}function Cv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914
|
|
193
193
|
a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18
|
|
194
|
-
a1 1 0 0 1 1 1Z`}),m.jsx("path",{d:"M10 11l-2 2 2 2"}),m.jsx("path",{d:"M14 11l2 2-2 2"})]})}const Cv={interactive:!0},On=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControl",Cv,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=St();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)}})});On.classes=An;On.displayName="@mantine/tiptap/RichTextEditorControl";const sa=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=St();return m.jsx(On,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});sa.displayName="@mantine/tiptap/RichTextEditorControlBase";function me({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=St(),u=c[n];return m.jsx(sa,{"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1,...i,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run()})});return o.displayName=`@mantine/tiptap/${n}`,o}const Mv=me({label:"boldControlLabel",icon:n=>m.jsx(V1,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),wv=me({label:"italicControlLabel",icon:n=>m.jsx(H1,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),Tv=me({label:"underlineControlLabel",icon:n=>m.jsx(W1,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Ev=me({label:"strikeControlLabel",icon:n=>m.jsx(Y1,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Av=me({label:"clearFormattingControlLabel",icon:n=>m.jsx(U1,{...n}),operation:{name:"unsetAllMarks"}}),Ov=me({label:"unlinkControlLabel",icon:n=>m.jsx(tv,{...n}),operation:{name:"unsetLink"}}),Dv=me({label:"bulletListControlLabel",icon:n=>m.jsx(Z1,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Nv=me({label:"orderedListControlLabel",icon:n=>m.jsx(ev,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Rv=me({label:"h1ControlLabel",icon:n=>m.jsx(q1,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Lv=me({label:"h2ControlLabel",icon:n=>m.jsx(K1,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Iv=me({label:"h3ControlLabel",icon:n=>m.jsx(J1,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),jv=me({label:"h4ControlLabel",icon:n=>m.jsx(G1,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Pv=me({label:"h5ControlLabel",icon:n=>m.jsx(X1,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),_v=me({label:"h6ControlLabel",icon:n=>m.jsx(Q1,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Bv=me({label:"blockquoteControlLabel",icon:n=>m.jsx(nv,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),Fv=me({label:"alignLeftControlLabel",icon:n=>m.jsx(rv,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),zv=me({label:"alignRightControlLabel",icon:n=>m.jsx(sv,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),$v=me({label:"alignCenterControlLabel",icon:n=>m.jsx(ov,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),Vv=me({label:"alignJustifyControlLabel",icon:n=>m.jsx(iv,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),Hv=me({label:"subscriptControlLabel",icon:n=>m.jsx(lv,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Wv=me({label:"superscriptControlLabel",icon:n=>m.jsx(av,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),Yv=me({label:"codeControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),Uv=me({label:"codeBlockControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),qv=me({label:"highlightControlLabel",icon:n=>m.jsx(cv,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Kv=me({label:"hrControlLabel",icon:n=>m.jsx(uv,{...n}),operation:{name:"setHorizontalRule"}}),Jv=me({label:"unsetColorControlLabel",icon:n=>m.jsx(yh,{...n}),operation:{name:"unsetColor"}}),Gv=me({label:"undoControlLabel",icon:n=>m.jsx(yv,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),Xv=me({label:"redoControlLabel",icon:n=>m.jsx(bv,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),Qv=me({label:"tasksControlLabel",icon:n=>m.jsx(kv,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),Zv=me({label:"tasksSinkLabel",icon:n=>m.jsx(xv,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),eS=me({label:"tasksLiftLabel",icon:n=>m.jsx(vv,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),tS=n=>m.jsx(mv,{...n}),oa=v.factory((n,e)=>{var V;const t=v.useProps("RichTextEditorLinkControl",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=St(),p={classNames:r,styles:i},[g,y]=Cp(""),[b,k]=T.useState(d),[w,{open:E,close:C}]=il(!1),x=()=>{var q;E();const F=(q=h.editor)==null?void 0:q.getAttributes("link");y((F==null?void 0:F.href)||""),k(F!=null&&F.href?(F==null?void 0:F.target)==="_blank":d)},M=()=>{C(),y(""),k(d)},O=()=>{var F,q;M(),g===""?(F=h.editor)==null||F.chain().focus().extendMarkRange("link").unsetLink().run():(q=h.editor)==null||q.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},j=F=>{F.key==="Enter"&&(F.preventDefault(),O())};xp("edit-link",x,!1);const{resolvedClassNames:B,resolvedStyles:Y}=v.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(v.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:w,onChange:F=>!F&&M(),offset:-44,zIndex:1e4,...c,children:[m.jsx(v.Popover.Target,{children:m.jsx(sa,{icon:a||tS,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:x,active:(V=h.editor)==null?void 0:V.isActive("link"),ref:e,classNames:B,styles:Y,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:j,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(F=>!F),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(gv,{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})]})})]})});oa.classes=An;oa.displayName="@mantine/tiptap/RichTextEditorLinkControl";const bh=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=v.useProps("RichTextEditorColorPickerControl",null,n),{editor:i,labels:l,getStyles:a,variant:c}=St(),[u,{toggle:d,close:f}]=il(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(w,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(w).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((w,E)=>m.jsx(v.ColorSwatch,{component:"button",color:w,onClick:()=>y(w),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(w),"aria-label":l.colorPickerColorLabel(w)},E));return m.jsxs(v.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:w=>!w&&f(),...t,children:[m.jsx(v.Popover.Target,{children:m.jsx(On,{...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:w=>y(w,!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(fv,{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(yh,{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(dv,{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(hv,{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(pv,{style:{width:v.rem(16),height:v.rem(16)}})})]})})]})]})});bh.displayName="@mantine/tiptap/ColorPickerControl";const kh=T.forwardRef((n,e)=>{const{color:t,...r}=v.useProps("RichTextEditorColorControl",null,n),{editor:s,labels:o,variant:i}=St(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(On,{...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})})});kh.displayName="@mantine/tiptap/RichTextEditorColorControl";const nS={},xh=T.forwardRef((n,e)=>{const{...t}=v.useProps("RichTextEditorSourceCodeControl",nS,n),{editor:r,labels:s,variant:o,onSourceCodeTextSwitch:i}=St(),[l,a]=T.useState(!1),c=()=>{l?r==null||r.commands.setContent(r.getText(),{emitUpdate:!0}):r==null||r.commands.setContent(`<textarea>${r.getHTML()}</textarea>`);const u=!l;a(u),i==null||i(u)};return m.jsx(On,{...t,variant:o,active:l,"aria-label":s.sourceCodeControlLabel,title:s.sourceCodeControlLabel,onClick:()=>c(),ref:e,children:m.jsx(Sv,{style:{width:v.rem(16),height:v.rem(16)}})})});xh.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const ia=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControlsGroup",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=St();return m.jsx(v.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});ia.classes=An;ia.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const la=v.factory((n,e)=>{const t=v.useProps("RichTextEditorToolbar",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=St();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)}})});la.classes=An;la.displayName="@mantine/tiptap/RichTextEditorToolbar";const rS={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},$=v.factory((n,e)=>{const t=v.useProps("RichTextEditor",rS,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,labels:h,children:p,variant:g,attributes:y,...b}=t,k=v.useStyles({name:"RichTextEditor",classes:An,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:y,vars:a}),w=T.useMemo(()=>({...z1,...h}),[h]);return m.jsx($1,{value:{editor:c,getStyles:k,labels:w,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,unstyled:l,variant:g},children:m.jsx(v.Box,{...k("root"),...b,ref:e,children:p})})});$.classes=An;$.displayName="@mantine/tiptap/RichTextEditor";$.Content=ra;$.Control=On;$.Toolbar=la;$.ControlsGroup=ia;$.Bold=Mv;$.Italic=wv;$.Strikethrough=Ev;$.Underline=Tv;$.ClearFormatting=Av;$.H1=Rv;$.H2=Lv;$.H3=Iv;$.H4=jv;$.H5=Pv;$.H6=_v;$.BulletList=Dv;$.OrderedList=Nv;$.Link=oa;$.Unlink=Ov;$.Blockquote=Bv;$.AlignLeft=Fv;$.AlignRight=zv;$.AlignCenter=$v;$.AlignJustify=Vv;$.Superscript=Wv;$.Subscript=Hv;$.Code=Yv;$.CodeBlock=Uv;$.ColorPicker=bh;$.Color=kh;$.Highlight=qv;$.Hr=Kv;$.UnsetColor=Jv;$.Undo=Gv;$.Redo=Xv;$.TaskList=Qv;$.TaskListSink=Zv;$.TaskListLift=eS;$.SourceCode=xh;function sS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=Yk({editable:!r&&!s,extensions:[O1,o1,$x,_1,F1,L1,j1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs($,{editor:o,h:400,children:[m.jsxs($.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs($.ControlsGroup,{children:[m.jsx($.Bold,{}),m.jsx($.Italic,{}),m.jsx($.Underline,{}),m.jsx($.Strikethrough,{}),m.jsx($.ClearFormatting,{}),m.jsx($.Highlight,{}),m.jsx($.Code,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.H1,{}),m.jsx($.H2,{}),m.jsx($.H3,{}),m.jsx($.H4,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Blockquote,{}),m.jsx($.Hr,{}),m.jsx($.BulletList,{}),m.jsx($.OrderedList,{}),m.jsx($.Subscript,{}),m.jsx($.Superscript,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Link,{}),m.jsx($.Unlink,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.AlignLeft,{}),m.jsx($.AlignCenter,{}),m.jsx($.AlignJustify,{}),m.jsx($.AlignRight,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Undo,{}),m.jsx($.Redo,{})]})]}),m.jsx($.Content,{})]})}function oS({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,{data:t.data,...r,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function iS({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 lS({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 aS({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 cS({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(fs,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(fs,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}const aa={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})},uS=({field:n,layout:e="vertical"})=>{const t=n;return aa[e](t.fields.map(r=>{const s={...r,name:`${t.name}.${r.name}`,disabled:t.disabled,visible:t.visible};return m.jsx(so,{fieldSchema:s})}))},nl=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 ca(n,e={}){const t={};for(const r of n)r.type==="object"&&r.fields?t[r.name]=ca(r.fields,e==null?void 0:e[r.name]):t[r.name]=(e==null?void 0:e[r.name])??r.initialValue??nl(r.type);return t}function ro(n,e){const t={};for(const r of n){const s=(e==null?void 0:e[r.name])??nl(r.type);if(r.required)if(r.type==="object"){Object.values(s).length||(t[r.name]=`${r.label||r.name} is required`);const o=ro(r.fields,s);for(const[i,l]of Object.entries(o))t[`${r.name}.${i}`]=l}else r.type==="array"?(s.length||(t[r.name]=`${r.label||r.name} is required`),s.forEach((o,i)=>{const l=ro(r.fields,o);for(const[a,c]of Object.entries(l))t[`${r.name}.${i}.${a}`]=c})):s===nl(r.type)&&(t[r.name]=`${r.label||r.name} is required`)}return t}const dS=n=>{const{field:e,form:t,layout:r="vertical"}=n,s=e,o=t.getInputProps(s.name),i=(o==null?void 0:o.value)??[];e.visible,e.disabled,e.readOnly;function l(){o.onFieldChange([...i,ca(s.fields)])}function a(c){o.onFieldChange(i.filter((u,d)=>d!==c))}return m.jsxs(m.Fragment,{children:[aa[r](i.map((c,u)=>m.jsxs(T.Fragment,{children:[s.fields.map(d=>{const f={...d,name:`${s.name}.${u}.${d.name}`};return m.jsx(so,{fieldSchema:f},f.name)}),m.jsx(v.Button,{size:"compact-md",color:"red",w:120,onClick:()=>a(u),children:"Delete row"})]},u))),m.jsxs(m.Fragment,{children:[i.length>0&&m.jsx(v.Divider,{mb:"md"}),m.jsx(v.Button,{onClick:l,variant:"light",size:"compact-md",children:"Add"})]})]})},fS=({field:n,children:e})=>{const t=au(),{error:r}=t.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:e}),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 hS(n){const{layout:e,field:t,form:r}=n;let s=null;switch(t.type){case"text":s=m.jsx(aS,{field:t,form:r});break;case"select":s=m.jsx(oS,{field:t,form:r});break;case"object":s=m.jsx(uS,{field:t,form:r,layout:e});break;case"array":s=m.jsx(dS,{field:t,form:r,layout:e});break;case"checkbox":s=m.jsx(sp,{field:t,form:r});break;case"number":s=m.jsx(Tm,{field:t,form:r});break;case"date":s=m.jsx(Cm,{field:t,form:r});break;case"datetime":s=m.jsx(wm,{field:t,form:r});break;case"switch":s=m.jsx(iS,{field:t,form:r});break;case"texteditor":s=m.jsx(sS,{field:t,form:r});break;case"time":s=m.jsx(cS,{field:t,form:r});break;case"tags":s=m.jsx(lS,{field:t,form:r});break;default:s=m.jsxs("div",{children:["Unsupported field type: ",t.type]});break}return m.jsx(fS,{field:t,children:s})}class pS{constructor(e){ha(this,"layout");this.layout=e}canHandle(){return!0}resolve(e){return hS}}class mS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.name]}resolve(e){return this.renderers[e.name]??null}}class gS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.type]}resolve(e){return this.renderers[e.type]??null}}class yS{constructor(e){this.handlers=e}resolve(e){for(const t of this.handlers)if(t.canHandle(e)){const r=t.resolve(e);if(r)return r}return null}}function vh(n){return n.map(e=>{const t={...e,readOnly:!0};return e.type==="object"||e.type==="array"?{...t,fields:vh(e.fields)}:t})}const Sh=T.forwardRef((n,e)=>{const{schema:t,readOnly:r,primaryAction:s=!0,layout:o="vertical",loading:i=!0,values:l,initialValues:a,preSubmit:c=x=>x,onSubmit:u,postSubmit:d=()=>{},updateFieldSchema:f={},uiConfig:h,onFieldChange:p}=n,g=T.useMemo(()=>r?vh(t):t,[t,r]),[y,b]=T.useState(i),k=Zh({enhanceGetInputProps(x){return{onFieldChange:async M=>{var O;x.inputProps.onChange(M),await((O=p==null?void 0:p[x.field.replace(/\.\d+\./g,".")])==null?void 0:O.call(p,x.field,M,k))}}}}),w=T.useMemo(()=>new yS([new mS((h==null?void 0:h.customFieldNameRenderer)??{}),new gS((h==null?void 0:h.customTypeRenderer)??{}),new pS(o)]),[o,h]),E=k.onSubmit(async x=>{const M=ro(t,x);if(Object.keys(M).length){k.setErrors(M);return}const O=await c(x);await u(O),d(O)}),C=x=>{const M=ca(g,x);k.setValues(M),k.resetDirty(M)};return T.useEffect(()=>{let x=!1;return(async()=>{try{if(x)return;if(l)return C(await l());if(a)return C(await a());C()}finally{b(!1)}})(),()=>{x=!0}},[g,l,a]),T.useImperativeHandle(e,()=>({submit:()=>E(),reset:x=>{if(x){C(x);return}k.reset()},validate:()=>{const x=ro(t,k.values);return k.setErrors(x),Object.keys(x).length===0},getValues:()=>k.values,setValues:x=>{k.setValues(x)},getFieldValue:x=>k.getInputProps(x).value,setFieldValue:(x,M)=>{k.setFieldValue(x,M)},isValid:()=>Object.keys(k.errors).length===0,isDirty:()=>k.isDirty(),isLoading:()=>y,watch:(x,M)=>k.watch(x,M)})),m.jsx(Qh,{form:k,children:m.jsx(np,{value:f,children:m.jsx(ep,{value:w,children:m.jsxs(v.Box,{children:[aa[o](g.map(x=>m.jsx(so,{fieldSchema:x},x.name))),s&&m.jsx(v.Group,{justify:"flex-end",children:m.jsx(v.Button,{loading:y,onClick:()=>E(),children:"Submit"})})]})})})})});Sh.displayName="AutoForm";exports.AutoForm=Sh;exports.FieldRenderer=so;
|
|
194
|
+
a1 1 0 0 1 1 1Z`}),m.jsx("path",{d:"M10 11l-2 2 2 2"}),m.jsx("path",{d:"M14 11l2 2-2 2"})]})}const Mv={interactive:!0},On=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControl",Mv,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=St();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)}})});On.classes=An;On.displayName="@mantine/tiptap/RichTextEditorControl";const sa=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=St();return m.jsx(On,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});sa.displayName="@mantine/tiptap/RichTextEditorControlBase";function me({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=St(),u=c[n];return m.jsx(sa,{"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1,...i,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run()})});return o.displayName=`@mantine/tiptap/${n}`,o}const wv=me({label:"boldControlLabel",icon:n=>m.jsx(H1,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),Tv=me({label:"italicControlLabel",icon:n=>m.jsx(W1,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),Ev=me({label:"underlineControlLabel",icon:n=>m.jsx(Y1,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Av=me({label:"strikeControlLabel",icon:n=>m.jsx(U1,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Ov=me({label:"clearFormattingControlLabel",icon:n=>m.jsx(q1,{...n}),operation:{name:"unsetAllMarks"}}),Dv=me({label:"unlinkControlLabel",icon:n=>m.jsx(nv,{...n}),operation:{name:"unsetLink"}}),Nv=me({label:"bulletListControlLabel",icon:n=>m.jsx(ev,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Rv=me({label:"orderedListControlLabel",icon:n=>m.jsx(tv,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Lv=me({label:"h1ControlLabel",icon:n=>m.jsx(K1,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Iv=me({label:"h2ControlLabel",icon:n=>m.jsx(J1,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),jv=me({label:"h3ControlLabel",icon:n=>m.jsx(G1,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),Pv=me({label:"h4ControlLabel",icon:n=>m.jsx(X1,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),_v=me({label:"h5ControlLabel",icon:n=>m.jsx(Q1,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),Bv=me({label:"h6ControlLabel",icon:n=>m.jsx(Z1,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Fv=me({label:"blockquoteControlLabel",icon:n=>m.jsx(rv,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),zv=me({label:"alignLeftControlLabel",icon:n=>m.jsx(sv,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),$v=me({label:"alignRightControlLabel",icon:n=>m.jsx(ov,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),Vv=me({label:"alignCenterControlLabel",icon:n=>m.jsx(iv,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),Hv=me({label:"alignJustifyControlLabel",icon:n=>m.jsx(lv,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),Wv=me({label:"subscriptControlLabel",icon:n=>m.jsx(av,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Yv=me({label:"superscriptControlLabel",icon:n=>m.jsx(cv,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),Uv=me({label:"codeControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),qv=me({label:"codeBlockControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),Kv=me({label:"highlightControlLabel",icon:n=>m.jsx(uv,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Jv=me({label:"hrControlLabel",icon:n=>m.jsx(dv,{...n}),operation:{name:"setHorizontalRule"}}),Gv=me({label:"unsetColorControlLabel",icon:n=>m.jsx(yh,{...n}),operation:{name:"unsetColor"}}),Xv=me({label:"undoControlLabel",icon:n=>m.jsx(bv,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),Qv=me({label:"redoControlLabel",icon:n=>m.jsx(kv,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),Zv=me({label:"tasksControlLabel",icon:n=>m.jsx(xv,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),eS=me({label:"tasksSinkLabel",icon:n=>m.jsx(vv,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),tS=me({label:"tasksLiftLabel",icon:n=>m.jsx(Sv,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),nS=n=>m.jsx(gv,{...n}),oa=v.factory((n,e)=>{var V;const t=v.useProps("RichTextEditorLinkControl",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=St(),p={classNames:r,styles:i},[g,y]=Mp(""),[b,k]=T.useState(d),[w,{open:E,close:C}]=il(!1),x=()=>{var q;E();const F=(q=h.editor)==null?void 0:q.getAttributes("link");y((F==null?void 0:F.href)||""),k(F!=null&&F.href?(F==null?void 0:F.target)==="_blank":d)},M=()=>{C(),y(""),k(d)},O=()=>{var F,q;M(),g===""?(F=h.editor)==null||F.chain().focus().extendMarkRange("link").unsetLink().run():(q=h.editor)==null||q.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},j=F=>{F.key==="Enter"&&(F.preventDefault(),O())};vp("edit-link",x,!1);const{resolvedClassNames:B,resolvedStyles:Y}=v.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(v.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:w,onChange:F=>!F&&M(),offset:-44,zIndex:1e4,...c,children:[m.jsx(v.Popover.Target,{children:m.jsx(sa,{icon:a||nS,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:x,active:(V=h.editor)==null?void 0:V.isActive("link"),ref:e,classNames:B,styles:Y,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:j,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(F=>!F),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(yv,{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})]})})]})});oa.classes=An;oa.displayName="@mantine/tiptap/RichTextEditorLinkControl";const bh=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=v.useProps("RichTextEditorColorPickerControl",null,n),{editor:i,labels:l,getStyles:a,variant:c}=St(),[u,{toggle:d,close:f}]=il(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(w,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(w).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((w,E)=>m.jsx(v.ColorSwatch,{component:"button",color:w,onClick:()=>y(w),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(w),"aria-label":l.colorPickerColorLabel(w)},E));return m.jsxs(v.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:w=>!w&&f(),...t,children:[m.jsx(v.Popover.Target,{children:m.jsx(On,{...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:w=>y(w,!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(hv,{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(yh,{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(fv,{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(pv,{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(mv,{style:{width:v.rem(16),height:v.rem(16)}})})]})})]})]})});bh.displayName="@mantine/tiptap/ColorPickerControl";const kh=T.forwardRef((n,e)=>{const{color:t,...r}=v.useProps("RichTextEditorColorControl",null,n),{editor:s,labels:o,variant:i}=St(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(On,{...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})})});kh.displayName="@mantine/tiptap/RichTextEditorColorControl";const rS={},xh=T.forwardRef((n,e)=>{const{...t}=v.useProps("RichTextEditorSourceCodeControl",rS,n),{editor:r,labels:s,variant:o,onSourceCodeTextSwitch:i}=St(),[l,a]=T.useState(!1),c=()=>{l?r==null||r.commands.setContent(r.getText(),{emitUpdate:!0}):r==null||r.commands.setContent(`<textarea>${r.getHTML()}</textarea>`);const u=!l;a(u),i==null||i(u)};return m.jsx(On,{...t,variant:o,active:l,"aria-label":s.sourceCodeControlLabel,title:s.sourceCodeControlLabel,onClick:()=>c(),ref:e,children:m.jsx(Cv,{style:{width:v.rem(16),height:v.rem(16)}})})});xh.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const ia=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControlsGroup",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=St();return m.jsx(v.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});ia.classes=An;ia.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const la=v.factory((n,e)=>{const t=v.useProps("RichTextEditorToolbar",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=St();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)}})});la.classes=An;la.displayName="@mantine/tiptap/RichTextEditorToolbar";const sS={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},$=v.factory((n,e)=>{const t=v.useProps("RichTextEditor",sS,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,labels:h,children:p,variant:g,attributes:y,...b}=t,k=v.useStyles({name:"RichTextEditor",classes:An,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:y,vars:a}),w=T.useMemo(()=>({...$1,...h}),[h]);return m.jsx(V1,{value:{editor:c,getStyles:k,labels:w,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,unstyled:l,variant:g},children:m.jsx(v.Box,{...k("root"),...b,ref:e,children:p})})});$.classes=An;$.displayName="@mantine/tiptap/RichTextEditor";$.Content=ra;$.Control=On;$.Toolbar=la;$.ControlsGroup=ia;$.Bold=wv;$.Italic=Tv;$.Strikethrough=Av;$.Underline=Ev;$.ClearFormatting=Ov;$.H1=Lv;$.H2=Iv;$.H3=jv;$.H4=Pv;$.H5=_v;$.H6=Bv;$.BulletList=Nv;$.OrderedList=Rv;$.Link=oa;$.Unlink=Dv;$.Blockquote=Fv;$.AlignLeft=zv;$.AlignRight=$v;$.AlignCenter=Vv;$.AlignJustify=Hv;$.Superscript=Yv;$.Subscript=Wv;$.Code=Uv;$.CodeBlock=qv;$.ColorPicker=bh;$.Color=kh;$.Highlight=Kv;$.Hr=Jv;$.UnsetColor=Gv;$.Undo=Xv;$.Redo=Qv;$.TaskList=Zv;$.TaskListSink=eS;$.TaskListLift=tS;$.SourceCode=xh;function oS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=Uk({editable:!r&&!s,extensions:[D1,i1,Vx,B1,z1,I1,P1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs($,{editor:o,h:400,children:[m.jsxs($.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs($.ControlsGroup,{children:[m.jsx($.Bold,{}),m.jsx($.Italic,{}),m.jsx($.Underline,{}),m.jsx($.Strikethrough,{}),m.jsx($.ClearFormatting,{}),m.jsx($.Highlight,{}),m.jsx($.Code,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.H1,{}),m.jsx($.H2,{}),m.jsx($.H3,{}),m.jsx($.H4,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Blockquote,{}),m.jsx($.Hr,{}),m.jsx($.BulletList,{}),m.jsx($.OrderedList,{}),m.jsx($.Subscript,{}),m.jsx($.Superscript,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Link,{}),m.jsx($.Unlink,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.AlignLeft,{}),m.jsx($.AlignCenter,{}),m.jsx($.AlignJustify,{}),m.jsx($.AlignRight,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Undo,{}),m.jsx($.Redo,{})]})]}),m.jsx($.Content,{})]})}function iS({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,{data:t.data,...r,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function lS({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 aS({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 cS({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 uS({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(fs,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(fs,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}const aa={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})},nl=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 ca(n,e={}){const t={};for(const r of n)r.type==="object"&&r.fields?t[r.name]=ca(r.fields,e==null?void 0:e[r.name]):t[r.name]=(e==null?void 0:e[r.name])??r.initialValue??nl(r.type);return t}function ro(n,e){const t={};for(const r of n){const s=(e==null?void 0:e[r.name])??nl(r.type);if(r.required)if(r.type==="object"){Object.values(s).length||(t[r.name]=`${r.label||r.name} is required`);const o=ro(r.fields,s);for(const[i,l]of Object.entries(o))t[`${r.name}.${i}`]=l}else r.type==="array"?(s.length||(t[r.name]=`${r.label||r.name} is required`),s.forEach((o,i)=>{const l=ro(r.fields,o);for(const[a,c]of Object.entries(l))t[`${r.name}.${i}.${a}`]=c})):s===nl(r.type)&&(t[r.name]=`${r.label||r.name} is required`)}return t}const dS=n=>{const{field:e,form:t,layout:r="vertical"}=n,s=e,o=t.getInputProps(s.name),i=(o==null?void 0:o.value)??[];e.visible,e.disabled,e.readOnly;function l(){o.onFieldChange([...i,ca(s.fields)])}function a(c){o.onFieldChange(i.filter((u,d)=>d!==c))}return m.jsxs(m.Fragment,{children:[aa[r](i.map((c,u)=>m.jsxs(T.Fragment,{children:[s.fields.map(d=>{const f={...d,name:`${s.name}.${u}.${d.name}`};return m.jsx(so,{fieldSchema:f},f.name)}),m.jsx(v.Button,{size:"compact-md",color:"red",w:120,onClick:()=>a(u),children:"Delete row"})]},u))),m.jsxs(m.Fragment,{children:[i.length>0&&m.jsx(v.Divider,{mb:"md"}),m.jsx(v.Button,{onClick:l,variant:"light",size:"compact-md",children:"Add"})]})]})},fS=({field:n,layout:e="vertical"})=>{const t=n;return aa[e](t.fields.map(r=>{const s={...r,name:`${t.name}.${r.name}`,disabled:t.disabled,visible:t.visible};return m.jsx(so,{fieldSchema:s})}))},hS=({field:n,children:e})=>{const t=au(),{error:r}=t.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:"*"})]}),e,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 pS(n){const{layout:e,field:t,form:r}=n;let s=null;switch(t.type){case"text":s=m.jsx(cS,{field:t,form:r});break;case"select":s=m.jsx(iS,{field:t,form:r});break;case"object":s=m.jsx(fS,{field:t,form:r,layout:e});break;case"array":s=m.jsx(dS,{field:t,form:r,layout:e});break;case"checkbox":s=m.jsx(op,{field:t,form:r});break;case"number":s=m.jsx(Em,{field:t,form:r});break;case"date":s=m.jsx(Mm,{field:t,form:r});break;case"datetime":s=m.jsx(Tm,{field:t,form:r});break;case"switch":s=m.jsx(lS,{field:t,form:r});break;case"texteditor":s=m.jsx(oS,{field:t,form:r});break;case"time":s=m.jsx(uS,{field:t,form:r});break;case"tags":s=m.jsx(aS,{field:t,form:r});break;default:s=m.jsxs("div",{children:["Unsupported field type: ",t.type]});break}return m.jsx(hS,{field:t,children:s})}class mS{constructor(e){ha(this,"layout");this.layout=e}canHandle(){return!0}resolve(e){return pS}}class gS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.name.replace(/\.\d+\./g,".")]}resolve(e){return this.renderers[e.name.replace(/\.\d+\./g,".")]??null}}class yS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.type]}resolve(e){return this.renderers[e.type]??null}}class bS{constructor(e){this.handlers=e}resolve(e){for(const t of this.handlers)if(t.canHandle(e)){const r=t.resolve(e);if(r)return r}return null}}function vh(n){return n.map(e=>{const t={...e,readOnly:!0};return e.type==="object"||e.type==="array"?{...t,fields:vh(e.fields)}:t})}class kS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[`${e.type}`]}resolve(e){return this.renderers[`${e.type}`]??null}}function Sh({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})}const Ch=T.forwardRef((n,e)=>{const{schema:t,readOnly:r,primaryAction:s=!0,layout:o="vertical",loading:i=!0,values:l,initialValues:a,preSubmit:c=x=>x,onSubmit:u,postSubmit:d=()=>{},updateFieldSchema:f={},uiConfig:h,onFieldChange:p}=n,g=T.useMemo(()=>r?vh(t):t,[t,r]),[y,b]=T.useState(i),k=ep({enhanceGetInputProps(x){return{onFieldChange:async M=>{var O;x.inputProps.onChange(M),await((O=p==null?void 0:p[x.field.replace(/\.\d+\./g,".")])==null?void 0:O.call(p,x.field,M,k))}}}}),w=T.useMemo(()=>new bS([new gS((h==null?void 0:h.customFieldNameRenderers)??{}),new kS((h==null?void 0:h.customFieldTypeRenderers)??{}),new yS((h==null?void 0:h.customTypeRenderers)??{}),new mS(o)]),[o,h]),E=k.onSubmit(async x=>{const M=ro(t,x);if(Object.keys(M).length){k.setErrors(M);return}const O=await c(x);await u(O),d(O)}),C=x=>{const M=ca(g,x);k.setValues(M),k.resetDirty(M)};return T.useEffect(()=>{let x=!1;return(async()=>{try{if(x)return;if(l)return C(await l());if(a)return C(await a());C()}finally{b(!1)}})(),()=>{x=!0}},[g,l,a]),T.useImperativeHandle(e,()=>({submit:()=>E(),reset:x=>{if(x){C(x);return}k.reset()},validate:()=>{const x=ro(t,k.values);return k.setErrors(x),Object.keys(x).length===0},getValues:()=>k.values,setValues:x=>{k.setValues(x)},getFieldValue:x=>k.getInputProps(x).value,setFieldValue:(x,M)=>{k.setFieldValue(x,M)},isValid:()=>Object.keys(k.errors).length===0,isDirty:()=>k.isDirty(),isLoading:()=>y,watch:(x,M)=>k.watch(x,M)})),m.jsx(Zh,{form:k,children:m.jsx(rp,{value:f,children:m.jsx(tp,{value:w,children:m.jsxs(v.Box,{children:[aa[o](g.map(x=>m.jsx(Sh,{layout:o,field:x,children:m.jsx(so,{fieldSchema:x},x.name)}))),s&&m.jsx(v.Group,{justify:"flex-end",children:m.jsx(v.Button,{loading:y,onClick:()=>E(),children:"Submit"})})]})})})})});Ch.displayName="AutoForm";exports.AutoForm=Ch;exports.FieldLayoutWrapper=Sh;exports.FieldRenderer=so;
|