/* eslint-disable */
export const editorHtml = String.raw`
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>RichTextEditor</title>
    <script type="module" crossorigin>(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function wg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var kg={exports:{}},\$a={},Sg={exports:{}},_={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ss=Symbol.for("react.element"),Kv=Symbol.for("react.portal"),qv=Symbol.for("react.fragment"),Qv=Symbol.for("react.strict_mode"),Gv=Symbol.for("react.profiler"),Yv=Symbol.for("react.provider"),Xv=Symbol.for("react.context"),Zv=Symbol.for("react.forward_ref"),ew=Symbol.for("react.suspense"),tw=Symbol.for("react.memo"),nw=Symbol.for("react.lazy"),kp=Symbol.iterator;function rw(t){return t===null||typeof t!="object"?null:(t=kp&&t[kp]||t["@@iterator"],typeof t=="function"?t:null)}var xg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Mg=Object.assign,Eg={};function Ho(t,e,n){this.props=t,this.context=e,this.refs=Eg,this.updater=n||xg}Ho.prototype.isReactComponent={};Ho.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")};Ho.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Cg(){}Cg.prototype=Ho.prototype;function _d(t,e,n){this.props=t,this.context=e,this.refs=Eg,this.updater=n||xg}var Wd=_d.prototype=new Cg;Wd.constructor=_d;Mg(Wd,Ho.prototype);Wd.isPureReactComponent=!0;var Sp=Array.isArray,Tg=Object.prototype.hasOwnProperty,Ud={current:null},Og={key:!0,ref:!0,__self:!0,__source:!0};function Ng(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)Tg.call(e,r)&&!Og.hasOwnProperty(r)&&(o[r]=e[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];o.children=a}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{\$\$typeof:ss,type:t,key:i,ref:s,props:o,_owner:Ud.current}}function ow(t,e){return{\$\$typeof:ss,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Jd(t){return typeof t=="object"&&t!==null&&t.\$\$typeof===ss}function iw(t){var e={"=":"=0",":":"=2"};return"\$"+t.replace(/[=:]/g,function(n){return e[n]})}var xp=/\/+/g;function uc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?iw(""+t.key):e.toString(36)}function Us(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(t.\$\$typeof){case ss:case Kv:s=!0}}if(s)return s=t,o=o(s),t=r===""?"."+uc(s,0):r,Sp(o)?(n="",t!=null&&(n=t.replace(xp,"\$&/")+"/"),Us(o,e,n,"",function(c){return c})):o!=null&&(Jd(o)&&(o=ow(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(xp,"\$&/")+"/")+t)),e.push(o)),1;if(s=0,r=r===""?".":r+":",Sp(t))for(var l=0;l<t.length;l++){i=t[l];var a=r+uc(i,l);s+=Us(i,e,n,a,o)}else if(a=rw(t),typeof a=="function")for(t=a.call(t),l=0;!(i=t.next()).done;)i=i.value,a=r+uc(i,l++),s+=Us(i,e,n,a,o);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 s}function gs(t,e,n){if(t==null)return t;var r=[],o=0;return Us(t,r,"","",function(i){return e.call(n,i,o++)}),r}function sw(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 Ke={current:null},Js={transition:null},lw={ReactCurrentDispatcher:Ke,ReactCurrentBatchConfig:Js,ReactCurrentOwner:Ud};_.Children={map:gs,forEach:function(t,e,n){gs(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return gs(t,function(){e++}),e},toArray:function(t){return gs(t,function(e){return e})||[]},only:function(t){if(!Jd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};_.Component=Ho;_.Fragment=qv;_.Profiler=Gv;_.PureComponent=_d;_.StrictMode=Qv;_.Suspense=ew;_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lw;_.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=Mg({},t.props),o=t.key,i=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,s=Ud.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(a in e)Tg.call(e,a)&&!Og.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:ss,type:t.type,key:o,ref:i,props:r,_owner:s}};_.createContext=function(t){return t={\$\$typeof:Xv,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={\$\$typeof:Yv,_context:t},t.Consumer=t};_.createElement=Ng;_.createFactory=function(t){var e=Ng.bind(null,t);return e.type=t,e};_.createRef=function(){return{current:null}};_.forwardRef=function(t){return{\$\$typeof:Zv,render:t}};_.isValidElement=Jd;_.lazy=function(t){return{\$\$typeof:nw,_payload:{_status:-1,_result:t},_init:sw}};_.memo=function(t,e){return{\$\$typeof:tw,type:t,compare:e===void 0?null:e}};_.startTransition=function(t){var e=Js.transition;Js.transition={};try{t()}finally{Js.transition=e}};_.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};_.useCallback=function(t,e){return Ke.current.useCallback(t,e)};_.useContext=function(t){return Ke.current.useContext(t)};_.useDebugValue=function(){};_.useDeferredValue=function(t){return Ke.current.useDeferredValue(t)};_.useEffect=function(t,e){return Ke.current.useEffect(t,e)};_.useId=function(){return Ke.current.useId()};_.useImperativeHandle=function(t,e,n){return Ke.current.useImperativeHandle(t,e,n)};_.useInsertionEffect=function(t,e){return Ke.current.useInsertionEffect(t,e)};_.useLayoutEffect=function(t,e){return Ke.current.useLayoutEffect(t,e)};_.useMemo=function(t,e){return Ke.current.useMemo(t,e)};_.useReducer=function(t,e,n){return Ke.current.useReducer(t,e,n)};_.useRef=function(t){return Ke.current.useRef(t)};_.useState=function(t){return Ke.current.useState(t)};_.useSyncExternalStore=function(t,e,n){return Ke.current.useSyncExternalStore(t,e,n)};_.useTransition=function(){return Ke.current.useTransition()};_.version="18.2.0";Sg.exports=_;var q=Sg.exports;const K=wg(q);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var aw=q,cw=Symbol.for("react.element"),uw=Symbol.for("react.fragment"),dw=Object.prototype.hasOwnProperty,fw=aw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pw={key:!0,ref:!0,__self:!0,__source:!0};function bg(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)dw.call(e,r)&&!pw.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{\$\$typeof:cw,type:t,key:i,ref:s,props:o,_owner:fw.current}}\$a.Fragment=uw;\$a.jsx=bg;\$a.jsxs=bg;kg.exports=\$a;var Ag=kg.exports,\$g={exports:{}},wt={},Ig={exports:{}},Rg={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(t){function e(b,B){var F=b.length;b.push(B);e:for(;0<F;){var te=F-1>>>1,ce=b[te];if(0<o(ce,B))b[te]=B,b[F]=ce,F=te;else break e}}function n(b){return b.length===0?null:b[0]}function r(b){if(b.length===0)return null;var B=b[0],F=b.pop();if(F!==B){b[0]=F;e:for(var te=0,ce=b.length,hs=ce>>>1;te<hs;){var cr=2*(te+1)-1,cc=b[cr],ur=cr+1,ms=b[ur];if(0>o(cc,F))ur<ce&&0>o(ms,cc)?(b[te]=ms,b[ur]=F,te=ur):(b[te]=cc,b[cr]=F,te=cr);else if(ur<ce&&0>o(ms,F))b[te]=ms,b[ur]=F,te=ur;else break e}}return B}function o(b,B){var F=b.sortIndex-B.sortIndex;return F!==0?F:b.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],c=[],u=1,d=null,f=3,p=!1,h=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(b){for(var B=n(c);B!==null;){if(B.callback===null)r(c);else if(B.startTime<=b)r(c),B.sortIndex=B.expirationTime,e(a,B);else break;B=n(c)}}function S(b){if(g=!1,w(b),!h)if(n(a)!==null)h=!0,at(x);else{var B=n(c);B!==null&&Qe(S,B.startTime-b)}}function x(b,B){h=!1,g&&(g=!1,m(T),T=-1),p=!0;var F=f;try{for(w(B),d=n(a);d!==null&&(!(d.expirationTime>B)||b&&!Z());){var te=d.callback;if(typeof te=="function"){d.callback=null,f=d.priorityLevel;var ce=te(d.expirationTime<=B);B=t.unstable_now(),typeof ce=="function"?d.callback=ce:d===n(a)&&r(a),w(B)}else r(a);d=n(a)}if(d!==null)var hs=!0;else{var cr=n(c);cr!==null&&Qe(S,cr.startTime-B),hs=!1}return hs}finally{d=null,f=F,p=!1}}var k=!1,M=null,T=-1,O=5,R=-1;function Z(){return!(t.unstable_now()-R<O)}function lt(){if(M!==null){var b=t.unstable_now();R=b;var B=!0;try{B=M(!0,b)}finally{B?St():(k=!1,M=null)}}else k=!1}var St;if(typeof y=="function")St=function(){y(lt)};else if(typeof MessageChannel<"u"){var ar=new MessageChannel,It=ar.port2;ar.port1.onmessage=lt,St=function(){It.postMessage(null)}}else St=function(){v(lt,0)};function at(b){M=b,k||(k=!0,St())}function Qe(b,B){T=v(function(){b(t.unstable_now())},B)}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(b){b.callback=null},t.unstable_continueExecution=function(){h||p||(h=!0,at(x))},t.unstable_forceFrameRate=function(b){0>b||125<b?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<b?Math.floor(1e3/b):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(a)},t.unstable_next=function(b){switch(f){case 1:case 2:case 3:var B=3;break;default:B=f}var F=f;f=B;try{return b()}finally{f=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(b,B){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var F=f;f=b;try{return B()}finally{f=F}},t.unstable_scheduleCallback=function(b,B,F){var te=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?te+F:te):F=te,b){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=F+ce,b={id:u++,callback:B,priorityLevel:b,startTime:F,expirationTime:ce,sortIndex:-1},F>te?(b.sortIndex=F,e(c,b),n(a)===null&&b===n(c)&&(g?(m(T),T=-1):g=!0,Qe(S,F-te))):(b.sortIndex=ce,e(a,b),h||p||(h=!0,at(x))),b},t.unstable_shouldYield=Z,t.unstable_wrapCallback=function(b){var B=f;return function(){var F=f;f=B;try{return b.apply(this,arguments)}finally{f=F}}}})(Rg);Ig.exports=Rg;var hw=Ig.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var mw=q,vt=hw;function C(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 Lg=new Set,\$i={};function Hr(t,e){To(t,e),To(t+"Capture",e)}function To(t,e){for(\$i[t]=e,t=0;t<e.length;t++)Lg.add(e[t])}var gn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Su=Object.prototype.hasOwnProperty,gw=/^[: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]*\$/,Mp={},Ep={};function yw(t){return Su.call(Ep,t)?!0:Su.call(Mp,t)?!1:gw.test(t)?Ep[t]=!0:(Mp[t]=!0,!1)}function vw(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 ww(t,e,n,r){if(e===null||typeof e>"u"||vw(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 qe(t,e,n,r,o,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var Ae={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ae[t]=new qe(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ae[e]=new qe(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ae[t]=new qe(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ae[t]=new qe(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){Ae[t]=new qe(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ae[t]=new qe(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ae[t]=new qe(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ae[t]=new qe(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ae[t]=new qe(t,5,!1,t.toLowerCase(),null,!1,!1)});var Kd=/[\-:]([a-z])/g;function qd(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(Kd,qd);Ae[e]=new qe(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(Kd,qd);Ae[e]=new qe(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(Kd,qd);Ae[e]=new qe(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ae[t]=new qe(t,1,!1,t.toLowerCase(),null,!1,!1)});Ae.xlinkHref=new qe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ae[t]=new qe(t,1,!1,t.toLowerCase(),null,!0,!0)});function Qd(t,e,n,r){var o=Ae.hasOwnProperty(e)?Ae[e]:null;(o!==null?o.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(ww(e,n,o,r)&&(n=null),r||o===null?yw(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):o.mustUseProperty?t[o.propertyName]=n===null?o.type===3?!1:"":n:(e=o.attributeName,r=o.attributeNamespace,n===null?t.removeAttribute(e):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Sn=mw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ys=Symbol.for("react.element"),eo=Symbol.for("react.portal"),to=Symbol.for("react.fragment"),Gd=Symbol.for("react.strict_mode"),xu=Symbol.for("react.profiler"),Pg=Symbol.for("react.provider"),Dg=Symbol.for("react.context"),Yd=Symbol.for("react.forward_ref"),Mu=Symbol.for("react.suspense"),Eu=Symbol.for("react.suspense_list"),Xd=Symbol.for("react.memo"),Cn=Symbol.for("react.lazy"),zg=Symbol.for("react.offscreen"),Cp=Symbol.iterator;function Jo(t){return t===null||typeof t!="object"?null:(t=Cp&&t[Cp]||t["@@iterator"],typeof t=="function"?t:null)}var le=Object.assign,dc;function ri(t){if(dc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);dc=e&&e[1]||""}return\`
\`+dc+t}var fc=!1;function pc(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 o=c.stack.split(\`
\`),i=r.stack.split(\`
\`),s=o.length-1,l=i.length-1;1<=s&&0<=l&&o[s]!==i[l];)l--;for(;1<=s&&0<=l;s--,l--)if(o[s]!==i[l]){if(s!==1||l!==1)do if(s--,l--,0>l||o[s]!==i[l]){var a=\`
\`+o[s].replace(" at new "," at ");return t.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{fc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ri(t):""}function kw(t){switch(t.tag){case 5:return ri(t.type);case 16:return ri("Lazy");case 13:return ri("Suspense");case 19:return ri("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function Cu(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 to:return"Fragment";case eo:return"Portal";case xu:return"Profiler";case Gd:return"StrictMode";case Mu:return"Suspense";case Eu:return"SuspenseList"}if(typeof t=="object")switch(t.\$\$typeof){case Dg:return(t.displayName||"Context")+".Consumer";case Pg:return(t._context.displayName||"Context")+".Provider";case Yd:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Xd:return e=t.displayName||null,e!==null?e:Cu(t.type)||"Memo";case Cn:e=t._payload,t=t._init;try{return Cu(t(e))}catch{}}return null}function Sw(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 Cu(e);case 8:return e===Gd?"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 Yn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Bg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function xw(t){var e=Bg(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 o=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function vs(t){t._valueTracker||(t._valueTracker=xw(t))}function Fg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Bg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ul(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 Tu(t,e){var n=e.checked;return le({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Tp(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Yn(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 jg(t,e){e=e.checked,e!=null&&Qd(t,"checked",e,!1)}function Ou(t,e){jg(t,e);var n=Yn(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")?Nu(t,e.type,n):e.hasOwnProperty("defaultValue")&&Nu(t,e.type,Yn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Op(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 Nu(t,e,n){(e!=="number"||ul(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var oi=Array.isArray;function mo(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o<n.length;o++)e["\$"+n[o]]=!0;for(n=0;n<t.length;n++)o=e.hasOwnProperty("\$"+t[n].value),t[n].selected!==o&&(t[n].selected=o),o&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Yn(n),e=null,o=0;o<t.length;o++){if(t[o].value===n){t[o].selected=!0,r&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function bu(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(C(91));return le({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Np(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(C(92));if(oi(n)){if(1<n.length)throw Error(C(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Yn(n)}}function Hg(t,e){var n=Yn(e.value),r=Yn(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 bp(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Vg(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 Au(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Vg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var ws,_g=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,o){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(ws=ws||document.createElement("div"),ws.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=ws.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ii(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var pi={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},Mw=["Webkit","ms","Moz","O"];Object.keys(pi).forEach(function(t){Mw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),pi[e]=pi[t]})});function Wg(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||pi.hasOwnProperty(t)&&pi[t]?(""+e).trim():e+"px"}function Ug(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Wg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var Ew=le({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 \$u(t,e){if(e){if(Ew[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(C(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(C(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(C(61))}if(e.style!=null&&typeof e.style!="object")throw Error(C(62))}}function Iu(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 Ru=null;function Zd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Lu=null,go=null,yo=null;function Ap(t){if(t=cs(t)){if(typeof Lu!="function")throw Error(C(280));var e=t.stateNode;e&&(e=Da(e),Lu(t.stateNode,t.type,e))}}function Jg(t){go?yo?yo.push(t):yo=[t]:go=t}function Kg(){if(go){var t=go,e=yo;if(yo=go=null,Ap(t),e)for(t=0;t<e.length;t++)Ap(e[t])}}function qg(t,e){return t(e)}function Qg(){}var hc=!1;function Gg(t,e,n){if(hc)return t(e,n);hc=!0;try{return qg(t,e,n)}finally{hc=!1,(go!==null||yo!==null)&&(Qg(),Kg())}}function Ri(t,e){var n=t.stateNode;if(n===null)return null;var r=Da(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(C(231,e,typeof n));return n}var Pu=!1;if(gn)try{var Ko={};Object.defineProperty(Ko,"passive",{get:function(){Pu=!0}}),window.addEventListener("test",Ko,Ko),window.removeEventListener("test",Ko,Ko)}catch{Pu=!1}function Cw(t,e,n,r,o,i,s,l,a){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var hi=!1,dl=null,fl=!1,Du=null,Tw={onError:function(t){hi=!0,dl=t}};function Ow(t,e,n,r,o,i,s,l,a){hi=!1,dl=null,Cw.apply(Tw,arguments)}function Nw(t,e,n,r,o,i,s,l,a){if(Ow.apply(this,arguments),hi){if(hi){var c=dl;hi=!1,dl=null}else throw Error(C(198));fl||(fl=!0,Du=c)}}function Vr(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 Yg(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 \$p(t){if(Vr(t)!==t)throw Error(C(188))}function bw(t){var e=t.alternate;if(!e){if(e=Vr(t),e===null)throw Error(C(188));return e!==t?null:t}for(var n=t,r=e;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return \$p(o),t;if(i===r)return \$p(o),e;i=i.sibling}throw Error(C(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(C(189))}}if(n.alternate!==r)throw Error(C(190))}if(n.tag!==3)throw Error(C(188));return n.stateNode.current===n?t:e}function Xg(t){return t=bw(t),t!==null?Zg(t):null}function Zg(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Zg(t);if(e!==null)return e;t=t.sibling}return null}var e0=vt.unstable_scheduleCallback,Ip=vt.unstable_cancelCallback,Aw=vt.unstable_shouldYield,\$w=vt.unstable_requestPaint,fe=vt.unstable_now,Iw=vt.unstable_getCurrentPriorityLevel,ef=vt.unstable_ImmediatePriority,t0=vt.unstable_UserBlockingPriority,pl=vt.unstable_NormalPriority,Rw=vt.unstable_LowPriority,n0=vt.unstable_IdlePriority,Ia=null,tn=null;function Lw(t){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Ia,t,void 0,(t.current.flags&128)===128)}catch{}}var jt=Math.clz32?Math.clz32:zw,Pw=Math.log,Dw=Math.LN2;function zw(t){return t>>>=0,t===0?32:31-(Pw(t)/Dw|0)|0}var ks=64,Ss=4194304;function ii(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 hl(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=ii(l):(i&=s,i!==0&&(r=ii(i)))}else s=n&~o,s!==0?r=ii(s):i!==0&&(r=ii(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&o)&&(o=r&-r,i=e&-e,o>=i||o===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-jt(e),o=1<<n,r|=t[n],e&=~o;return r}function Bw(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 Fw(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var s=31-jt(i),l=1<<s,a=o[s];a===-1?(!(l&n)||l&r)&&(o[s]=Bw(l,e)):a<=e&&(t.expiredLanes|=l),i&=~l}}function zu(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function r0(){var t=ks;return ks<<=1,!(ks&4194240)&&(ks=64),t}function mc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function ls(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-jt(e),t[e]=n}function jw(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 o=31-jt(n),i=1<<o;e[o]=0,r[o]=-1,t[o]=-1,n&=~i}}function tf(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-jt(n),o=1<<r;o&e|t[r]&e&&(t[r]|=e),n&=~o}}var U=0;function o0(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var i0,nf,s0,l0,a0,Bu=!1,xs=[],Fn=null,jn=null,Hn=null,Li=new Map,Pi=new Map,An=[],Hw="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 Rp(t,e){switch(t){case"focusin":case"focusout":Fn=null;break;case"dragenter":case"dragleave":jn=null;break;case"mouseover":case"mouseout":Hn=null;break;case"pointerover":case"pointerout":Li.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pi.delete(e.pointerId)}}function qo(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},e!==null&&(e=cs(e),e!==null&&nf(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function Vw(t,e,n,r,o){switch(e){case"focusin":return Fn=qo(Fn,t,e,n,r,o),!0;case"dragenter":return jn=qo(jn,t,e,n,r,o),!0;case"mouseover":return Hn=qo(Hn,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return Li.set(i,qo(Li.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Pi.set(i,qo(Pi.get(i)||null,t,e,n,r,o)),!0}return!1}function c0(t){var e=hr(t.target);if(e!==null){var n=Vr(e);if(n!==null){if(e=n.tag,e===13){if(e=Yg(n),e!==null){t.blockedOn=e,a0(t.priority,function(){s0(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 Ks(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Fu(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Ru=r,n.target.dispatchEvent(r),Ru=null}else return e=cs(n),e!==null&&nf(e),t.blockedOn=n,!1;e.shift()}return!0}function Lp(t,e,n){Ks(t)&&n.delete(e)}function _w(){Bu=!1,Fn!==null&&Ks(Fn)&&(Fn=null),jn!==null&&Ks(jn)&&(jn=null),Hn!==null&&Ks(Hn)&&(Hn=null),Li.forEach(Lp),Pi.forEach(Lp)}function Qo(t,e){t.blockedOn===e&&(t.blockedOn=null,Bu||(Bu=!0,vt.unstable_scheduleCallback(vt.unstable_NormalPriority,_w)))}function Di(t){function e(o){return Qo(o,t)}if(0<xs.length){Qo(xs[0],t);for(var n=1;n<xs.length;n++){var r=xs[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Fn!==null&&Qo(Fn,t),jn!==null&&Qo(jn,t),Hn!==null&&Qo(Hn,t),Li.forEach(e),Pi.forEach(e),n=0;n<An.length;n++)r=An[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<An.length&&(n=An[0],n.blockedOn===null);)c0(n),n.blockedOn===null&&An.shift()}var vo=Sn.ReactCurrentBatchConfig,ml=!0;function Ww(t,e,n,r){var o=U,i=vo.transition;vo.transition=null;try{U=1,rf(t,e,n,r)}finally{U=o,vo.transition=i}}function Uw(t,e,n,r){var o=U,i=vo.transition;vo.transition=null;try{U=4,rf(t,e,n,r)}finally{U=o,vo.transition=i}}function rf(t,e,n,r){if(ml){var o=Fu(t,e,n,r);if(o===null)Cc(t,e,r,gl,n),Rp(t,r);else if(Vw(o,t,e,n,r))r.stopPropagation();else if(Rp(t,r),e&4&&-1<Hw.indexOf(t)){for(;o!==null;){var i=cs(o);if(i!==null&&i0(i),i=Fu(t,e,n,r),i===null&&Cc(t,e,r,gl,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Cc(t,e,r,null,n)}}var gl=null;function Fu(t,e,n,r){if(gl=null,t=Zd(r),t=hr(t),t!==null)if(e=Vr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Yg(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 gl=t,null}function u0(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(Iw()){case ef:return 1;case t0:return 4;case pl:case Rw:return 16;case n0:return 536870912;default:return 16}default:return 16}}var Ln=null,of=null,qs=null;function d0(){if(qs)return qs;var t,e=of,n=e.length,r,o="value"in Ln?Ln.value:Ln.textContent,i=o.length;for(t=0;t<n&&e[t]===o[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===o[i-r];r++);return qs=o.slice(t,1<r?1-r:void 0)}function Qs(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 Ms(){return!0}function Pp(){return!1}function kt(t){function e(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,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)?Ms:Pp,this.isPropagationStopped=Pp,this}return le(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=Ms)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ms)},persist:function(){},isPersistent:Ms}),e}var Vo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sf=kt(Vo),as=le({},Vo,{view:0,detail:0}),Jw=kt(as),gc,yc,Go,Ra=le({},as,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lf,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!==Go&&(Go&&t.type==="mousemove"?(gc=t.screenX-Go.screenX,yc=t.screenY-Go.screenY):yc=gc=0,Go=t),gc)},movementY:function(t){return"movementY"in t?t.movementY:yc}}),Dp=kt(Ra),Kw=le({},Ra,{dataTransfer:0}),qw=kt(Kw),Qw=le({},as,{relatedTarget:0}),vc=kt(Qw),Gw=le({},Vo,{animationName:0,elapsedTime:0,pseudoElement:0}),Yw=kt(Gw),Xw=le({},Vo,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Zw=kt(Xw),ek=le({},Vo,{data:0}),zp=kt(ek),tk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nk={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"},rk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ok(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=rk[t])?!!e[t]:!1}function lf(){return ok}var ik=le({},as,{key:function(t){if(t.key){var e=tk[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Qs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?nk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lf,charCode:function(t){return t.type==="keypress"?Qs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Qs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),sk=kt(ik),lk=le({},Ra,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bp=kt(lk),ak=le({},as,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lf}),ck=kt(ak),uk=le({},Vo,{propertyName:0,elapsedTime:0,pseudoElement:0}),dk=kt(uk),fk=le({},Ra,{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}),pk=kt(fk),hk=[9,13,27,32],af=gn&&"CompositionEvent"in window,mi=null;gn&&"documentMode"in document&&(mi=document.documentMode);var mk=gn&&"TextEvent"in window&&!mi,f0=gn&&(!af||mi&&8<mi&&11>=mi),Fp=" ",jp=!1;function p0(t,e){switch(t){case"keyup":return hk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function h0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var no=!1;function gk(t,e){switch(t){case"compositionend":return h0(e);case"keypress":return e.which!==32?null:(jp=!0,Fp);case"textInput":return t=e.data,t===Fp&&jp?null:t;default:return null}}function yk(t,e){if(no)return t==="compositionend"||!af&&p0(t,e)?(t=d0(),qs=of=Ln=null,no=!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 f0&&e.locale!=="ko"?null:e.data;default:return null}}var vk={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 Hp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!vk[t.type]:e==="textarea"}function m0(t,e,n,r){Jg(r),e=yl(e,"onChange"),0<e.length&&(n=new sf("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var gi=null,zi=null;function wk(t){T0(t,0)}function La(t){var e=io(t);if(Fg(e))return t}function kk(t,e){if(t==="change")return e}var g0=!1;if(gn){var wc;if(gn){var kc="oninput"in document;if(!kc){var Vp=document.createElement("div");Vp.setAttribute("oninput","return;"),kc=typeof Vp.oninput=="function"}wc=kc}else wc=!1;g0=wc&&(!document.documentMode||9<document.documentMode)}function _p(){gi&&(gi.detachEvent("onpropertychange",y0),zi=gi=null)}function y0(t){if(t.propertyName==="value"&&La(zi)){var e=[];m0(e,zi,t,Zd(t)),Gg(wk,e)}}function Sk(t,e,n){t==="focusin"?(_p(),gi=e,zi=n,gi.attachEvent("onpropertychange",y0)):t==="focusout"&&_p()}function xk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return La(zi)}function Mk(t,e){if(t==="click")return La(e)}function Ek(t,e){if(t==="input"||t==="change")return La(e)}function Ck(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _t=typeof Object.is=="function"?Object.is:Ck;function Bi(t,e){if(_t(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 o=n[r];if(!Su.call(e,o)||!_t(t[o],e[o]))return!1}return!0}function Wp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Up(t,e){var n=Wp(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=Wp(n)}}function v0(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?v0(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function w0(){for(var t=window,e=ul();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ul(t.document)}return e}function cf(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 Tk(t){var e=w0(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&v0(n.ownerDocument.documentElement,n)){if(r!==null&&cf(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 o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!t.extend&&i>r&&(o=r,r=i,i=o),o=Up(n,i);var s=Up(n,r);o&&s&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.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 Ok=gn&&"documentMode"in document&&11>=document.documentMode,ro=null,ju=null,yi=null,Hu=!1;function Jp(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hu||ro==null||ro!==ul(r)||(r=ro,"selectionStart"in r&&cf(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}),yi&&Bi(yi,r)||(yi=r,r=yl(ju,"onSelect"),0<r.length&&(e=new sf("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ro)))}function Es(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var oo={animationend:Es("Animation","AnimationEnd"),animationiteration:Es("Animation","AnimationIteration"),animationstart:Es("Animation","AnimationStart"),transitionend:Es("Transition","TransitionEnd")},Sc={},k0={};gn&&(k0=document.createElement("div").style,"AnimationEvent"in window||(delete oo.animationend.animation,delete oo.animationiteration.animation,delete oo.animationstart.animation),"TransitionEvent"in window||delete oo.transitionend.transition);function Pa(t){if(Sc[t])return Sc[t];if(!oo[t])return t;var e=oo[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in k0)return Sc[t]=e[n];return t}var S0=Pa("animationend"),x0=Pa("animationiteration"),M0=Pa("animationstart"),E0=Pa("transitionend"),C0=new Map,Kp="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 tr(t,e){C0.set(t,e),Hr(e,[t])}for(var xc=0;xc<Kp.length;xc++){var Mc=Kp[xc],Nk=Mc.toLowerCase(),bk=Mc[0].toUpperCase()+Mc.slice(1);tr(Nk,"on"+bk)}tr(S0,"onAnimationEnd");tr(x0,"onAnimationIteration");tr(M0,"onAnimationStart");tr("dblclick","onDoubleClick");tr("focusin","onFocus");tr("focusout","onBlur");tr(E0,"onTransitionEnd");To("onMouseEnter",["mouseout","mouseover"]);To("onMouseLeave",["mouseout","mouseover"]);To("onPointerEnter",["pointerout","pointerover"]);To("onPointerLeave",["pointerout","pointerover"]);Hr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Hr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Hr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Hr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Hr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Hr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var si="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(" "),Ak=new Set("cancel close invalid load scroll toggle".split(" ").concat(si));function qp(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,Nw(r,e,void 0,t),t.currentTarget=null}function T0(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],o=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var l=r[s],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==i&&o.isPropagationStopped())break e;qp(o,l,c),i=a}else for(s=0;s<r.length;s++){if(l=r[s],a=l.instance,c=l.currentTarget,l=l.listener,a!==i&&o.isPropagationStopped())break e;qp(o,l,c),i=a}}}if(fl)throw t=Du,fl=!1,Du=null,t}function G(t,e){var n=e[Ju];n===void 0&&(n=e[Ju]=new Set);var r=t+"__bubble";n.has(r)||(O0(e,t,2,!1),n.add(r))}function Ec(t,e,n){var r=0;e&&(r|=4),O0(n,t,r,e)}var Cs="_reactListening"+Math.random().toString(36).slice(2);function Fi(t){if(!t[Cs]){t[Cs]=!0,Lg.forEach(function(n){n!=="selectionchange"&&(Ak.has(n)||Ec(n,!1,t),Ec(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Cs]||(e[Cs]=!0,Ec("selectionchange",!1,e))}}function O0(t,e,n,r){switch(u0(e)){case 1:var o=Ww;break;case 4:o=Uw;break;default:o=rf}n=o.bind(null,e,n,t),o=void 0,!Pu||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),r?o!==void 0?t.addEventListener(e,n,{capture:!0,passive:o}):t.addEventListener(e,n,!0):o!==void 0?t.addEventListener(e,n,{passive:o}):t.addEventListener(e,n,!1)}function Cc(t,e,n,r,o){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var a=s.tag;if((a===3||a===4)&&(a=s.stateNode.containerInfo,a===o||a.nodeType===8&&a.parentNode===o))return;s=s.return}for(;l!==null;){if(s=hr(l),s===null)return;if(a=s.tag,a===5||a===6){r=i=s;continue e}l=l.parentNode}}r=r.return}Gg(function(){var c=i,u=Zd(n),d=[];e:{var f=C0.get(t);if(f!==void 0){var p=sf,h=t;switch(t){case"keypress":if(Qs(n)===0)break e;case"keydown":case"keyup":p=sk;break;case"focusin":h="focus",p=vc;break;case"focusout":h="blur",p=vc;break;case"beforeblur":case"afterblur":p=vc;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":p=Dp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=qw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=ck;break;case S0:case x0:case M0:p=Yw;break;case E0:p=dk;break;case"scroll":p=Jw;break;case"wheel":p=pk;break;case"copy":case"cut":case"paste":p=Zw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Bp}var g=(e&4)!==0,v=!g&&t==="scroll",m=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,w;y!==null;){w=y;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,m!==null&&(S=Ri(y,m),S!=null&&g.push(ji(y,S,w)))),v)break;y=y.return}0<g.length&&(f=new p(f,h,null,n,u),d.push({event:f,listeners:g}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&n!==Ru&&(h=n.relatedTarget||n.fromElement)&&(hr(h)||h[yn]))break e;if((p||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=n.relatedTarget||n.toElement,p=c,h=h?hr(h):null,h!==null&&(v=Vr(h),h!==v||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=c),p!==h)){if(g=Dp,S="onMouseLeave",m="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(g=Bp,S="onPointerLeave",m="onPointerEnter",y="pointer"),v=p==null?f:io(p),w=h==null?f:io(h),f=new g(S,y+"leave",p,n,u),f.target=v,f.relatedTarget=w,S=null,hr(u)===c&&(g=new g(m,y+"enter",h,n,u),g.target=w,g.relatedTarget=v,S=g),v=S,p&&h)t:{for(g=p,m=h,y=0,w=g;w;w=Wr(w))y++;for(w=0,S=m;S;S=Wr(S))w++;for(;0<y-w;)g=Wr(g),y--;for(;0<w-y;)m=Wr(m),w--;for(;y--;){if(g===m||m!==null&&g===m.alternate)break t;g=Wr(g),m=Wr(m)}g=null}else g=null;p!==null&&Qp(d,f,p,g,!1),h!==null&&v!==null&&Qp(d,v,h,g,!0)}}e:{if(f=c?io(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var x=kk;else if(Hp(f))if(g0)x=Ek;else{x=xk;var k=Sk}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(x=Mk);if(x&&(x=x(t,c))){m0(d,x,n,u);break e}k&&k(t,f,c),t==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&Nu(f,"number",f.value)}switch(k=c?io(c):window,t){case"focusin":(Hp(k)||k.contentEditable==="true")&&(ro=k,ju=c,yi=null);break;case"focusout":yi=ju=ro=null;break;case"mousedown":Hu=!0;break;case"contextmenu":case"mouseup":case"dragend":Hu=!1,Jp(d,n,u);break;case"selectionchange":if(Ok)break;case"keydown":case"keyup":Jp(d,n,u)}var M;if(af)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else no?p0(t,n)&&(T="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(f0&&n.locale!=="ko"&&(no||T!=="onCompositionStart"?T==="onCompositionEnd"&&no&&(M=d0()):(Ln=u,of="value"in Ln?Ln.value:Ln.textContent,no=!0)),k=yl(c,T),0<k.length&&(T=new zp(T,t,null,n,u),d.push({event:T,listeners:k}),M?T.data=M:(M=h0(n),M!==null&&(T.data=M)))),(M=mk?gk(t,n):yk(t,n))&&(c=yl(c,"onBeforeInput"),0<c.length&&(u=new zp("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=M))}T0(d,e)})}function ji(t,e,n){return{instance:t,listener:e,currentTarget:n}}function yl(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Ri(t,n),i!=null&&r.unshift(ji(t,i,o)),i=Ri(t,e),i!=null&&r.push(ji(t,i,o))),t=t.return}return r}function Wr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Qp(t,e,n,r,o){for(var i=e._reactName,s=[];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,o?(a=Ri(n,i),a!=null&&s.unshift(ji(n,a,l))):o||(a=Ri(n,i),a!=null&&s.push(ji(n,a,l)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var \$k=/\r\n?/g,Ik=/\u0000|\uFFFD/g;function Gp(t){return(typeof t=="string"?t:""+t).replace(\$k,\`
\`).replace(Ik,"")}function Ts(t,e,n){if(e=Gp(e),Gp(t)!==e&&n)throw Error(C(425))}function vl(){}var Vu=null,_u=null;function Wu(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 Uu=typeof setTimeout=="function"?setTimeout:void 0,Rk=typeof clearTimeout=="function"?clearTimeout:void 0,Yp=typeof Promise=="function"?Promise:void 0,Lk=typeof queueMicrotask=="function"?queueMicrotask:typeof Yp<"u"?function(t){return Yp.resolve(null).then(t).catch(Pk)}:Uu;function Pk(t){setTimeout(function(){throw t})}function Tc(t,e){var n=e,r=0;do{var o=n.nextSibling;if(t.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/\$"){if(r===0){t.removeChild(o),Di(e);return}r--}else n!=="\$"&&n!=="\$?"&&n!=="\$!"||r++;n=o}while(n);Di(e)}function Vn(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 Xp(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 _o=Math.random().toString(36).slice(2),Yt="__reactFiber\$"+_o,Hi="__reactProps\$"+_o,yn="__reactContainer\$"+_o,Ju="__reactEvents\$"+_o,Dk="__reactListeners\$"+_o,zk="__reactHandles\$"+_o;function hr(t){var e=t[Yt];if(e)return e;for(var n=t.parentNode;n;){if(e=n[yn]||n[Yt]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Xp(t);t!==null;){if(n=t[Yt])return n;t=Xp(t)}return e}t=n,n=t.parentNode}return null}function cs(t){return t=t[Yt]||t[yn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function io(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(C(33))}function Da(t){return t[Hi]||null}var Ku=[],so=-1;function nr(t){return{current:t}}function Y(t){0>so||(t.current=Ku[so],Ku[so]=null,so--)}function Q(t,e){so++,Ku[so]=t.current,t.current=e}var Xn={},ze=nr(Xn),et=nr(!1),Ir=Xn;function Oo(t,e){var n=t.type.contextTypes;if(!n)return Xn;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function tt(t){return t=t.childContextTypes,t!=null}function wl(){Y(et),Y(ze)}function Zp(t,e,n){if(ze.current!==Xn)throw Error(C(168));Q(ze,e),Q(et,n)}function N0(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error(C(108,Sw(t)||"Unknown",o));return le({},n,r)}function kl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Xn,Ir=ze.current,Q(ze,t),Q(et,et.current),!0}function eh(t,e,n){var r=t.stateNode;if(!r)throw Error(C(169));n?(t=N0(t,e,Ir),r.__reactInternalMemoizedMergedChildContext=t,Y(et),Y(ze),Q(ze,t)):Y(et),Q(et,n)}var dn=null,za=!1,Oc=!1;function b0(t){dn===null?dn=[t]:dn.push(t)}function Bk(t){za=!0,b0(t)}function rr(){if(!Oc&&dn!==null){Oc=!0;var t=0,e=U;try{var n=dn;for(U=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}dn=null,za=!1}catch(o){throw dn!==null&&(dn=dn.slice(t+1)),e0(ef,rr),o}finally{U=e,Oc=!1}}return null}var lo=[],ao=0,Sl=null,xl=0,Ct=[],Tt=0,Rr=null,fn=1,pn="";function dr(t,e){lo[ao++]=xl,lo[ao++]=Sl,Sl=t,xl=e}function A0(t,e,n){Ct[Tt++]=fn,Ct[Tt++]=pn,Ct[Tt++]=Rr,Rr=t;var r=fn;t=pn;var o=32-jt(r)-1;r&=~(1<<o),n+=1;var i=32-jt(e)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,fn=1<<32-jt(e)+o|n<<o|r,pn=i+t}else fn=1<<i|n<<o|r,pn=t}function uf(t){t.return!==null&&(dr(t,1),A0(t,1,0))}function df(t){for(;t===Sl;)Sl=lo[--ao],lo[ao]=null,xl=lo[--ao],lo[ao]=null;for(;t===Rr;)Rr=Ct[--Tt],Ct[Tt]=null,pn=Ct[--Tt],Ct[Tt]=null,fn=Ct[--Tt],Ct[Tt]=null}var yt=null,mt=null,ee=!1,Dt=null;function \$0(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 th(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,yt=t,mt=Vn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,yt=t,mt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Rr!==null?{id:fn,overflow:pn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Ot(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,yt=t,mt=null,!0):!1;default:return!1}}function qu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Qu(t){if(ee){var e=mt;if(e){var n=e;if(!th(t,e)){if(qu(t))throw Error(C(418));e=Vn(n.nextSibling);var r=yt;e&&th(t,e)?\$0(r,n):(t.flags=t.flags&-4097|2,ee=!1,yt=t)}}else{if(qu(t))throw Error(C(418));t.flags=t.flags&-4097|2,ee=!1,yt=t}}}function nh(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;yt=t}function Os(t){if(t!==yt)return!1;if(!ee)return nh(t),ee=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Wu(t.type,t.memoizedProps)),e&&(e=mt)){if(qu(t))throw I0(),Error(C(418));for(;e;)\$0(t,e),e=Vn(e.nextSibling)}if(nh(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(C(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/\$"){if(e===0){mt=Vn(t.nextSibling);break e}e--}else n!=="\$"&&n!=="\$!"&&n!=="\$?"||e++}t=t.nextSibling}mt=null}}else mt=yt?Vn(t.stateNode.nextSibling):null;return!0}function I0(){for(var t=mt;t;)t=Vn(t.nextSibling)}function No(){mt=yt=null,ee=!1}function ff(t){Dt===null?Dt=[t]:Dt.push(t)}var Fk=Sn.ReactCurrentBatchConfig;function Yo(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(C(309));var r=n.stateNode}if(!r)throw Error(C(147,t));var o=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(s){var l=o.refs;s===null?delete l[i]:l[i]=s},e._stringRef=i,e)}if(typeof t!="string")throw Error(C(284));if(!n._owner)throw Error(C(290,t))}return t}function Ns(t,e){throw t=Object.prototype.toString.call(e),Error(C(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function rh(t){var e=t._init;return e(t._payload)}function R0(t){function e(m,y){if(t){var w=m.deletions;w===null?(m.deletions=[y],m.flags|=16):w.push(y)}}function n(m,y){if(!t)return null;for(;y!==null;)e(m,y),y=y.sibling;return null}function r(m,y){for(m=new Map;y!==null;)y.key!==null?m.set(y.key,y):m.set(y.index,y),y=y.sibling;return m}function o(m,y){return m=Jn(m,y),m.index=0,m.sibling=null,m}function i(m,y,w){return m.index=w,t?(w=m.alternate,w!==null?(w=w.index,w<y?(m.flags|=2,y):w):(m.flags|=2,y)):(m.flags|=1048576,y)}function s(m){return t&&m.alternate===null&&(m.flags|=2),m}function l(m,y,w,S){return y===null||y.tag!==6?(y=Lc(w,m.mode,S),y.return=m,y):(y=o(y,w),y.return=m,y)}function a(m,y,w,S){var x=w.type;return x===to?u(m,y,w.props.children,S,w.key):y!==null&&(y.elementType===x||typeof x=="object"&&x!==null&&x.\$\$typeof===Cn&&rh(x)===y.type)?(S=o(y,w.props),S.ref=Yo(m,y,w),S.return=m,S):(S=nl(w.type,w.key,w.props,null,m.mode,S),S.ref=Yo(m,y,w),S.return=m,S)}function c(m,y,w,S){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=Pc(w,m.mode,S),y.return=m,y):(y=o(y,w.children||[]),y.return=m,y)}function u(m,y,w,S,x){return y===null||y.tag!==7?(y=Tr(w,m.mode,S,x),y.return=m,y):(y=o(y,w),y.return=m,y)}function d(m,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Lc(""+y,m.mode,w),y.return=m,y;if(typeof y=="object"&&y!==null){switch(y.\$\$typeof){case ys:return w=nl(y.type,y.key,y.props,null,m.mode,w),w.ref=Yo(m,null,y),w.return=m,w;case eo:return y=Pc(y,m.mode,w),y.return=m,y;case Cn:var S=y._init;return d(m,S(y._payload),w)}if(oi(y)||Jo(y))return y=Tr(y,m.mode,w,null),y.return=m,y;Ns(m,y)}return null}function f(m,y,w,S){var x=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return x!==null?null:l(m,y,""+w,S);if(typeof w=="object"&&w!==null){switch(w.\$\$typeof){case ys:return w.key===x?a(m,y,w,S):null;case eo:return w.key===x?c(m,y,w,S):null;case Cn:return x=w._init,f(m,y,x(w._payload),S)}if(oi(w)||Jo(w))return x!==null?null:u(m,y,w,S,null);Ns(m,w)}return null}function p(m,y,w,S,x){if(typeof S=="string"&&S!==""||typeof S=="number")return m=m.get(w)||null,l(y,m,""+S,x);if(typeof S=="object"&&S!==null){switch(S.\$\$typeof){case ys:return m=m.get(S.key===null?w:S.key)||null,a(y,m,S,x);case eo:return m=m.get(S.key===null?w:S.key)||null,c(y,m,S,x);case Cn:var k=S._init;return p(m,y,w,k(S._payload),x)}if(oi(S)||Jo(S))return m=m.get(w)||null,u(y,m,S,x,null);Ns(y,S)}return null}function h(m,y,w,S){for(var x=null,k=null,M=y,T=y=0,O=null;M!==null&&T<w.length;T++){M.index>T?(O=M,M=null):O=M.sibling;var R=f(m,M,w[T],S);if(R===null){M===null&&(M=O);break}t&&M&&R.alternate===null&&e(m,M),y=i(R,y,T),k===null?x=R:k.sibling=R,k=R,M=O}if(T===w.length)return n(m,M),ee&&dr(m,T),x;if(M===null){for(;T<w.length;T++)M=d(m,w[T],S),M!==null&&(y=i(M,y,T),k===null?x=M:k.sibling=M,k=M);return ee&&dr(m,T),x}for(M=r(m,M);T<w.length;T++)O=p(M,m,T,w[T],S),O!==null&&(t&&O.alternate!==null&&M.delete(O.key===null?T:O.key),y=i(O,y,T),k===null?x=O:k.sibling=O,k=O);return t&&M.forEach(function(Z){return e(m,Z)}),ee&&dr(m,T),x}function g(m,y,w,S){var x=Jo(w);if(typeof x!="function")throw Error(C(150));if(w=x.call(w),w==null)throw Error(C(151));for(var k=x=null,M=y,T=y=0,O=null,R=w.next();M!==null&&!R.done;T++,R=w.next()){M.index>T?(O=M,M=null):O=M.sibling;var Z=f(m,M,R.value,S);if(Z===null){M===null&&(M=O);break}t&&M&&Z.alternate===null&&e(m,M),y=i(Z,y,T),k===null?x=Z:k.sibling=Z,k=Z,M=O}if(R.done)return n(m,M),ee&&dr(m,T),x;if(M===null){for(;!R.done;T++,R=w.next())R=d(m,R.value,S),R!==null&&(y=i(R,y,T),k===null?x=R:k.sibling=R,k=R);return ee&&dr(m,T),x}for(M=r(m,M);!R.done;T++,R=w.next())R=p(M,m,T,R.value,S),R!==null&&(t&&R.alternate!==null&&M.delete(R.key===null?T:R.key),y=i(R,y,T),k===null?x=R:k.sibling=R,k=R);return t&&M.forEach(function(lt){return e(m,lt)}),ee&&dr(m,T),x}function v(m,y,w,S){if(typeof w=="object"&&w!==null&&w.type===to&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.\$\$typeof){case ys:e:{for(var x=w.key,k=y;k!==null;){if(k.key===x){if(x=w.type,x===to){if(k.tag===7){n(m,k.sibling),y=o(k,w.props.children),y.return=m,m=y;break e}}else if(k.elementType===x||typeof x=="object"&&x!==null&&x.\$\$typeof===Cn&&rh(x)===k.type){n(m,k.sibling),y=o(k,w.props),y.ref=Yo(m,k,w),y.return=m,m=y;break e}n(m,k);break}else e(m,k);k=k.sibling}w.type===to?(y=Tr(w.props.children,m.mode,S,w.key),y.return=m,m=y):(S=nl(w.type,w.key,w.props,null,m.mode,S),S.ref=Yo(m,y,w),S.return=m,m=S)}return s(m);case eo:e:{for(k=w.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(m,y.sibling),y=o(y,w.children||[]),y.return=m,m=y;break e}else{n(m,y);break}else e(m,y);y=y.sibling}y=Pc(w,m.mode,S),y.return=m,m=y}return s(m);case Cn:return k=w._init,v(m,y,k(w._payload),S)}if(oi(w))return h(m,y,w,S);if(Jo(w))return g(m,y,w,S);Ns(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(m,y.sibling),y=o(y,w),y.return=m,m=y):(n(m,y),y=Lc(w,m.mode,S),y.return=m,m=y),s(m)):n(m,y)}return v}var bo=R0(!0),L0=R0(!1),Ml=nr(null),El=null,co=null,pf=null;function hf(){pf=co=El=null}function mf(t){var e=Ml.current;Y(Ml),t._currentValue=e}function Gu(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 wo(t,e){El=t,pf=co=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Xe=!0),t.firstContext=null)}function At(t){var e=t._currentValue;if(pf!==t)if(t={context:t,memoizedValue:e,next:null},co===null){if(El===null)throw Error(C(308));co=t,El.dependencies={lanes:0,firstContext:t}}else co=co.next=t;return e}var mr=null;function gf(t){mr===null?mr=[t]:mr.push(t)}function P0(t,e,n,r){var o=e.interleaved;return o===null?(n.next=n,gf(e)):(n.next=o.next,o.next=n),e.interleaved=n,vn(t,r)}function vn(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 Tn=!1;function yf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function D0(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 hn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function _n(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var o=r.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),r.pending=e,vn(t,n)}return o=r.interleaved,o===null?(e.next=e,gf(r)):(e.next=o.next,o.next=e),r.interleaved=e,vn(t,n)}function Gs(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,tf(t,n)}}function oh(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,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 Cl(t,e,n,r){var o=t.updateQueue;Tn=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var a=l,c=a.next;a.next=null,s===null?i=c:s.next=c,s=a;var u=t.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==s&&(l===null?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=a))}if(i!==null){var d=o.baseState;s=0,u=c=a=null,l=i;do{var f=l.lane,p=l.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var h=t,g=l;switch(f=e,p=n,g.tag){case 1:if(h=g.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=le({},d,f);break e;case 2:Tn=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(c=u=p,a=d):u=u.next=p,s|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;f=l,l=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(u===null&&(a=d),o.baseState=a,o.firstBaseUpdate=c,o.lastBaseUpdate=u,e=o.shared.interleaved,e!==null){o=e;do s|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);Pr|=s,t.lanes=s,t.memoizedState=d}}function ih(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(C(191,o));o.call(r)}}}var us={},nn=nr(us),Vi=nr(us),_i=nr(us);function gr(t){if(t===us)throw Error(C(174));return t}function vf(t,e){switch(Q(_i,e),Q(Vi,t),Q(nn,us),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Au(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Au(e,t)}Y(nn),Q(nn,e)}function Ao(){Y(nn),Y(Vi),Y(_i)}function z0(t){gr(_i.current);var e=gr(nn.current),n=Au(e,t.type);e!==n&&(Q(Vi,t),Q(nn,n))}function wf(t){Vi.current===t&&(Y(nn),Y(Vi))}var re=nr(0);function Tl(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 Nc=[];function kf(){for(var t=0;t<Nc.length;t++)Nc[t]._workInProgressVersionPrimary=null;Nc.length=0}var Ys=Sn.ReactCurrentDispatcher,bc=Sn.ReactCurrentBatchConfig,Lr=0,se=null,ye=null,ke=null,Ol=!1,vi=!1,Wi=0,jk=0;function Ie(){throw Error(C(321))}function Sf(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!_t(t[n],e[n]))return!1;return!0}function xf(t,e,n,r,o,i){if(Lr=i,se=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ys.current=t===null||t.memoizedState===null?Wk:Uk,t=n(r,o),vi){i=0;do{if(vi=!1,Wi=0,25<=i)throw Error(C(301));i+=1,ke=ye=null,e.updateQueue=null,Ys.current=Jk,t=n(r,o)}while(vi)}if(Ys.current=Nl,e=ye!==null&&ye.next!==null,Lr=0,ke=ye=se=null,Ol=!1,e)throw Error(C(300));return t}function Mf(){var t=Wi!==0;return Wi=0,t}function Jt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ke===null?se.memoizedState=ke=t:ke=ke.next=t,ke}function \$t(){if(ye===null){var t=se.alternate;t=t!==null?t.memoizedState:null}else t=ye.next;var e=ke===null?se.memoizedState:ke.next;if(e!==null)ke=e,ye=t;else{if(t===null)throw Error(C(310));ye=t,t={memoizedState:ye.memoizedState,baseState:ye.baseState,baseQueue:ye.baseQueue,queue:ye.queue,next:null},ke===null?se.memoizedState=ke=t:ke=ke.next=t}return ke}function Ui(t,e){return typeof e=="function"?e(t):e}function Ac(t){var e=\$t(),n=e.queue;if(n===null)throw Error(C(311));n.lastRenderedReducer=t;var r=ye,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var l=s=null,a=null,c=i;do{var u=c.lane;if((Lr&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,s=r):a=a.next=d,se.lanes|=u,Pr|=u}c=c.next}while(c!==null&&c!==i);a===null?s=r:a.next=l,_t(r,e.memoizedState)||(Xe=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=a,n.lastRenderedState=r}if(t=n.interleaved,t!==null){o=t;do i=o.lane,se.lanes|=i,Pr|=i,o=o.next;while(o!==t)}else o===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function \$c(t){var e=\$t(),n=e.queue;if(n===null)throw Error(C(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);_t(i,e.memoizedState)||(Xe=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function B0(){}function F0(t,e){var n=se,r=\$t(),o=e(),i=!_t(r.memoizedState,o);if(i&&(r.memoizedState=o,Xe=!0),r=r.queue,Ef(V0.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||ke!==null&&ke.memoizedState.tag&1){if(n.flags|=2048,Ji(9,H0.bind(null,n,r,o,e),void 0,null),Se===null)throw Error(C(349));Lr&30||j0(n,e,o)}return o}function j0(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=se.updateQueue,e===null?(e={lastEffect:null,stores:null},se.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function H0(t,e,n,r){e.value=n,e.getSnapshot=r,_0(e)&&W0(t)}function V0(t,e,n){return n(function(){_0(e)&&W0(t)})}function _0(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_t(t,n)}catch{return!0}}function W0(t){var e=vn(t,1);e!==null&&Ht(e,t,1,-1)}function sh(t){var e=Jt();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:t},e.queue=t,t=t.dispatch=_k.bind(null,se,t),[e.memoizedState,t]}function Ji(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=se.updateQueue,e===null?(e={lastEffect:null,stores:null},se.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 U0(){return \$t().memoizedState}function Xs(t,e,n,r){var o=Jt();se.flags|=t,o.memoizedState=Ji(1|e,n,void 0,r===void 0?null:r)}function Ba(t,e,n,r){var o=\$t();r=r===void 0?null:r;var i=void 0;if(ye!==null){var s=ye.memoizedState;if(i=s.destroy,r!==null&&Sf(r,s.deps)){o.memoizedState=Ji(e,n,i,r);return}}se.flags|=t,o.memoizedState=Ji(1|e,n,i,r)}function lh(t,e){return Xs(8390656,8,t,e)}function Ef(t,e){return Ba(2048,8,t,e)}function J0(t,e){return Ba(4,2,t,e)}function K0(t,e){return Ba(4,4,t,e)}function q0(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 Q0(t,e,n){return n=n!=null?n.concat([t]):null,Ba(4,4,q0.bind(null,e,t),n)}function Cf(){}function G0(t,e){var n=\$t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Sf(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Y0(t,e){var n=\$t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Sf(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function X0(t,e,n){return Lr&21?(_t(n,e)||(n=r0(),se.lanes|=n,Pr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Xe=!0),t.memoizedState=n)}function Hk(t,e){var n=U;U=n!==0&&4>n?n:4,t(!0);var r=bc.transition;bc.transition={};try{t(!1),e()}finally{U=n,bc.transition=r}}function Z0(){return \$t().memoizedState}function Vk(t,e,n){var r=Un(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ey(t))ty(e,n);else if(n=P0(t,e,n,r),n!==null){var o=_e();Ht(n,t,r,o),ny(n,e,r)}}function _k(t,e,n){var r=Un(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ey(t))ty(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,_t(l,s)){var a=e.interleaved;a===null?(o.next=o,gf(e)):(o.next=a.next,a.next=o),e.interleaved=o;return}}catch{}finally{}n=P0(t,e,o,r),n!==null&&(o=_e(),Ht(n,t,r,o),ny(n,e,r))}}function ey(t){var e=t.alternate;return t===se||e!==null&&e===se}function ty(t,e){vi=Ol=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function ny(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,tf(t,n)}}var Nl={readContext:At,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useInsertionEffect:Ie,useLayoutEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useMutableSource:Ie,useSyncExternalStore:Ie,useId:Ie,unstable_isNewReconciler:!1},Wk={readContext:At,useCallback:function(t,e){return Jt().memoizedState=[t,e===void 0?null:e],t},useContext:At,useEffect:lh,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Xs(4194308,4,q0.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Xs(4194308,4,t,e)},useInsertionEffect:function(t,e){return Xs(4,2,t,e)},useMemo:function(t,e){var n=Jt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Jt();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=Vk.bind(null,se,t),[r.memoizedState,t]},useRef:function(t){var e=Jt();return t={current:t},e.memoizedState=t},useState:sh,useDebugValue:Cf,useDeferredValue:function(t){return Jt().memoizedState=t},useTransition:function(){var t=sh(!1),e=t[0];return t=Hk.bind(null,t[1]),Jt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=se,o=Jt();if(ee){if(n===void 0)throw Error(C(407));n=n()}else{if(n=e(),Se===null)throw Error(C(349));Lr&30||j0(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,lh(V0.bind(null,r,i,t),[t]),r.flags|=2048,Ji(9,H0.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Jt(),e=Se.identifierPrefix;if(ee){var n=pn,r=fn;n=(r&~(1<<32-jt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Wi++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=jk++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Uk={readContext:At,useCallback:G0,useContext:At,useEffect:Ef,useImperativeHandle:Q0,useInsertionEffect:J0,useLayoutEffect:K0,useMemo:Y0,useReducer:Ac,useRef:U0,useState:function(){return Ac(Ui)},useDebugValue:Cf,useDeferredValue:function(t){var e=\$t();return X0(e,ye.memoizedState,t)},useTransition:function(){var t=Ac(Ui)[0],e=\$t().memoizedState;return[t,e]},useMutableSource:B0,useSyncExternalStore:F0,useId:Z0,unstable_isNewReconciler:!1},Jk={readContext:At,useCallback:G0,useContext:At,useEffect:Ef,useImperativeHandle:Q0,useInsertionEffect:J0,useLayoutEffect:K0,useMemo:Y0,useReducer:\$c,useRef:U0,useState:function(){return \$c(Ui)},useDebugValue:Cf,useDeferredValue:function(t){var e=\$t();return ye===null?e.memoizedState=t:X0(e,ye.memoizedState,t)},useTransition:function(){var t=\$c(Ui)[0],e=\$t().memoizedState;return[t,e]},useMutableSource:B0,useSyncExternalStore:F0,useId:Z0,unstable_isNewReconciler:!1};function Lt(t,e){if(t&&t.defaultProps){e=le({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Yu(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:le({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Fa={isMounted:function(t){return(t=t._reactInternals)?Vr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=_e(),o=Un(t),i=hn(r,o);i.payload=e,n!=null&&(i.callback=n),e=_n(t,i,o),e!==null&&(Ht(e,t,o,r),Gs(e,t,o))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=_e(),o=Un(t),i=hn(r,o);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=_n(t,i,o),e!==null&&(Ht(e,t,o,r),Gs(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=_e(),r=Un(t),o=hn(n,r);o.tag=2,e!=null&&(o.callback=e),e=_n(t,o,r),e!==null&&(Ht(e,t,r,n),Gs(e,t,r))}};function ah(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!Bi(n,r)||!Bi(o,i):!0}function ry(t,e,n){var r=!1,o=Xn,i=e.contextType;return typeof i=="object"&&i!==null?i=At(i):(o=tt(e)?Ir:ze.current,r=e.contextTypes,i=(r=r!=null)?Oo(t,o):Xn),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Fa,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function ch(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&&Fa.enqueueReplaceState(e,e.state,null)}function Xu(t,e,n,r){var o=t.stateNode;o.props=n,o.state=t.memoizedState,o.refs={},yf(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=At(i):(i=tt(e)?Ir:ze.current,o.context=Oo(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Yu(t,e,i,n),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&Fa.enqueueReplaceState(o,o.state,null),Cl(t,n,o,r),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function \$o(t,e){try{var n="",r=e;do n+=kw(r),r=r.return;while(r);var o=n}catch(i){o=\`
Error generating stack: \`+i.message+\`
\`+i.stack}return{value:t,source:e,stack:o,digest:null}}function Ic(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Zu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Kk=typeof WeakMap=="function"?WeakMap:Map;function oy(t,e,n){n=hn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Al||(Al=!0,cd=r),Zu(t,e)},n}function iy(t,e,n){n=hn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return r(o)},n.callback=function(){Zu(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Zu(t,e),typeof r!="function"&&(Wn===null?Wn=new Set([this]):Wn.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function uh(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Kk;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(o.add(n),t=lS.bind(null,t,e,n),e.then(t,t))}function dh(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 fh(t,e,n,r,o){return t.mode&1?(t.flags|=65536,t.lanes=o,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=hn(-1,1),e.tag=2,_n(n,e,1))),n.lanes|=1),t)}var qk=Sn.ReactCurrentOwner,Xe=!1;function He(t,e,n,r){e.child=t===null?L0(e,null,n,r):bo(e,t.child,n,r)}function ph(t,e,n,r,o){n=n.render;var i=e.ref;return wo(e,o),r=xf(t,e,n,r,i,o),n=Mf(),t!==null&&!Xe?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,wn(t,e,o)):(ee&&n&&uf(e),e.flags|=1,He(t,e,r,o),e.child)}function hh(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!Rf(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,sy(t,e,i,r,o)):(t=nl(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Bi,n(s,r)&&t.ref===e.ref)return wn(t,e,o)}return e.flags|=1,t=Jn(i,r),t.ref=e.ref,t.return=e,e.child=t}function sy(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(Bi(i,r)&&t.ref===e.ref)if(Xe=!1,e.pendingProps=r=i,(t.lanes&o)!==0)t.flags&131072&&(Xe=!0);else return e.lanes=t.lanes,wn(t,e,o)}return ed(t,e,n,r,o)}function ly(t,e,n){var r=e.pendingProps,o=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Q(fo,ct),ct|=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,Q(fo,ct),ct|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Q(fo,ct),ct|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Q(fo,ct),ct|=r;return He(t,e,o,n),e.child}function ay(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function ed(t,e,n,r,o){var i=tt(n)?Ir:ze.current;return i=Oo(e,i),wo(e,o),n=xf(t,e,n,r,i,o),r=Mf(),t!==null&&!Xe?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,wn(t,e,o)):(ee&&r&&uf(e),e.flags|=1,He(t,e,n,o),e.child)}function mh(t,e,n,r,o){if(tt(n)){var i=!0;kl(e)}else i=!1;if(wo(e,o),e.stateNode===null)Zs(t,e),ry(e,n,r),Xu(e,n,r,o),r=!0;else if(t===null){var s=e.stateNode,l=e.memoizedProps;s.props=l;var a=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=At(c):(c=tt(n)?Ir:ze.current,c=Oo(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||a!==c)&&ch(e,s,r,c),Tn=!1;var f=e.memoizedState;s.state=f,Cl(e,r,s,o),a=e.memoizedState,l!==r||f!==a||et.current||Tn?(typeof u=="function"&&(Yu(e,n,u,r),a=e.memoizedState),(l=Tn||ah(e,n,l,r,f,a,c))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=a),s.props=r,s.state=a,s.context=c,r=l):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,D0(t,e),l=e.memoizedProps,c=e.type===e.elementType?l:Lt(e.type,l),s.props=c,d=e.pendingProps,f=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=At(a):(a=tt(n)?Ir:ze.current,a=Oo(e,a));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==d||f!==a)&&ch(e,s,r,a),Tn=!1,f=e.memoizedState,s.state=f,Cl(e,r,s,o);var h=e.memoizedState;l!==d||f!==h||et.current||Tn?(typeof p=="function"&&(Yu(e,n,p,r),h=e.memoizedState),(c=Tn||ah(e,n,c,r,f,h,a)||!1)?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,h,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,h,a)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),s.props=r,s.state=h,s.context=a,r=c):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return td(t,e,n,r,i,o)}function td(t,e,n,r,o,i){ay(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return o&&eh(e,n,!1),wn(t,e,i);r=e.stateNode,qk.current=e;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=bo(e,t.child,null,i),e.child=bo(e,null,l,i)):He(t,e,l,i),e.memoizedState=r.state,o&&eh(e,n,!0),e.child}function cy(t){var e=t.stateNode;e.pendingContext?Zp(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Zp(t,e.context,!1),vf(t,e.containerInfo)}function gh(t,e,n,r,o){return No(),ff(o),e.flags|=256,He(t,e,n,r),e.child}var nd={dehydrated:null,treeContext:null,retryLane:0};function rd(t){return{baseLanes:t,cachePool:null,transitions:null}}function uy(t,e,n){var r=e.pendingProps,o=re.current,i=!1,s=(e.flags&128)!==0,l;if((l=s)||(l=t!==null&&t.memoizedState===null?!1:(o&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),Q(re,o&1),t===null)return Qu(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):(s=r.children,t=r.fallback,i?(r=e.mode,i=e.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Va(s,r,0,null),t=Tr(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=rd(n),e.memoizedState=nd,t):Tf(e,s));if(o=t.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return Qk(t,e,s,r,l,o,n);if(i){i=r.fallback,s=e.mode,o=t.child,l=o.sibling;var a={mode:"hidden",children:r.children};return!(s&1)&&e.child!==o?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=Jn(o,a),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=Jn(l,i):(i=Tr(i,s,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,s=t.child.memoizedState,s=s===null?rd(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=t.childLanes&~n,e.memoizedState=nd,r}return i=t.child,t=i.sibling,r=Jn(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 Tf(t,e){return e=Va({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function bs(t,e,n,r){return r!==null&&ff(r),bo(e,t.child,null,n),t=Tf(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Qk(t,e,n,r,o,i,s){if(n)return e.flags&256?(e.flags&=-257,r=Ic(Error(C(422))),bs(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,o=e.mode,r=Va({mode:"visible",children:r.children},o,0,null),i=Tr(i,o,s,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&bo(e,t.child,null,s),e.child.memoizedState=rd(s),e.memoizedState=nd,i);if(!(e.mode&1))return bs(t,e,s,null);if(o.data==="\$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(C(419)),r=Ic(i,r,void 0),bs(t,e,s,r)}if(l=(s&t.childLanes)!==0,Xe||l){if(r=Se,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,vn(t,o),Ht(r,t,o,-1))}return If(),r=Ic(Error(C(421))),bs(t,e,s,r)}return o.data==="\$?"?(e.flags|=128,e.child=t.child,e=aS.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,mt=Vn(o.nextSibling),yt=e,ee=!0,Dt=null,t!==null&&(Ct[Tt++]=fn,Ct[Tt++]=pn,Ct[Tt++]=Rr,fn=t.id,pn=t.overflow,Rr=e),e=Tf(e,r.children),e.flags|=4096,e)}function yh(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Gu(t.return,e,n)}function Rc(t,e,n,r,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function dy(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(He(t,e,r.children,n),r=re.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&&yh(t,n,e);else if(t.tag===19)yh(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(Q(re,r),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(n=e.child,o=null;n!==null;)t=n.alternate,t!==null&&Tl(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Rc(e,!1,o,n,i);break;case"backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&Tl(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Rc(e,!0,n,null,i);break;case"together":Rc(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Zs(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function wn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Pr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(C(153));if(e.child!==null){for(t=e.child,n=Jn(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Jn(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Gk(t,e,n){switch(e.tag){case 3:cy(e),No();break;case 5:z0(e);break;case 1:tt(e.type)&&kl(e);break;case 4:vf(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,o=e.memoizedProps.value;Q(Ml,r._currentValue),r._currentValue=o;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Q(re,re.current&1),e.flags|=128,null):n&e.child.childLanes?uy(t,e,n):(Q(re,re.current&1),t=wn(t,e,n),t!==null?t.sibling:null);Q(re,re.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return dy(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Q(re,re.current),r)break;return null;case 22:case 23:return e.lanes=0,ly(t,e,n)}return wn(t,e,n)}var fy,od,py,hy;fy=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}};od=function(){};py=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,gr(nn.current);var i=null;switch(n){case"input":o=Tu(t,o),r=Tu(t,r),i=[];break;case"select":o=le({},o,{value:void 0}),r=le({},r,{value:void 0}),i=[];break;case"textarea":o=bu(t,o),r=bu(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=vl)}\$u(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var l=o[c];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(\$i.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var a=r[c];if(l=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(s in l)!l.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in a)a.hasOwnProperty(s)&&l[s]!==a[s]&&(n||(n={}),n[s]=a[s])}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"&&(\$i.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&G("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)}};hy=function(t,e,n,r){n!==r&&(e.flags|=4)};function Xo(t,e){if(!ee)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 Re(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function Yk(t,e,n){var r=e.pendingProps;switch(df(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Re(e),null;case 1:return tt(e.type)&&wl(),Re(e),null;case 3:return r=e.stateNode,Ao(),Y(et),Y(ze),kf(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Os(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Dt!==null&&(fd(Dt),Dt=null))),od(t,e),Re(e),null;case 5:wf(e);var o=gr(_i.current);if(n=e.type,t!==null&&e.stateNode!=null)py(t,e,n,r,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(C(166));return Re(e),null}if(t=gr(nn.current),Os(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Yt]=e,r[Hi]=i,t=(e.mode&1)!==0,n){case"dialog":G("cancel",r),G("close",r);break;case"iframe":case"object":case"embed":G("load",r);break;case"video":case"audio":for(o=0;o<si.length;o++)G(si[o],r);break;case"source":G("error",r);break;case"img":case"image":case"link":G("error",r),G("load",r);break;case"details":G("toggle",r);break;case"input":Tp(r,i),G("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},G("invalid",r);break;case"textarea":Np(r,i),G("invalid",r)}\$u(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Ts(r.textContent,l,t),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Ts(r.textContent,l,t),o=["children",""+l]):\$i.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&G("scroll",r)}switch(n){case"input":vs(r),Op(r,i,!0);break;case"textarea":vs(r),bp(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=vl)}r=o,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Vg(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Yt]=e,t[Hi]=r,fy(t,e,!1,!1),e.stateNode=t;e:{switch(s=Iu(n,r),n){case"dialog":G("cancel",t),G("close",t),o=r;break;case"iframe":case"object":case"embed":G("load",t),o=r;break;case"video":case"audio":for(o=0;o<si.length;o++)G(si[o],t);o=r;break;case"source":G("error",t),o=r;break;case"img":case"image":case"link":G("error",t),G("load",t),o=r;break;case"details":G("toggle",t),o=r;break;case"input":Tp(t,r),o=Tu(t,r),G("invalid",t);break;case"option":o=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},o=le({},r,{value:void 0}),G("invalid",t);break;case"textarea":Np(t,r),o=bu(t,r),G("invalid",t);break;default:o=r}\$u(n,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?Ug(t,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&_g(t,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Ii(t,a):typeof a=="number"&&Ii(t,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(\$i.hasOwnProperty(i)?a!=null&&i==="onScroll"&&G("scroll",t):a!=null&&Qd(t,i,a,s))}switch(n){case"input":vs(t),Op(t,r,!1);break;case"textarea":vs(t),bp(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Yn(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?mo(t,!!r.multiple,i,!1):r.defaultValue!=null&&mo(t,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=vl)}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 Re(e),null;case 6:if(t&&e.stateNode!=null)hy(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(C(166));if(n=gr(_i.current),gr(nn.current),Os(e)){if(r=e.stateNode,n=e.memoizedProps,r[Yt]=e,(i=r.nodeValue!==n)&&(t=yt,t!==null))switch(t.tag){case 3:Ts(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Ts(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Yt]=e,e.stateNode=r}return Re(e),null;case 13:if(Y(re),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ee&&mt!==null&&e.mode&1&&!(e.flags&128))I0(),No(),e.flags|=98560,i=!1;else if(i=Os(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(C(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(C(317));i[Yt]=e}else No(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Re(e),i=!1}else Dt!==null&&(fd(Dt),Dt=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||re.current&1?ve===0&&(ve=3):If())),e.updateQueue!==null&&(e.flags|=4),Re(e),null);case 4:return Ao(),od(t,e),t===null&&Fi(e.stateNode.containerInfo),Re(e),null;case 10:return mf(e.type._context),Re(e),null;case 17:return tt(e.type)&&wl(),Re(e),null;case 19:if(Y(re),i=e.memoizedState,i===null)return Re(e),null;if(r=(e.flags&128)!==0,s=i.rendering,s===null)if(r)Xo(i,!1);else{if(ve!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=Tl(t),s!==null){for(e.flags|=128,Xo(i,!1),r=s.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,s=i.alternate,s===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=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,t=s.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Q(re,re.current&1|2),e.child}t=t.sibling}i.tail!==null&&fe()>Io&&(e.flags|=128,r=!0,Xo(i,!1),e.lanes=4194304)}else{if(!r)if(t=Tl(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Xo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!ee)return Re(e),null}else 2*fe()-i.renderingStartTime>Io&&n!==1073741824&&(e.flags|=128,r=!0,Xo(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=fe(),e.sibling=null,n=re.current,Q(re,r?n&1|2:n&1),e):(Re(e),null);case 22:case 23:return \$f(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ct&1073741824&&(Re(e),e.subtreeFlags&6&&(e.flags|=8192)):Re(e),null;case 24:return null;case 25:return null}throw Error(C(156,e.tag))}function Xk(t,e){switch(df(e),e.tag){case 1:return tt(e.type)&&wl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ao(),Y(et),Y(ze),kf(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return wf(e),null;case 13:if(Y(re),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(C(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Y(re),null;case 4:return Ao(),null;case 10:return mf(e.type._context),null;case 22:case 23:return \$f(),null;case 24:return null;default:return null}}var As=!1,Pe=!1,Zk=typeof WeakSet=="function"?WeakSet:Set,\$=null;function uo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ue(t,e,r)}else n.current=null}function id(t,e,n){try{n()}catch(r){ue(t,e,r)}}var vh=!1;function eS(t,e){if(Vu=ml,t=w0(),cf(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 o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,a=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(l=s+o),d!==i||r!==0&&d.nodeType!==3||(a=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++c===o&&(l=s),f===i&&++u===r&&(a=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(_u={focusedElem:t,selectionRange:n},ml=!1,\$=e;\$!==null;)if(e=\$,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,\$=t;else for(;\$!==null;){e=\$;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,v=h.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?g:Lt(e.type,g),v);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(C(163))}}catch(S){ue(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,\$=t;break}\$=e.return}return h=vh,vh=!1,h}function wi(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&id(e,n,i)}o=o.next}while(o!==r)}}function ja(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 sd(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 my(t){var e=t.alternate;e!==null&&(t.alternate=null,my(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Yt],delete e[Hi],delete e[Ju],delete e[Dk],delete e[zk])),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 gy(t){return t.tag===5||t.tag===3||t.tag===4}function wh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||gy(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 ld(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=vl));else if(r!==4&&(t=t.child,t!==null))for(ld(t,e,n),t=t.sibling;t!==null;)ld(t,e,n),t=t.sibling}function ad(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(ad(t,e,n),t=t.sibling;t!==null;)ad(t,e,n),t=t.sibling}var Ce=null,Pt=!1;function xn(t,e,n){for(n=n.child;n!==null;)yy(t,e,n),n=n.sibling}function yy(t,e,n){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Ia,n)}catch{}switch(n.tag){case 5:Pe||uo(n,e);case 6:var r=Ce,o=Pt;Ce=null,xn(t,e,n),Ce=r,Pt=o,Ce!==null&&(Pt?(t=Ce,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ce.removeChild(n.stateNode));break;case 18:Ce!==null&&(Pt?(t=Ce,n=n.stateNode,t.nodeType===8?Tc(t.parentNode,n):t.nodeType===1&&Tc(t,n),Di(t)):Tc(Ce,n.stateNode));break;case 4:r=Ce,o=Pt,Ce=n.stateNode.containerInfo,Pt=!0,xn(t,e,n),Ce=r,Pt=o;break;case 0:case 11:case 14:case 15:if(!Pe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&id(n,e,s),o=o.next}while(o!==r)}xn(t,e,n);break;case 1:if(!Pe&&(uo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ue(n,e,l)}xn(t,e,n);break;case 21:xn(t,e,n);break;case 22:n.mode&1?(Pe=(r=Pe)||n.memoizedState!==null,xn(t,e,n),Pe=r):xn(t,e,n);break;default:xn(t,e,n)}}function kh(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Zk),e.forEach(function(r){var o=cS.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Rt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=t,s=e,l=s;e:for(;l!==null;){switch(l.tag){case 5:Ce=l.stateNode,Pt=!1;break e;case 3:Ce=l.stateNode.containerInfo,Pt=!0;break e;case 4:Ce=l.stateNode.containerInfo,Pt=!0;break e}l=l.return}if(Ce===null)throw Error(C(160));yy(i,s,o),Ce=null,Pt=!1;var a=o.alternate;a!==null&&(a.return=null),o.return=null}catch(c){ue(o,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)vy(e,t),e=e.sibling}function vy(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Rt(e,t),Ut(t),r&4){try{wi(3,t,t.return),ja(3,t)}catch(g){ue(t,t.return,g)}try{wi(5,t,t.return)}catch(g){ue(t,t.return,g)}}break;case 1:Rt(e,t),Ut(t),r&512&&n!==null&&uo(n,n.return);break;case 5:if(Rt(e,t),Ut(t),r&512&&n!==null&&uo(n,n.return),t.flags&32){var o=t.stateNode;try{Ii(o,"")}catch(g){ue(t,t.return,g)}}if(r&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,s=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&&jg(o,i),Iu(l,s);var c=Iu(l,i);for(s=0;s<a.length;s+=2){var u=a[s],d=a[s+1];u==="style"?Ug(o,d):u==="dangerouslySetInnerHTML"?_g(o,d):u==="children"?Ii(o,d):Qd(o,u,d,c)}switch(l){case"input":Ou(o,i);break;case"textarea":Hg(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?mo(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?mo(o,!!i.multiple,i.defaultValue,!0):mo(o,!!i.multiple,i.multiple?[]:"",!1))}o[Hi]=i}catch(g){ue(t,t.return,g)}}break;case 6:if(Rt(e,t),Ut(t),r&4){if(t.stateNode===null)throw Error(C(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(g){ue(t,t.return,g)}}break;case 3:if(Rt(e,t),Ut(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Di(e.containerInfo)}catch(g){ue(t,t.return,g)}break;case 4:Rt(e,t),Ut(t);break;case 13:Rt(e,t),Ut(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(bf=fe())),r&4&&kh(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(Pe=(c=Pe)||u,Rt(e,t),Pe=c):Rt(e,t),Ut(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=\$,p=f.child,f.tag){case 0:case 11:case 14:case 15:wi(4,f,f.return);break;case 1:uo(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(g){ue(r,n,g)}}break;case 5:uo(f,f.return);break;case 22:if(f.memoizedState!==null){xh(d);continue}}p!==null?(p.return=f,\$=p):xh(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{o=d.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,a=d.memoizedProps.style,s=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=Wg("display",s))}catch(g){ue(t,t.return,g)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(g){ue(t,t.return,g)}}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:Rt(e,t),Ut(t),r&4&&kh(t);break;case 21:break;default:Rt(e,t),Ut(t)}}function Ut(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(gy(n)){var r=n;break e}n=n.return}throw Error(C(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Ii(o,""),r.flags&=-33);var i=wh(t);ad(t,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,l=wh(t);ld(t,l,s);break;default:throw Error(C(161))}}catch(a){ue(t,t.return,a)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function tS(t,e,n){\$=t,wy(t)}function wy(t,e,n){for(var r=(t.mode&1)!==0;\$!==null;){var o=\$,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||As;if(!s){var l=o.alternate,a=l!==null&&l.memoizedState!==null||Pe;l=As;var c=Pe;if(As=s,(Pe=a)&&!c)for(\$=o;\$!==null;)s=\$,a=s.child,s.tag===22&&s.memoizedState!==null?Mh(o):a!==null?(a.return=s,\$=a):Mh(o);for(;i!==null;)\$=i,wy(i),i=i.sibling;\$=o,As=l,Pe=c}Sh(t)}else o.subtreeFlags&8772&&i!==null?(i.return=o,\$=i):Sh(t)}}function Sh(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:Pe||ja(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Pe)if(n===null)r.componentDidMount();else{var o=e.elementType===e.type?n.memoizedProps:Lt(e.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&ih(e,i,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}ih(e,s,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&&Di(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(C(163))}Pe||e.flags&512&&sd(e)}catch(f){ue(e,e.return,f)}}if(e===t){\$=null;break}if(n=e.sibling,n!==null){n.return=e.return,\$=n;break}\$=e.return}}function xh(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 Mh(t){for(;\$!==null;){var e=\$;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{ja(4,e)}catch(a){ue(e,n,a)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var o=e.return;try{r.componentDidMount()}catch(a){ue(e,o,a)}}var i=e.return;try{sd(e)}catch(a){ue(e,i,a)}break;case 5:var s=e.return;try{sd(e)}catch(a){ue(e,s,a)}}}catch(a){ue(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 nS=Math.ceil,bl=Sn.ReactCurrentDispatcher,Of=Sn.ReactCurrentOwner,Nt=Sn.ReactCurrentBatchConfig,W=0,Se=null,he=null,be=0,ct=0,fo=nr(0),ve=0,Ki=null,Pr=0,Ha=0,Nf=0,ki=null,Ge=null,bf=0,Io=1/0,cn=null,Al=!1,cd=null,Wn=null,\$s=!1,Pn=null,\$l=0,Si=0,ud=null,el=-1,tl=0;function _e(){return W&6?fe():el!==-1?el:el=fe()}function Un(t){return t.mode&1?W&2&&be!==0?be&-be:Fk.transition!==null?(tl===0&&(tl=r0()),tl):(t=U,t!==0||(t=window.event,t=t===void 0?16:u0(t.type)),t):1}function Ht(t,e,n,r){if(50<Si)throw Si=0,ud=null,Error(C(185));ls(t,n,r),(!(W&2)||t!==Se)&&(t===Se&&(!(W&2)&&(Ha|=n),ve===4&&\$n(t,be)),nt(t,r),n===1&&W===0&&!(e.mode&1)&&(Io=fe()+500,za&&rr()))}function nt(t,e){var n=t.callbackNode;Fw(t,e);var r=hl(t,t===Se?be:0);if(r===0)n!==null&&Ip(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Ip(n),e===1)t.tag===0?Bk(Eh.bind(null,t)):b0(Eh.bind(null,t)),Lk(function(){!(W&6)&&rr()}),n=null;else{switch(o0(r)){case 1:n=ef;break;case 4:n=t0;break;case 16:n=pl;break;case 536870912:n=n0;break;default:n=pl}n=Oy(n,ky.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function ky(t,e){if(el=-1,tl=0,W&6)throw Error(C(327));var n=t.callbackNode;if(ko()&&t.callbackNode!==n)return null;var r=hl(t,t===Se?be:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Il(t,r);else{e=r;var o=W;W|=2;var i=xy();(Se!==t||be!==e)&&(cn=null,Io=fe()+500,Cr(t,e));do try{iS();break}catch(l){Sy(t,l)}while(!0);hf(),bl.current=i,W=o,he!==null?e=0:(Se=null,be=0,e=ve)}if(e!==0){if(e===2&&(o=zu(t),o!==0&&(r=o,e=dd(t,o))),e===1)throw n=Ki,Cr(t,0),\$n(t,r),nt(t,fe()),n;if(e===6)\$n(t,r);else{if(o=t.current.alternate,!(r&30)&&!rS(o)&&(e=Il(t,r),e===2&&(i=zu(t),i!==0&&(r=i,e=dd(t,i))),e===1))throw n=Ki,Cr(t,0),\$n(t,r),nt(t,fe()),n;switch(t.finishedWork=o,t.finishedLanes=r,e){case 0:case 1:throw Error(C(345));case 2:fr(t,Ge,cn);break;case 3:if(\$n(t,r),(r&130023424)===r&&(e=bf+500-fe(),10<e)){if(hl(t,0)!==0)break;if(o=t.suspendedLanes,(o&r)!==r){_e(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=Uu(fr.bind(null,t,Ge,cn),e);break}fr(t,Ge,cn);break;case 4:if(\$n(t,r),(r&4194240)===r)break;for(e=t.eventTimes,o=-1;0<r;){var s=31-jt(r);i=1<<s,s=e[s],s>o&&(o=s),r&=~i}if(r=o,r=fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nS(r/1960))-r,10<r){t.timeoutHandle=Uu(fr.bind(null,t,Ge,cn),r);break}fr(t,Ge,cn);break;case 5:fr(t,Ge,cn);break;default:throw Error(C(329))}}}return nt(t,fe()),t.callbackNode===n?ky.bind(null,t):null}function dd(t,e){var n=ki;return t.current.memoizedState.isDehydrated&&(Cr(t,e).flags|=256),t=Il(t,e),t!==2&&(e=Ge,Ge=n,e!==null&&fd(e)),t}function fd(t){Ge===null?Ge=t:Ge.push.apply(Ge,t)}function rS(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 o=n[r],i=o.getSnapshot;o=o.value;try{if(!_t(i(),o))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 \$n(t,e){for(e&=~Nf,e&=~Ha,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-jt(e),r=1<<n;t[n]=-1,e&=~r}}function Eh(t){if(W&6)throw Error(C(327));ko();var e=hl(t,0);if(!(e&1))return nt(t,fe()),null;var n=Il(t,e);if(t.tag!==0&&n===2){var r=zu(t);r!==0&&(e=r,n=dd(t,r))}if(n===1)throw n=Ki,Cr(t,0),\$n(t,e),nt(t,fe()),n;if(n===6)throw Error(C(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,fr(t,Ge,cn),nt(t,fe()),null}function Af(t,e){var n=W;W|=1;try{return t(e)}finally{W=n,W===0&&(Io=fe()+500,za&&rr())}}function Dr(t){Pn!==null&&Pn.tag===0&&!(W&6)&&ko();var e=W;W|=1;var n=Nt.transition,r=U;try{if(Nt.transition=null,U=1,t)return t()}finally{U=r,Nt.transition=n,W=e,!(W&6)&&rr()}}function \$f(){ct=fo.current,Y(fo)}function Cr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Rk(n)),he!==null)for(n=he.return;n!==null;){var r=n;switch(df(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&wl();break;case 3:Ao(),Y(et),Y(ze),kf();break;case 5:wf(r);break;case 4:Ao();break;case 13:Y(re);break;case 19:Y(re);break;case 10:mf(r.type._context);break;case 22:case 23:\$f()}n=n.return}if(Se=t,he=t=Jn(t.current,null),be=ct=e,ve=0,Ki=null,Nf=Ha=Pr=0,Ge=ki=null,mr!==null){for(e=0;e<mr.length;e++)if(n=mr[e],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}mr=null}return t}function Sy(t,e){do{var n=he;try{if(hf(),Ys.current=Nl,Ol){for(var r=se.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Ol=!1}if(Lr=0,ke=ye=se=null,vi=!1,Wi=0,Of.current=null,n===null||n.return===null){ve=1,Ki=e,he=null;break}e:{var i=t,s=n.return,l=n,a=e;if(e=be,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 p=dh(s);if(p!==null){p.flags&=-257,fh(p,s,l,i,e),p.mode&1&&uh(i,c,e),e=p,a=c;var h=e.updateQueue;if(h===null){var g=new Set;g.add(a),e.updateQueue=g}else h.add(a);break e}else{if(!(e&1)){uh(i,c,e),If();break e}a=Error(C(426))}}else if(ee&&l.mode&1){var v=dh(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),fh(v,s,l,i,e),ff(\$o(a,l));break e}}i=a=\$o(a,l),ve!==4&&(ve=2),ki===null?ki=[i]:ki.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var m=oy(i,a,e);oh(i,m);break e;case 1:l=a;var y=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Wn===null||!Wn.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=iy(i,l,e);oh(i,S);break e}}i=i.return}while(i!==null)}Ey(n)}catch(x){e=x,he===n&&n!==null&&(he=n=n.return);continue}break}while(!0)}function xy(){var t=bl.current;return bl.current=Nl,t===null?Nl:t}function If(){(ve===0||ve===3||ve===2)&&(ve=4),Se===null||!(Pr&268435455)&&!(Ha&268435455)||\$n(Se,be)}function Il(t,e){var n=W;W|=2;var r=xy();(Se!==t||be!==e)&&(cn=null,Cr(t,e));do try{oS();break}catch(o){Sy(t,o)}while(!0);if(hf(),W=n,bl.current=r,he!==null)throw Error(C(261));return Se=null,be=0,ve}function oS(){for(;he!==null;)My(he)}function iS(){for(;he!==null&&!Aw();)My(he)}function My(t){var e=Ty(t.alternate,t,ct);t.memoizedProps=t.pendingProps,e===null?Ey(t):he=e,Of.current=null}function Ey(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=Xk(n,e),n!==null){n.flags&=32767,he=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ve=6,he=null;return}}else if(n=Yk(n,e,ct),n!==null){he=n;return}if(e=e.sibling,e!==null){he=e;return}he=e=t}while(e!==null);ve===0&&(ve=5)}function fr(t,e,n){var r=U,o=Nt.transition;try{Nt.transition=null,U=1,sS(t,e,n,r)}finally{Nt.transition=o,U=r}return null}function sS(t,e,n,r){do ko();while(Pn!==null);if(W&6)throw Error(C(327));n=t.finishedWork;var o=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(C(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(jw(t,i),t===Se&&(he=Se=null,be=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||\$s||(\$s=!0,Oy(pl,function(){return ko(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Nt.transition,Nt.transition=null;var s=U;U=1;var l=W;W|=4,Of.current=null,eS(t,n),vy(n,t),Tk(_u),ml=!!Vu,_u=Vu=null,t.current=n,tS(n),\$w(),W=l,U=s,Nt.transition=i}else t.current=n;if(\$s&&(\$s=!1,Pn=t,\$l=o),i=t.pendingLanes,i===0&&(Wn=null),Lw(n.stateNode),nt(t,fe()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)o=e[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Al)throw Al=!1,t=cd,cd=null,t;return \$l&1&&t.tag!==0&&ko(),i=t.pendingLanes,i&1?t===ud?Si++:(Si=0,ud=t):Si=0,rr(),null}function ko(){if(Pn!==null){var t=o0(\$l),e=Nt.transition,n=U;try{if(Nt.transition=null,U=16>t?16:t,Pn===null)var r=!1;else{if(t=Pn,Pn=null,\$l=0,W&6)throw Error(C(331));var o=W;for(W|=4,\$=t.current;\$!==null;){var i=\$,s=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:wi(8,u,i)}var d=u.child;if(d!==null)d.return=u,\$=d;else for(;\$!==null;){u=\$;var f=u.sibling,p=u.return;if(my(u),u===c){\$=null;break}if(f!==null){f.return=p,\$=f;break}\$=p}}}var h=i.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(g!==null)}}\$=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,\$=s;else e:for(;\$!==null;){if(i=\$,i.flags&2048)switch(i.tag){case 0:case 11:case 15:wi(9,i,i.return)}var m=i.sibling;if(m!==null){m.return=i.return,\$=m;break e}\$=i.return}}var y=t.current;for(\$=y;\$!==null;){s=\$;var w=s.child;if(s.subtreeFlags&2064&&w!==null)w.return=s,\$=w;else e:for(s=y;\$!==null;){if(l=\$,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ja(9,l)}}catch(x){ue(l,l.return,x)}if(l===s){\$=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,\$=S;break e}\$=l.return}}if(W=o,rr(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Ia,t)}catch{}r=!0}return r}finally{U=n,Nt.transition=e}}return!1}function Ch(t,e,n){e=\$o(n,e),e=oy(t,e,1),t=_n(t,e,1),e=_e(),t!==null&&(ls(t,1,e),nt(t,e))}function ue(t,e,n){if(t.tag===3)Ch(t,t,n);else for(;e!==null;){if(e.tag===3){Ch(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Wn===null||!Wn.has(r))){t=\$o(n,t),t=iy(e,t,1),e=_n(e,t,1),t=_e(),e!==null&&(ls(e,1,t),nt(e,t));break}}e=e.return}}function lS(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=_e(),t.pingedLanes|=t.suspendedLanes&n,Se===t&&(be&n)===n&&(ve===4||ve===3&&(be&130023424)===be&&500>fe()-bf?Cr(t,0):Nf|=n),nt(t,e)}function Cy(t,e){e===0&&(t.mode&1?(e=Ss,Ss<<=1,!(Ss&130023424)&&(Ss=4194304)):e=1);var n=_e();t=vn(t,e),t!==null&&(ls(t,e,n),nt(t,n))}function aS(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Cy(t,n)}function cS(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(C(314))}r!==null&&r.delete(e),Cy(t,n)}var Ty;Ty=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||et.current)Xe=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Xe=!1,Gk(t,e,n);Xe=!!(t.flags&131072)}else Xe=!1,ee&&e.flags&1048576&&A0(e,xl,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Zs(t,e),t=e.pendingProps;var o=Oo(e,ze.current);wo(e,n),o=xf(null,e,r,t,o,n);var i=Mf();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.\$\$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tt(r)?(i=!0,kl(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,yf(e),o.updater=Fa,e.stateNode=o,o._reactInternals=e,Xu(e,r,t,n),e=td(null,e,r,!0,i,n)):(e.tag=0,ee&&i&&uf(e),He(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Zs(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=dS(r),t=Lt(r,t),o){case 0:e=ed(null,e,r,t,n);break e;case 1:e=mh(null,e,r,t,n);break e;case 11:e=ph(null,e,r,t,n);break e;case 14:e=hh(null,e,r,Lt(r.type,t),n);break e}throw Error(C(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Lt(r,o),ed(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Lt(r,o),mh(t,e,r,o,n);case 3:e:{if(cy(e),t===null)throw Error(C(387));r=e.pendingProps,i=e.memoizedState,o=i.element,D0(t,e),Cl(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=\$o(Error(C(423)),e),e=gh(t,e,r,n,o);break e}else if(r!==o){o=\$o(Error(C(424)),e),e=gh(t,e,r,n,o);break e}else for(mt=Vn(e.stateNode.containerInfo.firstChild),yt=e,ee=!0,Dt=null,n=L0(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(No(),r===o){e=wn(t,e,n);break e}He(t,e,r,n)}e=e.child}return e;case 5:return z0(e),t===null&&Qu(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,Wu(r,o)?s=null:i!==null&&Wu(r,i)&&(e.flags|=32),ay(t,e),He(t,e,s,n),e.child;case 6:return t===null&&Qu(e),null;case 13:return uy(t,e,n);case 4:return vf(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=bo(e,null,r,n):He(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Lt(r,o),ph(t,e,r,o,n);case 7:return He(t,e,e.pendingProps,n),e.child;case 8:return He(t,e,e.pendingProps.children,n),e.child;case 12:return He(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Q(Ml,r._currentValue),r._currentValue=s,i!==null)if(_t(i.value,s)){if(i.children===o.children&&!et.current){e=wn(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=hn(-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),Gu(i.return,n,e),l.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(C(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Gu(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}He(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,wo(e,n),o=At(o),r=r(o),e.flags|=1,He(t,e,r,n),e.child;case 14:return r=e.type,o=Lt(r,e.pendingProps),o=Lt(r.type,o),hh(t,e,r,o,n);case 15:return sy(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Lt(r,o),Zs(t,e),e.tag=1,tt(r)?(t=!0,kl(e)):t=!1,wo(e,n),ry(e,r,o),Xu(e,r,o,n),td(null,e,r,!0,t,n);case 19:return dy(t,e,n);case 22:return ly(t,e,n)}throw Error(C(156,e.tag))};function Oy(t,e){return e0(t,e)}function uS(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 uS(t,e,n,r)}function Rf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dS(t){if(typeof t=="function")return Rf(t)?1:0;if(t!=null){if(t=t.\$\$typeof,t===Yd)return 11;if(t===Xd)return 14}return 2}function Jn(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 nl(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")Rf(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case to:return Tr(n.children,o,i,e);case Gd:s=8,o|=8;break;case xu:return t=Ot(12,n,e,o|2),t.elementType=xu,t.lanes=i,t;case Mu:return t=Ot(13,n,e,o),t.elementType=Mu,t.lanes=i,t;case Eu:return t=Ot(19,n,e,o),t.elementType=Eu,t.lanes=i,t;case zg:return Va(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.\$\$typeof){case Pg:s=10;break e;case Dg:s=9;break e;case Yd:s=11;break e;case Xd:s=14;break e;case Cn:s=16,r=null;break e}throw Error(C(130,t==null?t:typeof t,""))}return e=Ot(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Tr(t,e,n,r){return t=Ot(7,t,r,e),t.lanes=n,t}function Va(t,e,n,r){return t=Ot(22,t,r,e),t.elementType=zg,t.lanes=n,t.stateNode={isHidden:!1},t}function Lc(t,e,n){return t=Ot(6,t,null,e),t.lanes=n,t}function Pc(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 fS(t,e,n,r,o){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=mc(0),this.expirationTimes=mc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lf(t,e,n,r,o,i,s,l,a){return t=new fS(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 pS(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{\$\$typeof:eo,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Ny(t){if(!t)return Xn;t=t._reactInternals;e:{if(Vr(t)!==t||t.tag!==1)throw Error(C(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(tt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(C(171))}if(t.tag===1){var n=t.type;if(tt(n))return N0(t,n,e)}return e}function by(t,e,n,r,o,i,s,l,a){return t=Lf(n,r,!0,t,o,i,s,l,a),t.context=Ny(null),n=t.current,r=_e(),o=Un(n),i=hn(r,o),i.callback=e??null,_n(n,i,o),t.current.lanes=o,ls(t,o,r),nt(t,r),t}function _a(t,e,n,r){var o=e.current,i=_e(),s=Un(o);return n=Ny(n),e.context===null?e.context=n:e.pendingContext=n,e=hn(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=_n(o,e,s),t!==null&&(Ht(t,o,s,i),Gs(t,o,s)),s}function Rl(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 Th(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Pf(t,e){Th(t,e),(t=t.alternate)&&Th(t,e)}function hS(){return null}var Ay=typeof reportError=="function"?reportError:function(t){console.error(t)};function Df(t){this._internalRoot=t}Wa.prototype.render=Df.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(C(409));_a(t,e,null,null)};Wa.prototype.unmount=Df.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Dr(function(){_a(null,t,null,null)}),e[yn]=null}};function Wa(t){this._internalRoot=t}Wa.prototype.unstable_scheduleHydration=function(t){if(t){var e=l0();t={blockedOn:null,target:t,priority:e};for(var n=0;n<An.length&&e!==0&&e<An[n].priority;n++);An.splice(n,0,t),n===0&&c0(t)}};function zf(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ua(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Oh(){}function mS(t,e,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=Rl(s);i.call(c)}}var s=by(e,r,t,0,null,!1,!1,"",Oh);return t._reactRootContainer=s,t[yn]=s.current,Fi(t.nodeType===8?t.parentNode:t),Dr(),s}for(;o=t.lastChild;)t.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var c=Rl(a);l.call(c)}}var a=Lf(t,0,!1,null,null,!1,!1,"",Oh);return t._reactRootContainer=a,t[yn]=a.current,Fi(t.nodeType===8?t.parentNode:t),Dr(function(){_a(e,a,n,r)}),a}function Ja(t,e,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var l=o;o=function(){var a=Rl(s);l.call(a)}}_a(e,s,t,o)}else s=mS(n,e,t,o,r);return Rl(s)}i0=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=ii(e.pendingLanes);n!==0&&(tf(e,n|1),nt(e,fe()),!(W&6)&&(Io=fe()+500,rr()))}break;case 13:Dr(function(){var r=vn(t,1);if(r!==null){var o=_e();Ht(r,t,1,o)}}),Pf(t,1)}};nf=function(t){if(t.tag===13){var e=vn(t,134217728);if(e!==null){var n=_e();Ht(e,t,134217728,n)}Pf(t,134217728)}};s0=function(t){if(t.tag===13){var e=Un(t),n=vn(t,e);if(n!==null){var r=_e();Ht(n,t,e,r)}Pf(t,e)}};l0=function(){return U};a0=function(t,e){var n=U;try{return U=t,e()}finally{U=n}};Lu=function(t,e,n){switch(e){case"input":if(Ou(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 o=Da(r);if(!o)throw Error(C(90));Fg(r),Ou(r,o)}}}break;case"textarea":Hg(t,n);break;case"select":e=n.value,e!=null&&mo(t,!!n.multiple,e,!1)}};qg=Af;Qg=Dr;var gS={usingClientEntryPoint:!1,Events:[cs,io,Da,Jg,Kg,Af]},Zo={findFiberByHostInstance:hr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},yS={bundleType:Zo.bundleType,version:Zo.version,rendererPackageName:Zo.rendererPackageName,rendererConfig:Zo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Sn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Xg(t),t===null?null:t.stateNode},findFiberByHostInstance:Zo.findFiberByHostInstance||hS,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 Is=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Is.isDisabled&&Is.supportsFiber)try{Ia=Is.inject(yS),tn=Is}catch{}}wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gS;wt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zf(e))throw Error(C(200));return pS(t,e,null,n)};wt.createRoot=function(t,e){if(!zf(t))throw Error(C(299));var n=!1,r="",o=Ay;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Lf(t,1,!1,null,null,n,!1,r,o),t[yn]=e.current,Fi(t.nodeType===8?t.parentNode:t),new Df(e)};wt.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(C(188)):(t=Object.keys(t).join(","),Error(C(268,t)));return t=Xg(e),t=t===null?null:t.stateNode,t};wt.flushSync=function(t){return Dr(t)};wt.hydrate=function(t,e,n){if(!Ua(e))throw Error(C(200));return Ja(null,t,e,!0,n)};wt.hydrateRoot=function(t,e,n){if(!zf(t))throw Error(C(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=Ay;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=by(e,null,t,1,n??null,o,!1,i,s),t[yn]=e.current,Fi(t),r)for(t=0;t<r.length;t++)n=r[t],o=n._getVersion,o=o(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,o]:e.mutableSourceEagerHydrationData.push(n,o);return new Wa(e)};wt.render=function(t,e,n){if(!Ua(e))throw Error(C(200));return Ja(null,t,e,!1,n)};wt.unmountComponentAtNode=function(t){if(!Ua(t))throw Error(C(40));return t._reactRootContainer?(Dr(function(){Ja(null,null,t,!1,function(){t._reactRootContainer=null,t[yn]=null})}),!0):!1};wt.unstable_batchedUpdates=Af;wt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Ua(n))throw Error(C(200));if(t==null||t._reactInternals===void 0)throw Error(C(38));return Ja(t,e,n,!1,r)};wt.version="18.3.1-next-f1338f8080-20240426";function \$y(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(\$y)}catch(t){console.error(t)}}\$y(),\$g.exports=wt;var Ka=\$g.exports;const Iy=wg(Ka);var Ry,Nh=Ka;Ry=Nh.createRoot,Nh.hydrateRoot;var vS=Object.defineProperty,wS=(t,e,n)=>e in t?vS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,kS=(t,e,n)=>(wS(t,e+"",n),n),Rs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function SS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function xS(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ly=xS,MS=typeof Rs=="object"&&Rs&&Rs.Object===Object&&Rs,ES=MS,CS=ES,TS=typeof self=="object"&&self&&self.Object===Object&&self,OS=CS||TS||Function("return this")(),Py=OS,NS=Py,bS=function(){return NS.Date.now()},AS=bS,\$S=/\s/;function IS(t){for(var e=t.length;e--&&\$S.test(t.charAt(e)););return e}var RS=IS,LS=RS,PS=/^\s+/;function DS(t){return t&&t.slice(0,LS(t)+1).replace(PS,"")}var zS=DS,BS=Py,FS=BS.Symbol,Dy=FS,bh=Dy,zy=Object.prototype,jS=zy.hasOwnProperty,HS=zy.toString,ei=bh?bh.toStringTag:void 0;function VS(t){var e=jS.call(t,ei),n=t[ei];try{t[ei]=void 0;var r=!0}catch{}var o=HS.call(t);return r&&(e?t[ei]=n:delete t[ei]),o}var _S=VS,WS=Object.prototype,US=WS.toString;function JS(t){return US.call(t)}var KS=JS,Ah=Dy,qS=_S,QS=KS,GS="[object Null]",YS="[object Undefined]",\$h=Ah?Ah.toStringTag:void 0;function XS(t){return t==null?t===void 0?YS:GS:\$h&&\$h in Object(t)?qS(t):QS(t)}var ZS=XS;function ex(t){return t!=null&&typeof t=="object"}var tx=ex,nx=ZS,rx=tx,ox="[object Symbol]";function ix(t){return typeof t=="symbol"||rx(t)&&nx(t)==ox}var sx=ix,lx=zS,Ih=Ly,ax=sx,Rh=NaN,cx=/^[-+]0x[0-9a-f]+\$/i,ux=/^0b[01]+\$/i,dx=/^0o[0-7]+\$/i,fx=parseInt;function px(t){if(typeof t=="number")return t;if(ax(t))return Rh;if(Ih(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ih(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=lx(t);var n=ux.test(t);return n||dx.test(t)?fx(t.slice(2),n?2:8):cx.test(t)?Rh:+t}var hx=px,mx=Ly,Dc=AS,Lh=hx,gx="Expected a function",yx=Math.max,vx=Math.min;function wx(t,e,n){var r,o,i,s,l,a,c=0,u=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(gx);e=Lh(e)||0,mx(n)&&(u=!!n.leading,d="maxWait"in n,i=d?yx(Lh(n.maxWait)||0,e):i,f="trailing"in n?!!n.trailing:f);function p(k){var M=r,T=o;return r=o=void 0,c=k,s=t.apply(T,M),s}function h(k){return c=k,l=setTimeout(m,e),u?p(k):s}function g(k){var M=k-a,T=k-c,O=e-M;return d?vx(O,i-T):O}function v(k){var M=k-a,T=k-c;return a===void 0||M>=e||M<0||d&&T>=i}function m(){var k=Dc();if(v(k))return y(k);l=setTimeout(m,g(k))}function y(k){return l=void 0,f&&r?p(k):(r=o=void 0,s)}function w(){l!==void 0&&clearTimeout(l),c=0,r=a=o=l=void 0}function S(){return l===void 0?s:y(Dc())}function x(){var k=Dc(),M=v(k);if(r=arguments,o=this,a=k,M){if(l===void 0)return h(a);if(d)return clearTimeout(l),l=setTimeout(m,e),p(a)}return l===void 0&&(l=setTimeout(m,e)),s}return x.cancel=w,x.flush=S,x}var kx=wx;const Sx=SS(kx);function Te(t){this.content=t}Te.prototype={constructor:Te,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,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Te(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 Te(n)},addToStart:function(t,e){return new Te([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Te(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Te(o)},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=Te.from(t),t.size?new Te(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Te.from(t),t.size?new Te(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Te.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}};Te.from=function(t){if(t instanceof Te)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Te(e)};function By(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=By(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Fy(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=Fy(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class E{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,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!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,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new E(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new E(r,o)}cutByIndex(e,n){return e==n?E.empty:e==0&&n==this.content.length?this:new E(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new E(o,i)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return By(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Fy(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Ls(0,e);if(e==this.size)return Ls(this.content.length,e);if(e>this.size||e<0)throw new RangeError(\`Position \${e} outside of fragment (\${this})\`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||n>0?Ls(r+1,s):Ls(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return E.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new E(n||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const zc={index:0,offset:0};function Ls(t,e){return zc.index=t,zc.offset=e,zc}function Ll(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(!Ll(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ll(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let J=class pd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),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&&Ll(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\`);return r.create(n.attrs)}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 pd.none;if(e instanceof pd)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};J.none=[];class Pl extends Error{}class A{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=Hy(this.content,e+this.openStart,n);return r&&new A(r,this.openStart,this.openEnd)}removeBetween(e,n){return new A(jy(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 A.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new A(E.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=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)o++;return new A(e,r,o)}}A.empty=new A(E.empty,0,0);function jy(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(jy(i.content,e-o-1,n-o-1)))}function Hy(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Hy(s.content,e-i-1,n);return l&&t.replaceChild(o,s.copy(l))}function xx(t,e,n){if(n.openStart>t.depth)throw new Pl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Pl("Inconsistent open depths");return Vy(t,e,n,0)}function Vy(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Vy(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return Nr(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Mx(n,t);return Nr(i,Wy(t,s,l,e,r))}else return Nr(i,Dl(t,e,r))}function _y(t,e){if(!e.type.compatibleContent(t.type))throw new Pl("Cannot join "+e.type.name+" onto "+t.type.name)}function hd(t,e,n){let r=t.node(n);return _y(r,e.node(n)),r}function Or(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 xi(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Or(t.nodeAfter,r),i++));for(let l=i;l<s;l++)Or(o.child(l),r);e&&e.depth==n&&e.textOffset&&Or(e.nodeBefore,r)}function Nr(t,e){return t.type.checkContent(e),t.copy(e)}function Wy(t,e,n,r,o){let i=t.depth>o&&hd(t,e,o+1),s=r.depth>o&&hd(n,r,o+1),l=[];return xi(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(_y(i,s),Or(Nr(i,Wy(t,e,n,r,o+1)),l)):(i&&Or(Nr(i,Dl(t,e,o+1)),l),xi(e,n,o,l),s&&Or(Nr(s,Dl(n,r,o+1)),l)),xi(r,null,o,l),new E(l)}function Dl(t,e,n){let r=[];if(xi(null,t,n,r),t.depth>n){let o=hd(t,e,n+1);Or(Nr(o,Dl(t,e,n+1)),r)}return xi(e,null,n,r),new E(r)}function Mx(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)r=e.node(o).copy(E.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class qi{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return J.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.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 zl(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=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new qi(n,r,i)}static resolveCached(e,n){for(let o=0;o<Bc.length;o++){let i=Bc[o];if(i.pos==n&&i.doc==e)return i}let r=Bc[Fc]=qi.resolve(e,n);return Fc=(Fc+1)%Ex,r}}let Bc=[],Fc=0,Ex=12;class zl{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 Cx=Object.create(null);let br=class md{constructor(e,n,r,o=J.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||E.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&Ll(this.attrs,n||e.defaultAttrs||Cx)&&J.sameSet(this.marks,r||J.none)}copy(e=null){return e==this.content?this:new md(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new md(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 A.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),a=o.node(s).content.cut(o.pos-l,i.pos-l);return new A(a,o.depth-s,i.depth-s)}replace(e,n,r){return xx(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return qi.resolveCached(this,e)}resolveNoCache(e){return qi.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),Uy(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=E.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=J.none;for(let n=0;n<this.marks.length;n++)e=this.marks[n].addToSet(e);if(!J.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=null;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 o=E.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};br.prototype.text=void 0;class Bl extends br{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Uy(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 Bl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Bl(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 Uy(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class zr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Tx(e,n);if(r.next==null)return zr.empty;let o=Jy(r);r.next&&r.err("Unexpected trailing text");let i=Rx(Ix(o));return Lx(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 o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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 o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return E.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.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 o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),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 o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(\`
\`)}}zr.empty=new zr(!0);class Tx{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 Jy(t){let e=[];do e.push(Ox(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ox(t){let e=[];do e.push(Nx(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Nx(t){let e=\$x(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=bx(t,e);else break;return e}function Ph(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function bx(t,e){let n=Ph(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ph(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Ax(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function \$x(t){if(t.eat("(")){let e=Jy(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=Ax(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 Ix(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Ky(t,e){return e-t}function Dh(t,e){let n=[];return r(e),n.sort(Ky);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function Rx(t){let e=Object.create(null);return n(Dh(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);Dh(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new zr(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Ky);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function Lx(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qy(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 Qy(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Gy(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new Px(t[n]);return e}let zh=class Yy{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=Gy(r.attrs),this.defaultAttrs=qy(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==zr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:Qy(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new br(this,this.computeAttrs(e),E.from(n),J.setFrom(r))}createChecked(e=null,n,r){return n=E.from(n),this.checkContent(n),new br(this,this.computeAttrs(e),n,J.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=E.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(E.empty,!0);return i?new br(this,e,n.append(i),J.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)}\`)}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:J.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Yy(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");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}};class Px{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class qa{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Gy(o.attrs),this.excluded=null;let i=qy(this.attrs);this.instance=i?new J(this,i):null}create(e=null){return!e&&this.instance?this.instance:new J(this,Qy(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new qa(i,o++,n,s)),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]}excludes(e){return this.excluded.indexOf(e)>-1}}class Dx{constructor(e){this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Te.from(e.nodes),n.marks=Te.from(e.marks||{}),this.nodes=zh.compile(this.spec.nodes,this),this.marks=qa.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;i.contentMatch=r[s]||(r[s]=zr.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=l=="_"?null:l?Bh(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Bh(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof zh){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,o)}text(e,n){let r=this.nodes.text;return new Bl(r,r.defaultAttrs,e,J.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return br.fromJSON(this,e)}markFromJSON(e){return J.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Bh(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class Ro{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new jh(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new jh(this,n,!0);return r.addAll(e,n.from,n.to),A.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(Fx(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Hh(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Hh(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ro(e,Ro.schemaRules(e)))}}const Xy={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},zx={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zy={ol:!0,ul:!0},Fl=1,jl=2,Mi=4;function Fh(t,e,n){return e!=null?(e?Fl:0)|(e==="full"?jl:0):t&&t.whitespace=="pre"?Fl|jl:n&~Mi}class Ps{constructor(e,n,r,o,i,s,l){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=l,this.content=[],this.activeMarks=J.none,this.stashMarks=[],this.match=s||(l&Mi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(E.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Fl)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+\$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=E.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;n<r.length;n++){let o=r[n];(this.type?this.type.allowsMarkType(o.type):Hx(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Xy.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class jh{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=Fh(null,n.preserveWhitespace,0)|(r?Mi:0);o?i=new Ps(o.type,o.attrs,J.none,J.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Ps(null,null,J.none,J.none,!0,null,s):i=new Ps(e.schema.topNodeType,null,J.none,J.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.getAttribute("style");if(!r)return n();let o=this.readStyles(jx(r));if(!o)return;let[i,s]=o,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);n();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&jl||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&Fl)r.options&jl?n=n.replace(/\r\n?/g,\`
\`):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&i.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]\$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),o;Zy.hasOwnProperty(r)&&this.parser.normalizeLists&&Bx(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));if(i?i.ignore:zx.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let s,l=this.top,a=this.needsBlock;if(Xy.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(\`
\`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=J.none,r=J.none;for(let o=0;o<e.length;o+=2)for(let i=void 0;;){let s=this.parser.matchStyle(e[o],e[o+1],this,i);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{s.clearMark(l)&&(r=l.addToSet(r))}):n=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(n),s.consuming===!1)i=s;else break}return[n,r]}addElementByRule(e,n,r){let o,i,s;n.node?(i=this.parser.schema.nodes[n.node],i.isLeaf?this.insertNode(i.create(n.attrs))||this.leafFallback(e):o=this.enter(i,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));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)}o&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let n,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=i,!s.length)||i.solid)break}if(!n)return!1;this.sync(r);for(let o=0;o<n.length;o++)this.enterInner(n[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let o=0;o<e.marks.length;o++)(!n.type||n.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let o=this.findPlace(e.create(n));return o&&this.enterInner(e,n,!0,r),o}enterInner(e,n=null,r=!1,o){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=Fh(e,o,i.options);i.options&Mi&&i.content.length==0&&(s|=Mi),this.nodes.push(new Ps(e,n,i.activeMarks,i.pendingMarks,r,null,s)),this.open++}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;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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(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(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(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}}addPendingMark(e){let n=Vx(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let i=o.popFromStashMark(e);i&&o.type&&o.type.allowsMarkType(i.type)&&(o.activeMarks=i.addToSet(o.activeMarks))}if(o==n)break}}}function Bx(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Zy.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Fx(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function jx(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function Hh(t){let e={};for(let n in t)e[n]=t[n];return e}function Hx(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=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&&s(u))return!0}};if(s(o.contentMatch))return!0}}function Vx(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class Zt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=jc(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.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;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Zt.renderSpec(jc(n),this.nodes[e.type.name](e));if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Zt.renderSpec(jc(r),o(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let o=n[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));let s,l=r?e.createElementNS(r,o):e.createElement(o),a=n[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let d=u.indexOf(" ");d>0?l.setAttributeNS(u.slice(0,d),u.slice(d+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;u<n.length;u++){let d=n[u];if(d===0){if(u<n.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=Zt.renderSpec(e,d,r);if(l.appendChild(f),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:l,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Zt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Vh(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Vh(e.marks)}}function Vh(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function jc(t){return t.document||window.document}const e1=65535,t1=Math.pow(2,16);function _x(t,e){return t+e*t1}function _h(t){return t&e1}function Wx(t){return(t-(t&e1))/t1}const n1=1,r1=2,rl=4,o1=8;class gd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&o1)>0}get deletedBefore(){return(this.delInfo&(n1|rl))>0}get deletedAfter(){return(this.delInfo&(r1|rl))>0}get deletedAcross(){return(this.delInfo&rl)>0}}class ft{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ft.empty)return ft.empty}recover(e){let n=0,r=_h(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+Wx(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 o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,p=a+o+(f<0?0:u);if(r)return p;let h=e==(n<0?a:d)?null:_x(l/3,e-a),g=e==a?r1:e==d?n1:rl;return(n<0?e!=a:e!=d)&&(g|=o1),new gd(p,g,h)}o+=u-c}return r?e+o:new gd(e+o,0,null)}touches(e,n){let r=0,o=_h(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new ft(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ft.empty:new ft(e<0?[0,-e,0]:[0,0,e])}}ft.empty=new ft([]);class So{constructor(e=[],n,r=0,o=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=o}slice(e=0,n=this.maps.length){return new So(this.maps,this.mirror,e,n)}copy(){return new So(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){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 o=e.getMirror(n);this.appendMap(e.maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new So;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 o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],l=s.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}}o|=l.delInfo,e=l.pos}return r?e:new gd(e,o,null)}}const Hc=Object.create(null);class Fe{getMap(){return ft.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Hc[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 Hc)throw new RangeError("Duplicate use of step JSON ID "+e);return Hc[e]=n,n.prototype.jsonID=e,n}}class me{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new me(e,null)}static fail(e){return new me(null,e)}static fromReplace(e,n,r,o){try{return me.ok(e.replace(n,r,o))}catch(i){if(i instanceof Pl)return me.fail(i.message);throw i}}}function Bf(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Bf(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return E.fromArray(r)}class Dn extends Fe{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),o=r.node(r.sharedDepth(this.to)),i=new A(Bf(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return me.fromReplace(e,this.from,this.to,i)}invert(){return new en(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 Dn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Dn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dn(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 Dn(n.from,n.to,e.markFromJSON(n.mark))}}Fe.jsonID("addMark",Dn);class en extends Fe{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 A(Bf(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return me.fromReplace(e,this.from,this.to,r)}invert(){return new Dn(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 en(n.pos,r.pos,this.mark)}merge(e){return e instanceof en&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new en(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 en(n.from,n.to,e.markFromJSON(n.mark))}}Fe.jsonID("removeMark",en);class zn extends Fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return me.fromReplace(e,this.pos,this.pos+1,new A(E.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new zn(this.pos,n.marks[o]);return new zn(this.pos,this.mark)}}return new Lo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new zn(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 zn(n.pos,e.markFromJSON(n.mark))}}Fe.jsonID("addNodeMark",zn);class Lo extends Fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return me.fromReplace(e,this.pos,this.pos+1,new A(E.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new zn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Lo(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 Lo(n.pos,e.markFromJSON(n.mark))}}Fe.jsonID("removeNodeMark",Lo);class Oe extends Fe{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&yd(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ft([this.from,this.to-this.from,this.slice.size])}invert(e){return new Oe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Oe(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Oe)||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?A.empty:new A(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Oe(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?A.empty:new A(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Oe(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 Oe(n.from,n.to,A.fromJSON(e,n.slice),!!n.structure)}}Fe.jsonID("replace",Oe);class xe extends Fe{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(yd(e,this.from,this.gapFrom)||yd(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?me.fromReplace(e,this.from,this.to,r):me.fail("Content does not fit in gap")}getMap(){return new ft([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 xe(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),o=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new xe(n.pos,r.pos,o,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 xe(n.from,n.to,n.gapFrom,n.gapTo,A.fromJSON(e,n.slice),n.insert,!!n.structure)}}Fe.jsonID("replaceAround",xe);function yd(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Ux(t,e,n,r){let o=[],i=[],s,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),p=Math.min(c+a.nodeSize,n),h=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=p:o.push(s=new en(f,p,d[g])));l&&l.to==f?l.to=p:i.push(l=new Dn(f,p,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function Jx(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof qa){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==i-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new en(s.from,s.to,s.style)))}function Kx(t,e,n,r=n.contentMatch){let o=t.doc.nodeAt(e),i=[],s=e+1;for(let l=0;l<o.childCount;l++){let a=o.child(l),c=s+a.nodeSize,u=r.matchType(a.type);if(!u)i.push(new Oe(s,c,A.empty));else{r=u;for(let d=0;d<a.marks.length;d++)n.allowsMarkType(a.marks[d].type)||t.step(new en(s,c,a.marks[d]));if(a.isText&&!n.spec.code){let d,f=/\r?\n|\r/g,p;for(;d=f.exec(a.text);)p||(p=new A(E.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),i.push(new Oe(s+d.index,s+d.index+d[0].length,p))}}s=c}if(!r.validEnd){let l=r.fillBefore(E.empty,!0);t.replace(s,s,new A(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function qx(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Wo(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.\$from.node(n),o=t.\$from.index(n),i=t.\$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(n==0||r.type.spec.isolating||!qx(r,o,i))break}return null}function Qx(t,e,n){let{\$from:r,\$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=E.empty,d=0;for(let h=i,g=!1;h>n;h--)g||r.index(h)>0?(g=!0,u=E.from(r.node(h).copy(u)),d++):a--;let f=E.empty,p=0;for(let h=i,g=!1;h>n;h--)g||o.after(h+1)<o.end(h)?(g=!0,f=E.from(o.node(h).copy(f)),p++):c++;t.step(new xe(a,c,s,l,new A(u.append(f),d,p),u.size-d,!0))}function Ff(t,e,n=null,r=t){let o=Gx(t,e),i=o&&Yx(r,e);return i?o.map(Wh).concat({type:e,attrs:n}).concat(i.map(Wh)):null}function Wh(t){return{type:t,attrs:null}}function Gx(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function Yx(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=r;l&&a<o;a++)l=l.matchType(n.child(a).type);return!l||!l.validEnd?null:s}function Xx(t,e,n){let r=E.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=E.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new xe(o,i,o,i,new A(r,0,0),n.length,!0))}function Zx(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&eM(t.doc,t.mapping.slice(i).map(l),r)){t.clearIncompatible(t.mapping.slice(i).map(l,1),r);let a=t.mapping.slice(i),c=a.map(l,1),u=a.map(l+s.nodeSize,1);return t.step(new xe(c,u,c+1,u-1,new A(E.from(r.create(o,null,s.marks)),0,0),1,!0)),!1}})}function eM(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function tM(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new xe(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new A(E.from(s),0,0),1,!0))}function xo(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function nM(t,e,n=1,r){let o=t.doc.resolve(e),i=E.empty,s=E.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=E.from(o.node(l).copy(i));let u=r&&r[c];s=E.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new Oe(e,e,new A(i.append(s),n,n),!0))}function or(t,e){let n=t.resolve(e),r=n.index();return i1(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function i1(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Qa(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&i1(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function rM(t,e,n){let r=new Oe(e-n,e+n,A.empty,!0);t.step(r)}function oM(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function s1(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function jf(t,e,n=e,r=A.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return l1(o,i,r)?new Oe(e,n,r):new iM(o,i,r).fit()}function l1(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class iM{constructor(e,n,r){this.\$from=e,this.\$to=n,this.unplaced=r,this.frontier=[],this.placed=E.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=E.from(e.node(o).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,o=this.close(e<0?this.\$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new A(i,s,l);return e>-1?new xe(r.pos,e,this.\$to.pos,this.\$to.end(),a,n):a.size||r.pos!=this.\$to.pos?new Oe(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=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 o,i=null;r?(i=Vc(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(E.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.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,o=Vc(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new A(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Vc(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new A(li(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new A(li(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),v=d.matchType(g.type);if(!v)break;c++,(c>1||a==0||g.content.size)&&(d=v,u.push(a1(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=ai(this.placed,n,E.from(u)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=l;g<p;g++){let m=v.lastChild;this.frontier.push({type:m.type,match:m.contentMatchAt(m.childCount)}),v=m.content}this.unplaced=h?e==0?A.empty:new A(li(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new A(li(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.\$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_c(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,o=this.\$to.after(r);for(;r>1&&o==this.\$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=_c(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=_c(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,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=ai(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=ai(this.placed,this.depth,E.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(E.empty,!0);e.childCount&&(this.placed=ai(this.placed,this.frontier.length,e))}}function li(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(li(t.firstChild.content,e-1,n)))}function ai(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ai(t.lastChild.content,e-1,n)))}function Vc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function a1(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,a1(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(E.empty,!0)))),t.copy(r)}function _c(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!sM(n,i.content,s)?l:null}function sM(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function lM(t){return t.spec.defining||t.spec.definingForContent}function aM(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(l1(o,i,r))return t.step(new Oe(e,n,r));let s=u1(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==p&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=lM(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let g=0;g<s.length;g++){let v=s[(g+a)%s.length],m=!0;v<0&&(m=!1,v=-v);let y=o.node(v-1),w=o.index(v-1);if(y.canReplaceWith(w,w,h.type,h.marks))return t.replace(o.before(v),m?i.after(v):n,new A(c1(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),n=i.after(p))}}function c1(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(c1(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(E.empty,!0))}return t}function cM(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=oM(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new A(E.from(r),0,0))}function uM(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=u1(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function u1(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class Mo extends Fe{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 me.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 o=n.type.create(r,null,n.marks);return me.fromReplace(e,this.pos,this.pos+1,new A(E.from(o),0,n.isLeaf?0:1))}getMap(){return ft.empty}invert(e){return new Mo(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 Mo(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 Mo(n.pos,n.attr,n.value)}}Fe.jsonID("attr",Mo);class Qi extends Fe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return me.ok(r)}getMap(){return ft.empty}invert(e){return new Qi(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 Qi(n.attr,n.value)}}Fe.jsonID("docAttr",Qi);let Po=class extends Error{};Po=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Po.prototype=Object.create(Error.prototype);Po.prototype.constructor=Po;Po.prototype.name="TransformError";class d1{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new So}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Po(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}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=A.empty){let o=jf(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new A(E.from(r),0,0))}delete(e,n){return this.replace(e,n,A.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return aM(this,e,n,r),this}replaceRangeWith(e,n,r){return cM(this,e,n,r),this}deleteRange(e,n){return uM(this,e,n),this}lift(e,n){return Qx(this,e,n),this}join(e,n=1){return rM(this,e,n),this}wrap(e,n){return Xx(this,e,n),this}setBlockType(e,n=e,r,o=null){return Zx(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return tM(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Mo(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qi(e,n)),this}addNodeMark(e,n){return this.step(new zn(e,n)),this}removeNodeMark(e,n){if(!(n instanceof J)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Lo(e,n)),this}split(e,n=1,r){return nM(this,e,n,r),this}addMark(e,n,r){return Ux(this,e,n,r),this}removeMark(e,n,r){return Jx(this,e,n,r),this}clearIncompatible(e,n,r){return Kx(this,e,n,r),this}}const Wc=Object.create(null);class j{constructor(e,n,r){this.\$anchor=e,this.\$head=n,this.ranges=r||[new dM(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=A.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{\$from:a,\$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?A.empty:n),l==0&&Kh(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{\$from:s,\$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Kh(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new D(e):Qr(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Qr(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Qr(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Vt(e.node(0))}static atStart(e){return Qr(e,e,0,0,1)||new Vt(e)}static atEnd(e){return Qr(e,e,e.content.size,e.childCount,-1)||new Vt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Wc[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 Wc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Wc[e]=n,n.prototype.jsonID=e,n}getBookmark(){return D.between(this.\$anchor,this.\$head).getBookmark()}}j.prototype.visible=!0;class dM{constructor(e,n){this.\$from=e,this.\$to=n}}let Uh=!1;function Jh(t){!Uh&&!t.parent.inlineContent&&(Uh=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class D extends j{constructor(e,n=e){Jh(e),Jh(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 j.near(r);let o=e.resolve(n.map(this.anchor));return new D(o.parent.inlineContent?o:r,r)}replace(e,n=A.empty){if(super.replace(e,n),n==A.empty){let r=this.\$from.marksAcross(this.\$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof D&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ga(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 D(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=j.findFrom(n,r,!0)||j.findFrom(n,-r,!0);if(i)n=i.\$head;else return j.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(j.findFrom(e,-r,!0)||j.findFrom(e,r,!0)).\$anchor,e.pos<n.pos!=o<0&&(e=n))),new D(e,n)}}j.jsonID("text",D);class Ga{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ga(e.map(this.anchor),e.map(this.head))}resolve(e){return D.between(e.resolve(this.anchor),e.resolve(this.head))}}class P extends j{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?j.near(i):new P(i)}content(){return new A(E.from(this.node),0,0)}eq(e){return e instanceof P&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Hf(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new P(e.resolve(n.anchor))}static create(e,n){return new P(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}P.prototype.visible=!1;j.jsonID("node",P);class Hf{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ga(r,r):new Hf(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&P.isSelectable(r)?new P(n):j.near(n)}}class Vt extends j{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=A.empty){if(n==A.empty){e.delete(0,e.doc.content.size);let r=j.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Vt(e)}map(e){return new Vt(e)}eq(e){return e instanceof Vt}getBookmark(){return fM}}j.jsonID("all",Vt);const fM={map(){return this},resolve(t){return new Vt(t)}};function Qr(t,e,n,r,o,i=!1){if(e.inlineContent)return D.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&P.isSelectable(l))return P.create(t,n-(o<0?l.nodeSize:0))}else{let a=Qr(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function Kh(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Oe||o instanceof xe))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(j.near(t.doc.resolve(s),n))}const qh=1,Ds=2,Qh=4;class pM extends d1{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|qh)&~Ds,this.storedMarks=null,this}get selectionSet(){return(this.updated&qh)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ds,this}ensureMarks(e){return J.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&Ds)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ds,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)||J.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(j.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|=Qh,this}get scrolledIntoView(){return(this.updated&Qh)>0}}function Gh(t,e){return!e||!t?t:t.bind(e)}class ci{constructor(e,n,r){this.name=e,this.init=Gh(n.init,r),this.apply=Gh(n.apply,r)}}const hM=[new ci("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ci("selection",{init(t,e){return t.selection||j.atStart(e.doc)},apply(t){return t.selection}}),new ci("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.\$cursor?t.storedMarks:null}}),new ci("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Uc{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=hM.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 ci(r.key,r.spec.state,r))})}}class po{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 o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={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 po(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new pM(this)}static create(e){let n=new Uc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new po(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Uc(this.schema,e.plugins),r=n.fields,o=new po(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}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 o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.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 o=new Uc(e.schema,e.plugins),i=new po(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=br.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=j.fromJSON(i.doc,n.selection);else if(s.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==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function f1(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=f1(o,e,{})),n[r]=o}return n}class pe{constructor(e){this.spec=e,this.props={},e.props&&f1(e.props,this,this.props),this.key=e.key?e.key.key:p1("plugin")}getState(e){return e[this.key]}}const Jc=Object.create(null);function p1(t){return t in Jc?t+"\$"+ ++Jc[t]:(Jc[t]=0,t+"\$")}class we{constructor(e="key"){this.key=p1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ve=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Gi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Yh=null;const un=function(t,e,n){let r=Yh||(Yh=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Br=function(t,e,n,r){return n&&(Xh(t,e,n,r,-1)||Xh(t,e,n,r,1))},mM=/^(img|br|input|textarea|hr)\$/i;function Xh(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Xt(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Vf(t)||mM.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ve(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?Xt(t):0}else return!1}}function Xt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function gM(t,e,n){for(let r=e==0,o=e==Xt(t);r||o;){if(t==n)return!0;let i=Ve(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Xt(t)}}function Vf(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 Ya=function(t){return t.focusNode&&Br(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function pr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function yM(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function vM(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const on=typeof navigator<"u"?navigator:null,Zh=typeof document<"u"?document:null,ir=on&&on.userAgent||"",vd=/Edge\/(\d+)/.exec(ir),h1=/MSIE \d/.exec(ir),wd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ir),rt=!!(h1||wd||vd),Kn=h1?document.documentMode:wd?+wd[1]:vd?+vd[1]:0,Wt=!rt&&/gecko\/(\d+)/i.test(ir);Wt&&+(/Firefox\/(\d+)/.exec(ir)||[0,0])[1];const kd=!rt&&/Chrome\/(\d+)/.exec(ir),De=!!kd,wM=kd?+kd[1]:0,We=!rt&&!!on&&/Apple Computer/.test(on.vendor),Do=We&&(/Mobile\/\w+/.test(ir)||!!on&&on.maxTouchPoints>2),Et=Do||(on?/Mac/.test(on.platform):!1),kM=on?/Win/.test(on.platform):!1,zt=/Android \d/.test(ir),ds=!!Zh&&"webkitFontSmoothing"in Zh.documentElement.style,SM=ds?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xM(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ln(t,e){return typeof t=="number"?t:t[e]}function MM(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 em(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Gi(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?xM(i):MM(l),u=0,d=0;if(e.top<c.top+ln(r,"top")?d=-(c.top-e.top+ln(o,"top")):e.bottom>c.bottom-ln(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+ln(o,"top")-c.top:e.bottom-c.bottom+ln(o,"bottom")),e.left<c.left+ln(r,"left")?u=-(c.left-e.left+ln(o,"left")):e.right>c.right-ln(r,"right")&&(u=e.right-c.right+ln(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let h=l.scrollLeft-f,g=l.scrollTop-p;e={left:e.left-h,top:e.top-g,right:e.right-h,bottom:e.bottom-g}}if(a||/^(fixed|sticky)\$/.test(getComputedStyle(s).position))break}}function EM(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:m1(t.dom)}}function m1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Gi(r));return e}function CM({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;g1(n,r==0?0:r-e)}function g1(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ur=null;function TM(t){if(t.setActive)return t.setActive();if(Ur)return t.focus(Ur);let e=m1(t);t.focus(Ur==null?{get preventScroll(){return Ur={preventScroll:!0},!0}}:void 0),Ur||(Ur=!1,g1(e,0))}function y1(t,e){let n,r=2e8,o,i=0,s=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=un(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let g=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(g<r){n=u,r=g,o=g&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&g&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?OM(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:y1(n,o)}function OM(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=En(r,1);if(i.top!=i.bottom&&_f(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function _f(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function NM(t,e){let n=t.parentNode;return n&&/^li\$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function bM(t,e,n){let{node:r,offset:o}=y1(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function AM(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!s||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!s&&(s=!0,a.left>r.left||a.top>r.top?o=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(o=l.posAfter)),!l.contentDOM&&o<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 o>-1?o:t.docView.posFromDOM(e,n,-1)}function v1(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(_f(e,c))return v1(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function \$M(t,e){let n=t.dom.ownerDocument,r,o=0,i=vM(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!_f(e,c)||(s=v1(t.dom,e,c),!s))return null}if(We)for(let c=s;r&&c;c=Gi(c))c.draggable&&(r=void 0);if(s=NM(s,e),r){if(Wt&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;ds&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=AM(t,r,o,e))}l==null&&(l=bM(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function tm(t){return t.top<t.bottom||t.left<t.right}function En(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(tm(r))return r}return Array.prototype.find.call(n,tm)||t.getBoundingClientRect()}const IM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function w1(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=ds||Wt;if(r.nodeType==3)if(s&&(IM.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=En(un(r,o,o),n);if(Wt&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let a=En(un(r,o-1,o-1),-1);if(a.top==l.top){let c=En(un(r,o,o+1),-1);if(c.top!=l.top)return ti(c,c.left<a.left)}}return l}else{let l=o,a=o,c=n<0?1:-1;return n<0&&!o?(a++,c=-1):n>=0&&o==r.nodeValue.length?(l--,c=1):n<0?l--:a++,ti(En(un(r,l,a),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Xt(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Kc(l.getBoundingClientRect(),!1)}if(i==null&&o<Xt(r)){let l=r.childNodes[o];if(l.nodeType==1)return Kc(l.getBoundingClientRect(),!0)}return Kc(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Xt(r))){let l=r.childNodes[o-1],a=l.nodeType==3?un(l,Xt(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(a)return ti(En(a,1),!1)}if(i==null&&o<Xt(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let a=l?l.nodeType==3?un(l,0,s?0:1):l.nodeType==1?l:null:null;if(a)return ti(En(a,-1),!0)}return ti(En(r.nodeType==3?un(r):r,-n),n>=0)}function ti(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 Kc(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 k1(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function RM(t,e,n){let r=e.selection,o=n=="up"?r.\$from:r.\$to;return k1(t,e,()=>{let{node:i}=t.docView.domFromPos(o.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 s=w1(t,o.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=un(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"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const LM=/[\u0590-\u08ac]/;function PM(t,e,n){let{\$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return!LM.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:k1(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:g}=t.domSelectionRange(),v=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),v})}let nm=null,rm=null,om=!1;function DM(t,e,n){return nm==e&&rm==n?om:(nm=e,rm=n,om=n=="up"||n=="down"?RM(t,e,n):PM(t,e,n))}const bt=0,im=1,yr=2,sn=3;class fs{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=bt,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 o=this.children[n];if(o==e)return r;r+=o.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,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Ve(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==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 o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof x1){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof S1&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Ve(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Ve(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 o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+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=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Ve(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-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=Ve(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,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,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let h=this.children[f],g=p+h.size;if(i>p&&s<g)return h.setSelection(e-p-h.border,n-p-h.border,r,o);p=g}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((Wt||We)&&e==n){let{node:f,offset:p}=l;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==\`
\`),u&&p==f.nodeValue.length)for(let h=f,g;h;h=h.parentNode){if(g=h.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Ve(g)+1});break}let v=h.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let h=f.childNodes[p-1];u=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}if(Wt&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||u&&We)&&Br(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Br(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((c.extend||e==n)&&!u){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),d=!0}catch{}}if(!d){if(e>n){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}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,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?yr:im,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=sn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?yr:sn}r=s}this.dirty=yr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?yr:im;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class S1 extends fs{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==bt&&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 side(){return this.widget.type.side}}class zM extends fs{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}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 Fr extends fs{constructor(e,n,r,o){super(e,[],r,o),this.mark=n}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Zt.renderSpec(document,n.type.spec.toDOM(n,r))),new Fr(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&sn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=sn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=bt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=bt}}slice(e,n,r){let o=Fr.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Md(i,n,s,r)),e>0&&(i=Md(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}}class qn extends fs{constructor(e,n,r,o,i,s,l,a,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),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}=Zt.renderSpec(document,n.type.spec.toDOM(n)));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=C1(u,r,n),c?a=new BM(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Xa(e,n,r,o,u,f,i):new qn(e,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let 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=()=>E.empty)}return e}matchesNode(e,n,r){return this.dirty==bt&&e.eq(this.node)&&xd(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,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new jM(this,s&&s.node,e);_M(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?J.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(p=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,p,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==yr)&&(s&&this.protectLocalComposition(e,s),M1(this.contentDOM,this.children,e),Do&&WM(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof D)||r<n||o>n+this.node.content.size)return null;let i=e.domSelectionRange(),s=UM(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,a=JM(this.node.content,l,r-n,o-n);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){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 s=new zM(this,i,n,o);e.input.compositionNodes.push(s),this.children=Md(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==sn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=bt}updateOuterDeco(e){if(xd(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=E1(this.dom,this.nodeDOM,Sd(this.outerDeco,this.node,n),Sd(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.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function sm(t,e,n,r,o){C1(r,e,t);let i=new qn(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Xa extends qn{constructor(e,n,r,o,i,s,l){super(e,n,r,o,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==sn||this.dirty!=bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=bt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=bt,!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 o=this.node.cut(e,n),i=document.createTextNode(o.text);return new Xa(this.parent,o,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=sn)}get domAtom(){return!1}}class x1 extends fs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class BM extends qn{constructor(e,n,r,o,i,s,l,a,c,u){super(e,n,r,o,i,s,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==sn)return!1;if(this.spec.update){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,o)}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 M1(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=lm(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof Fr){let a=r?r.previousSibling:t.lastChild;M1(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=lm(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Ei=function(t){t&&(this.nodeName=t)};Ei.prototype=Object.create(null);const vr=[new Ei];function Sd(t,e,n){if(t.length==0)return vr;let r=n?vr[0]:new Ei,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Ei(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new Ei(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 o}function E1(t,e,n,r){if(n==vr&&r==vr)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=vr[0]),o=a}FM(o,l||vr[0],s)}return o}function FM(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function C1(t,e,n){return E1(t,t,vr,Sd(e,n,t.nodeType!=1))}function xd(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 lm(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class jM{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=HM(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){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=bt,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Fr.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,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,o,i){let s=this.top.children[o];return s.dirty==sn&&s.dom==s.contentDOM&&(s.dirty=yr),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof qn){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!=sn&&xd(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.top.children[this.index]=d,d.contentDOM&&(d.dirty=yr,d.updateChildren(o,s+1),d.dirty=bt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let l=qn.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=qn.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new S1(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 Fr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Xa)||/\n\$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s\$/.test(e.node.text))&&((We||De)&&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 o=new x1(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function HM(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Fr)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(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function VM(t,e){return t.type.side-e.type.side}function _M(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(VM);for(let v=0;v<d.length;v++)n(d[v],c,!!a)}else n(u,c,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let v=0;v<l.length;v++)l[v].to<=i&&l.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let v=h;s<o.length&&o[s].from<v&&(v=o[s].from);for(let m=0;m<l.length;m++)l[m].to<v&&(v=l[m].to);v<h&&(a=f.cut(v-i),f=f.cut(0,v-i),h=v,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let g=f.isInline&&!f.isLeaf?l.filter(v=>!v.inline):l.slice();r(f,g,e.forChild(i,f),p),i=h}}function WM(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 UM(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=Xt(t)}else if(t.nodeType==1&&e<t.childNodes.length)t=t.childNodes[e],e=0;else return null}}function JM(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);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 Md(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Wf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Ya(n)){for(a=l;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&P.isSelectable(u)&&o.parent&&!(u.isInline&&gM(n.focusNode,n.focusOffset,o.dom))){let d=o.posBefore;c=new P(s==d?l:r.resolve(d))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;a=r.resolve(u)}if(!c){let u=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Uf(t,a,l,u)}return c}function T1(t){return t.editable?t.hasFocus():N1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function mn(t,e=!1){let n=t.state.selection;if(O1(t,n),!!T1(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&De){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Br(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)qM(t);else{let{anchor:r,head:o}=n,i,s;am&&!(n instanceof D)&&(n.\$from.parent.inlineContent||(i=cm(t,n.from)),!n.empty&&!n.\$from.parent.inlineContent&&(s=cm(t,n.to))),t.docView.setSelection(r,o,t.root,e),am&&(i&&um(i),s&&um(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&KM(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const am=We||De&&wM<63;function cm(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(We&&o&&o.contentEditable=="false")return qc(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return qc(o);if(i)return qc(i)}}function qc(t){return t.contentEditable="true",We&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function um(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function KM(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!T1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function qM(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setEnd(r.parentNode,Ve(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&rt&&Kn<=11&&(r.disabled=!0,r.disabled=!1)}function O1(t,e){if(e instanceof P){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(dm(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else dm(t)}function dm(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Uf(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||D.between(e,n,r)}function fm(t){return t.editable&&!t.hasFocus()?!1:N1(t)}function N1(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 QM(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Br(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ed(t,e){let{\$anchor:n,\$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&j.findFrom(i,e)}function On(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function pm(t,e,n){let r=t.state.selection;if(r instanceof D)if(n.indexOf("s")>-1){let{\$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return On(t,new D(r.\$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Ed(t.state,e);return o&&o instanceof P?On(t,o):!1}else if(!(Et&&n.indexOf("m")>-1)){let o=r.\$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?P.isSelectable(i)?On(t,new P(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):ds?On(t,new D(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof P&&r.node.isInline)return On(t,new D(e>0?r.\$to:r.\$from));{let o=Ed(t.state,e);return o?On(t,o):!1}}}function Hl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ci(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Jr(t,e){return e<0?GM(t):YM(t)}function GM(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Wt&&n.nodeType==1&&r<Hl(n)&&Ci(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Ci(l,-1))o=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(b1(n))break;{let l=n.previousSibling;for(;l&&Ci(l,-1);)o=n.parentNode,i=Ve(l),l=l.previousSibling;if(l)n=l,r=Hl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Cd(t,n,r):o&&Cd(t,o,i)}function YM(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Hl(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Ci(l,1))i=n,s=++r;else break}else{if(b1(n))break;{let l=n.nextSibling;for(;l&&Ci(l,1);)i=l.parentNode,s=Ve(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Hl(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Cd(t,i,s)}function b1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function XM(t,e){for(;t&&e==t.childNodes.length&&!Vf(t);)e=Ve(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 ZM(t,e){for(;t&&!e&&!Vf(t);)e=Ve(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 Cd(t,e,n){if(e.nodeType!=3){let i,s;(s=XM(e,n))?(e=s,n=0):(i=ZM(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(Ya(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:o}=t;setTimeout(()=>{t.state==o&&mn(t)},50)}function hm(t,e){let n=t.state.doc.resolve(e);if(!(De||kM)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left<r.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function mm(t,e,n){let r=t.state.selection;if(r instanceof D&&!r.empty||n.indexOf("s")>-1||Et&&n.indexOf("m")>-1)return!1;let{\$from:o,\$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Ed(t.state,e);if(s&&s instanceof P)return On(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof Vt?j.near(s,e):j.findFrom(s,e);return l?On(t,l):!1}return!1}function gm(t,e){if(!(t.state.selection instanceof D))return!0;let{\$head:n,\$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)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 s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function ym(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function eE(t){if(!We||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;ym(t,r,"true"),setTimeout(()=>ym(t,r,"false"),20)}return!1}function tE(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function nE(t,e){let n=e.keyCode,r=tE(e);if(n==8||Et&&n==72&&r=="c")return gm(t,-1)||Jr(t,-1);if(n==46&&!e.shiftKey||Et&&n==68&&r=="c")return gm(t,1)||Jr(t,1);if(n==13||n==27)return!0;if(n==37||Et&&n==66&&r=="c"){let o=n==37?hm(t,t.state.selection.from)=="ltr"?-1:1:-1;return pm(t,o,r)||Jr(t,o)}else if(n==39||Et&&n==70&&r=="c"){let o=n==39?hm(t,t.state.selection.from)=="ltr"?1:-1:1;return pm(t,o,r)||Jr(t,o)}else{if(n==38||Et&&n==80&&r=="c")return mm(t,-1,r)||Jr(t,-1);if(n==40||Et&&n==78&&r=="c")return eE(t)||mm(t,1,r)||Jr(t,1);if(r==(Et?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function A1(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||Zt.fromSchema(t.state.schema),l=D1(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=P1[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=l.createElement(u[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",\`\${o} \${i}\${d?\` -\${d}\`:""} \${JSON.stringify(n)}\`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,\`

\`);return{dom:a,text:f}}function \$1(t,e,n,r,o){let i=o.parent.type.spec.code,s,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 e?new A(E.from(t.state.schema.text(e.replace(/\r\n?/g,\`
\`))),0,0):A.empty;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:p}=t.state,h=Zt.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=s.appendChild(document.createElement("p"));g&&v.appendChild(h.serializeNode(p.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=iE(n),ds&&sE(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ro.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!rE.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)l=lE(vm(l,+u[1],+u[2]),u[4]);else if(l=A.maxOpen(oE(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let p=l.content.firstChild;d<l.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=vm(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t)}),l}const rE=/^(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 oE(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),o,i=[];if(t.forEach(s=>{if(!i)return;let l=r.findWrapping(s.type),a;if(!l)return i=null;if(a=i.length&&o.length&&R1(l,o,s,i[i.length-1],0))i[i.length-1]=a;else{i.length&&(i[i.length-1]=L1(i[i.length-1],o.length));let c=I1(s,l);i.push(c),r=r.matchType(c.type),o=l}}),i)return E.from(i)}return t}function I1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,E.from(t));return t}function R1(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=R1(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(E.from(I1(n,t,o+1))))}}function L1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,L1(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(E.empty,!0);return t.copy(n.append(r))}function Td(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=Td(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(E.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function vm(t,e,n){return e<t.openStart&&(t=new A(Td(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new A(Td(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const P1={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 wm=null;function D1(){return wm||(wm=document.implementation.createHTMLDocument("title"))}function iE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=D1().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&P1[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=t,o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function sE(t){let e=t.querySelectorAll(De?"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 lE(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:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=E.from(a.create(r[l+1],o)),i++,s++}return new A(o,i,s)}const Ue={},Je={},aE={touchstart:!0,touchmove:!0};class cE{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function uE(t){for(let e in Ue){let n=Ue[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{fE(t,r)&&!Jf(t,r)&&(t.editable||!(r.type in Je))&&n(t,r)},aE[e]?{passive:!0}:void 0)}We&&t.dom.addEventListener("input",()=>null),Od(t)}function Bn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function dE(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 Od(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Jf(t,r))})}function Jf(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function fE(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 pE(t,e){!Jf(t,e)&&Ue[e.type]&&(t.editable||!(e.type in Je))&&Ue[e.type](t,e)}Je.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!B1(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(zt&&De&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Do&&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",o=>o(t,pr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||nE(t,n)?n.preventDefault():Bn(t,"key")};Je.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Je.keypress=(t,e)=>{let n=e;if(B1(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Et&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof D)||!r.\$from.sameParent(r.\$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.\$from.pos,r.\$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function Za(t){return{left:t.clientX,top:t.clientY}}function hE(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Kf(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Eo(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function mE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(Eo(t,new P(n)),!0):!1}function gE(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof P&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(P.isSelectable(l)){r&&n.\$from.depth>0&&s>=n.\$from.depth&&i.before(n.\$from.depth+1)==n.\$from.pos?o=i.before(n.\$from.depth):o=i.before(s);break}}return o!=null?(Eo(t,P.create(t.state.doc,o)),!0):!1}function yE(t,e,n,r,o){return Kf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?gE(t,n):mE(t,n))}function vE(t,e,n,r){return Kf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function wE(t,e,n,r){return Kf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||kE(t,n,r)}function kE(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Eo(t,D.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Eo(t,D.create(r,l+1,l+1+s.content.size));else if(P.isSelectable(s))Eo(t,P.create(r,l));else continue;return!0}}function qf(t){return Vl(t)}const z1=Et?"metaKey":"ctrlKey";Ue.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=qf(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&hE(n,t.input.lastClick)&&!n[z1]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(Za(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new SE(t,s,n,!!r)):(i=="doubleClick"?vE:wE)(t,s.pos,s.inside,n)?n.preventDefault():Bn(t,"pointer"))};class SE{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[z1],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof P&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!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)),Bn(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(()=>mn(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(Za(e))),this.updateAllowDefault(e),this.allowDefault||!n?Bn(this.view,"pointer"):yE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||We&&this.mightDrag&&!this.mightDrag.node.isAtom||De&&!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)?(Eo(this.view,j.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Bn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Bn(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)}}Ue.touchstart=t=>{t.input.lastTouch=Date.now(),qf(t),Bn(t,"pointer")};Ue.touchmove=t=>{t.input.lastTouch=Date.now(),Bn(t,"pointer")};Ue.contextmenu=t=>qf(t);function B1(t,e){return t.composing?!0:We&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const xE=zt?5e3:-1;Je.compositionstart=Je.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.\$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Vl(t,!0),t.markCursor=null;else if(Vl(t),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){t.domSelection().collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}F1(t,xE)};Je.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.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,F1(t,20))};function F1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Vl(t),e))}function j1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ME());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ME(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Vl(t,e=!1){if(!(zt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),j1(t),e||t.docView&&t.docView.dirty){let n=Wf(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function EE(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Yi=rt&&Kn<15||Do&&SM<604;Ue.copy=Je.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Yi?null:n.clipboardData,s=r.content(),{dom:l,text:a}=A1(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):EE(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function CE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function TE(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xi(t,r.value,null,o,e):Xi(t,r.textContent,r.innerHTML,o,e)},50)}function Xi(t,e,n,r,o){let i=\$1(t,e,n,r,t.state.selection.\$from);if(t.someProp("handlePaste",a=>a(t,o,i||A.empty)))return!0;if(!i)return!1;let s=CE(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function H1(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," "):""}Je.paste=(t,e)=>{let n=e;if(t.composing&&!zt)return;let r=Yi?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Xi(t,H1(r),r.getData("text/html"),o,n)?n.preventDefault():TE(t,n)};class V1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const _1=Et?"altKey":"ctrlKey";Ue.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Za(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof P?o.to-1:o.to))){if(r&&r.mightDrag)s=P.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(s=P.create(t.state.doc,u.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c}=A1(t,l);n.dataTransfer.clearData(),n.dataTransfer.setData(Yi?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Yi||n.dataTransfer.setData("text/plain",c),t.dragging=new V1(l,!n[_1],s)};Ue.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Je.dragover=Je.dragenter=(t,e)=>e.preventDefault();Je.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Za(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t)}):s=\$1(t,H1(n.dataTransfer),Yi?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&!n[_1]);if(t.someProp("handleDrop",h=>h(t,n,s||A.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?s1(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=t.state.tr;if(l){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&P.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new P(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,v,m,y)=>h=y),c.setSelection(Uf(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ue.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())&&mn(t)},20))};Ue.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)};Ue.beforeinput=(t,e)=>{if(De&&zt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,pr(8,"Backspace")))))return;let{\$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Je)Ue[t]=Je[t];function Zi(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 _l{constructor(e,n){this.toDOM=e,this.spec=n||Ar,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ze(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof _l&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Zi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Qn{constructor(e,n){this.attrs=e,this.spec=n||Ar}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ze(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Qn&&Zi(this.attrs,e.attrs)&&Zi(this.spec,e.spec)}static is(e){return e.type instanceof Qn}destroy(){}}class Qf{constructor(e,n){this.attrs=e,this.spec=n||Ar}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ze(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Qf&&Zi(this.attrs,e.attrs)&&Zi(this.spec,e.spec)}destroy(){}}class Ze{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ze(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 Ze(e,e,new _l(n,r))}static inline(e,n,r,o){return new Ze(e,n,new Qn(r,o))}static node(e,n,r,o){return new Ze(e,n,new Qf(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Qn}get widget(){return this.type instanceof _l}}const Gr=[],Ar={};class oe{constructor(e,n){this.local=e.length?e:Gr,this.children=n.length?n:Gr}static create(e,n){return n.length?Wl(n,e,0,Ar):Le}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Le||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ar)}mapInner(e,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?OE(this.children,s||[],e,n,r,o,i):s?new oe(s.sort(\$r),Gr):Le}add(e,n){return n.length?this==Le?oe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=U1(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Wl(u,l,c+1,Ar)),i+=3}});let s=W1(i?J1(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new oe(s.length?this.local.concat(s).sort(\$r):this.local,o||this.children)}remove(e){return e.length==0||this==Le?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,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,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Le?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new oe(o,r):Le}forChild(e,n){if(this==Le)return this;if(n.isLeaf)return oe.empty;let r,o;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,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof Qn){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new oe(o.sort(\$r),Gr);return r?new In([l,r]):l}return r||Le}eq(e){if(this==e)return!0;if(!(e instanceof oe)||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 Gf(this.localsInner(e))}localsInner(e){if(this==Le)return Gr;if(e.inlineContent||!this.local.some(Qn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Qn||n.push(this.local[r]);return n}}oe.empty=new oe([],[]);oe.removeOverlap=Gf;const Le=oe.empty;class In{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Ar));return In.from(r)}forChild(e,n){if(n.isLeaf)return oe.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Le&&(i instanceof In?r=r.concat(i.members):r.push(i))}return In.from(r)}eq(e){if(!(e instanceof In)||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 o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Gf(r?n:n.sort(\$r)):Gr}static from(e){switch(e.length){case 0:return Le;case 1:return e[0];default:return new In(e.every(n=>n instanceof oe)?e:e.reduce((n,r)=>n.concat(r instanceof oe?r:r.members),[]))}}}function OE(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,p,h,g)=>{let v=g-h-(p-f);for(let m=0;m<l.length;m+=3){let y=l[m+1];if(y<0||f>y+u-d)continue;let w=l[m]+u-d;p>=w?l[m+1]=f<=w?-2:-1:f>=u&&v&&(l[m]+=v,l[m+1]+=v)}d+=v}),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-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),p=f-o,{index:h,offset:g}=r.content.findIndex(d),v=r.maybeChild(h);if(v&&g==d&&g+v.nodeSize==p){let m=l[c+2].mapInner(n,v,u+1,t[c]+i+1,s);m!=Le?(l[c]=d,l[c+1]=p,l[c+2]=m):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=NE(l,t,e,n,o,i,s),u=Wl(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new oe(e.sort(\$r),l)}function W1(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Ze(o.from+e,o.to+e,o.type))}return n}function NE(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function U1(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function J1(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Wl(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=U1(t,l,a+n);if(c){i=!0;let u=Wl(c,l,n+a+1,r);u!=Le&&o.push(a,a+l.nodeSize,u)}});let s=W1(i?J1(t):t,-n).sort(\$r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new oe(s,o):Le}function \$r(t,e){return t.from-e.from||t.to-e.to}function Gf(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),km(e,o+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),km(e,o,r.copy(i.from,r.to)));break}}}return e}function km(t,e,n){for(;e<t.length&&\$r(n,t[e])>0;)e++;t.splice(e,0,n)}function Qc(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Le&&e.push(r)}),t.cursorWrapper&&e.push(oe.create(t.state.doc,[t.cursorWrapper.deco])),In.from(e)}const bE={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AE=rt&&Kn<=11;class \$E{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 IE{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new \$E,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);rt&&Kn<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),AE&&(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,bE)),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(fm(this.view)){if(this.suppressingSelectionUpdates)return mn(this.view);if(rt&&Kn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Br(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=Gi(i))n.add(i);for(let i=e.anchorNode;i;i=Gi(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.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(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fm(e)&&!this.ignoreSelectionChange(r),i=-1,s=-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),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Wt&&a.length>1){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let d=u[0],f=u[1];d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ya(r)&&(c=Wf(e))&&c.eq(j.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,mn(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),RE(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mn(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++)n.push(e.addedNodes[u]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(rt&&Kn<=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)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?Ve(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Ve(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}:{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Sm=new WeakMap,xm=!1;function RE(t){if(!Sm.has(t)&&(Sm.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,xm)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."),xm=!0}}function LE(t){let e;function n(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0);let r=e.startContainer,o=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return Br(l.node,l.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}function PE(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,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}],Ya(a)||c.push({node:a.focusNode,offset:a.focusOffset})),De&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let m=r.childNodes[v-1],y=m.pmViewDesc;if(m.nodeName=="BR"&&!y){i=v;break}if(!y||y.size)break}let d=t.state.doc,f=t.someProp("domParser")||Ro.fromSchema(t.state.schema),p=d.resolve(s),h=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:DE,context:p});if(c&&c[0].pos!=null){let v=c[0].pos,m=c[1]&&c[1].pos;m==null&&(m=v),h={anchor:v+s,head:m+s}}return{doc:g,sel:h,from:s,to:l}}function DE(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(We&&/^(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||We&&/^(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 zE=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)\$/i;function BE(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let O=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=Wf(t,O);if(R&&!t.state.selection.eq(R)){if(De&&zt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",lt=>lt(t,pr(13,"Enter"))))return;let Z=t.state.tr.setSelection(R);O=="pointer"?Z.setMeta("pointer",!0):O=="key"&&Z.scrollIntoView(),i&&Z.setMeta("composition",i),t.dispatch(Z)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=PE(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=HE(d.content,c.doc.content,c.from,f,p);if((Do&&t.input.lastIOSEnter>Date.now()-225||zt)&&o.some(O=>O.nodeType==1&&!zE.test(O.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",O=>O(t,pr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof D&&!a.empty&&a.\$head.sameParent(a.\$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let O=Mm(t,t.state.doc,c.sel);if(O&&!O.eq(t.state.selection)){let R=t.state.tr.setSelection(O);i&&R.setMeta("composition",i),t.dispatch(R)}}return}if(De&&t.cursorWrapper&&c.sel&&c.sel.anchor==t.cursorWrapper.deco.from&&c.sel.head==c.sel.anchor){let O=h.endB-h.start;c.sel={anchor:c.sel.anchor+O,head:c.sel.anchor+O}}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof D&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),rt&&Kn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let g=c.doc.resolveNoCache(h.start-c.from),v=c.doc.resolveNoCache(h.endB-c.from),m=u.resolve(h.start),y=g.sameParent(v)&&g.parent.inlineContent&&m.end()>=h.endA,w;if((Do&&t.input.lastIOSEnter>Date.now()-225&&(!y||o.some(O=>O.nodeName=="DIV"||O.nodeName=="P"))||!y&&g.pos<c.doc.content.size&&!g.sameParent(v)&&(w=j.findFrom(c.doc.resolve(g.pos+1),1,!0))&&w.head==v.pos)&&t.someProp("handleKeyDown",O=>O(t,pr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&jE(u,h.start,h.endA,g,v)&&t.someProp("handleKeyDown",O=>O(t,pr(8,"Backspace")))){zt&&De&&t.domObserver.suppressSelectionUpdates();return}De&&zt&&h.endB==h.start&&(t.input.lastAndroidDelete=Date.now()),zt&&!y&&g.start()!=v.start()&&v.parentOffset==0&&g.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,v=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(O){return O(t,pr(13,"Enter"))})},20));let S=h.start,x=h.endA,k,M,T;if(y){if(g.pos==v.pos)rt&&Kn<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(t),20)),k=t.state.tr.delete(S,x),M=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(T=FE(g.parent.content.cut(g.parentOffset,v.parentOffset),m.parent.content.cut(m.parentOffset,h.endA-m.start()))))k=t.state.tr,T.type=="add"?k.addMark(S,x,T.mark):k.removeMark(S,x,T.mark);else if(g.parent.child(g.index()).isText&&g.index()==v.index()-(v.textOffset?0:1)){let O=g.parent.textBetween(g.parentOffset,v.parentOffset);if(t.someProp("handleTextInput",R=>R(t,S,x,O)))return;k=t.state.tr.insertText(O,S,x)}}if(k||(k=t.state.tr.replace(S,x,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let O=Mm(t,k.doc,c.sel);O&&!(De&&zt&&t.composing&&O.empty&&(h.start!=h.endB||t.input.lastAndroidDelete<Date.now()-100)&&(O.head==S||O.head==k.mapping.map(x)-1)||rt&&O.empty&&O.head==S)&&k.setSelection(O)}M&&k.ensureMarks(M),i&&k.setMeta("composition",i),t.dispatch(k.scrollIntoView())}function Mm(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Uf(t,e.resolve(n.anchor),e.resolve(n.head))}function FE(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(E.from(c).eq(t))return{mark:l,type:s}}function jE(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Gc(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Gc(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Gc(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Gc(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function HE(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&t.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&Em(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&Em(t.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Em(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 VE{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 cE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(bm),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=Om(this),Tm(this),this.nodeViews=Nm(this),this.docView=sm(this.state.doc,Cm(this),Qc(this),this.dom,this),this.domObserver=new IE(this,(r,o,i,s)=>BE(this,r,o,i,s)),this.domObserver.start(),uE(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&&Od(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(bm),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 o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(j1(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Nm(this);WE(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Od(this),this.editable=Om(this),Tm(this);let a=Qc(this),c=Cm(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&EM(this);if(s){this.domObserver.stop();let p=d&&(rt||De)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&_E(o.selection,e.selection);if(d){let h=De?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=sm(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&QM(this))?mn(this,p):(O1(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&CM(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof P){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&em(this,n.getBoundingClientRect(),e)}else em(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,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new V1(e.slice,e.move,o<0?void 0:P.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(rt){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&&TM(this.dom),mn(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 \$M(this,e)}coordsAtPos(e,n=1){return w1(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return DM(this,n||this.state,e)}pasteHTML(e,n){return Xi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Xi(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(dE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Qc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return pE(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return We&&this.root.nodeType===11&&yM(this.dom.ownerDocument)==this.dom?LE(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Cm(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"),[Ze.node(0,t.state.doc.content.size,e)]}function Tm(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:Ze.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Om(t){return!t.someProp("editable",e=>e(t.state)===!1)}function _E(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 Nm(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WE(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function bm(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 Zn={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:"'"},Ul={48:")",49:"!",50:"@",51:"#",52:"\$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},UE=typeof navigator<"u"&&/Mac/.test(navigator.platform),JE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ne=0;Ne<10;Ne++)Zn[48+Ne]=Zn[96+Ne]=String(Ne);for(var Ne=1;Ne<=24;Ne++)Zn[Ne+111]="F"+Ne;for(var Ne=65;Ne<=90;Ne++)Zn[Ne]=String.fromCharCode(Ne+32),Ul[Ne]=String.fromCharCode(Ne);for(var Yc in Zn)Ul.hasOwnProperty(Yc)||(Ul[Yc]=Zn[Yc]);function KE(t){var e=UE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||JE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ul:Zn)[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 qE=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function QE(t){let e=t.split(/-(?!\$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)\$/i.test(a))s=!0;else if(/^a(lt)?\$/i.test(a))r=!0;else if(/^(c|ctrl|control)\$/i.test(a))o=!0;else if(/^s(hift)?\$/i.test(a))i=!0;else if(/^mod\$/i.test(a))qE?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function GE(t){let e=Object.create(null);for(let n in t)e[QE(n)]=t[n];return e}function Xc(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 YE(t){return new pe({props:{handleKeyDown:XE(t)}})}function XE(t){let e=GE(t);return function(n,r){let o=KE(r),i,s=e[Xc(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Xc(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=Zn[r.keyCode])&&i!=o){let l=e[Xc(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const ZE=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function eC(t,e){let{\$cursor:n}=t.selection;return!n||n.parentOffset>0?null:n}const tC=(t,e,n)=>{let r=eC(t);if(!r)return!1;let o=K1(r);if(!o){let s=r.blockRange(),l=s&&Wo(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&G1(t,o,e))return!0;if(r.parent.content.size==0&&(zo(i,"end")||P.isSelectable(i))){let s=jf(t.doc,r.before(),r.after(),A.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(zo(i,"end")?j.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):P.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function zo(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 nC=(t,e,n)=>{let{\$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(r.parentOffset>0)return!1;i=K1(r)}let s=i&&i.nodeBefore;return!s||!P.isSelectable(s)?!1:(e&&e(t.tr.setSelection(P.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function K1(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 rC(t,e){let{\$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const oC=(t,e,n)=>{let r=rC(t);if(!r)return!1;let o=q1(r);if(!o)return!1;let i=o.nodeAfter;if(G1(t,o,e))return!0;if(r.parent.content.size==0&&(zo(i,"start")||P.isSelectable(i))){let s=jf(t.doc,r.before(),r.after(),A.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(zo(i,"start")?j.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):P.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},iC=(t,e,n)=>{let{\$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(r.parentOffset<r.parent.content.size)return!1;i=q1(r)}let s=i&&i.nodeAfter;return!s||!P.isSelectable(s)?!1:(e&&e(t.tr.setSelection(P.create(t.doc,i.pos)).scrollIntoView()),!0)};function q1(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 sC=(t,e)=>{let n=t.selection,r=n instanceof P,o;if(r){if(n.node.isTextblock||!or(t.doc,n.from))return!1;o=n.from}else if(o=Qa(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(P.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},lC=(t,e)=>{let n=t.selection,r;if(n instanceof P){if(n.node.isTextblock||!or(t.doc,n.to))return!1;r=n.to}else if(r=Qa(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},aC=(t,e)=>{let{\$from:n,\$to:r}=t.selection,o=n.blockRange(r),i=o&&Wo(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},cC=(t,e)=>{let{\$head:n,\$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(\`
\`).scrollIntoView()),!0)};function Q1(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 uC=(t,e)=>{let{\$head:n,\$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Q1(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(j.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},dC=(t,e)=>{let n=t.selection,{\$from:r,\$to:o}=n;if(n instanceof Vt||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Q1(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(D.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},fC=(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(xo(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Wo(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)},pC=(t,e)=>{let{\$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(P.create(t.doc,o))),!0)};function hC(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.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)||!(o.isTextblock||or(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function G1(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(hC(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(n){let d=e.pos+o.nodeSize,f=E.empty;for(let g=i.length-1;g>=0;g--)f=E.from(i[g].create(null,f));f=E.from(r.copy(f));let p=t.tr.step(new xe(e.pos-1,d,e.pos,d,new A(f,1,0),i.length,!0)),h=d+2*i.length;or(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}let a=j.findFrom(e,1),c=a&&a.\$from.blockRange(a.\$to),u=c&&Wo(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(l&&zo(o,"start",!0)&&zo(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let p=o,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(d.canReplace(d.childCount,d.childCount,p.content)){if(n){let g=E.empty;for(let m=f.length-1;m>=0;m--)g=E.from(f[m].copy(g));let v=t.tr.step(new xe(e.pos-f.length,e.pos+o.nodeSize,e.pos+h,e.pos+o.nodeSize-h,new A(g,f.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Y1(t){return function(e,n){let r=e.selection,o=t<0?r.\$from:r.\$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(D.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const mC=Y1(-1),gC=Y1(1);function yC(t,e=null){return function(n,r){let{\$from:o,\$to:i}=n.selection,s=o.blockRange(i),l=s&&Ff(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Am(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{\$from:{pos:s},\$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{\$from:{pos:l},\$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function vC(t,e=null){return function(n,r){let{\$from:o,\$to:i}=n.selection,s=o.blockRange(i),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);a=new zl(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new zl(o,n.doc.resolve(i.end(s.depth)),s.depth)),l=!0}let c=Ff(a,t,e,s);return c?(r&&r(wC(n.tr,s,c,l,t).scrollIntoView()),!0):!1}}function wC(t,e,n,r,o){let i=E.empty;for(let u=n.length-1;u>=0;u--)i=E.from(n[u].type.create(n[u].attrs,i));t.step(new xe(e.start-(r?2:0),e.end,e.start,e.end,new A(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,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&&xo(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function kC(t){return function(e,n){let{\$from:r,\$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?SC(e,n,t,i):xC(e,n,i):!0:!1}}function SC(t,e,n,r){let o=t.tr,i=r.end,s=r.\$to.end(r.depth);i<s&&(o.step(new xe(i-1,s,i,s,new A(E.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new zl(o.doc.resolve(r.\$from.pos),o.doc.resolve(s),r.depth));const l=Wo(r);if(l==null)return!1;o.lift(r,l);let a=o.mapping.map(i,-1)-1;return or(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function xC(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,g=n.startIndex;h>g;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?E.empty:E.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new xe(d-(l?1:0),f+(a?1:0),d+1,f-1,new A((l?E.empty:E.from(o.copy(E.empty))).append(a?E.empty:E.from(o.copy(E.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function MC(t){return function(e,n){let{\$from:r,\$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=E.from(c?t.create():null),d=new A(E.from(t.create(null,E.from(l.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new xe(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function ec(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,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 o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}class tc{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>{const u=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...h)=>{const g=this.buildProps(c,n),v=p(...h)(g);return l.push(v),d}])),run:u};return d}createCan(e){const{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(e,n=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:ec({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}class EC{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function I(t,e,n){return t.config[e]===void 0&&t.parent?I(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?I(t.parent,e,n):null}):t.config[e]}function nc(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function X1(t){const e=[],{nodeExtensions:n,markExtensions:r}=nc(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=I(s,"addGlobalAttributes",l);a&&a().forEach(c=>{c.types.forEach(u=>{Object.entries(c.attributes).forEach(([d,f])=>{e.push({type:u,name:d,attribute:{...i,...f}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=I(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function Ee(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}function X(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const s=i?i.split(" "):[],l=r[o]?r[o].split(" "):[],a=s.filter(c=>!l.includes(c));r[o]=[...l,...a].join(" ")}else o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function Nd(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>X(n,r),{})}function Z1(t){return typeof t=="function"}function V(t,e=void 0,...n){return Z1(t)?e?t.bind(e)(...n):t(...n):t}function CC(t={}){return Object.keys(t).length===0&&t.constructor===Object}function TC(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+\$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function \$m(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):TC(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function Im(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&CC(n)?!1:n!=null))}function OC(t,e){var n;const r=X1(t),{nodeExtensions:o,markExtensions:i}=nc(t),s=(n=o.find(c=>I(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((m,y)=>{const w=I(y,"extendNodeSchema",d);return{...m,...w?w(c):{}}},{}),p=Im({...f,content:V(I(c,"content",d)),marks:V(I(c,"marks",d)),group:V(I(c,"group",d)),inline:V(I(c,"inline",d)),atom:V(I(c,"atom",d)),selectable:V(I(c,"selectable",d)),draggable:V(I(c,"draggable",d)),code:V(I(c,"code",d)),defining:V(I(c,"defining",d)),isolating:V(I(c,"isolating",d)),attrs:Object.fromEntries(u.map(m=>{var y;return[m.name,{default:(y=m==null?void 0:m.attribute)===null||y===void 0?void 0:y.default}]}))}),h=V(I(c,"parseHTML",d));h&&(p.parseDOM=h.map(m=>\$m(m,u)));const g=I(c,"renderHTML",d);g&&(p.toDOM=m=>g({node:m,HTMLAttributes:Nd(m,u)}));const v=I(c,"renderText",d);return v&&(p.toText=v),[c.name,p]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((v,m)=>{const y=I(m,"extendMarkSchema",d);return{...v,...y?y(c):{}}},{}),p=Im({...f,inclusive:V(I(c,"inclusive",d)),excludes:V(I(c,"excludes",d)),group:V(I(c,"group",d)),spanning:V(I(c,"spanning",d)),code:V(I(c,"code",d)),attrs:Object.fromEntries(u.map(v=>{var m;return[v.name,{default:(m=v==null?void 0:v.attribute)===null||m===void 0?void 0:m.default}]}))}),h=V(I(c,"parseHTML",d));h&&(p.parseDOM=h.map(v=>\$m(v,u)));const g=I(c,"renderHTML",d);return g&&(p.toDOM=v=>g({mark:v,HTMLAttributes:Nd(v,u)})),[c.name,p]}));return new Dx({topNode:s,nodes:l,marks:a})}function Zc(t,e){return e.nodes[t]||e.marks[t]||null}function Rm(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const NC=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=u.slice(0,Math.max(0,r-i))}),n};function Yf(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class rc{constructor(e){this.find=e.find,this.handler=e.handler}}const bC=(t,e)=>{if(Yf(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 eu(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,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===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=NC(c)+i;return s.forEach(f=>{if(u)return;const p=bC(d,f.find);if(!p)return;const h=a.state.tr,g=ec({state:a.state,transaction:h}),v={from:r-(p[0].length-i.length),to:o},{commands:m,chain:y,can:w}=new tc({editor:n,state:g});f.handler({state:g,range:v,match:p,commands:m,chain:y,can:w})===null||!h.steps.length||(h.setMeta(l,{transform:h,from:r,to:o,text:i}),a.dispatch(h),u=!0)}),u}function AC(t){const{editor:e,rules:n}=t,r=new pe({state:{init(){return null},apply(o,i){return o.getMeta(r)||(o.selectionSet||o.docChanged?null:i)}},props:{handleTextInput(o,i,s,l){return eu({editor:e,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{\$cursor:i}=o.state.selection;i&&eu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{\$cursor:s}=o.state.selection;return s?eu({editor:e,from:s.pos,to:s.pos,text:\`
\`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function \$C(t){return typeof t=="number"}class IC{constructor(e){this.find=e.find,this.handler=e.handler}}const RC=(t,e,n)=>{if(Yf(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function LC(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new tc({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(f,p)=>{if(!f.isTextblock||f.type.spec.code)return;const h=Math.max(r,p),g=Math.min(o,p+f.content.size),v=f.textBetween(h-p,g-p,void 0,"￼");RC(v,i.find,s).forEach(m=>{if(m.index===void 0)return;const y=h+m.index+1,w=y+m[0].length,S={from:n.tr.mapping.map(y),to:n.tr.mapping.map(w)},x=i.handler({state:n,range:S,match:m,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(x)})}),d.every(f=>f!==null)}function PC(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=new ClipboardEvent("paste"),l=new DragEvent("drop");return n.map(a=>new pe({view(c){const u=d=>{var f;r=!((f=c.dom.parentElement)===null||f===void 0)&&f.contains(d.target)?c.dom.parentElement:null};return window.addEventListener("dragstart",u),{destroy(){window.removeEventListener("dragstart",u)}}},props:{handleDOMEvents:{drop:(c,u)=>(i=r===c.dom.parentElement,l=u,!1),paste:(c,u)=>{var d;const f=(d=u.clipboardData)===null||d===void 0?void 0:d.getData("text/html");return s=u,o=!!(f!=null&&f.includes("data-pm-slice")),!1}}},appendTransaction:(c,u,d)=>{const f=c[0],p=f.getMeta("uiEvent")==="paste"&&!o,h=f.getMeta("uiEvent")==="drop"&&!i;if(!p&&!h)return;const g=u.doc.content.findDiffStart(d.doc.content),v=u.doc.content.findDiffEnd(d.doc.content);if(!\$C(g)||!v||g===v.b)return;const m=d.tr,y=ec({state:d,transaction:m});if(!(!LC({editor:e,state:y,from:Math.max(g-1,0),to:v.b-1,rule:a,pasteEvent:s,dropEvent:l})||!m.steps.length))return l=new DragEvent("drop"),s=new ClipboardEvent("paste"),m}}))}function DC(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class ho{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ho.resolve(e),this.schema=OC(this.extensions,n),this.extensions.forEach(r=>{var o;this.editor.extensionStorage[r.name]=r.storage;const i={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Zc(r.name,this.schema)};r.type==="mark"&&(!((o=V(I(r,"keepOnSplit",i)))!==null&&o!==void 0)||o)&&this.splittableMarks.push(r.name);const s=I(r,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);const l=I(r,"onCreate",i);l&&this.editor.on("create",l);const a=I(r,"onUpdate",i);a&&this.editor.on("update",a);const c=I(r,"onSelectionUpdate",i);c&&this.editor.on("selectionUpdate",c);const u=I(r,"onTransaction",i);u&&this.editor.on("transaction",u);const d=I(r,"onFocus",i);d&&this.editor.on("focus",d);const f=I(r,"onBlur",i);f&&this.editor.on("blur",f);const p=I(r,"onDestroy",i);p&&this.editor.on("destroy",p)})}static resolve(e){const n=ho.sort(ho.flatten(e)),r=DC(n.map(o=>o.name));return r.length&&console.warn(\`[tiptap warn]: Duplicate extension names found: [\${r.map(o=>\`'\${o}'\`).join(", ")}]. This can lead to issues.\`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},o=I(n,"addExtensions",r);return o?[n,...this.flatten(o())]:n}).flat(10)}static sort(e){return e.sort((n,r)=>{const o=I(n,"priority")||100,i=I(r,"priority")||100;return o>i?-1:o<i?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Zc(n.name,this.schema)},o=I(n,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){const{editor:e}=this,n=ho.sort([...this.extensions].reverse()),r=[],o=[],i=n.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Zc(s.name,this.schema)},a=[],c=I(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&s.config.exitable&&(u.ArrowRight=()=>st.handleExit({editor:e,mark:s})),c){const g=Object.fromEntries(Object.entries(c()).map(([v,m])=>[v,()=>m({editor:e})]));u={...u,...g}}const d=YE(u);a.push(d);const f=I(s,"addInputRules",l);Rm(s,e.options.enableInputRules)&&f&&r.push(...f());const p=I(s,"addPasteRules",l);Rm(s,e.options.enablePasteRules)&&p&&o.push(...p());const h=I(s,"addProseMirrorPlugins",l);if(h){const g=h();a.push(...g)}return a}).flat();return[AC({editor:e,rules:r}),...PC({editor:e,rules:o}),...i]}get attributes(){return X1(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=nc(this.extensions);return Object.fromEntries(n.filter(r=>!!I(r,"addNodeView")).map(r=>{const o=this.attributes.filter(a=>a.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ee(r.name,this.schema)},s=I(r,"addNodeView",i);if(!s)return[];const l=(a,c,u,d)=>{const f=Nd(a,o);return s()({editor:e,node:a,getPos:u,decorations:d,HTMLAttributes:f,extension:r})};return[r.name,l]}))}}function zC(t){return Object.prototype.toString.call(t).slice(8,-1)}function tu(t){return zC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function oc(t,e){const n={...t};return tu(t)&&tu(e)&&Object.keys(e).forEach(r=>{tu(e[r])?r in t?n[r]=oc(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class it{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${this.name}".\`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(I(this,"addOptions",{name:this.name}))),this.storage=V(I(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new it(e)}configure(e={}){const n=this.extend();return n.options=oc(this.options,e),n.storage=V(I(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new it(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${n.name}".\`),n.options=V(I(n,"addOptions",{name:n.name})),n.storage=V(I(n,"addStorage",{name:n.name,options:n.options})),n}}function ev(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=\`

\`,textSerializers:s={}}=n||{};let l="",a=!0;return t.nodesBetween(r,o,(c,u,d,f)=>{var p;const h=s==null?void 0:s[c.type.name];h?(c.isBlock&&!a&&(l+=i,a=!0),d&&(l+=h({node:c,pos:u,parent:d,index:f,range:e}))):c.isText?(l+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,o-u),a=!1):c.isBlock&&!a&&(l+=i,a=!0)}),l}function tv(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const BC=it.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new pe({key:new we("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(c=>c.\$from.pos)),l=Math.max(...i.map(c=>c.\$to.pos)),a=tv(n);return ev(r,{from:s,to:l},{textSerializers:a})}}})]}}),FC=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),jC=(t=!1)=>({commands:e})=>e.setContent("",t),HC=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({\$from:i,\$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Wo(p);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(h||h===0)&&e.lift(p,h)})}),!0},VC=t=>e=>t(e),_C=()=>({state:t,dispatch:e})=>dC(t,e),WC=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new D(r.doc.resolve(s-1))),!0},UC=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.\$anchor.node();if(r.content.size>0)return!1;const o=t.selection.\$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const s=o.before(i),l=o.after(i);t.delete(s,l).scrollIntoView()}return!0}return!1},JC=t=>({tr:e,state:n,dispatch:r})=>{const o=Ee(t,n.schema),i=e.selection.\$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const l=i.before(s),a=i.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},KC=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},qC=()=>({state:t,dispatch:e})=>ZE(t,e),QC=()=>({commands:t})=>t.keyboardShortcut("Enter"),GC=()=>({state:t,dispatch:e})=>uC(t,e);function Jl(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Yf(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function bd(t,e,n={}){return t.find(r=>r.type===e&&Jl(r.attrs,n))}function YC(t,e,n={}){return!!bd(t,e,n)}function Xf(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=bd([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(bd([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&YC([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function sr(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}const XC=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=sr(t,r.schema),{doc:s,selection:l}=n,{\$from:a,from:c,to:u}=l;if(o){const d=Xf(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=D.create(s,d.from,d.to);n.setSelection(f)}}return!0},ZC=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 nv(t){return t instanceof D}function wr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function rv(t,e=null){if(!e)return null;const n=j.atStart(t),r=j.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?D.create(t,wr(0,o,i),wr(t.content.size,o,i)):D.create(t,wr(e,o,i),wr(e,o,i))}function Zf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const eT=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{Zf()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!nv(n.state.selection))return s(),!0;const l=rv(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},tT=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),nT=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Ad=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&!/\S/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Ad(r)}return t};function Lm(t){const e=\`<body>\${t}</body>\`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Ad(n),Ad(n)}function Kl(t,e,n){if(n={slice:!0,parseOptions:{},...n},typeof t=="object"&&t!==null)try{return Array.isArray(t)&&t.length>0?E.fromArray(t.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),Kl("",e,n)}if(typeof t=="string"){const r=Ro.fromSchema(e);return n.slice?r.parseSlice(Lm(t),n.parseOptions).content:r.parse(Lm(t),n.parseOptions)}return Kl("",e,n)}function rT(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof Oe||o instanceof xe))return;const i=t.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(j.near(t.doc.resolve(s),n))}const oT=t=>t.toString().startsWith("<"),iT=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,...n};const s=Kl(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:l,to:a}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((oT(s)?s:[s]).forEach(d=>{d.check(),c=c?d.isText&&d.marks.length===0:!1,u=u?d.isBlock:!1}),l===a&&u){const{parent:d}=r.doc.resolve(l);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(l-=1,a+=1)}c?Array.isArray(e)?r.insertText(e.map(d=>d.text||"").join(""),l,a):typeof e=="object"&&e&&e.text?r.insertText(e.text,l,a):r.insertText(e,l,a):r.replaceWith(l,a,s),n.updateSelection&&rT(r,r.steps.length-1,-1)}return!0},sT=()=>({state:t,dispatch:e})=>sC(t,e),lT=()=>({state:t,dispatch:e})=>lC(t,e),aT=()=>({state:t,dispatch:e})=>tC(t,e),cT=()=>({state:t,dispatch:e})=>oC(t,e),uT=()=>({tr:t,state:e,dispatch:n})=>{try{const r=Qa(e.doc,e.selection.\$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},dT=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Qa(t.doc,t.selection.\$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}};function ep(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function fT(t){const e=t.split(/-(?!\$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)\$/i.test(a))s=!0;else if(/^a(lt)?\$/i.test(a))r=!0;else if(/^(c|ctrl|control)\$/i.test(a))o=!0;else if(/^s(hift)?\$/i.test(a))i=!0;else if(/^mod\$/i.test(a))Zf()||ep()?s=!0:o=!0;else throw new Error(\`Unrecognized modifier name: \${a}\`)}return r&&(n=\`Alt-\${n}\`),o&&(n=\`Ctrl-\${n}\`),s&&(n=\`Meta-\${n}\`),i&&(n=\`Shift-\${n}\`),n}const pT=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=fT(t).split(/-(?!\$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,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&&o&&r.maybeStep(u)}),!0};function es(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?Ee(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),p=Math.min(o,d+u.nodeSize);l.push({node:u,from:f,to:p})});const a=o-r,c=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Jl(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}const hT=(t,e={})=>({state:n,dispatch:r})=>{const o=Ee(t,n.schema);return es(n,o,e)?aC(n,r):!1},mT=()=>({state:t,dispatch:e})=>fC(t,e),gT=t=>({state:e,dispatch:n})=>{const r=Ee(t,e.schema);return kC(r)(e,n)},yT=()=>({state:t,dispatch:e})=>cC(t,e);function ic(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Pm(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const vT=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=ic(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=Ee(t,r.schema)),l==="mark"&&(s=sr(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.\$from.pos,a.\$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,Pm(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Pm(d.attrs,e)))})})}),!0):!1},wT=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),kT=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),ST=()=>({state:t,dispatch:e})=>nC(t,e),xT=()=>({state:t,dispatch:e})=>iC(t,e),MT=()=>({state:t,dispatch:e})=>pC(t,e),ET=()=>({state:t,dispatch:e})=>gC(t,e),CT=()=>({state:t,dispatch:e})=>mC(t,e);function ov(t,e,n={}){return Kl(t,e,{slice:!1,parseOptions:n})}const TT=(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,l=ov(t,o.schema,n);return i&&r.replaceWith(0,s.content.size,l).setMeta("preventUpdate",!e),!0};function ps(t,e){const n=sr(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.\$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function OT(t,e){const n=new d1(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function NT(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 bT(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function AT(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 tp(t){return e=>AT(e.\$from,t)}function \$T(t,e){const n=Zt.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function IT(t,e){const n={from:0,to:t.content.size};return ev(t,n,e)}function RT(t,e){const n=Ee(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function iv(t,e){const n=ic(typeof e=="string"?e:e.name,t.schema);return n==="node"?RT(t,e):n==="mark"?ps(t,e):{}}function LT(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function PT(t){const e=LT(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function DT(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.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}})})}),PT(r)}function np(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=Xf(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function ol(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function \$d(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?sr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.\$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Jl(u.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({\$from:u,\$to:d})=>{const f=u.pos,p=d.pos;t.doc.nodesBetween(f,p,(h,g)=>{if(!h.isText&&!h.marks.length)return;const v=Math.max(f,g),m=Math.min(p,g+h.nodeSize),y=m-v;s+=y,l.push(...h.marks.map(w=>({mark:w,from:v,to:m})))})}),s===0)return!1;const a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Jl(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=s}function zT(t,e,n={}){if(!e)return es(t,null,n)||\$d(t,null,n);const r=ic(e,t.schema);return r==="node"?es(t,e,n):r==="mark"?\$d(t,e,n):!1}function Dm(t,e){const{nodeExtensions:n}=nc(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=V(I(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function BT(t){var e;const n=(e=t.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function FT(t,e,n){var r;const{selection:o}=e;let i=null;if(nv(o)&&(i=o.\$cursor),i){const l=(r=t.storedMarks)!==null&&r!==void 0?r:i.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:s}=o;return s.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 p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=p&&h}return!c}),c})}const jT=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=sr(t,r.schema);if(o)if(s){const c=ps(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,p)=>{const h=Math.max(p,u),g=Math.min(p+f.nodeSize,d);f.marks.find(v=>v.type===a)?f.marks.forEach(v=>{a===v.type&&n.addMark(h,g,a.create({...v.attrs,...e}))}):n.addMark(h,g,a.create(e))})});return FT(r,n,a)},HT=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),VT=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=Ee(t,n.schema);return i.isTextblock?o().command(({commands:s})=>Am(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>Am(i,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},_T=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=wr(t,0,r.content.size),i=P.create(r,o);e.setSelection(i)}return!0},WT=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=D.atStart(r).from,l=D.atEnd(r).to,a=wr(o,s,l),c=wr(i,s,l),u=D.create(r,a,c);e.setSelection(u)}return!0},UT=t=>({state:e,dispatch:n})=>{const r=Ee(t,e.schema);return MC(r)(e,n)};function zm(t,e){const n=t.storedMarks||t.selection.\$to.parentOffset&&t.selection.\$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}const JT=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{\$from:l,\$to:a}=i,c=o.extensionManager.attributes,u=ol(c,l.node().type.name,l.node().attrs);if(i instanceof P&&i.node.isBlock)return!l.parentOffset||!xo(s,l.pos)?!1:(r&&(t&&zm(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const d=a.parentOffset===a.parent.content.size;i instanceof D&&e.deleteSelection();const f=l.depth===0?void 0:NT(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,h=xo(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!h&&xo(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),h&&(e.split(e.mapping.map(l.pos),1,p),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),v=e.doc.resolve(g);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&zm(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},KT=t=>({tr:e,state:n,dispatch:r,editor:o})=>{var i;const s=Ee(t,n.schema),{\$from:l,\$to:a}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==s)return!1;const d=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let v=E.empty;const m=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-m;M>=l.depth-3;M-=1)v=E.from(l.node(M).copy(v));const y=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w=ol(d,l.node().type.name,l.node().attrs),S=((i=s.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(w))||void 0;v=v.append(E.from(s.createAndFill(null,S)||void 0));const x=l.before(l.depth-(m-1));e.replace(x,l.after(-y),new A(v,4-m,0));let k=-1;e.doc.nodesBetween(x,e.doc.content.size,(M,T)=>{if(k>-1)return!1;M.isTextblock&&M.content.size===0&&(k=T+1)}),k>-1&&e.setSelection(D.near(e.doc.resolve(k))),e.scrollIntoView()}return!0}const f=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p=ol(d,u.type.name,u.attrs),h=ol(d,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const g=f?[{type:s,attrs:p},{type:f,attrs:h}]:[{type:s,attrs:p}];if(!xo(e.doc,l.pos,2))return!1;if(r){const{selection:v,storedMarks:m}=n,{splittableMarks:y}=o.extensionManager,w=m||v.\$to.parentOffset&&v.\$from.marks();if(e.split(l.pos,2,g).scrollIntoView(),!w||!r)return!0;const S=w.filter(x=>y.includes(x.type.name));e.ensureMarks(S)}return!0},nu=(t,e)=>{const n=tp(i=>i.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 o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&or(t.doc,n.pos)&&t.join(n.pos),!0},ru=(t,e)=>{const n=tp(i=>i.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 o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&or(t.doc,r)&&t.join(r),!0},qT=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=Ee(t,s.schema),h=Ee(e,s.schema),{selection:g,storedMarks:v}=s,{\$from:m,\$to:y}=g,w=m.blockRange(y),S=v||g.\$to.parentOffset&&g.\$from.marks();if(!w)return!1;const x=tp(k=>Dm(k.type.name,d))(g);if(w.depth>=1&&x&&w.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(h);if(Dm(x.node.type.name,d)&&p.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,p),!0)).command(()=>nu(i,p)).command(()=>ru(i,p)).run()}return!n||!S||!l?a().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>nu(i,p)).command(()=>ru(i,p)).run():a().command(()=>{const k=u().wrapInList(p,r),M=S.filter(T=>f.includes(T.type.name));return i.ensureMarks(M),k?!0:c.clearNodes()}).wrapInList(p,r).command(()=>nu(i,p)).command(()=>ru(i,p)).run()},QT=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=sr(t,r.schema);return \$d(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},GT=(t,e,n={})=>({state:r,commands:o})=>{const i=Ee(t,r.schema),s=Ee(e,r.schema);return es(r,i,n)?o.setNode(s):o.setNode(i,n)},YT=(t,e={})=>({state:n,commands:r})=>{const o=Ee(t,n.schema);return es(n,o,e)?r.lift(o):r.wrapIn(o,e)},XT=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},ZT=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.\$from.pos,i.\$to.pos)}),!0},eO=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=sr(t,r.schema),{\$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:p}=l;const h=(i=c.marks().find(v=>v.type===a))===null||i===void 0?void 0:i.attrs,g=Xf(c,a,h);g&&(f=g.from,p=g.to),n.removeMark(f,p,a)}else d.forEach(f=>{n.removeMark(f.\$from.pos,f.\$to.pos,a)});return n.removeStoredMark(a),!0},tO=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=ic(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=Ee(t,r.schema)),l==="mark"&&(s=sr(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.\$from.pos,u=a.\$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{i&&i===d.type&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(p=>{if(s===p.type){const h=Math.max(f,c),g=Math.min(f+d.nodeSize,u);n.addMark(h,g,s.create({...p.attrs,...e}))}})})}),!0):!1},nO=(t,e={})=>({state:n,dispatch:r})=>{const o=Ee(t,n.schema);return yC(o,e)(n,r)},rO=(t,e={})=>({state:n,dispatch:r})=>{const o=Ee(t,n.schema);return vC(o,e)(n,r)};var oO=Object.freeze({__proto__:null,blur:FC,clearContent:jC,clearNodes:HC,command:VC,createParagraphNear:_C,cut:WC,deleteCurrentNode:UC,deleteNode:JC,deleteRange:KC,deleteSelection:qC,enter:QC,exitCode:GC,extendMarkRange:XC,first:ZC,focus:eT,forEach:tT,insertContent:nT,insertContentAt:iT,joinUp:sT,joinDown:lT,joinBackward:aT,joinForward:cT,joinItemBackward:uT,joinItemForward:dT,keyboardShortcut:pT,lift:hT,liftEmptyBlock:mT,liftListItem:gT,newlineInCode:yT,resetAttributes:vT,scrollIntoView:wT,selectAll:kT,selectNodeBackward:ST,selectNodeForward:xT,selectParentNode:MT,selectTextblockEnd:ET,selectTextblockStart:CT,setContent:TT,setMark:jT,setMeta:HT,setNode:VT,setNodeSelection:_T,setTextSelection:WT,sinkListItem:UT,splitBlock:JT,splitListItem:KT,toggleList:qT,toggleMark:QT,toggleNode:GT,toggleWrap:YT,undoInputRule:XT,unsetAllMarks:ZT,unsetMark:eO,updateAttributes:tO,wrapIn:nO,wrapInList:rO});const iO=it.create({name:"commands",addCommands(){return{...oO}}}),sO=it.create({name:"editable",addProseMirrorPlugins(){return[new pe({key:new we("editable"),props:{editable:()=>this.editor.options.editable}})]}}),lO=it.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new pe({key:new we("focusEvents"),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}}}})]}}),aO=it.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{const{selection:l,doc:a}=s,{empty:c,\$anchor:u}=l,{pos:d,parent:f}=u,p=u.parent.isTextblock?s.doc.resolve(d-1):u,h=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,v=h&&p.parent.childCount===1?g===u.pos:j.atStart(a).from===d;return!c||!v||!f.type.isTextblock||f.textContent.length?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.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()},r={...n},o={...n,"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 Zf()||ep()?o:r},addProseMirrorPlugins(){return[new pe({key:new we("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(d=>d.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:r,from:o,to:i}=e.selection,s=j.atStart(e.doc).from,l=j.atEnd(e.doc).to;if(r||!(o===s&&i===l)||n.doc.textBetween(0,n.doc.content.size," "," ").length!==0)return;const a=n.tr,c=ec({state:n,transaction:a}),{commands:u}=new tc({editor:this.editor,state:c});if(u.clearNodes(),!!a.steps.length)return a}})]}}),cO=it.create({name:"tabindex",addProseMirrorPlugins(){return[new pe({key:new we("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var uO=Object.freeze({__proto__:null,ClipboardTextSerializer:BC,Commands:iO,Editable:sO,FocusEvents:lO,Keymap:aO,Tabindex:cO});const dO=\`.ProseMirror {
  position: relative;
}

.ProseMirror {
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}

.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
  width: 1px !important;
  height: 1px !important;
}

.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}

.tippy-box[data-animation=fade][data-state=hidden] {
  opacity: 0
}\`;function fO(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}let pO=class extends EC{constructor(t={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=fO(dO,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!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})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=Z1(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(t){if(this.isDestroyed)return;const e=typeof t=="string"?\`\${t}\$\`:t.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(r=>!r.key.startsWith(e))});this.view.updateState(n)}createExtensionManager(){const t=[...this.options.enableCoreExtensions?Object.values(uO):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(e==null?void 0:e.type));this.extensionManager=new ho(t,this)}createCommandManager(){this.commandManager=new tc({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const t=ov(this.options.content,this.schema,this.options.parseOptions),e=rv(t,this.options.autofocus);this.view=new VE(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:po.create({doc:t,selection:e||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=\`tiptap \${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(i=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(i)});return}const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus"),o=t.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return iv(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return zT(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return \$T(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=\`

\`,textSerializers:n={}}=t||{};return IT(this.state.doc,{blockSeparator:e,textSerializers:{...tv(this.schema),...n}})}get isEmpty(){return BT(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}};function jr(t){return new rc({find:t.find,handler:({state:e,range:n,match:r})=>{const o=V(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(np(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(p=>p===t.type&&p!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const d=n.from+a+s.length;i.addMark(n.from+a,d,t.type.create(o||{})),i.removeStoredMark(t.type)}}})}function hO(t){return new rc({find:t.find,handler:({state:e,range:n,match:r})=>{const o=V(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else r[0]&&i.insert(s-1,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l));i.scrollIntoView()}})}function mO(t){return new rc({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=V(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)}})}function Bo(t){return new rc({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=V(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&Ff(l,t.type,i);if(!a)return null;if(s.wrap(l,a),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,p=d||u.\$to.parentOffset&&u.\$from.marks();if(p){const h=p.filter(g=>f.includes(g.type.name));s.ensureMarks(h)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&or(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}class st{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${this.name}".\`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(I(this,"addOptions",{name:this.name}))),this.storage=V(I(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new st(e)}configure(e={}){const n=this.extend();return n.options=oc(this.options,e),n.storage=V(I(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new st(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${n.name}".\`),n.options=V(I(n,"addOptions",{name:n.name})),n.storage=V(I(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.\$from;if(o.pos===o.end()){const i=o.marks();if(!i.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const s=i.find(l=>(l==null?void 0:l.type.name)===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}}class \$e{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${this.name}".\`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(I(this,"addOptions",{name:this.name}))),this.storage=V(I(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new \$e(e)}configure(e={}){const n=this.extend();return n.options=oc(this.options,e),n.storage=V(I(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new \$e(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${n.name}".\`),n.options=V(I(n,"addOptions",{name:n.name})),n.storage=V(I(n,"addStorage",{name:n.name,options:n.options})),n}}function er(t){return new IC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=V(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=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(np(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(h=>h===t.type&&h!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}const gO=({renderers:t})=>K.createElement(K.Fragment,null,Object.entries(t).map(([e,n])=>Iy.createPortal(n.reactElement,n.element,e)));class yO extends K.Component{constructor(e){super(e),this.editorContentRef=K.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?Ka.flushSync(e):e()}setRenderer(e,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:n}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{const r={...n};return delete r[e],{renderers:r}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,...n}=this.props;return K.createElement(K.Fragment,null,K.createElement("div",{ref:this.editorContentRef,...n}),K.createElement(gO,{renderers:this.state.renderers}))}}const vO=t=>{const e=K.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return K.createElement(yO,{key:e,...t})};K.memo(vO);class wO extends pO{constructor(){super(...arguments),this.contentComponent=null}}function kO(){const[,t]=q.useState(0);return()=>t(e=>e+1)}const SO=(t={},e=[])=>{const[n,r]=q.useState(null),o=kO(),{onBeforeCreate:i,onBlur:s,onCreate:l,onDestroy:a,onFocus:c,onSelectionUpdate:u,onTransaction:d,onUpdate:f}=t,p=q.useRef(i),h=q.useRef(s),g=q.useRef(l),v=q.useRef(a),m=q.useRef(c),y=q.useRef(u),w=q.useRef(d),S=q.useRef(f);return q.useEffect(()=>{n&&(i&&(n.off("beforeCreate",p.current),n.on("beforeCreate",i),p.current=i),s&&(n.off("blur",h.current),n.on("blur",s),h.current=s),l&&(n.off("create",g.current),n.on("create",l),g.current=l),a&&(n.off("destroy",v.current),n.on("destroy",a),v.current=a),c&&(n.off("focus",m.current),n.on("focus",c),m.current=c),u&&(n.off("selectionUpdate",y.current),n.on("selectionUpdate",u),y.current=u),d&&(n.off("transaction",w.current),n.on("transaction",d),w.current=d),f&&(n.off("update",S.current),n.on("update",f),S.current=f))},[i,s,l,a,c,u,d,f,n]),q.useEffect(()=>{let x=!0;const k=new wO(t);return r(k),k.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{x&&o()})})}),()=>{x=!1}},e),q.useEffect(()=>()=>{n==null||n.destroy()},[n]),n},xO=q.createContext({editor:null});xO.Consumer;const MO=q.createContext({onDragStart:void 0}),EO=()=>q.useContext(MO);K.forwardRef((t,e)=>{const{onDragStart:n}=EO(),r=t.as||"div";return K.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});var sv=(t=>(t.Action="action",t))(sv||{});class ae{constructor({forceName:e,tiptapExtension:n,tiptapExtensionDeps:r,onBridgeMessage:o,onEditorMessage:i,extendEditorState:s,extendEditorInstance:l,extendCSS:a,config:c,extendConfig:u}){n?this.name=Array.isArray(n)?n.map(d=>d.name).join("+"):n.name:this.name=e||"BridgeExtension",this.tiptapExtension=n,this.tiptapExtensionDeps=r,this.onBridgeMessage=o,this.onEditorMessage=i,this.extendEditorState=s,this.extendEditorInstance=l,this.extendCSS=a,this.config=c,this.extendConfig=u}clone(){return new ae({...this,forceName:this.name})}configureExtension(e){const n=this.clone();return n.config=e,n}configureCSS(e){const n=this.clone();return n.extendCSS=e,n}extendExtension(e){const n=this.clone();return n.extendConfig=e,n}configureTiptapExtensionsOnRunTime(e,n){var r,o;return this.tiptapExtension&&(e&&(this.tiptapExtension=(r=this.tiptapExtension)==null?void 0:r.configure(e)),n&&(this.tiptapExtension=(o=this.tiptapExtension)==null?void 0:o.extend(n))),[this.tiptapExtension,...this.tiptapExtensionDeps||[]]}}class CO{constructor(){kS(this,"subscriptions",{}),this.subscriptions={}}onMessage(e,n){this.subscriptions[e]&&this.subscriptions[e].forEach(r=>{r(n)})}addListener(e,n){this.subscriptions[e]||(this.subscriptions[e]=[]),this.subscriptions[e].push(n)}sendAsyncMessage(e,n){const r=Math.random().toString(36).substring(7);return e.payload=e.payload||{},e.payload.messageId=r,new Promise(o=>{this.addListener(r,o),n(e)})}}const zs=new CO,lv=()=>{let t=!1;try{require("expo-constants")&&(t=!0)}catch{t=!1}return t};class TO{constructor(){this.focus=!1,window.document.addEventListener("focus",()=>{this.focus=!0},!0),window.document.addEventListener("blur",()=>{this.focus=!1},!0)}get isFocused(){return this.focus}}const OO={isFocused:!1},NO=lv()?OO:new TO,bO=\$e.create({name:"doc",topNode:!0,content:"block+"}),AO=\$e.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",X(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),\$O=\$e.create({name:"text",group:"inline"});var Yr=(t=>(t.SetSelection="set-selection",t.GetHTML="get-html",t.GetJSON="get-json",t.GetText="get-text",t.SendHTMLToNative="send-html-back",t.SendTextToNative="send-text-back",t.SendJSONToNative="send-json-back",t.SetContent="set-content",t.StateUpdate="stateUpdate",t.Focus="focus",t.Blur="blur",t.EditorReady="editor-ready",t.UpdateScrollThresholdAndMargin="update-scroll-threshold-and-margin",t.ContentUpdate="content-update",t.DocumentHeight="document-height",t.SetEditable="set-editable",t))(Yr||{});const IO=new ae({forceName:"coreBridge",tiptapExtension:bO,tiptapExtensionDeps:[AO,\$O],onBridgeMessage:(t,e,n)=>e.type==="set-content"?(t.commands.setContent(e.payload.content),!0):(e.type==="get-html"&&n({type:"send-html-back",payload:{content:t.getHTML(),messageId:e.payload.messageId}}),e.type==="get-json"&&n({type:"send-json-back",payload:{content:t.getJSON(),messageId:e.payload.messageId}}),e.type==="get-text"&&n({type:"send-text-back",payload:{content:t.getText(),messageId:e.payload.messageId}}),e.type==="set-selection"?(t.commands.setTextSelection({from:e.payload.from,to:e.payload.to}),!0):e.type==="focus"?(t.commands.focus(e.payload),!0):e.type==="blur"?(t.commands.blur(),!0):e.type==="update-scroll-threshold-and-margin"?(t.setOptions({editorProps:{scrollThreshold:{top:0,bottom:e.payload,right:0,left:0},scrollMargin:{top:0,bottom:e.payload,right:0,left:0}}}),!0):e.type==="set-editable"?(t.setEditable(e.payload),!0):!1),onEditorMessage:({type:t,payload:e},n)=>t==="send-html-back"||t==="send-text-back"||t==="send-json-back"?(zs.onMessage(e.messageId,e.content),!0):(t==="editor-ready"&&n.autofocus&&n.focus("end"),t==="stateUpdate"&&n._updateEditorState(e),t==="content-update"&&n._onContentUpdate(),!1),extendEditorInstance:(t,e,n,r,o)=>({updateScrollThresholdAndMargin:i=>t({type:"update-scroll-threshold-and-margin",payload:i}),setSelection:(i,s)=>{t({type:"set-selection",payload:{from:i,to:s}})},setContent:i=>{t({type:"set-content",payload:{content:i}})},getHTML:async()=>await zs.sendAsyncMessage({type:"get-html"},t),getText:async()=>await zs.sendAsyncMessage({type:"get-text"},t),getJSON:async()=>await zs.sendAsyncMessage({type:"get-json"},t),focus:i=>{var s;o==="android"?setTimeout(()=>{var l;(l=e==null?void 0:e.current)==null||l.requestFocus()},100):(s=e==null?void 0:e.current)==null||s.requestFocus(),n&&n.current&&r&&r({...n.current,isFocused:!0}),t({type:"focus",payload:i})},blur:()=>{t({type:"blur",payload:void 0})},injectJS:i=>{var s;(s=e==null?void 0:e.current)==null||s.injectJavaScript(i)},setEditable:i=>{t({type:"set-editable",payload:i})}}),extendEditorState:t=>({isFocused:NO.isFocused,isReady:!0,selection:{from:t.state.selection.from,to:t.state.selection.to},editable:t.isEditable})}),RO=it.create({name:"eventHandler",addProseMirrorPlugins(){return[new pe({key:new we("blueBackground"),state:{init(){return oe.empty},apply(t,e,n,r){if(t.selection.empty)return oe.empty;{const o=[],{from:i,to:s}=t.selection;return o.push(Ze.inline(i,s,{class:"highlight-background"})),oe.create(r.doc,o)}}},props:{decorations(t){return this.getState(t)}}})]}});class LO{constructor(){this.connected=!1,this.resizeObserver=null,this.currentHeight=null}connect(e,n){this.connected=!0,this.currentHeight=e.getBoundingClientRect().height,n(this.currentHeight),this.resizeObserver=new ResizeObserver(r=>{for(let o of r){const i=o.target.getBoundingClientRect().height;this.currentHeight!==i&&(this.currentHeight=i,n(i))}}),this.resizeObserver.observe(e)}disconnect(){var e;(e=this.resizeObserver)==null||e.disconnect()}get height(){return this.currentHeight}}const PO={height:0,connect:()=>{},connected:!0},Bm=lv()?PO:new LO,DO=window.initialContent||"",Kr=t=>{var e;(e=window.ReactNativeWebView)==null||e.postMessage(JSON.stringify(t))},zO=t=>{const{tiptapOptions:e={},bridges:n=[]}=t||{},r=q.useMemo(()=>JSON.parse(window.bridgeExtensionConfigMap||"{}"),[]);function o(c){return c!=null}const i=n.map(c=>{const u=r[c.name];if(!u)return null;const{optionsConfig:d,extendConfig:f}=u;return c.configureTiptapExtensionsOnRunTime(d,f)}).filter(o).flat(),s={...e,extensions:[...window.disableColorHighlight?[]:[RO],...i,...e.extensions||[]]},l=Sx(c=>{let u={};const d=n.reduce((f,p)=>p.extendEditorState?Object.assign(f,p.extendEditorState(c)):f,u);Kr({type:Yr.StateUpdate,payload:d})},10),a=SO({content:DO,onCreate:()=>Kr({type:Yr.EditorReady,payload:void 0}),onUpdate:c=>{l(c.editor),Kr({type:Yr.ContentUpdate,payload:void 0})},onSelectionUpdate:c=>l(c.editor),onTransaction:c=>l(c.editor),editable:window.editable,...s});return q.useEffect(()=>{if(!a)return;const c=d=>{n.forEach(f=>{f.onBridgeMessage&&f.onBridgeMessage(a,d,Kr)})},u=d=>{if(!(d instanceof MessageEvent))return;const f=JSON.parse(d.data);if(f.type===sv.Action){if(f.id){if(window.lastMessageID===f.id)return;window.lastMessageID=f.id}c(f.payload)}};return window.addEventListener("message",u),document.addEventListener("message",u),()=>{window.removeEventListener("message",u),document.removeEventListener("message",u)}},[a,n]),q.useEffect(()=>{if(a&&!Bm.connected&&window.dynamicHeight){const c=BO();Bm.connect(document.querySelector(".ProseMirror"),u=>{window.platform==="android"&&Kr({type:Yr.DocumentHeight,payload:u+c}),Kr({type:Yr.DocumentHeight,payload:u})})}},[a]),a},BO=()=>{if(window.platform!=="android")return 0;const t=document.createElement("p");t.style.visibility="hidden",t.textContent="tmp",document.body.appendChild(t);const e=t.getBoundingClientRect().height;return document.body.removeChild(t),e},FO=/^\s*>\s\$/,jO=\$e.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",X(this.options.HTMLAttributes,t),0]},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[Bo({find:FO,type:this.type})]}}),HO=new ae({tiptapExtension:jO,onBridgeMessage:(t,e)=>(e.type==="toggle-blockquote"&&t.chain().focus().toggleBlockquote().run(),!1),extendEditorInstance:t=>({toggleBlockquote:()=>t({type:"toggle-blockquote"})}),extendEditorState:t=>({canToggleBlockquote:t.can().toggleBlockquote(),isBlockquoteActive:t.isActive("blockquote")}),extendCSS:\`
    blockquote {
        border-left: 3px solid #0d0d0d1a;
        padding-left: 1rem;
    }
  \`}),VO=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))\$/,_O=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,WO=/(?:^|\s)((?:__)((?:[^__]+))(?:__))\$/,UO=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,JO=st.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})\$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",X(this.options.HTMLAttributes,t),0]},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[jr({find:VO,type:this.type}),jr({find:WO,type:this.type})]},addPasteRules(){return[er({find:_O,type:this.type}),er({find:UO,type:this.type})]}}),KO=new ae({tiptapExtension:JO,onBridgeMessage:(t,e)=>(e.type==="toggle-bold"&&t.chain().focus().toggleBold().run(),!1),extendEditorInstance:t=>({toggleBold:()=>t({type:"toggle-bold"})}),extendEditorState:t=>({canToggleBold:t.can().toggleBold(),isBoldActive:t.isActive("bold")})}),rp=\$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",X(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),qO=\$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",X(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Fm=st.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",X(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=ps(t,this.type);return Object.entries(n).some(([,r])=>!!r)?!0:e.unsetMark(this.name)}}}}),jm=/^\s*([-+*])\s\$/,QO=\$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",X(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qO.name,this.editor.getAttributes(Fm.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Bo({find:jm,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Bo({find:jm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Fm.name),editor:this.editor})),[t]}}),GO=new ae({tiptapExtension:QO,tiptapExtensionDeps:[rp],onBridgeMessage:(t,e)=>(e.type==="toggle-bulletList"&&t.chain().focus().toggleBulletList().run(),!1),extendEditorInstance:t=>({toggleBulletList:()=>t({type:"toggle-bulletList"})}),extendEditorState:t=>({canToggleBulletList:t.can().toggleBulletList(),isBulletListActive:t.isActive("bulletList")})}),YO=/(?:^|\s)((?:\`)((?:[^\`]+))(?:\`))\$/,XO=/(?:^|\s)((?:\`)((?:[^\`]+))(?:\`))/g,ZO=st.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",X(this.options.HTMLAttributes,t),0]},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[jr({find:YO,type:this.type})]},addPasteRules(){return[er({find:XO,type:this.type})]}}),eN=new ae({tiptapExtension:ZO,onBridgeMessage:(t,e)=>(e.type==="toggle-code"&&t.chain().focus().toggleCode().run(),!1),extendEditorInstance:t=>({toggleCode:()=>t({type:"toggle-code"})}),extendEditorState:t=>({canToggleCode:t.can().toggleCode(),isCodeActive:t.isActive("code")}),extendCSS:\`
    code {
        background-color: #6161611a;
        border-radius: 0.25em;
        box-decoration-break: clone;
        color: #616161;
        font-size: 0.9rem;
        padding: 0.25em;
    }
  \`}),av=st.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",X(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=ps(t,this.type);return Object.entries(n).some(([,r])=>!!r)?!0:e.unsetMark(this.name)}}}}),tN=it.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:\`color: \${t.color}\`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),nN=new ae({tiptapExtension:tN,tiptapExtensionDeps:[av],onBridgeMessage:(t,{type:e,payload:n})=>{switch(e){case"set-color":t.chain().focus().setColor(n).run();break;case"unset-color":t.chain().focus().unsetColor().run();break}return!1},extendEditorInstance:t=>({setColor:e=>t({type:"set-color",payload:e}),unsetColor:()=>t({type:"unset-color",payload:void 0})}),extendEditorState:t=>({activeColor:t.getAttributes("textStyle").color})}),rN=\$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]}\`,X(this.options.HTMLAttributes,e),0]},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=>mO({find:new RegExp(\`^(#{1,\${t}})\\s\$\`),type:this.type,getAttributes:{level:t}}))}}),oN=new ae({tiptapExtension:rN,onBridgeMessage:(t,e)=>(e.type==="toggle-heading"&&t.chain().focus().toggleHeading({level:e.payload}).run(),!1),extendEditorInstance:t=>({toggleHeading:e=>t({type:"toggle-heading",payload:e})}),extendEditorState:t=>{var e;return{canToggleHeading:t.can().toggleHeading({level:1}),headingLevel:(e=t.getAttributes("heading"))==null?void 0:e.level}}}),iN=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))\$/,sN=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g,lN=st.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:\`background-color: \${t.color}; color: inherit\`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",X(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[jr({find:iN,type:this.type})]},addPasteRules(){return[er({find:sN,type:this.type})]}}),aN=new ae({tiptapExtension:lN.configure({multicolor:!0}),tiptapExtensionDeps:[av],onBridgeMessage:(t,{type:e,payload:n})=>{switch(e){case"set-highlight":t.chain().focus().setHighlight({color:n}).run();break;case"toggle-highlight":t.chain().focus().toggleHighlight({color:n}).run();break;case"unset-highlight":t.chain().focus().unsetHighlight().run();break}return!1},extendEditorInstance:t=>({setHighlight:e=>t({type:"set-highlight",payload:e}),toggleHighlight:e=>t({type:"toggle-highlight",payload:e}),unsetHighlight:()=>t({type:"unset-highlight",payload:void 0})}),extendEditorState:t=>({activeHighlight:t.getAttributes("highlight").color})});var ql=200,Me=function(){};Me.prototype.append=function(t){return t.length?(t=Me.from(t),!this.length&&t||t.length<ql&&this.leafAppend(t)||this.length<ql&&t.leafPrepend(this)||this.appendInner(t)):this};Me.prototype.prepend=function(t){return t.length?Me.from(t).append(this):this};Me.prototype.appendInner=function(t){return new cN(this,t)};Me.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Me.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Me.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Me.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};Me.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(o,i){return r.push(t(o,i))},e,n),r};Me.from=function(t){return t instanceof Me?t:t&&t.length?new cv(t):Me.empty};var cv=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(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,i,s){for(var l=o;l<i;l++)if(r(this.values[l],s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){for(var l=o-1;l>=i;l--)if(r(this.values[l],s+l)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=ql)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=ql)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Me);Me.empty=new cv([]);var cN=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(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,o,i){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(o,s),i)===!1||o>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,o)-s,i+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,o,i){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(o,s)-s,i+s)===!1||o<s&&this.left.forEachInvertedInner(n,Math.min(r,s),o,i)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var o=this.left.length;return r<=o?this.left.slice(n,r):n>=o?this.right.slice(n-o,r-o):this.left.slice(n,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Me);const uN=500;class Bt{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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Kt(d.map));let p=d.step.map(o.slice(i)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Kt(h,void 0,void 0,c.length+u.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new Bt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&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 Kt(e.mapping.maps[u],d,n),p;(p=a&&a.merge(f))&&(f=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>fN&&(l=dN(l,c),s-=c),new Bt(l.append(i),s)}remapping(e,n){let r=new So;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Bt(this.items.append(e.map(n=>new Kt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let p=i.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),v=f.selection&&f.selection.map(i.slice(a+1,p));v&&l++,r.push(new Kt(h,g,v))}else r.push(new Kt(h))},o);let c=[];for(let f=n;f<s;f++)c.push(new Kt(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Bt(u,l);return d.emptyItemCount()>uN&&(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,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Kt(c.invert(),a,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Bt(Me.from(o.reverse()),i)}}Bt.empty=new Bt(Me.empty,0);function dN(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Kt{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Kt(n.getMap().invert(),n,this.selection)}}}class Nn{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const fN=20;function pN(t,e,n,r){let o=n.getMeta(Gn),i;if(o)return o.historyState;n.getMeta(mN)&&(t=new Nn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Gn))return s.getMeta(Gn).redo?new Nn(t.done.addTransform(n,void 0,r,il(e)),t.undone,Hm(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Nn(t.done,t.undone.addTransform(n,void 0,r,il(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!hN(n,t.prevRanges)),c=s?ou(t.prevRanges,n.mapping):Hm(n.mapping.maps[n.steps.length-1]);return new Nn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,il(e)),Bt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Nn(t.done.rebased(n,i),t.undone.rebased(n,i),ou(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Nn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ou(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function hN(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Hm(t){let e=[];return t.forEach((n,r,o,i)=>e.push(o,i)),e}function ou(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function uv(t,e,n,r){let o=il(e),i=Gn.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(!s)return;let l=s.selection.resolve(s.transform.doc),a=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new Nn(r?a:s.remaining,r?s.remaining:a,null,0,-1);n(s.transform.setSelection(l).setMeta(Gn,{redo:r,historyState:c}).scrollIntoView())}let iu=!1,Vm=null;function il(t){let e=t.plugins;if(Vm!=e){iu=!1,Vm=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){iu=!0;break}}return iu}const Gn=new we("history"),mN=new we("closeHistory");function gN(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new pe({key:Gn,state:{init(){return new Nn(Bt.empty,Bt.empty,null,0,-1)},apply(e,n,r){return pN(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?dv:r=="historyRedo"?fv:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}const dv=(t,e)=>{let n=Gn.getState(t);return!n||n.done.eventCount==0?!1:(e&&uv(n,t,e,!1),!0)},fv=(t,e)=>{let n=Gn.getState(t);return!n||n.undone.eventCount==0?!1:(e&&uv(n,t,e,!0),!0)},yN=it.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dv(t,e),redo:()=>({state:t,dispatch:e})=>fv(t,e)}},addProseMirrorPlugins(){return[gN(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()}}}),vN=new ae({tiptapExtension:yN,onBridgeMessage:(t,e)=>(e.type==="undo"&&t.chain().focus().undo().run(),e.type==="redo"&&t.chain().focus().redo().run(),!1),extendEditorInstance:t=>({redo:()=>t({type:"redo"}),undo:()=>t({type:"undo"})}),extendEditorState:t=>({canUndo:t.can().undo(),canRedo:t.can().redo()})}),wN=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))\$/,kN=\$e.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",X(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[hO({find:wN,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),SN=new ae({tiptapExtension:kN.configure({allowBase64:!0}),onBridgeMessage:(t,e)=>(e.type==="set-image"&&t.chain().focus().setImage({src:e.payload}).setTextSelection(t.state.selection.to+1).run(),!1),extendEditorInstance:t=>({setImage:e=>t({type:"set-image",payload:e})}),extendEditorState:()=>({}),extendCSS:\`
  img {
    height: auto;
    max-width: 100%;
  }

  img &.ProseMirror-selectednode {
    outline: 3px solid #68cef8;
  }
  \`}),xN=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))\$/,MN=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,EN=/(?:^|\s)((?:_)((?:[^_]+))(?:_))\$/,CN=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,TN=st.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",X(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[jr({find:xN,type:this.type}),jr({find:EN,type:this.type})]},addPasteRules(){return[er({find:MN,type:this.type}),er({find:CN,type:this.type})]}}),ON=new ae({tiptapExtension:TN,onBridgeMessage:(t,e)=>(e.type==="toggle-italic"&&t.chain().focus().toggleItalic().run(),!1),extendEditorInstance:t=>({toggleItalic:()=>t({type:"toggle-italic"})}),extendEditorState:t=>({canToggleItalic:t.can().toggleItalic(),isItalicActive:t.isActive("italic")})}),NN=" ögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",bN="ελ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",Fo=(t,e)=>{for(const n in e)t[n]=e[n];return t},Id="numeric",Rd="ascii",Ld="alpha",sl="asciinumeric",Bs="alphanumeric",Pd="domain",pv="emoji",AN="scheme",\$N="slashscheme",_m="whitespace";function IN(t,e){return t in e||(e[t]=[]),e[t]}function kr(t,e,n){e[Id]&&(e[sl]=!0,e[Bs]=!0),e[Rd]&&(e[sl]=!0,e[Ld]=!0),e[sl]&&(e[Bs]=!0),e[Ld]&&(e[Bs]=!0),e[Bs]&&(e[Pd]=!0),e[pv]&&(e[Pd]=!0);for(const r in e){const o=IN(r,n);o.indexOf(t)<0&&o.push(t)}}function RN(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Ye(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Ye.groups={};Ye.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 o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e){return e===void 0&&(e=!1),e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||Ye.groups;let o;return e&&e.j?o=e:(o=new Ye(e),n&&r&&kr(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Ye.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,l=o.go(t);if(l?(s=new Ye,Fo(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Ye,i){if(r)if(s.t&&typeof s.t=="string"){const a=Fo(RN(s.t,r),n);kr(i,a,r)}else n&&kr(i,n,r);s.t=i}return o.j[t]=s,s}};const H=(t,e,n,r,o)=>t.ta(e,n,r,o),xt=(t,e,n,r,o)=>t.tr(e,n,r,o),Wm=(t,e,n,r,o)=>t.ts(e,n,r,o),N=(t,e,n,r,o)=>t.tt(e,n,r,o),an="WORD",Dd="UWORD",ts="LOCALHOST",zd="TLD",Bd="UTLD",ll="SCHEME",Xr="SLASH_SCHEME",op="NUM",hv="WS",ip="NL",Ti="OPENBRACE",Oi="CLOSEBRACE",Ql="OPENBRACKET",Gl="CLOSEBRACKET",Yl="OPENPAREN",Xl="CLOSEPAREN",Zl="OPENANGLEBRACKET",ea="CLOSEANGLEBRACKET",ta="FULLWIDTHLEFTPAREN",na="FULLWIDTHRIGHTPAREN",ra="LEFTCORNERBRACKET",oa="RIGHTCORNERBRACKET",ia="LEFTWHITECORNERBRACKET",sa="RIGHTWHITECORNERBRACKET",la="FULLWIDTHLESSTHAN",aa="FULLWIDTHGREATERTHAN",ca="AMPERSAND",ua="APOSTROPHE",da="ASTERISK",bn="AT",fa="BACKSLASH",pa="BACKTICK",ha="CARET",Rn="COLON",sp="COMMA",ma="DOLLAR",qt="DOT",ga="EQUALS",lp="EXCLAMATION",Qt="HYPHEN",ya="PERCENT",va="PIPE",wa="PLUS",ka="POUND",Sa="QUERY",ap="QUOTE",cp="SEMI",Gt="SLASH",Ni="TILDE",xa="UNDERSCORE",mv="EMOJI",Ma="SYM";var gv=Object.freeze({__proto__:null,WORD:an,UWORD:Dd,LOCALHOST:ts,TLD:zd,UTLD:Bd,SCHEME:ll,SLASH_SCHEME:Xr,NUM:op,WS:hv,NL:ip,OPENBRACE:Ti,CLOSEBRACE:Oi,OPENBRACKET:Ql,CLOSEBRACKET:Gl,OPENPAREN:Yl,CLOSEPAREN:Xl,OPENANGLEBRACKET:Zl,CLOSEANGLEBRACKET:ea,FULLWIDTHLEFTPAREN:ta,FULLWIDTHRIGHTPAREN:na,LEFTCORNERBRACKET:ra,RIGHTCORNERBRACKET:oa,LEFTWHITECORNERBRACKET:ia,RIGHTWHITECORNERBRACKET:sa,FULLWIDTHLESSTHAN:la,FULLWIDTHGREATERTHAN:aa,AMPERSAND:ca,APOSTROPHE:ua,ASTERISK:da,AT:bn,BACKSLASH:fa,BACKTICK:pa,CARET:ha,COLON:Rn,COMMA:sp,DOLLAR:ma,DOT:qt,EQUALS:ga,EXCLAMATION:lp,HYPHEN:Qt,PERCENT:ya,PIPE:va,PLUS:wa,POUND:ka,QUERY:Sa,QUOTE:ap,SEMI:cp,SLASH:Gt,TILDE:Ni,UNDERSCORE:xa,EMOJI:mv,SYM:Ma});const qr=/[a-z]/,su=new RegExp("\\p{L}","u"),lu=new RegExp("\\p{Emoji}","u"),au=/\d/,Um=/\s/,Jm=\`
\`,LN="️",PN="‍";let Fs=null,js=null;function DN(t){t===void 0&&(t=[]);const e={};Ye.groups=e;const n=new Ye;Fs==null&&(Fs=Km(NN)),js==null&&(js=Km(bN)),N(n,"'",ua),N(n,"{",Ti),N(n,"}",Oi),N(n,"[",Ql),N(n,"]",Gl),N(n,"(",Yl),N(n,")",Xl),N(n,"<",Zl),N(n,">",ea),N(n,"（",ta),N(n,"）",na),N(n,"「",ra),N(n,"」",oa),N(n,"『",ia),N(n,"』",sa),N(n,"＜",la),N(n,"＞",aa),N(n,"&",ca),N(n,"*",da),N(n,"@",bn),N(n,"\`",pa),N(n,"^",ha),N(n,":",Rn),N(n,",",sp),N(n,"\$",ma),N(n,".",qt),N(n,"=",ga),N(n,"!",lp),N(n,"-",Qt),N(n,"%",ya),N(n,"|",va),N(n,"+",wa),N(n,"#",ka),N(n,"?",Sa),N(n,'"',ap),N(n,"/",Gt),N(n,";",cp),N(n,"~",Ni),N(n,"_",xa),N(n,"\\",fa);const r=xt(n,au,op,{[Id]:!0});xt(r,au,r);const o=xt(n,qr,an,{[Rd]:!0});xt(o,qr,o);const i=xt(n,su,Dd,{[Ld]:!0});xt(i,qr),xt(i,su,i);const s=xt(n,Um,hv,{[_m]:!0});N(n,Jm,ip,{[_m]:!0}),N(s,Jm),xt(s,Um,s);const l=xt(n,lu,mv,{[pv]:!0});xt(l,lu,l),N(l,LN,l);const a=N(l,PN);xt(a,lu,l);const c=[[qr,o]],u=[[qr,null],[su,i]];for(let d=0;d<Fs.length;d++)Mn(n,Fs[d],zd,an,c);for(let d=0;d<js.length;d++)Mn(n,js[d],Bd,Dd,u);kr(zd,{tld:!0,ascii:!0},e),kr(Bd,{utld:!0,alpha:!0},e),Mn(n,"file",ll,an,c),Mn(n,"mailto",ll,an,c),Mn(n,"http",Xr,an,c),Mn(n,"https",Xr,an,c),Mn(n,"ftp",Xr,an,c),Mn(n,"ftps",Xr,an,c),kr(ll,{scheme:!0,ascii:!0},e),kr(Xr,{slashscheme:!0,ascii:!0},e),t=t.sort((d,f)=>d[0]>f[0]?1:-1);for(let d=0;d<t.length;d++){const f=t[d][0],p=t[d][1]?{[AN]:!0}:{[\$N]:!0};f.indexOf("-")>=0?p[Pd]=!0:qr.test(f)?au.test(f)?p[sl]=!0:p[Rd]=!0:p[Id]=!0,Wm(n,f,f,p)}return Wm(n,"localhost",ts,{ascii:!0}),n.jd=new Ye(Ma),{start:n,tokens:Fo({groups:e},gv)}}function zN(t,e){const n=BN(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function BN(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Mn(t,e,n,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new Ye(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new Ye(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Km(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const ns={defaultProtocol:"http",events:null,format:qm,formatHref:qm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function up(t,e){e===void 0&&(e=null);let n=Fo({},ns);t&&(n=Fo(n,t instanceof up?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}up.prototype={o:ns,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:ns[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},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 qm(t){return t}function yv(t,e){this.t="token",this.v=t,this.tk=e}yv.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){return t===void 0&&(t=ns.defaultProtocol),{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),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},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 s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Fo(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function sc(t,e){class n extends yv{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Qm=sc("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Gm=sc("text"),FN=sc("nl"),Hs=sc("url",{isLink:!0,toHref(t){return t===void 0&&(t=ns.defaultProtocol),this.hasProtocol()?this.v:\`\${t}://\${this.v}\`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ts&&t[1].t===Rn}}),Mt=t=>new Ye(t);function jN(t){let{groups:e}=t;const n=e.domain.concat([ca,da,bn,fa,pa,ha,ma,ga,Qt,op,ya,va,wa,ka,Gt,Ma,Ni,xa]),r=[ua,Rn,sp,qt,lp,Sa,ap,cp,Zl,ea,Ti,Oi,Gl,Ql,Yl,Xl,ta,na,ra,oa,ia,sa,la,aa],o=[ca,ua,da,fa,pa,ha,ma,ga,Qt,Ti,Oi,ya,va,wa,ka,Sa,Gt,Ma,Ni,xa],i=Mt(),s=N(i,Ni);H(s,o,s),H(s,e.domain,s);const l=Mt(),a=Mt(),c=Mt();H(i,e.domain,l),H(i,e.scheme,a),H(i,e.slashscheme,c),H(l,o,s),H(l,e.domain,l);const u=N(l,bn);N(s,bn,u),N(a,bn,u),N(c,bn,u);const d=N(s,qt);H(d,o,s),H(d,e.domain,s);const f=Mt();H(u,e.domain,f),H(f,e.domain,f);const p=N(f,qt);H(p,e.domain,f);const h=Mt(Qm);H(p,e.tld,h),H(p,e.utld,h),N(u,ts,h);const g=N(f,Qt);H(g,e.domain,f),H(h,e.domain,f),N(h,qt,p),N(h,Qt,g);const v=N(h,Rn);H(v,e.numeric,Qm);const m=N(l,Qt),y=N(l,qt);H(m,e.domain,l),H(y,o,s),H(y,e.domain,l);const w=Mt(Hs);H(y,e.tld,w),H(y,e.utld,w),H(w,e.domain,l),H(w,o,s),N(w,qt,y),N(w,Qt,m),N(w,bn,u);const S=N(w,Rn),x=Mt(Hs);H(S,e.numeric,x);const k=Mt(Hs),M=Mt();H(k,n,k),H(k,r,M),H(M,n,k),H(M,r,M),N(w,Gt,k),N(x,Gt,k);const T=N(a,Rn),O=N(c,Rn),R=N(O,Gt),Z=N(R,Gt);H(a,e.domain,l),N(a,qt,y),N(a,Qt,m),H(c,e.domain,l),N(c,qt,y),N(c,Qt,m),H(T,e.domain,k),N(T,Gt,k),H(Z,e.domain,k),H(Z,n,k),N(Z,Gt,k);const lt=[[Ti,Oi],[Ql,Gl],[Yl,Xl],[Zl,ea],[ta,na],[ra,oa],[ia,sa],[la,aa]];for(let St=0;St<lt.length;St++){const[ar,It]=lt[St],at=N(k,ar);N(M,ar,at),N(at,It,k);const Qe=Mt(Hs);H(at,n,Qe);const b=Mt();H(at,r),H(Qe,n,Qe),H(Qe,r,b),H(b,n,Qe),H(b,r,b),N(Qe,It,k),N(b,It,k)}return N(i,ts,w),N(i,ip,FN),{start:i,tokens:gv}}function HN(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(cu(Gm,e,s)),s=[]),o-=f,u-=f;const p=d.t,h=n.slice(o-u,o);i.push(cu(p,e,h))}}return s.length>0&&i.push(cu(Gm,e,s)),i}function cu(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const VN=typeof console<"u"&&console&&console.warn||(()=>{}),_N="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ne={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function WN(){Ye.groups={},ne.scanner=null,ne.parser=null,ne.tokenQueue=[],ne.pluginQueue=[],ne.customSchemes=[],ne.initialized=!1}function Ym(t,e){if(e===void 0&&(e=!1),ne.initialized&&VN(\`linkifyjs: already initialized - will not register custom scheme "\${t}" \${_N}\`),!/^[0-9a-z]+(-[0-9a-z]+)*\$/.test(t))throw new Error(\`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat\`);ne.customSchemes.push([t,e])}function UN(){ne.scanner=DN(ne.customSchemes);for(let t=0;t<ne.tokenQueue.length;t++)ne.tokenQueue[t][1]({scanner:ne.scanner});ne.parser=jN(ne.scanner.tokens);for(let t=0;t<ne.pluginQueue.length;t++)ne.pluginQueue[t][1]({scanner:ne.scanner,parser:ne.parser});ne.initialized=!0}function vv(t){return ne.initialized||UN(),HN(ne.parser.start,t,zN(ne.scanner.start,t))}function wv(t,e,n){if(e===void 0&&(e=null),n===void 0&&(n=null),e&&typeof e=="object"){if(n)throw Error(\`linkifyjs: Invalid link type \${e}; must be a string\`);n=e,e=null}const r=new up(n),o=vv(t),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}function JN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function KN(t){return new pe({key:new we("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),i=e.some(a=>a.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=OT(n.doc,[...e]);if(DT(l).forEach(({newRange:a})=>{const c=bT(r.doc,a,f=>f.isTextblock);let u,d;if(c.length>1?(u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):c.length&&r.doc.textBetween(a.from,a.to," "," ").endsWith(" ")&&(u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")),u&&d){const f=d.split(" ").filter(v=>v!=="");if(f.length<=0)return!1;const p=f[f.length-1],h=u.pos+d.lastIndexOf(p);if(!p)return!1;const g=vv(p).map(v=>v.toObject(t.defaultProtocol));if(!JN(g))return!1;g.filter(v=>v.isLink).map(v=>({...v,from:h+v.start+1,to:h+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>t.validate(v.value)).filter(v=>t.shouldAutoLink(v.value)).forEach(v=>{np(v.from,v.to,r.doc).some(m=>m.mark.type===t.type)||s.addMark(v.from,v.to,t.type.create({href:v.href}))})}}),!!s.steps.length)return s}})}function qN(t){return new pe({key:new we("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;const a=iv(e.state,t.type.name),c=r.target,u=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:a.href,d=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:a.target;return c&&u?(window.open(u,d),!0):!1}}})}function QN(t){return new pe({key:new we("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=wv(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(t.editor.commands.setMark(t.type,{href:a.href}),!0)}}})}const GN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function ni(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(GN,"").match(new RegExp(\`^(?:(?:\${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|\$))\`,"i"))}const YN=st.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"){Ym(t);return}Ym(t.scheme,t.optionalSlashes)})},onDestroy(){WN()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!ni(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},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}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!ni(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=>!!ni(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",X(this.options.HTMLAttributes,t),0]:["a",X(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>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[er({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=wv(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!ni(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>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||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(KN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!ni(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(qN({type:this.type})),this.options.linkOnPaste&&t.push(QN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),XN=new ae({tiptapExtension:YN.configure({openOnClick:!0,autolink:!0,protocols:["mailto"]}),onBridgeMessage:(t,{type:e,payload:n})=>{if(e==="set-link"){if(n===null)return!1;if(n==="")return t.chain().focus().extendMarkRange("link").unsetLink().setTextSelection(t.state.selection.from).run(),!1;t.chain().focus().extendMarkRange("link").setLink({href:n}).setTextSelection(t.state.selection.from).run()}return!1},extendEditorInstance:t=>({setLink:e=>t({type:"set-link",payload:e})}),extendEditorState:t=>({canSetLink:!t.state.selection.empty,isLinkActive:t.isActive("link"),activeLink:t.getAttributes("link").href})}),ZN=new ae({tiptapExtension:rp,onBridgeMessage:(t,e)=>{switch(e.type){case"lift":t.chain().focus().liftListItem(t.schema.nodes.listItem.name).run();break;case"sink":t.chain().focus().sinkListItem(t.schema.nodes.listItem.name).run();break}return!1},extendEditorInstance:t=>({lift:()=>t({type:"lift"}),sink:()=>t({type:"sink"})}),extendEditorState:t=>({canLift:t.can().liftListItem(t.state.schema.nodes.listItem.name),canSink:t.can().sinkListItem(t.state.schema.nodes.listItem.name)})}),eb=\$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",X(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Xm=st.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",X(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=ps(t,this.type);return Object.entries(n).some(([,r])=>!!r)?!0:e.unsetMark(this.name)}}}}),Zm=/^(\d+)\.\s\$/,tb=\$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}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",X(this.options.HTMLAttributes,n),0]:["ol",X(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(eb.name,this.editor.getAttributes(Xm.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Bo({find:Zm,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=Bo({find:Zm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Xm.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),nb=new ae({tiptapExtension:tb,tiptapExtensionDeps:[rp],onBridgeMessage:(t,e)=>(e.type==="toggle-orderedList"&&t.chain().focus().toggleOrderedList().run(),!1),extendEditorInstance:t=>({toggleOrderedList:()=>t({type:"toggle-orderedList"})}),extendEditorState:t=>({canToggleOrderedList:t.can().toggleOrderedList(),isOrderedListActive:t.isActive("orderedList")})}),rb=it.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new pe({key:new we("placeholder"),props:{decorations:({doc:t,selection:e})=>{var n;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,i=[];if(!r)return null;const{firstChild:s}=t.content,l=s&&s.type.isLeaf,a=s&&s.isAtom,c=this.options.considerAnyAsEmpty?!0:s&&s.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),u=t.content.childCount<=1&&s&&c&&s.nodeSize<=2&&(!l||!a);return t.descendants((d,f)=>{const p=o>=f&&o<=f+d.nodeSize,h=!d.isLeaf&&!d.childCount;if((p||!this.options.showOnlyCurrent)&&h){const g=[this.options.emptyNodeClass];u&&g.push(this.options.emptyEditorClass);const v=Ze.node(f,f+d.nodeSize,{class:g.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:d,pos:f,hasAnchor:p}):this.options.placeholder});i.push(v)}return this.options.includeChildren}),oe.create(t,i)}}})]}}),ob=new ae({tiptapExtension:rb,extendCSS:\`
    .is-editor-empty:first-child::before {
        color: #adb5bd;
        content: attr(data-placeholder);
        float: left;
        height: 0;
        pointer-events: none;
    }
  \`,onBridgeMessage:(t,e)=>{switch(e.type){case"set-placeholder":t.extensionManager.extensions.forEach(n=>{n.name==="placeholder"&&(n.options.placeholder=e.payload)}),t.setOptions();break}return!1},extendEditorInstance:t=>({setPlaceholder:e=>t({type:"set-placeholder",payload:e})})}),ib=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))\$/,sb=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,lb=st.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",X(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){const t={};return ep()?t["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():t["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),t},addInputRules(){return[jr({find:ib,type:this.type})]},addPasteRules(){return[er({find:sb,type:this.type})]}}),ab=new ae({tiptapExtension:lb,onBridgeMessage:(t,e)=>(e.type==="toggle-strike"&&t.chain().focus().toggleStrike().run(),!1),extendEditorInstance:t=>({toggleStrike:()=>t({type:"toggle-strike"})}),extendEditorState:t=>({canToggleStrike:t.can().toggleStrike(),isStrikeActive:t.isActive("strike")})}),cb=st.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",X(this.options.HTMLAttributes,t),0]},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()}}}),ub=new ae({tiptapExtension:cb,onBridgeMessage:(t,e)=>(e.type==="toggle-underline"&&t.chain().focus().toggleUnderline().run(),!1),extendEditorInstance:t=>({toggleUnderline:()=>t({type:"toggle-underline"})}),extendEditorState:t=>({canToggleUnderline:t.can().toggleUnderline(),isUnderlineActive:t.isActive("underline")})}),db=\$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",X(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),fb=/^\s*(\[([( |x])?\])\s\$/,pb=\$e.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>t.getAttribute("data-checked")==="true",renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:\`li[data-type="\${this.name}"]\`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",X(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},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 o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");return i.contentEditable="false",l.type="checkbox",l.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=c.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=n(),p=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...p==null?void 0:p.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{o.setAttribute(c,u)}),o.dataset.checked=t.attrs.checked,t.attrs.checked&&l.setAttribute("checked","checked"),i.append(l,s),o.append(i,a),Object.entries(e).forEach(([c,u])=>{o.setAttribute(c,u)}),{dom:o,contentDOM:a,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,c.attrs.checked?l.setAttribute("checked","checked"):l.removeAttribute("checked"),!0)}}},addInputRules(){return[Bo({find:fb,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),hb=new ae({tiptapExtension:db,tiptapExtensionDeps:[pb.configure({nested:!0})],onBridgeMessage:(t,e)=>(e.type==="toggle-task-list"&&t.chain().focus().toggleTaskList().run(),e.type==="lift-task-list-item"&&t.chain().focus().liftListItem(t.state.schema.nodes.taskItem.name).run(),e.type==="sink-task-list-item"&&t.chain().focus().sinkListItem(t.state.schema.nodes.taskItem.name).run(),!1),extendEditorInstance:t=>({toggleTaskList:()=>t({type:"toggle-task-list"}),liftTaskListItem:()=>t({type:"lift-task-list-item"}),sinkTaskListItem:()=>t({type:"sink-task-list-item"})}),extendEditorState:t=>({canToggleTaskList:t.can().toggleTaskList(),isTaskListActive:t.isActive("taskList"),canLiftTaskListItem:t.can().liftListItem(t.state.schema.nodes.taskItem.name),canSinkTaskListItem:t.can().sinkListItem(t.state.schema.nodes.taskItem.name)}),extendCSS:\`
  ul[data-type="taskList"] {
    list-style: none;
    padding: 0;
  }
  
  ul[data-type="taskList"] > li {
    display: flex;
  }
  
  ul[data-type="taskList"] p {
    margin: 0;
  }
  
  ul[data-type="taskList"] li {
    display: flex;
  }
  
  ul[data-type="taskList"] li > label > input {
    font-size: inherit;
    font-family: inherit;
    color: #000;
    margin: 0.1rem;
    border: 1px solid black;
    border-radius: 0.3rem;
    padding: 0.1rem 0.4rem;
    background: white;
    accent-color: black;
  }
  ul[data-type="taskList"] li > label {
    flex: 0 0 auto;
    margin-right: 0.5rem;
    user-select: none;
  }
  
  ul[data-type="taskList"] li > div {
    flex: 1 1 auto;
  }  
  \`});function mb(t={}){return new pe({view(e){return new gb(e,t)}})}class gb{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(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,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;if(n){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=l?u.bottom:u.top;l&&a&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.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 i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=o.getBoundingClientRect();i=l.left-o.scrollLeft,s=l.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=s1(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const yb=it.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[mb(this.options)]}}),vb=new ae({tiptapExtension:yb}),wb=\$e.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",X(this.options.HTMLAttributes,t)]},renderText(){return\`
\`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.\$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.\$to.parentOffset&&o.\$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),kb=new ae({tiptapExtension:wb,onBridgeMessage:(t,e)=>(e.type==="set-hard-break"&&(console.log("setting hard break"),t.chain().focus().setHardBreak().run()),!1),extendEditorInstance:t=>({setHardBreak:()=>t({type:"set-hard-break"})}),extendEditorState:()=>({})}),Sb=[KO,vN,eN,ON,ab,ub,nb,oN,SN,GO,HO,hb,XN,nN,aN,IO,ob,ZN,vb,kb];function kv(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=kv(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Sv(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=Sv(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class L{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,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!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,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new L(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new L(r,o)}cutByIndex(e,n){return e==n?L.empty:e==0&&n==this.content.length?this:new L(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new L(o,i)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let 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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return kv(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Sv(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Vs(0,e);if(e==this.size)return Vs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(\`Position \${e} outside of fragment (\${this})\`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||n>0?Vs(r+1,s):Vs(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return L.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new L(n||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const uu={index:0,offset:0};function Vs(t,e){return uu.index=t,uu.offset=e,uu}function Fd(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(!Fd(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Fd(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class ut{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),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&&Fd(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\`);return r.create(n.attrs)}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 ut.none;if(e instanceof ut)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}ut.none=[];class xb extends Error{}class z{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=Mv(this.content,e+this.openStart,n);return r&&new z(r,this.openStart,this.openEnd)}removeBetween(e,n){return new z(xv(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 z.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new z(L.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=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)o++;return new z(e,r,o)}}z.empty=new z(L.empty,0,0);function xv(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(xv(i.content,e-o-1,n-o-1)))}function Mv(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=Mv(s.content,e-i-1,n);return l&&t.replaceChild(o,s.copy(l))}class jd{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)}}function Mb(t){return t.tag!=null}function Eb(t){return t.style!=null}class Ea{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(Mb(o))this.tags.push(o);else if(Eb(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new tg(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new tg(this,n,!0);return r.addAll(e,n.from,n.to),z.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(Ob(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=ng(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=ng(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ea(e,Ea.schemaRules(e)))}}const Ev={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},Cb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Cv={ol:!0,ul:!0},Ca=1,Ta=2,bi=4;function eg(t,e,n){return e!=null?(e?Ca:0)|(e==="full"?Ta:0):t&&t.whitespace=="pre"?Ca|Ta:n&~bi}class _s{constructor(e,n,r,o,i,s,l){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=l,this.content=[],this.activeMarks=ut.none,this.stashMarks=[],this.match=s||(l&bi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(L.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ca)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+\$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=L.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;n<r.length;n++){let o=r[n];(this.type?this.type.allowsMarkType(o.type):Nb(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ev.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class tg{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=eg(null,n.preserveWhitespace,0)|(r?bi:0);o?i=new _s(o.type,o.attrs,ut.none,ut.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new _s(null,null,ut.none,ut.none,!0,null,s):i=new _s(e.schema.topNodeType,null,ut.none,ut.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.style;if(!r||!r.length)return n();let o=this.readStyles(e.style);if(!o)return;let[i,s]=o,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);n();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&Ta||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&Ca)r.options&Ta?n=n.replace(/\r\n?/g,\`
\`):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&i.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]\$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),o;Cv.hasOwnProperty(r)&&this.parser.normalizeLists&&Tb(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));if(i?i.ignore:Cb.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let s,l=this.top,a=this.needsBlock;if(Ev.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(\`
\`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=ut.none,r=ut.none;if(e.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=e.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{a.clearMark(c)&&(r=c.addToSet(r))}):n=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(n),a.consuming===!1)l=a;else break}}return[n,r]}addElementByRule(e,n,r){let o,i,s;n.node?(i=this.parser.schema.nodes[n.node],i.isLeaf?this.insertNode(i.create(n.attrs))||this.leafFallback(e):o=this.enter(i,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));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)}o&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let n,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=i,!s.length)||i.solid)break}if(!n)return!1;this.sync(r);for(let o=0;o<n.length;o++)this.enterInner(n[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let o=0;o<e.marks.length;o++)(!n.type||n.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let o=this.findPlace(e.create(n));return o&&this.enterInner(e,n,!0,r),o}enterInner(e,n=null,r=!1,o){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=eg(e,o,i.options);i.options&bi&&i.content.length==0&&(s|=bi),this.nodes.push(new _s(e,n,i.activeMarks,i.pendingMarks,r,null,s)),this.open++}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;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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(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(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(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}}addPendingMark(e){let n=bb(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let s=o.popFromStashMark(e);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==n)break}}}function Tb(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Cv.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ob(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ng(t){let e={};for(let n in t)e[n]=t[n];return e}function Nb(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=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&&s(u))return!0}};if(s(o.contentMatch))return!0}}function bb(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}const Tv=65535,Ov=Math.pow(2,16);function Ab(t,e){return t+e*Ov}function rg(t){return t&Tv}function \$b(t){return(t-(t&Tv))/Ov}const Nv=1,bv=2,al=4,Av=8;class og{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Av)>0}get deletedBefore(){return(this.delInfo&(Nv|al))>0}get deletedAfter(){return(this.delInfo&(bv|al))>0}get deletedAcross(){return(this.delInfo&al)>0}}class pt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pt.empty)return pt.empty}recover(e){let n=0,r=rg(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+\$b(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 o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,p=a+o+(f<0?0:u);if(r)return p;let h=e==(n<0?a:d)?null:Ab(l/3,e-a),g=e==a?bv:e==d?Nv:al;return(n<0?e!=a:e!=d)&&(g|=Av),new og(p,g,h)}o+=u-c}return r?e+o:new og(e+o,0,null)}touches(e,n){let r=0,o=rg(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pt.empty:new pt(e<0?[0,-e,0]:[0,0,e])}}pt.empty=new pt([]);const du=Object.create(null);class je{getMap(){return pt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=du[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 du)throw new RangeError("Duplicate use of step JSON ID "+e);return du[e]=n,n.prototype.jsonID=e,n}}class ge{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ge(e,null)}static fail(e){return new ge(null,e)}static fromReplace(e,n,r,o){try{return ge.ok(e.replace(n,r,o))}catch(i){if(i instanceof xb)return ge.fail(i.message);throw i}}}function dp(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(dp(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return L.fromArray(r)}class Sr extends je{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),o=r.node(r.sharedDepth(this.to)),i=new z(dp(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return ge.fromReplace(e,this.from,this.to,i)}invert(){return new xr(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 Sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Sr(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 Sr(n.from,n.to,e.markFromJSON(n.mark))}}je.jsonID("addMark",Sr);class xr extends je{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 z(dp(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return ge.fromReplace(e,this.from,this.to,r)}invert(){return new Sr(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 xr(n.pos,r.pos,this.mark)}merge(e){return e instanceof xr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xr(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 xr(n.from,n.to,e.markFromJSON(n.mark))}}je.jsonID("removeMark",xr);class Mr extends je{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ge.fromReplace(e,this.pos,this.pos+1,new z(L.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Mr(this.pos,n.marks[o]);return new Mr(this.pos,this.mark)}}return new rs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mr(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 Mr(n.pos,e.markFromJSON(n.mark))}}je.jsonID("addNodeMark",Mr);class rs extends je{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ge.fromReplace(e,this.pos,this.pos+1,new z(L.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Mr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new rs(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 rs(n.pos,e.markFromJSON(n.mark))}}je.jsonID("removeNodeMark",rs);class dt extends je{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Hd(e,this.from,this.to)?ge.fail("Structure replace would overwrite content"):ge.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new dt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new dt(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof dt)||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?z.empty:new z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new dt(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?z.empty:new z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new dt(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 dt(n.from,n.to,z.fromJSON(e,n.slice),!!n.structure)}}je.jsonID("replace",dt);class ot extends je{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Hd(e,this.from,this.gapFrom)||Hd(e,this.gapTo,this.to)))return ge.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ge.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ge.fromReplace(e,this.from,this.to,r):ge.fail("Content does not fit in gap")}getMap(){return new pt([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 ot(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),o=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||o<n.pos||i>r.pos?null:new ot(n.pos,r.pos,o,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 ot(n.from,n.to,n.gapFrom,n.gapTo,z.fromJSON(e,n.slice),n.insert,!!n.structure)}}je.jsonID("replaceAround",ot);function Hd(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Ib(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Uo(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.\$from.node(r),i=t.\$from.index(r),s=t.\$to.indexAfter(r);if(r<t.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!Ib(o,i,s))break}return null}function \$v(t,e,n=null,r=t){let o=Rb(t,e),i=o&&Lb(r,e);return i?o.map(ig).concat({type:e,attrs:n}).concat(i.map(ig)):null}function ig(t){return{type:t,attrs:null}}function Rb(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function Lb(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function Co(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function _r(t,e){let n=t.resolve(e),r=n.index();return Iv(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Iv(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function lc(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Iv(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function fp(t,e,n=e,r=z.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Pb(o,i,r)?new dt(e,n,r):new Db(o,i,r).fit()}function Pb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Db{constructor(e,n,r){this.\$from=e,this.\$to=n,this.unplaced=r,this.frontier=[],this.placed=L.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=L.from(e.node(o).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,o=this.close(e<0?this.\$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new z(i,s,l);return e>-1?new ot(r.pos,e,this.\$to.pos,this.\$to.end(),a,n):a.size||r.pos!=this.\$to.pos?new dt(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=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 o,i=null;r?(i=fu(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(L.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.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,o=fu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new z(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=fu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new z(ui(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new z(ui(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),v=d.matchType(g.type);if(!v)break;c++,(c>1||a==0||g.content.size)&&(d=v,u.push(Rv(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=di(this.placed,n,L.from(u)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=l;g<p;g++){let m=v.lastChild;this.frontier.push({type:m.type,match:m.contentMatchAt(m.childCount)}),v=m.content}this.unplaced=h?e==0?z.empty:new z(ui(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new z(ui(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.\$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!pu(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,o=this.\$to.after(r);for(;r>1&&o==this.\$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=pu(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=pu(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,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=di(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=di(this.placed,this.depth,L.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(L.empty,!0);n.childCount&&(this.placed=di(this.placed,this.frontier.length,n))}}function ui(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ui(t.firstChild.content,e-1,n)))}function di(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(di(t.lastChild.content,e-1,n)))}function fu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Rv(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Rv(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(L.empty,!0)))),t.copy(r)}function pu(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!zb(n,i.content,s)?l:null}function zb(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}class Ai extends je{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 ge.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 o=n.type.create(r,null,n.marks);return ge.fromReplace(e,this.pos,this.pos+1,new z(L.from(o),0,n.isLeaf?0:1))}getMap(){return pt.empty}invert(e){return new Ai(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 Ai(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 Ai(n.pos,n.attr,n.value)}}je.jsonID("attr",Ai);class Oa extends je{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ge.ok(r)}getMap(){return pt.empty}invert(e){return new Oa(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 Oa(n.attr,n.value)}}je.jsonID("docAttr",Oa);let is=class extends Error{};is=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};is.prototype=Object.create(Error.prototype);is.prototype.constructor=is;is.prototype.name="TransformError";const hu=Object.create(null);class de{constructor(e,n,r){this.\$anchor=e,this.\$head=n,this.ranges=r||[new Bb(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=z.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{\$from:a,\$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?z.empty:n),l==0&&ag(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{\$from:s,\$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),ag(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new gt(e):Zr(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Zr(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Zr(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new rn(e.node(0))}static atStart(e){return Zr(e,e,0,0,1)||new rn(e)}static atEnd(e){return Zr(e,e,e.content.size,e.childCount,-1)||new rn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=hu[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 hu)throw new RangeError("Duplicate use of selection JSON ID "+e);return hu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return gt.between(this.\$anchor,this.\$head).getBookmark()}}de.prototype.visible=!0;class Bb{constructor(e,n){this.\$from=e,this.\$to=n}}let sg=!1;function lg(t){!sg&&!t.parent.inlineContent&&(sg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class gt extends de{constructor(e,n=e){lg(e),lg(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 de.near(r);let o=e.resolve(n.map(this.anchor));return new gt(o.parent.inlineContent?o:r,r)}replace(e,n=z.empty){if(super.replace(e,n),n==z.empty){let r=this.\$from.marksAcross(this.\$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof gt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ac(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 gt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=de.findFrom(n,r,!0)||de.findFrom(n,-r,!0);if(i)n=i.\$head;else return de.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(de.findFrom(e,-r,!0)||de.findFrom(e,r,!0)).\$anchor,e.pos<n.pos!=o<0&&(e=n))),new gt(e,n)}}de.jsonID("text",gt);class ac{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ac(e.map(this.anchor),e.map(this.head))}resolve(e){return gt.between(e.resolve(this.anchor),e.resolve(this.head))}}class ie extends de{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?de.near(i):new ie(i)}content(){return new z(L.from(this.node),0,0)}eq(e){return e instanceof ie&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new pp(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ie(e.resolve(n.anchor))}static create(e,n){return new ie(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ie.prototype.visible=!1;de.jsonID("node",ie);class pp{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ac(r,r):new pp(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ie.isSelectable(r)?new ie(n):de.near(n)}}class rn extends de{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=z.empty){if(n==z.empty){e.delete(0,e.doc.content.size);let r=de.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new rn(e)}map(e){return new rn(e)}eq(e){return e instanceof rn}getBookmark(){return Fb}}de.jsonID("all",rn);const Fb={map(){return this},resolve(t){return new rn(t)}};function Zr(t,e,n,r,o,i=!1){if(e.inlineContent)return gt.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&ie.isSelectable(l))return ie.create(t,n-(o<0?l.nodeSize:0))}else{let a=Zr(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function ag(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof dt||o instanceof ot))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(de.near(t.doc.resolve(s),n))}function cg(t,e){return!e||!t?t:t.bind(e)}class Ws{constructor(e,n,r){this.name=e,this.init=cg(n.init,r),this.apply=cg(n.apply,r)}}new Ws("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ws("selection",{init(t,e){return t.selection||de.atStart(e.doc)},apply(t){return t.selection}}),new Ws("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.\$cursor?t.storedMarks:null}}),new Ws("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});const jb=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Lv(t,e){let{\$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Hb=(t,e,n)=>{let r=Lv(t,n);if(!r)return!1;let o=hp(r);if(!o){let s=r.blockRange(),l=s&&Uo(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&Bv(t,o,e))return!0;if(r.parent.content.size==0&&(jo(i,"end")||ie.isSelectable(i))){let s=fp(t.doc,r.before(),r.after(),z.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(jo(i,"end")?de.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):ie.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},Vb=(t,e,n)=>{let r=Lv(t,n);if(!r)return!1;let o=hp(r);return o?Pv(t,o,e):!1},_b=(t,e,n)=>{let r=Dv(t,n);if(!r)return!1;let o=mp(r);return o?Pv(t,o,e):!1};function Pv(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=fp(t.doc,i,a,z.empty);if(!c||c.from!=i||c instanceof dt&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(gt.create(u.doc,i)),n(u.scrollIntoView())}return!0}function jo(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 Wb=(t,e,n)=>{let{\$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=hp(r)}let s=i&&i.nodeBefore;return!s||!ie.isSelectable(s)?!1:(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function hp(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 Dv(t,e){let{\$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Ub=(t,e,n)=>{let r=Dv(t,n);if(!r)return!1;let o=mp(r);if(!o)return!1;let i=o.nodeAfter;if(Bv(t,o,e))return!0;if(r.parent.content.size==0&&(jo(i,"start")||ie.isSelectable(i))){let s=fp(t.doc,r.before(),r.after(),z.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(jo(i,"start")?de.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):ie.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Jb=(t,e,n)=>{let{\$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=mp(r)}let s=i&&i.nodeAfter;return!s||!ie.isSelectable(s)?!1:(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos)).scrollIntoView()),!0)};function mp(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 Kb=(t,e)=>{let n=t.selection,r=n instanceof ie,o;if(r){if(n.node.isTextblock||!_r(t.doc,n.from))return!1;o=n.from}else if(o=lc(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(ie.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},qb=(t,e)=>{let n=t.selection,r;if(n instanceof ie){if(n.node.isTextblock||!_r(t.doc,n.to))return!1;r=n.to}else if(r=lc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Qb=(t,e)=>{let{\$from:n,\$to:r}=t.selection,o=n.blockRange(r),i=o&&Uo(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},Gb=(t,e)=>{let{\$head:n,\$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(\`
\`).scrollIntoView()),!0)};function zv(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 Yb=(t,e)=>{let{\$head:n,\$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=zv(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(de.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Xb=(t,e)=>{let n=t.selection,{\$from:r,\$to:o}=n;if(n instanceof rn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=zv(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(gt.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Zb=(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(Co(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Uo(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)},eA=(t,e)=>{let{\$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(ie.create(t.doc,o))),!0)};function tA(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.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)||!(o.isTextblock||_r(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Bv(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(tA(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(n){let d=e.pos+o.nodeSize,f=L.empty;for(let g=i.length-1;g>=0;g--)f=L.from(i[g].create(null,f));f=L.from(r.copy(f));let p=t.tr.step(new ot(e.pos-1,d,e.pos,d,new z(f,1,0),i.length,!0)),h=d+2*i.length;_r(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}let a=de.findFrom(e,1),c=a&&a.\$from.blockRange(a.\$to),u=c&&Uo(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(l&&jo(o,"start",!0)&&jo(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let p=o,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(d.canReplace(d.childCount,d.childCount,p.content)){if(n){let g=L.empty;for(let m=f.length-1;m>=0;m--)g=L.from(f[m].copy(g));let v=t.tr.step(new ot(e.pos-f.length,e.pos+o.nodeSize,e.pos+h,e.pos+o.nodeSize-h,new z(g,f.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Fv(t){return function(e,n){let r=e.selection,o=t<0?r.\$from:r.\$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(gt.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const nA=Fv(-1),rA=Fv(1);function oA(t,e=null){return function(n,r){let{\$from:o,\$to:i}=n.selection,s=o.blockRange(i),l=s&&\$v(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function ug(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{\$from:{pos:s},\$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{\$from:{pos:l},\$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function iA(t,e=null){return function(n,r){let{\$from:o,\$to:i}=n.selection,s=o.blockRange(i),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);a=new jd(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new jd(o,n.doc.resolve(i.end(s.depth)),s.depth)),l=!0}let c=\$v(a,t,e,s);return c?(r&&r(sA(n.tr,s,c,l,t).scrollIntoView()),!0):!1}}function sA(t,e,n,r,o){let i=L.empty;for(let u=n.length-1;u>=0;u--)i=L.from(n[u].type.create(n[u].attrs,i));t.step(new ot(e.start-(r?2:0),e.end,e.start,e.end,new z(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,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&&Co(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function lA(t){return function(e,n){let{\$from:r,\$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?aA(e,n,t,i):cA(e,n,i):!0:!1}}function aA(t,e,n,r){let o=t.tr,i=r.end,s=r.\$to.end(r.depth);i<s&&(o.step(new ot(i-1,s,i,s,new z(L.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new jd(o.doc.resolve(r.\$from.pos),o.doc.resolve(s),r.depth));const l=Uo(r);if(l==null)return!1;o.lift(r,l);let a=o.mapping.map(i,-1)-1;return _r(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function cA(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,g=n.startIndex;h>g;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?L.empty:L.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new ot(d-(l?1:0),f+(a?1:0),d+1,f-1,new z((l?L.empty:L.from(o.copy(L.empty))).append(a?L.empty:L.from(o.copy(L.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function uA(t){return function(e,n){let{\$from:r,\$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=L.from(c?t.create():null),d=new z(L.from(t.create(null,L.from(l.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new ot(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function jv(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=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 o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}class dA{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...g)=>{const v=this.buildProps(c,n),m=p(...g)(v);return l.push(m),d}])),run:u};return d}createCan(e){const{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(e,n=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:jv({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}function ht(t,e,n){return t.config[e]===void 0&&t.parent?ht(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ht(t.parent,e,n):null}):t.config[e]}function fA(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Be(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}function fi(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?i.split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function pA(t){return typeof t=="function"}function Ft(t,e=void 0,...n){return pA(t)?e?t.bind(e)(...n):t(...n):t}function hA(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function mA(t){return Object.prototype.toString.call(t).slice(8,-1)}function mu(t){return mA(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function gp(t,e){const n={...t};return mu(t)&&mu(e)&&Object.keys(e).forEach(r=>{mu(e[r])?r in t?n[r]=gp(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class kn{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${this.name}".\`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ft(ht(this,"addOptions",{name:this.name}))),this.storage=Ft(ht(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new kn(e)}configure(e={}){const n=this.extend();return n.parent=this.parent,n.options=gp(this.options,e),n.storage=Ft(ht(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new kn({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${n.name}".\`),n.options=Ft(ht(n,"addOptions",{name:n.name})),n.storage=Ft(ht(n,"addStorage",{name:n.name,options:n.options})),n}}function gA(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=\`

\`,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const p=s==null?void 0:s[a.type.name];if(p)return u&&(l+=p({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function yA(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}kn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new pe({key:new we("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.\$from.pos)),l=Math.max(...i.map(u=>u.\$to.pos)),a=yA(n);return gA(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}});const vA=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),wA=(t=!1)=>({commands:e})=>e.setContent("",t),kA=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({\$from:i,\$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Uo(p);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(h||h===0)&&e.lift(p,h)})}),!0},SA=t=>e=>t(e),xA=()=>({state:t,dispatch:e})=>Xb(t,e),MA=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new D(r.doc.resolve(s-1))),!0},EA=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.\$anchor.node();if(r.content.size>0)return!1;const o=t.selection.\$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const l=o.before(i),a=o.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1},CA=t=>({tr:e,state:n,dispatch:r})=>{const o=Be(t,n.schema),i=e.selection.\$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},TA=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},OA=()=>({state:t,dispatch:e})=>jb(t,e),NA=()=>({commands:t})=>t.keyboardShortcut("Enter"),bA=()=>({state:t,dispatch:e})=>Yb(t,e);function Na(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:hA(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Vd(t,e,n={}){return t.find(r=>r.type===e&&Na(r.attrs,n))}function AA(t,e,n={}){return!!Vd(t,e,n)}function Hv(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=Vd([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(Vd([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&AA([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function lr(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}const \$A=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=lr(t,r.schema),{doc:s,selection:l}=n,{\$from:a,from:c,to:u}=l;if(o){const d=Hv(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=D.create(s,d.from,d.to);n.setSelection(f)}}return!0},IA=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 Vv(t){return t instanceof D}function Er(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function RA(t,e=null){if(!e)return null;const n=j.atStart(t),r=j.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?D.create(t,Er(0,o,i),Er(t.content.size,o,i)):D.create(t,Er(e,o,i),Er(e,o,i))}function yp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const LA=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{yp()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!Vv(n.state.selection))return s(),!0;const l=RA(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},PA=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),DA=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),_v=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&&_v(r)}return t};function dg(t){const e=\`<body>\${t}</body>\`,n=new window.DOMParser().parseFromString(e,"text/html").body;return _v(n)}function ba(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{return Array.isArray(t)&&t.length>0?L.fromArray(t.map(s=>e.nodeFromJSON(s))):e.nodeFromJSON(t)}catch(i){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),ba("",e,n)}if(o){const i=Ea.fromSchema(e);return n.slice?i.parseSlice(dg(t),n.parseOptions).content:i.parse(dg(t),n.parseOptions)}return ba("",e,n)}function zA(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof dt||o instanceof ot))return;const i=t.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(j.near(t.doc.resolve(s),n))}const BA=t=>t.toString().startsWith("<"),FA=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const s=ba(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:l,to:a}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((BA(s)?s:[s]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),l===a&&u){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,a+=1)}let f;c?(Array.isArray(e)?f=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?f=e.text:f=e,r.insertText(f,l,a)):(f=s,r.replaceWith(l,a,f)),n.updateSelection&&zA(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:f}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:f})}return!0},jA=()=>({state:t,dispatch:e})=>Kb(t,e),HA=()=>({state:t,dispatch:e})=>qb(t,e),VA=()=>({state:t,dispatch:e})=>Hb(t,e),_A=()=>({state:t,dispatch:e})=>Ub(t,e),WA=()=>({tr:t,state:e,dispatch:n})=>{try{const r=lc(e.doc,e.selection.\$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},UA=()=>({state:t,dispatch:e,tr:n})=>{try{const r=lc(t.doc,t.selection.\$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},JA=()=>({state:t,dispatch:e})=>Vb(t,e),KA=()=>({state:t,dispatch:e})=>_b(t,e);function Wv(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function qA(t){const e=t.split(/-(?!\$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)\$/i.test(a))s=!0;else if(/^a(lt)?\$/i.test(a))r=!0;else if(/^(c|ctrl|control)\$/i.test(a))o=!0;else if(/^s(hift)?\$/i.test(a))i=!0;else if(/^mod\$/i.test(a))yp()||Wv()?s=!0:o=!0;else throw new Error(\`Unrecognized modifier name: \${a}\`)}return r&&(n=\`Alt-\${n}\`),o&&(n=\`Ctrl-\${n}\`),s&&(n=\`Meta-\${n}\`),i&&(n=\`Shift-\${n}\`),n}const QA=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=qA(t).split(/-(?!\$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,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&&o&&r.maybeStep(u)}),!0};function vp(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?Be(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(o,f+d.nodeSize);l.push({node:d,from:p,to:h})});const a=o-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Na(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const GA=(t,e={})=>({state:n,dispatch:r})=>{const o=Be(t,n.schema);return vp(n,o,e)?Qb(n,r):!1},YA=()=>({state:t,dispatch:e})=>Zb(t,e),XA=t=>({state:e,dispatch:n})=>{const r=Be(t,e.schema);return lA(r)(e,n)},ZA=()=>({state:t,dispatch:e})=>Gb(t,e);function Uv(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function fg(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const e\$=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Uv(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=Be(t,r.schema)),l==="mark"&&(s=lr(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.\$from.pos,a.\$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,fg(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(fg(d.attrs,e)))})})}),!0):!1},t\$=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),n\$=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),r\$=()=>({state:t,dispatch:e})=>Wb(t,e),o\$=()=>({state:t,dispatch:e})=>Jb(t,e),i\$=()=>({state:t,dispatch:e})=>eA(t,e),s\$=()=>({state:t,dispatch:e})=>rA(t,e),l\$=()=>({state:t,dispatch:e})=>nA(t,e);function a\$(t,e,n={}){return ba(t,e,{slice:!1,parseOptions:n})}const c\$=(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,l=a\$(t,o.schema,n);return i&&r.replaceWith(0,s.content.size,l).setMeta("preventUpdate",!e),!0};function u\$(t,e){const n=lr(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.\$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function d\$(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 f\$(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 wp(t){return e=>f\$(e.\$from,t)}function cl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function p\$(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?lr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.\$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Na(d.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({\$from:d,\$to:f})=>{const p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(g,v)=>{if(!g.isText&&!g.marks.length)return;const m=Math.max(p,v),y=Math.min(h,v+g.nodeSize),w=y-m;s+=w,l.push(...g.marks.map(S=>({mark:S,from:m,to:y})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Na(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)>=s}function pg(t,e){const{nodeExtensions:n}=fA(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=Ft(ht(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function h\$(t,e,n){var r;const{selection:o}=e;let i=null;if(Vv(o)&&(i=o.\$cursor),i){const l=(r=t.storedMarks)!==null&&r!==void 0?r:i.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:s}=o;return s.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 p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=p&&h}return!c}),c})}const m\$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=lr(t,r.schema);if(o)if(s){const c=u\$(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,p)=>{const h=Math.max(p,u),g=Math.min(p+f.nodeSize,d);f.marks.find(m=>m.type===a)?f.marks.forEach(m=>{a===m.type&&n.addMark(h,g,a.create({...m.attrs,...e}))}):n.addMark(h,g,a.create(e))})});return h\$(r,n,a)},g\$=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),y\$=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=Be(t,n.schema);return i.isTextblock?o().command(({commands:s})=>ug(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>ug(i,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},v\$=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=Er(t,0,r.content.size),i=P.create(r,o);e.setSelection(i)}return!0},w\$=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=D.atStart(r).from,l=D.atEnd(r).to,a=Er(o,s,l),c=Er(i,s,l),u=D.create(r,a,c);e.setSelection(u)}return!0},k\$=t=>({state:e,dispatch:n})=>{const r=Be(t,e.schema);return uA(r)(e,n)};function hg(t,e){const n=t.storedMarks||t.selection.\$to.parentOffset&&t.selection.\$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}const S\$=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{\$from:l,\$to:a}=i,c=o.extensionManager.attributes,u=cl(c,l.node().type.name,l.node().attrs);if(i instanceof P&&i.node.isBlock)return!l.parentOffset||!Co(s,l.pos)?!1:(r&&(t&&hg(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const d=a.parentOffset===a.parent.content.size;i instanceof D&&e.deleteSelection();const f=l.depth===0?void 0:d\$(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,h=Co(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!h&&Co(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),h&&(e.split(e.mapping.map(l.pos),1,p),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),v=e.doc.resolve(g);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&hg(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},x\$=t=>({tr:e,state:n,dispatch:r,editor:o})=>{var i;const s=Be(t,n.schema),{\$from:l,\$to:a}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==s)return!1;const d=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let v=L.empty;const m=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-m;M>=l.depth-3;M-=1)v=L.from(l.node(M).copy(v));const y=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w=cl(d,l.node().type.name,l.node().attrs),S=((i=s.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(w))||void 0;v=v.append(L.from(s.createAndFill(null,S)||void 0));const x=l.before(l.depth-(m-1));e.replace(x,l.after(-y),new z(v,4-m,0));let k=-1;e.doc.nodesBetween(x,e.doc.content.size,(M,T)=>{if(k>-1)return!1;M.isTextblock&&M.content.size===0&&(k=T+1)}),k>-1&&e.setSelection(D.near(e.doc.resolve(k))),e.scrollIntoView()}return!0}const f=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p=cl(d,u.type.name,u.attrs),h=cl(d,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const g=f?[{type:s,attrs:p},{type:f,attrs:h}]:[{type:s,attrs:p}];if(!Co(e.doc,l.pos,2))return!1;if(r){const{selection:v,storedMarks:m}=n,{splittableMarks:y}=o.extensionManager,w=m||v.\$to.parentOffset&&v.\$from.marks();if(e.split(l.pos,2,g).scrollIntoView(),!w||!r)return!0;const S=w.filter(x=>y.includes(x.type.name));e.ensureMarks(S)}return!0},gu=(t,e)=>{const n=wp(s=>s.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 o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&_r(t.doc,n.pos)&&t.join(n.pos),!0},yu=(t,e)=>{const n=wp(s=>s.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 o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&_r(t.doc,r)&&t.join(r),!0},M\$=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=Be(t,s.schema),h=Be(e,s.schema),{selection:g,storedMarks:v}=s,{\$from:m,\$to:y}=g,w=m.blockRange(y),S=v||g.\$to.parentOffset&&g.\$from.marks();if(!w)return!1;const x=wp(k=>pg(k.type.name,d))(g);if(w.depth>=1&&x&&w.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(h);if(pg(x.node.type.name,d)&&p.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,p),!0)).command(()=>gu(i,p)).command(()=>yu(i,p)).run()}return!n||!S||!l?a().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>gu(i,p)).command(()=>yu(i,p)).run():a().command(()=>{const k=u().wrapInList(p,r),M=S.filter(T=>f.includes(T.type.name));return i.ensureMarks(M),k?!0:c.clearNodes()}).wrapInList(p,r).command(()=>gu(i,p)).command(()=>yu(i,p)).run()},E\$=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=lr(t,r.schema);return p\$(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},C\$=(t,e,n={})=>({state:r,commands:o})=>{const i=Be(t,r.schema),s=Be(e,r.schema);return vp(r,i,n)?o.setNode(s):o.setNode(i,n)},T\$=(t,e={})=>({state:n,commands:r})=>{const o=Be(t,n.schema);return vp(n,o,e)?r.lift(o):r.wrapIn(o,e)},O\$=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},N\$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.\$from.pos,i.\$to.pos)}),!0},b\$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=lr(t,r.schema),{\$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:p}=l;const h=(i=c.marks().find(v=>v.type===a))===null||i===void 0?void 0:i.attrs,g=Hv(c,a,h);g&&(f=g.from,p=g.to),n.removeMark(f,p,a)}else d.forEach(f=>{n.removeMark(f.\$from.pos,f.\$to.pos,a)});return n.removeStoredMark(a),!0},A\$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Uv(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=Be(t,r.schema)),l==="mark"&&(s=lr(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.\$from.pos,u=a.\$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{i&&i===d.type&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(p=>{if(s===p.type){const h=Math.max(f,c),g=Math.min(f+d.nodeSize,u);n.addMark(h,g,s.create({...p.attrs,...e}))}})})}),!0):!1},\$\$=(t,e={})=>({state:n,dispatch:r})=>{const o=Be(t,n.schema);return oA(o,e)(n,r)},I\$=(t,e={})=>({state:n,dispatch:r})=>{const o=Be(t,n.schema);return iA(o,e)(n,r)};var R\$=Object.freeze({__proto__:null,blur:vA,clearContent:wA,clearNodes:kA,command:SA,createParagraphNear:xA,cut:MA,deleteCurrentNode:EA,deleteNode:CA,deleteRange:TA,deleteSelection:OA,enter:NA,exitCode:bA,extendMarkRange:\$A,first:IA,focus:LA,forEach:PA,insertContent:DA,insertContentAt:FA,joinUp:jA,joinDown:HA,joinBackward:VA,joinForward:_A,joinItemBackward:WA,joinItemForward:UA,joinTextblockBackward:JA,joinTextblockForward:KA,keyboardShortcut:QA,lift:GA,liftEmptyBlock:YA,liftListItem:XA,newlineInCode:ZA,resetAttributes:e\$,scrollIntoView:t\$,selectAll:n\$,selectNodeBackward:r\$,selectNodeForward:o\$,selectParentNode:i\$,selectTextblockEnd:s\$,selectTextblockStart:l\$,setContent:c\$,setMark:m\$,setMeta:g\$,setNode:y\$,setNodeSelection:v\$,setTextSelection:w\$,sinkListItem:k\$,splitBlock:S\$,splitListItem:x\$,toggleList:M\$,toggleMark:E\$,toggleNode:C\$,toggleWrap:T\$,undoInputRule:O\$,unsetAllMarks:N\$,unsetMark:b\$,updateAttributes:A\$,wrapIn:\$\$,wrapInList:I\$});kn.create({name:"commands",addCommands(){return{...R\$}}});kn.create({name:"editable",addProseMirrorPlugins(){return[new pe({key:new we("editable"),props:{editable:()=>this.editor.options.editable}})]}});kn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new pe({key:new we("focusEvents"),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}}}})]}});kn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,\$anchor:d}=a,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=h.parent.type.spec.isolating,v=d.pos-d.parentOffset,m=g&&h.parent.childCount===1?v===d.pos:j.atStart(c).from===f;return!u||!p.type.isTextblock||p.textContent.length||!m||m&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...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 yp()||Wv()?i:o},addProseMirrorPlugins(){return[new pe({key:new we("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(h=>h.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:o,from:i,to:s}=e.selection,l=j.atStart(e.doc).from,a=j.atEnd(e.doc).to;if(o||!(i===l&&s===a)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const d=n.tr,f=jv({state:n,transaction:d}),{commands:p}=new dA({editor:this.editor,state:f});if(p.clearNodes(),!!d.steps.length)return d}})]}});kn.create({name:"tabindex",addProseMirrorPlugins(){return[new pe({key:new we("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Aa{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${this.name}".\`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ft(ht(this,"addOptions",{name:this.name}))),this.storage=Ft(ht(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Aa(e)}configure(e={}){const n=this.extend();return n.options=gp(this.options,e),n.storage=Ft(ht(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Aa({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(\`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "\${n.name}".\`),n.options=Ft(ht(n,"addOptions",{name:n.name})),n.storage=Ft(ht(n,"addStorage",{name:n.name,options:n.options})),n}}function L\$(t){return t.replace(/[-/\\^\$*+?.()|[\]{}]/g,"\\\$&")}const P\$=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},D\$=({renderers:t})=>K.createElement(K.Fragment,null,Object.entries(t).map(([e,n])=>Iy.createPortal(n.reactElement,n.element,e)));class z\$ extends K.Component{constructor(e){super(e),this.editorContentRef=K.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?Ka.flushSync(e):e()}setRenderer(e,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:n}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{const r={...n};return delete r[e],{renderers:r}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return K.createElement(K.Fragment,null,K.createElement("div",{ref:P\$(n,this.editorContentRef),...r}),K.createElement(D\$,{renderers:this.state.renderers}))}}const B\$=q.forwardRef((t,e)=>{const n=K.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return K.createElement(z\$,{key:n,innerRef:e,...t})}),F\$=K.memo(B\$);var vu={},wu={exports:{}},ku={};/**
 * @license React
 * use-sync-external-store-shim.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var mg;function j\$(){if(mg)return ku;mg=1;var t=K;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function l(d,f){var p=f(),h=r({inst:{value:p,getSnapshot:f}}),g=h[0].inst,v=h[1];return i(function(){g.value=p,g.getSnapshot=f,a(g)&&v({inst:g})},[d,p,f]),o(function(){return a(g)&&v({inst:g}),d(function(){a(g)&&v({inst:g})})},[d]),s(p),p}function a(d){var f=d.getSnapshot;d=d.value;try{var p=f();return!n(d,p)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return ku.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,ku}var gg;function H\$(){return gg||(gg=1,wu.exports=j\$()),wu.exports}/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var yg;function V\$(){if(yg)return vu;yg=1;var t=K,e=H\$();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,l=t.useMemo,a=t.useDebugValue;return vu.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var h=i(null);if(h.current===null){var g={hasValue:!1,value:null};h.current=g}else g=h.current;h=l(function(){function m(k){if(!y){if(y=!0,w=k,k=f(k),p!==void 0&&g.hasValue){var M=g.value;if(p(M,k))return S=M}return S=k}if(M=S,r(w,k))return M;var T=f(k);return p!==void 0&&p(M,T)?M:(w=k,S=T)}var y=!1,w,S,x=d===void 0?null:d;return[function(){return m(u())},x===null?void 0:function(){return m(x())}]},[u,d,f,p]);var v=o(c,h[0],h[1]);return s(function(){g.hasValue=!0,g.value=v},[v]),a(v),v},vu}V\$();const _\$=q.createContext({editor:null});_\$.Consumer;const W\$=q.createContext({onDragStart:void 0}),U\$=()=>q.useContext(W\$);K.forwardRef((t,e)=>{const{onDragStart:n}=U\$(),r=t.as||"div";return K.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function J\$(t){var e;const{char:n,allowSpaces:r,allowedPrefixes:o,startOfLine:i,\$position:s}=t,l=L\$(n),a=new RegExp(\`\\s\${l}\$\`),c=i?"^":"",u=r?new RegExp(\`\${c}\${l}.*?(?=\\s\${l}|\$)\`,"gm"):new RegExp(\`\${c}(?:^)?\${l}[^\\s\${l}]*\`,"gm"),d=((e=s.nodeBefore)===null||e===void 0?void 0:e.isText)&&s.nodeBefore.text;if(!d)return null;const f=s.pos-d.length,p=Array.from(d.matchAll(u)).pop();if(!p||p.input===void 0||p.index===void 0)return null;const h=p.input.slice(Math.max(0,p.index-1),p.index),g=new RegExp(\`^[\${o==null?void 0:o.join("")}\0]?\$\`).test(h);if(o!==null&&!g)return null;const v=f+p.index;let m=v+p[0].length;return r&&a.test(d.slice(m-1,m+1))&&(p[0]+=" ",m+=1),v<s.pos&&m>=s.pos?{range:{from:v,to:m},query:p[0].slice(n.length),text:p[0]}:null}const K\$=new we("suggestion");function q\$({pluginKey:t=K\$,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:o=[" "],startOfLine:i=!1,decorationTag:s="span",decorationClass:l="suggestion",command:a=()=>null,items:c=()=>[],render:u=()=>({}),allow:d=()=>!0,findSuggestionMatch:f=J\$}){let p;const h=u==null?void 0:u(),g=new pe({key:t,view(){return{update:async(v,m)=>{var y,w,S,x,k,M,T;const O=(y=this.key)===null||y===void 0?void 0:y.getState(m),R=(w=this.key)===null||w===void 0?void 0:w.getState(v.state),Z=O.active&&R.active&&O.range.from!==R.range.from,lt=!O.active&&R.active,St=O.active&&!R.active,ar=!lt&&!St&&O.query!==R.query,It=lt,at=ar||Z,Qe=St;if(!It&&!at&&!Qe)return;const b=Qe&&!It?O:R,B=v.dom.querySelector(\`[data-decoration-id="\${b.decorationId}"]\`);p={editor:e,range:b.range,query:b.query,text:b.text,items:[],command:F=>a({editor:e,range:b.range,props:F}),decorationNode:B,clientRect:B?()=>{var F;const{decorationId:te}=(F=this.key)===null||F===void 0?void 0:F.getState(e.state),ce=v.dom.querySelector(\`[data-decoration-id="\${te}"]\`);return(ce==null?void 0:ce.getBoundingClientRect())||null}:null},It&&((S=h==null?void 0:h.onBeforeStart)===null||S===void 0||S.call(h,p)),at&&((x=h==null?void 0:h.onBeforeUpdate)===null||x===void 0||x.call(h,p)),(at||It)&&(p.items=await c({editor:e,query:b.query})),Qe&&((k=h==null?void 0:h.onExit)===null||k===void 0||k.call(h,p)),at&&((M=h==null?void 0:h.onUpdate)===null||M===void 0||M.call(h,p)),It&&((T=h==null?void 0:h.onStart)===null||T===void 0||T.call(h,p))},destroy:()=>{var v;p&&((v=h==null?void 0:h.onExit)===null||v===void 0||v.call(h,p))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(v,m,y,w){const{isEditable:S}=e,{composing:x}=e.view,{selection:k}=v,{empty:M,from:T}=k,O={...m};if(O.composing=x,S&&(M||e.view.composing)){(T<m.range.from||T>m.range.to)&&!x&&!m.composing&&(O.active=!1);const R=f({char:n,allowSpaces:r,allowedPrefixes:o,startOfLine:i,\$position:k.\$from}),Z=\`id_\${Math.floor(Math.random()*4294967295)}\`;R&&d({editor:e,state:w,range:R.range,isActive:m.active})?(O.active=!0,O.decorationId=m.decorationId?m.decorationId:Z,O.range=R.range,O.query=R.query,O.text=R.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(v,m){var y;const{active:w,range:S}=g.getState(v.state);return w&&((y=h==null?void 0:h.onKeyDown)===null||y===void 0?void 0:y.call(h,{view:v,event:m,range:S}))||!1},decorations(v){const{active:m,range:y,decorationId:w}=g.getState(v);return m?oe.create(v.doc,[Ze.inline(y.from,y.to,{nodeName:s,class:l,"data-decoration-id":w})]):null}}});return g}const Q\$=new we("mention"),Jv=Aa.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return\`\${t.suggestion.char}\${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}\`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",fi(this.HTMLAttributes,t.HTMLAttributes),\`\${t.suggestion.char}\${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}\`]},suggestion:{char:"@",pluginKey:Q\$,command:({editor:t,range:e,props:n})=>{var r,o;const i=t.view.state.selection.\$to.nodeAfter;((r=i==null?void 0:i.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(o=window.getSelection())===null||o===void 0||o.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:\`span[data-type="\${this.name}"]\`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",fi({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=fi({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",fi({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,l)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[q\$({editor:this.editor,...this.options.suggestion})]}}),G\$=Jv.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),className:{default:null,parseHTML:e=>e.getAttribute("data-className"),renderHTML:e=>e.className?{"data-className":e.className}:{}}}}}).configure({HTMLAttributes:()=>({class:"mention"}),renderHTML({options:t,node:e}){const n=["mention",e.attrs.className??""];return["span",{contenteditable:!0},["span",fi({class:n.join(" "),contenteditable:!1},t.HTMLAttributes),\`\${t.suggestion.char}\${e.attrs.label??e.attrs.id}\`],["span",{},"\uFEFF"],["span",{},"​"]]},suggestion:{items:({query:t,editor:e})=>(e.extensionStorage.mentionQuery=t,[]),render:()=>({onExit:({editor:t})=>{t.extensionStorage.mentionQuery=void 0}})}}),Y\$=new ae({onBridgeMessage(t,e){var n,r;if(e.type==="InsertMention"){const{selection:o}=t.state,i=t.state.tr,s=t.view.dispatch,l=o.anchor;if(s){switch(t.state.doc.textBetween(o.from-1,o.from).at(-1)){case" ":i.insertText("@",l);break;case"@":i.delete(o.from-1,o.from);break;default:i.insertText(" @",l);break}s(i)}return!0}if(e.type==="SetMention"){const o=t.state,{from:i,to:s}=t.state.selection,l=o.doc.textBetween(0,i," "," "),a=l.lastIndexOf("@");if(a===-1)return!1;const c=i-(l.length-a),u=o.selection.\$to.nodeAfter,d=(n=u==null?void 0:u.text)==null?void 0:n.startsWith(" "),f={from:c,to:d?s+1:s};return d&&t.commands.insertContentAt(f," "),t.chain().focus().insertContentAt(f,[{type:Jv.name,attrs:e.payload},{type:"text",text:" "}]).run(),(r=window.getSelection())==null||r.collapseToEnd(),!0}return!1},extendEditorInstance(t,e,n,r){return{insertMention:()=>{t({type:"InsertMention",payload:void 0})},setMention:o=>{t({type:"SetMention",payload:o})}}},extendEditorState(t){return{mentionQuery:t.extensionStorage.mentionQuery}}}),X\$=()=>{const t=zO({bridges:[...Sb,Y\$],tiptapOptions:{extensions:[G\$]}});return Ag.jsx(F\$,{editor:t,className:window.dynamicHeight?"dynamic-height":void 0})},Z\$=()=>window.contentInjected;let vg;vg=setInterval(()=>{if(!Z\$())return;const t=document.getElementById("root");Ry(t).render(Ag.jsx(X\$,{})),clearInterval(vg)},1);
</script>
  </head>
  <style>
    body {
      margin: 0;
      padding: 0;
    }
    #root > div:nth-of-type(1) {
      position: absolute;
      height: 100%;
      overflow: auto;
      width: 100%;
      top: 0;
      bottom: 0;
    }
    #root > div.dynamic-height {
      height: unset;
    }
    #root div .ProseMirror {
      height: 100%;
      overflow: auto;
    }
    #root div.dynamic-height .ProseMirror {
      height: unset;
    }
    .ProseMirror:focus {
      outline: none;
    }
    .highlight-background {
      background-color: #e6e6ff;
    }
  </style>
  <body>
    <div id="root"></div>
  </body>
</html>

`.replace(/\\([`$])/g, '\$1')