pm-canvas-viewer 0.1.0
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/LICENSE +21 -0
- package/README.md +112 -0
- package/bin/cli.js +198 -0
- package/dist/frontend/assets/index-CDTMa6Xk.js +287 -0
- package/dist/frontend/assets/index-idGrS1dS.css +1 -0
- package/dist/frontend/assets/main-DeCTtllz.js +293 -0
- package/dist/frontend/index.html +13 -0
- package/lib/history.js +63 -0
- package/lib/port.js +106 -0
- package/lib/prompts.js +183 -0
- package/lib/scanner.js +72 -0
- package/package.json +68 -0
- package/server/api/anchors.js +44 -0
- package/server/api/files.js +93 -0
- package/server/index.js +32 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
var ix=Object.defineProperty;var ox=(t,e,n)=>e in t?ix(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ne=(t,e,n)=>ox(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function N0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var R0={exports:{}},sc={},O0={exports:{}},G={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Mo=Symbol.for("react.element"),lx=Symbol.for("react.portal"),ax=Symbol.for("react.fragment"),cx=Symbol.for("react.strict_mode"),ux=Symbol.for("react.profiler"),dx=Symbol.for("react.provider"),fx=Symbol.for("react.context"),hx=Symbol.for("react.forward_ref"),px=Symbol.for("react.suspense"),mx=Symbol.for("react.memo"),gx=Symbol.for("react.lazy"),kp=Symbol.iterator;function yx(t){return t===null||typeof t!="object"?null:(t=kp&&t[kp]||t["@@iterator"],typeof t=="function"?t:null)}var I0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L0=Object.assign,P0={};function Qs(t,e,n){this.props=t,this.context=e,this.refs=P0,this.updater=n||I0}Qs.prototype.isReactComponent={};Qs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Qs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function D0(){}D0.prototype=Qs.prototype;function Ef(t,e,n){this.props=t,this.context=e,this.refs=P0,this.updater=n||I0}var Tf=Ef.prototype=new D0;Tf.constructor=Ef;L0(Tf,Qs.prototype);Tf.isPureReactComponent=!0;var vp=Array.isArray,_0=Object.prototype.hasOwnProperty,Mf={current:null},z0={key:!0,ref:!0,__self:!0,__source:!0};function $0(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)_0.call(e,r)&&!z0.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Mo,type:t,key:i,ref:o,props:s,_owner:Mf.current}}function kx(t,e){return{$$typeof:Mo,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Af(t){return typeof t=="object"&&t!==null&&t.$$typeof===Mo}function vx(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var wp=/\/+/g;function jc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?vx(""+t.key):e.toString(36)}function xl(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Mo:case lx:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+jc(o,0):r,vp(s)?(n="",t!=null&&(n=t.replace(wp,"$&/")+"/"),xl(s,e,n,"",function(c){return c})):s!=null&&(Af(s)&&(s=kx(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(wp,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",vp(t))for(var l=0;l<t.length;l++){i=t[l];var a=r+jc(i,l);o+=xl(i,e,n,a,s)}else if(a=yx(t),typeof a=="function")for(t=a.call(t),l=0;!(i=t.next()).done;)i=i.value,a=r+jc(i,l++),o+=xl(i,e,n,a,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function zo(t,e,n){if(t==null)return t;var r=[],s=0;return xl(t,r,"","",function(i){return e.call(n,i,s++)}),r}function wx(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var st={current:null},Sl={transition:null},xx={ReactCurrentDispatcher:st,ReactCurrentBatchConfig:Sl,ReactCurrentOwner:Mf};function j0(){throw Error("act(...) is not supported in production builds of React.")}G.Children={map:zo,forEach:function(t,e,n){zo(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return zo(t,function(){e++}),e},toArray:function(t){return zo(t,function(e){return e})||[]},only:function(t){if(!Af(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};G.Component=Qs;G.Fragment=ax;G.Profiler=ux;G.PureComponent=Ef;G.StrictMode=cx;G.Suspense=px;G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xx;G.act=j0;G.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=L0({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Mf.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(a in e)_0.call(e,a)&&!z0.hasOwnProperty(a)&&(r[a]=e[a]===void 0&&l!==void 0?l[a]:e[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}return{$$typeof:Mo,type:t.type,key:s,ref:i,props:r,_owner:o}};G.createContext=function(t){return t={$$typeof:fx,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:dx,_context:t},t.Consumer=t};G.createElement=$0;G.createFactory=function(t){var e=$0.bind(null,t);return e.type=t,e};G.createRef=function(){return{current:null}};G.forwardRef=function(t){return{$$typeof:hx,render:t}};G.isValidElement=Af;G.lazy=function(t){return{$$typeof:gx,_payload:{_status:-1,_result:t},_init:wx}};G.memo=function(t,e){return{$$typeof:mx,type:t,compare:e===void 0?null:e}};G.startTransition=function(t){var e=Sl.transition;Sl.transition={};try{t()}finally{Sl.transition=e}};G.unstable_act=j0;G.useCallback=function(t,e){return st.current.useCallback(t,e)};G.useContext=function(t){return st.current.useContext(t)};G.useDebugValue=function(){};G.useDeferredValue=function(t){return st.current.useDeferredValue(t)};G.useEffect=function(t,e){return st.current.useEffect(t,e)};G.useId=function(){return st.current.useId()};G.useImperativeHandle=function(t,e,n){return st.current.useImperativeHandle(t,e,n)};G.useInsertionEffect=function(t,e){return st.current.useInsertionEffect(t,e)};G.useLayoutEffect=function(t,e){return st.current.useLayoutEffect(t,e)};G.useMemo=function(t,e){return st.current.useMemo(t,e)};G.useReducer=function(t,e,n){return st.current.useReducer(t,e,n)};G.useRef=function(t){return st.current.useRef(t)};G.useState=function(t){return st.current.useState(t)};G.useSyncExternalStore=function(t,e,n){return st.current.useSyncExternalStore(t,e,n)};G.useTransition=function(){return st.current.useTransition()};G.version="18.3.1";O0.exports=G;var T=O0.exports;const ln=N0(T);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Sx=T,Cx=Symbol.for("react.element"),bx=Symbol.for("react.fragment"),Ex=Object.prototype.hasOwnProperty,Tx=Sx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Mx={key:!0,ref:!0,__self:!0,__source:!0};function B0(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Ex.call(e,r)&&!Mx.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:Cx,type:t,key:i,ref:o,props:s,_owner:Tx.current}}sc.Fragment=bx;sc.jsx=B0;sc.jsxs=B0;R0.exports=sc;var w=R0.exports,Vu={},F0={exports:{}},St={},H0={exports:{}},V0={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(t){function e(A,I){var $=A.length;A.push(I);e:for(;0<$;){var U=$-1>>>1,le=A[U];if(0<s(le,I))A[U]=I,A[$]=le,$=U;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var I=A[0],$=A.pop();if($!==I){A[0]=$;e:for(var U=0,le=A.length,ht=le>>>1;U<ht;){var bt=2*(U+1)-1,kr=A[bt],In=bt+1,vr=A[In];if(0>s(kr,$))In<le&&0>s(vr,kr)?(A[U]=vr,A[In]=$,U=In):(A[U]=kr,A[bt]=$,U=bt);else if(In<le&&0>s(vr,$))A[U]=vr,A[In]=$,U=In;else break e}}return I}function s(A,I){var $=A.sortIndex-I.sortIndex;return $!==0?$:A.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],c=[],u=1,d=null,f=3,h=!1,p=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(A){for(var I=n(c);I!==null;){if(I.callback===null)r(c);else if(I.startTime<=A)r(c),I.sortIndex=I.expirationTime,e(a,I);else break;I=n(c)}}function x(A){if(m=!1,v(A),!p)if(n(a)!==null)p=!0,D(S);else{var I=n(c);I!==null&&V(x,I.startTime-A)}}function S(A,I){p=!1,m&&(m=!1,g(E),E=-1),h=!0;var $=f;try{for(v(I),d=n(a);d!==null&&(!(d.expirationTime>I)||A&&!j());){var U=d.callback;if(typeof U=="function"){d.callback=null,f=d.priorityLevel;var le=U(d.expirationTime<=I);I=t.unstable_now(),typeof le=="function"?d.callback=le:d===n(a)&&r(a),v(I)}else r(a);d=n(a)}if(d!==null)var ht=!0;else{var bt=n(c);bt!==null&&V(x,bt.startTime-I),ht=!1}return ht}finally{d=null,f=$,h=!1}}var b=!1,C=null,E=-1,N=5,P=-1;function j(){return!(t.unstable_now()-P<N)}function J(){if(C!==null){var A=t.unstable_now();P=A;var I=!0;try{I=C(!0,A)}finally{I?W():(b=!1,C=null)}}else b=!1}var W;if(typeof k=="function")W=function(){k(J)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,K=X.port2;X.port1.onmessage=J,W=function(){K.postMessage(null)}}else W=function(){y(J,0)};function D(A){C=A,b||(b=!0,W())}function V(A,I){E=y(function(){A(t.unstable_now())},I)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(A){A.callback=null},t.unstable_continueExecution=function(){p||h||(p=!0,D(S))},t.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<A?Math.floor(1e3/A):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(a)},t.unstable_next=function(A){switch(f){case 1:case 2:case 3:var I=3;break;default:I=f}var $=f;f=I;try{return A()}finally{f=$}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(A,I){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var $=f;f=A;try{return I()}finally{f=$}},t.unstable_scheduleCallback=function(A,I,$){var U=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?U+$:U):$=U,A){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=$+le,A={id:u++,callback:I,priorityLevel:A,startTime:$,expirationTime:le,sortIndex:-1},$>U?(A.sortIndex=$,e(c,A),n(a)===null&&A===n(c)&&(m?(g(E),E=-1):m=!0,V(x,$-U))):(A.sortIndex=le,e(a,A),p||h||(p=!0,D(S))),A},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(A){var I=f;return function(){var $=f;f=I;try{return A.apply(this,arguments)}finally{f=$}}}})(V0);H0.exports=V0;var Ax=H0.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var Nx=T,xt=Ax;function R(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var W0=new Set,Gi={};function es(t,e){Ds(t,e),Ds(t+"Capture",e)}function Ds(t,e){for(Gi[t]=e,t=0;t<e.length;t++)W0.add(e[t])}var Tn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wu=Object.prototype.hasOwnProperty,Rx=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,xp={},Sp={};function Ox(t){return Wu.call(Sp,t)?!0:Wu.call(xp,t)?!1:Rx.test(t)?Sp[t]=!0:(xp[t]=!0,!1)}function Ix(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Lx(t,e,n,r){if(e===null||typeof e>"u"||Ix(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function it(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var We={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){We[t]=new it(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];We[e]=new it(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){We[t]=new it(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){We[t]=new it(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){We[t]=new it(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){We[t]=new it(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){We[t]=new it(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){We[t]=new it(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){We[t]=new it(t,5,!1,t.toLowerCase(),null,!1,!1)});var Nf=/[\-:]([a-z])/g;function Rf(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Nf,Rf);We[e]=new it(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Nf,Rf);We[e]=new it(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Nf,Rf);We[e]=new it(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){We[t]=new it(t,1,!1,t.toLowerCase(),null,!1,!1)});We.xlinkHref=new it("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){We[t]=new it(t,1,!1,t.toLowerCase(),null,!0,!0)});function Of(t,e,n,r){var s=We.hasOwnProperty(e)?We[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Lx(e,n,s,r)&&(n=null),r||s===null?Ox(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Rn=Nx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$o=Symbol.for("react.element"),hs=Symbol.for("react.portal"),ps=Symbol.for("react.fragment"),If=Symbol.for("react.strict_mode"),Uu=Symbol.for("react.profiler"),U0=Symbol.for("react.provider"),K0=Symbol.for("react.context"),Lf=Symbol.for("react.forward_ref"),Ku=Symbol.for("react.suspense"),qu=Symbol.for("react.suspense_list"),Pf=Symbol.for("react.memo"),_n=Symbol.for("react.lazy"),q0=Symbol.for("react.offscreen"),Cp=Symbol.iterator;function ni(t){return t===null||typeof t!="object"?null:(t=Cp&&t[Cp]||t["@@iterator"],typeof t=="function"?t:null)}var ge=Object.assign,Bc;function ki(t){if(Bc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Bc=e&&e[1]||""}return`
|
|
34
|
+
`+Bc+t}var Fc=!1;function Hc(t,e){if(!t||Fc)return"";Fc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var s=c.stack.split(`
|
|
35
|
+
`),i=r.stack.split(`
|
|
36
|
+
`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var a=`
|
|
37
|
+
`+s[o].replace(" at new "," at ");return t.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{Fc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ki(t):""}function Px(t){switch(t.tag){case 5:return ki(t.type);case 16:return ki("Lazy");case 13:return ki("Suspense");case 19:return ki("SuspenseList");case 0:case 2:case 15:return t=Hc(t.type,!1),t;case 11:return t=Hc(t.type.render,!1),t;case 1:return t=Hc(t.type,!0),t;default:return""}}function Ju(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ps:return"Fragment";case hs:return"Portal";case Uu:return"Profiler";case If:return"StrictMode";case Ku:return"Suspense";case qu:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case K0:return(t.displayName||"Context")+".Consumer";case U0:return(t._context.displayName||"Context")+".Provider";case Lf:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Pf:return e=t.displayName||null,e!==null?e:Ju(t.type)||"Memo";case _n:e=t._payload,t=t._init;try{return Ju(t(e))}catch{}}return null}function Dx(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ju(e);case 8:return e===If?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function ar(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function J0(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function _x(t){var e=J0(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function jo(t){t._valueTracker||(t._valueTracker=_x(t))}function G0(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=J0(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Fl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Gu(t,e){var n=e.checked;return ge({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function bp(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=ar(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Q0(t,e){e=e.checked,e!=null&&Of(t,"checked",e,!1)}function Qu(t,e){Q0(t,e);var n=ar(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Xu(t,e.type,n):e.hasOwnProperty("defaultValue")&&Xu(t,e.type,ar(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ep(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Xu(t,e,n){(e!=="number"||Fl(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var vi=Array.isArray;function Ts(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+ar(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Yu(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(R(91));return ge({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Tp(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(R(92));if(vi(n)){if(1<n.length)throw Error(R(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:ar(n)}}function X0(t,e){var n=ar(e.value),r=ar(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Mp(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Y0(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Zu(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Y0(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Bo,Z0=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Bo=Bo||document.createElement("div"),Bo.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Bo.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Qi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ri={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zx=["Webkit","ms","Moz","O"];Object.keys(Ri).forEach(function(t){zx.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ri[e]=Ri[t]})});function ey(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ri.hasOwnProperty(t)&&Ri[t]?(""+e).trim():e+"px"}function ty(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=ey(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var $x=ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ed(t,e){if(e){if($x[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(R(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(R(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(R(61))}if(e.style!=null&&typeof e.style!="object")throw Error(R(62))}}function td(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var nd=null;function Df(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var rd=null,Ms=null,As=null;function Ap(t){if(t=Ro(t)){if(typeof rd!="function")throw Error(R(280));var e=t.stateNode;e&&(e=cc(e),rd(t.stateNode,t.type,e))}}function ny(t){Ms?As?As.push(t):As=[t]:Ms=t}function ry(){if(Ms){var t=Ms,e=As;if(As=Ms=null,Ap(t),e)for(t=0;t<e.length;t++)Ap(e[t])}}function sy(t,e){return t(e)}function iy(){}var Vc=!1;function oy(t,e,n){if(Vc)return t(e,n);Vc=!0;try{return sy(t,e,n)}finally{Vc=!1,(Ms!==null||As!==null)&&(iy(),ry())}}function Xi(t,e){var n=t.stateNode;if(n===null)return null;var r=cc(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(R(231,e,typeof n));return n}var sd=!1;if(Tn)try{var ri={};Object.defineProperty(ri,"passive",{get:function(){sd=!0}}),window.addEventListener("test",ri,ri),window.removeEventListener("test",ri,ri)}catch{sd=!1}function jx(t,e,n,r,s,i,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var Oi=!1,Hl=null,Vl=!1,id=null,Bx={onError:function(t){Oi=!0,Hl=t}};function Fx(t,e,n,r,s,i,o,l,a){Oi=!1,Hl=null,jx.apply(Bx,arguments)}function Hx(t,e,n,r,s,i,o,l,a){if(Fx.apply(this,arguments),Oi){if(Oi){var c=Hl;Oi=!1,Hl=null}else throw Error(R(198));Vl||(Vl=!0,id=c)}}function ts(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function ly(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Np(t){if(ts(t)!==t)throw Error(R(188))}function Vx(t){var e=t.alternate;if(!e){if(e=ts(t),e===null)throw Error(R(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Np(s),t;if(i===r)return Np(s),e;i=i.sibling}throw Error(R(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(R(189))}}if(n.alternate!==r)throw Error(R(190))}if(n.tag!==3)throw Error(R(188));return n.stateNode.current===n?t:e}function ay(t){return t=Vx(t),t!==null?cy(t):null}function cy(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=cy(t);if(e!==null)return e;t=t.sibling}return null}var uy=xt.unstable_scheduleCallback,Rp=xt.unstable_cancelCallback,Wx=xt.unstable_shouldYield,Ux=xt.unstable_requestPaint,Ce=xt.unstable_now,Kx=xt.unstable_getCurrentPriorityLevel,_f=xt.unstable_ImmediatePriority,dy=xt.unstable_UserBlockingPriority,Wl=xt.unstable_NormalPriority,qx=xt.unstable_LowPriority,fy=xt.unstable_IdlePriority,ic=null,sn=null;function Jx(t){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(ic,t,void 0,(t.current.flags&128)===128)}catch{}}var Kt=Math.clz32?Math.clz32:Xx,Gx=Math.log,Qx=Math.LN2;function Xx(t){return t>>>=0,t===0?32:31-(Gx(t)/Qx|0)|0}var Fo=64,Ho=4194304;function wi(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ul(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=wi(l):(i&=o,i!==0&&(r=wi(i)))}else o=n&~s,o!==0?r=wi(o):i!==0&&(r=wi(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Kt(e),s=1<<n,r|=t[n],e&=~s;return r}function Yx(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zx(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-Kt(i),l=1<<o,a=s[o];a===-1?(!(l&n)||l&r)&&(s[o]=Yx(l,e)):a<=e&&(t.expiredLanes|=l),i&=~l}}function od(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function hy(){var t=Fo;return Fo<<=1,!(Fo&4194240)&&(Fo=64),t}function Wc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Ao(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Kt(e),t[e]=n}function eS(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-Kt(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function zf(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Kt(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var te=0;function py(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var my,$f,gy,yy,ky,ld=!1,Vo=[],Xn=null,Yn=null,Zn=null,Yi=new Map,Zi=new Map,Hn=[],tS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Op(t,e){switch(t){case"focusin":case"focusout":Xn=null;break;case"dragenter":case"dragleave":Yn=null;break;case"mouseover":case"mouseout":Zn=null;break;case"pointerover":case"pointerout":Yi.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zi.delete(e.pointerId)}}function si(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=Ro(e),e!==null&&$f(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function nS(t,e,n,r,s){switch(e){case"focusin":return Xn=si(Xn,t,e,n,r,s),!0;case"dragenter":return Yn=si(Yn,t,e,n,r,s),!0;case"mouseover":return Zn=si(Zn,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return Yi.set(i,si(Yi.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Zi.set(i,si(Zi.get(i)||null,t,e,n,r,s)),!0}return!1}function vy(t){var e=Tr(t.target);if(e!==null){var n=ts(e);if(n!==null){if(e=n.tag,e===13){if(e=ly(n),e!==null){t.blockedOn=e,ky(t.priority,function(){gy(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Cl(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=ad(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);nd=r,n.target.dispatchEvent(r),nd=null}else return e=Ro(n),e!==null&&$f(e),t.blockedOn=n,!1;e.shift()}return!0}function Ip(t,e,n){Cl(t)&&n.delete(e)}function rS(){ld=!1,Xn!==null&&Cl(Xn)&&(Xn=null),Yn!==null&&Cl(Yn)&&(Yn=null),Zn!==null&&Cl(Zn)&&(Zn=null),Yi.forEach(Ip),Zi.forEach(Ip)}function ii(t,e){t.blockedOn===e&&(t.blockedOn=null,ld||(ld=!0,xt.unstable_scheduleCallback(xt.unstable_NormalPriority,rS)))}function eo(t){function e(s){return ii(s,t)}if(0<Vo.length){ii(Vo[0],t);for(var n=1;n<Vo.length;n++){var r=Vo[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Xn!==null&&ii(Xn,t),Yn!==null&&ii(Yn,t),Zn!==null&&ii(Zn,t),Yi.forEach(e),Zi.forEach(e),n=0;n<Hn.length;n++)r=Hn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Hn.length&&(n=Hn[0],n.blockedOn===null);)vy(n),n.blockedOn===null&&Hn.shift()}var Ns=Rn.ReactCurrentBatchConfig,Kl=!0;function sS(t,e,n,r){var s=te,i=Ns.transition;Ns.transition=null;try{te=1,jf(t,e,n,r)}finally{te=s,Ns.transition=i}}function iS(t,e,n,r){var s=te,i=Ns.transition;Ns.transition=null;try{te=4,jf(t,e,n,r)}finally{te=s,Ns.transition=i}}function jf(t,e,n,r){if(Kl){var s=ad(t,e,n,r);if(s===null)eu(t,e,r,ql,n),Op(t,r);else if(nS(s,t,e,n,r))r.stopPropagation();else if(Op(t,r),e&4&&-1<tS.indexOf(t)){for(;s!==null;){var i=Ro(s);if(i!==null&&my(i),i=ad(t,e,n,r),i===null&&eu(t,e,r,ql,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else eu(t,e,r,null,n)}}var ql=null;function ad(t,e,n,r){if(ql=null,t=Df(r),t=Tr(t),t!==null)if(e=ts(t),e===null)t=null;else if(n=e.tag,n===13){if(t=ly(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return ql=t,null}function wy(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Kx()){case _f:return 1;case dy:return 4;case Wl:case qx:return 16;case fy:return 536870912;default:return 16}default:return 16}}var Kn=null,Bf=null,bl=null;function xy(){if(bl)return bl;var t,e=Bf,n=e.length,r,s="value"in Kn?Kn.value:Kn.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return bl=s.slice(t,1<r?1-r:void 0)}function El(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Wo(){return!0}function Lp(){return!1}function Ct(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Wo:Lp,this.isPropagationStopped=Lp,this}return ge(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Wo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Wo)},persist:function(){},isPersistent:Wo}),e}var Xs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ff=Ct(Xs),No=ge({},Xs,{view:0,detail:0}),oS=Ct(No),Uc,Kc,oi,oc=ge({},No,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==oi&&(oi&&t.type==="mousemove"?(Uc=t.screenX-oi.screenX,Kc=t.screenY-oi.screenY):Kc=Uc=0,oi=t),Uc)},movementY:function(t){return"movementY"in t?t.movementY:Kc}}),Pp=Ct(oc),lS=ge({},oc,{dataTransfer:0}),aS=Ct(lS),cS=ge({},No,{relatedTarget:0}),qc=Ct(cS),uS=ge({},Xs,{animationName:0,elapsedTime:0,pseudoElement:0}),dS=Ct(uS),fS=ge({},Xs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),hS=Ct(fS),pS=ge({},Xs,{data:0}),Dp=Ct(pS),mS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kS(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=yS[t])?!!e[t]:!1}function Hf(){return kS}var vS=ge({},No,{key:function(t){if(t.key){var e=mS[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=El(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?gS[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hf,charCode:function(t){return t.type==="keypress"?El(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?El(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),wS=Ct(vS),xS=ge({},oc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_p=Ct(xS),SS=ge({},No,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hf}),CS=Ct(SS),bS=ge({},Xs,{propertyName:0,elapsedTime:0,pseudoElement:0}),ES=Ct(bS),TS=ge({},oc,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),MS=Ct(TS),AS=[9,13,27,32],Vf=Tn&&"CompositionEvent"in window,Ii=null;Tn&&"documentMode"in document&&(Ii=document.documentMode);var NS=Tn&&"TextEvent"in window&&!Ii,Sy=Tn&&(!Vf||Ii&&8<Ii&&11>=Ii),zp=" ",$p=!1;function Cy(t,e){switch(t){case"keyup":return AS.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function by(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ms=!1;function RS(t,e){switch(t){case"compositionend":return by(e);case"keypress":return e.which!==32?null:($p=!0,zp);case"textInput":return t=e.data,t===zp&&$p?null:t;default:return null}}function OS(t,e){if(ms)return t==="compositionend"||!Vf&&Cy(t,e)?(t=xy(),bl=Bf=Kn=null,ms=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Sy&&e.locale!=="ko"?null:e.data;default:return null}}var IS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function jp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!IS[t.type]:e==="textarea"}function Ey(t,e,n,r){ny(r),e=Jl(e,"onChange"),0<e.length&&(n=new Ff("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Li=null,to=null;function LS(t){_y(t,0)}function lc(t){var e=ks(t);if(G0(e))return t}function PS(t,e){if(t==="change")return e}var Ty=!1;if(Tn){var Jc;if(Tn){var Gc="oninput"in document;if(!Gc){var Bp=document.createElement("div");Bp.setAttribute("oninput","return;"),Gc=typeof Bp.oninput=="function"}Jc=Gc}else Jc=!1;Ty=Jc&&(!document.documentMode||9<document.documentMode)}function Fp(){Li&&(Li.detachEvent("onpropertychange",My),to=Li=null)}function My(t){if(t.propertyName==="value"&&lc(to)){var e=[];Ey(e,to,t,Df(t)),oy(LS,e)}}function DS(t,e,n){t==="focusin"?(Fp(),Li=e,to=n,Li.attachEvent("onpropertychange",My)):t==="focusout"&&Fp()}function _S(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return lc(to)}function zS(t,e){if(t==="click")return lc(e)}function $S(t,e){if(t==="input"||t==="change")return lc(e)}function jS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Gt=typeof Object.is=="function"?Object.is:jS;function no(t,e){if(Gt(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Wu.call(e,s)||!Gt(t[s],e[s]))return!1}return!0}function Hp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vp(t,e){var n=Hp(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hp(n)}}function Ay(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Ay(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Ny(){for(var t=window,e=Fl();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Fl(t.document)}return e}function Wf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function BS(t){var e=Ny(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Ay(n.ownerDocument.documentElement,n)){if(r!==null&&Wf(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Vp(n,i);var o=Vp(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var FS=Tn&&"documentMode"in document&&11>=document.documentMode,gs=null,cd=null,Pi=null,ud=!1;function Wp(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ud||gs==null||gs!==Fl(r)||(r=gs,"selectionStart"in r&&Wf(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pi&&no(Pi,r)||(Pi=r,r=Jl(cd,"onSelect"),0<r.length&&(e=new Ff("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=gs)))}function Uo(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var ys={animationend:Uo("Animation","AnimationEnd"),animationiteration:Uo("Animation","AnimationIteration"),animationstart:Uo("Animation","AnimationStart"),transitionend:Uo("Transition","TransitionEnd")},Qc={},Ry={};Tn&&(Ry=document.createElement("div").style,"AnimationEvent"in window||(delete ys.animationend.animation,delete ys.animationiteration.animation,delete ys.animationstart.animation),"TransitionEvent"in window||delete ys.transitionend.transition);function ac(t){if(Qc[t])return Qc[t];if(!ys[t])return t;var e=ys[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Ry)return Qc[t]=e[n];return t}var Oy=ac("animationend"),Iy=ac("animationiteration"),Ly=ac("animationstart"),Py=ac("transitionend"),Dy=new Map,Up="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function fr(t,e){Dy.set(t,e),es(e,[t])}for(var Xc=0;Xc<Up.length;Xc++){var Yc=Up[Xc],HS=Yc.toLowerCase(),VS=Yc[0].toUpperCase()+Yc.slice(1);fr(HS,"on"+VS)}fr(Oy,"onAnimationEnd");fr(Iy,"onAnimationIteration");fr(Ly,"onAnimationStart");fr("dblclick","onDoubleClick");fr("focusin","onFocus");fr("focusout","onBlur");fr(Py,"onTransitionEnd");Ds("onMouseEnter",["mouseout","mouseover"]);Ds("onMouseLeave",["mouseout","mouseover"]);Ds("onPointerEnter",["pointerout","pointerover"]);Ds("onPointerLeave",["pointerout","pointerover"]);es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));es("onBeforeInput",["compositionend","keypress","textInput","paste"]);es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),WS=new Set("cancel close invalid load scroll toggle".split(" ").concat(xi));function Kp(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,Hx(r,e,void 0,t),t.currentTarget=null}function _y(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==i&&s.isPropagationStopped())break e;Kp(s,l,c),i=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==i&&s.isPropagationStopped())break e;Kp(s,l,c),i=a}}}if(Vl)throw t=id,Vl=!1,id=null,t}function ae(t,e){var n=e[md];n===void 0&&(n=e[md]=new Set);var r=t+"__bubble";n.has(r)||(zy(e,t,2,!1),n.add(r))}function Zc(t,e,n){var r=0;e&&(r|=4),zy(n,t,r,e)}var Ko="_reactListening"+Math.random().toString(36).slice(2);function ro(t){if(!t[Ko]){t[Ko]=!0,W0.forEach(function(n){n!=="selectionchange"&&(WS.has(n)||Zc(n,!1,t),Zc(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Ko]||(e[Ko]=!0,Zc("selectionchange",!1,e))}}function zy(t,e,n,r){switch(wy(e)){case 1:var s=sS;break;case 4:s=iS;break;default:s=jf}n=s.bind(null,e,n,t),s=void 0,!sd||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function eu(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===s||a.nodeType===8&&a.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Tr(l),o===null)return;if(a=o.tag,a===5||a===6){r=i=o;continue e}l=l.parentNode}}r=r.return}oy(function(){var c=i,u=Df(n),d=[];e:{var f=Dy.get(t);if(f!==void 0){var h=Ff,p=t;switch(t){case"keypress":if(El(n)===0)break e;case"keydown":case"keyup":h=wS;break;case"focusin":p="focus",h=qc;break;case"focusout":p="blur",h=qc;break;case"beforeblur":case"afterblur":h=qc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Pp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=aS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=CS;break;case Oy:case Iy:case Ly:h=dS;break;case Py:h=ES;break;case"scroll":h=oS;break;case"wheel":h=MS;break;case"copy":case"cut":case"paste":h=hS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=_p}var m=(e&4)!==0,y=!m&&t==="scroll",g=m?f!==null?f+"Capture":null:f;m=[];for(var k=c,v;k!==null;){v=k;var x=v.stateNode;if(v.tag===5&&x!==null&&(v=x,g!==null&&(x=Xi(k,g),x!=null&&m.push(so(k,x,v)))),y)break;k=k.return}0<m.length&&(f=new h(f,p,null,n,u),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&n!==nd&&(p=n.relatedTarget||n.fromElement)&&(Tr(p)||p[Mn]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(p=n.relatedTarget||n.toElement,h=c,p=p?Tr(p):null,p!==null&&(y=ts(p),p!==y||p.tag!==5&&p.tag!==6)&&(p=null)):(h=null,p=c),h!==p)){if(m=Pp,x="onMouseLeave",g="onMouseEnter",k="mouse",(t==="pointerout"||t==="pointerover")&&(m=_p,x="onPointerLeave",g="onPointerEnter",k="pointer"),y=h==null?f:ks(h),v=p==null?f:ks(p),f=new m(x,k+"leave",h,n,u),f.target=y,f.relatedTarget=v,x=null,Tr(u)===c&&(m=new m(g,k+"enter",p,n,u),m.target=v,m.relatedTarget=y,x=m),y=x,h&&p)t:{for(m=h,g=p,k=0,v=m;v;v=ls(v))k++;for(v=0,x=g;x;x=ls(x))v++;for(;0<k-v;)m=ls(m),k--;for(;0<v-k;)g=ls(g),v--;for(;k--;){if(m===g||g!==null&&m===g.alternate)break t;m=ls(m),g=ls(g)}m=null}else m=null;h!==null&&qp(d,f,h,m,!1),p!==null&&y!==null&&qp(d,y,p,m,!0)}}e:{if(f=c?ks(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=PS;else if(jp(f))if(Ty)S=$S;else{S=_S;var b=DS}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=zS);if(S&&(S=S(t,c))){Ey(d,S,n,u);break e}b&&b(t,f,c),t==="focusout"&&(b=f._wrapperState)&&b.controlled&&f.type==="number"&&Xu(f,"number",f.value)}switch(b=c?ks(c):window,t){case"focusin":(jp(b)||b.contentEditable==="true")&&(gs=b,cd=c,Pi=null);break;case"focusout":Pi=cd=gs=null;break;case"mousedown":ud=!0;break;case"contextmenu":case"mouseup":case"dragend":ud=!1,Wp(d,n,u);break;case"selectionchange":if(FS)break;case"keydown":case"keyup":Wp(d,n,u)}var C;if(Vf)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else ms?Cy(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(Sy&&n.locale!=="ko"&&(ms||E!=="onCompositionStart"?E==="onCompositionEnd"&&ms&&(C=xy()):(Kn=u,Bf="value"in Kn?Kn.value:Kn.textContent,ms=!0)),b=Jl(c,E),0<b.length&&(E=new Dp(E,t,null,n,u),d.push({event:E,listeners:b}),C?E.data=C:(C=by(n),C!==null&&(E.data=C)))),(C=NS?RS(t,n):OS(t,n))&&(c=Jl(c,"onBeforeInput"),0<c.length&&(u=new Dp("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=C))}_y(d,e)})}function so(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Jl(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Xi(t,n),i!=null&&r.unshift(so(t,i,s)),i=Xi(t,e),i!=null&&r.push(so(t,i,s))),t=t.return}return r}function ls(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function qp(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var l=n,a=l.alternate,c=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&c!==null&&(l=c,s?(a=Xi(n,i),a!=null&&o.unshift(so(n,a,l))):s||(a=Xi(n,i),a!=null&&o.push(so(n,a,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var US=/\r\n?/g,KS=/\u0000|\uFFFD/g;function Jp(t){return(typeof t=="string"?t:""+t).replace(US,`
|
|
38
|
+
`).replace(KS,"")}function qo(t,e,n){if(e=Jp(e),Jp(t)!==e&&n)throw Error(R(425))}function Gl(){}var dd=null,fd=null;function hd(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var pd=typeof setTimeout=="function"?setTimeout:void 0,qS=typeof clearTimeout=="function"?clearTimeout:void 0,Gp=typeof Promise=="function"?Promise:void 0,JS=typeof queueMicrotask=="function"?queueMicrotask:typeof Gp<"u"?function(t){return Gp.resolve(null).then(t).catch(GS)}:pd;function GS(t){setTimeout(function(){throw t})}function tu(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),eo(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);eo(e)}function er(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Qp(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Ys=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ys,io="__reactProps$"+Ys,Mn="__reactContainer$"+Ys,md="__reactEvents$"+Ys,QS="__reactListeners$"+Ys,XS="__reactHandles$"+Ys;function Tr(t){var e=t[rn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Mn]||n[rn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Qp(t);t!==null;){if(n=t[rn])return n;t=Qp(t)}return e}t=n,n=t.parentNode}return null}function Ro(t){return t=t[rn]||t[Mn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ks(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(R(33))}function cc(t){return t[io]||null}var gd=[],vs=-1;function hr(t){return{current:t}}function ue(t){0>vs||(t.current=gd[vs],gd[vs]=null,vs--)}function ie(t,e){vs++,gd[vs]=t.current,t.current=e}var cr={},Ge=hr(cr),ct=hr(!1),Fr=cr;function _s(t,e){var n=t.type.contextTypes;if(!n)return cr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function ut(t){return t=t.childContextTypes,t!=null}function Ql(){ue(ct),ue(Ge)}function Xp(t,e,n){if(Ge.current!==cr)throw Error(R(168));ie(Ge,e),ie(ct,n)}function $y(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(R(108,Dx(t)||"Unknown",s));return ge({},n,r)}function Xl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||cr,Fr=Ge.current,ie(Ge,t),ie(ct,ct.current),!0}function Yp(t,e,n){var r=t.stateNode;if(!r)throw Error(R(169));n?(t=$y(t,e,Fr),r.__reactInternalMemoizedMergedChildContext=t,ue(ct),ue(Ge),ie(Ge,t)):ue(ct),ie(ct,n)}var kn=null,uc=!1,nu=!1;function jy(t){kn===null?kn=[t]:kn.push(t)}function YS(t){uc=!0,jy(t)}function pr(){if(!nu&&kn!==null){nu=!0;var t=0,e=te;try{var n=kn;for(te=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}kn=null,uc=!1}catch(s){throw kn!==null&&(kn=kn.slice(t+1)),uy(_f,pr),s}finally{te=e,nu=!1}}return null}var ws=[],xs=0,Yl=null,Zl=0,At=[],Nt=0,Hr=null,vn=1,wn="";function xr(t,e){ws[xs++]=Zl,ws[xs++]=Yl,Yl=t,Zl=e}function By(t,e,n){At[Nt++]=vn,At[Nt++]=wn,At[Nt++]=Hr,Hr=t;var r=vn;t=wn;var s=32-Kt(r)-1;r&=~(1<<s),n+=1;var i=32-Kt(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,vn=1<<32-Kt(e)+s|n<<s|r,wn=i+t}else vn=1<<i|n<<s|r,wn=t}function Uf(t){t.return!==null&&(xr(t,1),By(t,1,0))}function Kf(t){for(;t===Yl;)Yl=ws[--xs],ws[xs]=null,Zl=ws[--xs],ws[xs]=null;for(;t===Hr;)Hr=At[--Nt],At[Nt]=null,wn=At[--Nt],At[Nt]=null,vn=At[--Nt],At[Nt]=null}var vt=null,kt=null,fe=!1,Ft=null;function Fy(t,e){var n=Ot(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Zp(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,vt=t,kt=er(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,vt=t,kt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Hr!==null?{id:vn,overflow:wn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Ot(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,vt=t,kt=null,!0):!1;default:return!1}}function yd(t){return(t.mode&1)!==0&&(t.flags&128)===0}function kd(t){if(fe){var e=kt;if(e){var n=e;if(!Zp(t,e)){if(yd(t))throw Error(R(418));e=er(n.nextSibling);var r=vt;e&&Zp(t,e)?Fy(r,n):(t.flags=t.flags&-4097|2,fe=!1,vt=t)}}else{if(yd(t))throw Error(R(418));t.flags=t.flags&-4097|2,fe=!1,vt=t}}}function em(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;vt=t}function Jo(t){if(t!==vt)return!1;if(!fe)return em(t),fe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!hd(t.type,t.memoizedProps)),e&&(e=kt)){if(yd(t))throw Hy(),Error(R(418));for(;e;)Fy(t,e),e=er(e.nextSibling)}if(em(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(R(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){kt=er(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}kt=null}}else kt=vt?er(t.stateNode.nextSibling):null;return!0}function Hy(){for(var t=kt;t;)t=er(t.nextSibling)}function zs(){kt=vt=null,fe=!1}function qf(t){Ft===null?Ft=[t]:Ft.push(t)}var ZS=Rn.ReactCurrentBatchConfig;function li(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(R(309));var r=n.stateNode}if(!r)throw Error(R(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(R(284));if(!n._owner)throw Error(R(290,t))}return t}function Go(t,e){throw t=Object.prototype.toString.call(e),Error(R(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function tm(t){var e=t._init;return e(t._payload)}function Vy(t){function e(g,k){if(t){var v=g.deletions;v===null?(g.deletions=[k],g.flags|=16):v.push(k)}}function n(g,k){if(!t)return null;for(;k!==null;)e(g,k),k=k.sibling;return null}function r(g,k){for(g=new Map;k!==null;)k.key!==null?g.set(k.key,k):g.set(k.index,k),k=k.sibling;return g}function s(g,k){return g=sr(g,k),g.index=0,g.sibling=null,g}function i(g,k,v){return g.index=v,t?(v=g.alternate,v!==null?(v=v.index,v<k?(g.flags|=2,k):v):(g.flags|=2,k)):(g.flags|=1048576,k)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function l(g,k,v,x){return k===null||k.tag!==6?(k=cu(v,g.mode,x),k.return=g,k):(k=s(k,v),k.return=g,k)}function a(g,k,v,x){var S=v.type;return S===ps?u(g,k,v.props.children,x,v.key):k!==null&&(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===_n&&tm(S)===k.type)?(x=s(k,v.props),x.ref=li(g,k,v),x.return=g,x):(x=Il(v.type,v.key,v.props,null,g.mode,x),x.ref=li(g,k,v),x.return=g,x)}function c(g,k,v,x){return k===null||k.tag!==4||k.stateNode.containerInfo!==v.containerInfo||k.stateNode.implementation!==v.implementation?(k=uu(v,g.mode,x),k.return=g,k):(k=s(k,v.children||[]),k.return=g,k)}function u(g,k,v,x,S){return k===null||k.tag!==7?(k=Dr(v,g.mode,x,S),k.return=g,k):(k=s(k,v),k.return=g,k)}function d(g,k,v){if(typeof k=="string"&&k!==""||typeof k=="number")return k=cu(""+k,g.mode,v),k.return=g,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case $o:return v=Il(k.type,k.key,k.props,null,g.mode,v),v.ref=li(g,null,k),v.return=g,v;case hs:return k=uu(k,g.mode,v),k.return=g,k;case _n:var x=k._init;return d(g,x(k._payload),v)}if(vi(k)||ni(k))return k=Dr(k,g.mode,v,null),k.return=g,k;Go(g,k)}return null}function f(g,k,v,x){var S=k!==null?k.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return S!==null?null:l(g,k,""+v,x);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case $o:return v.key===S?a(g,k,v,x):null;case hs:return v.key===S?c(g,k,v,x):null;case _n:return S=v._init,f(g,k,S(v._payload),x)}if(vi(v)||ni(v))return S!==null?null:u(g,k,v,x,null);Go(g,v)}return null}function h(g,k,v,x,S){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(v)||null,l(k,g,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case $o:return g=g.get(x.key===null?v:x.key)||null,a(k,g,x,S);case hs:return g=g.get(x.key===null?v:x.key)||null,c(k,g,x,S);case _n:var b=x._init;return h(g,k,v,b(x._payload),S)}if(vi(x)||ni(x))return g=g.get(v)||null,u(k,g,x,S,null);Go(k,x)}return null}function p(g,k,v,x){for(var S=null,b=null,C=k,E=k=0,N=null;C!==null&&E<v.length;E++){C.index>E?(N=C,C=null):N=C.sibling;var P=f(g,C,v[E],x);if(P===null){C===null&&(C=N);break}t&&C&&P.alternate===null&&e(g,C),k=i(P,k,E),b===null?S=P:b.sibling=P,b=P,C=N}if(E===v.length)return n(g,C),fe&&xr(g,E),S;if(C===null){for(;E<v.length;E++)C=d(g,v[E],x),C!==null&&(k=i(C,k,E),b===null?S=C:b.sibling=C,b=C);return fe&&xr(g,E),S}for(C=r(g,C);E<v.length;E++)N=h(C,g,E,v[E],x),N!==null&&(t&&N.alternate!==null&&C.delete(N.key===null?E:N.key),k=i(N,k,E),b===null?S=N:b.sibling=N,b=N);return t&&C.forEach(function(j){return e(g,j)}),fe&&xr(g,E),S}function m(g,k,v,x){var S=ni(v);if(typeof S!="function")throw Error(R(150));if(v=S.call(v),v==null)throw Error(R(151));for(var b=S=null,C=k,E=k=0,N=null,P=v.next();C!==null&&!P.done;E++,P=v.next()){C.index>E?(N=C,C=null):N=C.sibling;var j=f(g,C,P.value,x);if(j===null){C===null&&(C=N);break}t&&C&&j.alternate===null&&e(g,C),k=i(j,k,E),b===null?S=j:b.sibling=j,b=j,C=N}if(P.done)return n(g,C),fe&&xr(g,E),S;if(C===null){for(;!P.done;E++,P=v.next())P=d(g,P.value,x),P!==null&&(k=i(P,k,E),b===null?S=P:b.sibling=P,b=P);return fe&&xr(g,E),S}for(C=r(g,C);!P.done;E++,P=v.next())P=h(C,g,E,P.value,x),P!==null&&(t&&P.alternate!==null&&C.delete(P.key===null?E:P.key),k=i(P,k,E),b===null?S=P:b.sibling=P,b=P);return t&&C.forEach(function(J){return e(g,J)}),fe&&xr(g,E),S}function y(g,k,v,x){if(typeof v=="object"&&v!==null&&v.type===ps&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case $o:e:{for(var S=v.key,b=k;b!==null;){if(b.key===S){if(S=v.type,S===ps){if(b.tag===7){n(g,b.sibling),k=s(b,v.props.children),k.return=g,g=k;break e}}else if(b.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===_n&&tm(S)===b.type){n(g,b.sibling),k=s(b,v.props),k.ref=li(g,b,v),k.return=g,g=k;break e}n(g,b);break}else e(g,b);b=b.sibling}v.type===ps?(k=Dr(v.props.children,g.mode,x,v.key),k.return=g,g=k):(x=Il(v.type,v.key,v.props,null,g.mode,x),x.ref=li(g,k,v),x.return=g,g=x)}return o(g);case hs:e:{for(b=v.key;k!==null;){if(k.key===b)if(k.tag===4&&k.stateNode.containerInfo===v.containerInfo&&k.stateNode.implementation===v.implementation){n(g,k.sibling),k=s(k,v.children||[]),k.return=g,g=k;break e}else{n(g,k);break}else e(g,k);k=k.sibling}k=uu(v,g.mode,x),k.return=g,g=k}return o(g);case _n:return b=v._init,y(g,k,b(v._payload),x)}if(vi(v))return p(g,k,v,x);if(ni(v))return m(g,k,v,x);Go(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,k!==null&&k.tag===6?(n(g,k.sibling),k=s(k,v),k.return=g,g=k):(n(g,k),k=cu(v,g.mode,x),k.return=g,g=k),o(g)):n(g,k)}return y}var $s=Vy(!0),Wy=Vy(!1),ea=hr(null),ta=null,Ss=null,Jf=null;function Gf(){Jf=Ss=ta=null}function Qf(t){var e=ea.current;ue(ea),t._currentValue=e}function vd(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Rs(t,e){ta=t,Jf=Ss=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(at=!0),t.firstContext=null)}function Dt(t){var e=t._currentValue;if(Jf!==t)if(t={context:t,memoizedValue:e,next:null},Ss===null){if(ta===null)throw Error(R(308));Ss=t,ta.dependencies={lanes:0,firstContext:t}}else Ss=Ss.next=t;return e}var Mr=null;function Xf(t){Mr===null?Mr=[t]:Mr.push(t)}function Uy(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,Xf(e)):(n.next=s.next,s.next=n),e.interleaved=n,An(t,r)}function An(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var zn=!1;function Yf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ky(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Sn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function tr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,An(t,n)}return s=r.interleaved,s===null?(e.next=e,Xf(r)):(e.next=s.next,s.next=e),r.interleaved=e,An(t,n)}function Tl(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,zf(t,n)}}function nm(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function na(t,e,n,r){var s=t.updateQueue;zn=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,c=a.next;a.next=null,o===null?i=c:o.next=c,o=a;var u=t.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=a))}if(i!==null){var d=s.baseState;o=0,u=c=a=null,l=i;do{var f=l.lane,h=l.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,m=l;switch(f=e,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(h,d,f):p,f==null)break e;d=ge({},d,f);break e;case 2:zn=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(c=u=h,a=d):u=u.next=h,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(u===null&&(a=d),s.baseState=a,s.firstBaseUpdate=c,s.lastBaseUpdate=u,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Wr|=o,t.lanes=o,t.memoizedState=d}}function rm(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(R(191,s));s.call(r)}}}var Oo={},on=hr(Oo),oo=hr(Oo),lo=hr(Oo);function Ar(t){if(t===Oo)throw Error(R(174));return t}function Zf(t,e){switch(ie(lo,e),ie(oo,t),ie(on,Oo),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Zu(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Zu(e,t)}ue(on),ie(on,e)}function js(){ue(on),ue(oo),ue(lo)}function qy(t){Ar(lo.current);var e=Ar(on.current),n=Zu(e,t.type);e!==n&&(ie(oo,t),ie(on,n))}function eh(t){oo.current===t&&(ue(on),ue(oo))}var pe=hr(0);function ra(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var ru=[];function th(){for(var t=0;t<ru.length;t++)ru[t]._workInProgressVersionPrimary=null;ru.length=0}var Ml=Rn.ReactCurrentDispatcher,su=Rn.ReactCurrentBatchConfig,Vr=0,me=null,Ae=null,Oe=null,sa=!1,Di=!1,ao=0,eC=0;function Ue(){throw Error(R(321))}function nh(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Gt(t[n],e[n]))return!1;return!0}function rh(t,e,n,r,s,i){if(Vr=i,me=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ml.current=t===null||t.memoizedState===null?sC:iC,t=n(r,s),Di){i=0;do{if(Di=!1,ao=0,25<=i)throw Error(R(301));i+=1,Oe=Ae=null,e.updateQueue=null,Ml.current=oC,t=n(r,s)}while(Di)}if(Ml.current=ia,e=Ae!==null&&Ae.next!==null,Vr=0,Oe=Ae=me=null,sa=!1,e)throw Error(R(300));return t}function sh(){var t=ao!==0;return ao=0,t}function Zt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oe===null?me.memoizedState=Oe=t:Oe=Oe.next=t,Oe}function _t(){if(Ae===null){var t=me.alternate;t=t!==null?t.memoizedState:null}else t=Ae.next;var e=Oe===null?me.memoizedState:Oe.next;if(e!==null)Oe=e,Ae=t;else{if(t===null)throw Error(R(310));Ae=t,t={memoizedState:Ae.memoizedState,baseState:Ae.baseState,baseQueue:Ae.baseQueue,queue:Ae.queue,next:null},Oe===null?me.memoizedState=Oe=t:Oe=Oe.next=t}return Oe}function co(t,e){return typeof e=="function"?e(t):e}function iu(t){var e=_t(),n=e.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=t;var r=Ae,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,a=null,c=i;do{var u=c.lane;if((Vr&u)===u)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=d,o=r):a=a.next=d,me.lanes|=u,Wr|=u}c=c.next}while(c!==null&&c!==i);a===null?o=r:a.next=l,Gt(r,e.memoizedState)||(at=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=a,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,me.lanes|=i,Wr|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function ou(t){var e=_t(),n=e.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);Gt(i,e.memoizedState)||(at=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function Jy(){}function Gy(t,e){var n=me,r=_t(),s=e(),i=!Gt(r.memoizedState,s);if(i&&(r.memoizedState=s,at=!0),r=r.queue,ih(Yy.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||Oe!==null&&Oe.memoizedState.tag&1){if(n.flags|=2048,uo(9,Xy.bind(null,n,r,s,e),void 0,null),Le===null)throw Error(R(349));Vr&30||Qy(n,e,s)}return s}function Qy(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=me.updateQueue,e===null?(e={lastEffect:null,stores:null},me.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Xy(t,e,n,r){e.value=n,e.getSnapshot=r,Zy(e)&&e1(t)}function Yy(t,e,n){return n(function(){Zy(e)&&e1(t)})}function Zy(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Gt(t,n)}catch{return!0}}function e1(t){var e=An(t,1);e!==null&&qt(e,t,1,-1)}function sm(t){var e=Zt();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:co,lastRenderedState:t},e.queue=t,t=t.dispatch=rC.bind(null,me,t),[e.memoizedState,t]}function uo(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=me.updateQueue,e===null?(e={lastEffect:null,stores:null},me.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function t1(){return _t().memoizedState}function Al(t,e,n,r){var s=Zt();me.flags|=t,s.memoizedState=uo(1|e,n,void 0,r===void 0?null:r)}function dc(t,e,n,r){var s=_t();r=r===void 0?null:r;var i=void 0;if(Ae!==null){var o=Ae.memoizedState;if(i=o.destroy,r!==null&&nh(r,o.deps)){s.memoizedState=uo(e,n,i,r);return}}me.flags|=t,s.memoizedState=uo(1|e,n,i,r)}function im(t,e){return Al(8390656,8,t,e)}function ih(t,e){return dc(2048,8,t,e)}function n1(t,e){return dc(4,2,t,e)}function r1(t,e){return dc(4,4,t,e)}function s1(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function i1(t,e,n){return n=n!=null?n.concat([t]):null,dc(4,4,s1.bind(null,e,t),n)}function oh(){}function o1(t,e){var n=_t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&nh(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function l1(t,e){var n=_t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&nh(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function a1(t,e,n){return Vr&21?(Gt(n,e)||(n=hy(),me.lanes|=n,Wr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,at=!0),t.memoizedState=n)}function tC(t,e){var n=te;te=n!==0&&4>n?n:4,t(!0);var r=su.transition;su.transition={};try{t(!1),e()}finally{te=n,su.transition=r}}function c1(){return _t().memoizedState}function nC(t,e,n){var r=rr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},u1(t))d1(e,n);else if(n=Uy(t,e,n,r),n!==null){var s=tt();qt(n,t,r,s),f1(n,e,r)}}function rC(t,e,n){var r=rr(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(u1(t))d1(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Gt(l,o)){var a=e.interleaved;a===null?(s.next=s,Xf(e)):(s.next=a.next,a.next=s),e.interleaved=s;return}}catch{}finally{}n=Uy(t,e,s,r),n!==null&&(s=tt(),qt(n,t,r,s),f1(n,e,r))}}function u1(t){var e=t.alternate;return t===me||e!==null&&e===me}function d1(t,e){Di=sa=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function f1(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,zf(t,n)}}var ia={readContext:Dt,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},sC={readContext:Dt,useCallback:function(t,e){return Zt().memoizedState=[t,e===void 0?null:e],t},useContext:Dt,useEffect:im,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Al(4194308,4,s1.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Al(4194308,4,t,e)},useInsertionEffect:function(t,e){return Al(4,2,t,e)},useMemo:function(t,e){var n=Zt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Zt();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=nC.bind(null,me,t),[r.memoizedState,t]},useRef:function(t){var e=Zt();return t={current:t},e.memoizedState=t},useState:sm,useDebugValue:oh,useDeferredValue:function(t){return Zt().memoizedState=t},useTransition:function(){var t=sm(!1),e=t[0];return t=tC.bind(null,t[1]),Zt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=me,s=Zt();if(fe){if(n===void 0)throw Error(R(407));n=n()}else{if(n=e(),Le===null)throw Error(R(349));Vr&30||Qy(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,im(Yy.bind(null,r,i,t),[t]),r.flags|=2048,uo(9,Xy.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Zt(),e=Le.identifierPrefix;if(fe){var n=wn,r=vn;n=(r&~(1<<32-Kt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ao++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=eC++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},iC={readContext:Dt,useCallback:o1,useContext:Dt,useEffect:ih,useImperativeHandle:i1,useInsertionEffect:n1,useLayoutEffect:r1,useMemo:l1,useReducer:iu,useRef:t1,useState:function(){return iu(co)},useDebugValue:oh,useDeferredValue:function(t){var e=_t();return a1(e,Ae.memoizedState,t)},useTransition:function(){var t=iu(co)[0],e=_t().memoizedState;return[t,e]},useMutableSource:Jy,useSyncExternalStore:Gy,useId:c1,unstable_isNewReconciler:!1},oC={readContext:Dt,useCallback:o1,useContext:Dt,useEffect:ih,useImperativeHandle:i1,useInsertionEffect:n1,useLayoutEffect:r1,useMemo:l1,useReducer:ou,useRef:t1,useState:function(){return ou(co)},useDebugValue:oh,useDeferredValue:function(t){var e=_t();return Ae===null?e.memoizedState=t:a1(e,Ae.memoizedState,t)},useTransition:function(){var t=ou(co)[0],e=_t().memoizedState;return[t,e]},useMutableSource:Jy,useSyncExternalStore:Gy,useId:c1,unstable_isNewReconciler:!1};function jt(t,e){if(t&&t.defaultProps){e=ge({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function wd(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ge({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var fc={isMounted:function(t){return(t=t._reactInternals)?ts(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=tt(),s=rr(t),i=Sn(r,s);i.payload=e,n!=null&&(i.callback=n),e=tr(t,i,s),e!==null&&(qt(e,t,s,r),Tl(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=tt(),s=rr(t),i=Sn(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=tr(t,i,s),e!==null&&(qt(e,t,s,r),Tl(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=tt(),r=rr(t),s=Sn(n,r);s.tag=2,e!=null&&(s.callback=e),e=tr(t,s,r),e!==null&&(qt(e,t,r,n),Tl(e,t,r))}};function om(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!no(n,r)||!no(s,i):!0}function h1(t,e,n){var r=!1,s=cr,i=e.contextType;return typeof i=="object"&&i!==null?i=Dt(i):(s=ut(e)?Fr:Ge.current,r=e.contextTypes,i=(r=r!=null)?_s(t,s):cr),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=fc,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function lm(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&fc.enqueueReplaceState(e,e.state,null)}function xd(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Yf(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Dt(i):(i=ut(e)?Fr:Ge.current,s.context=_s(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(wd(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&fc.enqueueReplaceState(s,s.state,null),na(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Bs(t,e){try{var n="",r=e;do n+=Px(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
+
Error generating stack: `+i.message+`
|
|
40
|
+
`+i.stack}return{value:t,source:e,stack:s,digest:null}}function lu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Sd(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var lC=typeof WeakMap=="function"?WeakMap:Map;function p1(t,e,n){n=Sn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){la||(la=!0,Id=r),Sd(t,e)},n}function m1(t,e,n){n=Sn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){Sd(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Sd(t,e),typeof r!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function am(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new lC;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=xC.bind(null,t,e,n),e.then(t,t))}function cm(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function um(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Sn(-1,1),e.tag=2,tr(n,e,1))),n.lanes|=1),t)}var aC=Rn.ReactCurrentOwner,at=!1;function Ze(t,e,n,r){e.child=t===null?Wy(e,null,n,r):$s(e,t.child,n,r)}function dm(t,e,n,r,s){n=n.render;var i=e.ref;return Rs(e,s),r=rh(t,e,n,r,i,s),n=sh(),t!==null&&!at?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Nn(t,e,s)):(fe&&n&&Uf(e),e.flags|=1,Ze(t,e,r,s),e.child)}function fm(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!ph(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,g1(t,e,i,r,s)):(t=Il(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:no,n(o,r)&&t.ref===e.ref)return Nn(t,e,s)}return e.flags|=1,t=sr(i,r),t.ref=e.ref,t.return=e,e.child=t}function g1(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(no(i,r)&&t.ref===e.ref)if(at=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(at=!0);else return e.lanes=t.lanes,Nn(t,e,s)}return Cd(t,e,n,r,s)}function y1(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ie(bs,mt),mt|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ie(bs,mt),mt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ie(bs,mt),mt|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,ie(bs,mt),mt|=r;return Ze(t,e,s,n),e.child}function k1(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Cd(t,e,n,r,s){var i=ut(n)?Fr:Ge.current;return i=_s(e,i),Rs(e,s),n=rh(t,e,n,r,i,s),r=sh(),t!==null&&!at?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Nn(t,e,s)):(fe&&r&&Uf(e),e.flags|=1,Ze(t,e,n,s),e.child)}function hm(t,e,n,r,s){if(ut(n)){var i=!0;Xl(e)}else i=!1;if(Rs(e,s),e.stateNode===null)Nl(t,e),h1(e,n,r),xd(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=Dt(c):(c=ut(n)?Fr:Ge.current,c=_s(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==c)&&lm(e,o,r,c),zn=!1;var f=e.memoizedState;o.state=f,na(e,r,o,s),a=e.memoizedState,l!==r||f!==a||ct.current||zn?(typeof u=="function"&&(wd(e,n,u,r),a=e.memoizedState),(l=zn||om(e,n,l,r,f,a,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=a),o.props=r,o.state=a,o.context=c,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Ky(t,e),l=e.memoizedProps,c=e.type===e.elementType?l:jt(e.type,l),o.props=c,d=e.pendingProps,f=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Dt(a):(a=ut(n)?Fr:Ge.current,a=_s(e,a));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==a)&&lm(e,o,r,a),zn=!1,f=e.memoizedState,o.state=f,na(e,r,o,s);var p=e.memoizedState;l!==d||f!==p||ct.current||zn?(typeof h=="function"&&(wd(e,n,h,r),p=e.memoizedState),(c=zn||om(e,n,c,r,f,p,a)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=a,r=c):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return bd(t,e,n,r,i,s)}function bd(t,e,n,r,s,i){k1(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&Yp(e,n,!1),Nn(t,e,i);r=e.stateNode,aC.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=$s(e,t.child,null,i),e.child=$s(e,null,l,i)):Ze(t,e,l,i),e.memoizedState=r.state,s&&Yp(e,n,!0),e.child}function v1(t){var e=t.stateNode;e.pendingContext?Xp(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Xp(t,e.context,!1),Zf(t,e.containerInfo)}function pm(t,e,n,r,s){return zs(),qf(s),e.flags|=256,Ze(t,e,n,r),e.child}var Ed={dehydrated:null,treeContext:null,retryLane:0};function Td(t){return{baseLanes:t,cachePool:null,transitions:null}}function w1(t,e,n){var r=e.pendingProps,s=pe.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),ie(pe,s&1),t===null)return kd(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=mc(o,r,0,null),t=Dr(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Td(n),e.memoizedState=Ed,t):lh(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return cC(t,e,o,r,l,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,l=s.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=sr(s,a),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=sr(l,i):(i=Dr(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?Td(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=Ed,r}return i=t.child,t=i.sibling,r=sr(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function lh(t,e){return e=mc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Qo(t,e,n,r){return r!==null&&qf(r),$s(e,t.child,null,n),t=lh(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function cC(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=lu(Error(R(422))),Qo(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=mc({mode:"visible",children:r.children},s,0,null),i=Dr(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&$s(e,t.child,null,o),e.child.memoizedState=Td(o),e.memoizedState=Ed,i);if(!(e.mode&1))return Qo(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(R(419)),r=lu(i,r,void 0),Qo(t,e,o,r)}if(l=(o&t.childLanes)!==0,at||l){if(r=Le,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,An(t,s),qt(r,t,s,-1))}return hh(),r=lu(Error(R(421))),Qo(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=SC.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,kt=er(s.nextSibling),vt=e,fe=!0,Ft=null,t!==null&&(At[Nt++]=vn,At[Nt++]=wn,At[Nt++]=Hr,vn=t.id,wn=t.overflow,Hr=e),e=lh(e,r.children),e.flags|=4096,e)}function mm(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),vd(t.return,e,n)}function au(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function x1(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(Ze(t,e,r.children,n),r=pe.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&mm(t,n,e);else if(t.tag===19)mm(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(ie(pe,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&ra(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),au(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&ra(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}au(e,!0,n,null,i);break;case"together":au(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Nl(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Nn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Wr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(R(153));if(e.child!==null){for(t=e.child,n=sr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=sr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function uC(t,e,n){switch(e.tag){case 3:v1(e),zs();break;case 5:qy(e);break;case 1:ut(e.type)&&Xl(e);break;case 4:Zf(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;ie(ea,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(ie(pe,pe.current&1),e.flags|=128,null):n&e.child.childLanes?w1(t,e,n):(ie(pe,pe.current&1),t=Nn(t,e,n),t!==null?t.sibling:null);ie(pe,pe.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return x1(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ie(pe,pe.current),r)break;return null;case 22:case 23:return e.lanes=0,y1(t,e,n)}return Nn(t,e,n)}var S1,Md,C1,b1;S1=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Md=function(){};C1=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Ar(on.current);var i=null;switch(n){case"input":s=Gu(t,s),r=Gu(t,r),i=[];break;case"select":s=ge({},s,{value:void 0}),r=ge({},r,{value:void 0}),i=[];break;case"textarea":s=Yu(t,s),r=Yu(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Gl)}ed(n,r);var o;n=null;for(c in s)if(!r.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var l=s[c];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Gi.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var a=r[c];if(l=s!=null?s[c]:void 0,r.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(i||(i=[]),i.push(c,n)),n=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(i=i||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Gi.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&ae("scroll",t),i||l===a||(i=[])):(i=i||[]).push(c,a))}n&&(i=i||[]).push("style",n);var c=i;(e.updateQueue=c)&&(e.flags|=4)}};b1=function(t,e,n,r){n!==r&&(e.flags|=4)};function ai(t,e){if(!fe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Ke(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function dC(t,e,n){var r=e.pendingProps;switch(Kf(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(e),null;case 1:return ut(e.type)&&Ql(),Ke(e),null;case 3:return r=e.stateNode,js(),ue(ct),ue(Ge),th(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Jo(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Ft!==null&&(Dd(Ft),Ft=null))),Md(t,e),Ke(e),null;case 5:eh(e);var s=Ar(lo.current);if(n=e.type,t!==null&&e.stateNode!=null)C1(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(R(166));return Ke(e),null}if(t=Ar(on.current),Jo(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[rn]=e,r[io]=i,t=(e.mode&1)!==0,n){case"dialog":ae("cancel",r),ae("close",r);break;case"iframe":case"object":case"embed":ae("load",r);break;case"video":case"audio":for(s=0;s<xi.length;s++)ae(xi[s],r);break;case"source":ae("error",r);break;case"img":case"image":case"link":ae("error",r),ae("load",r);break;case"details":ae("toggle",r);break;case"input":bp(r,i),ae("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ae("invalid",r);break;case"textarea":Tp(r,i),ae("invalid",r)}ed(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&qo(r.textContent,l,t),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&qo(r.textContent,l,t),s=["children",""+l]):Gi.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ae("scroll",r)}switch(n){case"input":jo(r),Ep(r,i,!0);break;case"textarea":jo(r),Mp(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Gl)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Y0(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[rn]=e,t[io]=r,S1(t,e,!1,!1),e.stateNode=t;e:{switch(o=td(n,r),n){case"dialog":ae("cancel",t),ae("close",t),s=r;break;case"iframe":case"object":case"embed":ae("load",t),s=r;break;case"video":case"audio":for(s=0;s<xi.length;s++)ae(xi[s],t);s=r;break;case"source":ae("error",t),s=r;break;case"img":case"image":case"link":ae("error",t),ae("load",t),s=r;break;case"details":ae("toggle",t),s=r;break;case"input":bp(t,r),s=Gu(t,r),ae("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=ge({},r,{value:void 0}),ae("invalid",t);break;case"textarea":Tp(t,r),s=Yu(t,r),ae("invalid",t);break;default:s=r}ed(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?ty(t,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Z0(t,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Qi(t,a):typeof a=="number"&&Qi(t,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Gi.hasOwnProperty(i)?a!=null&&i==="onScroll"&&ae("scroll",t):a!=null&&Of(t,i,a,o))}switch(n){case"input":jo(t),Ep(t,r,!1);break;case"textarea":jo(t),Mp(t);break;case"option":r.value!=null&&t.setAttribute("value",""+ar(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Ts(t,!!r.multiple,i,!1):r.defaultValue!=null&&Ts(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=Gl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Ke(e),null;case 6:if(t&&e.stateNode!=null)b1(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(R(166));if(n=Ar(lo.current),Ar(on.current),Jo(e)){if(r=e.stateNode,n=e.memoizedProps,r[rn]=e,(i=r.nodeValue!==n)&&(t=vt,t!==null))switch(t.tag){case 3:qo(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&qo(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[rn]=e,e.stateNode=r}return Ke(e),null;case 13:if(ue(pe),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(fe&&kt!==null&&e.mode&1&&!(e.flags&128))Hy(),zs(),e.flags|=98560,i=!1;else if(i=Jo(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(R(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(R(317));i[rn]=e}else zs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ke(e),i=!1}else Ft!==null&&(Dd(Ft),Ft=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||pe.current&1?Ne===0&&(Ne=3):hh())),e.updateQueue!==null&&(e.flags|=4),Ke(e),null);case 4:return js(),Md(t,e),t===null&&ro(e.stateNode.containerInfo),Ke(e),null;case 10:return Qf(e.type._context),Ke(e),null;case 17:return ut(e.type)&&Ql(),Ke(e),null;case 19:if(ue(pe),i=e.memoizedState,i===null)return Ke(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)ai(i,!1);else{if(Ne!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=ra(t),o!==null){for(e.flags|=128,ai(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return ie(pe,pe.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ce()>Fs&&(e.flags|=128,r=!0,ai(i,!1),e.lanes=4194304)}else{if(!r)if(t=ra(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),ai(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!fe)return Ke(e),null}else 2*Ce()-i.renderingStartTime>Fs&&n!==1073741824&&(e.flags|=128,r=!0,ai(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ce(),e.sibling=null,n=pe.current,ie(pe,r?n&1|2:n&1),e):(Ke(e),null);case 22:case 23:return fh(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?mt&1073741824&&(Ke(e),e.subtreeFlags&6&&(e.flags|=8192)):Ke(e),null;case 24:return null;case 25:return null}throw Error(R(156,e.tag))}function fC(t,e){switch(Kf(e),e.tag){case 1:return ut(e.type)&&Ql(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return js(),ue(ct),ue(Ge),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(ue(pe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(R(340));zs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ue(pe),null;case 4:return js(),null;case 10:return Qf(e.type._context),null;case 22:case 23:return fh(),null;case 24:return null;default:return null}}var Xo=!1,Je=!1,hC=typeof WeakSet=="function"?WeakSet:Set,_=null;function Cs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ve(t,e,r)}else n.current=null}function Ad(t,e,n){try{n()}catch(r){ve(t,e,r)}}var gm=!1;function pC(t,e){if(dd=Kl,t=Ny(),Wf(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var h;d!==n||s!==0&&d.nodeType!==3||(l=o+s),d!==i||r!==0&&d.nodeType!==3||(a=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===t)break t;if(f===n&&++c===s&&(l=o),f===i&&++u===r&&(a=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(fd={focusedElem:t,selectionRange:n},Kl=!1,_=e;_!==null;)if(e=_,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,_=t;else for(;_!==null;){e=_;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,y=p.memoizedState,g=e.stateNode,k=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:jt(e.type,m),y);g.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(R(163))}}catch(x){ve(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,_=t;break}_=e.return}return p=gm,gm=!1,p}function _i(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ad(e,n,i)}s=s.next}while(s!==r)}}function hc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Nd(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function E1(t){var e=t.alternate;e!==null&&(t.alternate=null,E1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[rn],delete e[io],delete e[md],delete e[QS],delete e[XS])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function T1(t){return t.tag===5||t.tag===3||t.tag===4}function ym(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||T1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rd(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Gl));else if(r!==4&&(t=t.child,t!==null))for(Rd(t,e,n),t=t.sibling;t!==null;)Rd(t,e,n),t=t.sibling}function Od(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Od(t,e,n),t=t.sibling;t!==null;)Od(t,e,n),t=t.sibling}var $e=null,Bt=!1;function Ln(t,e,n){for(n=n.child;n!==null;)M1(t,e,n),n=n.sibling}function M1(t,e,n){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(ic,n)}catch{}switch(n.tag){case 5:Je||Cs(n,e);case 6:var r=$e,s=Bt;$e=null,Ln(t,e,n),$e=r,Bt=s,$e!==null&&(Bt?(t=$e,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):$e.removeChild(n.stateNode));break;case 18:$e!==null&&(Bt?(t=$e,n=n.stateNode,t.nodeType===8?tu(t.parentNode,n):t.nodeType===1&&tu(t,n),eo(t)):tu($e,n.stateNode));break;case 4:r=$e,s=Bt,$e=n.stateNode.containerInfo,Bt=!0,Ln(t,e,n),$e=r,Bt=s;break;case 0:case 11:case 14:case 15:if(!Je&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ad(n,e,o),s=s.next}while(s!==r)}Ln(t,e,n);break;case 1:if(!Je&&(Cs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ve(n,e,l)}Ln(t,e,n);break;case 21:Ln(t,e,n);break;case 22:n.mode&1?(Je=(r=Je)||n.memoizedState!==null,Ln(t,e,n),Je=r):Ln(t,e,n);break;default:Ln(t,e,n)}}function km(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new hC),e.forEach(function(r){var s=CC.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function zt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:$e=l.stateNode,Bt=!1;break e;case 3:$e=l.stateNode.containerInfo,Bt=!0;break e;case 4:$e=l.stateNode.containerInfo,Bt=!0;break e}l=l.return}if($e===null)throw Error(R(160));M1(i,o,s),$e=null,Bt=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(c){ve(s,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)A1(e,t),e=e.sibling}function A1(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(zt(e,t),Xt(t),r&4){try{_i(3,t,t.return),hc(3,t)}catch(m){ve(t,t.return,m)}try{_i(5,t,t.return)}catch(m){ve(t,t.return,m)}}break;case 1:zt(e,t),Xt(t),r&512&&n!==null&&Cs(n,n.return);break;case 5:if(zt(e,t),Xt(t),r&512&&n!==null&&Cs(n,n.return),t.flags&32){var s=t.stateNode;try{Qi(s,"")}catch(m){ve(t,t.return,m)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,l=t.type,a=t.updateQueue;if(t.updateQueue=null,a!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Q0(s,i),td(l,o);var c=td(l,i);for(o=0;o<a.length;o+=2){var u=a[o],d=a[o+1];u==="style"?ty(s,d):u==="dangerouslySetInnerHTML"?Z0(s,d):u==="children"?Qi(s,d):Of(s,u,d,c)}switch(l){case"input":Qu(s,i);break;case"textarea":X0(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Ts(s,!!i.multiple,h,!1):f!==!!i.multiple&&(i.defaultValue!=null?Ts(s,!!i.multiple,i.defaultValue,!0):Ts(s,!!i.multiple,i.multiple?[]:"",!1))}s[io]=i}catch(m){ve(t,t.return,m)}}break;case 6:if(zt(e,t),Xt(t),r&4){if(t.stateNode===null)throw Error(R(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(m){ve(t,t.return,m)}}break;case 3:if(zt(e,t),Xt(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{eo(e.containerInfo)}catch(m){ve(t,t.return,m)}break;case 4:zt(e,t),Xt(t);break;case 13:zt(e,t),Xt(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(uh=Ce())),r&4&&km(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(Je=(c=Je)||u,zt(e,t),Je=c):zt(e,t),Xt(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(_=t,u=t.child;u!==null;){for(d=_=u;_!==null;){switch(f=_,h=f.child,f.tag){case 0:case 11:case 14:case 15:_i(4,f,f.return);break;case 1:Cs(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){ve(r,n,m)}}break;case 5:Cs(f,f.return);break;case 22:if(f.memoizedState!==null){wm(d);continue}}h!==null?(h.return=f,_=h):wm(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{s=d.stateNode,c?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,a=d.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=ey("display",o))}catch(m){ve(t,t.return,m)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(m){ve(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:zt(e,t),Xt(t),r&4&&km(t);break;case 21:break;default:zt(e,t),Xt(t)}}function Xt(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(T1(n)){var r=n;break e}n=n.return}throw Error(R(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Qi(s,""),r.flags&=-33);var i=ym(t);Od(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=ym(t);Rd(t,l,o);break;default:throw Error(R(161))}}catch(a){ve(t,t.return,a)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function mC(t,e,n){_=t,N1(t)}function N1(t,e,n){for(var r=(t.mode&1)!==0;_!==null;){var s=_,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Xo;if(!o){var l=s.alternate,a=l!==null&&l.memoizedState!==null||Je;l=Xo;var c=Je;if(Xo=o,(Je=a)&&!c)for(_=s;_!==null;)o=_,a=o.child,o.tag===22&&o.memoizedState!==null?xm(s):a!==null?(a.return=o,_=a):xm(s);for(;i!==null;)_=i,N1(i),i=i.sibling;_=s,Xo=l,Je=c}vm(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,_=i):vm(t)}}function vm(t){for(;_!==null;){var e=_;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Je||hc(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Je)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:jt(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&rm(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}rm(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var a=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&eo(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(R(163))}Je||e.flags&512&&Nd(e)}catch(f){ve(e,e.return,f)}}if(e===t){_=null;break}if(n=e.sibling,n!==null){n.return=e.return,_=n;break}_=e.return}}function wm(t){for(;_!==null;){var e=_;if(e===t){_=null;break}var n=e.sibling;if(n!==null){n.return=e.return,_=n;break}_=e.return}}function xm(t){for(;_!==null;){var e=_;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{hc(4,e)}catch(a){ve(e,n,a)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(a){ve(e,s,a)}}var i=e.return;try{Nd(e)}catch(a){ve(e,i,a)}break;case 5:var o=e.return;try{Nd(e)}catch(a){ve(e,o,a)}}}catch(a){ve(e,e.return,a)}if(e===t){_=null;break}var l=e.sibling;if(l!==null){l.return=e.return,_=l;break}_=e.return}}var gC=Math.ceil,oa=Rn.ReactCurrentDispatcher,ah=Rn.ReactCurrentOwner,It=Rn.ReactCurrentBatchConfig,Y=0,Le=null,Ee=null,Ve=0,mt=0,bs=hr(0),Ne=0,fo=null,Wr=0,pc=0,ch=0,zi=null,ot=null,uh=0,Fs=1/0,gn=null,la=!1,Id=null,nr=null,Yo=!1,qn=null,aa=0,$i=0,Ld=null,Rl=-1,Ol=0;function tt(){return Y&6?Ce():Rl!==-1?Rl:Rl=Ce()}function rr(t){return t.mode&1?Y&2&&Ve!==0?Ve&-Ve:ZS.transition!==null?(Ol===0&&(Ol=hy()),Ol):(t=te,t!==0||(t=window.event,t=t===void 0?16:wy(t.type)),t):1}function qt(t,e,n,r){if(50<$i)throw $i=0,Ld=null,Error(R(185));Ao(t,n,r),(!(Y&2)||t!==Le)&&(t===Le&&(!(Y&2)&&(pc|=n),Ne===4&&Vn(t,Ve)),dt(t,r),n===1&&Y===0&&!(e.mode&1)&&(Fs=Ce()+500,uc&&pr()))}function dt(t,e){var n=t.callbackNode;Zx(t,e);var r=Ul(t,t===Le?Ve:0);if(r===0)n!==null&&Rp(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Rp(n),e===1)t.tag===0?YS(Sm.bind(null,t)):jy(Sm.bind(null,t)),JS(function(){!(Y&6)&&pr()}),n=null;else{switch(py(r)){case 1:n=_f;break;case 4:n=dy;break;case 16:n=Wl;break;case 536870912:n=fy;break;default:n=Wl}n=z1(n,R1.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function R1(t,e){if(Rl=-1,Ol=0,Y&6)throw Error(R(327));var n=t.callbackNode;if(Os()&&t.callbackNode!==n)return null;var r=Ul(t,t===Le?Ve:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=ca(t,r);else{e=r;var s=Y;Y|=2;var i=I1();(Le!==t||Ve!==e)&&(gn=null,Fs=Ce()+500,Pr(t,e));do try{vC();break}catch(l){O1(t,l)}while(!0);Gf(),oa.current=i,Y=s,Ee!==null?e=0:(Le=null,Ve=0,e=Ne)}if(e!==0){if(e===2&&(s=od(t),s!==0&&(r=s,e=Pd(t,s))),e===1)throw n=fo,Pr(t,0),Vn(t,r),dt(t,Ce()),n;if(e===6)Vn(t,r);else{if(s=t.current.alternate,!(r&30)&&!yC(s)&&(e=ca(t,r),e===2&&(i=od(t),i!==0&&(r=i,e=Pd(t,i))),e===1))throw n=fo,Pr(t,0),Vn(t,r),dt(t,Ce()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(R(345));case 2:Sr(t,ot,gn);break;case 3:if(Vn(t,r),(r&130023424)===r&&(e=uh+500-Ce(),10<e)){if(Ul(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){tt(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=pd(Sr.bind(null,t,ot,gn),e);break}Sr(t,ot,gn);break;case 4:if(Vn(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-Kt(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=Ce()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gC(r/1960))-r,10<r){t.timeoutHandle=pd(Sr.bind(null,t,ot,gn),r);break}Sr(t,ot,gn);break;case 5:Sr(t,ot,gn);break;default:throw Error(R(329))}}}return dt(t,Ce()),t.callbackNode===n?R1.bind(null,t):null}function Pd(t,e){var n=zi;return t.current.memoizedState.isDehydrated&&(Pr(t,e).flags|=256),t=ca(t,e),t!==2&&(e=ot,ot=n,e!==null&&Dd(e)),t}function Dd(t){ot===null?ot=t:ot.push.apply(ot,t)}function yC(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Gt(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Vn(t,e){for(e&=~ch,e&=~pc,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Kt(e),r=1<<n;t[n]=-1,e&=~r}}function Sm(t){if(Y&6)throw Error(R(327));Os();var e=Ul(t,0);if(!(e&1))return dt(t,Ce()),null;var n=ca(t,e);if(t.tag!==0&&n===2){var r=od(t);r!==0&&(e=r,n=Pd(t,r))}if(n===1)throw n=fo,Pr(t,0),Vn(t,e),dt(t,Ce()),n;if(n===6)throw Error(R(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Sr(t,ot,gn),dt(t,Ce()),null}function dh(t,e){var n=Y;Y|=1;try{return t(e)}finally{Y=n,Y===0&&(Fs=Ce()+500,uc&&pr())}}function Ur(t){qn!==null&&qn.tag===0&&!(Y&6)&&Os();var e=Y;Y|=1;var n=It.transition,r=te;try{if(It.transition=null,te=1,t)return t()}finally{te=r,It.transition=n,Y=e,!(Y&6)&&pr()}}function fh(){mt=bs.current,ue(bs)}function Pr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,qS(n)),Ee!==null)for(n=Ee.return;n!==null;){var r=n;switch(Kf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ql();break;case 3:js(),ue(ct),ue(Ge),th();break;case 5:eh(r);break;case 4:js();break;case 13:ue(pe);break;case 19:ue(pe);break;case 10:Qf(r.type._context);break;case 22:case 23:fh()}n=n.return}if(Le=t,Ee=t=sr(t.current,null),Ve=mt=e,Ne=0,fo=null,ch=pc=Wr=0,ot=zi=null,Mr!==null){for(e=0;e<Mr.length;e++)if(n=Mr[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Mr=null}return t}function O1(t,e){do{var n=Ee;try{if(Gf(),Ml.current=ia,sa){for(var r=me.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}sa=!1}if(Vr=0,Oe=Ae=me=null,Di=!1,ao=0,ah.current=null,n===null||n.return===null){Ne=1,fo=e,Ee=null;break}e:{var i=t,o=n.return,l=n,a=e;if(e=Ve,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,u=l,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=cm(o);if(h!==null){h.flags&=-257,um(h,o,l,i,e),h.mode&1&&am(i,c,e),e=h,a=c;var p=e.updateQueue;if(p===null){var m=new Set;m.add(a),e.updateQueue=m}else p.add(a);break e}else{if(!(e&1)){am(i,c,e),hh();break e}a=Error(R(426))}}else if(fe&&l.mode&1){var y=cm(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),um(y,o,l,i,e),qf(Bs(a,l));break e}}i=a=Bs(a,l),Ne!==4&&(Ne=2),zi===null?zi=[i]:zi.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=p1(i,a,e);nm(i,g);break e;case 1:l=a;var k=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof k.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(nr===null||!nr.has(v)))){i.flags|=65536,e&=-e,i.lanes|=e;var x=m1(i,l,e);nm(i,x);break e}}i=i.return}while(i!==null)}P1(n)}catch(S){e=S,Ee===n&&n!==null&&(Ee=n=n.return);continue}break}while(!0)}function I1(){var t=oa.current;return oa.current=ia,t===null?ia:t}function hh(){(Ne===0||Ne===3||Ne===2)&&(Ne=4),Le===null||!(Wr&268435455)&&!(pc&268435455)||Vn(Le,Ve)}function ca(t,e){var n=Y;Y|=2;var r=I1();(Le!==t||Ve!==e)&&(gn=null,Pr(t,e));do try{kC();break}catch(s){O1(t,s)}while(!0);if(Gf(),Y=n,oa.current=r,Ee!==null)throw Error(R(261));return Le=null,Ve=0,Ne}function kC(){for(;Ee!==null;)L1(Ee)}function vC(){for(;Ee!==null&&!Wx();)L1(Ee)}function L1(t){var e=_1(t.alternate,t,mt);t.memoizedProps=t.pendingProps,e===null?P1(t):Ee=e,ah.current=null}function P1(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=fC(n,e),n!==null){n.flags&=32767,Ee=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ne=6,Ee=null;return}}else if(n=dC(n,e,mt),n!==null){Ee=n;return}if(e=e.sibling,e!==null){Ee=e;return}Ee=e=t}while(e!==null);Ne===0&&(Ne=5)}function Sr(t,e,n){var r=te,s=It.transition;try{It.transition=null,te=1,wC(t,e,n,r)}finally{It.transition=s,te=r}return null}function wC(t,e,n,r){do Os();while(qn!==null);if(Y&6)throw Error(R(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(R(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(eS(t,i),t===Le&&(Ee=Le=null,Ve=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Yo||(Yo=!0,z1(Wl,function(){return Os(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=It.transition,It.transition=null;var o=te;te=1;var l=Y;Y|=4,ah.current=null,pC(t,n),A1(n,t),BS(fd),Kl=!!dd,fd=dd=null,t.current=n,mC(n),Ux(),Y=l,te=o,It.transition=i}else t.current=n;if(Yo&&(Yo=!1,qn=t,aa=s),i=t.pendingLanes,i===0&&(nr=null),Jx(n.stateNode),dt(t,Ce()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(la)throw la=!1,t=Id,Id=null,t;return aa&1&&t.tag!==0&&Os(),i=t.pendingLanes,i&1?t===Ld?$i++:($i=0,Ld=t):$i=0,pr(),null}function Os(){if(qn!==null){var t=py(aa),e=It.transition,n=te;try{if(It.transition=null,te=16>t?16:t,qn===null)var r=!1;else{if(t=qn,qn=null,aa=0,Y&6)throw Error(R(331));var s=Y;for(Y|=4,_=t.current;_!==null;){var i=_,o=i.child;if(_.flags&16){var l=i.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(_=c;_!==null;){var u=_;switch(u.tag){case 0:case 11:case 15:_i(8,u,i)}var d=u.child;if(d!==null)d.return=u,_=d;else for(;_!==null;){u=_;var f=u.sibling,h=u.return;if(E1(u),u===c){_=null;break}if(f!==null){f.return=h,_=f;break}_=h}}}var p=i.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var y=m.sibling;m.sibling=null,m=y}while(m!==null)}}_=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,_=o;else e:for(;_!==null;){if(i=_,i.flags&2048)switch(i.tag){case 0:case 11:case 15:_i(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,_=g;break e}_=i.return}}var k=t.current;for(_=k;_!==null;){o=_;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,_=v;else e:for(o=k;_!==null;){if(l=_,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:hc(9,l)}}catch(S){ve(l,l.return,S)}if(l===o){_=null;break e}var x=l.sibling;if(x!==null){x.return=l.return,_=x;break e}_=l.return}}if(Y=s,pr(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(ic,t)}catch{}r=!0}return r}finally{te=n,It.transition=e}}return!1}function Cm(t,e,n){e=Bs(n,e),e=p1(t,e,1),t=tr(t,e,1),e=tt(),t!==null&&(Ao(t,1,e),dt(t,e))}function ve(t,e,n){if(t.tag===3)Cm(t,t,n);else for(;e!==null;){if(e.tag===3){Cm(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(nr===null||!nr.has(r))){t=Bs(n,t),t=m1(e,t,1),e=tr(e,t,1),t=tt(),e!==null&&(Ao(e,1,t),dt(e,t));break}}e=e.return}}function xC(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=tt(),t.pingedLanes|=t.suspendedLanes&n,Le===t&&(Ve&n)===n&&(Ne===4||Ne===3&&(Ve&130023424)===Ve&&500>Ce()-uh?Pr(t,0):ch|=n),dt(t,e)}function D1(t,e){e===0&&(t.mode&1?(e=Ho,Ho<<=1,!(Ho&130023424)&&(Ho=4194304)):e=1);var n=tt();t=An(t,e),t!==null&&(Ao(t,e,n),dt(t,n))}function SC(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),D1(t,n)}function CC(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(R(314))}r!==null&&r.delete(e),D1(t,n)}var _1;_1=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ct.current)at=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return at=!1,uC(t,e,n);at=!!(t.flags&131072)}else at=!1,fe&&e.flags&1048576&&By(e,Zl,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Nl(t,e),t=e.pendingProps;var s=_s(e,Ge.current);Rs(e,n),s=rh(null,e,r,t,s,n);var i=sh();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ut(r)?(i=!0,Xl(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yf(e),s.updater=fc,e.stateNode=s,s._reactInternals=e,xd(e,r,t,n),e=bd(null,e,r,!0,i,n)):(e.tag=0,fe&&i&&Uf(e),Ze(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Nl(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=EC(r),t=jt(r,t),s){case 0:e=Cd(null,e,r,t,n);break e;case 1:e=hm(null,e,r,t,n);break e;case 11:e=dm(null,e,r,t,n);break e;case 14:e=fm(null,e,r,jt(r.type,t),n);break e}throw Error(R(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:jt(r,s),Cd(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:jt(r,s),hm(t,e,r,s,n);case 3:e:{if(v1(e),t===null)throw Error(R(387));r=e.pendingProps,i=e.memoizedState,s=i.element,Ky(t,e),na(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Bs(Error(R(423)),e),e=pm(t,e,r,n,s);break e}else if(r!==s){s=Bs(Error(R(424)),e),e=pm(t,e,r,n,s);break e}else for(kt=er(e.stateNode.containerInfo.firstChild),vt=e,fe=!0,Ft=null,n=Wy(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zs(),r===s){e=Nn(t,e,n);break e}Ze(t,e,r,n)}e=e.child}return e;case 5:return qy(e),t===null&&kd(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,hd(r,s)?o=null:i!==null&&hd(r,i)&&(e.flags|=32),k1(t,e),Ze(t,e,o,n),e.child;case 6:return t===null&&kd(e),null;case 13:return w1(t,e,n);case 4:return Zf(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=$s(e,null,r,n):Ze(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:jt(r,s),dm(t,e,r,s,n);case 7:return Ze(t,e,e.pendingProps,n),e.child;case 8:return Ze(t,e,e.pendingProps.children,n),e.child;case 12:return Ze(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,ie(ea,r._currentValue),r._currentValue=o,i!==null)if(Gt(i.value,o)){if(i.children===s.children&&!ct.current){e=Nn(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Sn(-1,n&-n),a.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?a.next=a:(a.next=u.next,u.next=a),c.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),vd(i.return,n,e),l.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(R(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),vd(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Ze(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Rs(e,n),s=Dt(s),r=r(s),e.flags|=1,Ze(t,e,r,n),e.child;case 14:return r=e.type,s=jt(r,e.pendingProps),s=jt(r.type,s),fm(t,e,r,s,n);case 15:return g1(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:jt(r,s),Nl(t,e),e.tag=1,ut(r)?(t=!0,Xl(e)):t=!1,Rs(e,n),h1(e,r,s),xd(e,r,s,n),bd(null,e,r,!0,t,n);case 19:return x1(t,e,n);case 22:return y1(t,e,n)}throw Error(R(156,e.tag))};function z1(t,e){return uy(t,e)}function bC(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ot(t,e,n,r){return new bC(t,e,n,r)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function EC(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Lf)return 11;if(t===Pf)return 14}return 2}function sr(t,e){var n=t.alternate;return n===null?(n=Ot(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Il(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")ph(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ps:return Dr(n.children,s,i,e);case If:o=8,s|=8;break;case Uu:return t=Ot(12,n,e,s|2),t.elementType=Uu,t.lanes=i,t;case Ku:return t=Ot(13,n,e,s),t.elementType=Ku,t.lanes=i,t;case qu:return t=Ot(19,n,e,s),t.elementType=qu,t.lanes=i,t;case q0:return mc(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case U0:o=10;break e;case K0:o=9;break e;case Lf:o=11;break e;case Pf:o=14;break e;case _n:o=16,r=null;break e}throw Error(R(130,t==null?t:typeof t,""))}return e=Ot(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Dr(t,e,n,r){return t=Ot(7,t,r,e),t.lanes=n,t}function mc(t,e,n,r){return t=Ot(22,t,r,e),t.elementType=q0,t.lanes=n,t.stateNode={isHidden:!1},t}function cu(t,e,n){return t=Ot(6,t,null,e),t.lanes=n,t}function uu(t,e,n){return e=Ot(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function TC(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wc(0),this.expirationTimes=Wc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wc(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function mh(t,e,n,r,s,i,o,l,a){return t=new TC(t,e,n,l,a),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Ot(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yf(i),t}function MC(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hs,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function $1(t){if(!t)return cr;t=t._reactInternals;e:{if(ts(t)!==t||t.tag!==1)throw Error(R(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(ut(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(R(171))}if(t.tag===1){var n=t.type;if(ut(n))return $y(t,n,e)}return e}function j1(t,e,n,r,s,i,o,l,a){return t=mh(n,r,!0,t,s,i,o,l,a),t.context=$1(null),n=t.current,r=tt(),s=rr(n),i=Sn(r,s),i.callback=e??null,tr(n,i,s),t.current.lanes=s,Ao(t,s,r),dt(t,r),t}function gc(t,e,n,r){var s=e.current,i=tt(),o=rr(s);return n=$1(n),e.context===null?e.context=n:e.pendingContext=n,e=Sn(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=tr(s,e,o),t!==null&&(qt(t,s,o,i),Tl(t,s,o)),o}function ua(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function bm(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function gh(t,e){bm(t,e),(t=t.alternate)&&bm(t,e)}function AC(){return null}var B1=typeof reportError=="function"?reportError:function(t){console.error(t)};function yh(t){this._internalRoot=t}yc.prototype.render=yh.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(R(409));gc(t,e,null,null)};yc.prototype.unmount=yh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Ur(function(){gc(null,t,null,null)}),e[Mn]=null}};function yc(t){this._internalRoot=t}yc.prototype.unstable_scheduleHydration=function(t){if(t){var e=yy();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Hn.length&&e!==0&&e<Hn[n].priority;n++);Hn.splice(n,0,t),n===0&&vy(t)}};function kh(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function kc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Em(){}function NC(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var c=ua(o);i.call(c)}}var o=j1(e,r,t,0,null,!1,!1,"",Em);return t._reactRootContainer=o,t[Mn]=o.current,ro(t.nodeType===8?t.parentNode:t),Ur(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var c=ua(a);l.call(c)}}var a=mh(t,0,!1,null,null,!1,!1,"",Em);return t._reactRootContainer=a,t[Mn]=a.current,ro(t.nodeType===8?t.parentNode:t),Ur(function(){gc(e,a,n,r)}),a}function vc(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var a=ua(o);l.call(a)}}gc(e,o,t,s)}else o=NC(n,e,t,s,r);return ua(o)}my=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=wi(e.pendingLanes);n!==0&&(zf(e,n|1),dt(e,Ce()),!(Y&6)&&(Fs=Ce()+500,pr()))}break;case 13:Ur(function(){var r=An(t,1);if(r!==null){var s=tt();qt(r,t,1,s)}}),gh(t,1)}};$f=function(t){if(t.tag===13){var e=An(t,134217728);if(e!==null){var n=tt();qt(e,t,134217728,n)}gh(t,134217728)}};gy=function(t){if(t.tag===13){var e=rr(t),n=An(t,e);if(n!==null){var r=tt();qt(n,t,e,r)}gh(t,e)}};yy=function(){return te};ky=function(t,e){var n=te;try{return te=t,e()}finally{te=n}};rd=function(t,e,n){switch(e){case"input":if(Qu(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=cc(r);if(!s)throw Error(R(90));G0(r),Qu(r,s)}}}break;case"textarea":X0(t,n);break;case"select":e=n.value,e!=null&&Ts(t,!!n.multiple,e,!1)}};sy=dh;iy=Ur;var RC={usingClientEntryPoint:!1,Events:[Ro,ks,cc,ny,ry,dh]},ci={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},OC={bundleType:ci.bundleType,version:ci.version,rendererPackageName:ci.rendererPackageName,rendererConfig:ci.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Rn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=ay(t),t===null?null:t.stateNode},findFiberByHostInstance:ci.findFiberByHostInstance||AC,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zo.isDisabled&&Zo.supportsFiber)try{ic=Zo.inject(OC),sn=Zo}catch{}}St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=RC;St.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kh(e))throw Error(R(200));return MC(t,e,null,n)};St.createRoot=function(t,e){if(!kh(t))throw Error(R(299));var n=!1,r="",s=B1;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=mh(t,1,!1,null,null,n,!1,r,s),t[Mn]=e.current,ro(t.nodeType===8?t.parentNode:t),new yh(e)};St.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(R(188)):(t=Object.keys(t).join(","),Error(R(268,t)));return t=ay(e),t=t===null?null:t.stateNode,t};St.flushSync=function(t){return Ur(t)};St.hydrate=function(t,e,n){if(!kc(e))throw Error(R(200));return vc(null,t,e,!0,n)};St.hydrateRoot=function(t,e,n){if(!kh(t))throw Error(R(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=B1;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=j1(e,null,t,1,n??null,s,!1,i,o),t[Mn]=e.current,ro(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new yc(e)};St.render=function(t,e,n){if(!kc(e))throw Error(R(200));return vc(null,t,e,!1,n)};St.unmountComponentAtNode=function(t){if(!kc(t))throw Error(R(40));return t._reactRootContainer?(Ur(function(){vc(null,null,t,!1,function(){t._reactRootContainer=null,t[Mn]=null})}),!0):!1};St.unstable_batchedUpdates=dh;St.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!kc(n))throw Error(R(200));if(t==null||t._reactInternals===void 0)throw Error(R(38));return vc(t,e,n,!1,r)};St.version="18.3.1-next-f1338f8080-20240426";function F1(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(F1)}catch(t){console.error(t)}}F1(),F0.exports=St;var H1=F0.exports;const IC=N0(H1);var Tm=H1;Vu.createRoot=Tm.createRoot,Vu.hydrateRoot=Tm.hydrateRoot;const LC=T.forwardRef(function(e,n){return w.jsx("iframe",{ref:n,src:"/canvas/index.html",title:"Canvas Preview"})});var V1={exports:{}},W1={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var Hs=T;function PC(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var DC=typeof Object.is=="function"?Object.is:PC,_C=Hs.useState,zC=Hs.useEffect,$C=Hs.useLayoutEffect,jC=Hs.useDebugValue;function BC(t,e){var n=e(),r=_C({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return $C(function(){s.value=n,s.getSnapshot=e,du(s)&&i({inst:s})},[t,n,e]),zC(function(){return du(s)&&i({inst:s}),t(function(){du(s)&&i({inst:s})})},[t]),jC(n),n}function du(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!DC(t,n)}catch{return!0}}function FC(t,e){return e()}var HC=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?FC:BC;W1.useSyncExternalStore=Hs.useSyncExternalStore!==void 0?Hs.useSyncExternalStore:HC;V1.exports=W1;var vh=V1.exports;function je(t){this.content=t}je.prototype={constructor:je,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new je(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new je(n)},addToStart:function(t,e){return new je([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new je(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new je(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=je.from(t),t.size?new je(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=je.from(t),t.size?new je(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=je.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};je.from=function(t){if(t instanceof je)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new je(e)};function U1(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=U1(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function K1(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=K1(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-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&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new M(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new M(r,s)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new M(s,i)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return U1(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return K1(this,e,n,r)}findIndex(e){if(e==0)return el(0,e);if(e==this.size)return el(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?el(n+1,i):el(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const fu={index:0,offset:0};function el(t,e){return fu.index=t,fu.offset=e,fu}function da(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!da(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!da(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let re=class _d{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&da(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _d.none;if(e instanceof _d)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};re.none=[];class fa extends Error{}class L{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=J1(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new L(r,this.openStart,this.openEnd)}removeBetween(e,n){return new L(q1(this.content,e+this.openStart,n+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,n){if(!n)return L.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new L(M.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new L(e,r,s)}}L.empty=new L(M.empty,0,0);function q1(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(q1(i.content,e-s-1,n-s-1)))}function J1(t,e,n,r,s,i){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=J1(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,a);return c&&t.replaceChild(o,a.copy(c))}function VC(t,e,n){if(n.openStart>t.depth)throw new fa("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new fa("Inconsistent open depths");return G1(t,e,n,0)}function G1(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=G1(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return zr(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=WC(n,t);return zr(i,X1(t,o,l,e,r))}else return zr(i,ha(t,e,r))}function Q1(t,e){if(!e.type.compatibleContent(t.type))throw new fa("Cannot join "+e.type.name+" onto "+t.type.name)}function zd(t,e,n){let r=t.node(n);return Q1(r,e.node(n)),r}function _r(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ji(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(_r(t.nodeAfter,r),i++));for(let l=i;l<o;l++)_r(s.child(l),r);e&&e.depth==n&&e.textOffset&&_r(e.nodeBefore,r)}function zr(t,e){return t.type.checkContent(e),t.copy(e)}function X1(t,e,n,r,s){let i=t.depth>s&&zd(t,e,s+1),o=r.depth>s&&zd(n,r,s+1),l=[];return ji(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(Q1(i,o),_r(zr(i,X1(t,e,n,r,s+1)),l)):(i&&_r(zr(i,ha(t,e,s+1)),l),ji(e,n,s,l),o&&_r(zr(o,ha(n,r,s+1)),l)),ji(r,null,s,l),new M(l)}function ha(t,e,n){let r=[];if(ji(null,t,n,r),t.depth>n){let s=zd(t,e,n+1);_r(zr(s,ha(t,e,n+1)),r)}return ji(e,null,n,r),new M(r)}function WC(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(M.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class ho{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return re.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new pa(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ho(n,r,i)}static resolveCached(e,n){let r=Mm.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Mm.set(e,r=new UC);let s=r.elts[r.i]=ho.resolve(e,n);return r.i=(r.i+1)%KC,s}}class UC{constructor(){this.elts=[],this.i=0}}const KC=12,Mm=new WeakMap;class pa{constructor(e,n,r){this.$from=e,this.$to=n,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 qC=Object.create(null);class Jt{constructor(e,n,r,s=re.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||M.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,n,r,s=0){this.content.nodesBetween(e,n,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,n,r,s){return this.content.textBetween(e,n,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,n,r){return this.type==e&&da(this.attrs,n||e.defaultAttrs||qC)&&re.sameSet(this.marks,r||re.none)}copy(e=null){return e==this.content?this:new Jt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Jt(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return L.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new L(c,s.depth-o,i.depth-o)}replace(e,n,r){return VC(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return ho.resolveCached(this,e)}resolveNoCache(e){return ho.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.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()+")"),Y1(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.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=re.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!re.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=M.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Jt.prototype.text=void 0;class ma extends Jt{constructor(e,n,r,s){if(super(e,n,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):Y1(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ma(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ma(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Y1(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Kr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new JC(e,n);if(r.next==null)return Kr.empty;let s=Z1(r);r.next&&r.err("Unexpected trailing text");let i=tb(eb(s));return nb(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return M.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[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 n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
49
|
+
`)}}Kr.empty=new Kr(!0);class JC{constructor(e,n){this.string=e,this.nodeTypes=n,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 Z1(t){let e=[];do e.push(GC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function GC(t){let e=[];do e.push(QC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function QC(t){let e=ZC(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=XC(t,e);else break;return e}function Am(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function XC(t,e){let n=Am(t),r=n;return t.eat(",")&&(t.next!="}"?r=Am(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function YC(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function ZC(t){if(t.eat("(")){let e=Z1(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=YC(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function eb(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=n();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ek(t,e){return e-t}function Nm(t,e){let n=[];return r(e),n.sort(ek);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&n.indexOf(a)==-1&&r(a)}}}function tb(t){let e=Object.create(null);return n(Nm(t,0));function n(r){let s=[];r.forEach(o=>{t[o].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]);Nm(t,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Kr(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(ek);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function nb(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function tk(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function nk(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function rk(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function sk(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new sb(t,r,e[r]);return n}let Rm=class ik{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=sk(e,r.attrs),this.defaultAttrs=tk(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==Kr.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:nk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Jt(this,this.computeAttrs(e),M.from(n),re.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new Jt(this,this.computeAttrs(e),n,re.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(M.empty,!0);return i?new Jt(this,e,n.append(i),re.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){rk(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:re.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ik(i,n,o));let s=n.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 i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function rb(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class sb{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?rb(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class wc{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=sk(e,s.attrs),this.excluded=null;let i=tk(this.attrs);this.instance=i?new re(this,i):null}create(e=null){return!e&&this.instance?this.instance:new re(this,nk(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new wc(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){rk(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ok{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=je.from(e.nodes),n.marks=je.from(e.marks||{}),this.nodes=Rm.compile(this.spec.nodes,this),this.marks=wc.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 i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Kr.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Om(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Om(this,o.split(" "))}this.nodeFromJSON=s=>Jt.fromJSON(this,s),this.markFromJSON=s=>re.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Rm){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(n,r,s)}text(e,n){let r=this.nodes.text;return new ma(r,r.defaultAttrs,e,re.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Om(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ib(t){return t.tag!=null}function ob(t){return t.style!=null}class Cn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(ib(s))this.tags.push(s);else if(ob(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Lm(this,n,!1);return r.addAll(e,re.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Lm(this,n,!0);return r.addAll(e,re.none,n.from,n.to),L.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(cb(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Pm(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Pm(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Cn(e,Cn.schemaRules(e)))}}const lk={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},lb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ak={ol:!0,ul:!0},po=1,$d=2,Bi=4;function Im(t,e,n){return e!=null?(e?po:0)|(e==="full"?$d:0):t&&t.whitespace=="pre"?po|$d:n&~Bi}class tl{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=re.none,this.match=i||(o&Bi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);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&po)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!lk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Lm{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=Im(null,n.preserveWhitespace,0)|(r?Bi:0);s?i=new tl(s.type,s.attrs,re.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new tl(null,null,re.none,!0,null,o):i=new tl(e.schema.topNodeType,null,re.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&$d?"full":this.localPreserveWS||(s.options&po)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
50
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\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(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;ak.hasOwnProperty(o)&&this.parser.normalizeLists&&ab(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:lb.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);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(lk.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
51
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=re.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Dm(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Im(e,i,o.options);o.options&Bi&&o.content.length==0&&(l|=Bi);let a=re.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Dm(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new tl(e,n,a,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=po)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&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)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function ab(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ak.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function cb(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Pm(t){let e={};for(let n in t)e[n]=t[n];return e}function Dm(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class ns{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=nl(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return nl(n).createTextNode(e.text);let{dom:r,contentDOM:s}=Ll(nl(n),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,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Ll(nl(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:Ll(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ns(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=_m(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return _m(e.marks)}}function _m(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function nl(t){return t.document||window.document}const zm=new WeakMap;function ub(t){let e=zm.get(t);return e===void 0&&zm.set(t,e=db(t)),e}function db(t){let e=null;function n(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++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Ll(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=ub(r))&&i.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 o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?t.createElementNS(n,s):t.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 if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Ll(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const ck=65535,uk=Math.pow(2,16);function fb(t,e){return t+e*uk}function $m(t){return t&ck}function hb(t){return(t-(t&ck))/uk}const dk=1,fk=2,Pl=4,hk=8;class jd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&hk)>0}get deletedBefore(){return(this.delInfo&(dk|Pl))>0}get deletedAfter(){return(this.delInfo&(fk|Pl))>0}get deletedAcross(){return(this.delInfo&Pl)>0}}class gt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&>.empty)return gt.empty}recover(e){let n=0,r=$m(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+hb(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=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+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+s+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:fb(l/3,e-a),m=e==a?fk:e==d?dk:Pl;return(n<0?e!=a:e!=d)&&(m|=hk),new jd(h,m,p)}s+=u-c}return r?e+s:new jd(e+s,0,null)}touches(e,n){let r=0,s=$m(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new gt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gt.empty:new gt(e<0?[0,-e,0]:[0,0,e])}}gt.empty=new gt([]);class mo{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new mo(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new mo;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new jd(e,s,null)}}const hu=Object.create(null);class Ye{getMap(){return gt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=hu[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in hu)throw new RangeError("Duplicate use of step JSON ID "+e);return hu[e]=n,n.prototype.jsonID=e,n}}class Te{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Te(e,null)}static fail(e){return new Te(null,e)}static fromReplace(e,n,r,s){try{return Te.ok(e.replace(n,r,s))}catch(i){if(i instanceof fa)return Te.fail(i.message);throw i}}}function wh(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(wh(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return M.fromArray(r)}class Jn extends Ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new L(wh(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Te.fromReplace(e,this.from,this.to,i)}invert(){return new Ut(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jn(n.from,n.to,e.markFromJSON(n.mark))}}Ye.jsonID("addMark",Jn);class Ut extends Ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new L(wh(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return Te.fromReplace(e,this.from,this.to,r)}invert(){return new Jn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ut(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ut&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ut(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ut(n.from,n.to,e.markFromJSON(n.mark))}}Ye.jsonID("removeMark",Ut);class Gn extends Ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Te.fromReplace(e,this.pos,this.pos+1,new L(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Gn(this.pos,n.marks[s]);return new Gn(this.pos,this.mark)}}return new qr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Gn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Gn(n.pos,e.markFromJSON(n.mark))}}Ye.jsonID("addNodeMark",Gn);class qr extends Ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Te.fromReplace(e,this.pos,this.pos+1,new L(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Gn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new qr(n.pos,e.markFromJSON(n.mark))}}Ye.jsonID("removeNodeMark",qr);class be extends Ye{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Bd(e,this.from,this.to)?Te.fail("Structure replace would overwrite content"):Te.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new gt([this.from,this.to-this.from,this.slice.size])}invert(e){return new be(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&be.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new be(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof be)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?L.empty:new L(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new be(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?L.empty:new L(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new be(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new be(n.from,n.to,L.fromJSON(e,n.slice),!!n.structure)}}be.MAP_BIAS=1;Ye.jsonID("replace",be);class Pe extends Ye{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Bd(e,this.from,this.gapFrom)||Bd(e,this.gapTo,this.to)))return Te.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Te.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Te.fromReplace(e,this.from,this.to,r):Te.fail("Content does not fit in gap")}getMap(){return new gt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Pe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Pe(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Pe(n.from,n.to,n.gapFrom,n.gapTo,L.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ye.jsonID("replaceAround",Pe);function Bd(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function pb(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(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,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new Ut(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Jn(f,h,r))}}),s.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function mb(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof wc){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);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==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Ut(o.from,o.to,o.style)))}function xh(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new be(l,u,L.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Ut(l,u,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new L(M.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new be(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(M.empty,!0);t.replace(l,l,new L(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function gb(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Zs(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+s,a=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!gb(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function yb(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=M.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=M.from(r.node(p).copy(u)),d++):a--;let f=M.empty,h=0;for(let p=i,m=!1;p>n;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=M.from(s.node(p).copy(f)),h++):c++;t.step(new Pe(a,c,o,l,new L(u.append(f),d,h),u.size-d,!0))}function Sh(t,e,n=null,r=t){let s=kb(t,e),i=s&&vb(r,e);return i?s.map(jm).concat({type:e,attrs:n}).concat(i.map(jm)):null}function jm(t){return{type:t,attrs:null}}function kb(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function vb(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function wb(t,e,n){let r=M.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Pe(s,i,s,i,new L(r,0,0),n.length,!0))}function xb(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&Sb(t.doc,t.mapping.slice(i).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&&mk(t,o,l,i),xh(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return t.step(new Pe(d,f,d+1,f-1,new L(M.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&pk(t,o,l,i),!1}})}function pk(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function mk(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
52
|
+
`))}})}function Sb(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function Cb(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Pe(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new L(M.from(o),0,0),1,!0))}function bn(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;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 m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=s.indexAfter(i),a=r&&r[0];return s.node(i).canReplaceWith(l,l,a?a.type:s.node(i+1).type)}function bb(t,e,n=1,r){let s=t.doc.resolve(e),i=M.empty,o=M.empty;for(let l=s.depth,a=s.depth-n,c=n-1;l>a;l--,c--){i=M.from(s.node(l).copy(i));let u=r&&r[c];o=M.from(u?u.type.create(u.attrs,o):s.node(l).copy(o))}t.step(new be(e,e,new L(i.append(o),n,n),!0))}function mr(t,e){let n=t.resolve(e),r=n.index();return gk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Eb(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function gk(t,e){return!!(t&&e&&!t.isLeaf&&Eb(t,e))}function xc(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&gk(i,o)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function Tb(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);mk(t,u.node(),u.before(),l)}o.inlineContent&&xh(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new be(c,a.map(e+n,-1),L.empty,!0)),r===!0){let u=t.doc.resolve(c);pk(t,u.node(),u.before(),t.steps.length)}return t}function Mb(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function yk(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(i==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(o+1):r.after(o+1)}return null}function Sc(t,e,n=e,r=L.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return kk(s,i,r)?new be(e,n,r):new Ab(s,i,r).fit()}function kk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Ab{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=M.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(),n=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 i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let a=new L(i,o,l);return e>-1?new Pe(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new be(r.pos,s.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=pu(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(M.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=pu(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new L(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=pu(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new L(Si(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new L(Si(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(s){for(let m=0;m<s.childCount;m++)u.push(s.child(m));d=d.matchFragment(s)}let h=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||a==0||m.content.size)&&(d=y,u.push(vk(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Ci(this.placed,n,M.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<h;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=p?e==0?L.empty:new L(Si(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new L(Si(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!mu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.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 n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=mu(e,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=mu(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ci(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Ci(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=Ci(this.placed,this.frontier.length,n))}}function Si(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Si(t.firstChild.content,e-1,n)))}function Ci(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ci(t.lastChild.content,e-1,n)))}function pu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function vk(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,vk(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),t.copy(r)}function mu(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!Nb(n,i.content,o)?l:null}function Nb(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Rb(t){return t.spec.defining||t.spec.definingForContent}function Ob(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(kk(s,i,r))return t.step(new be(e,n,r));let o=xk(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.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;o.indexOf(f)>-1?l=f:s.before(f)==h&&o.splice(1,0,-f)}let a=o.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=Rb(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 m=0;m<o.length;m++){let y=o[(m+a)%o.length],g=!0;y<0&&(g=!1,y=-y);let k=s.node(y-1),v=s.index(y-1);if(k.canReplaceWith(v,v,p.type,p.marks))return t.replace(s.before(y),g?i.after(y):n,new L(wk(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=s.before(h),n=i.after(h))}}function wk(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(wk(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(M.empty,!0))}return t}function Ib(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=Mb(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new L(M.from(r),0,0))}function Lb(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=s.depth;a>o;a--)s.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=s.depth;a>0&&n==s.start(a);a--)n=s.before(a);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=xk(r,s);for(let o=0;o<i.length;o++){let l=i[o],a=o==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.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 t.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function xk(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Is extends Ye{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Te.fromReplace(e,this.pos,this.pos+1,new L(M.from(s),0,n.isLeaf?0:1))}getMap(){return gt.empty}invert(e){return new Is(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Is(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Is(n.pos,n.attr,n.value)}}Ye.jsonID("attr",Is);class go extends Ye{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Te.ok(r)}getMap(){return gt.empty}invert(e){return new go(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new go(n.attr,n.value)}}Ye.jsonID("docAttr",go);let Vs=class extends Error{};Vs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Vs.prototype=Object.create(Error.prototype);Vs.prototype.constructor=Vs;Vs.prototype.name="TransformError";class Ch{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new mo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Vs(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=L.empty){let s=Sc(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new L(M.from(r),0,0))}delete(e,n){return this.replace(e,n,L.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Ob(this,e,n,r),this}replaceRangeWith(e,n,r){return Ib(this,e,n,r),this}deleteRange(e,n){return Lb(this,e,n),this}lift(e,n){return yb(this,e,n),this}join(e,n=1){return Tb(this,e,n),this}wrap(e,n){return wb(this,e,n),this}setBlockType(e,n=e,r,s=null){return xb(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return Cb(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Is(e,n,r)),this}setDocAttribute(e,n){return this.step(new go(e,n)),this}addNodeMark(e,n){return this.step(new Gn(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof re)n.isInSet(r.marks)&&this.step(new qr(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new qr(e,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return bb(this,e,n,r),this}addMark(e,n,r){return pb(this,e,n,r),this}removeMark(e,n,r){return mb(this,e,n,r),this}clearIncompatible(e,n,r){return xh(this,e,n,r),this}}const gu=Object.create(null);class H{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Sk(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=L.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?L.empty:n),l==0&&Hm(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Hm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new B(e):us(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?us(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):us(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new wt(e.node(0))}static atStart(e){return us(e,e,0,0,1)||new wt(e)}static atEnd(e){return us(e,e,e.content.size,e.childCount,-1)||new wt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=gu[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in gu)throw new RangeError("Duplicate use of selection JSON ID "+e);return gu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return B.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class Sk{constructor(e,n){this.$from=e,this.$to=n}}let Bm=!1;function Fm(t){!Bm&&!t.parent.inlineContent&&(Bm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class B extends H{constructor(e,n=e){Fm(e),Fm(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return H.near(r);let s=e.resolve(n.map(this.anchor));return new B(s.parent.inlineContent?s:r,r)}replace(e,n=L.empty){if(super.replace(e,n),n==L.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof B&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Cc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new B(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=H.findFrom(n,r,!0)||H.findFrom(n,-r,!0);if(i)n=i.$head;else return H.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new B(e,n)}}H.jsonID("text",B);class Cc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Cc(e.map(this.anchor),e.map(this.head))}resolve(e){return B.between(e.resolve(this.anchor),e.resolve(this.head))}}class F extends H{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?H.near(i):new F(i)}content(){return new L(M.from(this.node),0,0)}eq(e){return e instanceof F&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new bh(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new F(e.resolve(n.anchor))}static create(e,n){return new F(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}F.prototype.visible=!1;H.jsonID("node",F);class bh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Cc(r,r):new bh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&F.isSelectable(r)?new F(n):H.near(n)}}class wt extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=L.empty){if(n==L.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new wt(e)}map(e){return new wt(e)}eq(e){return e instanceof wt}getBookmark(){return Pb}}H.jsonID("all",wt);const Pb={map(){return this},resolve(t){return new wt(t)}};function us(t,e,n,r,s,i=!1){if(e.inlineContent)return B.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&F.isSelectable(l))return F.create(t,n-(s<0?l.nodeSize:0))}else{let a=us(t,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function Hm(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof be||s instanceof Pe))return;let i=t.mapping.maps[r],o;i.forEach((l,a,c,u)=>{o==null&&(o=u)}),t.setSelection(H.near(t.doc.resolve(o),n))}const Vm=1,rl=2,Wm=4;class Db extends Ch{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|Vm)&~rl,this.storedMarks=null,this}get selectionSet(){return(this.updated&Vm)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=rl,this}ensureMarks(e){return re.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&rl)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~rl,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||re.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(H.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=Wm,this}get scrolledIntoView(){return(this.updated&Wm)>0}}function Um(t,e){return!e||!t?t:t.bind(e)}class bi{constructor(e,n,r){this.name=e,this.init=Um(n.init,r),this.apply=Um(n.apply,r)}}const _b=[new bi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new bi("selection",{init(t,e){return t.selection||H.atStart(e.doc)},apply(t){return t.selection}}),new bi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new bi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class yu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=_b.slice(),n&&n.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 bi(r.key,r.spec.state,r))})}}class Es{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){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 n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=s?s[o].n:0,c=s?s[o].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Es(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Db(this)}static create(e){let n=new yu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Es(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new yu(this.schema,e.plugins),r=n.fields,s=new Es(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new yu(e.schema,e.plugins),i=new Es(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Jt.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=H.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=c.fromJSON.call(a,e,n[l],i);return}}i[o.name]=o.init(e,i)}}),i}}function Ck(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Ck(s,e,{})),n[r]=s}return n}class de{constructor(e){this.spec=e,this.props={},e.props&&Ck(e.props,this,this.props),this.key=e.key?e.key.key:bk("plugin")}getState(e){return e[this.key]}}const ku=Object.create(null);function bk(t){return t in ku?t+"$"+ ++ku[t]:(ku[t]=0,t+"$")}class Se{constructor(e="key"){this.key=bk(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ek=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Tk(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Mk=(t,e,n)=>{let r=Tk(t,n);if(!r)return!1;let s=Eh(r);if(!s){let o=r.blockRange(),l=o&&Zs(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(_k(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Ws(i,"end")||F.isSelectable(i)))for(let o=r.depth;;o--){let l=Sc(t.doc,r.before(o),r.after(o),L.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Ws(i,"end")?H.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):F.create(a.doc,s.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},zb=(t,e,n)=>{let r=Tk(t,n);if(!r)return!1;let s=Eh(r);return s?Ak(t,s,e):!1},$b=(t,e,n)=>{let r=Rk(t,n);if(!r)return!1;let s=Th(r);return s?Ak(t,s,e):!1};function Ak(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,l=o,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=Sc(t.doc,i,a,L.empty);if(!c||c.from!=i||c instanceof be&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(B.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Ws(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Nk=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Eh(r)}let o=i&&i.nodeBefore;return!o||!F.isSelectable(o)?!1:(e&&e(t.tr.setSelection(F.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Eh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Rk(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Ok=(t,e,n)=>{let r=Rk(t,n);if(!r)return!1;let s=Th(r);if(!s)return!1;let i=s.nodeAfter;if(_k(t,s,e,1))return!0;if(r.parent.content.size==0&&(Ws(i,"start")||F.isSelectable(i))){let o=Sc(t.doc,r.before(),r.after(),L.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Ws(i,"start")?H.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):F.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},Ik=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Th(r)}let o=i&&i.nodeAfter;return!o||!F.isSelectable(o)?!1:(e&&e(t.tr.setSelection(F.create(t.doc,i.pos)).scrollIntoView()),!0)};function Th(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const jb=(t,e)=>{let n=t.selection,r=n instanceof F,s;if(r){if(n.node.isTextblock||!mr(t.doc,n.from))return!1;s=n.from}else if(s=xc(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(F.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Bb=(t,e)=>{let n=t.selection,r;if(n instanceof F){if(n.node.isTextblock||!mr(t.doc,n.to))return!1;r=n.to}else if(r=xc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Fb=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&Zs(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},Lk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
53
|
+
`).scrollIntoView()),!0)};function Mh(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Hb=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Mh(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(H.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Pk=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof wt||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Mh(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=t.tr.insert(o,i.createAndFill());l.setSelection(B.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Dk=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(bn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Zs(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function Vb(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof F&&e.selection.node.isBlock)return!r.parentOffset||!bn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,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=Mh(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof B||e.selection instanceof wt)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=bn(u.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=bn(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!a&&c&&r.node(o).type!=l){let h=u.mapping.map(r.before(o)),p=u.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return n&&n(u.scrollIntoView()),!0}}const Wb=Vb(),Ub=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(F.create(t.doc,s))),!0)};function Kb(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||mr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function _k(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,l,a=s.type.spec.isolating||i.type.spec.isolating;if(!a&&Kb(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=M.empty;for(let g=o.length-1;g>=0;g--)p=M.from(o[g].create(null,p));p=M.from(s.copy(p));let m=t.tr.step(new Pe(e.pos-1,h,e.pos,h,new L(p,1,0),o.length,!0)),y=m.doc.resolve(h+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&mr(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:H.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Zs(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Ws(i,"start",!0)&&Ws(s,"end")){let h=s,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let g=M.empty;for(let v=p.length-1;v>=0;v--)g=M.from(p[v].copy(g));let k=t.tr.step(new Pe(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new L(g,p.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function zk(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(B.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const qb=zk(-1),Jb=zk(1);function Gb(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&Sh(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Km(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(a,c)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)s=!0;else{let u=n.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function Ah(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}Ah(Ek,Mk,Nk);Ah(Ek,Ok,Ik);Ah(Lk,Pk,Dk,Wb);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Qb(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return Xb(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Xb(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);i=new pa(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new pa(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=Sh(i,n,r,e);return l?(t&&Yb(t,e,l,s,n),!0):!1}function Yb(t,e,n,r,s){let i=M.empty;for(let u=n.length-1;u>=0;u--)i=M.from(n[u].type.create(n[u].attrs,i));t.step(new Pe(e.start-(r?2:0),e.end,e.start,e.end,new L(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let l=n.length-o,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&bn(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function Zb(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?eE(e,n,t,i):tE(e,n,i):!0:!1}}function eE(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Pe(i-1,o,i,o,new L(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new pa(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=Zs(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(i,-1)-1);return mr(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function tE(t,e,n){let r=t.tr,s=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=s.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?M.empty:M.from(s))))return!1;let d=i.pos,f=d+o.nodeSize;return r.step(new Pe(d-(l?1:0),f+(a?1:0),d+1,f-1,new L((l?M.empty:M.from(s.copy(M.empty))).append(a?M.empty:M.from(s.copy(M.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function nE(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=M.from(c?t.create():null),d=new L(M.from(t.create(null,M.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new Pe(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Be=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Us=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Fd=null;const yn=function(t,e,n){let r=Fd||(Fd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},rE=function(){Fd=null},Jr=function(t,e,n,r){return n&&(qm(t,e,n,r,-1)||qm(t,e,n,r,1))},sE=/^(img|br|input|textarea|hr)$/i;function qm(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Rt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Io(t)||sE.test(t.nodeName)||t.contentEditable=="false")return!1;e=Be(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Rt(t):0}else return!1}}function Rt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function iE(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Rt(t)}else if(t.parentNode&&!Io(t))e=Be(t),t=t.parentNode;else return null}}function oE(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Io(t))e=Be(t)+1,t=t.parentNode;else return null}}function lE(t,e,n){for(let r=e==0,s=e==Rt(t);r||s;){if(t==n)return!0;let i=Be(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Rt(t)}}function Io(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const bc=function(t){return t.focusNode&&Jr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function br(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function aE(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function cE(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Rt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Rt(r.startContainer),r.startOffset)}}}const an=typeof navigator<"u"?navigator:null,Jm=typeof document<"u"?document:null,gr=an&&an.userAgent||"",Hd=/Edge\/(\d+)/.exec(gr),$k=/MSIE \d/.exec(gr),Vd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(gr),ft=!!($k||Vd||Hd),ir=$k?document.documentMode:Vd?+Vd[1]:Hd?+Hd[1]:0,Lt=!ft&&/gecko\/(\d+)/i.test(gr);Lt&&+(/Firefox\/(\d+)/.exec(gr)||[0,0])[1];const Wd=!ft&&/Chrome\/(\d+)/.exec(gr),He=!!Wd,jk=Wd?+Wd[1]:0,Qe=!ft&&!!an&&/Apple Computer/.test(an.vendor),Ks=Qe&&(/Mobile\/\w+/.test(gr)||!!an&&an.maxTouchPoints>2),Mt=Ks||(an?/Mac/.test(an.platform):!1),Bk=an?/Win/.test(an.platform):!1,xn=/Android \d/.test(gr),Lo=!!Jm&&"webkitFontSmoothing"in Jm.documentElement.style,uE=Lo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function dE(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function dn(t,e){return typeof t=="number"?t:t[e]}function fE(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Gm(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Us(o);continue}let l=o,a=l==i.body,c=a?dE(i):fE(l),u=0,d=0;if(e.top<c.top+dn(r,"top")?d=-(c.top-e.top+dn(s,"top")):e.bottom>c.bottom-dn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+dn(s,"top")-c.top:e.bottom-c.bottom+dn(s,"bottom")),e.left<c.left+dn(r,"left")?u=-(c.left-e.left+dn(s,"left")):e.right>c.right-dn(r,"right")&&(u=e.right-c.right+dn(s,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,y=l.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Us(o)}}function hE(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(i,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:Fk(t.dom)}}function Fk(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Us(r));return e}function pE({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Hk(n,r==0?0:r-e)}function Hk(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let as=null;function mE(t){if(t.setActive)return t.setActive();if(as)return t.focus(as);let e=Fk(t);t.focus(as==null?{get preventScroll(){return as={preventScroll:!0},!0}}:void 0),as||(as=!1,Hk(e,0))}function Vk(t,e){let n,r=2e8,s,i=0,o=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=yn(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,s=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,s=c,r=0),n&&n.nodeType==3?gE(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:Vk(n,s)}function gE(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Dn(r,1);if(o.top!=o.bottom&&Nh(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Nh(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function yE(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function kE(t,e,n){let{node:r,offset:s}=Vk(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function vE(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!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)&&(!o&&a.left>r.left||a.top>r.top?s=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),o=!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;i=l.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function Wk(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Nh(e,c))return Wk(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function wE(t,e){let n=t.dom.ownerDocument,r,s=0,i=cE(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Nh(e,c)||(o=Wk(t.dom,e,c),!o))return null}if(Qe)for(let c=o;r&&c;c=Us(c))c.draggable&&(r=void 0);if(o=yE(o,e),r){if(Lt&&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;Lo&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=vE(t,r,s,e))}l==null&&(l=kE(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Qm(t){return t.top<t.bottom||t.left<t.right}function Dn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Qm(r))return r}return Array.prototype.find.call(n,Qm)||t.getBoundingClientRect()}const xE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Uk(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Lo||Lt;if(r.nodeType==3)if(o&&(xE.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=Dn(yn(r,s,s),n);if(Lt&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Dn(yn(r,s-1,s-1),-1);if(c.top==a.top){let u=Dn(yn(r,s,s+1),-1);if(u.top!=a.top)return ui(u,u.left<c.left)}}return a}else{let a=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(a--,u=1):n<0?a--:c++,ui(Dn(yn(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Rt(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return vu(a.getBoundingClientRect(),!1)}if(i==null&&s<Rt(r)){let a=r.childNodes[s];if(a.nodeType==1)return vu(a.getBoundingClientRect(),!0)}return vu(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Rt(r))){let a=r.childNodes[s-1],c=a.nodeType==3?yn(a,Rt(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return ui(Dn(c,1),!1)}if(i==null&&s<Rt(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?yn(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return ui(Dn(c,-1),!0)}return ui(Dn(r.nodeType==3?yn(r):r,-n),n>=0)}function ui(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function vu(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Kk(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function SE(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return Kk(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=Uk(t,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=yn(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&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const CE=/[\u0590-\u08ac]/;function bE(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=t.domSelection();return l?!CE.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:Kk(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Xm=null,Ym=null,Zm=!1;function EE(t,e,n){return Xm==e&&Ym==n?Zm:(Xm=e,Ym=n,Zm=n=="up"||n=="down"?SE(t,e,n):bE(t,e,n))}const Pt=0,eg=1,Nr=2,cn=3;class Po{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Pt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let s=this.children[n];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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>Be(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(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>e||o instanceof Jk){s=e-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof qk&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Be(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Be(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(s==-1&&e<=c){let u=o+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=o;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=Be(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Be(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(i>p&&o<y)return m.setSelection(e-p-m.border,n-p-m.border,r,s);p=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Lt||Qe)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
54
|
+
`),d&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Be(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Lt&&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&&Qe)&&Jr(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Jr(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Lt)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){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,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+i.border,a=o-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?Nr:eg,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=cn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Nr:cn}r=o}this.dirty=Nr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Nr:eg;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class qk extends Po{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Pt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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 TE extends Po{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Gr extends Po{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=ns.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Gr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&cn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=cn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Pt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Pt}}slice(e,n,r){let s=Gr.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Kd(i,n,o,r)),e>0&&(i=Kd(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class or extends Po{constructor(e,n,r,s,i,o,l,a,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,n,r,s,i,o){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=ns.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Xk(u,r,n),c?a=new ME(e,n,r,s,u,d||null,f,c,i,o+1):n.isText?new Ec(e,n,r,s,u,f,i):new or(e,n,r,s,u,d||null,f,i,o+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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,n,r){return this.dirty==Pt&&e.eq(this.node)&&ga(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new NE(this,o&&o.node,e);IE(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?re.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,s)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(h=a.findIndexWithChild(i.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,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Nr)&&(o&&this.protectLocalComposition(e,o),Gk(this.contentDOM,this.children,e),Ks&&LE(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof B)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=PE(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new TE(this,i,n,s);e.input.compositionNodes.push(o),this.children=Kd(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==cn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Pt}updateOuterDeco(e){if(ga(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Qk(this.dom,this.nodeDOM,Ud(this.outerDeco,this.node,n),Ud(e,this.node,n)),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 tg(t,e,n,r,s){Xk(r,e,t);let i=new or(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Ec extends or{constructor(e,n,r,s,i,o,l){super(e,n,r,s,i,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==cn||this.dirty!=Pt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Pt||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=Pt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Ec(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=cn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Jk extends Po{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Pt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ME extends or{constructor(e,n,r,s,i,o,l,a,c,u){super(e,n,r,s,i,o,l,c,u),this.spec=a}update(e,n,r,s){if(this.dirty==cn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,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 Gk(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=ng(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(l,r);if(o instanceof Gr){let a=r?r.previousSibling:t.lastChild;Gk(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=ng(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const Fi=function(t){t&&(this.nodeName=t)};Fi.prototype=Object.create(null);const Rr=[new Fi];function Ud(t,e,n){if(t.length==0)return Rr;let r=n?Rr[0]:new Fi,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new Fi(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&s.length==1&&s.push(r=new Fi(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 Qk(t,e,n,r){if(n==Rr&&r==Rr)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let a;l&&l.nodeName==o.nodeName&&s!=t&&(a=s.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=Rr[0]),s=a}AE(s,l||Rr[0],o)}return s}function AE(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function Xk(t,e,n){return Qk(t,t,Rr,Ud(e,n,t.nodeType!=1))}function ga(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ng(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class NE{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=RE(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Pt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Gr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,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,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==cn&&o.dom==o.contentDOM&&(o.dirty=Nr),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==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=n}}updateNextNode(e,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof or){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=cn&&ga(n,a.outerDeco));if(!f&&a.update(e,n,r,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Nr,d.updateChildren(s,o+1),d.dirty=Pt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ga(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=or.create(this.top,n,r,s,i,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,s,i){let o=or.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,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 i=new qk(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Gr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ec)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Qe||He)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.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 Jk(this.top,[],r,null);n!=this.top?n.children.push(s):n.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 RE(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Gr)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function OE(t,e){return t.type.side-e.type.side}function IE(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let y=s[o++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(OE);for(let y=0;y<d.length;y++)n(d[y],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let p=i+f.nodeSize;if(f.isText){let y=p;o<s.length&&s[o].from<y&&(y=s[o].from);for(let g=0;g<l.length;g++)l[g].to<y&&(y=l[g].to);y<p&&(a=f.cut(y-i),f=f.cut(0,y-i),p=y,h=-1)}else for(;o<s.length&&s[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function LE(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function PE(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let a=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Kd(t,e,n,r,s){let i=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Rh(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(bc(n)){for(a=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&F.isSelectable(d)&&s.parent&&!(d.isInline&&lE(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new F(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Oh(t,u,l,d)}return c}function Yk(t){return t.editable?t.hasFocus():ev(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function En(t,e=!1){let n=t.state.selection;if(Zk(t,n),!!Yk(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&He){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Jr(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)_E(t);else{let{anchor:r,head:s}=n,i,o;rg&&!(n instanceof B)&&(n.$from.parent.inlineContent||(i=sg(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=sg(t,n.to))),t.docView.setSelection(r,s,t,e),rg&&(i&&ig(i),o&&ig(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&DE(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const rg=Qe||He&&jk<63;function sg(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Qe&&s&&s.contentEditable=="false")return wu(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return wu(s);if(i)return wu(i)}}function wu(t){return t.contentEditable="true",Qe&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ig(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function DE(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Yk(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function _E(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Be(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ft&&ir<=11&&(n.disabled=!0,n.disabled=!1)}function Zk(t,e){if(e instanceof F){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(og(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else og(t)}function og(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Oh(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||B.between(e,n,r)}function lg(t){return t.editable&&!t.hasFocus()?!1:ev(t)}function ev(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function zE(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Jr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qd(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&H.findFrom(i,e)}function $n(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ag(t,e,n){let r=t.state.selection;if(r instanceof B)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return $n(t,new B(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=qd(t.state,e);return s&&s instanceof F?$n(t,s):!1}else if(!(Mt&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?F.isSelectable(i)?$n(t,new F(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Lo?$n(t,new B(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof F&&r.node.isInline)return $n(t,new B(e>0?r.$to:r.$from));{let s=qd(t.state,e);return s?$n(t,s):!1}}}function ya(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Hi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function cs(t,e){return e<0?$E(t):jE(t)}function $E(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Lt&&n.nodeType==1&&r<ya(n)&&Hi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Hi(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(tv(n))break;{let l=n.previousSibling;for(;l&&Hi(l,-1);)s=n.parentNode,i=Be(l),l=l.previousSibling;if(l)n=l,r=ya(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Jd(t,n,r):s&&Jd(t,s,i)}function jE(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=ya(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Hi(l,1))i=n,o=++r;else break}else{if(tv(n))break;{let l=n.nextSibling;for(;l&&Hi(l,1);)i=l.parentNode,o=Be(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=ya(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Jd(t,i,o)}function tv(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function BE(t,e){for(;t&&e==t.childNodes.length&&!Io(t);)e=Be(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function FE(t,e){for(;t&&!e&&!Io(t);)e=Be(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Jd(t,e,n){if(e.nodeType!=3){let i,o;(o=BE(e,n))?(e=o,n=0):(i=FE(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(bc(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&En(t)},50)}function cg(t,e){let n=t.state.doc.resolve(e);if(!(He||Bk)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function ug(t,e,n){let r=t.state.selection;if(r instanceof B&&!r.empty||n.indexOf("s")>-1||Mt&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=qd(t.state,e);if(o&&o instanceof F)return $n(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof wt?H.near(o,e):H.findFrom(o,e);return l?$n(t,l):!1}return!1}function dg(t,e){if(!(t.state.selection instanceof B))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function fg(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function HE(t){if(!Qe||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;fg(t,r,"true"),setTimeout(()=>fg(t,r,"false"),20)}return!1}function VE(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function WE(t,e){let n=e.keyCode,r=VE(e);if(n==8||Mt&&n==72&&r=="c")return dg(t,-1)||cs(t,-1);if(n==46&&!e.shiftKey||Mt&&n==68&&r=="c")return dg(t,1)||cs(t,1);if(n==13||n==27)return!0;if(n==37||Mt&&n==66&&r=="c"){let s=n==37?cg(t,t.state.selection.from)=="ltr"?-1:1:-1;return ag(t,s,r)||cs(t,s)}else if(n==39||Mt&&n==70&&r=="c"){let s=n==39?cg(t,t.state.selection.from)=="ltr"?1:-1:1;return ag(t,s,r)||cs(t,s)}else{if(n==38||Mt&&n==80&&r=="c")return ug(t,-1,r)||cs(t,-1);if(n==40||Mt&&n==78&&r=="c")return HE(t)||ug(t,1,r)||cs(t,1);if(r==(Mt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ih(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||ns.fromSchema(t.state.schema),l=lv(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=ov[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} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
55
|
+
|
|
56
|
+
`);return{dom:a,text:f,slice:e}}function nv(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new L(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
57
|
+
`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(d)l=d;else{let f=s.marks(),{schema:h}=t.state,p=ns.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=o.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=JE(n),Lo&&GE(o);let c=o&&o.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=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Cn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!UE.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=QE(hg(l,+u[1],+u[2]),u[4]);else if(l=L.maxOpen(KE(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=hg(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const UE=/^(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 KE(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&sv(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=iv(o[o.length-1],i.length));let u=rv(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return M.from(o)}return t}function rv(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function sv(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=sv(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(M.from(rv(n,t,s+1))))}}function iv(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,iv(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function Gd(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=Gd(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function hg(t,e,n){return e<t.openStart&&(t=new L(Gd(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new L(Gd(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const ov={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 pg=null;function lv(){return pg||(pg=document.implementation.createHTMLDocument("title"))}let xu=null;function qE(t){let e=window.trustedTypes;return e?(xu||(xu=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),xu.createHTML(t)):t}function JE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=lv().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&ov[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=qE(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function GE(t){let e=t.querySelectorAll(He?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function QE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=M.from(a.create(r[l+1],s)),i++,o++}return new L(s,i,o)}const nt={},rt={},XE={touchstart:!0,touchmove:!0};class YE{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ZE(t){for(let e in nt){let n=nt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{tT(t,r)&&!Lh(t,r)&&(t.editable||!(r.type in rt))&&n(t,r)},XE[e]?{passive:!0}:void 0)}Qe&&t.dom.addEventListener("input",()=>null),Qd(t)}function Qn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function eT(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Qd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Lh(t,r))})}function Lh(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function tT(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function nT(t,e){!Lh(t,e)&&nt[e.type]&&(t.editable||!(e.type in rt))&&nt[e.type](t,e)}rt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!cv(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(xn&&He&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ks&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,br(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||WE(t,n)?n.preventDefault():Qn(t,"key")};rt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};rt.keypress=(t,e)=>{let n=e;if(cv(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mt&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof B)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Tc(t){return{left:t.clientX,top:t.clientY}}function rT(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ph(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Ls(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function sT(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&F.isSelectable(r)?(Ls(t,new F(n)),!0):!1}function iT(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof F&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(F.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Ls(t,F.create(t.state.doc,s)),!0):!1}function oT(t,e,n,r,s){return Ph(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?iT(t,n):sT(t,n))}function lT(t,e,n,r){return Ph(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function aT(t,e,n,r){return Ph(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||cT(t,n,r)}function cT(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ls(t,B.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Ls(t,B.create(r,l+1,l+1+o.content.size));else if(F.isSelectable(o))Ls(t,F.create(r,l));else continue;return!0}}function Dh(t){return ka(t)}const av=Mt?"metaKey":"ctrlKey";nt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Dh(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&rT(n,t.input.lastClick)&&!n[av]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Tc(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new uT(t,o,n,!!r)):(i=="doubleClick"?lT:aT)(t,o.pos,o.inside,n)?n.preventDefault():Qn(t,"pointer"))};class uT{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[av],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=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&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof F&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Lt&&!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)),Qn(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(()=>En(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Tc(e))),this.updateAllowDefault(e),this.allowDefault||!n?Qn(this.view,"pointer"):oT(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qe&&this.mightDrag&&!this.mightDrag.node.isAtom||He&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ls(this.view,H.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Qn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qn(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)}}nt.touchstart=t=>{t.input.lastTouch=Date.now(),Dh(t),Qn(t,"pointer")};nt.touchmove=t=>{t.input.lastTouch=Date.now(),Qn(t,"pointer")};nt.contextmenu=t=>Dh(t);function cv(t,e){return t.composing?!0:Qe&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const dT=xn?5e3:-1;rt.compositionstart=rt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof B&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||He&&Bk&&fT(t)))t.markCursor=t.state.storedMarks||n.marks(),ka(t,!0),t.markCursor=null;else if(ka(t,!e.selection.empty),Lt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}uv(t,dT)};function fT(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}rt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,uv(t,20))};function uv(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ka(t),e))}function dv(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=pT());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function hT(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=iE(e.focusNode,e.focusOffset),r=oE(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function pT(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ka(t,e=!1){if(!(xn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),dv(t),e||t.docView&&t.docView.dirty){let n=Rh(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function mT(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const yo=ft&&ir<15||Ks&&uE<604;nt.copy=rt.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=yo?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Ih(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):mT(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function gT(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function yT(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ko(t,r.value,null,s,e):ko(t,r.textContent,r.innerHTML,s,e)},50)}function ko(t,e,n,r,s){let i=nv(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||L.empty)))return!0;if(!i)return!1;let o=gT(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function fv(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}rt.paste=(t,e)=>{let n=e;if(t.composing&&!xn)return;let r=yo?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ko(t,fv(r),r.getData("text/html"),s,n)?n.preventDefault():yT(t,n)};class hv{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const kT=Mt?"altKey":"ctrlKey";function pv(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[kT]}nt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Tc(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof F?s.to-1:s.to))){if(r&&r.mightDrag)o=F.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=F.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=Ih(t,l);(!n.dataTransfer.files.length||!He||jk>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(yo?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",yo||n.dataTransfer.setData("text/plain",c),t.dragging=new hv(u,pv(t,n),o)};nt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};rt.dragover=rt.dragenter=(t,e)=>e.preventDefault();rt.drop=(t,e)=>{try{vT(t,e,t.dragging)}finally{t.dragging=null}};function vT(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Tc(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=nv(t,fv(e.dataTransfer),yo?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&pv(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||L.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?yk(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&F.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new F(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,y,g)=>h=g),a.setSelection(Oh(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}nt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&En(t)},20))};nt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};nt.beforeinput=(t,e)=>{if(He&&xn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,br(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in rt)nt[t]=rt[t];function vo(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class va{constructor(e,n){this.toDOM=e,this.spec=n||$r,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Ie(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof va&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&vo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class lr{constructor(e,n){this.attrs=e,this.spec=n||$r}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Ie(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof lr&&vo(this.attrs,e.attrs)&&vo(this.spec,e.spec)}static is(e){return e.type instanceof lr}destroy(){}}class _h{constructor(e,n){this.attrs=e,this.spec=n||$r}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Ie(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof _h&&vo(this.attrs,e.attrs)&&vo(this.spec,e.spec)}destroy(){}}class Ie{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ie(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ie(e,e,new va(n,r))}static inline(e,n,r,s){return new Ie(e,n,new lr(r,s))}static node(e,n,r,s){return new Ie(e,n,new _h(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof lr}get widget(){return this.type instanceof va}}const ds=[],$r={};class se{constructor(e,n){this.local=e.length?e:ds,this.children=n.length?n:ds}static create(e,n){return n.length?wa(n,e,0,$r):qe}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==qe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||$r)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?wT(this.children,o||[],e,n,r,s,i):o?new se(o.sort(jr),ds):qe}add(e,n){return n.length?this==qe?se.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=gv(n,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,wa(u,l,c+1,$r)),i+=3}});let o=mv(i?yv(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new se(o.length?this.local.concat(o).sort(jr):this.local,s||this.children)}remove(e){return e.length==0||this==qe?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=qe?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(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):qe}forChild(e,n){if(this==qe)return this;if(n.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 i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof lr){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new se(s.sort(jr),ds);return r?new Wn([l,r]):l}return r||qe}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 n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return zh(this.localsInner(e))}localsInner(e){if(this==qe)return ds;if(e.inlineContent||!this.local.some(lr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof lr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}se.empty=new se([],[]);se.removeOverlap=zh;const qe=se.empty;class Wn{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,$r));return Wn.from(r)}forChild(e,n){if(n.isLeaf)return se.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=qe&&(i instanceof Wn?r=r.concat(i.members):r.push(i))}return Wn.from(r)}eq(e){if(!(e instanceof Wn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?zh(r?n:n.sort(jr)):ds}static from(e){switch(e.length){case 0:return qe;case 1:return e[0];default:return new Wn(e.every(n=>n instanceof se)?e:e.reduce((n,r)=>n.concat(r instanceof se?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function wT(t,e,n,r,s,i,o){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let y=m-p-(h-f);for(let g=0;g<l.length;g+=3){let k=l[g+1];if(k<0||f>k+u-d)continue;let v=l[g]+u-d;h>=v?l[g+1]=f<=v?-2:-1:f>=u&&y&&(l[g]+=y,l[g+1]+=y)}d+=y}),u=n.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=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-s,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==h){let g=l[c+2].mapInner(n,y,u+1,t[c]+i+1,o);g!=qe?(l[c]=d,l[c+1]=h,l[c+2]=g):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=xT(l,t,e,n,s,i,o),u=wa(c,r,0,o);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(jr),l)}function mv(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Ie(s.from+e,s.to+e,s.type))}return n}function xT(t,e,n,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.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<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function gv(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function yv(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function wa(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let c=gv(t,l,a+n);if(c){i=!0;let u=wa(c,l,n+a+1,r);u!=qe&&s.push(a,a+l.nodeSize,u)}});let o=mv(i?yv(t):t,-n).sort(jr);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new se(o,s):qe}function jr(t,e){return t.from-e.from||t.to-e.to}function zh(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),mg(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),mg(e,s,r.copy(i.from,r.to)));break}}}return e}function mg(t,e,n){for(;e<t.length&&jr(n,t[e])>0;)e++;t.splice(e,0,n)}function Su(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=qe&&e.push(r)}),t.cursorWrapper&&e.push(se.create(t.state.doc,[t.cursorWrapper.deco])),Wn.from(e)}const ST={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},CT=ft&&ir<=11;class bT{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 ET{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bT,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]);ft&&ir<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Qe&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),CT&&(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,ST)),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 n=0;n<e.length;n++)this.queue.push(e[n]);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(lg(this.view)){if(this.suppressingSelectionUpdates)return En(this.view);if(ft&&ir<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Jr(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 n=new Set,r;for(let i=e.focusNode;i;i=Us(i))n.add(i);for(let i=e.anchorNode;i;i=Us(i))if(n.has(i)){r=i;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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&lg(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Lt&&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||AT(e,d)!=h)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&bc(r)&&(c=Rh(e))&&c.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,En(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),TT(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,NT(e,a)),this.handleDOMChange(i,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||En(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.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];n.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,i=e.nextSibling;if(ft&&ir<=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)&&(i=f)}let o=s&&s.parentNode==e.target?Be(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?Be(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let gg=new WeakMap,yg=!1;function TT(t){if(!gg.has(t)&&(gg.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Lt,yg)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."),yg=!0}}function kg(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Jr(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function MT(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return kg(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?kg(t,n):null}function AT(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function NT(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function RT(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],bc(a)||c.push({node:a.focusNode,offset:a.focusOffset})),He&&t.input.lastKeyCode===8)for(let y=i;y>s;y--){let g=r.childNodes[y-1],k=g.pmViewDesc;if(g.nodeName=="BR"&&!k){i=y;break}if(!k||k.size)break}let d=t.state.doc,f=t.someProp("domParser")||Cn.fromSchema(t.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:OT,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,g=c[1]&&c[1].pos;g==null&&(g=y),p={anchor:y+o,head:g+o}}return{doc:m,sel:p,from:o,to:l}}function OT(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Qe&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Qe&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const IT=/^(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 LT(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=Rh(t,C);if(E&&!t.state.selection.eq(E)){if(He&&xn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,br(13,"Enter"))))return;let N=t.state.tr.setSelection(E);C=="pointer"?N.setMeta("pointer",!0):C=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=RT(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=_T(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Ks&&t.input.lastIOSEnter>Date.now()-225||xn)&&s.some(C=>C.nodeType==1&&!IT.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,br(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof B&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let C=vg(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let E=t.state.tr.setSelection(C);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof B&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ft&&ir<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),g=u.resolve(p.start),k=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=p.endA;if((Ks&&t.input.lastIOSEnter>Date.now()-225&&(!k||s.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&m.pos<y.pos&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,br(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&DT(u,p.start,p.endA,m,y)&&t.someProp("handleKeyDown",C=>C(t,br(8,"Backspace")))){xn&&He&&t.domObserver.suppressSelectionUpdates();return}He&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),xn&&!k&&m.start()!=y.start()&&y.parentOffset==0&&m.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(()=>{t.someProp("handleKeyDown",function(C){return C(t,br(13,"Enter"))})},20));let v=p.start,x=p.endA,S=C=>{let E=C||t.state.tr.replace(v,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=vg(t,E.doc,c.sel);N&&!(He&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==v||N.head==E.mapping.map(x)-1)||ft&&N.empty&&N.head==v)&&E.setSelection(N)}return i&&E.setMeta("composition",i),E.scrollIntoView()},b;if(k)if(m.pos==y.pos){ft&&ir<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>En(t),20));let C=S(t.state.tr.delete(v,x)),E=u.resolve(p.start).marksAcross(u.resolve(p.endA));E&&C.ensureMarks(E),t.dispatch(C)}else if(p.endA==p.endB&&(b=PT(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start())))){let C=S(t.state.tr);b.type=="add"?C.addMark(v,x,b.mark):C.removeMark(v,x,b.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,y.parentOffset),E=()=>S(t.state.tr.insertText(C,v,x));t.someProp("handleTextInput",N=>N(t,v,x,C,E))||t.dispatch(E())}else t.dispatch(S());else t.dispatch(S())}function vg(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Oh(t,e.resolve(n.anchor),e.resolve(n.head))}function PT(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,l,a;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(M.from(c).eq(t))return{mark:l,type:o}}function DT(t,e,n,r,s){if(n-e<=s.pos-r.pos||Cu(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(Cu(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Cu(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Cu(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function _T(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let a=Math.max(0,i-Math.min(o,l));r-=o+a-i}if(o<i&&t.size<e.size){let a=r<=i&&r>=o?i-r:0;i-=a,i&&i<e.size&&wg(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-o),o=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&wg(t.textBetween(i-1,i+1))&&(i+=a?1:-1),o=i+(o-l),l=i}return{start:i,endA:o,endB:l}}function wg(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class kv{constructor(e,n){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 YE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Eg),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=Cg(this),Sg(this),this.nodeViews=bg(this),this.docView=tg(this.state.doc,xg(this),Su(this),this.dom,this),this.domObserver=new ET(this,(r,s,i,o)=>LT(this,r,s,i,o)),this.domObserver.start(),ZE(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Qd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Eg),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(dv(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=bg(this);$T(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Qd(this),this.editable=Cg(this),Sg(this);let a=Su(this),c=xg(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&hE(this);if(o){this.domObserver.stop();let h=d&&(ft||He)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&zT(s.selection,e.selection);if(d){let p=He?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=hT(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=tg(e.doc,c,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&zE(this))?En(this,h):(Zk(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&&pE(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof F){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Gm(this,n.getBoundingClientRect(),e)}else Gm(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new hv(e.slice,e.move,s<0?void 0:F.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(ft){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&&mE(this.dom),En(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return wE(this,e)}coordsAtPos(e,n=1){return Uk(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return EE(this,n||this.state,e)}pasteHTML(e,n){return ko(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ko(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ih(this,e)}destroy(){this.docView&&(eT(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Su(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,rE())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return nT(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qe&&this.root.nodeType===11&&aE(this.dom.ownerDocument)==this.dom&&MT(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}kv.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function xg(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ie.node(0,t.state.doc.content.size,e)]}function Sg(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ie.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Cg(t){return!t.someProp("editable",e=>e(t.state)===!1)}function zT(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function bg(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function $T(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function Eg(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ur={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:"'"},xa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jT=typeof navigator<"u"&&/Mac/.test(navigator.platform),BT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Fe=0;Fe<10;Fe++)ur[48+Fe]=ur[96+Fe]=String(Fe);for(var Fe=1;Fe<=24;Fe++)ur[Fe+111]="F"+Fe;for(var Fe=65;Fe<=90;Fe++)ur[Fe]=String.fromCharCode(Fe+32),xa[Fe]=String.fromCharCode(Fe);for(var bu in ur)xa.hasOwnProperty(bu)||(xa[bu]=ur[bu]);function FT(t){var e=jT&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||BT&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xa:ur)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const HT=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),VT=typeof navigator<"u"&&/Win/.test(navigator.platform);function WT(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!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))i=!0;else if(/^mod$/i.test(a))HT?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function UT(t){let e=Object.create(null);for(let n in t)e[WT(n)]=t[n];return e}function Eu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function KT(t){return new de({props:{handleKeyDown:$h(t)}})}function $h(t){let e=UT(t);return function(n,r){let s=FT(r),i,o=e[Eu(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Eu(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(VT&&r.ctrlKey&&r.altKey)&&(i=ur[r.keyCode])&&i!=s){let l=e[Eu(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var qT=Object.defineProperty,jh=(t,e)=>{for(var n in e)qT(t,n,{get:e[n],enumerable:!0})};function Mc(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Ac=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...c)=>{const u=l(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!t,a=t||s.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),y=f(...p)(m);return o.push(y),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Mc({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},$t={};jh($t,{blur:()=>JT,clearContent:()=>GT,clearNodes:()=>QT,command:()=>XT,createParagraphNear:()=>YT,cut:()=>ZT,deleteCurrentNode:()=>eM,deleteNode:()=>tM,deleteRange:()=>nM,deleteSelection:()=>iM,enter:()=>oM,exitCode:()=>lM,extendMarkRange:()=>aM,first:()=>cM,focus:()=>dM,forEach:()=>fM,insertContent:()=>hM,insertContentAt:()=>gM,joinBackward:()=>vM,joinDown:()=>kM,joinForward:()=>wM,joinItemBackward:()=>xM,joinItemForward:()=>SM,joinTextblockBackward:()=>CM,joinTextblockForward:()=>bM,joinUp:()=>yM,keyboardShortcut:()=>TM,lift:()=>MM,liftEmptyBlock:()=>AM,liftListItem:()=>NM,newlineInCode:()=>RM,resetAttributes:()=>OM,scrollIntoView:()=>IM,selectAll:()=>LM,selectNodeBackward:()=>PM,selectNodeForward:()=>DM,selectParentNode:()=>_M,selectTextblockEnd:()=>zM,selectTextblockStart:()=>$M,setContent:()=>jM,setMark:()=>oA,setMeta:()=>lA,setNode:()=>aA,setNodeSelection:()=>cA,setTextDirection:()=>uA,setTextSelection:()=>dA,sinkListItem:()=>fA,splitBlock:()=>hA,splitListItem:()=>pA,toggleList:()=>gA,toggleMark:()=>yA,toggleNode:()=>kA,toggleWrap:()=>vA,undoInputRule:()=>wA,unsetAllMarks:()=>xA,unsetMark:()=>SA,unsetTextDirection:()=>CA,updateAttributes:()=>bA,wrapIn:()=>EA,wrapInList:()=>TA});var JT=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),GT=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),QT=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.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=Zs(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},XT=t=>e=>t(e),YT=()=>({state:t,dispatch:e})=>Pk(t,e),ZT=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new B(r.doc.resolve(Math.max(o-1,0)))),!0},eM=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const l=s.before(i),a=s.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function Me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var tM=t=>({tr:e,state:n,dispatch:r})=>{const s=Me(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),c=i.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},nM=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},rM=t=>t.content?/^text(\*|\+)/.test(t.content):!1,Tg=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return rM(r)?n==="left"?t.start()-1:t.end()+1:t.pos},sM=(t,e,n)=>{const r=Tg(t,n,"left"),s=Tg(e,n,"right");return{from:r,to:s}},iM=()=>({state:t,dispatch:e})=>{const{$from:n,$to:r}=t.selection;if(t.selection.empty)return!1;const{from:s,to:i}=sM(n,r,t.schema);return e&&(t.tr.deleteRange(s,i).scrollIntoView(),e(t.tr)),!0},oM=()=>({commands:t})=>t.keyboardShortcut("Enter"),lM=()=>({state:t,dispatch:e})=>Hb(t,e);function Bh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Sa(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Bh(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function vv(t,e,n={}){return t.find(r=>r.type===e&&Sa(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Mg(t,e,n={}){return!!vv(t,e,n)}function Fh(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!vv([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,l=i+1,a=o+r.node.nodeSize;for(;i>0&&Mg([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&Mg([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:a}}function On(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var aM=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=On(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:u}=l;if(s){const d=Fh(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=B.create(o,d.from,d.to);n.setSelection(f)}}return!0},cM=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function wv(t){return t instanceof B}function Or(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function xv(t,e=null){if(!e)return null;const n=H.atStart(t),r=H.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?B.create(t,Or(0,s,i),Or(t.content.size,s,i)):B.create(t,Or(e,s,i),Or(e,s,i))}function Ag(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ca(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function uM(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var dM=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ca()||Ag())&&r.dom.focus(),uM()&&!Ca()&&!Ag()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!wv(n.state.selection))return o(),!0;const l=xv(s.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},fM=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),hM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Sv=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Sv(r)}return t};function Ei(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Sv(n)}function wo(t,e,n){if(t instanceof Jt||t instanceof M)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),wo("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const a=new ok({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=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Cn.fromSchema(a).parseSlice(Ei(t),n.parseOptions):Cn.fromSchema(a).parse(Ei(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Cn.fromSchema(e);return n.slice?i.parseSlice(Ei(t),n.parseOptions).content:i.parse(Ei(t),n.parseOptions)}return wo("",e,n)}function pM(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof be||s instanceof Pe))return;const i=t.mapping.maps[r];let o=0;i.forEach((l,a,c,u)=>{o===0&&(o=u)}),t.setSelection(H.near(t.doc.resolve(o),n))}var mM=t=>!("type"in t),gM=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{wo(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=wo(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((mM(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 m;if(f){if(Array.isArray(e))m=e.map(y=>y.text||"").join("");else if(e instanceof M){let y="";e.forEach(g=>{g.text&&(y+=g.text)}),m=y}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const y=r.doc.resolve(u),g=y.node(),k=y.parentOffset===0,v=g.isText||g.isTextblock,x=g.content.size>0;k&&v&&x&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&pM(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},yM=()=>({state:t,dispatch:e})=>jb(t,e),kM=()=>({state:t,dispatch:e})=>Bb(t,e),vM=()=>({state:t,dispatch:e})=>Mk(t,e),wM=()=>({state:t,dispatch:e})=>Ok(t,e),xM=()=>({state:t,dispatch:e,tr:n})=>{try{const r=xc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},SM=()=>({state:t,dispatch:e,tr:n})=>{try{const r=xc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},CM=()=>({state:t,dispatch:e})=>zb(t,e),bM=()=>({state:t,dispatch:e})=>$b(t,e);function Cv(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function EM(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!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))i=!0;else if(/^mod$/i.test(a))Ca()||Cv()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var TM=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=EM(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function dr(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Me(e,t.schema):null,l=[];t.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=>o?o.name===d.node.type.name:!0).filter(d=>Sa(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var MM=(t,e={})=>({state:n,dispatch:r})=>{const s=Me(t,n.schema);return dr(n,s,e)?Fb(n,r):!1},AM=()=>({state:t,dispatch:e})=>Dk(t,e),NM=t=>({state:e,dispatch:n})=>{const r=Me(t,e.schema);return Zb(r)(e,n)},RM=()=>({state:t,dispatch:e})=>Lk(t,e);function Nc(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ng(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var OM=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=Nc(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Me(t,r.schema)),l==="mark"&&(o=On(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(a=!0,s&&n.setNodeMarkup(d,void 0,Ng(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(a=!0,s&&n.addMark(d,d+u.nodeSize,o.create(Ng(f.attrs,e))))})})}),a},IM=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),LM=()=>({tr:t,dispatch:e})=>{if(e){const n=new wt(t.doc);t.setSelection(n)}return!0},PM=()=>({state:t,dispatch:e})=>Nk(t,e),DM=()=>({state:t,dispatch:e})=>Ik(t,e),_M=()=>({state:t,dispatch:e})=>Ub(t,e),zM=()=>({state:t,dispatch:e})=>Jb(t,e),$M=()=>({state:t,dispatch:e})=>qb(t,e);function Xd(t,e,n={},r={}){return wo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var jM=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=Xd(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function bv(t,e){const n=On(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Ev(t,e){const n=new Ch(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function BM(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function FM(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function Tv(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Rc(t){return e=>Tv(e.$from,t)}function z(t,e,n){return t.config[e]===void 0&&t.parent?z(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?z(t.parent,e,n):null}):t.config[e]}function Oc(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",n);return r?[e,...Oc(r())]:e}).flat(10)}function Hh(t,e){const n=ns.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function Mv(t){return typeof t=="function"}function Z(t,e=void 0,...n){return Mv(t)?e?t.bind(e)(...n):t(...n):t}function HM(t={}){return Object.keys(t).length===0&&t.constructor===Object}function qs(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Av(t){const e=[],{nodeExtensions:n,markExtensions:r}=qs(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:s},d=z(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=a:h.types==="nodes"?p=o:h.types==="marks"?p=l:p=[],p.forEach(m=>{Object.entries(h.attributes).forEach(([y,g])=>{e.push({type:m,name:y,attribute:{...i,...g}})})})})}),s.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=z(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const m={...i,...p};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:c.name,name:h,attribute:m})})}),e}function VM(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let l=0;l<o;l+=1){const a=t[l];if(a==="'"&&!s){r=!r,n+=a;continue}if(a==='"'&&!r){s=!s,n+=a;continue}if(!r&&!s){if(a==="("){i+=1,n+=a;continue}if(a===")"&&i>0){i-=1,n+=a;continue}if(a===";"&&i===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function Rg(t){const e=[],n=VM(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),a=i.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function he(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).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=new Map([...Rg(r[s]),...Rg(i)]);r[s]=Array.from(l.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function xo(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>he(n,r),{})}function WM(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Og(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):WM(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function Ig(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&HM(n)?!1:n!=null))}function Lg(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Nv(t,e){var n;const r=Av(t),{nodeExtensions:s,markExtensions:i}=qs(t),o=(n=s.find(c=>z(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((g,k)=>{const v=z(k,"extendNodeSchema",d);return{...g,...v?v(c):{}}},{}),h=Ig({...f,content:Z(z(c,"content",d)),marks:Z(z(c,"marks",d)),group:Z(z(c,"group",d)),inline:Z(z(c,"inline",d)),atom:Z(z(c,"atom",d)),selectable:Z(z(c,"selectable",d)),draggable:Z(z(c,"draggable",d)),code:Z(z(c,"code",d)),whitespace:Z(z(c,"whitespace",d)),linebreakReplacement:Z(z(c,"linebreakReplacement",d)),defining:Z(z(c,"defining",d)),isolating:Z(z(c,"isolating",d)),attrs:Object.fromEntries(u.map(Lg))}),p=Z(z(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Og(g,u)));const m=z(c,"renderHTML",d);m&&(h.toDOM=g=>m({node:g,HTMLAttributes:xo(g,u)}));const y=z(c,"renderText",d);return y&&(h.toText=y),[c.name,h]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,g)=>{const k=z(g,"extendMarkSchema",d);return{...y,...k?k(c):{}}},{}),h=Ig({...f,inclusive:Z(z(c,"inclusive",d)),excludes:Z(z(c,"excludes",d)),group:Z(z(c,"group",d)),spanning:Z(z(c,"spanning",d)),code:Z(z(c,"code",d)),attrs:Object.fromEntries(u.map(Lg))}),p=Z(z(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Og(y,u)));const m=z(c,"renderHTML",d);return m&&(h.toDOM=y=>m({mark:y,HTMLAttributes:xo(y,u)})),[c.name,h]}));return new ok({topNode:o,nodes:l,marks:a})}function UM(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Ps(t){return t.sort((n,r)=>{const s=z(n,"priority")||100,i=z(r,"priority")||100;return s>i?-1:s<i?1:0})}function Vh(t){const e=Ps(Oc(t)),n=UM(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function KM(t,e){const n=Vh(t);return Nv(n,e)}function qM(t,e){const n=KM(e),r=Ei(t);return Cn.fromSchema(n).parse(r).toJSON()}function Rv(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
|
|
58
|
+
|
|
59
|
+
`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,s,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const h=o==null?void 0:o[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 JM(t,e){const n={from:0,to:t.content.size};return Rv(t,n,e)}function Ov(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function GM(t,e){const n=Me(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function Iv(t,e){const n=Nc(typeof e=="string"?e:e.name,t.schema);return n==="node"?GM(t,e):n==="mark"?bv(t,e):{}}function QM(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function XM(t){const e=QM(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Lv(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),XM(r)}function Wh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Fh(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var YM=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);(l==null?void 0:l.type.name)===e?o=l:i-=1}return[o,i]};function di(t,e){return e.nodes[t]||e.marks[t]||null}function Dl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var ZM=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var a,c;const u=((c=(a=s.type.spec).toText)==null?void 0:c.call(a,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Yd(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?On(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Sa(d.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,y)=>{if(i&&m.inlineContent&&!m.type.allowsMarkType(i))return!1;if(!m.isText&&!m.marks.length)return;const g=Math.max(h,y),k=Math.min(p,y+m.nodeSize),v=k-g;o+=v,l.push(...m.marks.map(x=>({mark:x,from:g,to:k})))})}),o===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Sa(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=o}function eA(t,e,n={}){if(!e)return dr(t,null,n)||Yd(t,null,n);const r=Nc(e,t.schema);return r==="node"?dr(t,e,n):r==="mark"?Yd(t,e,n):!1}var tA=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=Rc(l=>l.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},nA=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Pg(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Tu(t,e){const{nodeExtensions:n}=qs(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=Z(z(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function So(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(So(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function Pv(t){return t instanceof F}var Dv=class _v{constructor(e){this.position=e}static fromJSON(e){return new _v(e.position)}toJSON(){return{position:this.position}}};function rA(t,e){const n=e.mapping.mapResult(t.position);return{position:new Dv(n.pos),mapResult:n}}function sA(t){return new Dv(t)}function iA(t,e,n){var r;const{selection:s}=e;let i=null;if(wv(s)&&(i=s.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var oA=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,a=On(t,r.schema);if(s)if(o){const c=bv(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(g=>g.type===a)?f.marks.forEach(g=>{a===g.type&&n.addMark(p,m,a.create({...g.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return iA(r,n,a)},lA=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),aA=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Me(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Km(i,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Km(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},cA=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Or(t,0,r.content.size),i=F.create(r,s);e.setSelection(i)}return!0},uA=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},dA=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=B.atStart(r).from,l=B.atEnd(r).to,a=Or(s,o,l),c=Or(i,o,l),u=B.create(r,a,c);e.setSelection(u)}return!0},fA=t=>({state:e,dispatch:n})=>{const r=Me(t,e.schema);return nE(r)(e,n)};function Dg(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var hA=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:a}=i,c=s.extensionManager.attributes,u=Dl(c,l.node().type.name,l.node().attrs);if(i instanceof F&&i.node.isBlock)return!l.parentOffset||!bn(o,l.pos)?!1:(r&&(t&&Dg(n,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:BM(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=bn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&bn(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&&(i instanceof B&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),y=e.doc.resolve(m);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&Dg(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},pA=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=Me(t,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=i.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 g=M.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let E=a.depth-k;E>=a.depth-3;E-=1)g=M.from(a.node(E).copy(g));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,x={...Dl(f,a.node().type.name,a.node().attrs),...e},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(x))||void 0;g=g.append(M.from(l.createAndFill(null,S)||void 0));const b=a.before(a.depth-(k-1));n.replace(b,a.after(-v),new L(g,4-k,0));let C=-1;n.doc.nodesBetween(b,n.doc.content.size,(E,N)=>{if(C>-1)return!1;E.isTextblock&&E.content.size===0&&(C=N+1)}),C>-1&&n.setSelection(B.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Dl(f,d.type.name,d.attrs),...e},m={...Dl(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const y=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!bn(n.doc,a.pos,2))return!1;if(s){const{selection:g,storedMarks:k}=r,{splittableMarks:v}=i.extensionManager,x=k||g.$to.parentOffset&&g.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!x||!s)return!0;const S=x.filter(b=>v.includes(b.type.name));n.ensureMarks(S)}return!0},Mu=(t,e)=>{const n=Rc(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&mr(t.doc,n.pos)&&t.join(n.pos),!0},Au=(t,e)=>{const n=Rc(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&mr(t.doc,r)&&t.join(r),!0};function mA(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return B.between(r,s)}var gA=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=Me(t,o.schema),p=Me(e,o.schema),{selection:m,storedMarks:y}=o,{$from:g,$to:k}=m,v=g.blockRange(k),x=y||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const S=Rc(W=>Tu(W.type.name,d))(m),b=m.from===0&&m.to===o.doc.content.size,C=o.doc.content.content,E=C.length===1?C[0]:null,N=b&&E&&Tu(E.type.name,d)?{node:E,pos:0}:null,P=S??N,j=!!S&&v.depth>=1&&v.depth-S.depth<=1,J=!!N;if((j||J)&&P){if(P.node.type===h)return b&&J?a().command(({tr:W,dispatch:X})=>{const K=mA(W);return K?(W.setSelection(K),X&&X(W),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(Tu(P.node.type.name,d)&&h.validContent(P.node.content))return a().command(()=>(i.setNodeMarkup(P.pos,h),!0)).command(()=>Mu(i,h)).command(()=>Au(i,h)).run()}return!n||!x||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Mu(i,h)).command(()=>Au(i,h)).run():a().command(()=>{const W=u().wrapInList(h,r),X=x.filter(K=>f.includes(K.type.name));return i.ensureMarks(X),W?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Mu(i,h)).command(()=>Au(i,h)).run()},yA=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=On(t,r.schema);return Yd(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},kA=(t,e,n={})=>({state:r,commands:s})=>{const i=Me(t,r.schema),o=Me(e,r.schema),l=dr(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...n})},vA=(t,e={})=>({state:n,commands:r})=>{const s=Me(t,n.schema);return dr(n,s,e)?r.lift(s):r.wrapIn(s,e)},wA=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},xA=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},SA=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=On(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!s)return!0;if(u&&o){let{from:f,to:h}=l;const p=(i=c.marks().find(y=>y.type===a))==null?void 0:i.attrs,m=Fh(c,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},CA=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},bA=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=Nc(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Me(t,r.schema)),l==="mark"&&(o=On(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,m;n.selection.empty?r.doc.nodesBetween(u,d,(y,g)=>{i&&i===y.type&&(a=!0,p=Math.max(g,u),m=Math.min(g+y.nodeSize,d),f=g,h=y)}):r.doc.nodesBetween(u,d,(y,g)=>{g<u&&i&&i===y.type&&(a=!0,p=Math.max(g,u),m=Math.min(g+y.nodeSize,d),f=g,h=y),g>=u&&g<=d&&(i&&i===y.type&&(a=!0,s&&n.setNodeMarkup(g,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(k=>{if(o===k.type&&(a=!0,s)){const v=Math.max(g,u),x=Math.min(g+y.nodeSize,d);n.addMark(v,x,o.create({...k.attrs,...e}))}}))}),h&&(f!==void 0&&s&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(y=>{o===y.type&&s&&n.addMark(p,m,o.create({...y.attrs,...e}))}))}),a},EA=(t,e={})=>({state:n,dispatch:r})=>{const s=Me(t,n.schema);return Gb(s,e)(n,r)},TA=(t,e={})=>({state:n,dispatch:r})=>{const s=Me(t,n.schema);return Qb(s,e)(n,r)},MA=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ic=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},AA=(t,e)=>{if(Bh(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function sl(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=t,{view:a}=n;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=ZM(c)+i;return o.forEach(f=>{if(u)return;const h=AA(d,f.find);if(!h)return;const p=a.state.tr,m=Mc({state:a.state,transaction:p}),y={from:r-(h[0].length-i.length),to:s},{commands:g,chain:k,can:v}=new Ac({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:g,chain:k,can:v})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:s,text:i}),a.dispatch(p),u=!0)}),u}function NA(t){const{editor:e,rules:n}=t,r=new de({state:{init(){return null},apply(s,i,o){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=Hh(M.from(u),o.schema);const{from:d}=a,f=d+u.length;sl({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return sl({editor:e,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&sl({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?sl({editor:e,from:o.pos,to:o.pos,text:`
|
|
60
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function RA(t){return Object.prototype.toString.call(t).slice(8,-1)}function il(t){return RA(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function zv(t,e){const n={...t};return il(t)&&il(e)&&Object.keys(e).forEach(r=>{il(e[r])&&il(t[r])?n[r]=zv(t[r],e[r]):n[r]=e[r]}),n}var Uh=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Z(z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Z(z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>zv(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},rs=class $v extends Uh{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new $v(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const a=o.find(c=>(c==null?void 0:c.type.name)===n.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 n=typeof e=="function"?e():e;return super.extend(n)}};function OA(t){return typeof t=="number"}var IA=class{constructor(t){this.find=t.find,this.handler=t.handler}},LA=(t,e,n)=>{if(Bh(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function PA(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Ac({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,s,(h,p)=>{var m,y,g,k,v;if((y=(m=h.type)==null?void 0:m.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(v=(k=(g=h.content)==null?void 0:g.size)!=null?k:h.nodeSize)!=null?v:0,S=Math.max(r,p),b=Math.min(s,p+x);if(S>=b)return;const C=h.isText?h.text||"":h.textBetween(S-p,b-p,void 0,"");LA(C,i.find,o).forEach(N=>{if(N.index===void 0)return;const P=S+N.index+1,j=P+N[0].length,J={from:n.tr.mapping.map(P),to:n.tr.mapping.map(j)},W=i.handler({state:n,range:J,match:N,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(W)})}),d.every(h=>h!==null)}var ol=null,DA=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function _A(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,y=Mc({state:u,transaction:m});if(!(!PA({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new de({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(ol=e)},h=()=>{ol&&(ol=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(i=r===d.dom.parentElement,l=f,!i){const h=ol;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 o=f,s=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!s,y=p.getMeta("uiEvent")==="drop"&&!i,g=p.getMeta("applyPasteRules"),k=!!g;if(!m&&!y&&!k)return;if(k){let{text:S}=g;typeof S=="string"?S=S:S=Hh(M.from(S),h.schema);const{from:b}=g,C=b+S.length,E=DA(S);return a({rule:u,state:h,from:b,to:{b:C},pasteEvt:E})}const v=f.doc.content.findDiffStart(h.doc.content),x=f.doc.content.findDiffEnd(h.doc.content);if(!(!OA(v)||!x||v===x.b))return a({rule:u,state:h,from:v,to:x,pasteEvt:o})}}))}var Lc=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Vh(t),this.schema=Nv(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:di(e.name,this.schema)},r=z(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Ps([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:di(r.name,this.schema)},i=[],o=z(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&z(r,"exitable",s)&&(l.ArrowRight=()=>rs.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=KT(l);i.push(a);const c=z(r,"addInputRules",s);if(Pg(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=NA({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=z(r,"addPasteRules",s);if(Pg(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=_A({editor:t,rules:f});i.push(...h)}}const d=z(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i})}get attributes(){return Av(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=qs(this.extensions);return Object.fromEntries(e.filter(n=>!!z(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Me(n.name,this.schema)},i=z(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(a,c,u,d,f)=>{const h=xo(a,r);return o({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return Ps([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:di(s.name,this.schema)},o=z(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Ps([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:di(s.name,this.schema)},o=z(s,"transformPastedHTML",i);return o?(l,a)=>{const c=r(l,a);return o.call(i,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=qs(this.extensions);return Object.fromEntries(e.filter(n=>!!z(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:On(n.name,this.schema)},i=z(n,"addMarkView",s);if(!i)return[];const o=(l,a,c)=>{const u=xo(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{XA(l,t,d)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:di(e.name,this.schema)};e.type==="mark"&&((n=Z(z(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=z(e,"onBeforeCreate",r),i=z(e,"onCreate",r),o=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),i&&this.editor.on("create",i),o&&this.editor.on("update",o),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)})}};Lc.resolve=Vh;Lc.sort=Ps;Lc.flatten=Oc;var zA={};jh(zA,{ClipboardTextSerializer:()=>Bv,Commands:()=>Fv,Delete:()=>Hv,Drop:()=>Vv,Editable:()=>Wv,FocusEvents:()=>Kv,Keymap:()=>qv,Paste:()=>Jv,Tabindex:()=>Gv,TextDirection:()=>Qv,focusEventsPluginKey:()=>Uv});var ye=class jv extends Uh{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new jv(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Bv=ye.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new de({key:new Se("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=Ov(n);return Rv(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Fv=ye.create({name:"commands",addCommands(){return{...$t}}}),Hv=ye.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Ev(t.before,[t,...e]);Lv(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,m)=>{const y=m+p.nodeSize-2,g=h.oldRange.from<=m&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:y,newFrom:u.mapping.map(m),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!g,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,y;if(h instanceof Ut){const g=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),v=f.invert().map(g,-1),x=f.invert().map(k),S=g>0?(m=u.doc.nodeAt(g-1))==null?void 0:m.marks.some(C=>C.eq(h.mark)):!1,b=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(C=>C.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:v,to:x},newRange:{from:g,to:k},partial:!!(b||S),editor:this.editor,transaction:t,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),Vv=ye.create({name:"drop",addProseMirrorPlugins(){return[new de({key:new Se("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Wv=ye.create({name:"editable",addProseMirrorPlugins(){return[new de({key:new Se("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Uv=new Se("focusEvents"),Kv=ye.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new de({key:Uv,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),qv=ye.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,g=m&&p.parent.childCount===1?y===d.pos:H.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"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 Ca()||Cv()?i:s},addProseMirrorPlugins(){return[new de({key:new Se("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),s=t.some(m=>m.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,a=H.atStart(e.doc).from,c=H.atEnd(e.doc).to;if(i||!(o===a&&l===c)||!So(n.doc))return;const f=n.tr,h=Mc({state:n,transaction:f}),{commands:p}=new Ac({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Jv=ye.create({name:"paste",addProseMirrorPlugins(){return[new de({key:new Se("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Gv=ye.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new de({key:new Se("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),Qv=ye.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=qs(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new de({key:new Se("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),$A=class Ti{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,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 n=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}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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),n=this.resolvedPos.doc.resolve(e);return new Ti(n,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 Ti(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 Ti(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!s&&!o&&a.depth<=this.depth)return;const c=new Ti(a,this.editor,s,s||o?n:null);s&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(i[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(a=>n[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},jA=`.ProseMirror {
|
|
61
|
+
position: relative;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ProseMirror {
|
|
65
|
+
word-wrap: break-word;
|
|
66
|
+
white-space: pre-wrap;
|
|
67
|
+
white-space: break-spaces;
|
|
68
|
+
-webkit-font-variant-ligatures: none;
|
|
69
|
+
font-variant-ligatures: none;
|
|
70
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror [contenteditable="false"] {
|
|
74
|
+
white-space: normal;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
78
|
+
white-space: pre-wrap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ProseMirror pre {
|
|
82
|
+
white-space: pre-wrap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
img.ProseMirror-separator {
|
|
86
|
+
display: inline !important;
|
|
87
|
+
border: none !important;
|
|
88
|
+
margin: 0 !important;
|
|
89
|
+
width: 0 !important;
|
|
90
|
+
height: 0 !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ProseMirror-gapcursor {
|
|
94
|
+
display: none;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
position: absolute;
|
|
97
|
+
margin: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ProseMirror-gapcursor:after {
|
|
101
|
+
content: "";
|
|
102
|
+
display: block;
|
|
103
|
+
position: absolute;
|
|
104
|
+
top: -2px;
|
|
105
|
+
width: 20px;
|
|
106
|
+
border-top: 1px solid black;
|
|
107
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@keyframes ProseMirror-cursor-blink {
|
|
111
|
+
to {
|
|
112
|
+
visibility: hidden;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ProseMirror-hideselection *::selection {
|
|
117
|
+
background: transparent;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
121
|
+
background: transparent;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.ProseMirror-hideselection * {
|
|
125
|
+
caret-color: transparent;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
129
|
+
display: block;
|
|
130
|
+
}`;function BA(t,e,n){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=t,document.getElementsByTagName("head")[0].appendChild(s),s}var FA=class extends MA{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!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,textDirection:void 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,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:rA,createMappablePosition:sA},this.setOptions(t),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:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=xv(e,this.options.autofocus);this.editorState=Es.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){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(t),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 t=this.editorView.dom;t!=null&&t.editor&&delete t.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(t){console.warn("Failed to remove CSS element:",t)}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=BA(jA,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,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(t,e){const n=Mv(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[Wv,Bv.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Fv,Kv,qv,Gv.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),Vv,Jv,Hv,Qv.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Lc(i,this)}createCommandManager(){this.commandManager=new Ac({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Xd(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(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Xd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new kv(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o==null?void 0:o.getMeta("focus"),a=o==null?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Iv(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return eA(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Hh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
131
|
+
|
|
132
|
+
`,textSerializers:n={}}=t||{};return JM(this.state.doc,{blockSeparator:e,textSerializers:{...Ov(this.schema),...n}})}get isEmpty(){return So(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new $A(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Js(t){return new Ic({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Z(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=n.from+l.indexOf(o),u=c+o.length;if(Wh(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+o.length;i.addMark(n.from+a,f,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function HA(t){return new Ic({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Z(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let l=n.to;const a=t.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?o:o-1;i.insert(c,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Zd(t){return new Ic({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=Z(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Gs(t){return new Ic({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=Z(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),c=a&&Sh(a,t.type,i);if(!c)return null;if(o.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(y=>h.includes(y.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&mr(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}function VA(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof F){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function _g(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function WA(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var UA={};jh(UA,{createAtomBlockMarkdownSpec:()=>KA,createBlockMarkdownSpec:()=>qA,createInlineMarkdownSpec:()=>QA,parseAttributes:()=>Kh,parseIndentedBlocks:()=>ef,renderNestedMarkdownContent:()=>Jh,serializeAttributes:()=>qh});function Kh(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.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 i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[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 qh(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function KA(t){const{nodeName:e,name:n,parseAttributes:r=Kh,serializeAttributes:s=qh,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=t,a=n||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={...i,...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 m=p[1]||"",y=r(m);if(!o.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 qA(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Kh,serializeAttributes:i=qh,defaultAttributes:o={},content:l="block",allowedAttributes:a}=t,c=n||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 m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...o,...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 m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(m);if(!y)return;const[g,k=""]=y,v=s(k);let x=1;const S=g.length;let b="";const C=/^:::([\w-]*)(\s.*)?/gm,E=d.slice(S);for(C.lastIndex=0;;){const N=C.exec(E);if(N===null)break;const P=N.index,j=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(j)x+=1;else if(x-=1,x===0){const J=E.slice(0,P);b=J.trim();const W=d.slice(0,S+P+N[0].length);let X=[];if(b)if(l==="block")for(X=h.blockTokens(J),X.forEach(K=>{K.text&&(!K.tokens||K.tokens.length===0)&&(K.tokens=h.inlineTokens(K.text))});X.length>0;){const K=X[X.length-1];if(K.type==="paragraph"&&(!K.text||K.text.trim()===""))X.pop();else break}else X=h.inlineTokens(b);return{type:e,raw:W,attributes:v,content:b,tokens:X}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",y=f.renderChildren(d.content||[],`
|
|
133
|
+
|
|
134
|
+
`);return`:::${c}${m}
|
|
135
|
+
|
|
136
|
+
${y}
|
|
137
|
+
|
|
138
|
+
:::`}}}function JA(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function GA(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function QA(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=JA,serializeAttributes:i=GA,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=f=>{if(!a)return f;const h={};return a.forEach(p=>{const m=typeof p=="string"?p:p.name,y=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){const g=f[m];if(y!==void 0&&g===y)return;h[m]=g}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...o,...f.attributes};if(l)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):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),m=p==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=f.match(m);if(!y)return;let g="",k="";if(l){const[,x]=y;k=x}else{const[,x,S]=y;k=x,g=S||""}const v=s(k.trim());return{type:e,raw:y[0],content:g.trim(),attributes:v}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(g=>g.type==="text").map(g=>g.text).join(""));const p=u(f.attrs||{}),m=i(p),y=m?` ${m}`:"";return l?`[${c}${y}]`:`[${c}${y}]${h}[/${c}]`}}}function ef(t,e,n){var r,s,i,o;const l=t.split(`
|
|
139
|
+
`),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,c=`${c}${f}
|
|
140
|
+
`;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:y}=p;c=`${c}${f}
|
|
141
|
+
`;const g=[y];for(u+=1;u<l.length;){const S=l[u];if(S.trim()===""){const C=l.slice(u+1).findIndex(P=>P.trim()!=="");if(C===-1)break;if((((s=(r=l[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>m){g.push(S),c=`${c}${S}
|
|
142
|
+
`,u+=1;continue}else break}if((((o=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>m)g.push(S),c=`${c}${S}
|
|
143
|
+
`,u+=1;else break}let k;const v=g.slice(1);if(v.length>0){const S=v.map(b=>b.slice(m+d)).join(`
|
|
144
|
+
`);S.trim()&&(e.customNestedParser?k=e.customNestedParser(S):k=n.blockTokens(S))}const x=e.createToken(p,k);a.push(x)}if(a.length!==0)return{items:a,raw:c}}function Jh(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]);let a=`${s}${l}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,f;const h=(f=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?f:e.renderChildren([c]);if(h!=null){const p=h.split(`
|
|
145
|
+
`).map(m=>m?e.indent(m):e.indent("")).join(`
|
|
146
|
+
`);a+=c.type==="paragraph"?`
|
|
147
|
+
|
|
148
|
+
${p}`:`
|
|
149
|
+
${p}`}}),a}function XA(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var _e=class Xv extends Uh{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Xv(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Qr(t){return new IA({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=Z(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(Wh(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+l.length,o.addMark(n.from+u,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:YA,getOwnPropertySymbols:ZA}=Object,{hasOwnProperty:eN}=Object.prototype;function Nu(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function ll(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const a=t(n,r,s);return i.delete(n),i.delete(r),a}}function tN(t){return t!=null?t[Symbol.toStringTag]:void 0}function zg(t){return YA(t).concat(ZA(t))}const nN=Object.hasOwn||((t,e)=>eN.call(t,e));function ss(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const rN="__v",sN="__o",iN="_owner",{getOwnPropertyDescriptor:$g,keys:jg}=Object;function oN(t,e){return t.byteLength===e.byteLength&&ba(new Uint8Array(t),new Uint8Array(e))}function lN(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function aN(t,e){return t.byteLength===e.byteLength&&ba(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function cN(t,e){return ss(t.getTime(),e.getTime())}function uN(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function dN(t,e){return t===e}function Bg(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,l,a=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(s[d]){d++;continue}const f=o.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1;a++}return!0}const fN=ss;function hN(t,e,n){const r=jg(t);let s=r.length;if(jg(e).length!==s)return!1;for(;s-- >0;)if(!Yv(t,e,n,r[s]))return!1;return!0}function fi(t,e,n){const r=zg(t);let s=r.length;if(zg(e).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!Yv(t,e,n,i)||(o=$g(t,i),l=$g(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function pN(t,e){return ss(t.valueOf(),e.valueOf())}function mN(t,e){return t.source===e.source&&t.flags===e.flags}function Fg(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,l;for(;(o=i.next())&&!o.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!s[u]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function ba(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function gN(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Yv(t,e,n,r){return(r===iN||r===sN||r===rN)&&(t.$$typeof||e.$$typeof)?!0:nN(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const yN="[object ArrayBuffer]",kN="[object Arguments]",vN="[object Boolean]",wN="[object DataView]",xN="[object Date]",SN="[object Error]",CN="[object Map]",bN="[object Number]",EN="[object Object]",TN="[object RegExp]",MN="[object Set]",AN="[object String]",NN={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},RN="[object URL]",ON=Object.prototype.toString;function IN({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(y,g,k){if(y===g)return!0;if(y==null||g==null)return!1;const v=typeof y;if(v!==typeof g)return!1;if(v!=="object")return v==="number"?l(y,g,k):v==="function"?i(y,g,k):!1;const x=y.constructor;if(x!==g.constructor)return!1;if(x===Object)return a(y,g,k);if(Array.isArray(y))return e(y,g,k);if(x===Date)return r(y,g,k);if(x===RegExp)return u(y,g,k);if(x===Map)return o(y,g,k);if(x===Set)return d(y,g,k);const S=ON.call(y);if(S===xN)return r(y,g,k);if(S===TN)return u(y,g,k);if(S===CN)return o(y,g,k);if(S===MN)return d(y,g,k);if(S===EN)return typeof y.then!="function"&&typeof g.then!="function"&&a(y,g,k);if(S===RN)return h(y,g,k);if(S===SN)return s(y,g,k);if(S===kN)return a(y,g,k);if(NN[S])return f(y,g,k);if(S===yN)return t(y,g,k);if(S===wN)return n(y,g,k);if(S===vN||S===bN||S===AN)return c(y,g,k);if(p){let b=p[S];if(!b){const C=tN(y);C&&(b=p[C])}if(b)return b(y,g,k)}return!1}}function LN({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:oN,areArraysEqual:n?fi:lN,areDataViewsEqual:aN,areDatesEqual:cN,areErrorsEqual:uN,areFunctionsEqual:dN,areMapsEqual:n?Nu(Bg,fi):Bg,areNumbersEqual:fN,areObjectsEqual:n?fi:hN,arePrimitiveWrappersEqual:pN,areRegExpsEqual:mN,areSetsEqual:n?Nu(Fg,fi):Fg,areTypedArraysEqual:n?Nu(ba,fi):ba,areUrlsEqual:gN,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=ll(r.areArraysEqual),i=ll(r.areMapsEqual),o=ll(r.areObjectsEqual),l=ll(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function PN(t){return function(e,n,r,s,i,o,l){return t(e,n,l)}}function DN({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,i)}}const _N=yr();yr({strict:!0});yr({circular:!0});yr({circular:!0,strict:!0});yr({createInternalComparator:()=>ss});yr({strict:!0,createInternalComparator:()=>ss});yr({circular:!0,createInternalComparator:()=>ss});yr({circular:!0,createInternalComparator:()=>ss,strict:!0});function yr(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=LN(t),o=IN(i),l=n?n(o):PN(o);return DN({circular:e,comparator:o,createState:r,equals:l,strict:s})}var Zv={exports:{}},ew={};/**
|
|
150
|
+
* @license React
|
|
151
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
152
|
+
*
|
|
153
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the MIT license found in the
|
|
156
|
+
* LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/var Pc=T,zN=vh;function $N(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var jN=typeof Object.is=="function"?Object.is:$N,BN=zN.useSyncExternalStore,FN=Pc.useRef,HN=Pc.useEffect,VN=Pc.useMemo,WN=Pc.useDebugValue;ew.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=FN(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=VN(function(){function a(h){if(!c){if(c=!0,u=h,h=r(h),s!==void 0&&o.hasValue){var p=o.value;if(s(p,h))return d=p}return d=h}if(p=d,jN(u,h))return p;var m=r(h);return s!==void 0&&s(p,m)?(u=h,p):(u=h,d=m)}var c=!1,u,d,f=n===void 0?null:n;return[function(){return a(e())},f===null?void 0:function(){return a(f())}]},[e,n,r,s]);var l=BN(t,i[0],i[1]);return HN(function(){o.hasValue=!0,o.value=l},[l]),WN(l),l};Zv.exports=ew;var UN=Zv.exports,KN=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},qN=({contentComponent:t})=>{const e=vh.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return w.jsx(w.Fragment,{children:Object.values(e)})};function JN(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:IC.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var GN=class extends ln.Component{constructor(t){super(t),this.editorContentRef=ln.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=JN(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return w.jsxs(w.Fragment,{children:[w.jsx("div",{ref:KN(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&w.jsx(qN,{contentComponent:t.contentComponent})]})}},QN=T.forwardRef((t,e)=>{const n=ln.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ln.createElement(GN,{key:n,innerRef:e,...t})}),tw=ln.memo(QN),XN=typeof window<"u"?T.useLayoutEffect:T.useEffect,YN=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,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(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function nw(t){var e;const[n]=T.useState(()=>new YN(t.editor)),r=UN.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:_N);return XN(()=>n.watch(t.editor),[t.editor,n]),T.useDebugValue(r),r}var ZN=!1,rw=typeof window>"u",e2=rw||!!(typeof window<"u"&&window.next),t2=class sw{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(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return rw?(n&&ZN&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):e2&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new FA(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?sw.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,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function n2(t={},e=[]){const n=T.useRef(t);n.current=t;const[r]=T.useState(()=>new t2(n)),s=vh.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return T.useDebugValue(s),T.useEffect(r.onRender(e)),nw({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var iw=T.createContext({editor:null});iw.Consumer;var r2=T.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),s2=()=>T.useContext(r2);ln.forwardRef((t,e)=>{const{onDragStart:n}=s2(),r=t.as||"div";return w.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ln.createContext({markViewContentRef:()=>{}});var Gh=T.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Gh.displayName="TiptapContext";var i2=()=>T.useContext(Gh);function ow({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=T.useMemo(()=>({editor:r}),[r]),i=T.useMemo(()=>({editor:r}),[r]);return w.jsx(iw.Provider,{value:i,children:w.jsx(Gh.Provider,{value:s,children:n})})}ow.displayName="Tiptap";function lw({...t}){const{editor:e}=i2();return w.jsx(tw,{editor:e,...t})}lw.displayName="Tiptap.Content";Object.assign(ow,{Content:lw});var Ea=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},o2=/^\s*>\s$/,l2=_e.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Ea("blockquote",{...he(this.options.HTMLAttributes,t),children:Ea("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,l;const u=((l=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?l:e.renderChildren([s])).split(`
|
|
158
|
+
`).map(d=>d.trim()===""?n:`${n} ${d}`);r.push(u.join(`
|
|
159
|
+
`))}),r.join(`
|
|
160
|
+
${n}
|
|
161
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Gs({find:o2,type:this.type})]}}),a2=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,c2=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,u2=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,d2=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,f2=rs.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Ea("strong",{...he(this.options.HTMLAttributes,t),children:Ea("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Js({find:a2,type:this.type}),Js({find:u2,type:this.type})]},addPasteRules(){return[Qr({find:c2,type:this.type}),Qr({find:d2,type:this.type})]}}),h2=/(^|[^`])`([^`]+)`(?!`)$/,p2=/(^|[^`])`([^`]+)`(?!`)/g,m2=rs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",he(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Js({find:h2,type:this.type})]},addPasteRules(){return[Qr({find:p2,type:this.type})]}}),Ru=4,g2=/^```([a-z]+)?[\s\n]$/,y2=/^~~~([a-z]+)?[\s\n]$/,k2=_e.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ru,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",he(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
|
|
162
|
+
`):r=`\`\`\`${s}
|
|
163
|
+
|
|
164
|
+
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Ru,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=s,h=r.doc.textBetween(c,u,`
|
|
165
|
+
`,`
|
|
166
|
+
`).split(`
|
|
167
|
+
`).map(p=>l+p).join(`
|
|
168
|
+
`);return a.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Ru,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:c}=i,u=i.start(),d=i.end(),h=r.doc.textBetween(u,d,`
|
|
169
|
+
`,`
|
|
170
|
+
`).split(`
|
|
171
|
+
`);let p=0,m=0;const y=c-u;for(let b=0;b<h.length;b+=1){if(m+h[b].length>=y){p=b;break}m+=h[b].length+1}const k=((a=h[p].match(/^ */))==null?void 0:a[0])||"",v=Math.min(k.length,n);if(v===0)return!0;let x=u;for(let b=0;b<p;b+=1)x+=h[b].length+1;return l.delete(x,x+v),c-x<=v&&l.setSelection(B.create(l.doc,x)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=s,f=r.doc.textBetween(a,c,`
|
|
172
|
+
`,`
|
|
173
|
+
`).split(`
|
|
174
|
+
`).map(h=>{var p;const m=((p=h.match(/^ */))==null?void 0:p[0])||"",y=Math.min(m.length,n);return h.slice(y)}).join(`
|
|
175
|
+
`);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
176
|
+
|
|
177
|
+
`);return!i||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||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)?t.commands.command(({tr:c})=>(c.setSelection(H.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Zd({find:g2,type:this.type,getAttributes:t=>({language:t[1]})}),Zd({find:y2,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new de({key:new Se("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
|
178
|
+
`));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(B.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),v2=_e.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
179
|
+
|
|
180
|
+
`):""}),w2=_e.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",he(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
181
|
+
`},renderMarkdown:()=>`
|
|
182
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){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()}}}),x2=_e.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,he(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Zd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),S2=_e.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",he(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!VA(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return Pv(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(B.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(F.create(o.doc,a.pos)):o.setSelection(B.create(o.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(B.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[HA({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),C2=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,b2=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,E2=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,T2=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,M2=rs.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",he(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Js({find:C2,type:this.type}),Js({find:E2,type:this.type})]},addPasteRules(){return[Qr({find:b2,type:this.type}),Qr({find:T2,type:this.type})]}});const A2="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",N2="ελ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",tf="numeric",nf="ascii",rf="alpha",Vi="asciinumeric",Mi="alphanumeric",sf="domain",aw="emoji",R2="scheme",O2="slashscheme",Ou="whitespace";function I2(t,e){return t in e||(e[t]=[]),e[t]}function Ir(t,e,n){e[tf]&&(e[Vi]=!0,e[Mi]=!0),e[nf]&&(e[Vi]=!0,e[rf]=!0),e[Vi]&&(e[Mi]=!0),e[rf]&&(e[Mi]=!0),e[Mi]&&(e[sf]=!0),e[aw]&&(e[sf]=!0);for(const r in e){const s=I2(r,n);s.indexOf(t)<0&&s.push(t)}}function L2(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function lt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}lt.groups={};lt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||lt.groups;let s;return e&&e.j?s=e:(s=new lt(e),n&&r&&Ir(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||lt.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,l=s.go(t);if(l?(o=new lt,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new lt,i){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(L2(o.t,r),n);Ir(i,a,r)}else n&&Ir(i,n,r);o.t=i}return s.j[t]=o,o}};const q=(t,e,n,r,s)=>t.ta(e,n,r,s),ke=(t,e,n,r,s)=>t.tr(e,n,r,s),Hg=(t,e,n,r,s)=>t.ts(e,n,r,s),O=(t,e,n,r,s)=>t.tt(e,n,r,s),pn="WORD",of="UWORD",cw="ASCIINUMERICAL",uw="ALPHANUMERICAL",Co="LOCALHOST",lf="TLD",af="UTLD",_l="SCHEME",fs="SLASH_SCHEME",Qh="NUM",cf="WS",Xh="NL",Wi="OPENBRACE",Ui="CLOSEBRACE",Ta="OPENBRACKET",Ma="CLOSEBRACKET",Aa="OPENPAREN",Na="CLOSEPAREN",Ra="OPENANGLEBRACKET",Oa="CLOSEANGLEBRACKET",Ia="FULLWIDTHLEFTPAREN",La="FULLWIDTHRIGHTPAREN",Pa="LEFTCORNERBRACKET",Da="RIGHTCORNERBRACKET",_a="LEFTWHITECORNERBRACKET",za="RIGHTWHITECORNERBRACKET",$a="FULLWIDTHLESSTHAN",ja="FULLWIDTHGREATERTHAN",Ba="AMPERSAND",Fa="APOSTROPHE",Ha="ASTERISK",jn="AT",Va="BACKSLASH",Wa="BACKTICK",Ua="CARET",Lr="COLON",Yh="COMMA",Ka="DOLLAR",en="DOT",qa="EQUALS",Zh="EXCLAMATION",Tt="HYPHEN",Ki="PERCENT",Ja="PIPE",Ga="PLUS",Qa="POUND",qi="QUERY",ep="QUOTE",dw="FULLWIDTHMIDDLEDOT",tp="SEMI",tn="SLASH",Ji="TILDE",Xa="UNDERSCORE",fw="EMOJI",Ya="SYM";var hw=Object.freeze({__proto__:null,ALPHANUMERICAL:uw,AMPERSAND:Ba,APOSTROPHE:Fa,ASCIINUMERICAL:cw,ASTERISK:Ha,AT:jn,BACKSLASH:Va,BACKTICK:Wa,CARET:Ua,CLOSEANGLEBRACKET:Oa,CLOSEBRACE:Ui,CLOSEBRACKET:Ma,CLOSEPAREN:Na,COLON:Lr,COMMA:Yh,DOLLAR:Ka,DOT:en,EMOJI:fw,EQUALS:qa,EXCLAMATION:Zh,FULLWIDTHGREATERTHAN:ja,FULLWIDTHLEFTPAREN:Ia,FULLWIDTHLESSTHAN:$a,FULLWIDTHMIDDLEDOT:dw,FULLWIDTHRIGHTPAREN:La,HYPHEN:Tt,LEFTCORNERBRACKET:Pa,LEFTWHITECORNERBRACKET:_a,LOCALHOST:Co,NL:Xh,NUM:Qh,OPENANGLEBRACKET:Ra,OPENBRACE:Wi,OPENBRACKET:Ta,OPENPAREN:Aa,PERCENT:Ki,PIPE:Ja,PLUS:Ga,POUND:Qa,QUERY:qi,QUOTE:ep,RIGHTCORNERBRACKET:Da,RIGHTWHITECORNERBRACKET:za,SCHEME:_l,SEMI:tp,SLASH:tn,SLASH_SCHEME:fs,SYM:Ya,TILDE:Ji,TLD:lf,UNDERSCORE:Xa,UTLD:af,UWORD:of,WORD:pn,WS:cf});const fn=/[a-z]/,hi=new RegExp("\\p{L}","u"),Iu=new RegExp("\\p{Emoji}","u"),hn=/\d/,Lu=/\s/,Vg="\r",Pu=`
|
|
183
|
+
`,P2="️",D2="",Du="";let al=null,cl=null;function _2(t=[]){const e={};lt.groups=e;const n=new lt;al==null&&(al=Wg(A2)),cl==null&&(cl=Wg(N2)),O(n,"'",Fa),O(n,"{",Wi),O(n,"}",Ui),O(n,"[",Ta),O(n,"]",Ma),O(n,"(",Aa),O(n,")",Na),O(n,"<",Ra),O(n,">",Oa),O(n,"(",Ia),O(n,")",La),O(n,"「",Pa),O(n,"」",Da),O(n,"『",_a),O(n,"』",za),O(n,"<",$a),O(n,">",ja),O(n,"&",Ba),O(n,"*",Ha),O(n,"@",jn),O(n,"`",Wa),O(n,"^",Ua),O(n,":",Lr),O(n,",",Yh),O(n,"$",Ka),O(n,".",en),O(n,"=",qa),O(n,"!",Zh),O(n,"-",Tt),O(n,"%",Ki),O(n,"|",Ja),O(n,"+",Ga),O(n,"#",Qa),O(n,"?",qi),O(n,'"',ep),O(n,"/",tn),O(n,";",tp),O(n,"~",Ji),O(n,"_",Xa),O(n,"\\",Va),O(n,"・",dw);const r=ke(n,hn,Qh,{[tf]:!0});ke(r,hn,r);const s=ke(r,fn,cw,{[Vi]:!0}),i=ke(r,hi,uw,{[Mi]:!0}),o=ke(n,fn,pn,{[nf]:!0});ke(o,hn,s),ke(o,fn,o),ke(s,hn,s),ke(s,fn,s);const l=ke(n,hi,of,{[rf]:!0});ke(l,fn),ke(l,hn,i),ke(l,hi,l),ke(i,hn,i),ke(i,fn),ke(i,hi,i);const a=O(n,Pu,Xh,{[Ou]:!0}),c=O(n,Vg,cf,{[Ou]:!0}),u=ke(n,Lu,cf,{[Ou]:!0});O(n,Du,u),O(c,Pu,a),O(c,Du,u),ke(c,Lu,u),O(u,Vg),O(u,Pu),ke(u,Lu,u),O(u,Du,u);const d=ke(n,Iu,fw,{[aw]:!0});O(d,"#"),ke(d,Iu,d),O(d,P2,d);const f=O(d,D2);O(f,"#"),ke(f,Iu,d);const h=[[fn,o],[hn,s]],p=[[fn,null],[hi,l],[hn,i]];for(let m=0;m<al.length;m++)Pn(n,al[m],lf,pn,h);for(let m=0;m<cl.length;m++)Pn(n,cl[m],af,of,p);Ir(lf,{tld:!0,ascii:!0},e),Ir(af,{utld:!0,alpha:!0},e),Pn(n,"file",_l,pn,h),Pn(n,"mailto",_l,pn,h),Pn(n,"http",fs,pn,h),Pn(n,"https",fs,pn,h),Pn(n,"ftp",fs,pn,h),Pn(n,"ftps",fs,pn,h),Ir(_l,{scheme:!0,ascii:!0},e),Ir(fs,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){const y=t[m][0],k=t[m][1]?{[R2]:!0}:{[O2]:!0};y.indexOf("-")>=0?k[sf]=!0:fn.test(y)?hn.test(y)?k[Vi]=!0:k[nf]=!0:k[tf]=!0,Hg(n,y,y,k)}return Hg(n,"localhost",Co,{ascii:!0}),n.jd=new lt(Ya),{start:n,tokens:Object.assign({groups:e},hw)}}function pw(t,e){const n=z2(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[o].length,f++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=f,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function z2(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Pn(t,e,n,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new lt(r),i.jr=s.slice(),t.j[a]=i),t=i}return i=new lt(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function Wg(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const bo={defaultProtocol:"http",events:null,format:Ug,formatHref:Ug,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function np(t,e=null){let n=Object.assign({},bo);t&&(n=Object.assign(n,t instanceof np?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}np.prototype={o:bo,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:bo[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Ug(t){return t}function mw(t,e){this.t="token",this.v=t,this.tk=e}mw.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=bo.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function Dc(t,e){class n extends mw{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const $2=Dc("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Kg=Dc("text"),j2=Dc("nl"),ul=Dc("url",{isLink:!0,toHref(t=bo.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Co&&t[1].t===Lr}}),Et=t=>new lt(t);function B2({groups:t}){const e=t.domain.concat([Ba,Ha,jn,Va,Wa,Ua,Ka,qa,Tt,Qh,Ki,Ja,Ga,Qa,tn,Ya,Ji,Xa]),n=[Fa,Lr,Yh,en,Zh,Ki,qi,ep,tp,Ra,Oa,Wi,Ui,Ma,Ta,Aa,Na,Ia,La,Pa,Da,_a,za,$a,ja],r=[Ba,Fa,Ha,Va,Wa,Ua,Ka,qa,Tt,Wi,Ui,Ki,Ja,Ga,Qa,qi,tn,Ya,Ji,Xa],s=Et(),i=O(s,Ji);q(i,r,i),q(i,t.domain,i);const o=Et(),l=Et(),a=Et();q(s,t.domain,o),q(s,t.scheme,l),q(s,t.slashscheme,a),q(o,r,i),q(o,t.domain,o);const c=O(o,jn);O(i,jn,c),O(l,jn,c),O(a,jn,c);const u=O(i,en);q(u,r,i),q(u,t.domain,i);const d=Et();q(c,t.domain,d),q(d,t.domain,d);const f=O(d,en);q(f,t.domain,d);const h=Et($2);q(f,t.tld,h),q(f,t.utld,h),O(c,Co,h);const p=O(d,Tt);O(p,Tt,p),q(p,t.domain,d),q(h,t.domain,d),O(h,en,f),O(h,Tt,p);const m=O(o,Tt),y=O(o,en);O(m,Tt,m),q(m,t.domain,o),q(y,r,i),q(y,t.domain,o);const g=Et(ul);q(y,t.tld,g),q(y,t.utld,g),q(g,t.domain,o),q(g,r,i),O(g,en,y),O(g,Tt,m),O(g,jn,c);const k=O(g,Lr),v=Et(ul);q(k,t.numeric,v);const x=Et(ul),S=Et();q(x,e,x),q(x,n,S),q(S,e,x),q(S,n,S),O(g,tn,x),O(v,tn,x);const b=O(l,Lr),C=O(a,Lr),E=O(C,tn),N=O(E,tn);q(l,t.domain,o),O(l,en,y),O(l,Tt,m),q(a,t.domain,o),O(a,en,y),O(a,Tt,m),q(b,t.domain,x),O(b,tn,x),O(b,qi,x),q(N,t.domain,x),q(N,e,x),O(N,tn,x);const P=[[Wi,Ui],[Ta,Ma],[Aa,Na],[Ra,Oa],[Ia,La],[Pa,Da],[_a,za],[$a,ja]];for(let j=0;j<P.length;j++){const[J,W]=P[j],X=O(x,J);O(S,J,X);const K=Et(ul);q(X,e,K);const D=Et();q(X,n,D),O(X,W,x),q(K,e,K),q(K,n,D),q(D,e,K),q(D,n,D),O(K,W,x),O(D,W,x)}return O(s,Co,g),O(s,Xh,j2),{start:s,tokens:hw}}function F2(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(a=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=a||l.go(n[s].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(_u(Kg,e,o)),o=[]),s-=f,u-=f;const h=d.t,p=n.slice(s-u,s);i.push(_u(h,e,p))}}return o.length>0&&i.push(_u(Kg,e,o)),i}function _u(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const H2=typeof console<"u"&&console&&console.warn||(()=>{}),V2="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ce={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function W2(){return lt.groups={},ce.scanner=null,ce.parser=null,ce.tokenQueue=[],ce.pluginQueue=[],ce.customSchemes=[],ce.initialized=!1,ce}function qg(t,e=!1){if(ce.initialized&&H2(`linkifyjs: already initialized - will not register custom scheme "${t}" ${V2}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
184
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
185
|
+
2. Cannot start or end with "-"
|
|
186
|
+
3. "-" cannot repeat`);ce.customSchemes.push([t,e])}function U2(){ce.scanner=_2(ce.customSchemes);for(let t=0;t<ce.tokenQueue.length;t++)ce.tokenQueue[t][1]({scanner:ce.scanner});ce.parser=B2(ce.scanner.tokens);for(let t=0;t<ce.pluginQueue.length;t++)ce.pluginQueue[t][1]({scanner:ce.scanner,parser:ce.parser});return ce.initialized=!0,ce}function rp(t){return ce.initialized||U2(),F2(ce.parser.start,t,pw(ce.scanner.start,t))}rp.scan=pw;function gw(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new np(n),s=rp(t),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var sp="[\0- -\u2029 ]",K2=new RegExp(sp),q2=new RegExp(`${sp}$`),J2=new RegExp(sp,"g");function G2(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Q2(t){return new de({key:new Se("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=Ev(n.doc,[...e]);if(Lv(l).forEach(({newRange:c})=>{const u=FM(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(!q2.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(K2).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const y=rp(p).map(g=>g.toObject(t.defaultProtocol));if(!G2(y))return!1;y.filter(g=>g.isLink).map(g=>({...g,from:m+g.start+1,to:m+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{Wh(g.from,g.to,r.doc).some(k=>k.mark.type===t.type)||o.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function X2(t){return new de({key:new Se("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const a=Iv(e.state,t.type.name),c=(s=o.href)!=null?s:a.href,u=(i=o.target)!=null?i:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function Y2(t){return new de({key:new Se("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=gw(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||s!==void 0&&!s(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function wr(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(J2,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Z2=rs.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(t=>{if(typeof t=="string"){qg(t);return}qg(t.scheme,t.optionalSlashes)})},onDestroy(){W2()},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:(t,e)=>!!wr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!wr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!wr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",he(this.options.HTMLAttributes,t),0]:["a",he(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",a=e.renderChildren(t);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!wr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Qr({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=gw(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!wr(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Q2({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!wr(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(X2({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Y2({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),eR=Object.defineProperty,tR=(t,e)=>{for(var n in e)eR(t,n,{get:e[n],enumerable:!0})},nR="listItem",Jg="textStyle",Gg=/^\s*([-+*])\s$/,yw=_e.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:t}){return["ul",he(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
187
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nR,this.editor.getAttributes(Jg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Gs({find:Gg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Gs({find:Gg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jg),editor:this.editor})),[t]}});function rR(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function sR(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var kw=_e.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",he(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(rR(t))return{type:"listItem",content:[{type:"paragraph",content:sR(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))s=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const a=t.tokens.slice(1),c=r(a);s.push(...c)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>Jh(t,e,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),iR={};tR(iR,{findListItemPos:()=>Do,getNextListDepth:()=>ip,handleBackspace:()=>uf,handleDelete:()=>df,hasListBefore:()=>vw,hasListItemAfter:()=>oR,hasListItemBefore:()=>ww,listItemHasSubList:()=>xw,nextListIsDeeper:()=>Sw,nextListIsHigher:()=>Cw});var Do=(t,e)=>{const{$from:n}=e.selection,r=Me(t,e.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},ip=(t,e)=>{const n=Do(t,e);if(!n)return!1;const[,r]=YM(e,t,n.$pos.pos+4);return r},vw=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},ww=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},xw=(t,e,n)=>{if(!n)return!1;const r=Me(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},uf=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!dr(t.state,e)&&vw(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.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=t.state.doc.resolve(a.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!dr(t.state,e)||!nA(t.state))return!1;const r=Do(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=xw(e,t.state,i);return ww(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Sw=(t,e)=>{const n=ip(t,e),r=Do(t,e);return!r||!n?!1:n>r.depth},Cw=(t,e)=>{const n=ip(t,e),r=Do(t,e);return!r||!n?!1:n<r.depth},df=(t,e)=>{if(!dr(t.state,e)||!tA(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:Sw(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Cw(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},oR=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},bw=ye.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&df(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&df(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&uf(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&uf(t,n,r)&&(e=!0)}),e}}}}),Qg=/^(\s*)(\d+)\.\s+(.*)$/,lR=/^\s/;function aR(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function cR(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&aR(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function uR(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(Qg);if(!i)break;const[,o,l,a]=i,c=o.length,u=[a];let d=n+1;const f=[s];let h=!1;for(;d<t.length;){const p=t[d];if(p.match(Qg))break;if(p.trim()==="")f.push(p),u.push(""),h=!0,d+=1;else if(p.match(lR))f.push(p),u.push(p.slice(c+2)),d+=1;else{if(h)break;f.push(p),u.push(p),d+=1}}e.push({indent:c,number:parseInt(l,10),content:u.join(`
|
|
188
|
+
`).trim(),contentLines:u,raw:f.join(`
|
|
189
|
+
`)}),r=d,n=d}return[e,r]}function Ew(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:l}=cR(i.contentLines),a=o.join(`
|
|
190
|
+
`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.join(`
|
|
191
|
+
`).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=s+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(m=>m.indent)),p=Ew(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
|
|
192
|
+
`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return r}function dR(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.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 i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var fR="listItem",Xg="textStyle",Yg=/^(\d+)\.\s$/,Tw=_e.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",he(this.options.HTMLAttributes,n),0]:["ol",he(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?dR(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
193
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
|
|
194
|
+
`),[i,o]=uR(s);if(i.length===0)return;const l=Ew(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,o).join(`
|
|
195
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fR,this.editor.getAttributes(Xg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Gs({find:Yg,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Gs({find:Yg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Xg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),hR=/^\s*(\[([( |x])?\])\s$/,pR=_e.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",he(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Jh(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=xo(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return u.forEach(y=>{p.has(y)||(y in m?s.setAttribute(y,m[y]):s.removeAttribute(y))}),Object.entries(h).forEach(([y,g])=>{g==null?y in m?s.setAttribute(y,m[y]):s.removeAttribute(y):s.setAttribute(y,g)}),u=p,!0}}}},addInputRules(){return[Gs({find:hR,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),mR=_e.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:t}){return["ul",he(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
196
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=ef(i,{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:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=ef(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ye.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(yw.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(kw.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(bw.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Tw.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(pR.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(mR.configure(this.options.taskList)),t}});var dl=" ",zu=" ",gR=_e.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",he(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===dl||n[0].text===dl||n[0].raw===zu||n[0].text===zu)&&r.length===1&&r[0].type==="text"&&(r[0].text===dl||r[0].text===zu)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?dl:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,kR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vR=rs.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",he(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Js({find:yR,type:this.type})]},addPasteRules(){return[Qr({find:kR,type:this.type})]}}),wR=_e.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),xR=rs.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",he(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function SR(t={}){return new de({view(e){return new CR(e,t)}})}class CR{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){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(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);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)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"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 n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=yk(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),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 H{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return we.valid(r)?new we(r):H.near(r)}content(){return L.empty}eq(e){return e instanceof we&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new we(e.resolve(n.pos))}getBookmark(){return new op(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!bR(e)||!ER(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&we.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(we.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!F.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(we.valid(l))return l}return null}}}we.prototype.visible=!1;we.findFrom=we.findGapCursorFrom;H.jsonID("gapcursor",we);class op{constructor(e){this.pos=e}map(e){return new op(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return we.valid(n)?new we(n):H.near(n)}}function Mw(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function bR(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Mw(s.type))return!0;if(s.inlineContent)return!1}}return!0}function ER(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Mw(s.type))return!0;if(s.inlineContent)return!1}}return!0}function TR(){return new de({props:{decorations:RR,createSelectionBetween(t,e,n){return e.pos==n.pos&&we.valid(n)?new we(n):null},handleClick:AR,handleKeyDown:MR,handleDOMEvents:{beforeinput:NR}}})}const MR=$h({ArrowLeft:fl("horiz",-1),ArrowRight:fl("horiz",1),ArrowUp:fl("vert",-1),ArrowDown:fl("vert",1)});function fl(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof B){if(!i.endOfTextblock(n)||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 AR(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!we.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&F.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new we(r))),!0)}function NR(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof we))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=M.empty;for(let o=r.length-1;o>=0;o--)s=M.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new L(s,0,0));return i.setSelection(B.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function RR(t){if(!(t.selection instanceof we))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",se.create(t.doc,[Ie.widget(t.selection.head,e,{key:"gapcursor"})])}var Za=200,De=function(){};De.prototype.append=function(e){return e.length?(e=De.from(e),!this.length&&e||e.length<Za&&this.leafAppend(e)||this.length<Za&&e.leafPrepend(this)||this.appendInner(e)):this};De.prototype.prepend=function(e){return e.length?De.from(e).append(this):this};De.prototype.appendInner=function(e){return new OR(this,e)};De.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?De.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};De.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};De.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};De.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};De.from=function(e){return e instanceof De?e:e&&e.length?new Aw(e):De.empty};var Aw=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Za)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Za)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(De);De.empty=new Aw([]);var OR=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.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,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},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}(De);const IR=500;class Wt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new nn(d.map));let h=d.step.map(s.slice(i)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new nn(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new Wt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=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 nn(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(o++,n=void 0),s||(a=f)}let c=o-r.depth;return c>PR&&(l=LR(l,c),o-=c),new Wt(l.append(i),o)}remapping(e,n){let r=new mo;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Wt(this.items.append(e.map(n=>new nn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(i.slice(a+1,h));y&&l++,r.push(new nn(p,m,y))}else r.push(new nn(p))},s);let c=[];for(let f=n;f<o;f++)c.push(new nn(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new Wt(u,l);return d.emptyItemCount()>IR&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new nn(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new Wt(De.from(s.reverse()),i)}}Wt.empty=new Wt(De.empty,0);function LR(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class nn{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new nn(n.getMap().invert(),n,this.selection)}}}class Bn{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const PR=20;function DR(t,e,n,r){let s=n.getMeta(Br),i;if(s)return s.historyState;n.getMeta($R)&&(t=new Bn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Br))return o.getMeta(Br).redo?new Bn(t.done.addTransform(n,void 0,r,zl(e)),t.undone,Zg(n.mapping.maps),t.prevTime,t.prevComposition):new Bn(t.done,t.undone.addTransform(n,void 0,r,zl(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!_R(n,t.prevRanges)),c=o?$u(t.prevRanges,n.mapping):Zg(n.mapping.maps);return new Bn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,zl(e)),Wt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Bn(t.done.rebased(n,i),t.undone.rebased(n,i),$u(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Bn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),$u(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function _R(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Zg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function $u(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function zR(t,e,n){let r=zl(e),s=Br.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new Bn(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(Br,{redo:n,historyState:a})}let ju=!1,e0=null;function zl(t){let e=t.plugins;if(e0!=e){ju=!1,e0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ju=!0;break}}return ju}const Br=new Se("history"),$R=new Se("closeHistory");function jR(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new de({key:Br,state:{init(){return new Bn(Wt.empty,Wt.empty,null,0,-1)},apply(e,n,r){return DR(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Rw:r=="historyRedo"?Ow:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Nw(t,e){return(n,r)=>{let s=Br.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=zR(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Rw=Nw(!1,!0),Ow=Nw(!0,!0);ye.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.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=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new de({key:new Se("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var BR=ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[SR(this.options)]}});ye.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new de({key:new Se("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return se.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),se.create(t,i)}}})]}});var FR=ye.create({name:"gapCursor",addProseMirrorPlugins(){return[TR()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Z(z(t,"allowGapCursor",n)))!=null?e:null}}});function t0(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return o&&u.push(c),Ie.node(s,s+i.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:l}):n})}function HR(t){const e=getComputedStyle(t),n=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(n)}function VR(t){let e=t;for(;e;){if(HR(e))return e;const n=e.parentElement;if(!n){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=n}return window}function WR(t){return t===window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect()}function UR({doc:t,view:e,scrollContainer:n}){const r=e.dom.getBoundingClientRect(),s=n?WR(n):{top:0,bottom:window.innerHeight},i=Math.max(r.top,s.top),o=Math.min(r.bottom,s.bottom);if(i>=o)return{top:0,bottom:t.content.size};const a=getComputedStyle(e.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,c=e.posAtCoords({left:a,top:i+2}),u=e.posAtCoords({left:a,top:o-2});return{top:c?c.pos:0,bottom:u?u.pos:t.content.size}}function KR(t,e){let n=null;return{call:(...i)=>{n||(t(...i),n=setTimeout(()=>{n=null},e))},cancel:()=>{n&&(clearTimeout(n),n=null)}}}var n0="placeholder";function qR(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var pi=new Se("tiptap__placeholder");ye.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:n0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${qR(this.options.dataAttribute)}`:`data-${n0}`;return[new de({state:{init(){return{topPos:null,bottomPos:null}},apply(e,n){const r=e.getMeta(pi);return r!=null&&r.positions?{topPos:r.positions.top,bottomPos:r.positions.bottom}:e.docChanged?{topPos:n.topPos!==null?e.mapping.map(n.topPos):null,bottomPos:n.bottomPos!==null?e.mapping.map(n.bottomPos):null}:n}},key:pi,view(e){const n=VR(e.dom),r=()=>{const l=UR({view:e,doc:e.state.doc,scrollContainer:n}),a=pi.getState(e.state);if(a.topPos===l.top&&a.bottomPos===l.bottom)return;const c=e.state.tr.setMeta(pi,{positions:l}).setMeta("tiptap__viewportUpdate",!0);e.dispatch(c)},{call:s,cancel:i}=KR(r,250),o=n;return o.addEventListener("scroll",s,{passive:!0}),r(),{update(l,a){e.state.doc.content.size!==a.doc.content.size&&r()},destroy:()=>{i(),o.removeEventListener("scroll",s)}}},props:{decorations:({doc:e,selection:n})=>{var r,s;if(!(this.editor.isEditable||!this.options.showOnlyWhenEditable))return null;const{anchor:o}=n,l=[],a=this.editor.isEmpty;if(this.options.showOnlyCurrent&&!this.options.includeChildren){const u=e.resolve(o);if(u.depth>0){const d=u.node(1),f=u.before(1);if(d.type.isTextblock&&So(d)){const h=o>=f&&o<=f+d.nodeSize,p=t0({node:d,dataAttribute:t,hasAnchor:h,placeholder:this.options.placeholder,classes:{emptyEditor:this.options.emptyEditorClass,emptyNode:this.options.emptyNodeClass},editor:this.editor,isEmptyDoc:a,pos:u.before(1)});l.push(p)}}}else{const u=pi.getState(this.editor.state),d=(r=u.topPos)!=null?r:0,f=(s=u.bottomPos)!=null?s:e.content.size;e.nodesBetween(d,f,(h,p)=>{const m=o>=p&&o<=p+h.nodeSize,y=!h.isLeaf&&So(h);if(!h.type.isTextblock)return this.options.includeChildren;if((m||!this.options.showOnlyCurrent)&&y){const g=t0({classes:{emptyEditor:this.options.emptyEditorClass,emptyNode:this.options.emptyNodeClass},editor:this.editor,isEmptyDoc:a,dataAttribute:t,hasAnchor:m,placeholder:this.options.placeholder,node:h,pos:p});l.push(g)}return this.options.includeChildren})}return se.create(e,l)}}})]}});ye.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new de({key:new Se("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Pv(n.selection)||t.view.dragging?null:se.create(n.doc,[Ie.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var JR="skipTrailingNode";function r0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var GR=ye.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Se(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new de({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,f=c.nodes[n];if(!s.some(h=>h.getMeta(JR))&&u)return a.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!r0({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!r0({node:o,types:r})}}})]}}),QR=ye.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Rw(t,e),redo:()=>({state:t,dispatch:e})=>Ow(t,e)}},addProseMirrorPlugins(){return[jR(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()}}}),XR=ye.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(f2.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(l2.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(yw.configure(this.options.bulletList)),this.options.code!==!1&&s.push(m2.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(k2.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(v2.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(BR.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(FR.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(w2.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(x2.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(QR.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(S2.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(M2.configure(this.options.italic)),this.options.listItem!==!1&&s.push(kw.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(bw.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(Z2.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Tw.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(gR.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(vR.configure(this.options.strike)),this.options.text!==!1&&s.push(wR.configure(this.options.text)),this.options.underline!==!1&&s.push(xR.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(GR.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),YR=XR;function lp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var is=lp();function Iw(t){is=t}var Er={exec:()=>null};function Q(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(et.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var ZR=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),et={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},eO=/^(?:[ \t]*(?:\n|$))+/,tO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,nO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_o=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ap=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Lw=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Pw=Q(Lw).replace(/bull/g,ap).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),sO=Q(Lw).replace(/bull/g,ap).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),cp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,iO=/^[^\n]+/,up=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,oO=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",up).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lO=Q(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ap).getRegex(),_c="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",dp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,aO=Q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",dp).replace("tag",_c).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Dw=Q(cp).replace("hr",_o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_c).getRegex(),cO=Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Dw).getRegex(),fp={blockquote:cO,code:tO,def:oO,fences:nO,heading:rO,hr:_o,html:aO,lheading:Pw,list:lO,newline:eO,paragraph:Dw,table:Er,text:iO},s0=Q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_c).getRegex(),uO={...fp,lheading:sO,table:s0,paragraph:Q(cp).replace("hr",_o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",s0).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_c).getRegex()},dO={...fp,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dp).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Er,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(cp).replace("hr",_o).replace("heading",` *#{1,6} *[^
|
|
197
|
+
]`).replace("lheading",Pw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fO=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hO=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_w=/^( {2,}|\\)\n(?!\s*$)/,pO=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ei=/[\p{P}\p{S}]/u,zc=/[\s\p{P}\p{S}]/u,hp=/[^\s\p{P}\p{S}]/u,mO=Q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,zc).getRegex(),zw=/(?!~)[\p{P}\p{S}]/u,gO=/(?!~)[\s\p{P}\p{S}]/u,yO=/(?:[^\s\p{P}\p{S}]|~)/u,kO=Q(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ZR?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$w=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,vO=Q($w,"u").replace(/punct/g,ei).getRegex(),wO=Q($w,"u").replace(/punct/g,zw).getRegex(),jw="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xO=Q(jw,"gu").replace(/notPunctSpace/g,hp).replace(/punctSpace/g,zc).replace(/punct/g,ei).getRegex(),SO=Q(jw,"gu").replace(/notPunctSpace/g,yO).replace(/punctSpace/g,gO).replace(/punct/g,zw).getRegex(),CO=Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hp).replace(/punctSpace/g,zc).replace(/punct/g,ei).getRegex(),bO=Q(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ei).getRegex(),EO="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",TO=Q(EO,"gu").replace(/notPunctSpace/g,hp).replace(/punctSpace/g,zc).replace(/punct/g,ei).getRegex(),MO=Q(/\\(punct)/,"gu").replace(/punct/g,ei).getRegex(),AO=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),NO=Q(dp).replace("(?:-->|$)","-->").getRegex(),RO=Q("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",NO).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ec=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,OO=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ec).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Bw=Q(/^!?\[(label)\]\[(ref)\]/).replace("label",ec).replace("ref",up).getRegex(),Fw=Q(/^!?\[(ref)\](?:\[\])?/).replace("ref",up).getRegex(),IO=Q("reflink|nolink(?!\\()","g").replace("reflink",Bw).replace("nolink",Fw).getRegex(),i0=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pp={_backpedal:Er,anyPunctuation:MO,autolink:AO,blockSkip:kO,br:_w,code:hO,del:Er,delLDelim:Er,delRDelim:Er,emStrongLDelim:vO,emStrongRDelimAst:xO,emStrongRDelimUnd:CO,escape:fO,link:OO,nolink:Fw,punctuation:mO,reflink:Bw,reflinkSearch:IO,tag:RO,text:pO,url:Er},LO={...pp,link:Q(/^!?\[(label)\]\((.*?)\)/).replace("label",ec).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ec).getRegex()},ff={...pp,emStrongRDelimAst:SO,emStrongLDelim:wO,delLDelim:bO,delRDelim:TO,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",i0).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",i0).getRegex()},PO={...ff,br:Q(_w).replace("{2,}","*").getRegex(),text:Q(ff.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},hl={normal:fp,gfm:uO,pedantic:dO},mi={normal:pp,gfm:ff,breaks:PO,pedantic:LO},DO={"&":"&","<":"<",">":">",'"':""","'":"'"},o0=t=>DO[t];function Yt(t,e){if(e){if(et.escapeTest.test(t))return t.replace(et.escapeReplace,o0)}else if(et.escapeTestNoEncode.test(t))return t.replace(et.escapeReplaceNoEncode,o0);return t}function l0(t){try{t=encodeURI(t).replace(et.percentDecode,"%")}catch{return null}return t}function a0(t,e){var i;let n=t.replace(et.findPipe,(o,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(et.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(et.slashPipe,"|");return r}function gi(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function _O(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function zO(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function c0(t,e,n,r,s){let i=e.href,o=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}function $O(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
198
|
+
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
|
|
199
|
+
`)}var tc=class{constructor(t){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=t||is}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:gi(n,`
|
|
200
|
+
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=$O(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=gi(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:gi(e[0],`
|
|
201
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=gi(e[0],`
|
|
202
|
+
`).split(`
|
|
203
|
+
`),r="",s="",i=[];for(;n.length>0;){let o=!1,l=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))l.push(n[a]),o=!0;else if(!o)l.push(n[a]);else break;n=n.slice(a);let c=l.join(`
|
|
204
|
+
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
205
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
206
|
+
${c}`:c,s=s?`${s}
|
|
207
|
+
${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=d,n.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let h=f,p=h.raw+`
|
|
208
|
+
`+n.join(`
|
|
209
|
+
`),m=this.blockquote(p);i[i.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,s=s.substring(0,s.length-h.text.length)+m.text;break}else if((f==null?void 0:f.type)==="list"){let h=f,p=h.raw+`
|
|
210
|
+
`+n.join(`
|
|
211
|
+
`),m=this.list(p);i[i.length-1]=m,r=r.substring(0,r.length-f.raw.length)+m.raw,s=s.substring(0,s.length-h.raw.length)+m.raw,n=p.substring(i.at(-1).raw.length).split(`
|
|
212
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){var n,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let l=this.rules.other.listItemRegex(s),a=!1;for(;t;){let u=!1,d="",f="";if(!(e=l.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let h=zO(e[2].split(`
|
|
213
|
+
`,1)[0],e[1].length),p=t.split(`
|
|
214
|
+
`,1)[0],m=!h.trim(),y=0;if(this.options.pedantic?(y=2,f=h.trimStart()):m?y=e[1].length+1:(y=h.search(this.rules.other.nonSpaceChar),y=y>4?1:y,f=h.slice(y),y+=e[1].length),m&&this.rules.other.blankLine.test(p)&&(d+=p+`
|
|
215
|
+
`,t=t.substring(p.length+1),u=!0),!u){let g=this.rules.other.nextBulletRegex(y),k=this.rules.other.hrRegex(y),v=this.rules.other.fencesBeginRegex(y),x=this.rules.other.headingBeginRegex(y),S=this.rules.other.htmlBeginRegex(y),b=this.rules.other.blockquoteBeginRegex(y);for(;t;){let C=t.split(`
|
|
216
|
+
`,1)[0],E;if(p=C,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),v.test(p)||x.test(p)||S.test(p)||b.test(p)||g.test(p)||k.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=y||!p.trim())f+=`
|
|
217
|
+
`+E.slice(y);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(h)||x.test(h)||k.test(h))break;f+=`
|
|
218
|
+
`+p}m=!p.trim(),d+=C+`
|
|
219
|
+
`,t=t.substring(C.length+1),h=E.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),o.raw+=d}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((n=u.tokens[0])==null?void 0:n.type)==="text"||((r=u.tokens[0])==null?void 0:r.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=f.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}if(!o.loose){let d=u.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));o.loose=f}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=a0(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
220
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(let l of s)i.rows.push(a0(l,i.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[c]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
221
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=gi(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=_O(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),c0(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return c0(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,l=s,a=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let u=[...r[0]][0].length,d=t.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let h=d.slice(1,-1);return{type:"em",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,l=s,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+s);(r=a.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...r[0]][0].length,u=t.slice(0,s+r.index+c+o),d=u.slice(s,-s);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Ht=class hf{constructor(e){ne(this,"tokens");ne(this,"options");ne(this,"state");ne(this,"inlineQueue");ne(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||is,this.options.tokenizer=this.options.tokenizer||new tc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:et,block:hl.normal,inline:mi.normal};this.options.pedantic?(n.block=hl.pedantic,n.inline=mi.pedantic):this.options.gfm&&(n.block=hl.gfm,this.options.breaks?n.inline=mi.breaks:n.inline=mi.gfm),this.tokenizer.rules=n}static get rules(){return{block:hl,inline:mi}}static lex(e,n){return new hf(n).lex(e)}static lexInline(e,n){return new hf(n).inlineTokens(e)}lex(e){e=e.replace(et.carriageReturn,`
|
|
222
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(et.tabCharGlobal," ").replace(et.spaceLine,""));e;){let l;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(l=c.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let c=n.at(-1);l.raw.length===1&&c!==void 0?c.raw+=`
|
|
223
|
+
`:n.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
224
|
+
`)?"":`
|
|
225
|
+
`)+l.raw,c.text+=`
|
|
226
|
+
`+l.text,this.inlineQueue.at(-1).src=c.text):n.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
227
|
+
`)?"":`
|
|
228
|
+
`)+l.raw,c.text+=`
|
|
229
|
+
`+l.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),n.push(l);continue}let a=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(a=e.substring(0,c+1))}if(this.state.top&&(l=this.tokenizer.paragraph(a))){let c=n.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
230
|
+
`)?"":`
|
|
231
|
+
`)+l.raw,c.text+=`
|
|
232
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(l),r=a.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
233
|
+
`)?"":`
|
|
234
|
+
`)+l.raw,c.text+=`
|
|
235
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(l);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var a,c,u,d,f;this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)h.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(a=this.options.hooks)==null?void 0:a.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,l="";for(;e;){o||(l=""),o=!1;let h;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(m=>(h=m.call({lexer:this},e,n))?(e=e.substring(h.raw.length),n.push(h),!0):!1))continue;if(h=this.tokenizer.escape(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.tag(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.link(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(h.raw.length);let m=n.at(-1);h.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):n.push(h);continue}if(h=this.tokenizer.emStrong(e,r,l)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.codespan(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.br(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.del(e,r,l)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.autolink(e)){e=e.substring(h.raw.length),n.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(e))){e=e.substring(h.raw.length),n.push(h);continue}let p=e;if((f=this.options.extensions)!=null&&f.startInline){let m=1/0,y=e.slice(1),g;this.options.extensions.startInline.forEach(k=>{g=k.call({lexer:this},y),typeof g=="number"&&g>=0&&(m=Math.min(m,g))}),m<1/0&&m>=0&&(p=e.substring(0,m+1))}if(h=this.tokenizer.inlineText(p)){e=e.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(l=h.raw.slice(-1)),o=!0;let m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):n.push(h);continue}if(e){let m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},nc=class{constructor(t){ne(this,"options");ne(this,"parser");this.options=t||is}space(t){return""}code({text:t,lang:e,escaped:n}){var i;let r=(i=(e||"").match(et.notSpaceStart))==null?void 0:i[0],s=t.replace(et.endingNewline,"")+`
|
|
236
|
+
`;return r?'<pre><code class="language-'+Yt(r)+'">'+(n?s:Yt(s,!0))+`</code></pre>
|
|
237
|
+
`:"<pre><code>"+(n?s:Yt(s,!0))+`</code></pre>
|
|
238
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
239
|
+
${this.parser.parse(t)}</blockquote>
|
|
240
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
241
|
+
`}hr(t){return`<hr>
|
|
242
|
+
`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let l=t.items[o];r+=this.listitem(l)}let s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
|
|
243
|
+
`+r+"</"+s+`>
|
|
244
|
+
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
245
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
246
|
+
`}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
247
|
+
<thead>
|
|
248
|
+
`+e+`</thead>
|
|
249
|
+
`+r+`</table>
|
|
250
|
+
`}tablerow({text:t}){return`<tr>
|
|
251
|
+
${t}</tr>
|
|
252
|
+
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
253
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Yt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=l0(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+Yt(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=l0(t);if(s===null)return Yt(n);t=s;let i=`<img src="${t}" alt="${Yt(n)}"`;return e&&(i+=` title="${Yt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Yt(t.text)}},mp=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Vt=class pf{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||is,this.options.renderer=this.options.renderer||new nc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mp}static parse(e,n){return new pf(n).parse(e)}static parseInline(e,n){return new pf(n).parseInline(e)}parse(e){var r,s;this.renderer.parser=this;let n="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let a=o,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=c||"";continue}}let l=o;switch(l.type){case"space":{n+=this.renderer.space(l);break}case"hr":{n+=this.renderer.hr(l);break}case"heading":{n+=this.renderer.heading(l);break}case"code":{n+=this.renderer.code(l);break}case"table":{n+=this.renderer.table(l);break}case"blockquote":{n+=this.renderer.blockquote(l);break}case"list":{n+=this.renderer.list(l);break}case"checkbox":{n+=this.renderer.checkbox(l);break}case"html":{n+=this.renderer.html(l);break}case"def":{n+=this.renderer.def(l);break}case"paragraph":{n+=this.renderer.paragraph(l);break}case"text":{n+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){var s,i;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let l=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){let c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=c||"";continue}}let a=l;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},wl,Ai=(wl=class{constructor(t){ne(this,"options");ne(this,"block");this.options=t||is}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?Ht.lex:Ht.lexInline}provideParser(t=this.block){return t?Vt.parse:Vt.parseInline}},ne(wl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(wl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),wl),jO=class{constructor(...t){ne(this,"defaults",lp());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Vt);ne(this,"Renderer",nc);ne(this,"TextRenderer",mp);ne(this,"Lexer",Ht);ne(this,"Tokenizer",tc);ne(this,"Hooks",Ai);this.use(...t)}walkTokens(t,e){var r,s;let n=[];for(let i of t)switch(n=n.concat(e.call(this,i)),i.type){case"table":{let o=i;for(let l of o.header)n=n.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let a of l)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);n=n.concat(this.walkTokens(a,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new nc(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,l=n.renderer[o],a=s[o];s[o]=(...c)=>{let u=l.apply(s,c);return u===!1&&(u=a.apply(s,c)),u||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new tc(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,l=n.tokenizer[o],a=s[o];s[o]=(...c)=>{let u=l.apply(s,c);return u===!1&&(u=a.apply(s,c)),u}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Ai;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,l=n.hooks[o],a=s[o];Ai.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&Ai.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await l.call(s,c);return a.call(s,d)})();let u=l.call(s,c);return a.call(s,u)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await l.apply(s,c);return d===!1&&(d=await a.apply(s,c)),d})();let u=l.apply(s,c);return u===!1&&(u=a.apply(s,c)),u}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ht.lex(t,e??this.defaults)}parser(t,e){return Vt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer(t):t?Ht.lex:Ht.lexInline)(o,s),a=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?Vt.parse:Vt.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(t):t?Ht.lex:Ht.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let l=(s.hooks?s.hooks.provideParser(t):t?Vt.parse:Vt.parseInline)(o,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
254
|
+
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Yt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Xr=new jO;function ee(t,e){return Xr.parse(t,e)}ee.options=ee.setOptions=function(t){return Xr.setOptions(t),ee.defaults=Xr.defaults,Iw(ee.defaults),ee};ee.getDefaults=lp;ee.defaults=is;ee.use=function(...t){return Xr.use(...t),ee.defaults=Xr.defaults,Iw(ee.defaults),ee};ee.walkTokens=function(t,e){return Xr.walkTokens(t,e)};ee.parseInline=Xr.parseInline;ee.Parser=Vt;ee.parser=Vt.parse;ee.Renderer=nc;ee.TextRenderer=mp;ee.Lexer=Ht;ee.lexer=Ht.lex;ee.Tokenizer=tc;ee.Hooks=Ai;ee.parse=ee;ee.options;ee.setOptions;ee.use;ee.walkTokens;ee.parseInline;Vt.parse;Ht.lex;function BO(t,e){const r=e.split(`
|
|
255
|
+
`).flatMap(s=>[s,""]).map(s=>`${t}${s}`).join(`
|
|
256
|
+
`);return r.slice(0,r.length-1)}function Eo(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(s=>Object.prototype.hasOwnProperty.call(e,s)&&Object.is(t[s],e[s]))}function FO(t,e){const n=[];return Array.from(t.entries()).forEach(([r,s])=>{if(!e){n.push(r);return}(e.marks||[]).find(o=>o.type===r&&Eo(o.attrs,s.attrs))||n.push(r)}),n}function HO(t,e){const n=[];return Array.from(e.entries()).forEach(([r,s])=>{const i=t.get(r);(!i||!Eo(i.attrs,s.attrs))&&n.push({type:r,mark:s})}),n}function VO(t,e,n,r){const s=!n,i=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(e,new Map(n.marks.map(a=>[a.type,a]))),l=[];return(s||i||o)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([a,c])=>{n.marks.find(d=>d.type===a&&Eo(d.attrs,c.attrs))||l.push(a)}):(s||i)&&l.push(...Array.from(t.keys()).reverse())),l}function WO(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const s=t.get(r),i=e(r,s);i&&(n=i+n)}),t.clear(),n}function UO(t,e,n){let r="";return Array.from(t.entries()).forEach(([s,i])=>{const o=n(s,i);o&&(r+=o),e.set(s,i)}),r}function Bu(t){const n=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function pl(t,e){return typeof t!="string"?"json":e}var KO=class{constructor(t){this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.lastParseResult=null;var e,n,r,s,i;this.markedInstance=(e=t==null?void 0:t.marked)!=null?e:ee,this.indentStyle=(r=(n=t==null?void 0:t.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(i=(s=t==null?void 0:t.indentation)==null?void 0:s.size)!=null?i:2,this.baseExtensions=(t==null?void 0:t.extensions)||[],t!=null&&t.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t!=null&&t.extensions&&(this.baseExtensions=t.extensions,Ps(Oc(t.extensions)).forEach(l=>this.registerExtension(l)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t){var e,n;this.extensions.push(t);const r=Z(z(t,"code")),s=t.name;r&&this.codeTypes.add(s),this.extensionRanks.has(s)||this.extensionRanks.set(s,this.extensionRanks.size);const i=z(t,"markdownTokenName")||s,o=z(t,"parseMarkdown"),l=z(t,"renderMarkdown"),a=z(t,"markdownTokenizer"),c=(e=z(t,"markdownOptions"))!=null?e:null,u=(n=c==null?void 0:c.indentsContent)!=null?n:!1,d=c==null?void 0:c.htmlReopen,f={tokenName:i,nodeName:s,parseMarkdown:o,renderMarkdown:l,isIndenting:u,htmlReopen:d,tokenizer:a};if(i&&o){const h=this.registry.get(i)||[];h.push(f),this.registry.set(i,h)}if(l){const h=this.nodeTypeRegistry.get(s)||[];h.push(f),this.nodeTypeRegistry.set(s,h)}a&&this.hasMarked()&&this.registerTokenizer(a)}createLexer(){return new this.markedInstance.Lexer}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!=null?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:r="inline",tokenize:s}=t,i=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this);let l;n?l=typeof n=="function"?n:c=>c.indexOf(n):l=c=>{const u=s(c,[],this.createTokenizerHelpers(this.createLexer()));return u&&u.raw?c.indexOf(u.raw):-1};const a={name:e,level:r,start:l,tokenizer(c,u){const d=this.lexer?i(this.lexer):i(o()),f=s(c,u,d);if(f&&f.type)return{...f,type:f.type||e,raw:f.raw||"",tokens:f.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[a]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/ /g,"").replace(/\u00A0/g,"").trim()===""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{const r=n.lex(t);return{type:"doc",content:this.parseTokens(r,!0)}}finally{this.activeParseLexer=e}}parseTokens(t,e=!1){const n=t.reduce((i,o,l)=>(o.type!=="space"&&i.push(l),i),[]);let r=-1,s=0;return t.flatMap((i,o)=>{for(var l;s<n.length&&n[s]<o;)r=n[s],s+=1;if(e&&i.type==="space"){const c=(l=n[s])!=null?l:-1;return this.createImplicitEmptyParagraphsFromSpace(i,r,c)}const a=this.parseToken(i,e);return a===null?[]:Array.isArray(a)?a:[a]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const r=this.countParagraphSeparators(t.raw||"");if(r===0)return[];const i=Math.max(r-(e===-1||n===-1?0:1),0);return Array.from({length:i},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
|
|
257
|
+
`).match(/\n\n/g)||[]).length}parseToken(t,e=!1){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const n=this.getHandlersForToken(t.type),r=this.createParseHelpers();if(n.find(i=>{if(!i.parseMarkdown)return!1;const o=i.parseMarkdown(t,r),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(l=>Bu(l).isTask),n=t.items.some(l=>!Bu(l).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let s=[],i=null;for(let l=0;l<t.items.length;l+=1){const a=t.items[l],{isTask:c,checked:u,indentLevel:d}=Bu(a);let f=a;if(c){const m=(a.raw||a.text||"").split(`
|
|
258
|
+
`),y=m[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),g=y?y[2]:"";let k=[];if(m.length>1&&m.slice(1).join(`
|
|
259
|
+
`).trim()){const x=m.slice(1),S=x.filter(b=>b.trim());if(S.length>0){const b=Math.min(...S.map(N=>N.length-N.trimStart().length)),E=x.map(N=>N.trim()?N.slice(b):"").join(`
|
|
260
|
+
`).trim();E&&(k=this.markedInstance.lexer(`${E}
|
|
261
|
+
`))}}f={type:"taskItem",raw:"",mainContent:g,indentLevel:d,checked:u??!1,text:g,tokens:this.tokenizeInline(g),nestedTokens:k}}const h=c?"taskList":"list";i!==h?(s.length>0&&r.push({type:i,items:s}),s=[f],i=h):s.push(f)}s.length>0&&r.push({type:i,items:s});const o=[];for(let l=0;l<r.length;l+=1){const a=r[l],c={...t,type:a.type,items:a.items},u=this.parseToken(c);u&&(Array.isArray(u)?o.push(...u):o.push(u))}return o.length>0?o:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(t,n),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,n,r,s;const i=[];for(let o=0;o<t.length;o+=1){const l=t[o];if(l.type==="text")i.push({type:"text",text:_g(l.text||"")});else if(l.type==="html"){const a=((n=(e=l.raw)!=null?e:l.text)!=null?n:"").toString(),c=/^<\/[\s]*[\w-]+/i.test(a),u=a.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!c&&u&&!/\/>$/.test(a)){const f=u[1],h=this.escapeRegex(f),p=new RegExp(`^<\\/\\s*${h}\\b`,"i");let m=-1;const y=[a];for(let g=o+1;g<t.length;g+=1){const k=t[g],v=((s=(r=k.raw)!=null?r:k.text)!=null?s:"").toString();if(y.push(v),k.type==="html"&&p.test(v)){m=g;break}}if(m!==-1){const g=y.join(""),k={type:"html",raw:g,text:g,block:!1},v=this.parseHTMLToken(k);if(v){const x=this.normalizeParseResult(v);Array.isArray(x)?i.push(...x):x&&i.push(x)}o=m;continue}}const d=this.parseHTMLToken(l);if(d){const f=this.normalizeParseResult(d);Array.isArray(f)?i.push(...f):f&&i.push(f)}}else if(l.type){const a=this.getHandlerForToken(l.type);if(a&&a.parseMarkdown){const c=this.createParseHelpers(),u=a.parseMarkdown(l,c);if(this.isMarkResult(u)){const d=this.applyMarkToContent(u.mark,u.content,u.attrs);i.push(...d)}else{const d=this.normalizeParseResult(u);Array.isArray(d)?i.push(...d):d&&i.push(d)}}else l.tokens&&i.push(...this.parseInlineTokens(l.tokens))}}return i}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:_g(t.text||"")};case"html":return this.parseHTMLToken(t);case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(typeof window>"u")return t.block?{type:"paragraph",content:[{type:"text",text:e}]}:{type:"text",text:e};try{const n=qM(e,this.baseExtensions);return n.type==="doc"&&n.content?t.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}encodeTextForMarkdown(t,e,n){return(n==null?void 0:n.type)!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(s=>this.codeTypes.has(typeof s=="string"?s:s.type))?t:WA(t)}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const o=this.getHandlerForToken(t.type);if(!o)return"";const l=Array.isArray(e==null?void 0:e.content)&&n>0?e.content[n-1]:void 0,a={renderChildren:(d,f)=>{const h=o.isIndenting?r+1:r;return!Array.isArray(d)&&d.content?this.renderNodes(d.content,t,f||"",n,h):this.renderNodes(d,t,f||"",n,h)},renderChild:(d,f)=>{const h=o.isIndenting?r+1:r;return this.renderNodeToMarkdown(d,t,f,h)},indent:d=>this.indentString+d,wrapInBlock:BO},c={index:n,level:r,parentType:e==null?void 0:e.type,previousNode:l,meta:{parentAttrs:e==null?void 0:e.attrs,...s}};return((i=o.renderMarkdown)==null?void 0:i.call(o,t,a,c))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,o=new Set,l=new Map;return t.forEach((a,c)=>{const u=c<t.length-1?t[c+1]:null;if(a.type)if(a.type==="text"){let d=this.encodeTextForMarkdown(a.text||"",a,e);const f=new Map((a.marks||[]).map(S=>[S.type,S])),h=this.getMarksToOpenForSerialization(i,f,u),p=FO(f,u),m=p.filter(S=>i.has(S)),y=m.length>0&&h.length>0;let g="";if(p.length>0&&!y){const S=d.match(/(\s+)$/);S&&(g=S[1],d=d.slice(0,-g.length))}y||p.slice().reverse().forEach(S=>{if(!i.has(S))return;const b=f.get(S),C=this.getMarkClosing(S,b,l.get(S));C&&(d+=C),i.has(S)&&(i.delete(S),l.delete(S))});let k="";if(h.length>0){const S=d.match(/^(\s+)/);S&&(k=S[1],d=d.slice(k.length))}h.forEach(({type:S,mark:b})=>{const C=o.has(S)?"html":"markdown",E=this.getMarkOpening(S,b,C);E&&(d=E+d),l.set(S,C),o.delete(S)}),y||h.slice().reverse().forEach(({type:S,mark:b})=>{i.set(S,b)}),d=k+d;let v;if(y){const S=new Set(((u==null?void 0:u.marks)||[]).map(E=>E.type));h.forEach(({type:E})=>{S.has(E)&&this.getHtmlReopenTags(E)&&o.add(E)});const b=Array.from(i.keys()),C=m.slice().sort((E,N)=>b.indexOf(N)-b.indexOf(E));v=[...h.map(E=>E.type),...C]}else v=VO(i,f,u,this.markSetsEqual.bind(this));let x="";if(v.length>0){const S=d.match(/(\s+)$/);S&&(x=S[1],d=d.slice(0,-x.length))}v.forEach(S=>{var b;const C=(b=i.get(S))!=null?b:f.get(S),E=this.getMarkClosing(S,C,l.get(S));E&&(d+=E),i.delete(S),l.delete(S)}),d+=x,d+=g,s.push(d)}else{const d=new Set((a.marks||[]).map(g=>g.type)),f=new Map,h=new Map;i.forEach((g,k)=>{var v;d.has(k)&&(f.set(k,g),h.set(k,(v=l.get(k))!=null?v:"markdown"))});const p=WO(i,(g,k)=>this.getMarkClosing(g,k,l.get(g)));l.clear();const m=this.renderNodeToMarkdown(a,e,c,r),y=a.type==="hardBreak"?"":UO(f,i,(g,k)=>{var v;const x=(v=h.get(g))!=null?v:"markdown";return l.set(g,x),this.getMarkOpening(g,k,x)});s.push(p+m+y)}}),s.join(n)}getMarkOpening(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.open)||"";const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const a=i.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:u=>u,wrapInBlock:(u,d)=>u+d},{index:0,level:0,parentType:"text",meta:{}}),c=a.indexOf(o);return c>=0?a.substring(0,c):""}catch(a){throw new Error(`Failed to get mark opening for ${t}: ${a}`)}}getMarkClosing(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.close)||"";const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const a=i.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:d=>d,wrapInBlock:(d,f)=>d+f},{index:0,level:0,parentType:"text",meta:{}}),c=a.indexOf(o),u=c+o.length;return c>=0?a.substring(u):""}catch(a){throw new Error(`Failed to get mark closing for ${t}: ${a}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n==null?void 0:n.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const s=e.get(n);return s&&Eo(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=HO(t,e);if(r.length<=1)return r;const s=(n==null?void 0:n.marks)||[],i=(c,u)=>s.some(d=>d.type===c&&Eo(d.attrs,u)),o=(c,u)=>{var d,f;const h=(d=this.extensionRanks.get(c.type))!=null?d:Number.MAX_SAFE_INTEGER,p=(f=this.extensionRanks.get(u.type))!=null?f:Number.MAX_SAFE_INTEGER;return h!==p?p-h:c.type.localeCompare(u.type)},l=r.filter(c=>!i(c.type,c.mark.attrs)).sort(o),a=r.filter(c=>i(c.type,c.mark.attrs)).sort(o);return[...l,...a]}},u0=KO,qO=ye.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!(e!=null&&e.contentType)||pl(t,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return $t.setContent(t,e);const r=this.editor.markdown.parse(t);return $t.setContent(r,e)},insertContent:(t,e)=>{if(!(e!=null&&e.contentType)||pl(t,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return $t.insertContent(t,e);const r=this.editor.markdown.parse(t);return $t.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!(n!=null&&n.contentType)||pl(e,n==null?void 0:n.contentType)!=="markdown"||!this.editor.markdown)return $t.insertContentAt(t,e,n);const s=this.editor.markdown.parse(e);return $t.insertContentAt(t,s,n)}}},addStorage(){return{manager:new u0({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new u0({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||pl(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const n=this.editor.markdown.parse(this.editor.options.content);(t=n.content)!=null&&t.length&&(this.editor.options.content=n)}});let mf,gf;if(typeof WeakMap<"u"){let t=new WeakMap;mf=e=>t.get(e),gf=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;mf=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},gf=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var xe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,s=e/this.width|0;let i=r+1,o=s+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<s;)o++;return o==l?i-1:this.map[o]}s=i}}static get(t){return mf(t)||gf(t,JO(t))}};function JO(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=GO(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let p=0;;p++){for(;s<r.length&&r[s]!=0;)s++;if(p==d.childCount)break;const m=d.child(p),{colspan:y,rowspan:g,colwidth:k}=m.attrs;for(let v=0;v<g;v++){if(v+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:g-v});break}const x=s+v*e;for(let S=0;S<y;S++){r[x+S]==0?r[x+S]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-S});const b=k&&k[S];if(b){const C=(x+S)%e*2,E=o[C];E==null||E!=b&&o[C+1]==1?(o[C]=b,o[C+1]=1):E==b&&o[C+1]++}}}s+=y,u+=m.nodeSize}const f=(c+1)*e;let h=0;for(;s<f;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new xe(e,n,r,i);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(a=!0);return a&&QO(l,o,t),l}function GO(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const l=s.child(o);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function QO(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const u=e[(s+c)%t.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=XO(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function XO(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Xe(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const Un=new Se("selectingCells");function Yr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function YO(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Qt(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function $c(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Yr(e.$head)||ZO(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function ZO(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function yf(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function eI(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function gp(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Hw(t,e,n){const r=t.node(-1),s=xe.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Zr(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function Vw(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(e,0,0)}return r}function tI(t,e,n){const r=Xe(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=r)return!1;return!0}var oe=class mn extends H{constructor(e,n=e){const r=e.node(-1),s=xe.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),l=e.node(0),a=s.cellsInRect(o).filter(u=>u!=n.pos-i);a.unshift(n.pos-i);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new Sk(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(yf(r)&&yf(s)&&gp(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?mn.rowSelection(r,s):i&&this.isColSelection()?mn.colSelection(r,s):new mn(r,s)}return B.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let a=s.top;a<s.bottom;a++){const c=[];for(let u=a*n.width+s.left,d=s.left;d<s.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=s.left-h.left,y=h.right-s.right;if(m>0||y>0){let g=p.attrs;if(m>0&&(g=Zr(g,0,m)),y>0&&(g=Zr(g,g.colspan-y,y)),h.left<s.left){if(p=p.type.createAndFill(g),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else p=p.type.create(g,p.content)}if(h.top<s.top||h.bottom>s.bottom){const g={...p.attrs,rowspan:Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top)};h.top<s.top?p=p.type.createAndFill(g):p=p.type.create(g,p.content)}c.push(p)}o.push(e.child(a).copy(M.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new L(M.from(l),1,1)}replace(e,n=L.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:l,$to:a}=s[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?L.empty:n)}const i=H.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new L(M.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=xe.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=xe.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(i+s.map[o.left])),l.bottom<s.height&&(n=a.resolve(i+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+s.map[l.left])),o.bottom<s.height&&(e=a.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new mn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof mn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=xe.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(i+s.map[o.top*s.width])),l.right<s.width&&(n=a.resolve(i+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+s.map[l.top*s.width])),o.right<s.width&&(e=a.resolve(i+s.map[s.width*(o.top+1)-1]))),new mn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new mn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new mn(e.resolve(n),e.resolve(r))}getBookmark(){return new nI(this.$anchorCell.pos,this.$headCell.pos)}};oe.prototype.visible=!1;H.jsonID("cell",oe);var nI=class Ww{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ww(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&gp(n,r)?new oe(n,r):H.near(r,1)}};function rI(t){if(!(t.selection instanceof oe))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Ie.node(r,r+n.nodeSize,{class:"selectedCell"}))}),se.create(t.doc,e)}function sI({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function iI({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function oI(t,e,n){const r=(e||t).selection,s=(e||t).doc;let i,o;if(r instanceof F&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=oe.create(s,r.from);else if(o=="row"){const l=s.resolve(r.from+1);i=oe.rowSelection(l,l)}else if(!n){const l=xe.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=oe.create(s,a+1,c)}}else r instanceof B&&sI(r)?i=B.create(s,r.from):r instanceof B&&iI(r)&&(i=B.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const lI=new Se("fix-tables");function Uw(t,e,n,r){const s=t.childCount,i=e.childCount;e:for(let o=0,l=0;o<i;o++){const a=e.child(o);for(let c=l,u=Math.min(s,o+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<s&&t.child(l).sameMarkup(a)?Uw(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Kw(t,e){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=aI(t,s,i,n))};return e?e.doc!=t.doc&&Uw(e.doc,t.doc,0,r):t.doc.descendants(r),n}function aI(t,e,n,r){const s=xe.get(e);if(!s.problems)return r;r||(r=t.tr);const i=[];for(let a=0;a<s.height;a++)i.push(0);for(let a=0;a<s.problems.length;a++){const c=s.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Zr(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let o,l;for(let a=0;a<i.length;a++)i[a]&&(o==null&&(o=a),l=a);for(let a=0,c=n+1;a<s.height;a++){const u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let y=0;y<f;y++){const g=Xe(t.schema)[h].createAndFill();g&&p.push(g)}const m=(a==0||o==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(lI,{fixTables:!0})}function un(t){const e=t.selection,n=$c(t),r=n.node(-1),s=n.start(-1),i=xe.get(r);return{...e instanceof oe?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function qw(t,{map:e,tableStart:n,table:r},s){let i=s>0?-1:0;tI(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+s;if(s>0&&s<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,Vw(c.attrs,s-e.colCount(a))),o+=c.attrs.rowspan-1}else{const a=i==null?Xe(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(o,s,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function cI(t,e){if(!Qt(t))return!1;if(e){const n=un(t);e(qw(t.tr,n,n.left))}return!0}function uI(t,e){if(!Qt(t))return!1;if(e){const n=un(t);e(qw(t.tr,n,n.right))}return!0}function dI(t,{map:e,table:n,tableStart:r},s){const i=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+s,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(s>0&&e.map[l-1]==a||s<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(i).map(r+a),null,Zr(u,s-e.colCount(a)));else{const d=t.mapping.slice(i).map(r+a);t.delete(d,d+c.nodeSize)}o+=u.rowspan}}function fI(t,e){if(!Qt(t))return!1;if(e){const n=un(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;dI(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=xe.get(i)}e(r)}return!0}function hI(t,e,n){var r;const s=Xe(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=s)return!1;return!0}function Jw(t,{map:e,tableStart:n,table:r},s){let i=n;for(let c=0;c<s;c++)i+=r.child(c).nodeSize;const o=[];let l=s>0?-1:0;hI(e,r,s+l)&&(l=s==0||s==e.height?null:0);for(let c=0,u=e.width*s;c<e.width;c++,u++)if(s>0&&s<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;const d=l==null?Xe(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d==null?void 0:d.createAndFill();f&&o.push(f)}return t.insert(i,Xe(r.type.schema).row.create(null,o)),t}function pI(t,e){if(!Qt(t))return!1;if(e){const n=un(t);e(Jw(t.tr,n,n.top))}return!0}function mI(t,e){if(!Qt(t))return!1;if(e){const n=un(t);e(Jw(t.tr,n,n.bottom))}return!0}function gI(t,{map:e,table:n,tableStart:r},s){let i=0;for(let c=0;c<s;c++)i+=n.child(c).nodeSize;const o=i+n.child(s).nodeSize,l=t.mapping.maps.length;t.delete(i+r,o+r);const a=new Set;for(let c=0,u=s*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),s>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(s<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(s+1,c,n);t.insert(t.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function yI(t,e){if(!Qt(t))return!1;if(e){const n=un(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;gI(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=xe.get(n.table)}e(r)}return!0}function d0(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function kI({width:t,height:e,map:n},r){let s=r.top*t+r.left,i=s,o=(r.bottom-1)*t+r.left,l=s+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[s]==n[s-t]||r.bottom<e&&n[o]==n[o+t])return!0;s++,o++}return!1}function f0(t,e){const n=t.selection;if(!(n instanceof oe)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=un(t),{map:s}=r;if(kI(s,r))return!1;if(e){const i=t.tr,o={};let l=M.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=s.map[u*s.width+d],h=r.table.nodeAt(f);if(!(o[f]||!h))if(o[f]=!0,a==null)a=f,c=h;else{d0(h)||(l=l.append(h.content));const p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...Vw(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const u=a+1+c.content.size,d=d0(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new oe(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function h0(t,e){const n=Xe(t.schema);return vI(({node:r})=>n[r.type.spec.tableRole])(t,e)}function vI(t){return(e,n)=>{const r=e.selection;let s,i;if(r instanceof oe){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(s=YO(r.$from),!s)return!1;i=(o=Yr(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||i==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=un(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=s.nodeSize);for(let m=u.left,y=0;m<u.right;m++,y++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),t({node:s,row:h,col:m}).createAndFill(a[y]))}d.setNodeMarkup(i,t({node:s,row:u.top,col:u.left}),a[0]),r instanceof oe&&d.setSelection(new oe(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function wI(t,e){return function(n,r){if(!Qt(n))return!1;const s=$c(n);if(s.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof oe?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&i.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function xI(t){return function(e,n){if(!Qt(e))return!1;if(n){const r=Xe(e.schema),s=un(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=o.map(a=>s.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<o.length;a++)i.setNodeMarkup(s.tableStart+o[a],r.header_cell,l[a].attrs);n(i)}return!0}}function p0(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function To(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?xI(t):function(n,r){if(!Qt(n))return!1;if(r){const s=Xe(n.schema),i=un(n),o=n.tr,l=p0("row",i,s),a=p0("column",i,s),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?a?s.cell:s.header_cell:t=="row"?l?s.cell:s.header_cell:s.cell;i.map.cellsInRect(u).forEach(f=>{const h=f+i.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}To("row",{useDeprecatedLogic:!0});To("column",{useDeprecatedLogic:!0});const SI=To("cell",{useDeprecatedLogic:!0});function CI(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),s=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function m0(t){return function(e,n){if(!Qt(e))return!1;const r=CI($c(e),t);if(r==null)return!1;if(n){const s=e.doc.resolve(r);n(e.tr.setSelection(B.between(s,eI(s))).scrollIntoView())}return!0}}function bI(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function ml(t,e){const n=t.selection;if(!(n instanceof oe))return!1;if(e){const r=t.tr,s=Xe(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new L(s,0,0))}),r.docChanged&&e(r)}return!0}function EI(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),i=s.type.spec.tableRole,o=s.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=kf(Xe(o).row,new L(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(n||r?kf(Xe(o).row,new L(e,n,r)).content:e);else return null;return TI(o,l)}function TI(t,e){const n=[];for(let s=0;s<e.length;s++){const i=e[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=i.child(o).attrs;for(let c=s;c<s+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(M.empty),n[s]<r){const i=Xe(t).cell.createAndFill(),o=[];for(let l=n[s];l<r;l++)o.push(i);e[s]=e[s].append(M.from(o))}return{height:e.length,width:r,rows:e}}function kf(t,e){const n=t.createAndFill();return new Ch(n).replace(0,n.content.size,e).doc}function MI({width:t,height:e,rows:n},r,s){if(t!=r){const i=[],o=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Zr(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}o.push(M.from(c))}n=o,t=r}if(e!=s){const i=[];for(let o=0,l=0;o<s;o++,l++){const a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>s&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,s-d.attrs.rowspan)},d.content)),a.push(d)}i.push(M.from(a))}n=i,e=s}return{width:t,height:e,rows:n}}function AI(t,e,n,r,s,i,o){const l=t.doc.type.schema,a=Xe(l);let c,u;if(s>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<s;y++)p.push(m);t.insert(t.mapping.slice(o).map(f-1+r),p)}if(i>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,s);p++){const y=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==a.header_cell;d.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,M.from(d)),h=[];for(let p=e.height;p<i;p++)h.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),h)}return!!(c||u)}function g0(t,e,n,r,s,i,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=s;c<i;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:o-h}),t.insert(t.mapping.slice(l).map(e.positionAt(o,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return a}function y0(t,e,n,r,s,i,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=s;c<i;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,Zr(f.attrs,o-h,f.attrs.colspan-(o-h))),t.insert(p+f.nodeSize,f.type.createAndFill(Zr(f.attrs,0,o-h))),c+=f.attrs.rowspan-1}}return a}function k0(t,e,n,r,s){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let o=xe.get(i);const{top:l,left:a}=r,c=a+s.width,u=l+s.height,d=t.tr;let f=0;function h(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");o=xe.get(i),f=d.mapping.maps.length}AI(d,o,i,n,c,u,f)&&h(),g0(d,o,i,n,a,c,l,f)&&h(),g0(d,o,i,n,a,c,u,f)&&h(),y0(d,o,i,n,l,u,a,f)&&h(),y0(d,o,i,n,l,u,c,f)&&h();for(let p=l;p<u;p++){const m=o.positionAt(p,a,i),y=o.positionAt(p,c,i);d.replace(d.mapping.slice(f).map(m+n),d.mapping.slice(f).map(y+n),new L(s.rows[p-l],0,0))}h(),d.setSelection(new oe(d.doc.resolve(n+o.positionAt(l,a,i)),d.doc.resolve(n+o.positionAt(u-1,c-1,i)))),e(d)}const NI=$h({ArrowLeft:gl("horiz",-1),ArrowRight:gl("horiz",1),ArrowUp:gl("vert",-1),ArrowDown:gl("vert",1),"Shift-ArrowLeft":yl("horiz",-1),"Shift-ArrowRight":yl("horiz",1),"Shift-ArrowUp":yl("vert",-1),"Shift-ArrowDown":yl("vert",1),Backspace:ml,"Mod-Backspace":ml,Delete:ml,"Mod-Delete":ml});function $l(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function gl(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof oe)return $l(n,r,H.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=Gw(s,t,e);if(o==null)return!1;if(t=="horiz")return $l(n,r,H.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(o),a=Hw(l,t,e);let c;return a?c=H.near(a,1):e<0?c=H.near(n.doc.resolve(l.before(-1)),-1):c=H.near(n.doc.resolve(l.after(-1)),1),$l(n,r,c)}}}function yl(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof oe)o=i;else{const a=Gw(s,t,e);if(a==null)return!1;o=new oe(n.doc.resolve(a))}const l=Hw(o.$headCell,t,e);return l?$l(n,r,new oe(o.$anchorCell,l)):!1}}function RI(t,e){const n=t.state.doc,r=Yr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new oe(r))),!0):!1}function OI(t,e,n){if(!Qt(t.state))return!1;let r=EI(n);const s=t.state.selection;if(s instanceof oe){r||(r={width:1,height:1,rows:[M.from(kf(Xe(t.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),l=xe.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=MI(r,l.right-l.left,l.bottom-l.top),k0(t.state,t.dispatch,o,l,r),!0}else if(r){const i=$c(t.state),o=i.start(-1);return k0(t.state,t.dispatch,o,xe.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function II(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=v0(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof oe)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Yr(t.state.selection.$anchor))!=null&&((n=Fu(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)i(s,e),e.preventDefault();else if(!r)return;function i(a,c){let u=Fu(t,c);const d=Un.getState(t.state)==null;if(!u||!gp(a,u))if(d)u=a;else return;const f=new oe(a,u);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(Un,a.pos),t.dispatch(h)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),Un.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Un,-1))}function l(a){const c=a,u=Un.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(v0(t,c.target)!=r&&(d=Fu(t,e),!d))return o();d&&i(d,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function Gw(t,e,n){if(!(t.state.selection instanceof B))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function v0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fu(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&Yr(t.state.doc.resolve(r))||Yr(t.state.doc.resolve(s))}var LI=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),vf(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,vf(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function vf(t,e,n,r,s,i){let o=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let m=0;m<h;m++,f++){const y=s==f?i:p&&p[m],g=y?y+"px":"";if(o+=y||r,y||(l=!1),a)a.style.width!=g&&(a.style.width=g),a=a.nextSibling;else{const k=document.createElement("col");k.style.width=g,e.appendChild(k)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const yt=new Se("tableColumnResizing");function PI({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=LI,lastColumnResizable:s=!0}={}){const i=new de({key:yt,state:{init(o,l){var a;const c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Xe(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new DI(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=yt.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{_I(o,l,t,s)},mouseleave:o=>{zI(o)},mousedown:(o,l)=>{$I(o,l,e,n)}},decorations:o=>{const l=yt.getState(o);if(l&&l.activeHandle>-1)return VI(o,l.activeHandle)},nodeViews:{}}});return i}var DI=class jl{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(yt);if(r&&r.setHandle!=null)return new jl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new jl(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return yf(e.doc.resolve(s))||(s=-1),new jl(s,n.dragging)}return n}};function _I(t,e,n,r){if(!t.editable)return;const s=yt.getState(t.state);if(s&&!s.dragging){const i=BI(e.target);let o=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=n?o=w0(t,e,"left",n):a-e.clientX<=n&&(o=w0(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),a=l.node(-1),c=xe.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Qw(t,o)}}}function zI(t){if(!t.editable)return;const e=yt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Qw(t,-1)}function $I(t,e,n,r){var s;if(!t.editable)return!1;const i=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=yt.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),a=jI(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(yt,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=yt.getState(t.state);f!=null&&f.dragging&&(FI(t,f.activeHandle,x0(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(yt,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=yt.getState(t.state);if(f&&f.dragging){const h=x0(f.dragging,d,n);S0(t,f.activeHandle,h,r)}}return S0(t,o.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function jI(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(o-=r[a],l--);return o/l}function BI(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function w0(t,e,n,r){const s=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!i)return-1;const{pos:o}=i,l=Yr(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const a=xe.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function x0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Qw(t,e){t.dispatch(t.state.tr.setMeta(yt,{setHandle:e}))}function FI(t,e,n){const r=t.state.doc.resolve(e),s=r.node(-1),i=xe.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=s.nodeAt(d).attrs,h=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():HI(f.colspan);p[h]=n,a.setNodeMarkup(o+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function S0(t,e,n,r){const s=t.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),l=xe.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let a=t.domAtPos(s.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&vf(i,a.firstChild,a,r,l,n)}function HI(t){return Array(t).fill(0)}function VI(t,e){const n=[],r=t.doc.resolve(e),s=r.node(-1);if(!s)return se.empty;const i=xe.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const u=l+c*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var a;const d=i.map[u],f=o+d+s.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=yt.getState(t))===null||a===void 0)&&a.dragging&&n.push(Ie.node(o+d,o+d+s.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(Ie.widget(f,h))}}return se.create(t.doc,n)}function WI({allowTableNodeSelection:t=!1}={}){return new de({key:Un,state:{init(){return null},apply(e,n){const r=e.getMeta(Un);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:s,pos:i}=e.mapping.mapResult(n);return s?null:i}},props:{decorations:rI,handleDOMEvents:{mousedown:II},createSelectionBetween(e){return Un.getState(e.state)!=null?e.state.selection:null},handleTripleClick:RI,handleKeyDown:NI,handlePaste:OI},appendTransaction(e,n,r){return oI(r,Kw(r,n),t)}})}function rc(t){return t==="left"||t==="right"||t==="center"?t:null}function UI(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return rc(e||n)}function KI(t){return rc(t==null?void 0:t.align)}function Xw(){return{default:null,parseHTML:t=>UI(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}var Yw=_e.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(i=>parseInt(i,10)):null;if(!s){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const l=i[o].getAttribute("width");return l?[parseInt(l,10)]:null}}return s}},align:Xw()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",he(this.options.HTMLAttributes,t),0]}}),Zw=_e.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}},align:Xw()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",he(this.options.HTMLAttributes,t),0]}}),ex=_e.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",he(this.options.HTMLAttributes,t),0]}});function wf(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function C0(t,e,n,r,s,i){var o;let l=0,a=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let f=0,h=0;f<u.childCount;f+=1){const{colspan:p,colwidth:m}=u.child(f).attrs;for(let y=0;y<p;y+=1,h+=1){const g=s===h?i:m&&m[y],k=g?`${g}px`:"";if(l+=g||r,g||(a=!1),c){if(c.style.width!==k){const[v,x]=wf(r,g);c.style.setProperty(v,x)}c=c.nextSibling}else{const v=document.createElement("col"),[x,S]=wf(r,g);v.style.setProperty(x,S),e.appendChild(v)}}}for(;c;){const f=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=f}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);a&&!d?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var qI=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),C0(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,C0(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function JI(t,e,n,r){let s=0,i=!0;const o=[],l=t.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const y=n===f?r:p&&p[m];s+=y||e,y||(i=!1);const[g,k]=wf(e,y);o.push(["col",{style:`${g}: ${k}`}])}}const a=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:a,tableMinWidth:c}}function b0(t,e){return t.createAndFill()}function GI(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function QI(t,e,n,r,s){const i=GI(t),o=[],l=[];for(let c=0;c<n;c+=1){const u=b0(i.cell);if(u&&l.push(u),r){const d=b0(i.header_cell);d&&o.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?o:l));return i.table.createChecked(null,a)}function XI(t){return t instanceof oe}var kl=({editor:t})=>{const{selection:e}=t.state;if(!XI(e))return!1;let n=0;const r=Tv(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},YI="";function ZI(t){return(t||"").replace(/\s+/g," ").trim()}function eL(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:YI;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(m=>{const y=[];m.content&&m.content.forEach(g=>{let k="";g.content&&Array.isArray(g.content)&&g.content.length>1?k=g.content.map(C=>e.renderChildren(C)).join(s):k=g.content?e.renderChildren(g.content):"";const v=ZI(k),x=g.type==="tableHeader",S=KI(g.attrs);y.push({text:v,isHeader:x,align:S})}),i.push(y)});const o=i.reduce((m,y)=>Math.max(m,y.length),0);if(o===0)return"";const l=new Array(o).fill(0);i.forEach(m=>{var y;for(let g=0;g<o;g+=1){const v=(((y=m[g])==null?void 0:y.text)||"").length;v>l[g]&&(l[g]=v),l[g]<3&&(l[g]=3)}});const a=(m,y)=>m+" ".repeat(Math.max(0,y-m.length)),c=i[0],u=c.some(m=>m.isHeader),d=new Array(o).fill(null);i.forEach(m=>{var y;for(let g=0;g<o;g+=1)!d[g]&&((y=m[g])!=null&&y.align)&&(d[g]=m[g].align)});let f=`
|
|
262
|
+
`;const h=new Array(o).fill(0).map((m,y)=>u&&c[y]&&c[y].text||"");return f+=`| ${h.map((m,y)=>a(m,l[y])).join(" | ")} |
|
|
263
|
+
`,f+=`| ${l.map((m,y)=>{const g=Math.max(3,m),k=d[y];return k==="left"?`:${"-".repeat(g)}`:k==="right"?`${"-".repeat(g)}:`:k==="center"?`:${"-".repeat(g)}:`:"-".repeat(g)}).join(" | ")} |
|
|
264
|
+
`,(u?i.slice(1):i).forEach(m=>{f+=`| ${new Array(o).fill(0).map((y,g)=>a(m[g]&&m[g].text||"",l[g])).join(" | ")} |
|
|
265
|
+
`}),f}var tL=eL,tx=_e.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:qI,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=JI(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const l=["table",he(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const s=[];t.header.forEach((i,o)=>{var l;const a=rc((l=r[o])!=null?l:i.align),c=a?{align:a}:{};s.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const i=[];s.forEach((o,l)=>{var a;const c=rc((a=r[l])!=null?a:o.align),u=c?{align:c}:{};i.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>tL(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=QI(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(B.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>cI(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>uI(t,e),deleteColumn:()=>({state:t,dispatch:e})=>fI(t,e),addRowBefore:()=>({state:t,dispatch:e})=>pI(t,e),addRowAfter:()=>({state:t,dispatch:e})=>mI(t,e),deleteRow:()=>({state:t,dispatch:e})=>yI(t,e),deleteTable:()=>({state:t,dispatch:e})=>bI(t,e),mergeCells:()=>({state:t,dispatch:e})=>f0(t,e),splitCell:()=>({state:t,dispatch:e})=>h0(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>To("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>To("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>SI(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>f0(t,e)?!0:h0(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>wI(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>m0(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>m0(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Kw(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=oe.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:kl,"Mod-Backspace":kl,Delete:kl,"Mod-Delete":kl}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[PI({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],WI({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r})=>new e(n,this.options.cellMinWidth,r)},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Z(z(t,"tableRole",e))}}});ye.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(tx.configure(this.options.table)),this.options.tableCell!==!1&&t.push(Yw.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Zw.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ex.configure(this.options.tableRow)),t}});function Re({active:t,onClick:e,title:n,children:r,disabled:s}){return w.jsx("button",{className:`md-toolbar-btn${t?" md-toolbar-btn--active":""}`,onClick:e,title:n,disabled:s,onMouseDown:i=>i.preventDefault(),children:r})}function vl(){return w.jsx("span",{className:"md-toolbar-divider"})}function nL({editor:t,editorState:e}){const n=T.useCallback(()=>{t&&t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},[t]);if(!t||!e)return null;const r=e;return w.jsxs("div",{className:"md-toolbar",children:[w.jsx(Re,{active:r.headingLevel===1,onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),title:"H1",children:"H1"}),w.jsx(Re,{active:r.headingLevel===2,onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),title:"H2",children:"H2"}),w.jsx(Re,{active:r.headingLevel===3,onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),title:"H3",children:"H3"}),w.jsx(vl,{}),w.jsx(Re,{active:r.isBold,onClick:()=>t.chain().focus().toggleBold().run(),title:"加粗 (⌘B)",children:w.jsx("strong",{children:"B"})}),w.jsx(Re,{active:r.isItalic,onClick:()=>t.chain().focus().toggleItalic().run(),title:"斜体 (⌘I)",children:w.jsx("em",{children:"I"})}),w.jsx(Re,{active:r.isStrike,onClick:()=>t.chain().focus().toggleStrike().run(),title:"删除线",children:w.jsx("s",{children:"S"})}),w.jsx(Re,{active:r.isCode,onClick:()=>t.chain().focus().toggleCode().run(),title:"行内代码 (⌘⇧K)",children:w.jsx("code",{children:"</>"})}),w.jsx(vl,{}),w.jsx(Re,{active:r.isBulletList,onClick:()=>t.chain().focus().toggleBulletList().run(),title:"无序列表",children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[w.jsx("circle",{cx:"2",cy:"4",r:"1.5"}),w.jsx("circle",{cx:"2",cy:"8",r:"1.5"}),w.jsx("circle",{cx:"2",cy:"12",r:"1.5"}),w.jsx("rect",{x:"5",y:"3",width:"10",height:"2",rx:"0.5"}),w.jsx("rect",{x:"5",y:"7",width:"10",height:"2",rx:"0.5"}),w.jsx("rect",{x:"5",y:"11",width:"10",height:"2",rx:"0.5"})]})}),w.jsx(Re,{active:r.isOrderedList,onClick:()=>t.chain().focus().toggleOrderedList().run(),title:"有序列表",children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[w.jsx("text",{x:"0",y:"5.5",fontSize:"5",fontWeight:"600",children:"1."}),w.jsx("text",{x:"0",y:"9.5",fontSize:"5",fontWeight:"600",children:"2."}),w.jsx("text",{x:"0",y:"13.5",fontSize:"5",fontWeight:"600",children:"3."}),w.jsx("rect",{x:"5",y:"3",width:"10",height:"2",rx:"0.5"}),w.jsx("rect",{x:"5",y:"7",width:"10",height:"2",rx:"0.5"}),w.jsx("rect",{x:"5",y:"11",width:"10",height:"2",rx:"0.5"})]})}),w.jsx(vl,{}),w.jsx(Re,{active:r.isBlockquote,onClick:()=>t.chain().focus().toggleBlockquote().run(),title:"引用块",children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[w.jsx("rect",{x:"0",y:"1",width:"2.5",height:"14",rx:"1",opacity:"0.5"}),w.jsx("rect",{x:"5",y:"3",width:"10",height:"2",rx:"0.5"}),w.jsx("rect",{x:"5",y:"7",width:"8",height:"2",rx:"0.5"}),w.jsx("rect",{x:"5",y:"11",width:"6",height:"2",rx:"0.5"})]})}),w.jsx(Re,{active:r.isCodeBlock,onClick:()=>t.chain().focus().toggleCodeBlock().run(),title:"代码块",children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("polyline",{points:"4,3 1,8 4,13"}),w.jsx("polyline",{points:"12,3 15,8 12,13"}),w.jsx("line",{x1:"10",y1:"2",x2:"6",y2:"14"})]})}),w.jsx(Re,{onClick:()=>t.chain().focus().setHorizontalRule().run(),title:"分割线",children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:w.jsx("rect",{x:"0",y:"7",width:"16",height:"2",rx:"1"})})}),w.jsx(vl,{}),w.jsx(Re,{active:r.isTable,onClick:n,title:"插入表格",children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",children:[w.jsx("rect",{x:"1",y:"1",width:"14",height:"14",rx:"1.5"}),w.jsx("line",{x1:"1",y1:"5.5",x2:"15",y2:"5.5"}),w.jsx("line",{x1:"1",y1:"10.5",x2:"15",y2:"10.5"}),w.jsx("line",{x1:"6",y1:"1",x2:"6",y2:"15"}),w.jsx("line",{x1:"11",y1:"1",x2:"11",y2:"15"})]})}),r.isTable&&w.jsxs(w.Fragment,{children:[w.jsx(Re,{onClick:()=>t.chain().focus().addRowAfter().run(),title:"添加行",children:"+行"}),w.jsx(Re,{onClick:()=>t.chain().focus().addColumnAfter().run(),title:"添加列",children:"+列"}),w.jsx(Re,{onClick:()=>t.chain().focus().deleteRow().run(),title:"删除行",children:"-行"}),w.jsx(Re,{onClick:()=>t.chain().focus().deleteColumn().run(),title:"删除列",children:"-列"}),w.jsx(Re,{onClick:()=>t.chain().focus().deleteTable().run(),title:"删除表格",children:"删表"})]})]})}const rL=_e.create({name:"anchorMarker",group:"block",atom:!0,draggable:!0,defining:!0,addAttributes(){return{anchorId:{default:null},label:{default:""},color:{default:"#4A90D9"}}},markdownTokenizer:{name:"anchorMarker",level:"block",start(t){const e=t.search(/<!--\s*@anchor:/);return e!==-1?e:-1},tokenize(t){const e=t.match(/^<!--\s*@anchor:([^|]+)\|([^|]*)\|([^|]*?)\s*-->[ \t]*(?:\n|$)/);if(e)return{type:"anchorMarker",raw:e[0],anchorId:e[1],label:e[2],color:e[3]}}},parseMarkdown(t,e){return e.createNode("anchorMarker",{anchorId:t.anchorId,label:t.label,color:t.color||"#4A90D9"})},renderMarkdown(t){const{anchorId:e,label:n,color:r}=t.attrs||{};return`<!-- @anchor:${e||""}|${n||""}|${r||"#4A90D9"} -->
|
|
266
|
+
|
|
267
|
+
`},parseHTML(){return[{tag:"div[data-anchor-id]"}]},renderHTML({HTMLAttributes:t}){return["div",{"data-anchor-id":t.anchorId,"data-anchor-label":t.label,"data-anchor-color":t.color,class:"anchor-marker-wrap"}]},addNodeView(){return({node:t,getPos:e,editor:n})=>{let r=t;const s=document.createElement("div");s.classList.add("anchor-marker-wrap"),s.contentEditable="false";const i=document.createElement("div");i.classList.add("anchor-marker-chip"),i.contentEditable="false";const o=u=>{i.style.setProperty("--anchor-color",u||"#4A90D9")};o(t.attrs.color);const l=document.createElement("span");l.classList.add("anchor-marker-chip__icon"),l.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="13" height="13"><path d="M16.555 5.412a8.028 8.028 0 0 0-3.503-2.81 14.899 14.899 0 0 1 1.663 4.472 8.547 8.547 0 0 0 1.84-1.662ZM13.326 7.825a13.43 13.43 0 0 0-2.413-5.773 8.087 8.087 0 0 0-1.826 0 13.43 13.43 0 0 0-2.413 5.773A8.473 8.473 0 0 0 10 8.5c1.18 0 2.304-.24 3.326-.675ZM6.514 9.376A9.98 9.98 0 0 0 10 10c1.226 0 2.4-.22 3.486-.624a13.54 13.54 0 0 1-.351 3.759 13.54 13.54 0 0 1-6.27 0 13.54 13.54 0 0 1-.351-3.759ZM10.707 19.006a.75.75 0 0 1-1.414 0 15.147 15.147 0 0 1-.534-4.927 14.91 14.91 0 0 0 2.482 0 15.147 15.147 0 0 1-.534 4.927ZM3.445 5.412a8.547 8.547 0 0 0 1.84 1.662 14.899 14.899 0 0 1 1.663-4.472 8.028 8.028 0 0 0-3.503 2.81Z"/></svg>';const a=document.createElement("span");a.classList.add("anchor-marker-chip__label"),a.textContent=t.attrs.label||t.attrs.anchorId||"anchor";const c=document.createElement("button");return c.classList.add("anchor-marker-chip__more"),c.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="13" height="13"><path d="M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"/></svg>',i.appendChild(l),i.appendChild(a),i.appendChild(c),s.appendChild(i),i.addEventListener("click",u=>{u.target.closest(".anchor-marker-chip__more")||(u.preventDefault(),u.stopPropagation(),window.dispatchEvent(new CustomEvent("anchor-navigate",{detail:{anchorId:r.attrs.anchorId}})))}),c.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),oL(i,r,e,n)}),{dom:s,update(u){return u.type.name!=="anchorMarker"?!1:(r=u,o(u.attrs.color),a.textContent=u.attrs.label||u.attrs.anchorId||"anchor",!0)},destroy(){Fn()}}}}}),sL=["#4A90D9","#52C41A","#FF6B6B","#FAAD14","#722ED1","#13C2C2","#EB2F96","#FA8C16"];let Cr=null;function Fn(){Cr!=null&&Cr.parentNode&&Cr.parentNode.removeChild(Cr),Cr=null,document.removeEventListener("keydown",nx)}function nx(t){t.key==="Escape"&&Fn()}function E0(t,e,n,r){if(typeof e!="function")return;const s=e();s!=null&&n.chain().focus().command(({tr:i})=>(i.setNodeMarkup(s,void 0,{...t.attrs,...r}),!0)).run()}function iL(t,e,n){if(typeof e!="function")return;const r=e();r!=null&&n.chain().focus().command(({tr:s})=>(s.delete(r,r+t.nodeSize),!0)).run()}function oL(t,e,n,r){Fn();const s=document.createElement("div");s.classList.add("anchor-popover");function i(){s.innerHTML="",[{icon:"pencil",text:"编辑标签",action:()=>o()},{icon:"palette",text:"编辑颜色",action:()=>l()},{icon:"trash",text:"删除锚点",danger:!0,action:()=>{Fn(),iL(e,n,r)}},{divider:!0},{icon:"xmark",text:"关闭",muted:!0,action:()=>Fn()}].forEach(({icon:u,text:d,danger:f,muted:h,action:p,divider:m})=>{if(m){const g=document.createElement("div");g.classList.add("anchor-popover__divider"),s.appendChild(g);return}const y=document.createElement("button");y.classList.add("anchor-popover__item"),f&&y.classList.add("anchor-popover__item--danger"),h&&y.classList.add("anchor-popover__item--muted"),y.innerHTML=`<span class="anchor-popover__item-icon">${lL(u)}</span> ${d}`,y.addEventListener("click",g=>{g.stopPropagation(),p()}),s.appendChild(y)})}function o(){s.innerHTML="";const c=document.createElement("div");c.classList.add("anchor-popover__edit");const u=document.createElement("input");u.classList.add("anchor-popover__input"),u.value=e.attrs.label||"",u.placeholder="锚点标签";const d=document.createElement("div");d.classList.add("anchor-popover__edit-actions");const f=document.createElement("button");f.classList.add("anchor-popover__edit-btn"),f.textContent="取消",f.addEventListener("click",p=>{p.stopPropagation(),i()});const h=document.createElement("button");h.classList.add("anchor-popover__edit-btn","anchor-popover__edit-btn--primary"),h.textContent="确认",h.addEventListener("click",p=>{p.stopPropagation(),u.value.trim()&&E0(e,n,r,{label:u.value.trim()}),Fn()}),u.addEventListener("keydown",p=>{p.key==="Enter"&&h.click(),p.key==="Escape"&&Fn()}),d.appendChild(f),d.appendChild(h),c.appendChild(u),c.appendChild(d),s.appendChild(c),setTimeout(()=>u.focus(),0)}function l(){s.innerHTML="";const c=document.createElement("div");c.classList.add("anchor-popover__edit");const u=document.createElement("div");u.classList.add("anchor-popover__color-grid"),sL.forEach(d=>{const f=document.createElement("button");f.classList.add("anchor-color-btn"),e.attrs.color===d&&f.classList.add("anchor-color-btn--active"),f.style.background=d,f.addEventListener("click",h=>{h.stopPropagation(),E0(e,n,r,{color:d}),Fn()}),u.appendChild(f)}),c.appendChild(u),s.appendChild(c)}i();const a=t.getBoundingClientRect();s.style.position="fixed",s.style.left=`${a.left}px`,s.style.top=`${a.bottom+4}px`,document.body.appendChild(s),Cr=s,setTimeout(()=>{document.addEventListener("keydown",nx)},0)}function lL(t){return{pencil:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="13" height="13"><path d="m5.433 13.917 1.262-3.155A4 4 0 0 1 7.58 9.42l6.92-6.918a2.121 2.121 0 0 1 3 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 0 1-.65-.65Z"/><path d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0 0 10 3H4.75A2.75 2.75 0 0 0 2 5.75v9.5A2.75 2.75 0 0 0 4.75 18h9.5A2.75 2.75 0 0 0 17 15.25V10a.75.75 0 0 0-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5Z"/></svg>',palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="13" height="13"><path fill-rule="evenodd" d="M3.5 2A1.5 1.5 0 0 0 2 3.5v13A1.5 1.5 0 0 0 3.5 18h13a1.5 1.5 0 0 0 1.5-1.5V10a.75.75 0 0 0-1.5 0v6.5h-13v-13h6.5a.75.75 0 0 0 0-1.5H3.5ZM16.414 3.586a2 2 0 0 0-2.828 0L7.793 9.379a1 1 0 0 0-.263.464l-.79 2.632a.5.5 0 0 0 .63.63l2.633-.791a1 1 0 0 0 .464-.263l5.793-5.793a2 2 0 0 0 0-2.828l-.846-.844Z" clip-rule="evenodd"/></svg>',trash:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="13" height="13"><path fill-rule="evenodd" d="M8.75 1A2.75 2.75 0 0 0 6 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 1 0 .23 1.482l.149-.022.841 10.518A2.75 2.75 0 0 0 7.596 19h4.807a2.75 2.75 0 0 0 2.742-2.53l.841-10.519.149.023a.75.75 0 0 0 .23-1.482A41.03 41.03 0 0 0 14 4.193V3.75A2.75 2.75 0 0 0 11.25 1h-2.5ZM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4ZM8.58 7.72a.75.75 0 0 0-1.5.06l.3 7.5a.75.75 0 1 0 1.5-.06l-.3-7.5Zm4.34.06a.75.75 0 1 0-1.5-.06l-.3 7.5a.75.75 0 1 0 1.5.06l.3-7.5Z" clip-rule="evenodd"/></svg>',xmark:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="13" height="13"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"/></svg>'}[t]||""}const xf={version:1,anchors:[]};let ze={...xf},Sf=new Set;function yi(){Sf.forEach(t=>t(ze))}function aL(){return"anc_"+Math.random().toString(36).slice(2,8)}const pt={subscribe(t){return Sf.add(t),()=>Sf.delete(t)},getData(){return ze},getAnchors(){return ze.anchors},getById(t){return ze.anchors.find(e=>e.id===t)||null},async load(){try{const t=await fetch("/api/anchors");if(!t.ok)throw new Error(t.status);ze=await t.json(),ze.anchors||(ze={...xf}),yi()}catch{ze={...xf},yi()}return ze},async save(){try{if(!(await fetch("/api/anchors",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ze)})).ok)throw new Error("save failed")}catch(t){console.error("AnchorStore save error:",t)}},async create({label:t,color:e,canvas:n,binding:r,target:s}){const i={id:aL(),label:t||"Anchor",color:e||"#4A90D9",canvas:n||{x:100,y:100},binding:r||null,target:s||{file:null,type:"file"},createdAt:new Date().toISOString()};return ze.anchors.push(i),yi(),await this.save(),i},async update(t,e){const n=ze.anchors.findIndex(r=>r.id===t);return n===-1?null:(ze.anchors[n]={...ze.anchors[n],...e},yi(),await this.save(),ze.anchors[n])},async remove(t){ze.anchors=ze.anchors.filter(e=>e.id!==t),yi(),await this.save()}};function cL({filename:t,getDirtyContent:e,updateDirtyCache:n,clearDirtyCache:r}){const[s,i]=T.useState(!1),[o,l]=T.useState(!1),a=T.useRef(null),[c,u]=T.useState(()=>(e==null?void 0:e(t))!==void 0),[d,f]=T.useState(!1),h=T.useRef(!1),p=T.useRef(!1),m=T.useRef(null),y=n2({extensions:[YR.configure({codeBlock:{HTMLAttributes:{class:"md-code-block"}}}),qO.configure({markedOptions:{gfm:!0}}),tx.configure({resizable:!0,HTMLAttributes:{class:"md-table"}}),ex,Yw,Zw,rL],content:"",editable:!1,immediatelyRender:!1,onUpdate:({editor:v,transaction:x})=>{if(!h.current)return;const S=v.getMarkdown();if(n==null||n(t,S),u(!0),x.docChanged){const b=new Set;v.state.doc.descendants(E=>{E.type.name==="anchorMarker"&&E.attrs.anchorId&&b.add(E.attrs.anchorId)}),pt.getAnchors().forEach(E=>{var N;((N=E.target)==null?void 0:N.type)==="marker"&&E.target.markerId&&E.target.file===t&&(b.has(E.target.markerId)||pt.remove(E.id))})}}}),g=nw({editor:y,selector:({editor:v})=>({isBold:v==null?void 0:v.isActive("bold"),isItalic:v==null?void 0:v.isActive("italic"),isStrike:v==null?void 0:v.isActive("strike"),isCode:v==null?void 0:v.isActive("code"),isBulletList:v==null?void 0:v.isActive("bulletList"),isOrderedList:v==null?void 0:v.isActive("orderedList"),isBlockquote:v==null?void 0:v.isActive("blockquote"),isCodeBlock:v==null?void 0:v.isActive("codeBlock"),isTable:v==null?void 0:v.isActive("table"),headingLevel:v!=null&&v.isActive("heading",{level:1})?1:v!=null&&v.isActive("heading",{level:2})?2:v!=null&&v.isActive("heading",{level:3})?3:0})}),k=T.useCallback(async()=>{if(!(!y||p.current||!h.current)){p.current=!0,i(!0);try{const v=y.getMarkdown();if(!(await fetch(`/api/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:v})})).ok)throw new Error("save failed");y.getMarkdown()===v&&(r==null||r(t),u(!1)),l(!0),clearTimeout(a.current),a.current=setTimeout(()=>l(!1),1500)}catch{l(!1)}finally{i(!1),p.current=!1}}},[y,t,r]);return m.current=k,T.useEffect(()=>()=>clearTimeout(a.current),[]),T.useEffect(()=>{if(!y)return;h.current=!1,f(!1),y.setEditable(!1);const v=e==null?void 0:e(t);v!==void 0?(y.commands.setContent(v,{contentType:"markdown"}),y.setEditable(!0),h.current=!0,u(!0)):fetch(`/api/files/${encodeURIComponent(t)}`).then(x=>{if(!x.ok)throw new Error(x.status);return x.json()}).then(x=>{y.isDestroyed||(y.commands.setContent(x.content||"",{contentType:"markdown"}),y.setEditable(!0),h.current=!0)}).catch(()=>{y.isDestroyed||f(!0)})},[y,t]),T.useEffect(()=>{const v=x=>{var S;(x.metaKey||x.ctrlKey)&&x.key==="s"&&(x.preventDefault(),(S=m.current)==null||S.call(m))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[]),T.useEffect(()=>{if(!y)return;const v=x=>{const{markerId:S}=x.detail||{};if(!S||!h.current||y.isDestroyed)return;let b=!1;y.state.doc.descendants((C,E)=>{if(b)return!1;if(C.type.name==="anchorMarker"&&C.attrs.anchorId===S){const N=y.view.nodeDOM(E);if(N){N.scrollIntoView({behavior:"smooth",block:"center"});const P=N.querySelector(".anchor-marker-chip")||N;P.classList.add("anchor-marker-chip--highlight"),setTimeout(()=>P.classList.remove("anchor-marker-chip--highlight"),1500)}return b=!0,!1}})};return window.addEventListener("anchor-scroll-to",v),()=>window.removeEventListener("anchor-scroll-to",v)},[y]),d?w.jsx("div",{className:"md-editor",children:w.jsx("div",{className:"md-editor__error",children:"文件加载失败,请刷新重试"})}):w.jsxs("div",{className:"md-editor",children:[w.jsxs("div",{className:"md-editor__toolbar",children:[w.jsxs("div",{className:"md-editor__toolbar-left",children:[w.jsx(nL,{editor:y,editorState:g}),c&&w.jsx("span",{className:"dirty-badge",children:"未保存"})]}),w.jsx("button",{className:"md-editor__save",onClick:k,disabled:s||!h.current,children:s?"保存中...":o?"已保存":"⌘S 保存"})]}),w.jsx(tw,{editor:y,className:"md-editor__editor"})]})}const uL="modulepreload",dL=function(t){return"/"+t},T0={},fL=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(a=>{if(a=dL(a),a in T0)return;T0[a]=!0;const c=a.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":uL,c||(d.as="script"),d.crossOrigin="",d.href=a,l&&d.setAttribute("nonce",l),document.head.appendChild(d),c)return new Promise((f,h)=>{d.addEventListener("load",f),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},hL=ln.lazy(async()=>({default:(await fL(()=>import("./main-DeCTtllz.js").then(e=>e.m),[])).Excalidraw}));function pL({filename:t,getDirtyContent:e,updateDirtyCache:n,clearDirtyCache:r}){const[s,i]=T.useState(null),[o,l]=T.useState(null),[a,c]=T.useState(!1),[u,d]=T.useState(!1),f=T.useRef(null),[h,p]=T.useState(()=>(e==null?void 0:e(t))!==void 0),m=T.useRef(null),y=T.useRef(h),g=T.useRef(!1),k=T.useRef(null);T.useEffect(()=>()=>{clearTimeout(f.current),clearTimeout(k.current)},[]),T.useEffect(()=>{let b=!1;const C=e==null?void 0:e(t),E=N=>{try{const P=typeof N=="string"?JSON.parse(N):N;return{elements:P.elements||[],appState:{...P.appState,collaborators:[]},files:P.files||{}}}catch{return{elements:[],appState:{viewBackgroundColor:"#ffffff"},files:{}}}};if(C!==void 0){i(E(C));return}return fetch(`/api/files/${encodeURIComponent(t)}`).then(N=>N.json()).then(N=>{b||i(E(N.content))}).catch(()=>{b||i({elements:[],appState:{},files:{}})}),()=>{b=!0}},[t,e]);const v=T.useCallback((b,C,E)=>JSON.stringify({type:"excalidraw",version:2,elements:b,appState:{viewBackgroundColor:C.viewBackgroundColor,gridSize:C.gridSize},files:E},null,2),[]),x=T.useCallback((b,C,E)=>{g.current&&(m.current={elements:b,appState:C,files:E},y.current=!0,p(!0),clearTimeout(k.current),k.current=setTimeout(()=>{if(m.current){const{elements:N,appState:P,files:j}=m.current;n==null||n(t,v(N,P,j))}},800))},[t,n,v]);T.useEffect(()=>()=>{if(y.current&&m.current){const{elements:b,appState:C,files:E}=m.current;n==null||n(t,v(b,C,E))}},[t,n,v]);const S=T.useCallback(async()=>{if(o){c(!0);try{const b=o.getSceneElements(),C=o.getAppState(),E=o.getFiles(),N=v(b,C,E);if(!(await fetch(`/api/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:N})})).ok)throw new Error("保存失败");r==null||r(t),y.current=!1,p(!1),d(!0),clearTimeout(f.current),f.current=setTimeout(()=>d(!1),1500)}catch{d(!1)}finally{c(!1)}}},[t,o,r,v]);return T.useEffect(()=>{const b=C=>{(C.metaKey||C.ctrlKey)&&C.key==="s"&&(C.preventDefault(),S())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[S]),s?w.jsxs("div",{className:"excalidraw-editor",children:[w.jsxs("div",{className:"excalidraw-editor__toolbar",children:[w.jsxs("div",{className:"excalidraw-editor__toolbar-left",children:[w.jsx("span",{className:"excalidraw-editor__filename",children:t}),h&&w.jsx("span",{className:"dirty-badge",children:"未保存"})]}),w.jsx("button",{className:"excalidraw-editor__save",onClick:S,disabled:a,children:a?"保存中...":u?"已保存":"保存 ⌘S"})]}),w.jsx("div",{className:"excalidraw-editor__canvas",onPointerDown:()=>{g.current=!0},children:w.jsx(ln.Suspense,{fallback:w.jsx("div",{className:"excalidraw-loading",children:"Loading Excalidraw..."}),children:w.jsx(hL,{initialData:s,excalidrawAPI:b=>l(b),onChange:x,langCode:"zh-CN",theme:"light"})})})]}):w.jsx("div",{className:"excalidraw-loading",children:"Loading..."})}const Bl="https://embed.diagrams.net",mL=Bl+"/?embed=1&proto=json&spin=1&lang=zh&noExitBtn=1",M0=`<mxGraphModel>
|
|
268
|
+
<root>
|
|
269
|
+
<mxCell id="0"/>
|
|
270
|
+
<mxCell id="1" parent="0"/>
|
|
271
|
+
</root>
|
|
272
|
+
</mxGraphModel>`;function gL({filename:t,getDirtyContent:e,updateDirtyCache:n,clearDirtyCache:r}){const s=T.useRef(null),i=T.useRef(""),[o,l]=T.useState(!1),[a,c]=T.useState(!0),[u,d]=T.useState(!1),[f,h]=T.useState(!1),p=T.useRef(null),[m,y]=T.useState(()=>(e==null?void 0:e(t))!==void 0),g=T.useRef(!1);T.useEffect(()=>()=>clearTimeout(p.current),[]),T.useEffect(()=>{let v=!1;const x=e==null?void 0:e(t);if(x!==void 0){i.current=x,l(!0);return}return fetch(`/api/files/${encodeURIComponent(t)}`).then(S=>S.json()).then(S=>{v||(i.current=S.content||M0,l(!0))}).catch(()=>{v||(i.current=M0,l(!0))}),()=>{v=!0}},[t,e]);const k=T.useCallback(async v=>{var S;const x=v||i.current;d(!0);try{if(!(await fetch(`/api/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x})})).ok)throw new Error("保存失败");r==null||r(t),y(!1),(S=s.current)!=null&&S.contentWindow&&s.current.contentWindow.postMessage(JSON.stringify({action:"status",message:"",modified:!1}),Bl),h(!0),clearTimeout(p.current),p.current=setTimeout(()=>h(!1),1500)}catch{h(!1)}finally{d(!1)}},[t,r]);return T.useEffect(()=>{const v=x=>{var b,C,E;if(x.origin!==Bl||x.source!==((b=s.current)==null?void 0:b.contentWindow)||!x.data||typeof x.data!="string")return;let S;try{S=JSON.parse(x.data)}catch{return}S.event&&(S.event==="init"&&!g.current&&(g.current=!0,(E=(C=s.current)==null?void 0:C.contentWindow)==null||E.postMessage(JSON.stringify({action:"load",xml:i.current,autosave:1}),Bl),c(!1)),S.event==="autosave"&&(i.current=S.xml,n==null||n(t,S.xml),y(!0)),S.event==="save"&&(i.current=S.xml,k(S.xml)))};return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[t,n,k]),T.useEffect(()=>{const v=x=>{(x.metaKey||x.ctrlKey)&&x.key==="s"&&(x.preventDefault(),k())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[k]),w.jsxs("div",{className:"drawio-editor",children:[w.jsxs("div",{className:"drawio-editor__toolbar",children:[w.jsxs("div",{className:"drawio-editor__toolbar-left",children:[w.jsx("span",{className:"drawio-editor__filename",children:t}),m&&w.jsx("span",{className:"dirty-badge",children:"未保存"})]}),w.jsx("button",{className:"drawio-editor__save",onClick:()=>k(),disabled:u,children:u?"保存中...":f?"已保存":"保存 ⌘S"})]}),w.jsxs("div",{className:"drawio-editor__canvas",children:[!o&&w.jsx("div",{className:"drawio-loading",children:"Loading..."}),o&&w.jsxs(w.Fragment,{children:[a&&w.jsx("div",{className:"drawio-loading",style:{position:"absolute",inset:0,zIndex:1},children:"Loading draw.io..."}),w.jsx("iframe",{ref:s,src:mL,style:{width:"100%",height:"100%",border:"none"}})]})]})]})}const yL={md:{ext:".md",placeholder:"需求规格",label:"Markdown",defaultContent:t=>`# ${t}
|
|
273
|
+
|
|
274
|
+
`},excalidraw:{ext:".excalidraw",placeholder:"业务流程",label:"Excalidraw",defaultContent:()=>JSON.stringify({type:"excalidraw",version:2,elements:[],appState:{viewBackgroundColor:"#ffffff"},files:{}},null,2)},drawio:{ext:".drawio",placeholder:"系统流程图",label:"Draw.io",defaultContent:()=>`<mxGraphModel>
|
|
275
|
+
<root>
|
|
276
|
+
<mxCell id="0"/>
|
|
277
|
+
<mxCell id="1" parent="0"/>
|
|
278
|
+
</root>
|
|
279
|
+
</mxGraphModel>`}};function kL({type:t,onCancel:e,onCreated:n}){const[r,s]=T.useState(""),[i,o]=T.useState(""),l=yL[t];if(!l)return null;const a=async()=>{const c=r.trim();if(!c){o("请输入文件名");return}const u=c.endsWith(l.ext)?c:c+l.ext,d=l.defaultContent(c);try{if(!(await fetch(`/api/files/${encodeURIComponent(u)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:d})})).ok)throw new Error("创建失败");n(u)}catch(f){o(f.message)}};return w.jsxs("div",{className:"new-file-dialog",children:[w.jsxs("div",{className:"new-file-dialog__title",children:["新建 ",l.label," 文件"]}),w.jsxs("div",{className:"new-file-dialog__input-row",children:[w.jsx("input",{className:"new-file-dialog__input",placeholder:l.placeholder,value:r,onChange:c=>{s(c.target.value),o("")},onKeyDown:c=>c.key==="Enter"&&a(),autoFocus:!0}),w.jsx("span",{className:"new-file-dialog__ext",children:l.ext})]}),i&&w.jsx("div",{className:"new-file-dialog__error",children:i}),w.jsxs("div",{className:"new-file-dialog__actions",children:[w.jsx("button",{className:"new-file-dialog__btn new-file-dialog__btn--cancel",onClick:e,children:"取消"}),w.jsx("button",{className:"new-file-dialog__btn new-file-dialog__btn--create",onClick:a,children:"创建"})]})]})}function Ni({type:t,size:e=16}){return t==="markdown"?w.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:"file-icon",children:[w.jsx("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:"#3B82F6",opacity:"0.12"}),w.jsx("path",{d:"M4 11V5l2.5 3L9 5v6",stroke:"#3B82F6",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),w.jsx("path",{d:"M11 8l1.5 1.5L14 8",stroke:"#3B82F6",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):t==="excalidraw"?w.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:"file-icon",children:[w.jsx("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:"#8B5CF6",opacity:"0.12"}),w.jsx("path",{d:"M4.5 11.5l7-7",stroke:"#8B5CF6",strokeWidth:"1.3",strokeLinecap:"round"}),w.jsx("path",{d:"M9.5 4.5l2 2",stroke:"#8B5CF6",strokeWidth:"1.3",strokeLinecap:"round"}),w.jsx("path",{d:"M4 12l1-3 7-7 2 2-7 7-3 1z",stroke:"#8B5CF6",strokeWidth:"1.1",strokeLinejoin:"round",fill:"#8B5CF6",opacity:"0.15"})]}):t==="drawio"?w.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:"file-icon",children:[w.jsx("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:"#F97316",opacity:"0.12"}),w.jsx("rect",{x:"3",y:"3",width:"4",height:"3",rx:"0.8",stroke:"#F97316",strokeWidth:"1.1",fill:"#F97316",opacity:"0.15"}),w.jsx("rect",{x:"9",y:"10",width:"4",height:"3",rx:"0.8",stroke:"#F97316",strokeWidth:"1.1",fill:"#F97316",opacity:"0.15"}),w.jsx("path",{d:"M5 6v2.5a1 1 0 001 1h3.5",stroke:"#F97316",strokeWidth:"1.1",strokeLinecap:"round"}),w.jsx("polyline",{points:"10.5,8.5 12,10 10.5,10",stroke:"#F97316",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):null}function vL({files:t,onRefresh:e,activeFile:n,onActiveFileChange:r,dirtyFiles:s,getDirtyContent:i,updateDirtyCache:o,clearDirtyCache:l,onDelete:a,onReorder:c}){const[u,d]=T.useState(null),[f,h]=T.useState(!1),[p,m]=T.useState(null),[y,g]=T.useState(null),[k,v]=T.useState(null),x=T.useRef(null);T.useEffect(()=>{if(!f)return;const j=J=>{x.current&&!x.current.contains(J.target)&&h(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[f]);const S=async j=>{d(null),await e();const J=j.split(".").pop();r({name:j,type:{md:"markdown",excalidraw:"excalidraw",drawio:"drawio"}[J]||"markdown",path:j})},b=j=>s.has(j),C=(j,J)=>{g(J),j.dataTransfer.effectAllowed="move"},E=(j,J)=>{if(j.preventDefault(),y===null||J===y)return;const W=j.currentTarget.getBoundingClientRect(),X=j.clientX<W.left+W.width/2?"left":"right";v(K=>(K==null?void 0:K.index)===J&&(K==null?void 0:K.side)===X?K:{index:J,side:X})},N=j=>{if(j.preventDefault(),y===null||!k){g(null),v(null);return}const J=t[y],W=t[k.index],X=t.filter((V,A)=>A!==y),K=X.findIndex(V=>V.name===W.name),D=k.side==="right"?K+1:K;X.splice(D,0,J),c(X.map(V=>V.name)),g(null),v(null)},P=()=>{g(null),v(null)};return w.jsxs("div",{className:"doc-panel",children:[w.jsxs("div",{className:"doc-panel__tabbar",children:[w.jsx("div",{className:"doc-panel__tabs",children:t.map((j,J)=>w.jsxs("button",{className:`doc-tab${(n==null?void 0:n.name)===j.name?" doc-tab--active":""}${y===J?" doc-tab--dragging":""}${(k==null?void 0:k.index)===J&&(k==null?void 0:k.side)==="left"?" doc-tab--drop-left":""}${(k==null?void 0:k.index)===J&&(k==null?void 0:k.side)==="right"?" doc-tab--drop-right":""}`,draggable:!0,onDragStart:W=>C(W,J),onDragOver:W=>E(W,J),onDrop:N,onDragEnd:P,onClick:()=>{r(j),d(null)},title:j.name,children:[w.jsx(Ni,{type:j.type}),w.jsx("span",{className:"doc-tab__name",children:j.name}),b(j.name)&&w.jsx("span",{className:"doc-tab__dirty"}),w.jsx("span",{className:"doc-tab__delete",draggable:!1,onDragStart:W=>{W.preventDefault(),W.stopPropagation()},onClick:W=>{W.stopPropagation(),m(j)},title:"删除文件",children:w.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M2 3h8M4.5 3V2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v1M3 3l.5 7a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1L9 3"})})})]},j.name))}),w.jsxs("div",{className:"doc-panel__new",ref:x,children:[w.jsx("button",{className:"doc-panel__new-trigger",onClick:()=>h(!f),title:"新建文件",children:w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[w.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),w.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})}),f&&w.jsxs("div",{className:"doc-panel__new-menu",children:[w.jsxs("button",{onClick:()=>{d("md"),h(!1)},children:[w.jsx(Ni,{type:"markdown"})," Markdown 文档"]}),w.jsxs("button",{onClick:()=>{d("excalidraw"),h(!1)},children:[w.jsx(Ni,{type:"excalidraw"})," Excalidraw 画板"]}),w.jsxs("button",{onClick:()=>{d("drawio"),h(!1)},children:[w.jsx(Ni,{type:"drawio"})," Draw.io 流程图"]})]})]})]}),w.jsxs("div",{className:"doc-panel__content",children:[u&&w.jsx(kL,{type:u,onCancel:()=>d(null),onCreated:S}),!u&&(n==null?void 0:n.type)==="markdown"&&w.jsx(cL,{filename:n.name,getDirtyContent:i,updateDirtyCache:o,clearDirtyCache:l},n.name),!u&&(n==null?void 0:n.type)==="excalidraw"&&w.jsx(pL,{filename:n.name,getDirtyContent:i,updateDirtyCache:o,clearDirtyCache:l},n.name),!u&&(n==null?void 0:n.type)==="drawio"&&w.jsx(gL,{filename:n.name,getDirtyContent:i,updateDirtyCache:o,clearDirtyCache:l},n.name),!u&&!n&&t.length>0&&w.jsx("div",{className:"doc-panel__placeholder",children:"选择文件开始编辑"}),!u&&!n&&t.length===0&&w.jsxs("div",{className:"doc-panel__placeholder",children:["点击 ",w.jsx("strong",{children:"+"})," 新建 Markdown、Excalidraw 或 Draw.io 文件"]})]}),p&&w.jsx("div",{className:"delete-confirm-backdrop",onClick:()=>m(null),children:w.jsxs("div",{className:"delete-confirm",onClick:j=>j.stopPropagation(),children:[w.jsxs("p",{className:"delete-confirm__msg",children:["确认删除文档 ",w.jsx("strong",{children:p.name}),"?"]}),w.jsx("p",{className:"delete-confirm__warning",children:"此操作不可恢复"}),w.jsxs("div",{className:"delete-confirm__actions",children:[w.jsx("button",{className:"delete-confirm__btn",onClick:()=>m(null),children:"取消"}),w.jsx("button",{className:"delete-confirm__btn delete-confirm__btn--danger",onClick:()=>{a(p),m(null)},children:"删除"})]})]})})]})}function wL({size:t=14,className:e=""}){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:w.jsx("path",{d:"M16.555 5.412a8.028 8.028 0 0 0-3.503-2.81 14.899 14.899 0 0 1 1.663 4.472 8.547 8.547 0 0 0 1.84-1.662ZM13.326 7.825a13.43 13.43 0 0 0-2.413-5.773 8.087 8.087 0 0 0-1.826 0 13.43 13.43 0 0 0-2.413 5.773A8.473 8.473 0 0 0 10 8.5c1.18 0 2.304-.24 3.326-.675ZM6.514 9.376A9.98 9.98 0 0 0 10 10c1.226 0 2.4-.22 3.486-.624a13.54 13.54 0 0 1-.351 3.759 13.54 13.54 0 0 1-6.27 0 13.54 13.54 0 0 1-.351-3.759ZM10.707 19.006a.75.75 0 0 1-1.414 0 15.147 15.147 0 0 1-.534-4.927 14.91 14.91 0 0 0 2.482 0 15.147 15.147 0 0 1-.534 4.927ZM3.445 5.412a8.547 8.547 0 0 0 1.84 1.662 14.899 14.899 0 0 1 1.663-4.472 8.028 8.028 0 0 0-3.503 2.81Z"})})}function xL({size:t=14,className:e=""}){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:w.jsx("path",{d:"M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"})})}function SL({size:t=14,className:e=""}){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:w.jsx("path",{fillRule:"evenodd",d:"M8.75 1A2.75 2.75 0 0 0 6 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 1 0 .23 1.482l.149-.022.841 10.518A2.75 2.75 0 0 0 7.596 19h4.807a2.75 2.75 0 0 0 2.742-2.53l.841-10.519.149.023a.75.75 0 0 0 .23-1.482A41.03 41.03 0 0 0 14 4.193V3.75A2.75 2.75 0 0 0 11.25 1h-2.5ZM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4ZM8.58 7.72a.75.75 0 0 0-1.5.06l.3 7.5a.75.75 0 1 0 1.5-.06l-.3-7.5Zm4.34.06a.75.75 0 1 0-1.5-.06l-.3 7.5a.75.75 0 1 0 1.5.06l.3-7.5Z",clipRule:"evenodd"})})}function CL({size:t=14,className:e=""}){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:[w.jsx("path",{d:"m5.433 13.917 1.262-3.155A4 4 0 0 1 7.58 9.42l6.92-6.918a2.121 2.121 0 0 1 3 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 0 1-.65-.65Z"}),w.jsx("path",{d:"M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0 0 10 3H4.75A2.75 2.75 0 0 0 2 5.75v9.5A2.75 2.75 0 0 0 4.75 18h9.5A2.75 2.75 0 0 0 17 15.25V10a.75.75 0 0 0-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5Z"})]})}function bL({size:t=14,className:e=""}){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:w.jsx("path",{fillRule:"evenodd",d:"M3.5 2A1.5 1.5 0 0 0 2 3.5v13A1.5 1.5 0 0 0 3.5 18h13a1.5 1.5 0 0 0 1.5-1.5V10a.75.75 0 0 0-1.5 0v6.5h-13v-13h6.5a.75.75 0 0 0 0-1.5H3.5ZM16.414 3.586a2 2 0 0 0-2.828 0L7.793 9.379a1 1 0 0 0-.263.464l-.79 2.632a.5.5 0 0 0 .63.63l2.633-.791a1 1 0 0 0 .464-.263l5.793-5.793a2 2 0 0 0 0-2.828l-.846-.844Z",clipRule:"evenodd"})})}function EL({size:t=14,className:e=""}){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:w.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 0 0 1.06 0l7.22-7.22v5.69a.75.75 0 0 0 1.5 0v-7.5a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0 0 1.5h5.69l-7.22 7.22a.75.75 0 0 0 0 1.06Z",clipRule:"evenodd"})})}function TL({size:t=14,className:e=""}){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:w.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})})}function ML({size:t=14,className:e=""}){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:t,height:t,className:e,children:[w.jsx("path",{d:"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z"}),w.jsx("path",{d:"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z"})]})}function AL(t){if(!t)return[];const e=t.split(`
|
|
280
|
+
`),n=[];for(const r of e){const s=r.match(/^(#{1,6})\s+(.+)$/);s&&n.push({level:s[1].length,text:s[2].trim()})}return n}function NL(t,e,n){const r=t.split(`
|
|
281
|
+
`);for(let s=0;s<r.length;s++){const i=r[s].match(/^#{1,6}\s+(.+)$/);if(i&&i[1].trim()===e)return r.splice(s,0,n,""),r.join(`
|
|
282
|
+
`)}return n+`
|
|
283
|
+
|
|
284
|
+
`+t}function Hu(t){return(t||"").replace(/\|/g,"\\|").replace(/-->/g,"--\\>")}function RL(t){return(t||"").replace(/\\\|/g,"|").replace(/--\\>/g,"-->")}function OL(t,e,n){return`<!-- @anchor:${Hu(t)}|${Hu(e)}|${Hu(n)} -->`}function IL(t,e){const n=t.split(`
|
|
285
|
+
`),r=[];for(let s=0;s<n.length;s++){const i=n[s].match(/^<!--\s*@anchor:([^|]+)\|/);if(i&&RL(i[1].trim())===e){s+1<n.length&&n[s+1].trim()===""&&s++;continue}r.push(n[s])}return r.join(`
|
|
286
|
+
`)}const Cf=["#4A90D9","#52C41A","#FF6B6B","#FAAD14","#722ED1","#13C2C2","#EB2F96","#FA8C16"];function LL({anchor:t,screenPos:e,scale:n,onNavigate:r,onUpdate:s,onRemove:i,onDragEnd:o}){var b;const[l,a]=T.useState(!1),[c,u]=T.useState(null),[d,f]=T.useState(""),h=T.useRef(null),p=T.useRef(null),m=T.useRef(null),y=()=>{a(!1),u(null)};T.useEffect(()=>{if(!l)return;const C=N=>{p.current&&!p.current.contains(N.target)&&!(h.current&&h.current.contains(N.target))&&y()},E=N=>{N.key==="Escape"&&y()};return setTimeout(()=>{document.addEventListener("mousedown",C),document.addEventListener("keydown",E)},0),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",E)}},[l]),T.useEffect(()=>{c&&m.current&&m.current.focus()},[c]);const g=C=>{if(C.button!==0||C.target.closest(".anchor-pin__more"))return;if(l){y();return}C.stopPropagation();const E=C.clientX,N=C.clientY,P=e.x,j=e.y,J=t.canvas.x,W=t.canvas.y,X=n||1;let K=!1;const D=document.createElement("div");D.style.cssText="position:fixed;inset:0;z-index:9999;cursor:grabbing",document.body.appendChild(D);const V=I=>{const $=I.clientX-E,U=I.clientY-N;!K&&Math.abs($)<4&&Math.abs(U)<4||(K=!0,h.current&&(h.current.style.transform=`translate(${P+$}px, ${j+U}px)`,h.current.classList.add("anchor-pin--dragging")))},A=I=>{if(D.remove(),document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",A),h.current&&h.current.classList.remove("anchor-pin--dragging"),K){const $=I.clientX-E,U=I.clientY-N;o==null||o(t.id,{x:J+$/X,y:W+U/X})}else r==null||r(t)};document.addEventListener("mousemove",V),document.addEventListener("mouseup",A)},k=C=>{C.stopPropagation(),l?y():(a(!0),u(null))},v=()=>{d.trim()&&(s==null||s(t.id,{label:d.trim()})),y()},x=C=>{s==null||s(t.id,{color:C}),y()},S=(b=t.target)!=null&&b.file?t.target.type==="marker"?`${t.target.file} (标记)`:t.target.file:"未关联";return w.jsxs("div",{ref:h,className:"anchor-pin","data-anchor-id":t.id,style:{transform:`translate(${e.x}px, ${e.y}px)`,"--pin-color":t.color},onMouseDown:g,title:`${t.label}
|
|
287
|
+
→ ${S}`,children:[w.jsx(wL,{size:13,className:"anchor-pin__icon"}),w.jsx("span",{className:"anchor-pin__label",children:t.label}),w.jsx("button",{className:"anchor-pin__more",onClick:k,onMouseDown:C=>C.stopPropagation(),children:w.jsx(xL,{size:13})}),l&&w.jsxs("div",{ref:p,className:"anchor-popover",onClick:C=>C.stopPropagation(),onMouseDown:C=>C.stopPropagation(),children:[!c&&w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:"anchor-popover__item",onClick:()=>{u("label"),f(t.label)},children:[w.jsx(CL,{size:13})," 编辑标签"]}),w.jsxs("button",{className:"anchor-popover__item",onClick:()=>u("color"),children:[w.jsx(bL,{size:13})," 编辑颜色"]}),w.jsxs("button",{className:"anchor-popover__item",onClick:()=>{r==null||r(t),y()},children:[w.jsx(EL,{size:13})," 跳转到目标"]}),w.jsx("div",{className:"anchor-popover__divider"}),w.jsxs("button",{className:"anchor-popover__item anchor-popover__item--danger",onClick:()=>{y(),i==null||i(t.id)},children:[w.jsx(SL,{size:13})," 删除锚点"]}),w.jsx("div",{className:"anchor-popover__divider"}),w.jsxs("button",{className:"anchor-popover__item anchor-popover__item--muted",onClick:y,children:[w.jsx(TL,{size:13})," 关闭"]})]}),c==="label"&&w.jsxs("div",{className:"anchor-popover__edit",children:[w.jsx("input",{ref:m,className:"anchor-popover__input",value:d,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&v(),C.key==="Escape"&&y()},placeholder:"锚点标签"}),w.jsxs("div",{className:"anchor-popover__edit-actions",children:[w.jsx("button",{className:"anchor-popover__edit-btn",onClick:y,children:"取消"}),w.jsx("button",{className:"anchor-popover__edit-btn anchor-popover__edit-btn--primary",onClick:v,children:"确认"})]})]}),c==="color"&&w.jsx("div",{className:"anchor-popover__edit",children:w.jsx("div",{className:"anchor-popover__color-grid",children:Cf.map(C=>w.jsx("button",{className:`anchor-color-btn${t.color===C?" anchor-color-btn--active":""}`,style:{background:C},onClick:()=>x(C)},C))})})]})]})}const rx=40;function bf(t){var e;try{return((e=t==null?void 0:t.contentWindow)==null?void 0:e.pmCanvas)||null}catch{return null}}function A0(t){if(!t)return{scale:1,panX:0,panY:0};const e=t.getPan?t.getPan():{x:0,y:0};return{scale:t.getScale?t.getScale():1,panX:e.x,panY:e.y}}function PL(t,e,n){return{x:(t+n.panX)*n.scale,y:(e+n.panY)*n.scale+rx}}function DL(t,e,n){return{x:t/n.scale-n.panX,y:(e-rx)/n.scale-n.panY}}function _L({anchors:t,iframeRef:e,onNavigate:n,onUpdate:r,onRemove:s,onCreateAt:i}){const[o,l]=T.useState({scale:1,panX:0,panY:0}),a=T.useRef(o);a.current=o;const c=T.useRef(null);T.useEffect(()=>{const d=e==null?void 0:e.current;if(!d)return;let f=null;const h=()=>{const p=bf(d);if(!p||!p.onChange)return;f&&(f(),f=null);const m=()=>l(A0(p));p.onReady?p.onReady(m):m(),f=p.onChange(y=>l({scale:y.scale,panX:y.x,panY:y.y}))};return d.addEventListener("load",h),h(),()=>{d.removeEventListener("load",h),f&&f()}},[e]),T.useEffect(()=>{const d=e==null?void 0:e.current;if(!d)return;let f=null;const h=()=>{var p;try{const m=d.contentDocument||((p=d.contentWindow)==null?void 0:p.document);if(!m)return;const y=g=>{const k=bf(d),v=k?A0(k):a.current;i==null||i(DL(g.clientX,g.clientY,v))};m.addEventListener("dblclick",y),f=()=>{try{m.removeEventListener("dblclick",y)}catch{}}}catch{}};return d.addEventListener("load",h),h(),()=>{d.removeEventListener("load",h),f==null||f()}},[e,i]),T.useEffect(()=>{const d=c.current,f=e==null?void 0:e.current;if(!d||!f)return;const h=p=>{var m;try{const y=f.contentDocument||((m=f.contentWindow)==null?void 0:m.document),g=y&&y.getElementById("canvas-viewport");if(!g)return;p.preventDefault(),g.dispatchEvent(new WheelEvent("wheel",{deltaX:p.deltaX,deltaY:p.deltaY,clientX:p.clientX,clientY:p.clientY,ctrlKey:p.ctrlKey,metaKey:p.metaKey,bubbles:!1,cancelable:!0}))}catch{}};return d.addEventListener("wheel",h,{passive:!1}),()=>d.removeEventListener("wheel",h)},[e]);const u=T.useCallback((d,f)=>{r==null||r(d,{canvas:f})},[r]);return w.jsx("div",{className:"anchor-overlay",ref:c,children:t.map(d=>w.jsx(LL,{anchor:d,screenPos:PL(d.canvas.x,d.canvas.y,o),scale:o.scale,onNavigate:n,onUpdate:r,onRemove:s,onDragEnd:u},d.id))})}function zL({files:t,position:e,onConfirm:n,onCancel:r}){const[s,i]=T.useState(""),[o,l]=T.useState(Cf[0]),[a,c]=T.useState(null),[u,d]=T.useState([]),[f,h]=T.useState(null),[p,m]=T.useState(1),[y,g]=T.useState(!1);T.useEffect(()=>{if(!a||a.type!=="markdown"){d([]);return}g(!0),fetch(`/api/files/${encodeURIComponent(a.name)}`).then(x=>x.json()).then(x=>{d(AL(x.content||"")),g(!1)}).catch(()=>{d([]),g(!1)})},[a]);const k=()=>{if(!s.trim()||!a)return;const x=f?{file:a.name,type:"marker",markerId:null}:{file:a.name,type:"file"};n({label:s.trim(),color:o,canvas:e,target:x,headingText:(f==null?void 0:f.text)||null})},v=w.jsx("div",{className:"anchor-dialog__steps",children:[1,2,3].map(x=>w.jsx("div",{className:`anchor-dialog__step-dot${p>=x?" anchor-dialog__step-dot--active":""}`},x))});return w.jsx("div",{className:"anchor-dialog-backdrop",onClick:r,children:w.jsxs("div",{className:"anchor-dialog",onClick:x=>x.stopPropagation(),children:[w.jsxs("div",{className:"anchor-dialog__header",children:[w.jsx("div",{className:"anchor-dialog__title",children:p===1?"创建锚点":p===2?"选择目标文件":"选择定位位置"}),v]}),p===1&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"anchor-dialog__field",children:[w.jsx("label",{children:"标签名称"}),w.jsx("input",{type:"text",value:s,onChange:x=>i(x.target.value),placeholder:"如:持仓分析",autoFocus:!0,onKeyDown:x=>{x.key==="Enter"&&s.trim()&&m(2),x.key==="Escape"&&r()}})]}),w.jsxs("div",{className:"anchor-dialog__field",children:[w.jsx("label",{children:"颜色"}),w.jsx("div",{className:"anchor-dialog__colors",children:Cf.map(x=>w.jsx("button",{className:`anchor-color-btn${o===x?" anchor-color-btn--active":""}`,style:{background:x},onClick:()=>l(x)},x))})]}),w.jsxs("div",{className:"anchor-dialog__actions",children:[w.jsx("button",{className:"anchor-dialog__btn",onClick:r,children:"取消"}),w.jsx("button",{className:"anchor-dialog__btn anchor-dialog__btn--primary",onClick:()=>m(2),disabled:!s.trim(),children:"下一步"})]})]}),p===2&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"anchor-dialog__file-list",children:[t.map(x=>w.jsxs("button",{className:`anchor-dialog__file-item${(a==null?void 0:a.name)===x.name?" anchor-dialog__file-item--active":""}`,onClick:()=>{c(x),h(null),x.type==="markdown"&&m(3)},children:[w.jsx(Ni,{type:x.type,size:18}),w.jsx("span",{className:"anchor-dialog__file-name",children:x.name})]},x.name)),t.length===0&&w.jsx("div",{className:"anchor-dialog__empty",children:"暂无文件,请先创建文档"})]}),w.jsxs("div",{className:"anchor-dialog__actions",children:[w.jsx("button",{className:"anchor-dialog__btn",onClick:()=>m(1),children:"上一步"}),w.jsx("button",{className:"anchor-dialog__btn anchor-dialog__btn--primary",onClick:k,disabled:!a||a.type==="markdown",children:"完成"})]})]}),p===3&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"anchor-dialog__heading-list",children:[w.jsxs("button",{className:`anchor-dialog__heading-item${f===null?" anchor-dialog__heading-item--active":""}`,onClick:()=>h(null),children:[w.jsx(ML,{size:13,className:"anchor-dialog__heading-icon"}),"仅关联到文档(不定位到具体位置)"]}),y?w.jsx("div",{className:"anchor-dialog__empty",children:"加载中..."}):u.map((x,S)=>w.jsxs("button",{className:`anchor-dialog__heading-item${f===x?" anchor-dialog__heading-item--active":""}`,style:{paddingLeft:12+(x.level-1)*16},onClick:()=>h(x),children:[w.jsxs("span",{className:"anchor-dialog__heading-level",children:["H",x.level]}),x.text]},S))]}),w.jsxs("div",{className:"anchor-dialog__actions",children:[w.jsx("button",{className:"anchor-dialog__btn",onClick:()=>m(2),children:"上一步"}),w.jsx("button",{className:"anchor-dialog__btn anchor-dialog__btn--primary",onClick:k,children:"完成"})]})]})]})})}const sx="canvas-file-order";function $L(){try{return JSON.parse(localStorage.getItem(sx))||[]}catch{return[]}}function jL(t){localStorage.setItem(sx,JSON.stringify(t))}function BL(t,e){if(!e.length)return t;const n=new Map(t.map(s=>[s.name,s])),r=[];for(const s of e)n.has(s)&&(r.push(n.get(s)),n.delete(s));for(const s of n.values())r.push(s);return r}function FL(){const[t,e]=T.useState(!0),[n,r]=T.useState([]),[s,i]=T.useState(null),[o,l]=T.useState(null),a=T.useRef(new Map),[c,u]=T.useState(new Set),d=T.useRef(null),f=T.useRef([]),h=T.useRef(null),[p,m]=T.useState([]),[y,g]=T.useState(null),k=T.useRef(null),v=T.useCallback(()=>fetch("/api/files").then(D=>D.json()).then(D=>r(BL(D.files||[],$L()))).catch(()=>r([])),[]),x=T.useCallback(D=>{jL(D),r(V=>{const A=new Map(V.map(I=>[I.name,I]));return D.filter(I=>A.has(I)).map(I=>A.get(I))})},[]);T.useEffect(()=>{v()},[v]),T.useEffect(()=>(pt.load().then(D=>m(D.anchors||[])),pt.subscribe(D=>m([...D.anchors||[]]))),[]),T.useEffect(()=>{if(n.length!==0){if(!s)i(n[0]);else{const D=f.current.some(A=>A.name===s.name),V=n.some(A=>A.name===s.name);D&&!V&&i(n[0])}f.current=n}},[n,s]),T.useEffect(()=>{const D=V=>{const{anchorId:A}=V.detail||{};if(!A)return;const I=pt.getById(A)||pt.getAnchors().find($=>{var U;return((U=$.target)==null?void 0:U.markerId)===A});I&&N(I)};return window.addEventListener("anchor-navigate",D),()=>window.removeEventListener("anchor-navigate",D)},[]);const S=T.useCallback((D,V)=>{a.current.set(D,V),u(new Set(a.current.keys()))},[]),b=T.useCallback(D=>{a.current.delete(D),u(new Set(a.current.keys()))},[]),C=T.useCallback(D=>a.current.get(D),[]),E=T.useCallback(D=>{D.preventDefault();const V=document.createElement("div");V.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize",document.body.appendChild(V),document.body.style.userSelect="none";const A=$=>{if(!d.current)return;const U=d.current.offsetWidth-$.clientX;l(Math.max(320,Math.min(d.current.offsetWidth*.7,U)))},I=()=>{V.remove(),document.body.style.userSelect="",document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",I)},[]),N=T.useCallback(D=>{const V=bf(h.current);V&&V.centerOn&&D.canvas&&V.centerOn(D.canvas.x,D.canvas.y);const A=document.querySelector(`.anchor-pin[data-anchor-id="${D.id}"]`);A&&(A.classList.add("anchor-pin--highlight"),setTimeout(()=>A.classList.remove("anchor-pin--highlight"),1500))},[]),P=T.useCallback(D=>{var A;if(!((A=D.target)!=null&&A.file))return;const V=n.find(I=>I.name===D.target.file);if(V&&(t||e(!0),i(V),D.target.type==="marker"&&D.target.markerId)){k.current=D.target.markerId;const I=$=>{if($<=0){k.current=null;return}window.dispatchEvent(new CustomEvent("anchor-scroll-to",{detail:{markerId:D.target.markerId}})),setTimeout(()=>{k.current&&I($-1)},200)};setTimeout(()=>I(5),100)}},[n,t]),j=T.useCallback(async(D,V)=>{await pt.update(D,V)},[]),J=T.useCallback(async D=>{var A;const V=pt.getById(D);if(await pt.remove(D),((A=V==null?void 0:V.target)==null?void 0:A.type)==="marker"&&V.target.file&&V.target.markerId){const I=V.target.file;try{let U=a.current.get(I);if(U===void 0){const ht=await fetch(`/api/files/${encodeURIComponent(I)}`);if(!ht.ok)throw new Error("read failed");U=(await ht.json()).content||""}const le=IL(U,V.target.markerId);if(le!==U){if(!(await fetch(`/api/files/${encodeURIComponent(I)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:le})})).ok)throw new Error("write failed");a.current.delete(I),u(new Set(a.current.keys())),(s==null?void 0:s.name)===I&&(i(null),setTimeout(()=>{const bt=n.find(kr=>kr.name===I);bt&&i(bt)},50))}}catch($){console.error("Failed to remove anchor marker from MD:",$)}}},[s,n]),W=T.useCallback(async D=>{try{if(!(await fetch(`/api/files/${encodeURIComponent(D.name)}`,{method:"DELETE"})).ok)throw new Error("Delete failed");const A=p.filter(I=>{var $;return(($=I.target)==null?void 0:$.file)===D.name});for(const I of A)await pt.remove(I.id);a.current.delete(D.name),u(new Set(a.current.keys())),await v()}catch(V){console.error("Failed to delete file:",V)}},[p,v]),X=T.useCallback(D=>{g({position:D})},[]),K=T.useCallback(async({label:D,color:V,canvas:A,target:I,headingText:$})=>{if(I.type==="marker"&&$&&I.file)try{const U=a.current.get(I.file);let le;if(U!==void 0)le=U;else{const ti=await fetch(`/api/files/${encodeURIComponent(I.file)}`);if(!ti.ok)throw new Error("Failed to read file");le=(await ti.json()).content||""}const ht="anc_"+Math.random().toString(36).slice(2,8),bt=OL(ht,D,V),kr=NL(le,$,bt);if(!(await fetch(`/api/files/${encodeURIComponent(I.file)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:kr})})).ok)throw new Error("Failed to write file");const vr=await pt.create({label:D,color:V,canvas:A,target:{...I,markerId:ht}});vr.id!==ht&&await pt.update(vr.id,{target:{...I,markerId:ht}}),a.current.delete(I.file),u(new Set(a.current.keys())),(s==null?void 0:s.name)===I.file&&(i(null),setTimeout(()=>{const ti=n.find(yp=>yp.name===I.file);ti&&i(ti)},50))}catch(U){console.error("Failed to create anchor marker:",U),g(null);return}else await pt.create({label:D,color:V,canvas:A,target:I});g(null)},[s,n]);return w.jsxs("div",{className:"app",ref:d,children:[w.jsxs("div",{className:"app__canvas",children:[w.jsx(LC,{ref:h}),w.jsx(_L,{anchors:p,iframeRef:h,onNavigate:P,onUpdate:j,onRemove:J,onCreateAt:X})]}),t?w.jsxs("div",{className:"app__panel",style:o?{width:o+"px",flex:"none"}:void 0,children:[w.jsx("button",{className:"panel-toggle panel-toggle--open",onClick:()=>e(!1),title:"收起文档面板",children:w.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:w.jsx("polyline",{points:"3,1 7,5 3,9"})})}),w.jsx("div",{className:"panel-resize-handle",onMouseDown:E}),w.jsx(vL,{files:n,onRefresh:v,activeFile:s,onActiveFileChange:i,dirtyFiles:c,getDirtyContent:C,updateDirtyCache:S,clearDirtyCache:b,onDelete:W,onReorder:x})]}):w.jsx("button",{className:"panel-toggle",onClick:()=>e(!0),title:"展开文档面板",children:w.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:w.jsx("polyline",{points:"7,1 3,5 7,9"})})}),y&&w.jsx(zL,{files:n,position:y.position,onConfirm:K,onCancel:()=>g(null)})]})}Vu.createRoot(document.getElementById("root")).render(w.jsx(ln.StrictMode,{children:w.jsx(FL,{})}));export{T as a,N0 as g,w as j,H1 as r};
|