regen.mde 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +295 -0
  3. package/bin/build-corpus-editor.js +81 -0
  4. package/bin/build-corpus.js +41 -0
  5. package/bin/postinstall.js +187 -0
  6. package/bin/regen-mdeditor-install.js +27 -0
  7. package/bin/regen-mdeditor-uninstall.js +19 -0
  8. package/bin/validate-katex.js +93 -0
  9. package/desktop/BuildCorpusEditor/BuildCorpusBridge.cs +270 -0
  10. package/desktop/BuildCorpusEditor/BuildCorpusEditor.csproj +22 -0
  11. package/desktop/BuildCorpusEditor/EditorForm.cs +540 -0
  12. package/desktop/BuildCorpusEditor/Program.cs +81 -0
  13. package/desktop/BuildCorpusEditor/app.manifest +16 -0
  14. package/dist/release/regen.mde-0.2.2-win-x64-setup.exe +0 -0
  15. package/dist/release/regen.mde-0.2.2-win-x64.zip +0 -0
  16. package/dist/windows-editor/BuildCorpusEditor.deps.json +83 -0
  17. package/dist/windows-editor/BuildCorpusEditor.dll +0 -0
  18. package/dist/windows-editor/BuildCorpusEditor.exe +0 -0
  19. package/dist/windows-editor/BuildCorpusEditor.pdb +0 -0
  20. package/dist/windows-editor/BuildCorpusEditor.runtimeconfig.json +19 -0
  21. package/dist/windows-editor/Microsoft.Web.WebView2.Core.dll +0 -0
  22. package/dist/windows-editor/Microsoft.Web.WebView2.Core.xml +6817 -0
  23. package/dist/windows-editor/Microsoft.Web.WebView2.WinForms.dll +0 -0
  24. package/dist/windows-editor/Microsoft.Web.WebView2.WinForms.xml +510 -0
  25. package/dist/windows-editor/Microsoft.Web.WebView2.Wpf.dll +0 -0
  26. package/dist/windows-editor/Microsoft.Web.WebView2.Wpf.xml +1902 -0
  27. package/dist/windows-editor/WebView2Loader.dll +0 -0
  28. package/dist/windows-editor/runtimes/win-x64/native/WebView2Loader.dll +0 -0
  29. package/dist/windows-editor/wwwroot/assets/index-DjJ6xmhy.js +326 -0
  30. package/dist/windows-editor/wwwroot/assets/index-_dwMNNsm.css +1 -0
  31. package/dist/windows-editor/wwwroot/index.html +22 -0
  32. package/editor-web/index.html +21 -0
  33. package/editor-web/src/main.jsx +399 -0
  34. package/editor-web/src/styles.css +602 -0
  35. package/editor-web/vite.config.js +13 -0
  36. package/examples/build-corpus.config.example.json +21 -0
  37. package/installer/install-regen-mde.ps1 +175 -0
  38. package/installer/regen-mde.nsi +81 -0
  39. package/package.json +86 -0
  40. package/pyproject.toml +33 -0
  41. package/requirements.txt +4 -0
  42. package/scripts/build-windows-editor.ps1 +47 -0
  43. package/scripts/package-windows-editor.ps1 +90 -0
  44. package/scripts/run-corpus.ps1 +28 -0
  45. package/scripts/run-editor-implementation-plane.ps1 +203 -0
  46. package/scripts/run-required-tests.ps1 +98 -0
  47. package/scripts/run-smoke.ps1 +28 -0
  48. package/src/build_corpus/__init__.py +3 -0
  49. package/src/build_corpus/docx_exporter.py +798 -0
  50. package/src/build_corpus/exporter.py +1195 -0
  51. package/src/build_corpus/ppt_exporter.py +532 -0
  52. package/src/build_corpus/templates/__init__.py +1 -0
  53. package/src/build_corpus/templates/md-to-word-template.dotx +0 -0
  54. package/src/build_corpus/validate_assets.py +46 -0
  55. package/tools/audit_corpus.py +203 -0
  56. package/tools/collect_microsoft_word_templates.py +228 -0
  57. package/tools/collect_online_docx_corpus.py +272 -0
  58. package/tools/collect_online_pptx_corpus.py +252 -0
  59. package/tools/compare_pptx_inputs_outputs.py +87 -0
  60. package/tools/roundtrip_docx_corpus.py +171 -0
@@ -0,0 +1,326 @@
1
+ var CM=Object.defineProperty;var MM=(t,e,n)=>e in t?CM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Pe=(t,e,n)=>MM(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function nx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Uh={exports:{}},bo={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var zv;function AM(){if(zv)return bo;zv=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,s,o){var a=null;if(o!==void 0&&(a=""+o),s.key!==void 0&&(a=""+s.key),"key"in s){o={};for(var u in s)u!=="key"&&(o[u]=s[u])}else o=s;return s=o.ref,{$$typeof:t,type:i,key:a,ref:s!==void 0?s:null,props:o}}return bo.Fragment=e,bo.jsx=n,bo.jsxs=n,bo}var Lv;function OM(){return Lv||(Lv=1,Uh.exports=AM()),Uh.exports}var j=OM(),jh={exports:{}},ge={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var _v;function NM(){if(_v)return ge;_v=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function v(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function E(O,K,Q){this.props=O,this.context=K,this.refs=k,this.updater=Q||S}E.prototype.isReactComponent={},E.prototype.setState=function(O,K){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,K,"setState")},E.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function N(){}N.prototype=E.prototype;function L(O,K,Q){this.props=O,this.context=K,this.refs=k,this.updater=Q||S}var V=L.prototype=new N;V.constructor=L,w(V,E.prototype),V.isPureReactComponent=!0;var I=Array.isArray;function C(){}var H={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function ie(O,K,Q){var ne=Q.ref;return{$$typeof:t,type:O,key:K,ref:ne!==void 0?ne:null,props:Q}}function te(O,K){return ie(O.type,K,O.props)}function ve(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function pe(O){var K={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(Q){return K[Q]})}var xe=/\/+/g;function de(O,K){return typeof O=="object"&&O!==null&&O.key!=null?pe(""+O.key):K.toString(36)}function se(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(C,C):(O.status="pending",O.then(function(K){O.status==="pending"&&(O.status="fulfilled",O.value=K)},function(K){O.status==="pending"&&(O.status="rejected",O.reason=K)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function B(O,K,Q,ne,me){var ke=typeof O;(ke==="undefined"||ke==="boolean")&&(O=null);var Re=!1;if(O===null)Re=!0;else switch(ke){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(O.$$typeof){case t:case e:Re=!0;break;case p:return Re=O._init,B(Re(O._payload),K,Q,ne,me)}}if(Re)return me=me(O),Re=ne===""?"."+de(O,0):ne,I(me)?(Q="",Re!=null&&(Q=Re.replace(xe,"$&/")+"/"),B(me,K,Q,"",function(Zt){return Zt})):me!=null&&(ve(me)&&(me=te(me,Q+(me.key==null||O&&O.key===me.key?"":(""+me.key).replace(xe,"$&/")+"/")+Re)),K.push(me)),1;Re=0;var J=ne===""?".":ne+":";if(I(O))for(var fe=0;fe<O.length;fe++)ne=O[fe],ke=J+de(ne,fe),Re+=B(ne,K,Q,ke,me);else if(fe=v(O),typeof fe=="function")for(O=fe.call(O),fe=0;!(ne=O.next()).done;)ne=ne.value,ke=J+de(ne,fe++),Re+=B(ne,K,Q,ke,me);else if(ke==="object"){if(typeof O.then=="function")return B(se(O),K,Q,ne,me);throw K=String(O),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Re}function Y(O,K,Q){if(O==null)return O;var ne=[],me=0;return B(O,ne,"","",function(ke){return K.call(Q,ke,me++)}),ne}function Z(O){if(O._status===-1){var K=O._result;K=K(),K.then(function(Q){(O._status===0||O._status===-1)&&(O._status=1,O._result=Q)},function(Q){(O._status===0||O._status===-1)&&(O._status=2,O._result=Q)}),O._status===-1&&(O._status=0,O._result=K)}if(O._status===1)return O._result.default;throw O._result}var ye=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},Oe={map:Y,forEach:function(O,K,Q){Y(O,function(){K.apply(this,arguments)},Q)},count:function(O){var K=0;return Y(O,function(){K++}),K},toArray:function(O){return Y(O,function(K){return K})||[]},only:function(O){if(!ve(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return ge.Activity=g,ge.Children=Oe,ge.Component=E,ge.Fragment=n,ge.Profiler=s,ge.PureComponent=L,ge.StrictMode=i,ge.Suspense=f,ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ge.__COMPILER_RUNTIME={__proto__:null,c:function(O){return H.H.useMemoCache(O)}},ge.cache=function(O){return function(){return O.apply(null,arguments)}},ge.cacheSignal=function(){return null},ge.cloneElement=function(O,K,Q){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var ne=w({},O.props),me=O.key;if(K!=null)for(ke in K.key!==void 0&&(me=""+K.key),K)!W.call(K,ke)||ke==="key"||ke==="__self"||ke==="__source"||ke==="ref"&&K.ref===void 0||(ne[ke]=K[ke]);var ke=arguments.length-2;if(ke===1)ne.children=Q;else if(1<ke){for(var Re=Array(ke),J=0;J<ke;J++)Re[J]=arguments[J+2];ne.children=Re}return ie(O.type,me,ne)},ge.createContext=function(O){return O={$$typeof:a,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:o,_context:O},O},ge.createElement=function(O,K,Q){var ne,me={},ke=null;if(K!=null)for(ne in K.key!==void 0&&(ke=""+K.key),K)W.call(K,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(me[ne]=K[ne]);var Re=arguments.length-2;if(Re===1)me.children=Q;else if(1<Re){for(var J=Array(Re),fe=0;fe<Re;fe++)J[fe]=arguments[fe+2];me.children=J}if(O&&O.defaultProps)for(ne in Re=O.defaultProps,Re)me[ne]===void 0&&(me[ne]=Re[ne]);return ie(O,ke,me)},ge.createRef=function(){return{current:null}},ge.forwardRef=function(O){return{$$typeof:u,render:O}},ge.isValidElement=ve,ge.lazy=function(O){return{$$typeof:p,_payload:{_status:-1,_result:O},_init:Z}},ge.memo=function(O,K){return{$$typeof:h,type:O,compare:K===void 0?null:K}},ge.startTransition=function(O){var K=H.T,Q={};H.T=Q;try{var ne=O(),me=H.S;me!==null&&me(Q,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(C,ye)}catch(ke){ye(ke)}finally{K!==null&&Q.types!==null&&(K.types=Q.types),H.T=K}},ge.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ge.use=function(O){return H.H.use(O)},ge.useActionState=function(O,K,Q){return H.H.useActionState(O,K,Q)},ge.useCallback=function(O,K){return H.H.useCallback(O,K)},ge.useContext=function(O){return H.H.useContext(O)},ge.useDebugValue=function(){},ge.useDeferredValue=function(O,K){return H.H.useDeferredValue(O,K)},ge.useEffect=function(O,K){return H.H.useEffect(O,K)},ge.useEffectEvent=function(O){return H.H.useEffectEvent(O)},ge.useId=function(){return H.H.useId()},ge.useImperativeHandle=function(O,K,Q){return H.H.useImperativeHandle(O,K,Q)},ge.useInsertionEffect=function(O,K){return H.H.useInsertionEffect(O,K)},ge.useLayoutEffect=function(O,K){return H.H.useLayoutEffect(O,K)},ge.useMemo=function(O,K){return H.H.useMemo(O,K)},ge.useOptimistic=function(O,K){return H.H.useOptimistic(O,K)},ge.useReducer=function(O,K,Q){return H.H.useReducer(O,K,Q)},ge.useRef=function(O){return H.H.useRef(O)},ge.useState=function(O){return H.H.useState(O)},ge.useSyncExternalStore=function(O,K,Q){return H.H.useSyncExternalStore(O,K,Q)},ge.useTransition=function(){return H.H.useTransition()},ge.version="19.2.6",ge}var Bv;function na(){return Bv||(Bv=1,jh.exports=NM()),jh.exports}var Ae=na();const Qe=nx(Ae);var Ih={exports:{}},vo={},Vh={exports:{}},$h={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Hv;function RM(){return Hv||(Hv=1,(function(t){function e(B,Y){var Z=B.length;B.push(Y);e:for(;0<Z;){var ye=Z-1>>>1,Oe=B[ye];if(0<s(Oe,Y))B[ye]=Y,B[Z]=Oe,Z=ye;else break e}}function n(B){return B.length===0?null:B[0]}function i(B){if(B.length===0)return null;var Y=B[0],Z=B.pop();if(Z!==Y){B[0]=Z;e:for(var ye=0,Oe=B.length,O=Oe>>>1;ye<O;){var K=2*(ye+1)-1,Q=B[K],ne=K+1,me=B[ne];if(0>s(Q,Z))ne<Oe&&0>s(me,Q)?(B[ye]=me,B[ne]=Z,ye=ne):(B[ye]=Q,B[K]=Z,ye=K);else if(ne<Oe&&0>s(me,Z))B[ye]=me,B[ne]=Z,ye=ne;else break e}}return Y}function s(B,Y){var Z=B.sortIndex-Y.sortIndex;return Z!==0?Z:B.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var a=Date,u=a.now();t.unstable_now=function(){return a.now()-u}}var f=[],h=[],p=1,g=null,b=3,v=!1,S=!1,w=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function V(B){for(var Y=n(h);Y!==null;){if(Y.callback===null)i(h);else if(Y.startTime<=B)i(h),Y.sortIndex=Y.expirationTime,e(f,Y);else break;Y=n(h)}}function I(B){if(w=!1,V(B),!S)if(n(f)!==null)S=!0,C||(C=!0,pe());else{var Y=n(h);Y!==null&&se(I,Y.startTime-B)}}var C=!1,H=-1,W=5,ie=-1;function te(){return k?!0:!(t.unstable_now()-ie<W)}function ve(){if(k=!1,C){var B=t.unstable_now();ie=B;var Y=!0;try{e:{S=!1,w&&(w=!1,N(H),H=-1),v=!0;var Z=b;try{t:{for(V(B),g=n(f);g!==null&&!(g.expirationTime>B&&te());){var ye=g.callback;if(typeof ye=="function"){g.callback=null,b=g.priorityLevel;var Oe=ye(g.expirationTime<=B);if(B=t.unstable_now(),typeof Oe=="function"){g.callback=Oe,V(B),Y=!0;break t}g===n(f)&&i(f),V(B)}else i(f);g=n(f)}if(g!==null)Y=!0;else{var O=n(h);O!==null&&se(I,O.startTime-B),Y=!1}}break e}finally{g=null,b=Z,v=!1}Y=void 0}}finally{Y?pe():C=!1}}}var pe;if(typeof L=="function")pe=function(){L(ve)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,de=xe.port2;xe.port1.onmessage=ve,pe=function(){de.postMessage(null)}}else pe=function(){E(ve,0)};function se(B,Y){H=E(function(){B(t.unstable_now())},Y)}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_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"):W=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(B){switch(b){case 1:case 2:case 3:var Y=3;break;default:Y=b}var Z=b;b=Y;try{return B()}finally{b=Z}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(B,Y){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=b;b=B;try{return Y()}finally{b=Z}},t.unstable_scheduleCallback=function(B,Y,Z){var ye=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?ye+Z:ye):Z=ye,B){case 1:var Oe=-1;break;case 2:Oe=250;break;case 5:Oe=1073741823;break;case 4:Oe=1e4;break;default:Oe=5e3}return Oe=Z+Oe,B={id:p++,callback:Y,priorityLevel:B,startTime:Z,expirationTime:Oe,sortIndex:-1},Z>ye?(B.sortIndex=Z,e(h,B),n(f)===null&&B===n(h)&&(w?(N(H),H=-1):w=!0,se(I,Z-ye))):(B.sortIndex=Oe,e(f,B),S||v||(S=!0,C||(C=!0,pe()))),B},t.unstable_shouldYield=te,t.unstable_wrapCallback=function(B){var Y=b;return function(){var Z=b;b=Y;try{return B.apply(this,arguments)}finally{b=Z}}}})($h)),$h}var Uv;function DM(){return Uv||(Uv=1,Vh.exports=RM()),Vh.exports}var qh={exports:{}},zt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var jv;function zM(){if(jv)return zt;jv=1;var t=na();function e(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(f,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:f,containerInfo:h,implementation:p}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,zt.createPortal=function(f,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return o(f,h,null,p)},zt.flushSync=function(f){var h=a.T,p=i.p;try{if(a.T=null,i.p=2,f)return f()}finally{a.T=h,i.p=p,i.d.f()}},zt.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(f,h))},zt.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},zt.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var p=h.as,g=u(p,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,v=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?i.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:v}):p==="script"&&i.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},zt.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=u(h.as,h.crossOrigin);i.d.M(f,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(f)},zt.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=u(p,h.crossOrigin);i.d.L(f,p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},zt.preloadModule=function(f,h){if(typeof f=="string")if(h){var p=u(h.as,h.crossOrigin);i.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(f)},zt.requestFormReset=function(f){i.d.r(f)},zt.unstable_batchedUpdates=function(f,h){return f(h)},zt.useFormState=function(f,h,p){return a.H.useFormState(f,h,p)},zt.useFormStatus=function(){return a.H.useHostTransitionStatus()},zt.version="19.2.6",zt}var Iv;function ix(){if(Iv)return qh.exports;Iv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),qh.exports=zM(),qh.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Vv;function LM(){if(Vv)return vo;Vv=1;var t=DM(),e=na(),n=ix();function i(r){var l="https://react.dev/errors/"+r;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var l=r,c=r;if(r.alternate)for(;l.return;)l=l.return;else{r=l;do l=r,(l.flags&4098)!==0&&(c=l.return),r=l.return;while(r)}return l.tag===3?c:null}function a(r){if(r.tag===13){var l=r.memoizedState;if(l===null&&(r=r.alternate,r!==null&&(l=r.memoizedState)),l!==null)return l.dehydrated}return null}function u(r){if(r.tag===31){var l=r.memoizedState;if(l===null&&(r=r.alternate,r!==null&&(l=r.memoizedState)),l!==null)return l.dehydrated}return null}function f(r){if(o(r)!==r)throw Error(i(188))}function h(r){var l=r.alternate;if(!l){if(l=o(r),l===null)throw Error(i(188));return l!==r?null:r}for(var c=r,d=l;;){var m=c.return;if(m===null)break;var y=m.alternate;if(y===null){if(d=m.return,d!==null){c=d;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===c)return f(m),r;if(y===d)return f(m),l;y=y.sibling}throw Error(i(188))}if(c.return!==d.return)c=m,d=y;else{for(var x=!1,T=m.child;T;){if(T===c){x=!0,c=m,d=y;break}if(T===d){x=!0,d=m,c=y;break}T=T.sibling}if(!x){for(T=y.child;T;){if(T===c){x=!0,c=y,d=m;break}if(T===d){x=!0,d=y,c=m;break}T=T.sibling}if(!x)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:l}function p(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(l=p(r),l!==null)return l;r=r.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),L=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),ve=Symbol.iterator;function pe(r){return r===null||typeof r!="object"?null:(r=ve&&r[ve]||r["@@iterator"],typeof r=="function"?r:null)}var xe=Symbol.for("react.client.reference");function de(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===xe?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case w:return"Fragment";case E:return"Profiler";case k:return"StrictMode";case I:return"Suspense";case C:return"SuspenseList";case ie:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case L:return r.displayName||"Context";case N:return(r._context.displayName||"Context")+".Consumer";case V:var l=r.render;return r=r.displayName,r||(r=l.displayName||l.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case H:return l=r.displayName||null,l!==null?l:de(r.type)||"Memo";case W:l=r._payload,r=r._init;try{return de(r(l))}catch{}}return null}var se=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},ye=[],Oe=-1;function O(r){return{current:r}}function K(r){0>Oe||(r.current=ye[Oe],ye[Oe]=null,Oe--)}function Q(r,l){Oe++,ye[Oe]=r.current,r.current=l}var ne=O(null),me=O(null),ke=O(null),Re=O(null);function J(r,l){switch(Q(ke,l),Q(me,r),Q(ne,null),l.nodeType){case 9:case 11:r=(r=l.documentElement)&&(r=r.namespaceURI)?nv(r):0;break;default:if(r=l.tagName,l=l.namespaceURI)l=nv(l),r=iv(l,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}K(ne),Q(ne,r)}function fe(){K(ne),K(me),K(ke)}function Zt(r){r.memoizedState!==null&&Q(Re,r);var l=ne.current,c=iv(l,r.type);l!==c&&(Q(me,r),Q(ne,c))}function ii(r){me.current===r&&(K(ne),K(me)),Re.current===r&&(K(Re),po._currentValue=Z)}var mn,ca;function Dr(r){if(mn===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);mn=l&&l[1]||"",ca=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+mn+r+ca}var xf=!1;function wf(r,l){if(!r||xf)return"";xf=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(l){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(U){var _=U}Reflect.construct(r,[],P)}else{try{P.call()}catch(U){_=U}r.call(P.prototype)}}else{try{throw Error()}catch(U){_=U}(P=r())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(U){if(U&&_&&typeof U.stack=="string")return[U.stack,_.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),x=y[0],T=y[1];if(x&&T){var M=x.split(`
44
+ `),z=T.split(`
45
+ `);for(m=d=0;d<M.length&&!M[d].includes("DetermineComponentFrameRoot");)d++;for(;m<z.length&&!z[m].includes("DetermineComponentFrameRoot");)m++;if(d===M.length||m===z.length)for(d=M.length-1,m=z.length-1;1<=d&&0<=m&&M[d]!==z[m];)m--;for(;1<=d&&0<=m;d--,m--)if(M[d]!==z[m]){if(d!==1||m!==1)do if(d--,m--,0>m||M[d]!==z[m]){var $=`
46
+ `+M[d].replace(" at new "," at ");return r.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",r.displayName)),$}while(1<=d&&0<=m);break}}}finally{xf=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?Dr(c):""}function iE(r,l){switch(r.tag){case 26:case 27:case 5:return Dr(r.type);case 16:return Dr("Lazy");case 13:return r.child!==l&&l!==null?Dr("Suspense Fallback"):Dr("Suspense");case 19:return Dr("SuspenseList");case 0:case 15:return wf(r.type,!1);case 11:return wf(r.type.render,!1);case 1:return wf(r.type,!0);case 31:return Dr("Activity");default:return""}}function zg(r){try{var l="",c=null;do l+=iE(r,c),c=r,r=r.return;while(r);return l}catch(d){return`
47
+ Error generating stack: `+d.message+`
48
+ `+d.stack}}var kf=Object.prototype.hasOwnProperty,Tf=t.unstable_scheduleCallback,Ef=t.unstable_cancelCallback,rE=t.unstable_shouldYield,sE=t.unstable_requestPaint,en=t.unstable_now,lE=t.unstable_getCurrentPriorityLevel,Lg=t.unstable_ImmediatePriority,_g=t.unstable_UserBlockingPriority,ua=t.unstable_NormalPriority,oE=t.unstable_LowPriority,Bg=t.unstable_IdlePriority,aE=t.log,cE=t.unstable_setDisableYieldValue,El=null,tn=null;function Ui(r){if(typeof aE=="function"&&cE(r),tn&&typeof tn.setStrictMode=="function")try{tn.setStrictMode(El,r)}catch{}}var nn=Math.clz32?Math.clz32:dE,uE=Math.log,fE=Math.LN2;function dE(r){return r>>>=0,r===0?32:31-(uE(r)/fE|0)|0}var fa=256,da=262144,ha=4194304;function zr(r){var l=r&42;if(l!==0)return l;switch(r&-r){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function pa(r,l,c){var d=r.pendingLanes;if(d===0)return 0;var m=0,y=r.suspendedLanes,x=r.pingedLanes;r=r.warmLanes;var T=d&134217727;return T!==0?(d=T&~y,d!==0?m=zr(d):(x&=T,x!==0?m=zr(x):c||(c=T&~r,c!==0&&(m=zr(c))))):(T=d&~y,T!==0?m=zr(T):x!==0?m=zr(x):c||(c=d&~r,c!==0&&(m=zr(c)))),m===0?0:l!==0&&l!==m&&(l&y)===0&&(y=m&-m,c=l&-l,y>=c||y===32&&(c&4194048)!==0)?l:m}function Cl(r,l){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&l)===0}function hE(r,l){switch(r){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32: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 l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Hg(){var r=ha;return ha<<=1,(ha&62914560)===0&&(ha=4194304),r}function Cf(r){for(var l=[],c=0;31>c;c++)l.push(r);return l}function Ml(r,l){r.pendingLanes|=l,l!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function pE(r,l,c,d,m,y){var x=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var T=r.entanglements,M=r.expirationTimes,z=r.hiddenUpdates;for(c=x&~c;0<c;){var $=31-nn(c),P=1<<$;T[$]=0,M[$]=-1;var _=z[$];if(_!==null)for(z[$]=null,$=0;$<_.length;$++){var U=_[$];U!==null&&(U.lane&=-536870913)}c&=~P}d!==0&&Ug(r,d,0),y!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=y&~(x&~l))}function Ug(r,l,c){r.pendingLanes|=l,r.suspendedLanes&=~l;var d=31-nn(l);r.entangledLanes|=l,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function jg(r,l){var c=r.entangledLanes|=l;for(r=r.entanglements;c;){var d=31-nn(c),m=1<<d;m&l|r[d]&l&&(r[d]|=l),c&=~m}}function Ig(r,l){var c=l&-l;return c=(c&42)!==0?1:Mf(c),(c&(r.suspendedLanes|l))!==0?0:c}function Mf(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Af(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Vg(){var r=Y.p;return r!==0?r:(r=window.event,r===void 0?32:Cv(r.type))}function $g(r,l){var c=Y.p;try{return Y.p=r,l()}finally{Y.p=c}}var ji=Math.random().toString(36).slice(2),Tt="__reactFiber$"+ji,Pt="__reactProps$"+ji,xs="__reactContainer$"+ji,Of="__reactEvents$"+ji,mE="__reactListeners$"+ji,gE="__reactHandles$"+ji,qg="__reactResources$"+ji,Al="__reactMarker$"+ji;function Nf(r){delete r[Tt],delete r[Pt],delete r[Of],delete r[mE],delete r[gE]}function ws(r){var l=r[Tt];if(l)return l;for(var c=r.parentNode;c;){if(l=c[xs]||c[Tt]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(r=uv(r);r!==null;){if(c=r[Tt])return c;r=uv(r)}return l}r=c,c=r.parentNode}return null}function ks(r){if(r=r[Tt]||r[xs]){var l=r.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return r}return null}function Ol(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r.stateNode;throw Error(i(33))}function Ts(r){var l=r[qg];return l||(l=r[qg]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function bt(r){r[Al]=!0}var Pg=new Set,Kg={};function Lr(r,l){Es(r,l),Es(r+"Capture",l)}function Es(r,l){for(Kg[r]=l,r=0;r<l.length;r++)Pg.add(l[r])}var yE=RegExp("^[: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]*$"),Gg={},Yg={};function bE(r){return kf.call(Yg,r)?!0:kf.call(Gg,r)?!1:yE.test(r)?Yg[r]=!0:(Gg[r]=!0,!1)}function ma(r,l,c){if(bE(l))if(c===null)r.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(l);return;case"boolean":var d=l.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(l);return}}r.setAttribute(l,""+c)}}function ga(r,l,c){if(c===null)r.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(l);return}r.setAttribute(l,""+c)}}function ri(r,l,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(l,c,""+d)}}function gn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Xg(r){var l=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function vE(r,l,c){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,l);if(!r.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,y=d.set;return Object.defineProperty(r,l,{configurable:!0,get:function(){return m.call(this)},set:function(x){c=""+x,y.call(this,x)}}),Object.defineProperty(r,l,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(x){c=""+x},stopTracking:function(){r._valueTracker=null,delete r[l]}}}}function Rf(r){if(!r._valueTracker){var l=Xg(r)?"checked":"value";r._valueTracker=vE(r,l,""+r[l])}}function Fg(r){if(!r)return!1;var l=r._valueTracker;if(!l)return!0;var c=l.getValue(),d="";return r&&(d=Xg(r)?r.checked?"true":"false":r.value),r=d,r!==c?(l.setValue(r),!0):!1}function ya(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var SE=/[\n"\\]/g;function yn(r){return r.replace(SE,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Df(r,l,c,d,m,y,x,T){r.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?r.type=x:r.removeAttribute("type"),l!=null?x==="number"?(l===0&&r.value===""||r.value!=l)&&(r.value=""+gn(l)):r.value!==""+gn(l)&&(r.value=""+gn(l)):x!=="submit"&&x!=="reset"||r.removeAttribute("value"),l!=null?zf(r,x,gn(l)):c!=null?zf(r,x,gn(c)):d!=null&&r.removeAttribute("value"),m==null&&y!=null&&(r.defaultChecked=!!y),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?r.name=""+gn(T):r.removeAttribute("name")}function Wg(r,l,c,d,m,y,x,T){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),l!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||l!=null)){Rf(r);return}c=c!=null?""+gn(c):"",l=l!=null?""+gn(l):c,T||l===r.value||(r.value=l),r.defaultValue=l}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=T?r.checked:!!d,r.defaultChecked=!!d,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.name=x),Rf(r)}function zf(r,l,c){l==="number"&&ya(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Cs(r,l,c,d){if(r=r.options,l){l={};for(var m=0;m<c.length;m++)l["$"+c[m]]=!0;for(c=0;c<r.length;c++)m=l.hasOwnProperty("$"+r[c].value),r[c].selected!==m&&(r[c].selected=m),m&&d&&(r[c].defaultSelected=!0)}else{for(c=""+gn(c),l=null,m=0;m<r.length;m++){if(r[m].value===c){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}l!==null||r[m].disabled||(l=r[m])}l!==null&&(l.selected=!0)}}function Qg(r,l,c){if(l!=null&&(l=""+gn(l),l!==r.value&&(r.value=l),c==null)){r.defaultValue!==l&&(r.defaultValue=l);return}r.defaultValue=c!=null?""+gn(c):""}function Jg(r,l,c,d){if(l==null){if(d!=null){if(c!=null)throw Error(i(92));if(se(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),l=c}c=gn(l),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),Rf(r)}function Ms(r,l){if(l){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=l;return}}r.textContent=l}var xE=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Zg(r,l,c){var d=l.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(l,""):l==="float"?r.cssFloat="":r[l]="":d?r.setProperty(l,c):typeof c!="number"||c===0||xE.has(l)?l==="float"?r.cssFloat=c:r[l]=(""+c).trim():r[l]=c+"px"}function ey(r,l,c){if(l!=null&&typeof l!="object")throw Error(i(62));if(r=r.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||l!=null&&l.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in l)d=l[m],l.hasOwnProperty(m)&&c[m]!==d&&Zg(r,m,d)}else for(var y in l)l.hasOwnProperty(y)&&Zg(r,y,l[y])}function Lf(r){if(r.indexOf("-")===-1)return!1;switch(r){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 wE=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),kE=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ba(r){return kE.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function si(){}var _f=null;function Bf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var As=null,Os=null;function ty(r){var l=ks(r);if(l&&(r=l.stateNode)){var c=r[Pt]||null;e:switch(r=l.stateNode,l.type){case"input":if(Df(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),l=c.name,c.type==="radio"&&l!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+yn(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var d=c[l];if(d!==r&&d.form===r.form){var m=d[Pt]||null;if(!m)throw Error(i(90));Df(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<c.length;l++)d=c[l],d.form===r.form&&Fg(d)}break e;case"textarea":Qg(r,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&Cs(r,!!c.multiple,l,!1)}}}var Hf=!1;function ny(r,l,c){if(Hf)return r(l,c);Hf=!0;try{var d=r(l);return d}finally{if(Hf=!1,(As!==null||Os!==null)&&(sc(),As&&(l=As,r=Os,Os=As=null,ty(l),r)))for(l=0;l<r.length;l++)ty(r[l])}}function Nl(r,l){var c=r.stateNode;if(c===null)return null;var d=c[Pt]||null;if(d===null)return null;c=d[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(i(231,l,typeof c));return c}var li=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uf=!1;if(li)try{var Rl={};Object.defineProperty(Rl,"passive",{get:function(){Uf=!0}}),window.addEventListener("test",Rl,Rl),window.removeEventListener("test",Rl,Rl)}catch{Uf=!1}var Ii=null,jf=null,va=null;function iy(){if(va)return va;var r,l=jf,c=l.length,d,m="value"in Ii?Ii.value:Ii.textContent,y=m.length;for(r=0;r<c&&l[r]===m[r];r++);var x=c-r;for(d=1;d<=x&&l[c-d]===m[y-d];d++);return va=m.slice(r,1<d?1-d:void 0)}function Sa(r){var l=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&l===13&&(r=13)):r=l,r===10&&(r=13),32<=r||r===13?r:0}function xa(){return!0}function ry(){return!1}function Kt(r){function l(c,d,m,y,x){this._reactName=c,this._targetInst=m,this.type=d,this.nativeEvent=y,this.target=x,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(c=r[T],this[T]=c?c(y):y[T]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?xa:ry,this.isPropagationStopped=ry,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=xa)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=xa)},persist:function(){},isPersistent:xa}),l}var _r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wa=Kt(_r),Dl=g({},_r,{view:0,detail:0}),TE=Kt(Dl),If,Vf,zl,ka=g({},Dl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==zl&&(zl&&r.type==="mousemove"?(If=r.screenX-zl.screenX,Vf=r.screenY-zl.screenY):Vf=If=0,zl=r),If)},movementY:function(r){return"movementY"in r?r.movementY:Vf}}),sy=Kt(ka),EE=g({},ka,{dataTransfer:0}),CE=Kt(EE),ME=g({},Dl,{relatedTarget:0}),$f=Kt(ME),AE=g({},_r,{animationName:0,elapsedTime:0,pseudoElement:0}),OE=Kt(AE),NE=g({},_r,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),RE=Kt(NE),DE=g({},_r,{data:0}),ly=Kt(DE),zE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},LE={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"},_E={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function BE(r){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(r):(r=_E[r])?!!l[r]:!1}function qf(){return BE}var HE=g({},Dl,{key:function(r){if(r.key){var l=zE[r.key]||r.key;if(l!=="Unidentified")return l}return r.type==="keypress"?(r=Sa(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?LE[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qf,charCode:function(r){return r.type==="keypress"?Sa(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Sa(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),UE=Kt(HE),jE=g({},ka,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),oy=Kt(jE),IE=g({},Dl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qf}),VE=Kt(IE),$E=g({},_r,{propertyName:0,elapsedTime:0,pseudoElement:0}),qE=Kt($E),PE=g({},ka,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),KE=Kt(PE),GE=g({},_r,{newState:0,oldState:0}),YE=Kt(GE),XE=[9,13,27,32],Pf=li&&"CompositionEvent"in window,Ll=null;li&&"documentMode"in document&&(Ll=document.documentMode);var FE=li&&"TextEvent"in window&&!Ll,ay=li&&(!Pf||Ll&&8<Ll&&11>=Ll),cy=" ",uy=!1;function fy(r,l){switch(r){case"keyup":return XE.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dy(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ns=!1;function WE(r,l){switch(r){case"compositionend":return dy(l);case"keypress":return l.which!==32?null:(uy=!0,cy);case"textInput":return r=l.data,r===cy&&uy?null:r;default:return null}}function QE(r,l){if(Ns)return r==="compositionend"||!Pf&&fy(r,l)?(r=iy(),va=jf=Ii=null,Ns=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return ay&&l.locale!=="ko"?null:l.data;default:return null}}var JE={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 hy(r){var l=r&&r.nodeName&&r.nodeName.toLowerCase();return l==="input"?!!JE[r.type]:l==="textarea"}function py(r,l,c,d){As?Os?Os.push(d):Os=[d]:As=d,l=dc(l,"onChange"),0<l.length&&(c=new wa("onChange","change",null,c,d),r.push({event:c,listeners:l}))}var _l=null,Bl=null;function ZE(r){Wb(r,0)}function Ta(r){var l=Ol(r);if(Fg(l))return r}function my(r,l){if(r==="change")return l}var gy=!1;if(li){var Kf;if(li){var Gf="oninput"in document;if(!Gf){var yy=document.createElement("div");yy.setAttribute("oninput","return;"),Gf=typeof yy.oninput=="function"}Kf=Gf}else Kf=!1;gy=Kf&&(!document.documentMode||9<document.documentMode)}function by(){_l&&(_l.detachEvent("onpropertychange",vy),Bl=_l=null)}function vy(r){if(r.propertyName==="value"&&Ta(Bl)){var l=[];py(l,Bl,r,Bf(r)),ny(ZE,l)}}function eC(r,l,c){r==="focusin"?(by(),_l=l,Bl=c,_l.attachEvent("onpropertychange",vy)):r==="focusout"&&by()}function tC(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Ta(Bl)}function nC(r,l){if(r==="click")return Ta(l)}function iC(r,l){if(r==="input"||r==="change")return Ta(l)}function rC(r,l){return r===l&&(r!==0||1/r===1/l)||r!==r&&l!==l}var rn=typeof Object.is=="function"?Object.is:rC;function Hl(r,l){if(rn(r,l))return!0;if(typeof r!="object"||r===null||typeof l!="object"||l===null)return!1;var c=Object.keys(r),d=Object.keys(l);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var m=c[d];if(!kf.call(l,m)||!rn(r[m],l[m]))return!1}return!0}function Sy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function xy(r,l){var c=Sy(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=l&&d>=l)return{node:c,offset:l-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Sy(c)}}function wy(r,l){return r&&l?r===l?!0:r&&r.nodeType===3?!1:l&&l.nodeType===3?wy(r,l.parentNode):"contains"in r?r.contains(l):r.compareDocumentPosition?!!(r.compareDocumentPosition(l)&16):!1:!1}function ky(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var l=ya(r.document);l instanceof r.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)r=l.contentWindow;else break;l=ya(r.document)}return l}function Yf(r){var l=r&&r.nodeName&&r.nodeName.toLowerCase();return l&&(l==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||l==="textarea"||r.contentEditable==="true")}var sC=li&&"documentMode"in document&&11>=document.documentMode,Rs=null,Xf=null,Ul=null,Ff=!1;function Ty(r,l,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ff||Rs==null||Rs!==ya(d)||(d=Rs,"selectionStart"in d&&Yf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Ul&&Hl(Ul,d)||(Ul=d,d=dc(Xf,"onSelect"),0<d.length&&(l=new wa("onSelect","select",null,l,c),r.push({event:l,listeners:d}),l.target=Rs)))}function Br(r,l){var c={};return c[r.toLowerCase()]=l.toLowerCase(),c["Webkit"+r]="webkit"+l,c["Moz"+r]="moz"+l,c}var Ds={animationend:Br("Animation","AnimationEnd"),animationiteration:Br("Animation","AnimationIteration"),animationstart:Br("Animation","AnimationStart"),transitionrun:Br("Transition","TransitionRun"),transitionstart:Br("Transition","TransitionStart"),transitioncancel:Br("Transition","TransitionCancel"),transitionend:Br("Transition","TransitionEnd")},Wf={},Ey={};li&&(Ey=document.createElement("div").style,"AnimationEvent"in window||(delete Ds.animationend.animation,delete Ds.animationiteration.animation,delete Ds.animationstart.animation),"TransitionEvent"in window||delete Ds.transitionend.transition);function Hr(r){if(Wf[r])return Wf[r];if(!Ds[r])return r;var l=Ds[r],c;for(c in l)if(l.hasOwnProperty(c)&&c in Ey)return Wf[r]=l[c];return r}var Cy=Hr("animationend"),My=Hr("animationiteration"),Ay=Hr("animationstart"),lC=Hr("transitionrun"),oC=Hr("transitionstart"),aC=Hr("transitioncancel"),Oy=Hr("transitionend"),Ny=new Map,Qf="abort auxClick beforeToggle 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(" ");Qf.push("scrollEnd");function zn(r,l){Ny.set(r,l),Lr(l,[r])}var Ea=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},bn=[],zs=0,Jf=0;function Ca(){for(var r=zs,l=Jf=zs=0;l<r;){var c=bn[l];bn[l++]=null;var d=bn[l];bn[l++]=null;var m=bn[l];bn[l++]=null;var y=bn[l];if(bn[l++]=null,d!==null&&m!==null){var x=d.pending;x===null?m.next=m:(m.next=x.next,x.next=m),d.pending=m}y!==0&&Ry(c,m,y)}}function Ma(r,l,c,d){bn[zs++]=r,bn[zs++]=l,bn[zs++]=c,bn[zs++]=d,Jf|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Zf(r,l,c,d){return Ma(r,l,c,d),Aa(r)}function Ur(r,l){return Ma(r,null,null,l),Aa(r)}function Ry(r,l,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var m=!1,y=r.return;y!==null;)y.childLanes|=c,d=y.alternate,d!==null&&(d.childLanes|=c),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(m=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,m&&l!==null&&(m=31-nn(c),r=y.hiddenUpdates,d=r[m],d===null?r[m]=[l]:d.push(l),l.lane=c|536870912),y):null}function Aa(r){if(50<lo)throw lo=0,ah=null,Error(i(185));for(var l=r.return;l!==null;)r=l,l=r.return;return r.tag===3?r.stateNode:null}var Ls={};function cC(r,l,c,d){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(r,l,c,d){return new cC(r,l,c,d)}function ed(r){return r=r.prototype,!(!r||!r.isReactComponent)}function oi(r,l){var c=r.alternate;return c===null?(c=sn(r.tag,l,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=l,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,l=r.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function Dy(r,l){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=l,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,l=c.dependencies,r.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),r}function Oa(r,l,c,d,m,y){var x=0;if(d=r,typeof r=="function")ed(r)&&(x=1);else if(typeof r=="string")x=pM(r,c,ne.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case ie:return r=sn(31,c,l,m),r.elementType=ie,r.lanes=y,r;case w:return jr(c.children,m,y,l);case k:x=8,m|=24;break;case E:return r=sn(12,c,l,m|2),r.elementType=E,r.lanes=y,r;case I:return r=sn(13,c,l,m),r.elementType=I,r.lanes=y,r;case C:return r=sn(19,c,l,m),r.elementType=C,r.lanes=y,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case L:x=10;break e;case N:x=9;break e;case V:x=11;break e;case H:x=14;break e;case W:x=16,d=null;break e}x=29,c=Error(i(130,r===null?"null":typeof r,"")),d=null}return l=sn(x,c,l,m),l.elementType=r,l.type=d,l.lanes=y,l}function jr(r,l,c,d){return r=sn(7,r,d,l),r.lanes=c,r}function td(r,l,c){return r=sn(6,r,null,l),r.lanes=c,r}function zy(r){var l=sn(18,null,null,0);return l.stateNode=r,l}function nd(r,l,c){return l=sn(4,r.children!==null?r.children:[],r.key,l),l.lanes=c,l.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},l}var Ly=new WeakMap;function vn(r,l){if(typeof r=="object"&&r!==null){var c=Ly.get(r);return c!==void 0?c:(l={value:r,source:l,stack:zg(l)},Ly.set(r,l),l)}return{value:r,source:l,stack:zg(l)}}var _s=[],Bs=0,Na=null,jl=0,Sn=[],xn=0,Vi=null,$n=1,qn="";function ai(r,l){_s[Bs++]=jl,_s[Bs++]=Na,Na=r,jl=l}function _y(r,l,c){Sn[xn++]=$n,Sn[xn++]=qn,Sn[xn++]=Vi,Vi=r;var d=$n;r=qn;var m=32-nn(d)-1;d&=~(1<<m),c+=1;var y=32-nn(l)+m;if(30<y){var x=m-m%5;y=(d&(1<<x)-1).toString(32),d>>=x,m-=x,$n=1<<32-nn(l)+m|c<<m|d,qn=y+r}else $n=1<<y|c<<m|d,qn=r}function id(r){r.return!==null&&(ai(r,1),_y(r,1,0))}function rd(r){for(;r===Na;)Na=_s[--Bs],_s[Bs]=null,jl=_s[--Bs],_s[Bs]=null;for(;r===Vi;)Vi=Sn[--xn],Sn[xn]=null,qn=Sn[--xn],Sn[xn]=null,$n=Sn[--xn],Sn[xn]=null}function By(r,l){Sn[xn++]=$n,Sn[xn++]=qn,Sn[xn++]=Vi,$n=l.id,qn=l.overflow,Vi=r}var Et=null,Fe=null,Ne=!1,$i=null,wn=!1,sd=Error(i(519));function qi(r){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Il(vn(l,r)),sd}function Hy(r){var l=r.stateNode,c=r.type,d=r.memoizedProps;switch(l[Tt]=r,l[Pt]=d,c){case"dialog":Ee("cancel",l),Ee("close",l);break;case"iframe":case"object":case"embed":Ee("load",l);break;case"video":case"audio":for(c=0;c<ao.length;c++)Ee(ao[c],l);break;case"source":Ee("error",l);break;case"img":case"image":case"link":Ee("error",l),Ee("load",l);break;case"details":Ee("toggle",l);break;case"input":Ee("invalid",l),Wg(l,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Ee("invalid",l);break;case"textarea":Ee("invalid",l),Jg(l,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||l.textContent===""+c||d.suppressHydrationWarning===!0||ev(l.textContent,c)?(d.popover!=null&&(Ee("beforetoggle",l),Ee("toggle",l)),d.onScroll!=null&&Ee("scroll",l),d.onScrollEnd!=null&&Ee("scrollend",l),d.onClick!=null&&(l.onclick=si),l=!0):l=!1,l||qi(r,!0)}function Uy(r){for(Et=r.return;Et;)switch(Et.tag){case 5:case 31:case 13:wn=!1;return;case 27:case 3:wn=!0;return;default:Et=Et.return}}function Hs(r){if(r!==Et)return!1;if(!Ne)return Uy(r),Ne=!0,!1;var l=r.tag,c;if((c=l!==3&&l!==27)&&((c=l===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||kh(r.type,r.memoizedProps)),c=!c),c&&Fe&&qi(r),Uy(r),l===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Fe=cv(r)}else if(l===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Fe=cv(r)}else l===27?(l=Fe,ir(r.type)?(r=Ah,Ah=null,Fe=r):Fe=l):Fe=Et?Tn(r.stateNode.nextSibling):null;return!0}function Ir(){Fe=Et=null,Ne=!1}function ld(){var r=$i;return r!==null&&(Ft===null?Ft=r:Ft.push.apply(Ft,r),$i=null),r}function Il(r){$i===null?$i=[r]:$i.push(r)}var od=O(null),Vr=null,ci=null;function Pi(r,l,c){Q(od,l._currentValue),l._currentValue=c}function ui(r){r._currentValue=od.current,K(od)}function ad(r,l,c){for(;r!==null;){var d=r.alternate;if((r.childLanes&l)!==l?(r.childLanes|=l,d!==null&&(d.childLanes|=l)):d!==null&&(d.childLanes&l)!==l&&(d.childLanes|=l),r===c)break;r=r.return}}function cd(r,l,c,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var y=m.dependencies;if(y!==null){var x=m.child;y=y.firstContext;e:for(;y!==null;){var T=y;y=m;for(var M=0;M<l.length;M++)if(T.context===l[M]){y.lanes|=c,T=y.alternate,T!==null&&(T.lanes|=c),ad(y.return,c,r),d||(x=null);break e}y=T.next}}else if(m.tag===18){if(x=m.return,x===null)throw Error(i(341));x.lanes|=c,y=x.alternate,y!==null&&(y.lanes|=c),ad(x,c,r),x=null}else x=m.child;if(x!==null)x.return=m;else for(x=m;x!==null;){if(x===r){x=null;break}if(m=x.sibling,m!==null){m.return=x.return,x=m;break}x=x.return}m=x}}function Us(r,l,c,d){r=null;for(var m=l,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var x=m.alternate;if(x===null)throw Error(i(387));if(x=x.memoizedProps,x!==null){var T=m.type;rn(m.pendingProps.value,x.value)||(r!==null?r.push(T):r=[T])}}else if(m===Re.current){if(x=m.alternate,x===null)throw Error(i(387));x.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(po):r=[po])}m=m.return}r!==null&&cd(l,r,c,d),l.flags|=262144}function Ra(r){for(r=r.firstContext;r!==null;){if(!rn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function $r(r){Vr=r,ci=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Ct(r){return jy(Vr,r)}function Da(r,l){return Vr===null&&$r(r),jy(r,l)}function jy(r,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},ci===null){if(r===null)throw Error(i(308));ci=l,r.dependencies={lanes:0,firstContext:l},r.flags|=524288}else ci=ci.next=l;return c}var uC=typeof AbortController<"u"?AbortController:function(){var r=[],l=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){l.aborted=!0,r.forEach(function(c){return c()})}},fC=t.unstable_scheduleCallback,dC=t.unstable_NormalPriority,ut={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ud(){return{controller:new uC,data:new Map,refCount:0}}function Vl(r){r.refCount--,r.refCount===0&&fC(dC,function(){r.controller.abort()})}var $l=null,fd=0,js=0,Is=null;function hC(r,l){if($l===null){var c=$l=[];fd=0,js=ph(),Is={status:"pending",value:void 0,then:function(d){c.push(d)}}}return fd++,l.then(Iy,Iy),l}function Iy(){if(--fd===0&&$l!==null){Is!==null&&(Is.status="fulfilled");var r=$l;$l=null,js=0,Is=null;for(var l=0;l<r.length;l++)(0,r[l])()}}function pC(r,l){var c=[],d={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return r.then(function(){d.status="fulfilled",d.value=l;for(var m=0;m<c.length;m++)(0,c[m])(l)},function(m){for(d.status="rejected",d.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),d}var Vy=B.S;B.S=function(r,l){Tb=en(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&hC(r,l),Vy!==null&&Vy(r,l)};var qr=O(null);function dd(){var r=qr.current;return r!==null?r:qe.pooledCache}function za(r,l){l===null?Q(qr,qr.current):Q(qr,l.pool)}function $y(){var r=dd();return r===null?null:{parent:ut._currentValue,pool:r}}var Vs=Error(i(460)),hd=Error(i(474)),La=Error(i(542)),_a={then:function(){}};function qy(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Py(r,l,c){switch(c=r[c],c===void 0?r.push(l):c!==l&&(l.then(si,si),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Gy(r),r;default:if(typeof l.status=="string")l.then(si,si);else{if(r=qe,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=l,r.status="pending",r.then(function(d){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=d}},function(d){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=d}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Gy(r),r}throw Kr=l,Vs}}function Pr(r){try{var l=r._init;return l(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Kr=c,Vs):c}}var Kr=null;function Ky(){if(Kr===null)throw Error(i(459));var r=Kr;return Kr=null,r}function Gy(r){if(r===Vs||r===La)throw Error(i(483))}var $s=null,ql=0;function Ba(r){var l=ql;return ql+=1,$s===null&&($s=[]),Py($s,r,l)}function Pl(r,l){l=l.props.ref,r.ref=l!==void 0?l:null}function Ha(r,l){throw l.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(l),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":r)))}function Yy(r){function l(R,A){if(r){var D=R.deletions;D===null?(R.deletions=[A],R.flags|=16):D.push(A)}}function c(R,A){if(!r)return null;for(;A!==null;)l(R,A),A=A.sibling;return null}function d(R){for(var A=new Map;R!==null;)R.key!==null?A.set(R.key,R):A.set(R.index,R),R=R.sibling;return A}function m(R,A){return R=oi(R,A),R.index=0,R.sibling=null,R}function y(R,A,D){return R.index=D,r?(D=R.alternate,D!==null?(D=D.index,D<A?(R.flags|=67108866,A):D):(R.flags|=67108866,A)):(R.flags|=1048576,A)}function x(R){return r&&R.alternate===null&&(R.flags|=67108866),R}function T(R,A,D,q){return A===null||A.tag!==6?(A=td(D,R.mode,q),A.return=R,A):(A=m(A,D),A.return=R,A)}function M(R,A,D,q){var ae=D.type;return ae===w?$(R,A,D.props.children,q,D.key):A!==null&&(A.elementType===ae||typeof ae=="object"&&ae!==null&&ae.$$typeof===W&&Pr(ae)===A.type)?(A=m(A,D.props),Pl(A,D),A.return=R,A):(A=Oa(D.type,D.key,D.props,null,R.mode,q),Pl(A,D),A.return=R,A)}function z(R,A,D,q){return A===null||A.tag!==4||A.stateNode.containerInfo!==D.containerInfo||A.stateNode.implementation!==D.implementation?(A=nd(D,R.mode,q),A.return=R,A):(A=m(A,D.children||[]),A.return=R,A)}function $(R,A,D,q,ae){return A===null||A.tag!==7?(A=jr(D,R.mode,q,ae),A.return=R,A):(A=m(A,D),A.return=R,A)}function P(R,A,D){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=td(""+A,R.mode,D),A.return=R,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case v:return D=Oa(A.type,A.key,A.props,null,R.mode,D),Pl(D,A),D.return=R,D;case S:return A=nd(A,R.mode,D),A.return=R,A;case W:return A=Pr(A),P(R,A,D)}if(se(A)||pe(A))return A=jr(A,R.mode,D,null),A.return=R,A;if(typeof A.then=="function")return P(R,Ba(A),D);if(A.$$typeof===L)return P(R,Da(R,A),D);Ha(R,A)}return null}function _(R,A,D,q){var ae=A!==null?A.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ae!==null?null:T(R,A,""+D,q);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case v:return D.key===ae?M(R,A,D,q):null;case S:return D.key===ae?z(R,A,D,q):null;case W:return D=Pr(D),_(R,A,D,q)}if(se(D)||pe(D))return ae!==null?null:$(R,A,D,q,null);if(typeof D.then=="function")return _(R,A,Ba(D),q);if(D.$$typeof===L)return _(R,A,Da(R,D),q);Ha(R,D)}return null}function U(R,A,D,q,ae){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return R=R.get(D)||null,T(A,R,""+q,ae);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return R=R.get(q.key===null?D:q.key)||null,M(A,R,q,ae);case S:return R=R.get(q.key===null?D:q.key)||null,z(A,R,q,ae);case W:return q=Pr(q),U(R,A,D,q,ae)}if(se(q)||pe(q))return R=R.get(D)||null,$(A,R,q,ae,null);if(typeof q.then=="function")return U(R,A,D,Ba(q),ae);if(q.$$typeof===L)return U(R,A,D,Da(A,q),ae);Ha(A,q)}return null}function ee(R,A,D,q){for(var ae=null,De=null,re=A,Se=A=0,Me=null;re!==null&&Se<D.length;Se++){re.index>Se?(Me=re,re=null):Me=re.sibling;var ze=_(R,re,D[Se],q);if(ze===null){re===null&&(re=Me);break}r&&re&&ze.alternate===null&&l(R,re),A=y(ze,A,Se),De===null?ae=ze:De.sibling=ze,De=ze,re=Me}if(Se===D.length)return c(R,re),Ne&&ai(R,Se),ae;if(re===null){for(;Se<D.length;Se++)re=P(R,D[Se],q),re!==null&&(A=y(re,A,Se),De===null?ae=re:De.sibling=re,De=re);return Ne&&ai(R,Se),ae}for(re=d(re);Se<D.length;Se++)Me=U(re,R,Se,D[Se],q),Me!==null&&(r&&Me.alternate!==null&&re.delete(Me.key===null?Se:Me.key),A=y(Me,A,Se),De===null?ae=Me:De.sibling=Me,De=Me);return r&&re.forEach(function(ar){return l(R,ar)}),Ne&&ai(R,Se),ae}function ue(R,A,D,q){if(D==null)throw Error(i(151));for(var ae=null,De=null,re=A,Se=A=0,Me=null,ze=D.next();re!==null&&!ze.done;Se++,ze=D.next()){re.index>Se?(Me=re,re=null):Me=re.sibling;var ar=_(R,re,ze.value,q);if(ar===null){re===null&&(re=Me);break}r&&re&&ar.alternate===null&&l(R,re),A=y(ar,A,Se),De===null?ae=ar:De.sibling=ar,De=ar,re=Me}if(ze.done)return c(R,re),Ne&&ai(R,Se),ae;if(re===null){for(;!ze.done;Se++,ze=D.next())ze=P(R,ze.value,q),ze!==null&&(A=y(ze,A,Se),De===null?ae=ze:De.sibling=ze,De=ze);return Ne&&ai(R,Se),ae}for(re=d(re);!ze.done;Se++,ze=D.next())ze=U(re,R,Se,ze.value,q),ze!==null&&(r&&ze.alternate!==null&&re.delete(ze.key===null?Se:ze.key),A=y(ze,A,Se),De===null?ae=ze:De.sibling=ze,De=ze);return r&&re.forEach(function(EM){return l(R,EM)}),Ne&&ai(R,Se),ae}function $e(R,A,D,q){if(typeof D=="object"&&D!==null&&D.type===w&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case v:e:{for(var ae=D.key;A!==null;){if(A.key===ae){if(ae=D.type,ae===w){if(A.tag===7){c(R,A.sibling),q=m(A,D.props.children),q.return=R,R=q;break e}}else if(A.elementType===ae||typeof ae=="object"&&ae!==null&&ae.$$typeof===W&&Pr(ae)===A.type){c(R,A.sibling),q=m(A,D.props),Pl(q,D),q.return=R,R=q;break e}c(R,A);break}else l(R,A);A=A.sibling}D.type===w?(q=jr(D.props.children,R.mode,q,D.key),q.return=R,R=q):(q=Oa(D.type,D.key,D.props,null,R.mode,q),Pl(q,D),q.return=R,R=q)}return x(R);case S:e:{for(ae=D.key;A!==null;){if(A.key===ae)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){c(R,A.sibling),q=m(A,D.children||[]),q.return=R,R=q;break e}else{c(R,A);break}else l(R,A);A=A.sibling}q=nd(D,R.mode,q),q.return=R,R=q}return x(R);case W:return D=Pr(D),$e(R,A,D,q)}if(se(D))return ee(R,A,D,q);if(pe(D)){if(ae=pe(D),typeof ae!="function")throw Error(i(150));return D=ae.call(D),ue(R,A,D,q)}if(typeof D.then=="function")return $e(R,A,Ba(D),q);if(D.$$typeof===L)return $e(R,A,Da(R,D),q);Ha(R,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,A!==null&&A.tag===6?(c(R,A.sibling),q=m(A,D),q.return=R,R=q):(c(R,A),q=td(D,R.mode,q),q.return=R,R=q),x(R)):c(R,A)}return function(R,A,D,q){try{ql=0;var ae=$e(R,A,D,q);return $s=null,ae}catch(re){if(re===Vs||re===La)throw re;var De=sn(29,re,null,R.mode);return De.lanes=q,De.return=R,De}finally{}}}var Gr=Yy(!0),Xy=Yy(!1),Ki=!1;function pd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function md(r,l){r=r.updateQueue,l.updateQueue===r&&(l.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Gi(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Yi(r,l,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Le&2)!==0){var m=d.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),d.pending=l,l=Aa(r),Ry(r,null,c),l}return Ma(r,d,l,c),Aa(r)}function Kl(r,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var d=l.lanes;d&=r.pendingLanes,c|=d,l.lanes=c,jg(r,c)}}function gd(r,l){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var m=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var x={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?m=y=x:y=y.next=x,c=c.next}while(c!==null);y===null?m=y=l:y=y.next=l}else m=y=l;c={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=l:r.next=l,c.lastBaseUpdate=l}var yd=!1;function Gl(){if(yd){var r=Is;if(r!==null)throw r}}function Yl(r,l,c,d){yd=!1;var m=r.updateQueue;Ki=!1;var y=m.firstBaseUpdate,x=m.lastBaseUpdate,T=m.shared.pending;if(T!==null){m.shared.pending=null;var M=T,z=M.next;M.next=null,x===null?y=z:x.next=z,x=M;var $=r.alternate;$!==null&&($=$.updateQueue,T=$.lastBaseUpdate,T!==x&&(T===null?$.firstBaseUpdate=z:T.next=z,$.lastBaseUpdate=M))}if(y!==null){var P=m.baseState;x=0,$=z=M=null,T=y;do{var _=T.lane&-536870913,U=_!==T.lane;if(U?(Ce&_)===_:(d&_)===_){_!==0&&_===js&&(yd=!0),$!==null&&($=$.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var ee=r,ue=T;_=l;var $e=c;switch(ue.tag){case 1:if(ee=ue.payload,typeof ee=="function"){P=ee.call($e,P,_);break e}P=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=ue.payload,_=typeof ee=="function"?ee.call($e,P,_):ee,_==null)break e;P=g({},P,_);break e;case 2:Ki=!0}}_=T.callback,_!==null&&(r.flags|=64,U&&(r.flags|=8192),U=m.callbacks,U===null?m.callbacks=[_]:U.push(_))}else U={lane:_,tag:T.tag,payload:T.payload,callback:T.callback,next:null},$===null?(z=$=U,M=P):$=$.next=U,x|=_;if(T=T.next,T===null){if(T=m.shared.pending,T===null)break;U=T,T=U.next,U.next=null,m.lastBaseUpdate=U,m.shared.pending=null}}while(!0);$===null&&(M=P),m.baseState=M,m.firstBaseUpdate=z,m.lastBaseUpdate=$,y===null&&(m.shared.lanes=0),Ji|=x,r.lanes=x,r.memoizedState=P}}function Fy(r,l){if(typeof r!="function")throw Error(i(191,r));r.call(l)}function Wy(r,l){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)Fy(c[r],l)}var qs=O(null),Ua=O(0);function Qy(r,l){r=vi,Q(Ua,r),Q(qs,l),vi=r|l.baseLanes}function bd(){Q(Ua,vi),Q(qs,qs.current)}function vd(){vi=Ua.current,K(qs),K(Ua)}var ln=O(null),kn=null;function Xi(r){var l=r.alternate;Q(at,at.current&1),Q(ln,r),kn===null&&(l===null||qs.current!==null||l.memoizedState!==null)&&(kn=r)}function Sd(r){Q(at,at.current),Q(ln,r),kn===null&&(kn=r)}function Jy(r){r.tag===22?(Q(at,at.current),Q(ln,r),kn===null&&(kn=r)):Fi()}function Fi(){Q(at,at.current),Q(ln,ln.current)}function on(r){K(ln),kn===r&&(kn=null),K(at)}var at=O(0);function ja(r){for(var l=r;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ch(c)||Mh(c)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var fi=0,be=null,Ie=null,ft=null,Ia=!1,Ps=!1,Yr=!1,Va=0,Xl=0,Ks=null,mC=0;function it(){throw Error(i(321))}function xd(r,l){if(l===null)return!1;for(var c=0;c<l.length&&c<r.length;c++)if(!rn(r[c],l[c]))return!1;return!0}function wd(r,l,c,d,m,y){return fi=y,be=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,B.H=r===null||r.memoizedState===null?_0:Hd,Yr=!1,y=c(d,m),Yr=!1,Ps&&(y=e0(l,c,d,m)),Zy(r),y}function Zy(r){B.H=Ql;var l=Ie!==null&&Ie.next!==null;if(fi=0,ft=Ie=be=null,Ia=!1,Xl=0,Ks=null,l)throw Error(i(300));r===null||dt||(r=r.dependencies,r!==null&&Ra(r)&&(dt=!0))}function e0(r,l,c,d){be=r;var m=0;do{if(Ps&&(Ks=null),Xl=0,Ps=!1,25<=m)throw Error(i(301));if(m+=1,ft=Ie=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}B.H=B0,y=l(c,d)}while(Ps);return y}function gC(){var r=B.H,l=r.useState()[0];return l=typeof l.then=="function"?Fl(l):l,r=r.useState()[0],(Ie!==null?Ie.memoizedState:null)!==r&&(be.flags|=1024),l}function kd(){var r=Va!==0;return Va=0,r}function Td(r,l,c){l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~c}function Ed(r){if(Ia){for(r=r.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Ia=!1}fi=0,ft=Ie=be=null,Ps=!1,Xl=Va=0,Ks=null}function jt(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?be.memoizedState=ft=r:ft=ft.next=r,ft}function ct(){if(Ie===null){var r=be.alternate;r=r!==null?r.memoizedState:null}else r=Ie.next;var l=ft===null?be.memoizedState:ft.next;if(l!==null)ft=l,Ie=r;else{if(r===null)throw be.alternate===null?Error(i(467)):Error(i(310));Ie=r,r={memoizedState:Ie.memoizedState,baseState:Ie.baseState,baseQueue:Ie.baseQueue,queue:Ie.queue,next:null},ft===null?be.memoizedState=ft=r:ft=ft.next=r}return ft}function $a(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fl(r){var l=Xl;return Xl+=1,Ks===null&&(Ks=[]),r=Py(Ks,r,l),l=be,(ft===null?l.memoizedState:ft.next)===null&&(l=l.alternate,B.H=l===null||l.memoizedState===null?_0:Hd),r}function qa(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Fl(r);if(r.$$typeof===L)return Ct(r)}throw Error(i(438,String(r)))}function Cd(r){var l=null,c=be.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var d=be.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(l={data:d.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=$a(),be.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(r),d=0;d<r;d++)c[d]=te;return l.index++,c}function di(r,l){return typeof l=="function"?l(r):l}function Pa(r){var l=ct();return Md(l,Ie,r)}function Md(r,l,c){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var m=r.baseQueue,y=d.pending;if(y!==null){if(m!==null){var x=m.next;m.next=y.next,y.next=x}l.baseQueue=m=y,d.pending=null}if(y=r.baseState,m===null)r.memoizedState=y;else{l=m.next;var T=x=null,M=null,z=l,$=!1;do{var P=z.lane&-536870913;if(P!==z.lane?(Ce&P)===P:(fi&P)===P){var _=z.revertLane;if(_===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),P===js&&($=!0);else if((fi&_)===_){z=z.next,_===js&&($=!0);continue}else P={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},M===null?(T=M=P,x=y):M=M.next=P,be.lanes|=_,Ji|=_;P=z.action,Yr&&c(y,P),y=z.hasEagerState?z.eagerState:c(y,P)}else _={lane:P,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},M===null?(T=M=_,x=y):M=M.next=_,be.lanes|=P,Ji|=P;z=z.next}while(z!==null&&z!==l);if(M===null?x=y:M.next=T,!rn(y,r.memoizedState)&&(dt=!0,$&&(c=Is,c!==null)))throw c;r.memoizedState=y,r.baseState=x,r.baseQueue=M,d.lastRenderedState=y}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Ad(r){var l=ct(),c=l.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var d=c.dispatch,m=c.pending,y=l.memoizedState;if(m!==null){c.pending=null;var x=m=m.next;do y=r(y,x.action),x=x.next;while(x!==m);rn(y,l.memoizedState)||(dt=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),c.lastRenderedState=y}return[y,d]}function t0(r,l,c){var d=be,m=ct(),y=Ne;if(y){if(c===void 0)throw Error(i(407));c=c()}else c=l();var x=!rn((Ie||m).memoizedState,c);if(x&&(m.memoizedState=c,dt=!0),m=m.queue,Rd(r0.bind(null,d,m,r),[r]),m.getSnapshot!==l||x||ft!==null&&ft.memoizedState.tag&1){if(d.flags|=2048,Gs(9,{destroy:void 0},i0.bind(null,d,m,c,l),null),qe===null)throw Error(i(349));y||(fi&127)!==0||n0(d,l,c)}return c}function n0(r,l,c){r.flags|=16384,r={getSnapshot:l,value:c},l=be.updateQueue,l===null?(l=$a(),be.updateQueue=l,l.stores=[r]):(c=l.stores,c===null?l.stores=[r]:c.push(r))}function i0(r,l,c,d){l.value=c,l.getSnapshot=d,s0(l)&&l0(r)}function r0(r,l,c){return c(function(){s0(l)&&l0(r)})}function s0(r){var l=r.getSnapshot;r=r.value;try{var c=l();return!rn(r,c)}catch{return!0}}function l0(r){var l=Ur(r,2);l!==null&&Wt(l,r,2)}function Od(r){var l=jt();if(typeof r=="function"){var c=r;if(r=c(),Yr){Ui(!0);try{c()}finally{Ui(!1)}}}return l.memoizedState=l.baseState=r,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:di,lastRenderedState:r},l}function o0(r,l,c,d){return r.baseState=c,Md(r,Ie,typeof d=="function"?d:di)}function yC(r,l,c,d,m){if(Ya(r))throw Error(i(485));if(r=l.action,r!==null){var y={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){y.listeners.push(x)}};B.T!==null?c(!0):y.isTransition=!1,d(y),c=l.pending,c===null?(y.next=l.pending=y,a0(l,y)):(y.next=c.next,l.pending=c.next=y)}}function a0(r,l){var c=l.action,d=l.payload,m=r.state;if(l.isTransition){var y=B.T,x={};B.T=x;try{var T=c(m,d),M=B.S;M!==null&&M(x,T),c0(r,l,T)}catch(z){Nd(r,l,z)}finally{y!==null&&x.types!==null&&(y.types=x.types),B.T=y}}else try{y=c(m,d),c0(r,l,y)}catch(z){Nd(r,l,z)}}function c0(r,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){u0(r,l,d)},function(d){return Nd(r,l,d)}):u0(r,l,c)}function u0(r,l,c){l.status="fulfilled",l.value=c,f0(l),r.state=c,l=r.pending,l!==null&&(c=l.next,c===l?r.pending=null:(c=c.next,l.next=c,a0(r,c)))}function Nd(r,l,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do l.status="rejected",l.reason=c,f0(l),l=l.next;while(l!==d)}r.action=null}function f0(r){r=r.listeners;for(var l=0;l<r.length;l++)(0,r[l])()}function d0(r,l){return l}function h0(r,l){if(Ne){var c=qe.formState;if(c!==null){e:{var d=be;if(Ne){if(Fe){t:{for(var m=Fe,y=wn;m.nodeType!==8;){if(!y){m=null;break t}if(m=Tn(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){Fe=Tn(m.nextSibling),d=m.data==="F!";break e}}qi(d)}d=!1}d&&(l=c[0])}}return c=jt(),c.memoizedState=c.baseState=l,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d0,lastRenderedState:l},c.queue=d,c=D0.bind(null,be,d),d.dispatch=c,d=Od(!1),y=Bd.bind(null,be,!1,d.queue),d=jt(),m={state:l,dispatch:null,action:r,pending:null},d.queue=m,c=yC.bind(null,be,m,y,c),m.dispatch=c,d.memoizedState=r,[l,c,!1]}function p0(r){var l=ct();return m0(l,Ie,r)}function m0(r,l,c){if(l=Md(r,l,d0)[0],r=Pa(di)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var d=Fl(l)}catch(x){throw x===Vs?La:x}else d=l;l=ct();var m=l.queue,y=m.dispatch;return c!==l.memoizedState&&(be.flags|=2048,Gs(9,{destroy:void 0},bC.bind(null,m,c),null)),[d,y,r]}function bC(r,l){r.action=l}function g0(r){var l=ct(),c=Ie;if(c!==null)return m0(l,c,r);ct(),l=l.memoizedState,c=ct();var d=c.queue.dispatch;return c.memoizedState=r,[l,d,!1]}function Gs(r,l,c,d){return r={tag:r,create:c,deps:d,inst:l,next:null},l=be.updateQueue,l===null&&(l=$a(),be.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,l.lastEffect=r),r}function y0(){return ct().memoizedState}function Ka(r,l,c,d){var m=jt();be.flags|=r,m.memoizedState=Gs(1|l,{destroy:void 0},c,d===void 0?null:d)}function Ga(r,l,c,d){var m=ct();d=d===void 0?null:d;var y=m.memoizedState.inst;Ie!==null&&d!==null&&xd(d,Ie.memoizedState.deps)?m.memoizedState=Gs(l,y,c,d):(be.flags|=r,m.memoizedState=Gs(1|l,y,c,d))}function b0(r,l){Ka(8390656,8,r,l)}function Rd(r,l){Ga(2048,8,r,l)}function vC(r){be.flags|=4;var l=be.updateQueue;if(l===null)l=$a(),be.updateQueue=l,l.events=[r];else{var c=l.events;c===null?l.events=[r]:c.push(r)}}function v0(r){var l=ct().memoizedState;return vC({ref:l,nextImpl:r}),function(){if((Le&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function S0(r,l){return Ga(4,2,r,l)}function x0(r,l){return Ga(4,4,r,l)}function w0(r,l){if(typeof l=="function"){r=r();var c=l(r);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return r=r(),l.current=r,function(){l.current=null}}function k0(r,l,c){c=c!=null?c.concat([r]):null,Ga(4,4,w0.bind(null,l,r),c)}function Dd(){}function T0(r,l){var c=ct();l=l===void 0?null:l;var d=c.memoizedState;return l!==null&&xd(l,d[1])?d[0]:(c.memoizedState=[r,l],r)}function E0(r,l){var c=ct();l=l===void 0?null:l;var d=c.memoizedState;if(l!==null&&xd(l,d[1]))return d[0];if(d=r(),Yr){Ui(!0);try{r()}finally{Ui(!1)}}return c.memoizedState=[d,l],d}function zd(r,l,c){return c===void 0||(fi&1073741824)!==0&&(Ce&261930)===0?r.memoizedState=l:(r.memoizedState=c,r=Cb(),be.lanes|=r,Ji|=r,c)}function C0(r,l,c,d){return rn(c,l)?c:qs.current!==null?(r=zd(r,c,d),rn(r,l)||(dt=!0),r):(fi&42)===0||(fi&1073741824)!==0&&(Ce&261930)===0?(dt=!0,r.memoizedState=c):(r=Cb(),be.lanes|=r,Ji|=r,l)}function M0(r,l,c,d,m){var y=Y.p;Y.p=y!==0&&8>y?y:8;var x=B.T,T={};B.T=T,Bd(r,!1,l,c);try{var M=m(),z=B.S;if(z!==null&&z(T,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var $=pC(M,d);Wl(r,l,$,un(r))}else Wl(r,l,d,un(r))}catch(P){Wl(r,l,{then:function(){},status:"rejected",reason:P},un())}finally{Y.p=y,x!==null&&T.types!==null&&(x.types=T.types),B.T=x}}function SC(){}function Ld(r,l,c,d){if(r.tag!==5)throw Error(i(476));var m=A0(r).queue;M0(r,m,l,Z,c===null?SC:function(){return O0(r),c(d)})}function A0(r){var l=r.memoizedState;if(l!==null)return l;l={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:di,lastRenderedState:Z},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:di,lastRenderedState:c},next:null},r.memoizedState=l,r=r.alternate,r!==null&&(r.memoizedState=l),l}function O0(r){var l=A0(r);l.next===null&&(l=r.alternate.memoizedState),Wl(r,l.next.queue,{},un())}function _d(){return Ct(po)}function N0(){return ct().memoizedState}function R0(){return ct().memoizedState}function xC(r){for(var l=r.return;l!==null;){switch(l.tag){case 24:case 3:var c=un();r=Gi(c);var d=Yi(l,r,c);d!==null&&(Wt(d,l,c),Kl(d,l,c)),l={cache:ud()},r.payload=l;return}l=l.return}}function wC(r,l,c){var d=un();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ya(r)?z0(l,c):(c=Zf(r,l,c,d),c!==null&&(Wt(c,r,d),L0(c,l,d)))}function D0(r,l,c){var d=un();Wl(r,l,c,d)}function Wl(r,l,c,d){var m={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Ya(r))z0(l,m);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var x=l.lastRenderedState,T=y(x,c);if(m.hasEagerState=!0,m.eagerState=T,rn(T,x))return Ma(r,l,m,0),qe===null&&Ca(),!1}catch{}finally{}if(c=Zf(r,l,m,d),c!==null)return Wt(c,r,d),L0(c,l,d),!0}return!1}function Bd(r,l,c,d){if(d={lane:2,revertLane:ph(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ya(r)){if(l)throw Error(i(479))}else l=Zf(r,c,d,2),l!==null&&Wt(l,r,2)}function Ya(r){var l=r.alternate;return r===be||l!==null&&l===be}function z0(r,l){Ps=Ia=!0;var c=r.pending;c===null?l.next=l:(l.next=c.next,c.next=l),r.pending=l}function L0(r,l,c){if((c&4194048)!==0){var d=l.lanes;d&=r.pendingLanes,c|=d,l.lanes=c,jg(r,c)}}var Ql={readContext:Ct,use:qa,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useLayoutEffect:it,useInsertionEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useSyncExternalStore:it,useId:it,useHostTransitionStatus:it,useFormState:it,useActionState:it,useOptimistic:it,useMemoCache:it,useCacheRefresh:it};Ql.useEffectEvent=it;var _0={readContext:Ct,use:qa,useCallback:function(r,l){return jt().memoizedState=[r,l===void 0?null:l],r},useContext:Ct,useEffect:b0,useImperativeHandle:function(r,l,c){c=c!=null?c.concat([r]):null,Ka(4194308,4,w0.bind(null,l,r),c)},useLayoutEffect:function(r,l){return Ka(4194308,4,r,l)},useInsertionEffect:function(r,l){Ka(4,2,r,l)},useMemo:function(r,l){var c=jt();l=l===void 0?null:l;var d=r();if(Yr){Ui(!0);try{r()}finally{Ui(!1)}}return c.memoizedState=[d,l],d},useReducer:function(r,l,c){var d=jt();if(c!==void 0){var m=c(l);if(Yr){Ui(!0);try{c(l)}finally{Ui(!1)}}}else m=l;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=wC.bind(null,be,r),[d.memoizedState,r]},useRef:function(r){var l=jt();return r={current:r},l.memoizedState=r},useState:function(r){r=Od(r);var l=r.queue,c=D0.bind(null,be,l);return l.dispatch=c,[r.memoizedState,c]},useDebugValue:Dd,useDeferredValue:function(r,l){var c=jt();return zd(c,r,l)},useTransition:function(){var r=Od(!1);return r=M0.bind(null,be,r.queue,!0,!1),jt().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,l,c){var d=be,m=jt();if(Ne){if(c===void 0)throw Error(i(407));c=c()}else{if(c=l(),qe===null)throw Error(i(349));(Ce&127)!==0||n0(d,l,c)}m.memoizedState=c;var y={value:c,getSnapshot:l};return m.queue=y,b0(r0.bind(null,d,y,r),[r]),d.flags|=2048,Gs(9,{destroy:void 0},i0.bind(null,d,y,c,l),null),c},useId:function(){var r=jt(),l=qe.identifierPrefix;if(Ne){var c=qn,d=$n;c=(d&~(1<<32-nn(d)-1)).toString(32)+c,l="_"+l+"R_"+c,c=Va++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=mC++,l="_"+l+"r_"+c.toString(32)+"_";return r.memoizedState=l},useHostTransitionStatus:_d,useFormState:h0,useActionState:h0,useOptimistic:function(r){var l=jt();l.memoizedState=l.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=Bd.bind(null,be,!0,c),c.dispatch=l,[r,l]},useMemoCache:Cd,useCacheRefresh:function(){return jt().memoizedState=xC.bind(null,be)},useEffectEvent:function(r){var l=jt(),c={impl:r};return l.memoizedState=c,function(){if((Le&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},Hd={readContext:Ct,use:qa,useCallback:T0,useContext:Ct,useEffect:Rd,useImperativeHandle:k0,useInsertionEffect:S0,useLayoutEffect:x0,useMemo:E0,useReducer:Pa,useRef:y0,useState:function(){return Pa(di)},useDebugValue:Dd,useDeferredValue:function(r,l){var c=ct();return C0(c,Ie.memoizedState,r,l)},useTransition:function(){var r=Pa(di)[0],l=ct().memoizedState;return[typeof r=="boolean"?r:Fl(r),l]},useSyncExternalStore:t0,useId:N0,useHostTransitionStatus:_d,useFormState:p0,useActionState:p0,useOptimistic:function(r,l){var c=ct();return o0(c,Ie,r,l)},useMemoCache:Cd,useCacheRefresh:R0};Hd.useEffectEvent=v0;var B0={readContext:Ct,use:qa,useCallback:T0,useContext:Ct,useEffect:Rd,useImperativeHandle:k0,useInsertionEffect:S0,useLayoutEffect:x0,useMemo:E0,useReducer:Ad,useRef:y0,useState:function(){return Ad(di)},useDebugValue:Dd,useDeferredValue:function(r,l){var c=ct();return Ie===null?zd(c,r,l):C0(c,Ie.memoizedState,r,l)},useTransition:function(){var r=Ad(di)[0],l=ct().memoizedState;return[typeof r=="boolean"?r:Fl(r),l]},useSyncExternalStore:t0,useId:N0,useHostTransitionStatus:_d,useFormState:g0,useActionState:g0,useOptimistic:function(r,l){var c=ct();return Ie!==null?o0(c,Ie,r,l):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Cd,useCacheRefresh:R0};B0.useEffectEvent=v0;function Ud(r,l,c,d){l=r.memoizedState,c=c(d,l),c=c==null?l:g({},l,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var jd={enqueueSetState:function(r,l,c){r=r._reactInternals;var d=un(),m=Gi(d);m.payload=l,c!=null&&(m.callback=c),l=Yi(r,m,d),l!==null&&(Wt(l,r,d),Kl(l,r,d))},enqueueReplaceState:function(r,l,c){r=r._reactInternals;var d=un(),m=Gi(d);m.tag=1,m.payload=l,c!=null&&(m.callback=c),l=Yi(r,m,d),l!==null&&(Wt(l,r,d),Kl(l,r,d))},enqueueForceUpdate:function(r,l){r=r._reactInternals;var c=un(),d=Gi(c);d.tag=2,l!=null&&(d.callback=l),l=Yi(r,d,c),l!==null&&(Wt(l,r,c),Kl(l,r,c))}};function H0(r,l,c,d,m,y,x){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,y,x):l.prototype&&l.prototype.isPureReactComponent?!Hl(c,d)||!Hl(m,y):!0}function U0(r,l,c,d){r=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,d),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,d),l.state!==r&&jd.enqueueReplaceState(l,l.state,null)}function Xr(r,l){var c=l;if("ref"in l){c={};for(var d in l)d!=="ref"&&(c[d]=l[d])}if(r=r.defaultProps){c===l&&(c=g({},c));for(var m in r)c[m]===void 0&&(c[m]=r[m])}return c}function j0(r){Ea(r)}function I0(r){console.error(r)}function V0(r){Ea(r)}function Xa(r,l){try{var c=r.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(d){setTimeout(function(){throw d})}}function $0(r,l,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Id(r,l,c){return c=Gi(c),c.tag=3,c.payload={element:null},c.callback=function(){Xa(r,l)},c}function q0(r){return r=Gi(r),r.tag=3,r}function P0(r,l,c,d){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var y=d.value;r.payload=function(){return m(y)},r.callback=function(){$0(l,c,d)}}var x=c.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(r.callback=function(){$0(l,c,d),typeof m!="function"&&(Zi===null?Zi=new Set([this]):Zi.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function kC(r,l,c,d,m){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(l=c.alternate,l!==null&&Us(l,c,m,!0),c=ln.current,c!==null){switch(c.tag){case 31:case 13:return kn===null?lc():c.alternate===null&&rt===0&&(rt=3),c.flags&=-257,c.flags|=65536,c.lanes=m,d===_a?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([d]):l.add(d),fh(r,d,m)),!1;case 22:return c.flags|=65536,d===_a?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([d]):c.add(d)),fh(r,d,m)),!1}throw Error(i(435,c.tag))}return fh(r,d,m),lc(),!1}if(Ne)return l=ln.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,d!==sd&&(r=Error(i(422),{cause:d}),Il(vn(r,c)))):(d!==sd&&(l=Error(i(423),{cause:d}),Il(vn(l,c))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=vn(d,c),m=Id(r.stateNode,d,m),gd(r,m),rt!==4&&(rt=2)),!1;var y=Error(i(520),{cause:d});if(y=vn(y,c),so===null?so=[y]:so.push(y),rt!==4&&(rt=2),l===null)return!0;d=vn(d,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,r=m&-m,c.lanes|=r,r=Id(c.stateNode,d,r),gd(c,r),!1;case 1:if(l=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Zi===null||!Zi.has(y))))return c.flags|=65536,m&=-m,c.lanes|=m,m=q0(m),P0(m,r,c,d),gd(c,m),!1}c=c.return}while(c!==null);return!1}var Vd=Error(i(461)),dt=!1;function Mt(r,l,c,d){l.child=r===null?Xy(l,null,c,d):Gr(l,r.child,c,d)}function K0(r,l,c,d,m){c=c.render;var y=l.ref;if("ref"in d){var x={};for(var T in d)T!=="ref"&&(x[T]=d[T])}else x=d;return $r(l),d=wd(r,l,c,x,y,m),T=kd(),r!==null&&!dt?(Td(r,l,m),hi(r,l,m)):(Ne&&T&&id(l),l.flags|=1,Mt(r,l,d,m),l.child)}function G0(r,l,c,d,m){if(r===null){var y=c.type;return typeof y=="function"&&!ed(y)&&y.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=y,Y0(r,l,y,d,m)):(r=Oa(c.type,null,d,l,l.mode,m),r.ref=l.ref,r.return=l,l.child=r)}if(y=r.child,!Fd(r,m)){var x=y.memoizedProps;if(c=c.compare,c=c!==null?c:Hl,c(x,d)&&r.ref===l.ref)return hi(r,l,m)}return l.flags|=1,r=oi(y,d),r.ref=l.ref,r.return=l,l.child=r}function Y0(r,l,c,d,m){if(r!==null){var y=r.memoizedProps;if(Hl(y,d)&&r.ref===l.ref)if(dt=!1,l.pendingProps=d=y,Fd(r,m))(r.flags&131072)!==0&&(dt=!0);else return l.lanes=r.lanes,hi(r,l,m)}return $d(r,l,c,d,m)}function X0(r,l,c,d){var m=d.children,y=r!==null?r.memoizedState:null;if(r===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((l.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,r!==null){for(d=l.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~y}else d=0,l.child=null;return F0(r,l,y,c,d)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},r!==null&&za(l,y!==null?y.cachePool:null),y!==null?Qy(l,y):bd(),Jy(l);else return d=l.lanes=536870912,F0(r,l,y!==null?y.baseLanes|c:c,c,d)}else y!==null?(za(l,y.cachePool),Qy(l,y),Fi(),l.memoizedState=null):(r!==null&&za(l,null),bd(),Fi());return Mt(r,l,m,c),l.child}function Jl(r,l){return r!==null&&r.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function F0(r,l,c,d,m){var y=dd();return y=y===null?null:{parent:ut._currentValue,pool:y},l.memoizedState={baseLanes:c,cachePool:y},r!==null&&za(l,null),bd(),Jy(l),r!==null&&Us(r,l,d,!0),l.childLanes=m,null}function Fa(r,l){return l=Qa({mode:l.mode,children:l.children},r.mode),l.ref=r.ref,r.child=l,l.return=r,l}function W0(r,l,c){return Gr(l,r.child,null,c),r=Fa(l,l.pendingProps),r.flags|=2,on(l),l.memoizedState=null,r}function TC(r,l,c){var d=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,r===null){if(Ne){if(d.mode==="hidden")return r=Fa(l,d),l.lanes=536870912,Jl(null,r);if(Sd(l),(r=Fe)?(r=av(r,wn),r=r!==null&&r.data==="&"?r:null,r!==null&&(l.memoizedState={dehydrated:r,treeContext:Vi!==null?{id:$n,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},c=zy(r),c.return=l,l.child=c,Et=l,Fe=null)):r=null,r===null)throw qi(l);return l.lanes=536870912,null}return Fa(l,d)}var y=r.memoizedState;if(y!==null){var x=y.dehydrated;if(Sd(l),m)if(l.flags&256)l.flags&=-257,l=W0(r,l,c);else if(l.memoizedState!==null)l.child=r.child,l.flags|=128,l=null;else throw Error(i(558));else if(dt||Us(r,l,c,!1),m=(c&r.childLanes)!==0,dt||m){if(d=qe,d!==null&&(x=Ig(d,c),x!==0&&x!==y.retryLane))throw y.retryLane=x,Ur(r,x),Wt(d,r,x),Vd;lc(),l=W0(r,l,c)}else r=y.treeContext,Fe=Tn(x.nextSibling),Et=l,Ne=!0,$i=null,wn=!1,r!==null&&By(l,r),l=Fa(l,d),l.flags|=4096;return l}return r=oi(r.child,{mode:d.mode,children:d.children}),r.ref=l.ref,l.child=r,r.return=l,r}function Wa(r,l){var c=l.ref;if(c===null)r!==null&&r.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(l.flags|=4194816)}}function $d(r,l,c,d,m){return $r(l),c=wd(r,l,c,d,void 0,m),d=kd(),r!==null&&!dt?(Td(r,l,m),hi(r,l,m)):(Ne&&d&&id(l),l.flags|=1,Mt(r,l,c,m),l.child)}function Q0(r,l,c,d,m,y){return $r(l),l.updateQueue=null,c=e0(l,d,c,m),Zy(r),d=kd(),r!==null&&!dt?(Td(r,l,y),hi(r,l,y)):(Ne&&d&&id(l),l.flags|=1,Mt(r,l,c,y),l.child)}function J0(r,l,c,d,m){if($r(l),l.stateNode===null){var y=Ls,x=c.contextType;typeof x=="object"&&x!==null&&(y=Ct(x)),y=new c(d,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=jd,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=d,y.state=l.memoizedState,y.refs={},pd(l),x=c.contextType,y.context=typeof x=="object"&&x!==null?Ct(x):Ls,y.state=l.memoizedState,x=c.getDerivedStateFromProps,typeof x=="function"&&(Ud(l,c,x,d),y.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(x=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),x!==y.state&&jd.enqueueReplaceState(y,y.state,null),Yl(l,d,y,m),Gl(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),d=!0}else if(r===null){y=l.stateNode;var T=l.memoizedProps,M=Xr(c,T);y.props=M;var z=y.context,$=c.contextType;x=Ls,typeof $=="object"&&$!==null&&(x=Ct($));var P=c.getDerivedStateFromProps;$=typeof P=="function"||typeof y.getSnapshotBeforeUpdate=="function",T=l.pendingProps!==T,$||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(T||z!==x)&&U0(l,y,d,x),Ki=!1;var _=l.memoizedState;y.state=_,Yl(l,d,y,m),Gl(),z=l.memoizedState,T||_!==z||Ki?(typeof P=="function"&&(Ud(l,c,P,d),z=l.memoizedState),(M=Ki||H0(l,c,M,d,_,z,x))?($||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(l.flags|=4194308)):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=d,l.memoizedState=z),y.props=d,y.state=z,y.context=x,d=M):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),d=!1)}else{y=l.stateNode,md(r,l),x=l.memoizedProps,$=Xr(c,x),y.props=$,P=l.pendingProps,_=y.context,z=c.contextType,M=Ls,typeof z=="object"&&z!==null&&(M=Ct(z)),T=c.getDerivedStateFromProps,(z=typeof T=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(x!==P||_!==M)&&U0(l,y,d,M),Ki=!1,_=l.memoizedState,y.state=_,Yl(l,d,y,m),Gl();var U=l.memoizedState;x!==P||_!==U||Ki||r!==null&&r.dependencies!==null&&Ra(r.dependencies)?(typeof T=="function"&&(Ud(l,c,T,d),U=l.memoizedState),($=Ki||H0(l,c,$,d,_,U,M)||r!==null&&r.dependencies!==null&&Ra(r.dependencies))?(z||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,U,M),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,U,M)),typeof y.componentDidUpdate=="function"&&(l.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof y.componentDidUpdate!="function"||x===r.memoizedProps&&_===r.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||x===r.memoizedProps&&_===r.memoizedState||(l.flags|=1024),l.memoizedProps=d,l.memoizedState=U),y.props=d,y.state=U,y.context=M,d=$):(typeof y.componentDidUpdate!="function"||x===r.memoizedProps&&_===r.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||x===r.memoizedProps&&_===r.memoizedState||(l.flags|=1024),d=!1)}return y=d,Wa(r,l),d=(l.flags&128)!==0,y||d?(y=l.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:y.render(),l.flags|=1,r!==null&&d?(l.child=Gr(l,r.child,null,m),l.child=Gr(l,null,c,m)):Mt(r,l,c,m),l.memoizedState=y.state,r=l.child):r=hi(r,l,m),r}function Z0(r,l,c,d){return Ir(),l.flags|=256,Mt(r,l,c,d),l.child}var qd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pd(r){return{baseLanes:r,cachePool:$y()}}function Kd(r,l,c){return r=r!==null?r.childLanes&~c:0,l&&(r|=cn),r}function eb(r,l,c){var d=l.pendingProps,m=!1,y=(l.flags&128)!==0,x;if((x=y)||(x=r!==null&&r.memoizedState===null?!1:(at.current&2)!==0),x&&(m=!0,l.flags&=-129),x=(l.flags&32)!==0,l.flags&=-33,r===null){if(Ne){if(m?Xi(l):Fi(),(r=Fe)?(r=av(r,wn),r=r!==null&&r.data!=="&"?r:null,r!==null&&(l.memoizedState={dehydrated:r,treeContext:Vi!==null?{id:$n,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},c=zy(r),c.return=l,l.child=c,Et=l,Fe=null)):r=null,r===null)throw qi(l);return Mh(r)?l.lanes=32:l.lanes=536870912,null}var T=d.children;return d=d.fallback,m?(Fi(),m=l.mode,T=Qa({mode:"hidden",children:T},m),d=jr(d,m,c,null),T.return=l,d.return=l,T.sibling=d,l.child=T,d=l.child,d.memoizedState=Pd(c),d.childLanes=Kd(r,x,c),l.memoizedState=qd,Jl(null,d)):(Xi(l),Gd(l,T))}var M=r.memoizedState;if(M!==null&&(T=M.dehydrated,T!==null)){if(y)l.flags&256?(Xi(l),l.flags&=-257,l=Yd(r,l,c)):l.memoizedState!==null?(Fi(),l.child=r.child,l.flags|=128,l=null):(Fi(),T=d.fallback,m=l.mode,d=Qa({mode:"visible",children:d.children},m),T=jr(T,m,c,null),T.flags|=2,d.return=l,T.return=l,d.sibling=T,l.child=d,Gr(l,r.child,null,c),d=l.child,d.memoizedState=Pd(c),d.childLanes=Kd(r,x,c),l.memoizedState=qd,l=Jl(null,d));else if(Xi(l),Mh(T)){if(x=T.nextSibling&&T.nextSibling.dataset,x)var z=x.dgst;x=z,d=Error(i(419)),d.stack="",d.digest=x,Il({value:d,source:null,stack:null}),l=Yd(r,l,c)}else if(dt||Us(r,l,c,!1),x=(c&r.childLanes)!==0,dt||x){if(x=qe,x!==null&&(d=Ig(x,c),d!==0&&d!==M.retryLane))throw M.retryLane=d,Ur(r,d),Wt(x,r,d),Vd;Ch(T)||lc(),l=Yd(r,l,c)}else Ch(T)?(l.flags|=192,l.child=r.child,l=null):(r=M.treeContext,Fe=Tn(T.nextSibling),Et=l,Ne=!0,$i=null,wn=!1,r!==null&&By(l,r),l=Gd(l,d.children),l.flags|=4096);return l}return m?(Fi(),T=d.fallback,m=l.mode,M=r.child,z=M.sibling,d=oi(M,{mode:"hidden",children:d.children}),d.subtreeFlags=M.subtreeFlags&65011712,z!==null?T=oi(z,T):(T=jr(T,m,c,null),T.flags|=2),T.return=l,d.return=l,d.sibling=T,l.child=d,Jl(null,d),d=l.child,T=r.child.memoizedState,T===null?T=Pd(c):(m=T.cachePool,m!==null?(M=ut._currentValue,m=m.parent!==M?{parent:M,pool:M}:m):m=$y(),T={baseLanes:T.baseLanes|c,cachePool:m}),d.memoizedState=T,d.childLanes=Kd(r,x,c),l.memoizedState=qd,Jl(r.child,d)):(Xi(l),c=r.child,r=c.sibling,c=oi(c,{mode:"visible",children:d.children}),c.return=l,c.sibling=null,r!==null&&(x=l.deletions,x===null?(l.deletions=[r],l.flags|=16):x.push(r)),l.child=c,l.memoizedState=null,c)}function Gd(r,l){return l=Qa({mode:"visible",children:l},r.mode),l.return=r,r.child=l}function Qa(r,l){return r=sn(22,r,null,l),r.lanes=0,r}function Yd(r,l,c){return Gr(l,r.child,null,c),r=Gd(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function tb(r,l,c){r.lanes|=l;var d=r.alternate;d!==null&&(d.lanes|=l),ad(r.return,l,c)}function Xd(r,l,c,d,m,y){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:m,treeForkCount:y}:(x.isBackwards=l,x.rendering=null,x.renderingStartTime=0,x.last=d,x.tail=c,x.tailMode=m,x.treeForkCount=y)}function nb(r,l,c){var d=l.pendingProps,m=d.revealOrder,y=d.tail;d=d.children;var x=at.current,T=(x&2)!==0;if(T?(x=x&1|2,l.flags|=128):x&=1,Q(at,x),Mt(r,l,d,c),d=Ne?jl:0,!T&&r!==null&&(r.flags&128)!==0)e:for(r=l.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&tb(r,c,l);else if(r.tag===19)tb(r,c,l);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===l)break e;for(;r.sibling===null;){if(r.return===null||r.return===l)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(c=l.child,m=null;c!==null;)r=c.alternate,r!==null&&ja(r)===null&&(m=c),c=c.sibling;c=m,c===null?(m=l.child,l.child=null):(m=c.sibling,c.sibling=null),Xd(l,!1,m,c,y,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=l.child,l.child=null;m!==null;){if(r=m.alternate,r!==null&&ja(r)===null){l.child=m;break}r=m.sibling,m.sibling=c,c=m,m=r}Xd(l,!0,c,null,y,d);break;case"together":Xd(l,!1,null,null,void 0,d);break;default:l.memoizedState=null}return l.child}function hi(r,l,c){if(r!==null&&(l.dependencies=r.dependencies),Ji|=l.lanes,(c&l.childLanes)===0)if(r!==null){if(Us(r,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(r!==null&&l.child!==r.child)throw Error(i(153));if(l.child!==null){for(r=l.child,c=oi(r,r.pendingProps),l.child=c,c.return=l;r.sibling!==null;)r=r.sibling,c=c.sibling=oi(r,r.pendingProps),c.return=l;c.sibling=null}return l.child}function Fd(r,l){return(r.lanes&l)!==0?!0:(r=r.dependencies,!!(r!==null&&Ra(r)))}function EC(r,l,c){switch(l.tag){case 3:J(l,l.stateNode.containerInfo),Pi(l,ut,r.memoizedState.cache),Ir();break;case 27:case 5:Zt(l);break;case 4:J(l,l.stateNode.containerInfo);break;case 10:Pi(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Sd(l),null;break;case 13:var d=l.memoizedState;if(d!==null)return d.dehydrated!==null?(Xi(l),l.flags|=128,null):(c&l.child.childLanes)!==0?eb(r,l,c):(Xi(l),r=hi(r,l,c),r!==null?r.sibling:null);Xi(l);break;case 19:var m=(r.flags&128)!==0;if(d=(c&l.childLanes)!==0,d||(Us(r,l,c,!1),d=(c&l.childLanes)!==0),m){if(d)return nb(r,l,c);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Q(at,at.current),d)break;return null;case 22:return l.lanes=0,X0(r,l,c,l.pendingProps);case 24:Pi(l,ut,r.memoizedState.cache)}return hi(r,l,c)}function ib(r,l,c){if(r!==null)if(r.memoizedProps!==l.pendingProps)dt=!0;else{if(!Fd(r,c)&&(l.flags&128)===0)return dt=!1,EC(r,l,c);dt=(r.flags&131072)!==0}else dt=!1,Ne&&(l.flags&1048576)!==0&&_y(l,jl,l.index);switch(l.lanes=0,l.tag){case 16:e:{var d=l.pendingProps;if(r=Pr(l.elementType),l.type=r,typeof r=="function")ed(r)?(d=Xr(r,d),l.tag=1,l=J0(null,l,r,d,c)):(l.tag=0,l=$d(null,l,r,d,c));else{if(r!=null){var m=r.$$typeof;if(m===V){l.tag=11,l=K0(null,l,r,d,c);break e}else if(m===H){l.tag=14,l=G0(null,l,r,d,c);break e}}throw l=de(r)||r,Error(i(306,l,""))}}return l;case 0:return $d(r,l,l.type,l.pendingProps,c);case 1:return d=l.type,m=Xr(d,l.pendingProps),J0(r,l,d,m,c);case 3:e:{if(J(l,l.stateNode.containerInfo),r===null)throw Error(i(387));d=l.pendingProps;var y=l.memoizedState;m=y.element,md(r,l),Yl(l,d,null,c);var x=l.memoizedState;if(d=x.cache,Pi(l,ut,d),d!==y.cache&&cd(l,[ut],c,!0),Gl(),d=x.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:x.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=Z0(r,l,d,c);break e}else if(d!==m){m=vn(Error(i(424)),l),Il(m),l=Z0(r,l,d,c);break e}else{switch(r=l.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Fe=Tn(r.firstChild),Et=l,Ne=!0,$i=null,wn=!0,c=Xy(l,null,d,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ir(),d===m){l=hi(r,l,c);break e}Mt(r,l,d,c)}l=l.child}return l;case 26:return Wa(r,l),r===null?(c=pv(l.type,null,l.pendingProps,null))?l.memoizedState=c:Ne||(c=l.type,r=l.pendingProps,d=hc(ke.current).createElement(c),d[Tt]=l,d[Pt]=r,At(d,c,r),bt(d),l.stateNode=d):l.memoizedState=pv(l.type,r.memoizedProps,l.pendingProps,r.memoizedState),null;case 27:return Zt(l),r===null&&Ne&&(d=l.stateNode=fv(l.type,l.pendingProps,ke.current),Et=l,wn=!0,m=Fe,ir(l.type)?(Ah=m,Fe=Tn(d.firstChild)):Fe=m),Mt(r,l,l.pendingProps.children,c),Wa(r,l),r===null&&(l.flags|=4194304),l.child;case 5:return r===null&&Ne&&((m=d=Fe)&&(d=tM(d,l.type,l.pendingProps,wn),d!==null?(l.stateNode=d,Et=l,Fe=Tn(d.firstChild),wn=!1,m=!0):m=!1),m||qi(l)),Zt(l),m=l.type,y=l.pendingProps,x=r!==null?r.memoizedProps:null,d=y.children,kh(m,y)?d=null:x!==null&&kh(m,x)&&(l.flags|=32),l.memoizedState!==null&&(m=wd(r,l,gC,null,null,c),po._currentValue=m),Wa(r,l),Mt(r,l,d,c),l.child;case 6:return r===null&&Ne&&((r=c=Fe)&&(c=nM(c,l.pendingProps,wn),c!==null?(l.stateNode=c,Et=l,Fe=null,r=!0):r=!1),r||qi(l)),null;case 13:return eb(r,l,c);case 4:return J(l,l.stateNode.containerInfo),d=l.pendingProps,r===null?l.child=Gr(l,null,d,c):Mt(r,l,d,c),l.child;case 11:return K0(r,l,l.type,l.pendingProps,c);case 7:return Mt(r,l,l.pendingProps,c),l.child;case 8:return Mt(r,l,l.pendingProps.children,c),l.child;case 12:return Mt(r,l,l.pendingProps.children,c),l.child;case 10:return d=l.pendingProps,Pi(l,l.type,d.value),Mt(r,l,d.children,c),l.child;case 9:return m=l.type._context,d=l.pendingProps.children,$r(l),m=Ct(m),d=d(m),l.flags|=1,Mt(r,l,d,c),l.child;case 14:return G0(r,l,l.type,l.pendingProps,c);case 15:return Y0(r,l,l.type,l.pendingProps,c);case 19:return nb(r,l,c);case 31:return TC(r,l,c);case 22:return X0(r,l,c,l.pendingProps);case 24:return $r(l),d=Ct(ut),r===null?(m=dd(),m===null&&(m=qe,y=ud(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=c),m=y),l.memoizedState={parent:d,cache:m},pd(l),Pi(l,ut,m)):((r.lanes&c)!==0&&(md(r,l),Yl(l,null,null,c),Gl()),m=r.memoizedState,y=l.memoizedState,m.parent!==d?(m={parent:d,cache:d},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),Pi(l,ut,d)):(d=y.cache,Pi(l,ut,d),d!==m.cache&&cd(l,[ut],c,!0))),Mt(r,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function pi(r){r.flags|=4}function Wd(r,l,c,d,m){if((l=(r.mode&32)!==0)&&(l=!1),l){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(Nb())r.flags|=8192;else throw Kr=_a,hd}else r.flags&=-16777217}function rb(r,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!vv(l))if(Nb())r.flags|=8192;else throw Kr=_a,hd}function Ja(r,l){l!==null&&(r.flags|=4),r.flags&16384&&(l=r.tag!==22?Hg():536870912,r.lanes|=l,Ws|=l)}function Zl(r,l){if(!Ne)switch(r.tailMode){case"hidden":l=r.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?l||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function We(r){var l=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(l)for(var m=r.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=c,l}function CC(r,l,c){var d=l.pendingProps;switch(rd(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(l),null;case 1:return We(l),null;case 3:return c=l.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),ui(ut),fe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Hs(l)?pi(l):r===null||r.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,ld())),We(l),null;case 26:var m=l.type,y=l.memoizedState;return r===null?(pi(l),y!==null?(We(l),rb(l,y)):(We(l),Wd(l,m,null,d,c))):y?y!==r.memoizedState?(pi(l),We(l),rb(l,y)):(We(l),l.flags&=-16777217):(r=r.memoizedProps,r!==d&&pi(l),We(l),Wd(l,m,r,d,c)),null;case 27:if(ii(l),c=ke.current,m=l.type,r!==null&&l.stateNode!=null)r.memoizedProps!==d&&pi(l);else{if(!d){if(l.stateNode===null)throw Error(i(166));return We(l),null}r=ne.current,Hs(l)?Hy(l):(r=fv(m,d,c),l.stateNode=r,pi(l))}return We(l),null;case 5:if(ii(l),m=l.type,r!==null&&l.stateNode!=null)r.memoizedProps!==d&&pi(l);else{if(!d){if(l.stateNode===null)throw Error(i(166));return We(l),null}if(y=ne.current,Hs(l))Hy(l);else{var x=hc(ke.current);switch(y){case 1:y=x.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=x.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=x.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=x.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=x.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?x.createElement("select",{is:d.is}):x.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?x.createElement(m,{is:d.is}):x.createElement(m)}}y[Tt]=l,y[Pt]=d;e:for(x=l.child;x!==null;){if(x.tag===5||x.tag===6)y.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===l)break e;for(;x.sibling===null;){if(x.return===null||x.return===l)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}l.stateNode=y;e:switch(At(y,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&pi(l)}}return We(l),Wd(l,l.type,r===null?null:r.memoizedProps,l.pendingProps,c),null;case 6:if(r&&l.stateNode!=null)r.memoizedProps!==d&&pi(l);else{if(typeof d!="string"&&l.stateNode===null)throw Error(i(166));if(r=ke.current,Hs(l)){if(r=l.stateNode,c=l.memoizedProps,d=null,m=Et,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Tt]=l,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||ev(r.nodeValue,c)),r||qi(l,!0)}else r=hc(r).createTextNode(d),r[Tt]=l,l.stateNode=r}return We(l),null;case 31:if(c=l.memoizedState,r===null||r.memoizedState!==null){if(d=Hs(l),c!==null){if(r===null){if(!d)throw Error(i(318));if(r=l.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Tt]=l}else Ir(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;We(l),r=!1}else c=ld(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return l.flags&256?(on(l),l):(on(l),null);if((l.flags&128)!==0)throw Error(i(558))}return We(l),null;case 13:if(d=l.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Hs(l),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Tt]=l}else Ir(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;We(l),m=!1}else m=ld(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(on(l),l):(on(l),null)}return on(l),(l.flags&128)!==0?(l.lanes=c,l):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=l.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==m&&(d.flags|=2048)),c!==r&&c&&(l.child.flags|=8192),Ja(l,l.updateQueue),We(l),null);case 4:return fe(),r===null&&bh(l.stateNode.containerInfo),We(l),null;case 10:return ui(l.type),We(l),null;case 19:if(K(at),d=l.memoizedState,d===null)return We(l),null;if(m=(l.flags&128)!==0,y=d.rendering,y===null)if(m)Zl(d,!1);else{if(rt!==0||r!==null&&(r.flags&128)!==0)for(r=l.child;r!==null;){if(y=ja(r),y!==null){for(l.flags|=128,Zl(d,!1),r=y.updateQueue,l.updateQueue=r,Ja(l,r),l.subtreeFlags=0,r=c,c=l.child;c!==null;)Dy(c,r),c=c.sibling;return Q(at,at.current&1|2),Ne&&ai(l,d.treeForkCount),l.child}r=r.sibling}d.tail!==null&&en()>ic&&(l.flags|=128,m=!0,Zl(d,!1),l.lanes=4194304)}else{if(!m)if(r=ja(y),r!==null){if(l.flags|=128,m=!0,r=r.updateQueue,l.updateQueue=r,Ja(l,r),Zl(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!Ne)return We(l),null}else 2*en()-d.renderingStartTime>ic&&c!==536870912&&(l.flags|=128,m=!0,Zl(d,!1),l.lanes=4194304);d.isBackwards?(y.sibling=l.child,l.child=y):(r=d.last,r!==null?r.sibling=y:l.child=y,d.last=y)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=en(),r.sibling=null,c=at.current,Q(at,m?c&1|2:c&1),Ne&&ai(l,d.treeForkCount),r):(We(l),null);case 22:case 23:return on(l),vd(),d=l.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(l.flags|=8192):d&&(l.flags|=8192),d?(c&536870912)!==0&&(l.flags&128)===0&&(We(l),l.subtreeFlags&6&&(l.flags|=8192)):We(l),c=l.updateQueue,c!==null&&Ja(l,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==c&&(l.flags|=2048),r!==null&&K(qr),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),ui(ut),We(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function MC(r,l){switch(rd(l),l.tag){case 1:return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 3:return ui(ut),fe(),r=l.flags,(r&65536)!==0&&(r&128)===0?(l.flags=r&-65537|128,l):null;case 26:case 27:case 5:return ii(l),null;case 31:if(l.memoizedState!==null){if(on(l),l.alternate===null)throw Error(i(340));Ir()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 13:if(on(l),r=l.memoizedState,r!==null&&r.dehydrated!==null){if(l.alternate===null)throw Error(i(340));Ir()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 19:return K(at),null;case 4:return fe(),null;case 10:return ui(l.type),null;case 22:case 23:return on(l),vd(),r!==null&&K(qr),r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 24:return ui(ut),null;case 25:return null;default:return null}}function sb(r,l){switch(rd(l),l.tag){case 3:ui(ut),fe();break;case 26:case 27:case 5:ii(l);break;case 4:fe();break;case 31:l.memoizedState!==null&&on(l);break;case 13:on(l);break;case 19:K(at);break;case 10:ui(l.type);break;case 22:case 23:on(l),vd(),r!==null&&K(qr);break;case 24:ui(ut)}}function eo(r,l){try{var c=l.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&r)===r){d=void 0;var y=c.create,x=c.inst;d=y(),x.destroy=d}c=c.next}while(c!==m)}}catch(T){Ue(l,l.return,T)}}function Wi(r,l,c){try{var d=l.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var y=m.next;d=y;do{if((d.tag&r)===r){var x=d.inst,T=x.destroy;if(T!==void 0){x.destroy=void 0,m=l;var M=c,z=T;try{z()}catch($){Ue(m,M,$)}}}d=d.next}while(d!==y)}}catch($){Ue(l,l.return,$)}}function lb(r){var l=r.updateQueue;if(l!==null){var c=r.stateNode;try{Wy(l,c)}catch(d){Ue(r,r.return,d)}}}function ob(r,l,c){c.props=Xr(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){Ue(r,l,d)}}function to(r,l){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof c=="function"?r.refCleanup=c(d):c.current=d}}catch(m){Ue(r,l,m)}}function Pn(r,l){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(m){Ue(r,l,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Ue(r,l,m)}else c.current=null}function ab(r){var l=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(m){Ue(r,r.return,m)}}function Qd(r,l,c){try{var d=r.stateNode;FC(d,r.type,c,l),d[Pt]=l}catch(m){Ue(r,r.return,m)}}function cb(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ir(r.type)||r.tag===4}function Jd(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||cb(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ir(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Zd(r,l,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,l?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,l):(l=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,l.appendChild(r),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=si));else if(d!==4&&(d===27&&ir(r.type)&&(c=r.stateNode,l=null),r=r.child,r!==null))for(Zd(r,l,c),r=r.sibling;r!==null;)Zd(r,l,c),r=r.sibling}function Za(r,l,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,l?c.insertBefore(r,l):c.appendChild(r);else if(d!==4&&(d===27&&ir(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Za(r,l,c),r=r.sibling;r!==null;)Za(r,l,c),r=r.sibling}function ub(r){var l=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);At(l,d,c),l[Tt]=r,l[Pt]=c}catch(y){Ue(r,r.return,y)}}var mi=!1,ht=!1,eh=!1,fb=typeof WeakSet=="function"?WeakSet:Set,vt=null;function AC(r,l){if(r=r.containerInfo,xh=Sc,r=ky(r),Yf(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var m=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var x=0,T=-1,M=-1,z=0,$=0,P=r,_=null;t:for(;;){for(var U;P!==c||m!==0&&P.nodeType!==3||(T=x+m),P!==y||d!==0&&P.nodeType!==3||(M=x+d),P.nodeType===3&&(x+=P.nodeValue.length),(U=P.firstChild)!==null;)_=P,P=U;for(;;){if(P===r)break t;if(_===c&&++z===m&&(T=x),_===y&&++$===d&&(M=x),(U=P.nextSibling)!==null)break;P=_,_=P.parentNode}P=U}c=T===-1||M===-1?null:{start:T,end:M}}else c=null}c=c||{start:0,end:0}}else c=null;for(wh={focusedElem:r,selectionRange:c},Sc=!1,vt=l;vt!==null;)if(l=vt,r=l.child,(l.subtreeFlags&1028)!==0&&r!==null)r.return=l,vt=r;else for(;vt!==null;){switch(l=vt,y=l.alternate,r=l.flags,l.tag){case 0:if((r&4)!==0&&(r=l.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)m=r[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&y!==null){r=void 0,c=l,m=y.memoizedProps,y=y.memoizedState,d=c.stateNode;try{var ee=Xr(c.type,m);r=d.getSnapshotBeforeUpdate(ee,y),d.__reactInternalSnapshotBeforeUpdate=r}catch(ue){Ue(c,c.return,ue)}}break;case 3:if((r&1024)!==0){if(r=l.stateNode.containerInfo,c=r.nodeType,c===9)Eh(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Eh(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=l.sibling,r!==null){r.return=l.return,vt=r;break}vt=l.return}}function db(r,l,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:yi(r,c),d&4&&eo(5,c);break;case 1:if(yi(r,c),d&4)if(r=c.stateNode,l===null)try{r.componentDidMount()}catch(x){Ue(c,c.return,x)}else{var m=Xr(c.type,l.memoizedProps);l=l.memoizedState;try{r.componentDidUpdate(m,l,r.__reactInternalSnapshotBeforeUpdate)}catch(x){Ue(c,c.return,x)}}d&64&&lb(c),d&512&&to(c,c.return);break;case 3:if(yi(r,c),d&64&&(r=c.updateQueue,r!==null)){if(l=null,c.child!==null)switch(c.child.tag){case 27:case 5:l=c.child.stateNode;break;case 1:l=c.child.stateNode}try{Wy(r,l)}catch(x){Ue(c,c.return,x)}}break;case 27:l===null&&d&4&&ub(c);case 26:case 5:yi(r,c),l===null&&d&4&&ab(c),d&512&&to(c,c.return);break;case 12:yi(r,c);break;case 31:yi(r,c),d&4&&mb(r,c);break;case 13:yi(r,c),d&4&&gb(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=HC.bind(null,c),iM(r,c))));break;case 22:if(d=c.memoizedState!==null||mi,!d){l=l!==null&&l.memoizedState!==null||ht,m=mi;var y=ht;mi=d,(ht=l)&&!y?bi(r,c,(c.subtreeFlags&8772)!==0):yi(r,c),mi=m,ht=y}break;case 30:break;default:yi(r,c)}}function hb(r){var l=r.alternate;l!==null&&(r.alternate=null,hb(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&Nf(l)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var tt=null,Gt=!1;function gi(r,l,c){for(c=c.child;c!==null;)pb(r,l,c),c=c.sibling}function pb(r,l,c){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(El,c)}catch{}switch(c.tag){case 26:ht||Pn(c,l),gi(r,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:ht||Pn(c,l);var d=tt,m=Gt;ir(c.type)&&(tt=c.stateNode,Gt=!1),gi(r,l,c),uo(c.stateNode),tt=d,Gt=m;break;case 5:ht||Pn(c,l);case 6:if(d=tt,m=Gt,tt=null,gi(r,l,c),tt=d,Gt=m,tt!==null)if(Gt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(c.stateNode)}catch(y){Ue(c,l,y)}else try{tt.removeChild(c.stateNode)}catch(y){Ue(c,l,y)}break;case 18:tt!==null&&(Gt?(r=tt,lv(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),rl(r)):lv(tt,c.stateNode));break;case 4:d=tt,m=Gt,tt=c.stateNode.containerInfo,Gt=!0,gi(r,l,c),tt=d,Gt=m;break;case 0:case 11:case 14:case 15:Wi(2,c,l),ht||Wi(4,c,l),gi(r,l,c);break;case 1:ht||(Pn(c,l),d=c.stateNode,typeof d.componentWillUnmount=="function"&&ob(c,l,d)),gi(r,l,c);break;case 21:gi(r,l,c);break;case 22:ht=(d=ht)||c.memoizedState!==null,gi(r,l,c),ht=d;break;default:gi(r,l,c)}}function mb(r,l){if(l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{rl(r)}catch(c){Ue(l,l.return,c)}}}function gb(r,l){if(l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{rl(r)}catch(c){Ue(l,l.return,c)}}function OC(r){switch(r.tag){case 31:case 13:case 19:var l=r.stateNode;return l===null&&(l=r.stateNode=new fb),l;case 22:return r=r.stateNode,l=r._retryCache,l===null&&(l=r._retryCache=new fb),l;default:throw Error(i(435,r.tag))}}function ec(r,l){var c=OC(r);l.forEach(function(d){if(!c.has(d)){c.add(d);var m=UC.bind(null,r,d);d.then(m,m)}})}function Yt(r,l){var c=l.deletions;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d],y=r,x=l,T=x;e:for(;T!==null;){switch(T.tag){case 27:if(ir(T.type)){tt=T.stateNode,Gt=!1;break e}break;case 5:tt=T.stateNode,Gt=!1;break e;case 3:case 4:tt=T.stateNode.containerInfo,Gt=!0;break e}T=T.return}if(tt===null)throw Error(i(160));pb(y,x,m),tt=null,Gt=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)yb(l,r),l=l.sibling}var Ln=null;function yb(r,l){var c=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Yt(l,r),Xt(r),d&4&&(Wi(3,r,r.return),eo(3,r),Wi(5,r,r.return));break;case 1:Yt(l,r),Xt(r),d&512&&(ht||c===null||Pn(c,c.return)),d&64&&mi&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var m=Ln;if(Yt(l,r),Xt(r),d&512&&(ht||c===null||Pn(c,c.return)),d&4){var y=c!==null?c.memoizedState:null;if(d=r.memoizedState,c===null)if(d===null)if(r.stateNode===null){e:{d=r.type,c=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":y=m.getElementsByTagName("title")[0],(!y||y[Al]||y[Tt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(d),m.head.insertBefore(y,m.querySelector("head > title"))),At(y,d,c),y[Tt]=r,bt(y),d=y;break e;case"link":var x=yv("link","href",m).get(d+(c.href||""));if(x){for(var T=0;T<x.length;T++)if(y=x[T],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){x.splice(T,1);break t}}y=m.createElement(d),At(y,d,c),m.head.appendChild(y);break;case"meta":if(x=yv("meta","content",m).get(d+(c.content||""))){for(T=0;T<x.length;T++)if(y=x[T],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){x.splice(T,1);break t}}y=m.createElement(d),At(y,d,c),m.head.appendChild(y);break;default:throw Error(i(468,d))}y[Tt]=r,bt(y),d=y}r.stateNode=d}else bv(m,r.type,r.stateNode);else r.stateNode=gv(m,d,r.memoizedProps);else y!==d?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,d===null?bv(m,r.type,r.stateNode):gv(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Qd(r,r.memoizedProps,c.memoizedProps)}break;case 27:Yt(l,r),Xt(r),d&512&&(ht||c===null||Pn(c,c.return)),c!==null&&d&4&&Qd(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Yt(l,r),Xt(r),d&512&&(ht||c===null||Pn(c,c.return)),r.flags&32){m=r.stateNode;try{Ms(m,"")}catch(ee){Ue(r,r.return,ee)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Qd(r,m,c!==null?c.memoizedProps:m)),d&1024&&(eh=!0);break;case 6:if(Yt(l,r),Xt(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,c=r.stateNode;try{c.nodeValue=d}catch(ee){Ue(r,r.return,ee)}}break;case 3:if(gc=null,m=Ln,Ln=pc(l.containerInfo),Yt(l,r),Ln=m,Xt(r),d&4&&c!==null&&c.memoizedState.isDehydrated)try{rl(l.containerInfo)}catch(ee){Ue(r,r.return,ee)}eh&&(eh=!1,bb(r));break;case 4:d=Ln,Ln=pc(r.stateNode.containerInfo),Yt(l,r),Xt(r),Ln=d;break;case 12:Yt(l,r),Xt(r);break;case 31:Yt(l,r),Xt(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ec(r,d)));break;case 13:Yt(l,r),Xt(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(nc=en()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ec(r,d)));break;case 22:m=r.memoizedState!==null;var M=c!==null&&c.memoizedState!==null,z=mi,$=ht;if(mi=z||m,ht=$||M,Yt(l,r),ht=$,mi=z,Xt(r),d&8192)e:for(l=r.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(c===null||M||mi||ht||Fr(r)),c=null,l=r;;){if(l.tag===5||l.tag===26){if(c===null){M=c=l;try{if(y=M.stateNode,m)x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{T=M.stateNode;var P=M.memoizedProps.style,_=P!=null&&P.hasOwnProperty("display")?P.display:null;T.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(ee){Ue(M,M.return,ee)}}}else if(l.tag===6){if(c===null){M=l;try{M.stateNode.nodeValue=m?"":M.memoizedProps}catch(ee){Ue(M,M.return,ee)}}}else if(l.tag===18){if(c===null){M=l;try{var U=M.stateNode;m?ov(U,!0):ov(M.stateNode,!1)}catch(ee){Ue(M,M.return,ee)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===r)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break e;for(;l.sibling===null;){if(l.return===null||l.return===r)break e;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}d&4&&(d=r.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,ec(r,c))));break;case 19:Yt(l,r),Xt(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ec(r,d)));break;case 30:break;case 21:break;default:Yt(l,r),Xt(r)}}function Xt(r){var l=r.flags;if(l&2){try{for(var c,d=r.return;d!==null;){if(cb(d)){c=d;break}d=d.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,y=Jd(r);Za(r,y,m);break;case 5:var x=c.stateNode;c.flags&32&&(Ms(x,""),c.flags&=-33);var T=Jd(r);Za(r,T,x);break;case 3:case 4:var M=c.stateNode.containerInfo,z=Jd(r);Zd(r,z,M);break;default:throw Error(i(161))}}catch($){Ue(r,r.return,$)}r.flags&=-3}l&4096&&(r.flags&=-4097)}function bb(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var l=r;bb(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),r=r.sibling}}function yi(r,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)db(r,l.alternate,l),l=l.sibling}function Fr(r){for(r=r.child;r!==null;){var l=r;switch(l.tag){case 0:case 11:case 14:case 15:Wi(4,l,l.return),Fr(l);break;case 1:Pn(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&ob(l,l.return,c),Fr(l);break;case 27:uo(l.stateNode);case 26:case 5:Pn(l,l.return),Fr(l);break;case 22:l.memoizedState===null&&Fr(l);break;case 30:Fr(l);break;default:Fr(l)}r=r.sibling}}function bi(r,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var d=l.alternate,m=r,y=l,x=y.flags;switch(y.tag){case 0:case 11:case 15:bi(m,y,c),eo(4,y);break;case 1:if(bi(m,y,c),d=y,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(z){Ue(d,d.return,z)}if(d=y,m=d.updateQueue,m!==null){var T=d.stateNode;try{var M=m.shared.hiddenCallbacks;if(M!==null)for(m.shared.hiddenCallbacks=null,m=0;m<M.length;m++)Fy(M[m],T)}catch(z){Ue(d,d.return,z)}}c&&x&64&&lb(y),to(y,y.return);break;case 27:ub(y);case 26:case 5:bi(m,y,c),c&&d===null&&x&4&&ab(y),to(y,y.return);break;case 12:bi(m,y,c);break;case 31:bi(m,y,c),c&&x&4&&mb(m,y);break;case 13:bi(m,y,c),c&&x&4&&gb(m,y);break;case 22:y.memoizedState===null&&bi(m,y,c),to(y,y.return);break;case 30:break;default:bi(m,y,c)}l=l.sibling}}function th(r,l){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(r=l.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&Vl(c))}function nh(r,l){r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&Vl(r))}function _n(r,l,c,d){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)vb(r,l,c,d),l=l.sibling}function vb(r,l,c,d){var m=l.flags;switch(l.tag){case 0:case 11:case 15:_n(r,l,c,d),m&2048&&eo(9,l);break;case 1:_n(r,l,c,d);break;case 3:_n(r,l,c,d),m&2048&&(r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&Vl(r)));break;case 12:if(m&2048){_n(r,l,c,d),r=l.stateNode;try{var y=l.memoizedProps,x=y.id,T=y.onPostCommit;typeof T=="function"&&T(x,l.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(M){Ue(l,l.return,M)}}else _n(r,l,c,d);break;case 31:_n(r,l,c,d);break;case 13:_n(r,l,c,d);break;case 23:break;case 22:y=l.stateNode,x=l.alternate,l.memoizedState!==null?y._visibility&2?_n(r,l,c,d):no(r,l):y._visibility&2?_n(r,l,c,d):(y._visibility|=2,Ys(r,l,c,d,(l.subtreeFlags&10256)!==0||!1)),m&2048&&th(x,l);break;case 24:_n(r,l,c,d),m&2048&&nh(l.alternate,l);break;default:_n(r,l,c,d)}}function Ys(r,l,c,d,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var y=r,x=l,T=c,M=d,z=x.flags;switch(x.tag){case 0:case 11:case 15:Ys(y,x,T,M,m),eo(8,x);break;case 23:break;case 22:var $=x.stateNode;x.memoizedState!==null?$._visibility&2?Ys(y,x,T,M,m):no(y,x):($._visibility|=2,Ys(y,x,T,M,m)),m&&z&2048&&th(x.alternate,x);break;case 24:Ys(y,x,T,M,m),m&&z&2048&&nh(x.alternate,x);break;default:Ys(y,x,T,M,m)}l=l.sibling}}function no(r,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=r,d=l,m=d.flags;switch(d.tag){case 22:no(c,d),m&2048&&th(d.alternate,d);break;case 24:no(c,d),m&2048&&nh(d.alternate,d);break;default:no(c,d)}l=l.sibling}}var io=8192;function Xs(r,l,c){if(r.subtreeFlags&io)for(r=r.child;r!==null;)Sb(r,l,c),r=r.sibling}function Sb(r,l,c){switch(r.tag){case 26:Xs(r,l,c),r.flags&io&&r.memoizedState!==null&&mM(c,Ln,r.memoizedState,r.memoizedProps);break;case 5:Xs(r,l,c);break;case 3:case 4:var d=Ln;Ln=pc(r.stateNode.containerInfo),Xs(r,l,c),Ln=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=io,io=16777216,Xs(r,l,c),io=d):Xs(r,l,c));break;default:Xs(r,l,c)}}function xb(r){var l=r.alternate;if(l!==null&&(r=l.child,r!==null)){l.child=null;do l=r.sibling,r.sibling=null,r=l;while(r!==null)}}function ro(r){var l=r.deletions;if((r.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var d=l[c];vt=d,kb(d,r)}xb(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)wb(r),r=r.sibling}function wb(r){switch(r.tag){case 0:case 11:case 15:ro(r),r.flags&2048&&Wi(9,r,r.return);break;case 3:ro(r);break;case 12:ro(r);break;case 22:var l=r.stateNode;r.memoizedState!==null&&l._visibility&2&&(r.return===null||r.return.tag!==13)?(l._visibility&=-3,tc(r)):ro(r);break;default:ro(r)}}function tc(r){var l=r.deletions;if((r.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var d=l[c];vt=d,kb(d,r)}xb(r)}for(r=r.child;r!==null;){switch(l=r,l.tag){case 0:case 11:case 15:Wi(8,l,l.return),tc(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,tc(l));break;default:tc(l)}r=r.sibling}}function kb(r,l){for(;vt!==null;){var c=vt;switch(c.tag){case 0:case 11:case 15:Wi(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Vl(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,vt=d;else e:for(c=r;vt!==null;){d=vt;var m=d.sibling,y=d.return;if(hb(d),d===c){vt=null;break e}if(m!==null){m.return=y,vt=m;break e}vt=y}}}var NC={getCacheForType:function(r){var l=Ct(ut),c=l.data.get(r);return c===void 0&&(c=r(),l.data.set(r,c)),c},cacheSignal:function(){return Ct(ut).controller.signal}},RC=typeof WeakMap=="function"?WeakMap:Map,Le=0,qe=null,Te=null,Ce=0,He=0,an=null,Qi=!1,Fs=!1,ih=!1,vi=0,rt=0,Ji=0,Wr=0,rh=0,cn=0,Ws=0,so=null,Ft=null,sh=!1,nc=0,Tb=0,ic=1/0,rc=null,Zi=null,yt=0,er=null,Qs=null,Si=0,lh=0,oh=null,Eb=null,lo=0,ah=null;function un(){return(Le&2)!==0&&Ce!==0?Ce&-Ce:B.T!==null?ph():Vg()}function Cb(){if(cn===0)if((Ce&536870912)===0||Ne){var r=da;da<<=1,(da&3932160)===0&&(da=262144),cn=r}else cn=536870912;return r=ln.current,r!==null&&(r.flags|=32),cn}function Wt(r,l,c){(r===qe&&(He===2||He===9)||r.cancelPendingCommit!==null)&&(Js(r,0),tr(r,Ce,cn,!1)),Ml(r,c),((Le&2)===0||r!==qe)&&(r===qe&&((Le&2)===0&&(Wr|=c),rt===4&&tr(r,Ce,cn,!1)),Kn(r))}function Mb(r,l,c){if((Le&6)!==0)throw Error(i(327));var d=!c&&(l&127)===0&&(l&r.expiredLanes)===0||Cl(r,l),m=d?LC(r,l):uh(r,l,!0),y=d;do{if(m===0){Fs&&!d&&tr(r,l,0,!1);break}else{if(c=r.current.alternate,y&&!DC(c)){m=uh(r,l,!1),y=!1;continue}if(m===2){if(y=l,r.errorRecoveryDisabledLanes&y)var x=0;else x=r.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){l=x;e:{var T=r;m=so;var M=T.current.memoizedState.isDehydrated;if(M&&(Js(T,x).flags|=256),x=uh(T,x,!1),x!==2){if(ih&&!M){T.errorRecoveryDisabledLanes|=y,Wr|=y,m=4;break e}y=Ft,Ft=m,y!==null&&(Ft===null?Ft=y:Ft.push.apply(Ft,y))}m=x}if(y=!1,m!==2)continue}}if(m===1){Js(r,0),tr(r,l,0,!0);break}e:{switch(d=r,y=m,y){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:tr(d,l,cn,!Qi);break e;case 2:Ft=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(m=nc+300-en(),10<m)){if(tr(d,l,cn,!Qi),pa(d,0,!0)!==0)break e;Si=l,d.timeoutHandle=rv(Ab.bind(null,d,c,Ft,rc,sh,l,cn,Wr,Ws,Qi,y,"Throttled",-0,0),m);break e}Ab(d,c,Ft,rc,sh,l,cn,Wr,Ws,Qi,y,null,-0,0)}}break}while(!0);Kn(r)}function Ab(r,l,c,d,m,y,x,T,M,z,$,P,_,U){if(r.timeoutHandle=-1,P=l.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:si},Sb(l,y,P);var ee=(y&62914560)===y?nc-en():(y&4194048)===y?Tb-en():0;if(ee=gM(P,ee),ee!==null){Si=y,r.cancelPendingCommit=ee(Bb.bind(null,r,l,y,c,d,m,x,T,M,$,P,null,_,U)),tr(r,y,x,!z);return}}Bb(r,l,y,c,d,m,x,T,M)}function DC(r){for(var l=r;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var m=c[d],y=m.getSnapshot;m=m.value;try{if(!rn(y(),m))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function tr(r,l,c,d){l&=~rh,l&=~Wr,r.suspendedLanes|=l,r.pingedLanes&=~l,d&&(r.warmLanes|=l),d=r.expirationTimes;for(var m=l;0<m;){var y=31-nn(m),x=1<<y;d[y]=-1,m&=~x}c!==0&&Ug(r,c,l)}function sc(){return(Le&6)===0?(oo(0),!1):!0}function ch(){if(Te!==null){if(He===0)var r=Te.return;else r=Te,ci=Vr=null,Ed(r),$s=null,ql=0,r=Te;for(;r!==null;)sb(r.alternate,r),r=r.return;Te=null}}function Js(r,l){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,JC(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Si=0,ch(),qe=r,Te=c=oi(r.current,null),Ce=l,He=0,an=null,Qi=!1,Fs=Cl(r,l),ih=!1,Ws=cn=rh=Wr=Ji=rt=0,Ft=so=null,sh=!1,(l&8)!==0&&(l|=l&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=l;0<d;){var m=31-nn(d),y=1<<m;l|=r[m],d&=~y}return vi=l,Ca(),c}function Ob(r,l){be=null,B.H=Ql,l===Vs||l===La?(l=Ky(),He=3):l===hd?(l=Ky(),He=4):He=l===Vd?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,an=l,Te===null&&(rt=1,Xa(r,vn(l,r.current)))}function Nb(){var r=ln.current;return r===null?!0:(Ce&4194048)===Ce?kn===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?r===kn:!1}function Rb(){var r=B.H;return B.H=Ql,r===null?Ql:r}function Db(){var r=B.A;return B.A=NC,r}function lc(){rt=4,Qi||(Ce&4194048)!==Ce&&ln.current!==null||(Fs=!0),(Ji&134217727)===0&&(Wr&134217727)===0||qe===null||tr(qe,Ce,cn,!1)}function uh(r,l,c){var d=Le;Le|=2;var m=Rb(),y=Db();(qe!==r||Ce!==l)&&(rc=null,Js(r,l)),l=!1;var x=rt;e:do try{if(He!==0&&Te!==null){var T=Te,M=an;switch(He){case 8:ch(),x=6;break e;case 3:case 2:case 9:case 6:ln.current===null&&(l=!0);var z=He;if(He=0,an=null,Zs(r,T,M,z),c&&Fs){x=0;break e}break;default:z=He,He=0,an=null,Zs(r,T,M,z)}}zC(),x=rt;break}catch($){Ob(r,$)}while(!0);return l&&r.shellSuspendCounter++,ci=Vr=null,Le=d,B.H=m,B.A=y,Te===null&&(qe=null,Ce=0,Ca()),x}function zC(){for(;Te!==null;)zb(Te)}function LC(r,l){var c=Le;Le|=2;var d=Rb(),m=Db();qe!==r||Ce!==l?(rc=null,ic=en()+500,Js(r,l)):Fs=Cl(r,l);e:do try{if(He!==0&&Te!==null){l=Te;var y=an;t:switch(He){case 1:He=0,an=null,Zs(r,l,y,1);break;case 2:case 9:if(qy(y)){He=0,an=null,Lb(l);break}l=function(){He!==2&&He!==9||qe!==r||(He=7),Kn(r)},y.then(l,l);break e;case 3:He=7;break e;case 4:He=5;break e;case 7:qy(y)?(He=0,an=null,Lb(l)):(He=0,an=null,Zs(r,l,y,7));break;case 5:var x=null;switch(Te.tag){case 26:x=Te.memoizedState;case 5:case 27:var T=Te;if(x?vv(x):T.stateNode.complete){He=0,an=null;var M=T.sibling;if(M!==null)Te=M;else{var z=T.return;z!==null?(Te=z,oc(z)):Te=null}break t}}He=0,an=null,Zs(r,l,y,5);break;case 6:He=0,an=null,Zs(r,l,y,6);break;case 8:ch(),rt=6;break e;default:throw Error(i(462))}}_C();break}catch($){Ob(r,$)}while(!0);return ci=Vr=null,B.H=d,B.A=m,Le=c,Te!==null?0:(qe=null,Ce=0,Ca(),rt)}function _C(){for(;Te!==null&&!rE();)zb(Te)}function zb(r){var l=ib(r.alternate,r,vi);r.memoizedProps=r.pendingProps,l===null?oc(r):Te=l}function Lb(r){var l=r,c=l.alternate;switch(l.tag){case 15:case 0:l=Q0(c,l,l.pendingProps,l.type,void 0,Ce);break;case 11:l=Q0(c,l,l.pendingProps,l.type.render,l.ref,Ce);break;case 5:Ed(l);default:sb(c,l),l=Te=Dy(l,vi),l=ib(c,l,vi)}r.memoizedProps=r.pendingProps,l===null?oc(r):Te=l}function Zs(r,l,c,d){ci=Vr=null,Ed(l),$s=null,ql=0;var m=l.return;try{if(kC(r,m,l,c,Ce)){rt=1,Xa(r,vn(c,r.current)),Te=null;return}}catch(y){if(m!==null)throw Te=m,y;rt=1,Xa(r,vn(c,r.current)),Te=null;return}l.flags&32768?(Ne||d===1?r=!0:Fs||(Ce&536870912)!==0?r=!1:(Qi=r=!0,(d===2||d===9||d===3||d===6)&&(d=ln.current,d!==null&&d.tag===13&&(d.flags|=16384))),_b(l,r)):oc(l)}function oc(r){var l=r;do{if((l.flags&32768)!==0){_b(l,Qi);return}r=l.return;var c=CC(l.alternate,l,vi);if(c!==null){Te=c;return}if(l=l.sibling,l!==null){Te=l;return}Te=l=r}while(l!==null);rt===0&&(rt=5)}function _b(r,l){do{var c=MC(r.alternate,r);if(c!==null){c.flags&=32767,Te=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(r=r.sibling,r!==null)){Te=r;return}Te=r=c}while(r!==null);rt=6,Te=null}function Bb(r,l,c,d,m,y,x,T,M){r.cancelPendingCommit=null;do ac();while(yt!==0);if((Le&6)!==0)throw Error(i(327));if(l!==null){if(l===r.current)throw Error(i(177));if(y=l.lanes|l.childLanes,y|=Jf,pE(r,c,y,x,T,M),r===qe&&(Te=qe=null,Ce=0),Qs=l,er=r,Si=c,lh=y,oh=m,Eb=d,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,jC(ua,function(){return Vb(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||d){d=B.T,B.T=null,m=Y.p,Y.p=2,x=Le,Le|=4;try{AC(r,l,c)}finally{Le=x,Y.p=m,B.T=d}}yt=1,Hb(),Ub(),jb()}}function Hb(){if(yt===1){yt=0;var r=er,l=Qs,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=B.T,B.T=null;var d=Y.p;Y.p=2;var m=Le;Le|=4;try{yb(l,r);var y=wh,x=ky(r.containerInfo),T=y.focusedElem,M=y.selectionRange;if(x!==T&&T&&T.ownerDocument&&wy(T.ownerDocument.documentElement,T)){if(M!==null&&Yf(T)){var z=M.start,$=M.end;if($===void 0&&($=z),"selectionStart"in T)T.selectionStart=z,T.selectionEnd=Math.min($,T.value.length);else{var P=T.ownerDocument||document,_=P&&P.defaultView||window;if(_.getSelection){var U=_.getSelection(),ee=T.textContent.length,ue=Math.min(M.start,ee),$e=M.end===void 0?ue:Math.min(M.end,ee);!U.extend&&ue>$e&&(x=$e,$e=ue,ue=x);var R=xy(T,ue),A=xy(T,$e);if(R&&A&&(U.rangeCount!==1||U.anchorNode!==R.node||U.anchorOffset!==R.offset||U.focusNode!==A.node||U.focusOffset!==A.offset)){var D=P.createRange();D.setStart(R.node,R.offset),U.removeAllRanges(),ue>$e?(U.addRange(D),U.extend(A.node,A.offset)):(D.setEnd(A.node,A.offset),U.addRange(D))}}}}for(P=[],U=T;U=U.parentNode;)U.nodeType===1&&P.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<P.length;T++){var q=P[T];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}Sc=!!xh,wh=xh=null}finally{Le=m,Y.p=d,B.T=c}}r.current=l,yt=2}}function Ub(){if(yt===2){yt=0;var r=er,l=Qs,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=B.T,B.T=null;var d=Y.p;Y.p=2;var m=Le;Le|=4;try{db(r,l.alternate,l)}finally{Le=m,Y.p=d,B.T=c}}yt=3}}function jb(){if(yt===4||yt===3){yt=0,sE();var r=er,l=Qs,c=Si,d=Eb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?yt=5:(yt=0,Qs=er=null,Ib(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(Zi=null),Af(c),l=l.stateNode,tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(El,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=B.T,m=Y.p,Y.p=2,B.T=null;try{for(var y=r.onRecoverableError,x=0;x<d.length;x++){var T=d[x];y(T.value,{componentStack:T.stack})}}finally{B.T=l,Y.p=m}}(Si&3)!==0&&ac(),Kn(r),m=r.pendingLanes,(c&261930)!==0&&(m&42)!==0?r===ah?lo++:(lo=0,ah=r):lo=0,oo(0)}}function Ib(r,l){(r.pooledCacheLanes&=l)===0&&(l=r.pooledCache,l!=null&&(r.pooledCache=null,Vl(l)))}function ac(){return Hb(),Ub(),jb(),Vb()}function Vb(){if(yt!==5)return!1;var r=er,l=lh;lh=0;var c=Af(Si),d=B.T,m=Y.p;try{Y.p=32>c?32:c,B.T=null,c=oh,oh=null;var y=er,x=Si;if(yt=0,Qs=er=null,Si=0,(Le&6)!==0)throw Error(i(331));var T=Le;if(Le|=4,wb(y.current),vb(y,y.current,x,c),Le=T,oo(0,!1),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(El,y)}catch{}return!0}finally{Y.p=m,B.T=d,Ib(r,l)}}function $b(r,l,c){l=vn(c,l),l=Id(r.stateNode,l,2),r=Yi(r,l,2),r!==null&&(Ml(r,2),Kn(r))}function Ue(r,l,c){if(r.tag===3)$b(r,r,c);else for(;l!==null;){if(l.tag===3){$b(l,r,c);break}else if(l.tag===1){var d=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Zi===null||!Zi.has(d))){r=vn(c,r),c=q0(2),d=Yi(l,c,2),d!==null&&(P0(c,d,l,r),Ml(d,2),Kn(d));break}}l=l.return}}function fh(r,l,c){var d=r.pingCache;if(d===null){d=r.pingCache=new RC;var m=new Set;d.set(l,m)}else m=d.get(l),m===void 0&&(m=new Set,d.set(l,m));m.has(c)||(ih=!0,m.add(c),r=BC.bind(null,r,l,c),l.then(r,r))}function BC(r,l,c){var d=r.pingCache;d!==null&&d.delete(l),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,qe===r&&(Ce&c)===c&&(rt===4||rt===3&&(Ce&62914560)===Ce&&300>en()-nc?(Le&2)===0&&Js(r,0):rh|=c,Ws===Ce&&(Ws=0)),Kn(r)}function qb(r,l){l===0&&(l=Hg()),r=Ur(r,l),r!==null&&(Ml(r,l),Kn(r))}function HC(r){var l=r.memoizedState,c=0;l!==null&&(c=l.retryLane),qb(r,c)}function UC(r,l){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(c=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(l),qb(r,c)}function jC(r,l){return Tf(r,l)}var cc=null,el=null,dh=!1,uc=!1,hh=!1,nr=0;function Kn(r){r!==el&&r.next===null&&(el===null?cc=el=r:el=el.next=r),uc=!0,dh||(dh=!0,VC())}function oo(r,l){if(!hh&&uc){hh=!0;do for(var c=!1,d=cc;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var y=0;else{var x=d.suspendedLanes,T=d.pingedLanes;y=(1<<31-nn(42|r)+1)-1,y&=m&~(x&~T),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,Yb(d,y))}else y=Ce,y=pa(d,d===qe?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||Cl(d,y)||(c=!0,Yb(d,y));d=d.next}while(c);hh=!1}}function IC(){Pb()}function Pb(){uc=dh=!1;var r=0;nr!==0&&QC()&&(r=nr);for(var l=en(),c=null,d=cc;d!==null;){var m=d.next,y=Kb(d,l);y===0?(d.next=null,c===null?cc=m:c.next=m,m===null&&(el=c)):(c=d,(r!==0||(y&3)!==0)&&(uc=!0)),d=m}yt!==0&&yt!==5||oo(r),nr!==0&&(nr=0)}function Kb(r,l){for(var c=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var x=31-nn(y),T=1<<x,M=m[x];M===-1?((T&c)===0||(T&d)!==0)&&(m[x]=hE(T,l)):M<=l&&(r.expiredLanes|=T),y&=~T}if(l=qe,c=Ce,c=pa(r,r===l?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===l&&(He===2||He===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Ef(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||Cl(r,c)){if(l=c&-c,l===r.callbackPriority)return l;switch(d!==null&&Ef(d),Af(c)){case 2:case 8:c=_g;break;case 32:c=ua;break;case 268435456:c=Bg;break;default:c=ua}return d=Gb.bind(null,r),c=Tf(c,d),r.callbackPriority=l,r.callbackNode=c,l}return d!==null&&d!==null&&Ef(d),r.callbackPriority=2,r.callbackNode=null,2}function Gb(r,l){if(yt!==0&&yt!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(ac()&&r.callbackNode!==c)return null;var d=Ce;return d=pa(r,r===qe?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Mb(r,d,l),Kb(r,en()),r.callbackNode!=null&&r.callbackNode===c?Gb.bind(null,r):null)}function Yb(r,l){if(ac())return null;Mb(r,l,!0)}function VC(){ZC(function(){(Le&6)!==0?Tf(Lg,IC):Pb()})}function ph(){if(nr===0){var r=js;r===0&&(r=fa,fa<<=1,(fa&261888)===0&&(fa=256)),nr=r}return nr}function Xb(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:ba(""+r)}function Fb(r,l){var c=l.ownerDocument.createElement("input");return c.name=l.name,c.value=l.value,r.id&&c.setAttribute("form",r.id),l.parentNode.insertBefore(c,l),r=new FormData(r),c.parentNode.removeChild(c),r}function $C(r,l,c,d,m){if(l==="submit"&&c&&c.stateNode===m){var y=Xb((m[Pt]||null).action),x=d.submitter;x&&(l=(l=x[Pt]||null)?Xb(l.formAction):x.getAttribute("formAction"),l!==null&&(y=l,x=null));var T=new wa("action","action",null,d,m);r.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(nr!==0){var M=x?Fb(m,x):new FormData(m);Ld(c,{pending:!0,data:M,method:m.method,action:y},null,M)}}else typeof y=="function"&&(T.preventDefault(),M=x?Fb(m,x):new FormData(m),Ld(c,{pending:!0,data:M,method:m.method,action:y},y,M))},currentTarget:m}]})}}for(var mh=0;mh<Qf.length;mh++){var gh=Qf[mh],qC=gh.toLowerCase(),PC=gh[0].toUpperCase()+gh.slice(1);zn(qC,"on"+PC)}zn(Cy,"onAnimationEnd"),zn(My,"onAnimationIteration"),zn(Ay,"onAnimationStart"),zn("dblclick","onDoubleClick"),zn("focusin","onFocus"),zn("focusout","onBlur"),zn(lC,"onTransitionRun"),zn(oC,"onTransitionStart"),zn(aC,"onTransitionCancel"),zn(Oy,"onTransitionEnd"),Es("onMouseEnter",["mouseout","mouseover"]),Es("onMouseLeave",["mouseout","mouseover"]),Es("onPointerEnter",["pointerout","pointerover"]),Es("onPointerLeave",["pointerout","pointerover"]),Lr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Lr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Lr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Lr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Lr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Lr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ao="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(" "),KC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ao));function Wb(r,l){l=(l&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],m=d.event;d=d.listeners;e:{var y=void 0;if(l)for(var x=d.length-1;0<=x;x--){var T=d[x],M=T.instance,z=T.currentTarget;if(T=T.listener,M!==y&&m.isPropagationStopped())break e;y=T,m.currentTarget=z;try{y(m)}catch($){Ea($)}m.currentTarget=null,y=M}else for(x=0;x<d.length;x++){if(T=d[x],M=T.instance,z=T.currentTarget,T=T.listener,M!==y&&m.isPropagationStopped())break e;y=T,m.currentTarget=z;try{y(m)}catch($){Ea($)}m.currentTarget=null,y=M}}}}function Ee(r,l){var c=l[Of];c===void 0&&(c=l[Of]=new Set);var d=r+"__bubble";c.has(d)||(Qb(l,r,2,!1),c.add(d))}function yh(r,l,c){var d=0;l&&(d|=4),Qb(c,r,d,l)}var fc="_reactListening"+Math.random().toString(36).slice(2);function bh(r){if(!r[fc]){r[fc]=!0,Pg.forEach(function(c){c!=="selectionchange"&&(KC.has(c)||yh(c,!1,r),yh(c,!0,r))});var l=r.nodeType===9?r:r.ownerDocument;l===null||l[fc]||(l[fc]=!0,yh("selectionchange",!1,l))}}function Qb(r,l,c,d){switch(Cv(l)){case 2:var m=vM;break;case 8:m=SM;break;default:m=zh}c=m.bind(null,l,c,r),m=void 0,!Uf||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(l,c,{capture:!0,passive:m}):r.addEventListener(l,c,!0):m!==void 0?r.addEventListener(l,c,{passive:m}):r.addEventListener(l,c,!1)}function vh(r,l,c,d,m){var y=d;if((l&1)===0&&(l&2)===0&&d!==null)e:for(;;){if(d===null)return;var x=d.tag;if(x===3||x===4){var T=d.stateNode.containerInfo;if(T===m)break;if(x===4)for(x=d.return;x!==null;){var M=x.tag;if((M===3||M===4)&&x.stateNode.containerInfo===m)return;x=x.return}for(;T!==null;){if(x=ws(T),x===null)return;if(M=x.tag,M===5||M===6||M===26||M===27){d=y=x;continue e}T=T.parentNode}}d=d.return}ny(function(){var z=y,$=Bf(c),P=[];e:{var _=Ny.get(r);if(_!==void 0){var U=wa,ee=r;switch(r){case"keypress":if(Sa(c)===0)break e;case"keydown":case"keyup":U=UE;break;case"focusin":ee="focus",U=$f;break;case"focusout":ee="blur",U=$f;break;case"beforeblur":case"afterblur":U=$f;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=sy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=CE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=VE;break;case Cy:case My:case Ay:U=OE;break;case Oy:U=qE;break;case"scroll":case"scrollend":U=TE;break;case"wheel":U=KE;break;case"copy":case"cut":case"paste":U=RE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=oy;break;case"toggle":case"beforetoggle":U=YE}var ue=(l&4)!==0,$e=!ue&&(r==="scroll"||r==="scrollend"),R=ue?_!==null?_+"Capture":null:_;ue=[];for(var A=z,D;A!==null;){var q=A;if(D=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||D===null||R===null||(q=Nl(A,R),q!=null&&ue.push(co(A,q,D))),$e)break;A=A.return}0<ue.length&&(_=new U(_,ee,null,c,$),P.push({event:_,listeners:ue}))}}if((l&7)===0){e:{if(_=r==="mouseover"||r==="pointerover",U=r==="mouseout"||r==="pointerout",_&&c!==_f&&(ee=c.relatedTarget||c.fromElement)&&(ws(ee)||ee[xs]))break e;if((U||_)&&(_=$.window===$?$:(_=$.ownerDocument)?_.defaultView||_.parentWindow:window,U?(ee=c.relatedTarget||c.toElement,U=z,ee=ee?ws(ee):null,ee!==null&&($e=o(ee),ue=ee.tag,ee!==$e||ue!==5&&ue!==27&&ue!==6)&&(ee=null)):(U=null,ee=z),U!==ee)){if(ue=sy,q="onMouseLeave",R="onMouseEnter",A="mouse",(r==="pointerout"||r==="pointerover")&&(ue=oy,q="onPointerLeave",R="onPointerEnter",A="pointer"),$e=U==null?_:Ol(U),D=ee==null?_:Ol(ee),_=new ue(q,A+"leave",U,c,$),_.target=$e,_.relatedTarget=D,q=null,ws($)===z&&(ue=new ue(R,A+"enter",ee,c,$),ue.target=D,ue.relatedTarget=$e,q=ue),$e=q,U&&ee)t:{for(ue=GC,R=U,A=ee,D=0,q=R;q;q=ue(q))D++;q=0;for(var ae=A;ae;ae=ue(ae))q++;for(;0<D-q;)R=ue(R),D--;for(;0<q-D;)A=ue(A),q--;for(;D--;){if(R===A||A!==null&&R===A.alternate){ue=R;break t}R=ue(R),A=ue(A)}ue=null}else ue=null;U!==null&&Jb(P,_,U,ue,!1),ee!==null&&$e!==null&&Jb(P,$e,ee,ue,!0)}}e:{if(_=z?Ol(z):window,U=_.nodeName&&_.nodeName.toLowerCase(),U==="select"||U==="input"&&_.type==="file")var De=my;else if(hy(_))if(gy)De=iC;else{De=tC;var re=eC}else U=_.nodeName,!U||U.toLowerCase()!=="input"||_.type!=="checkbox"&&_.type!=="radio"?z&&Lf(z.elementType)&&(De=my):De=nC;if(De&&(De=De(r,z))){py(P,De,c,$);break e}re&&re(r,_,z),r==="focusout"&&z&&_.type==="number"&&z.memoizedProps.value!=null&&zf(_,"number",_.value)}switch(re=z?Ol(z):window,r){case"focusin":(hy(re)||re.contentEditable==="true")&&(Rs=re,Xf=z,Ul=null);break;case"focusout":Ul=Xf=Rs=null;break;case"mousedown":Ff=!0;break;case"contextmenu":case"mouseup":case"dragend":Ff=!1,Ty(P,c,$);break;case"selectionchange":if(sC)break;case"keydown":case"keyup":Ty(P,c,$)}var Se;if(Pf)e:{switch(r){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Ns?fy(r,c)&&(Me="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(Me="onCompositionStart");Me&&(ay&&c.locale!=="ko"&&(Ns||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Ns&&(Se=iy()):(Ii=$,jf="value"in Ii?Ii.value:Ii.textContent,Ns=!0)),re=dc(z,Me),0<re.length&&(Me=new ly(Me,r,null,c,$),P.push({event:Me,listeners:re}),Se?Me.data=Se:(Se=dy(c),Se!==null&&(Me.data=Se)))),(Se=FE?WE(r,c):QE(r,c))&&(Me=dc(z,"onBeforeInput"),0<Me.length&&(re=new ly("onBeforeInput","beforeinput",null,c,$),P.push({event:re,listeners:Me}),re.data=Se)),$C(P,r,z,c,$)}Wb(P,l)})}function co(r,l,c){return{instance:r,listener:l,currentTarget:c}}function dc(r,l){for(var c=l+"Capture",d=[];r!==null;){var m=r,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Nl(r,c),m!=null&&d.unshift(co(r,m,y)),m=Nl(r,l),m!=null&&d.push(co(r,m,y))),r.tag===3)return d;r=r.return}return[]}function GC(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Jb(r,l,c,d,m){for(var y=l._reactName,x=[];c!==null&&c!==d;){var T=c,M=T.alternate,z=T.stateNode;if(T=T.tag,M!==null&&M===d)break;T!==5&&T!==26&&T!==27||z===null||(M=z,m?(z=Nl(c,y),z!=null&&x.unshift(co(c,z,M))):m||(z=Nl(c,y),z!=null&&x.push(co(c,z,M)))),c=c.return}x.length!==0&&r.push({event:l,listeners:x})}var YC=/\r\n?/g,XC=/\u0000|\uFFFD/g;function Zb(r){return(typeof r=="string"?r:""+r).replace(YC,`
49
+ `).replace(XC,"")}function ev(r,l){return l=Zb(l),Zb(r)===l}function Ve(r,l,c,d,m,y){switch(c){case"children":typeof d=="string"?l==="body"||l==="textarea"&&d===""||Ms(r,d):(typeof d=="number"||typeof d=="bigint")&&l!=="body"&&Ms(r,""+d);break;case"className":ga(r,"class",d);break;case"tabIndex":ga(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ga(r,c,d);break;case"style":ey(r,d,y);break;case"data":if(l!=="object"){ga(r,"data",d);break}case"src":case"href":if(d===""&&(l!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=ba(""+d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(c==="formAction"?(l!=="input"&&Ve(r,l,"name",m.name,m,null),Ve(r,l,"formEncType",m.formEncType,m,null),Ve(r,l,"formMethod",m.formMethod,m,null),Ve(r,l,"formTarget",m.formTarget,m,null)):(Ve(r,l,"encType",m.encType,m,null),Ve(r,l,"method",m.method,m,null),Ve(r,l,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=ba(""+d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=si);break;case"onScroll":d!=null&&Ee("scroll",r);break;case"onScrollEnd":d!=null&&Ee("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}c=ba(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""+d):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":Ee("beforetoggle",r),Ee("toggle",r),ma(r,"popover",d);break;case"xlinkActuate":ri(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ri(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ri(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ri(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ri(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ri(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ri(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ri(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ri(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ma(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=wE.get(c)||c,ma(r,c,d))}}function Sh(r,l,c,d,m,y){switch(c){case"style":ey(r,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"children":typeof d=="string"?Ms(r,d):(typeof d=="number"||typeof d=="bigint")&&Ms(r,""+d);break;case"onScroll":d!=null&&Ee("scroll",r);break;case"onScrollEnd":d!=null&&Ee("scrollend",r);break;case"onClick":d!=null&&(r.onclick=si);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Kg.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),l=c.slice(2,m?c.length-7:void 0),y=r[Pt]||null,y=y!=null?y[c]:null,typeof y=="function"&&r.removeEventListener(l,y,m),typeof d=="function")){typeof y!="function"&&y!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(l,d,m);break e}c in r?r[c]=d:d===!0?r.setAttribute(c,""):ma(r,c,d)}}}function At(r,l,c){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",r),Ee("load",r);var d=!1,m=!1,y;for(y in c)if(c.hasOwnProperty(y)){var x=c[y];if(x!=null)switch(y){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Ve(r,l,y,x,c,null)}}m&&Ve(r,l,"srcSet",c.srcSet,c,null),d&&Ve(r,l,"src",c.src,c,null);return;case"input":Ee("invalid",r);var T=y=x=m=null,M=null,z=null;for(d in c)if(c.hasOwnProperty(d)){var $=c[d];if($!=null)switch(d){case"name":m=$;break;case"type":x=$;break;case"checked":M=$;break;case"defaultChecked":z=$;break;case"value":y=$;break;case"defaultValue":T=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(i(137,l));break;default:Ve(r,l,d,$,c,null)}}Wg(r,y,T,M,z,x,m,!1);return;case"select":Ee("invalid",r),d=x=y=null;for(m in c)if(c.hasOwnProperty(m)&&(T=c[m],T!=null))switch(m){case"value":y=T;break;case"defaultValue":x=T;break;case"multiple":d=T;default:Ve(r,l,m,T,c,null)}l=y,c=x,r.multiple=!!d,l!=null?Cs(r,!!d,l,!1):c!=null&&Cs(r,!!d,c,!0);return;case"textarea":Ee("invalid",r),y=m=d=null;for(x in c)if(c.hasOwnProperty(x)&&(T=c[x],T!=null))switch(x){case"value":d=T;break;case"defaultValue":m=T;break;case"children":y=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:Ve(r,l,x,T,c,null)}Jg(r,d,m,y);return;case"option":for(M in c)if(c.hasOwnProperty(M)&&(d=c[M],d!=null))switch(M){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Ve(r,l,M,d,c,null)}return;case"dialog":Ee("beforetoggle",r),Ee("toggle",r),Ee("cancel",r),Ee("close",r);break;case"iframe":case"object":Ee("load",r);break;case"video":case"audio":for(d=0;d<ao.length;d++)Ee(ao[d],r);break;case"image":Ee("error",r),Ee("load",r);break;case"details":Ee("toggle",r);break;case"embed":case"source":case"link":Ee("error",r),Ee("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(z in c)if(c.hasOwnProperty(z)&&(d=c[z],d!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Ve(r,l,z,d,c,null)}return;default:if(Lf(l)){for($ in c)c.hasOwnProperty($)&&(d=c[$],d!==void 0&&Sh(r,l,$,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&Ve(r,l,T,d,c,null))}function FC(r,l,c,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,x=null,T=null,M=null,z=null,$=null;for(U in c){var P=c[U];if(c.hasOwnProperty(U)&&P!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":M=P;default:d.hasOwnProperty(U)||Ve(r,l,U,null,d,P)}}for(var _ in d){var U=d[_];if(P=c[_],d.hasOwnProperty(_)&&(U!=null||P!=null))switch(_){case"type":y=U;break;case"name":m=U;break;case"checked":z=U;break;case"defaultChecked":$=U;break;case"value":x=U;break;case"defaultValue":T=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(i(137,l));break;default:U!==P&&Ve(r,l,_,U,d,P)}}Df(r,x,T,M,z,$,y,m);return;case"select":U=x=T=_=null;for(y in c)if(M=c[y],c.hasOwnProperty(y)&&M!=null)switch(y){case"value":break;case"multiple":U=M;default:d.hasOwnProperty(y)||Ve(r,l,y,null,d,M)}for(m in d)if(y=d[m],M=c[m],d.hasOwnProperty(m)&&(y!=null||M!=null))switch(m){case"value":_=y;break;case"defaultValue":T=y;break;case"multiple":x=y;default:y!==M&&Ve(r,l,m,y,d,M)}l=T,c=x,d=U,_!=null?Cs(r,!!c,_,!1):!!d!=!!c&&(l!=null?Cs(r,!!c,l,!0):Cs(r,!!c,c?[]:"",!1));return;case"textarea":U=_=null;for(T in c)if(m=c[T],c.hasOwnProperty(T)&&m!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:Ve(r,l,T,null,d,m)}for(x in d)if(m=d[x],y=c[x],d.hasOwnProperty(x)&&(m!=null||y!=null))switch(x){case"value":_=m;break;case"defaultValue":U=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==y&&Ve(r,l,x,m,d,y)}Qg(r,_,U);return;case"option":for(var ee in c)if(_=c[ee],c.hasOwnProperty(ee)&&_!=null&&!d.hasOwnProperty(ee))switch(ee){case"selected":r.selected=!1;break;default:Ve(r,l,ee,null,d,_)}for(M in d)if(_=d[M],U=c[M],d.hasOwnProperty(M)&&_!==U&&(_!=null||U!=null))switch(M){case"selected":r.selected=_&&typeof _!="function"&&typeof _!="symbol";break;default:Ve(r,l,M,_,d,U)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ue in c)_=c[ue],c.hasOwnProperty(ue)&&_!=null&&!d.hasOwnProperty(ue)&&Ve(r,l,ue,null,d,_);for(z in d)if(_=d[z],U=c[z],d.hasOwnProperty(z)&&_!==U&&(_!=null||U!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(137,l));break;default:Ve(r,l,z,_,d,U)}return;default:if(Lf(l)){for(var $e in c)_=c[$e],c.hasOwnProperty($e)&&_!==void 0&&!d.hasOwnProperty($e)&&Sh(r,l,$e,void 0,d,_);for($ in d)_=d[$],U=c[$],!d.hasOwnProperty($)||_===U||_===void 0&&U===void 0||Sh(r,l,$,_,d,U);return}}for(var R in c)_=c[R],c.hasOwnProperty(R)&&_!=null&&!d.hasOwnProperty(R)&&Ve(r,l,R,null,d,_);for(P in d)_=d[P],U=c[P],!d.hasOwnProperty(P)||_===U||_==null&&U==null||Ve(r,l,P,_,d,U)}function tv(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function WC(){if(typeof performance.getEntriesByType=="function"){for(var r=0,l=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var m=c[d],y=m.transferSize,x=m.initiatorType,T=m.duration;if(y&&T&&tv(x)){for(x=0,T=m.responseEnd,d+=1;d<c.length;d++){var M=c[d],z=M.startTime;if(z>T)break;var $=M.transferSize,P=M.initiatorType;$&&tv(P)&&(M=M.responseEnd,x+=$*(M<T?1:(T-z)/(M-z)))}if(--d,l+=8*(y+x)/(m.duration/1e3),r++,10<r)break}}if(0<r)return l/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var xh=null,wh=null;function hc(r){return r.nodeType===9?r:r.ownerDocument}function nv(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function iv(r,l){if(r===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&l==="foreignObject"?0:r}function kh(r,l){return r==="textarea"||r==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Th=null;function QC(){var r=window.event;return r&&r.type==="popstate"?r===Th?!1:(Th=r,!0):(Th=null,!1)}var rv=typeof setTimeout=="function"?setTimeout:void 0,JC=typeof clearTimeout=="function"?clearTimeout:void 0,sv=typeof Promise=="function"?Promise:void 0,ZC=typeof queueMicrotask=="function"?queueMicrotask:typeof sv<"u"?function(r){return sv.resolve(null).then(r).catch(eM)}:rv;function eM(r){setTimeout(function(){throw r})}function ir(r){return r==="head"}function lv(r,l){var c=l,d=0;do{var m=c.nextSibling;if(r.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(m),rl(l);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")uo(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,uo(c);for(var y=c.firstChild;y;){var x=y.nextSibling,T=y.nodeName;y[Al]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=x}}else c==="body"&&uo(r.ownerDocument.body);c=m}while(c);rl(l)}function ov(r,l){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?l?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(l?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function Eh(r){var l=r.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var c=l;switch(l=l.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Eh(c),Nf(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function tM(r,l,c,d){for(;r.nodeType===1;){var m=c;if(r.nodeName.toLowerCase()!==l.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Al])switch(l){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(l==="input"&&r.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=Tn(r.nextSibling),r===null)break}return null}function nM(r,l,c){if(l==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Tn(r.nextSibling),r===null))return null;return r}function av(r,l){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!l||(r=Tn(r.nextSibling),r===null))return null;return r}function Ch(r){return r.data==="$?"||r.data==="$~"}function Mh(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function iM(r,l){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=l;else if(r.data!=="$?"||c.readyState!=="loading")l();else{var d=function(){l(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Tn(r){for(;r!=null;r=r.nextSibling){var l=r.nodeType;if(l===1||l===3)break;if(l===8){if(l=r.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return r}var Ah=null;function cv(r){r=r.nextSibling;for(var l=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(l===0)return Tn(r.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}r=r.nextSibling}return null}function uv(r){r=r.previousSibling;for(var l=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(l===0)return r;l--}else c!=="/$"&&c!=="/&"||l++}r=r.previousSibling}return null}function fv(r,l,c){switch(l=hc(c),r){case"html":if(r=l.documentElement,!r)throw Error(i(452));return r;case"head":if(r=l.head,!r)throw Error(i(453));return r;case"body":if(r=l.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function uo(r){for(var l=r.attributes;l.length;)r.removeAttributeNode(l[0]);Nf(r)}var En=new Map,dv=new Set;function pc(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var xi=Y.d;Y.d={f:rM,r:sM,D:lM,C:oM,L:aM,m:cM,X:fM,S:uM,M:dM};function rM(){var r=xi.f(),l=sc();return r||l}function sM(r){var l=ks(r);l!==null&&l.tag===5&&l.type==="form"?O0(l):xi.r(r)}var tl=typeof document>"u"?null:document;function hv(r,l,c){var d=tl;if(d&&typeof l=="string"&&l){var m=yn(l);m='link[rel="'+r+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),dv.has(m)||(dv.add(m),r={rel:r,crossOrigin:c,href:l},d.querySelector(m)===null&&(l=d.createElement("link"),At(l,"link",r),bt(l),d.head.appendChild(l)))}}function lM(r){xi.D(r),hv("dns-prefetch",r,null)}function oM(r,l){xi.C(r,l),hv("preconnect",r,l)}function aM(r,l,c){xi.L(r,l,c);var d=tl;if(d&&r&&l){var m='link[rel="preload"][as="'+yn(l)+'"]';l==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+yn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+yn(c.imageSizes)+'"]')):m+='[href="'+yn(r)+'"]';var y=m;switch(l){case"style":y=nl(r);break;case"script":y=il(r)}En.has(y)||(r=g({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:r,as:l},c),En.set(y,r),d.querySelector(m)!==null||l==="style"&&d.querySelector(fo(y))||l==="script"&&d.querySelector(ho(y))||(l=d.createElement("link"),At(l,"link",r),bt(l),d.head.appendChild(l)))}}function cM(r,l){xi.m(r,l);var c=tl;if(c&&r){var d=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+yn(d)+'"][href="'+yn(r)+'"]',y=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=il(r)}if(!En.has(y)&&(r=g({rel:"modulepreload",href:r},l),En.set(y,r),c.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ho(y)))return}d=c.createElement("link"),At(d,"link",r),bt(d),c.head.appendChild(d)}}}function uM(r,l,c){xi.S(r,l,c);var d=tl;if(d&&r){var m=Ts(d).hoistableStyles,y=nl(r);l=l||"default";var x=m.get(y);if(!x){var T={loading:0,preload:null};if(x=d.querySelector(fo(y)))T.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":l},c),(c=En.get(y))&&Oh(r,c);var M=x=d.createElement("link");bt(M),At(M,"link",r),M._p=new Promise(function(z,$){M.onload=z,M.onerror=$}),M.addEventListener("load",function(){T.loading|=1}),M.addEventListener("error",function(){T.loading|=2}),T.loading|=4,mc(x,l,d)}x={type:"stylesheet",instance:x,count:1,state:T},m.set(y,x)}}}function fM(r,l){xi.X(r,l);var c=tl;if(c&&r){var d=Ts(c).hoistableScripts,m=il(r),y=d.get(m);y||(y=c.querySelector(ho(m)),y||(r=g({src:r,async:!0},l),(l=En.get(m))&&Nh(r,l),y=c.createElement("script"),bt(y),At(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function dM(r,l){xi.M(r,l);var c=tl;if(c&&r){var d=Ts(c).hoistableScripts,m=il(r),y=d.get(m);y||(y=c.querySelector(ho(m)),y||(r=g({src:r,async:!0,type:"module"},l),(l=En.get(m))&&Nh(r,l),y=c.createElement("script"),bt(y),At(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function pv(r,l,c,d){var m=(m=ke.current)?pc(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=nl(c.href),c=Ts(m).hoistableStyles,d=c.get(l),d||(d={type:"style",instance:null,count:0,state:null},c.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=nl(c.href);var y=Ts(m).hoistableStyles,x=y.get(r);if(x||(m=m.ownerDocument||m,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,x),(y=m.querySelector(fo(r)))&&!y._p&&(x.instance=y,x.state.loading=5),En.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},En.set(r,c),y||hM(m,r,c,x.state))),l&&d===null)throw Error(i(528,""));return x}if(l&&d!==null)throw Error(i(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=il(c),c=Ts(m).hoistableScripts,d=c.get(l),d||(d={type:"script",instance:null,count:0,state:null},c.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function nl(r){return'href="'+yn(r)+'"'}function fo(r){return'link[rel="stylesheet"]['+r+"]"}function mv(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function hM(r,l,c,d){r.querySelector('link[rel="preload"][as="style"]['+l+"]")?d.loading=1:(l=r.createElement("link"),d.preload=l,l.addEventListener("load",function(){return d.loading|=1}),l.addEventListener("error",function(){return d.loading|=2}),At(l,"link",c),bt(l),r.head.appendChild(l))}function il(r){return'[src="'+yn(r)+'"]'}function ho(r){return"script[async]"+r}function gv(r,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var d=r.querySelector('style[data-href~="'+yn(c.href)+'"]');if(d)return l.instance=d,bt(d),d;var m=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),bt(d),At(d,"style",m),mc(d,c.precedence,r),l.instance=d;case"stylesheet":m=nl(c.href);var y=r.querySelector(fo(m));if(y)return l.state.loading|=4,l.instance=y,bt(y),y;d=mv(c),(m=En.get(m))&&Oh(d,m),y=(r.ownerDocument||r).createElement("link"),bt(y);var x=y;return x._p=new Promise(function(T,M){x.onload=T,x.onerror=M}),At(y,"link",d),l.state.loading|=4,mc(y,c.precedence,r),l.instance=y;case"script":return y=il(c.src),(m=r.querySelector(ho(y)))?(l.instance=m,bt(m),m):(d=c,(m=En.get(y))&&(d=g({},c),Nh(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),bt(m),At(m,"link",d),r.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(d=l.instance,l.state.loading|=4,mc(d,c.precedence,r));return l.instance}function mc(r,l,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,y=m,x=0;x<d.length;x++){var T=d[x];if(T.dataset.precedence===l)y=T;else if(y!==m)break}y?y.parentNode.insertBefore(r,y.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(r,l.firstChild))}function Oh(r,l){r.crossOrigin==null&&(r.crossOrigin=l.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=l.referrerPolicy),r.title==null&&(r.title=l.title)}function Nh(r,l){r.crossOrigin==null&&(r.crossOrigin=l.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=l.referrerPolicy),r.integrity==null&&(r.integrity=l.integrity)}var gc=null;function yv(r,l,c){if(gc===null){var d=new Map,m=gc=new Map;m.set(c,d)}else m=gc,d=m.get(c),d||(d=new Map,m.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),m=0;m<c.length;m++){var y=c[m];if(!(y[Al]||y[Tt]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var x=y.getAttribute(l)||"";x=r+x;var T=d.get(x);T?T.push(y):d.set(x,[y])}}return d}function bv(r,l,c){r=r.ownerDocument||r,r.head.insertBefore(c,l==="title"?r.querySelector("head > title"):null)}function pM(r,l,c){if(c===1||l.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return r=l.disabled,typeof l.precedence=="string"&&r==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function vv(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function mM(r,l,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=nl(d.href),y=l.querySelector(fo(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(r.count++,r=yc.bind(r),l.then(r,r)),c.state.loading|=4,c.instance=y,bt(y);return}y=l.ownerDocument||l,d=mv(d),(m=En.get(m))&&Oh(d,m),y=y.createElement("link"),bt(y);var x=y;x._p=new Promise(function(T,M){x.onload=T,x.onerror=M}),At(y,"link",d),c.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,l),(l=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=yc.bind(r),l.addEventListener("load",c),l.addEventListener("error",c))}}var Rh=0;function gM(r,l){return r.stylesheets&&r.count===0&&vc(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&vc(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+l);0<r.imgBytes&&Rh===0&&(Rh=62500*WC());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&vc(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>Rh?50:800)+l);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function yc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vc(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var bc=null;function vc(r,l){r.stylesheets=null,r.unsuspend!==null&&(r.count++,bc=new Map,l.forEach(yM,r),bc=null,yc.call(r))}function yM(r,l){if(!(l.state.loading&4)){var c=bc.get(r);if(c)var d=c.get(null);else{c=new Map,bc.set(r,c);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var x=m[y];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(c.set(x.dataset.precedence,x),d=x)}d&&c.set(null,d)}m=l.instance,x=m.getAttribute("data-precedence"),y=c.get(x)||d,y===d&&c.set(null,m),c.set(x,m),this.count++,d=yc.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),y?y.parentNode.insertBefore(m,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),l.state.loading|=4}}var po={$$typeof:L,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function bM(r,l,c,d,m,y,x,T,M){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Cf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cf(0),this.hiddenUpdates=Cf(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Sv(r,l,c,d,m,y,x,T,M,z,$,P){return r=new bM(r,l,c,x,M,z,$,P,T),l=1,y===!0&&(l|=24),y=sn(3,null,null,l),r.current=y,y.stateNode=r,l=ud(),l.refCount++,r.pooledCache=l,l.refCount++,y.memoizedState={element:d,isDehydrated:c,cache:l},pd(y),r}function xv(r){return r?(r=Ls,r):Ls}function wv(r,l,c,d,m,y){m=xv(m),d.context===null?d.context=m:d.pendingContext=m,d=Gi(l),d.payload={element:c},y=y===void 0?null:y,y!==null&&(d.callback=y),c=Yi(r,d,l),c!==null&&(Wt(c,r,l),Kl(c,r,l))}function kv(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<l?c:l}}function Dh(r,l){kv(r,l),(r=r.alternate)&&kv(r,l)}function Tv(r){if(r.tag===13||r.tag===31){var l=Ur(r,67108864);l!==null&&Wt(l,r,67108864),Dh(r,67108864)}}function Ev(r){if(r.tag===13||r.tag===31){var l=un();l=Mf(l);var c=Ur(r,l);c!==null&&Wt(c,r,l),Dh(r,l)}}var Sc=!0;function vM(r,l,c,d){var m=B.T;B.T=null;var y=Y.p;try{Y.p=2,zh(r,l,c,d)}finally{Y.p=y,B.T=m}}function SM(r,l,c,d){var m=B.T;B.T=null;var y=Y.p;try{Y.p=8,zh(r,l,c,d)}finally{Y.p=y,B.T=m}}function zh(r,l,c,d){if(Sc){var m=Lh(d);if(m===null)vh(r,l,d,xc,c),Mv(r,d);else if(wM(m,r,l,c,d))d.stopPropagation();else if(Mv(r,d),l&4&&-1<xM.indexOf(r)){for(;m!==null;){var y=ks(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var x=zr(y.pendingLanes);if(x!==0){var T=y;for(T.pendingLanes|=2,T.entangledLanes|=2;x;){var M=1<<31-nn(x);T.entanglements[1]|=M,x&=~M}Kn(y),(Le&6)===0&&(ic=en()+500,oo(0))}}break;case 31:case 13:T=Ur(y,2),T!==null&&Wt(T,y,2),sc(),Dh(y,2)}if(y=Lh(d),y===null&&vh(r,l,d,xc,c),y===m)break;m=y}m!==null&&d.stopPropagation()}else vh(r,l,d,null,c)}}function Lh(r){return r=Bf(r),_h(r)}var xc=null;function _h(r){if(xc=null,r=ws(r),r!==null){var l=o(r);if(l===null)r=null;else{var c=l.tag;if(c===13){if(r=a(l),r!==null)return r;r=null}else if(c===31){if(r=u(l),r!==null)return r;r=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;r=null}else l!==r&&(r=null)}}return xc=r,null}function Cv(r){switch(r){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(lE()){case Lg:return 2;case _g:return 8;case ua:case oE:return 32;case Bg:return 268435456;default:return 32}default:return 32}}var Bh=!1,rr=null,sr=null,lr=null,mo=new Map,go=new Map,or=[],xM="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".split(" ");function Mv(r,l){switch(r){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":lr=null;break;case"pointerover":case"pointerout":mo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":go.delete(l.pointerId)}}function yo(r,l,c,d,m,y){return r===null||r.nativeEvent!==y?(r={blockedOn:l,domEventName:c,eventSystemFlags:d,nativeEvent:y,targetContainers:[m]},l!==null&&(l=ks(l),l!==null&&Tv(l)),r):(r.eventSystemFlags|=d,l=r.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),r)}function wM(r,l,c,d,m){switch(l){case"focusin":return rr=yo(rr,r,l,c,d,m),!0;case"dragenter":return sr=yo(sr,r,l,c,d,m),!0;case"mouseover":return lr=yo(lr,r,l,c,d,m),!0;case"pointerover":var y=m.pointerId;return mo.set(y,yo(mo.get(y)||null,r,l,c,d,m)),!0;case"gotpointercapture":return y=m.pointerId,go.set(y,yo(go.get(y)||null,r,l,c,d,m)),!0}return!1}function Av(r){var l=ws(r.target);if(l!==null){var c=o(l);if(c!==null){if(l=c.tag,l===13){if(l=a(c),l!==null){r.blockedOn=l,$g(r.priority,function(){Ev(c)});return}}else if(l===31){if(l=u(c),l!==null){r.blockedOn=l,$g(r.priority,function(){Ev(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function wc(r){if(r.blockedOn!==null)return!1;for(var l=r.targetContainers;0<l.length;){var c=Lh(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);_f=d,c.target.dispatchEvent(d),_f=null}else return l=ks(c),l!==null&&Tv(l),r.blockedOn=c,!1;l.shift()}return!0}function Ov(r,l,c){wc(r)&&c.delete(l)}function kM(){Bh=!1,rr!==null&&wc(rr)&&(rr=null),sr!==null&&wc(sr)&&(sr=null),lr!==null&&wc(lr)&&(lr=null),mo.forEach(Ov),go.forEach(Ov)}function kc(r,l){r.blockedOn===l&&(r.blockedOn=null,Bh||(Bh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kM)))}var Tc=null;function Nv(r){Tc!==r&&(Tc=r,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Tc===r&&(Tc=null);for(var l=0;l<r.length;l+=3){var c=r[l],d=r[l+1],m=r[l+2];if(typeof d!="function"){if(_h(d||c)===null)continue;break}var y=ks(c);y!==null&&(r.splice(l,3),l-=3,Ld(y,{pending:!0,data:m,method:c.method,action:d},d,m))}}))}function rl(r){function l(M){return kc(M,r)}rr!==null&&kc(rr,r),sr!==null&&kc(sr,r),lr!==null&&kc(lr,r),mo.forEach(l),go.forEach(l);for(var c=0;c<or.length;c++){var d=or[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<or.length&&(c=or[0],c.blockedOn===null);)Av(c),c.blockedOn===null&&or.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var m=c[d],y=c[d+1],x=m[Pt]||null;if(typeof y=="function")x||Nv(c);else if(x){var T=null;if(y&&y.hasAttribute("formAction")){if(m=y,x=y[Pt]||null)T=x.formAction;else if(_h(m)!==null)continue}else T=x.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),Nv(c)}}}function Rv(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(x){return m=x})},focusReset:"manual",scroll:"manual"})}function l(){m!==null&&(m(),m=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function Hh(r){this._internalRoot=r}Ec.prototype.render=Hh.prototype.render=function(r){var l=this._internalRoot;if(l===null)throw Error(i(409));var c=l.current,d=un();wv(c,d,r,l,null,null)},Ec.prototype.unmount=Hh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var l=r.containerInfo;wv(r.current,2,null,r,null,null),sc(),l[xs]=null}};function Ec(r){this._internalRoot=r}Ec.prototype.unstable_scheduleHydration=function(r){if(r){var l=Vg();r={blockedOn:null,target:r,priority:l};for(var c=0;c<or.length&&l!==0&&l<or[c].priority;c++);or.splice(c,0,r),c===0&&Av(r)}};var Dv=e.version;if(Dv!=="19.2.6")throw Error(i(527,Dv,"19.2.6"));Y.findDOMNode=function(r){var l=r._reactInternals;if(l===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=h(l),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var TM={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cc.isDisabled&&Cc.supportsFiber)try{El=Cc.inject(TM),tn=Cc}catch{}}return vo.createRoot=function(r,l){if(!s(r))throw Error(i(299));var c=!1,d="",m=j0,y=I0,x=V0;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(x=l.onRecoverableError)),l=Sv(r,1,!1,null,null,c,d,null,m,y,x,Rv),r[xs]=l.current,bh(r),new Hh(l)},vo.hydrateRoot=function(r,l,c){if(!s(r))throw Error(i(299));var d=!1,m="",y=j0,x=I0,T=V0,M=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(x=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&(M=c.formState)),l=Sv(r,1,!0,l,c??null,d,m,M,y,x,T,Rv),l.context=xv(null),c=l.current,d=un(),d=Mf(d),m=Gi(d),m.callback=null,Yi(c,m,d),c=d,l.current.lanes=c,Ml(l,c),Kn(l),r[xs]=l.current,bh(r),new Ec(l)},vo.version="19.2.6",vo}var $v;function _M(){if($v)return Ih.exports;$v=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Ih.exports=LM(),Ih.exports}var BM=_M(),xm=ix();const HM=nx(xm);var Ph={exports:{}},Kh={};/**
50
+ * @license React
51
+ * use-sync-external-store-shim.production.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */var qv;function UM(){if(qv)return Kh;qv=1;var t=na();function e(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,s=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue;function u(g,b){var v=b(),S=i({inst:{value:v,getSnapshot:b}}),w=S[0].inst,k=S[1];return o(function(){w.value=v,w.getSnapshot=b,f(w)&&k({inst:w})},[g,v,b]),s(function(){return f(w)&&k({inst:w}),g(function(){f(w)&&k({inst:w})})},[g]),a(v),v}function f(g){var b=g.getSnapshot;g=g.value;try{var v=b();return!n(g,v)}catch{return!0}}function h(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return Kh.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Kh}var Pv;function rx(){return Pv||(Pv=1,Ph.exports=UM()),Ph.exports}var sx=rx();function Ot(t){this.content=t}Ot.prototype={constructor:Ot,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 i=n&&n!=t?this.remove(n):this,s=i.find(t),o=i.content.slice();return s==-1?o.push(n||t,e):(o[s+1]=e,n&&(o[s]=n)),new Ot(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ot(n)},addToStart:function(t,e){return new Ot([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ot(n)},addBefore:function(t,e,n){var i=this.remove(e),s=i.content.slice(),o=i.find(t);return s.splice(o==-1?s.length:o,0,e,n),new Ot(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ot.from(t),t.size?new Ot(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ot.from(t),t.size?new Ot(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ot.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}};Ot.from=function(t){if(t instanceof Ot)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ot(e)};function lx(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(i),o=e.child(i);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){for(let a=0;s.text[a]==o.text[a];a++)n++;return n}if(s.content.size||o.content.size){let a=lx(s.content,o.content,n+1);if(a!=null)return a}n+=s.nodeSize}}function ox(t,e,n,i){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:i};let a=t.child(--s),u=e.child(--o),f=a.nodeSize;if(a==u){n-=f,i-=f;continue}if(!a.sameMarkup(u))return{a:n,b:i};if(a.isText&&a.text!=u.text){let h=0,p=Math.min(a.text.length,u.text.length);for(;h<p&&a.text[a.text.length-h-1]==u.text[u.text.length-h-1];)h++,n--,i--;return{a:n,b:i}}if(a.content.size||u.content.size){let h=ox(a.content,u.content,n-1,i-1);if(h)return h}n-=f,i-=f}}class G{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,s=0,o){for(let a=0,u=0;u<n;a++){let f=this.content[a],h=u+f.nodeSize;if(h>e&&i(f,s+u,o||null,a)!==!1&&f.content.size){let p=u+1;f.nodesBetween(Math.max(0,e-p),Math.min(f.content.size,n-p),i,s+p)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,s){let o="",a=!0;return this.nodesBetween(e,n,(u,f)=>{let h=u.isText?u.text.slice(Math.max(e,f)-f,n-f):u.isLeaf?s?typeof s=="function"?s(u):s:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&h||u.isTextblock)&&i&&(a?a=!1:o+=i),o+=h},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(i)&&(s[s.length-1]=n.withText(n.text+i.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new G(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],s=0;if(n>e)for(let o=0,a=0;a<n;o++){let u=this.content[o],f=a+u.nodeSize;f>e&&((a<e||f>n)&&(u.isText?u=u.cut(Math.max(0,e-a),Math.min(u.text.length,n-a)):u=u.cut(Math.max(0,e-a-1),Math.min(u.content.size,n-a-1))),i.push(u),s+=u.nodeSize),a=f}return new G(i,s)}cutByIndex(e,n){return e==n?G.empty:e==0&&n==this.content.length?this:new G(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-i.nodeSize;return s[e]=n,new G(s,o)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(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,i=0;n<this.content.length;n++){let s=this.content[n];e(s,i,n),i+=s.nodeSize}}findDiffStart(e,n=0){return lx(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return ox(this,e,n,i)}findIndex(e){if(e==0)return Mc(0,e);if(e==this.size)return Mc(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let s=this.child(n),o=i+s.nodeSize;if(o>=e)return o==e?Mc(n+1,o):Mc(n,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return G.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let n,i=0;for(let s=0;s<e.length;s++){let o=e[s];i+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(n||(n=e.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new G(n||e,i)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const Gh={index:0,offset:0};function Mc(t,e){return Gh.index=t,Gh.offset=e,Gh}function eu(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 i=0;i<t.length;i++)if(!eu(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!eu(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Ke=class Rp{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!i&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),i=!0),n&&n.push(o)}}return n||(n=e.slice()),i||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&&eu(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 i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=i.create(n.attrs);return i.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Rp.none;if(e instanceof Rp)return[e];let n=e.slice();return n.sort((i,s)=>i.type.rank-s.type.rank),n}};Ke.none=[];class tu extends Error{}class F{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=cx(this.content,e+this.openStart,n);return i&&new F(i,this.openStart,this.openEnd)}removeBetween(e,n){return new F(ax(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 F.empty;let i=n.openStart||0,s=n.openEnd||0;if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(G.fromJSON(e,n.content),i,s)}static maxOpen(e,n=!0){let i=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)i++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new F(e,i,s)}}F.empty=new F(G.empty,0,0);function ax(t,e,n){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i),{index:a,offset:u}=t.findIndex(n);if(s==e||o.isText){if(u!=n&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(i,o.copy(ax(o.content,e-s-1,n-s-1)))}function cx(t,e,n,i){let{index:s,offset:o}=t.findIndex(e),a=t.maybeChild(s);if(o==e||a.isText)return i&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=cx(a.content,e-o-1,n,a);return u&&t.replaceChild(s,a.copy(u))}function jM(t,e,n){if(n.openStart>t.depth)throw new tu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new tu("Inconsistent open depths");return ux(t,e,n,0)}function ux(t,e,n,i){let s=t.index(i),o=t.node(i);if(s==e.index(i)&&i<t.depth-n.openStart){let a=ux(t,e,n,i+1);return o.copy(o.content.replaceChild(s,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let a=t.parent,u=a.content;return rs(a,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=IM(n,t);return rs(o,dx(t,a,u,e,i))}else return rs(o,nu(t,e,i))}function fx(t,e){if(!e.type.compatibleContent(t.type))throw new tu("Cannot join "+e.type.name+" onto "+t.type.name)}function Dp(t,e,n){let i=t.node(n);return fx(i,e.node(n)),i}function is(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 Ro(t,e,n,i){let s=(e||t).node(n),o=0,a=e?e.index(n):s.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(is(t.nodeAfter,i),o++));for(let u=o;u<a;u++)is(s.child(u),i);e&&e.depth==n&&e.textOffset&&is(e.nodeBefore,i)}function rs(t,e){return t.type.checkContent(e),t.copy(e)}function dx(t,e,n,i,s){let o=t.depth>s&&Dp(t,e,s+1),a=i.depth>s&&Dp(n,i,s+1),u=[];return Ro(null,t,s,u),o&&a&&e.index(s)==n.index(s)?(fx(o,a),is(rs(o,dx(t,e,n,i,s+1)),u)):(o&&is(rs(o,nu(t,e,s+1)),u),Ro(e,n,s,u),a&&is(rs(a,nu(n,i,s+1)),u)),Ro(i,null,s,u),new G(u)}function nu(t,e,n){let i=[];if(Ro(null,t,n,i),t.depth>n){let s=Dp(t,e,n+1);is(rs(s,nu(t,e,n+1)),i)}return Ro(e,null,n,i),new G(i)}function IM(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)s=e.node(o).copy(G.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class qo{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,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 i=this.pos-this.path[this.path.length-1],s=e.child(n);return i?e.child(n).cut(i):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)s+=i.child(o).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ke.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),s=e.maybeChild(n);if(!i){let u=i;i=s,s=u}let o=i.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!s||!o[a].isInSet(s.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}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 i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new iu(this,e,i);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 i=[],s=0,o=n;for(let a=e;;){let{index:u,offset:f}=a.content.findIndex(o),h=o-f;if(i.push(a,u,s+f),!h||(a=a.child(u),a.isText))break;o=h-1,s+=f+1}return new qo(n,i,o)}static resolveCached(e,n){let i=Kv.get(e);if(i)for(let o=0;o<i.elts.length;o++){let a=i.elts[o];if(a.pos==n)return a}else Kv.set(e,i=new VM);let s=i.elts[i.i]=qo.resolve(e,n);return i.i=(i.i+1)%$M,s}}class VM{constructor(){this.elts=[],this.i=0}}const $M=12,Kv=new WeakMap;class iu{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}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 qM=Object.create(null);let xr=class zp{constructor(e,n,i,s=Ke.none){this.type=e,this.attrs=n,this.marks=s,this.content=i||G.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,s=0){this.content.nodesBetween(e,n,i,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,s){return this.content.textBetween(e,n,i,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&eu(this.attrs,n||e.defaultAttrs||qM)&&Ke.sameSet(this.marks,i||Ke.none)}copy(e=null){return e==this.content?this:new zp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new zp(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,i=!1){if(e==n)return F.empty;let s=this.resolve(e),o=this.resolve(n),a=i?0:s.sharedDepth(n),u=s.start(a),h=s.node(a).content.cut(s.pos-u,o.pos-u);return new F(h,s.depth-a,o.depth-a)}replace(e,n,i){return jM(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let s=this.content.child(n-1);return{node:s,index:n-1,offset:i-s.nodeSize}}resolve(e){return qo.resolveCached(this,e)}resolveNoCache(e){return qo.resolve(this,e)}rangeHasMark(e,n,i){let s=!1;return n>e&&this.nodesBetween(e,n,o=>(i.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),hx(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,i=G.empty,s=0,o=i.childCount){let a=this.contentMatchAt(e).matchFragment(i,s,o),u=a&&a.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let f=s;f<o;f++)if(!this.type.allowsMarks(i.child(f).marks))return!1;return!0}canReplaceWith(e,n,i,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(i),a=o&&o.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ke.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!Ke.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 i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=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,i)}let s=G.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,s,i);return o.type.checkAttrs(o.attrs),o}};xr.prototype.text=void 0;class ru extends xr{constructor(e,n,i,s){if(super(e,n,null,s),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):hx(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 ru(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ru(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 hx(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class cs{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new PM(e,n);if(i.next==null)return cs.empty;let s=px(i);i.next&&i.err("Unexpected trailing text");let o=QM(WM(s));return JM(o,i),o}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,i=e.childCount){let s=this;for(let o=n;s&&o<i;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type: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 i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let s=[this];function o(a,u){let f=a.matchFragment(e,i);if(f&&(!n||f.validEnd))return G.from(u.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:p,next:g}=a.next[h];if(!(p.isText||p.hasRequiredAttrs())&&s.indexOf(g)==-1){s.push(g);let b=o(g,u.concat(p));if(b)return b}}return null}return o(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let s=i.shift(),o=s.match;if(o.matchType(e)){let a=[];for(let u=s;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:u,next:f}=o.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!s.type||f.validEnd)&&(i.push({match:u.contentMatch,type:u,via:s}),n[u.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(i){e.push(i);for(let s=0;s<i.next.length;s++)e.indexOf(i.next[s].next)==-1&&n(i.next[s].next)}return n(this),e.map((i,s)=>{let o=s+(i.validEnd?"*":" ")+" ";for(let a=0;a<i.next.length;a++)o+=(a?", ":"")+i.next[a].type.name+"->"+e.indexOf(i.next[a].next);return o}).join(`
58
+ `)}}cs.empty=new cs(!0);class PM{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 px(t){let e=[];do e.push(KM(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function KM(t){let e=[];do e.push(GM(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function GM(t){let e=FM(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=YM(t,e);else break;return e}function Gv(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function YM(t,e){let n=Gv(t),i=n;return t.eat(",")&&(t.next!="}"?i=Gv(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function XM(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let s=[];for(let o in n){let a=n[o];a.isInGroup(e)&&s.push(a)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function FM(t){if(t.eat("(")){let e=px(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=XM(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 WM(t){let e=[[]];return s(o(t,0),n()),e;function n(){return e.push([])-1}function i(a,u,f){let h={term:f,to:u};return e[a].push(h),h}function s(a,u){a.forEach(f=>f.to=u)}function o(a,u){if(a.type=="choice")return a.exprs.reduce((f,h)=>f.concat(o(h,u)),[]);if(a.type=="seq")for(let f=0;;f++){let h=o(a.exprs[f],u);if(f==a.exprs.length-1)return h;s(h,u=n())}else if(a.type=="star"){let f=n();return i(u,f),s(o(a.expr,f),f),[i(f)]}else if(a.type=="plus"){let f=n();return s(o(a.expr,u),f),s(o(a.expr,f),f),[i(f)]}else{if(a.type=="opt")return[i(u)].concat(o(a.expr,u));if(a.type=="range"){let f=u;for(let h=0;h<a.min;h++){let p=n();s(o(a.expr,f),p),f=p}if(a.max==-1)s(o(a.expr,f),f);else for(let h=a.min;h<a.max;h++){let p=n();i(f,p),s(o(a.expr,f),p),f=p}return[i(f)]}else{if(a.type=="name")return[i(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function mx(t,e){return e-t}function Yv(t,e){let n=[];return i(e),n.sort(mx);function i(s){let o=t[s];if(o.length==1&&!o[0].term)return i(o[0].to);n.push(s);for(let a=0;a<o.length;a++){let{term:u,to:f}=o[a];!u&&n.indexOf(f)==-1&&i(f)}}}function QM(t){let e=Object.create(null);return n(Yv(t,0));function n(i){let s=[];i.forEach(a=>{t[a].forEach(({term:u,to:f})=>{if(!u)return;let h;for(let p=0;p<s.length;p++)s[p][0]==u&&(h=s[p][1]);Yv(t,f).forEach(p=>{h||s.push([u,h=[]]),h.indexOf(p)==-1&&h.push(p)})})});let o=e[i.join(",")]=new cs(i.indexOf(t.length-1)>-1);for(let a=0;a<s.length;a++){let u=s[a][1].sort(mx);o.next.push({type:s[a][0],next:e[u.join(",")]||n(u)})}return o}}function JM(t,e){for(let n=0,i=[t];n<i.length;n++){let s=i[n],o=!s.validEnd,a=[];for(let u=0;u<s.next.length;u++){let{type:f,next:h}=s.next[u];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),i.indexOf(h)==-1&&i.push(h)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function gx(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function yx(t,e){let n=Object.create(null);for(let i in t){let s=e&&e[i];if(s===void 0){let o=t[i];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=s}return n}function bx(t,e,n,i){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let o=t[s];o.validate&&o.validate(e[s])}}function vx(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new eA(t,i,e[i]);return n}let Xv=class Sx{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=vx(e,i.attrs),this.defaultAttrs=gx(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==cs.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:yx(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xr(this,this.computeAttrs(e),G.from(n),Ke.setFrom(i))}createChecked(e=null,n,i){return n=G.from(n),this.checkContent(n),new xr(this,this.computeAttrs(e),n,Ke.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=G.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let s=this.contentMatch.matchFragment(n),o=s&&s.fillBefore(G.empty,!0);return o?new xr(this,e,n.append(o),Ke.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bx(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:Ke.none:e}static compile(e,n){let i=Object.create(null);e.forEach((o,a)=>i[o]=new Sx(o,n,a));let s=n.spec.topNode||"doc";if(!i[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let o in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function ZM(t,e,n){let i=n.split("|");return s=>{let o=s===null?"null":typeof s;if(i.indexOf(o)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${o}`)}}class eA{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?ZM(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Ju{constructor(e,n,i,s){this.name=e,this.rank=n,this.schema=i,this.spec=s,this.attrs=vx(e,s.attrs),this.excluded=null;let o=gx(this.attrs);this.instance=o?new Ke(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ke(this,yx(this.attrs,e))}static compile(e,n){let i=Object.create(null),s=0;return e.forEach((o,a)=>i[o]=new Ju(o,s++,n,a)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){bx(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class xx{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Ot.from(e.nodes),n.marks=Ot.from(e.marks||{}),this.nodes=Xv.compile(this.spec.nodes,this),this.marks=Ju.compile(this.spec.marks,this);let i=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],a=o.spec.content||"",u=o.spec.marks;if(o.contentMatch=i[a]||(i[a]=cs.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=u=="_"?null:u?Fv(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Fv(this,a.split(" "))}this.nodeFromJSON=s=>xr.fromJSON(this,s),this.markFromJSON=s=>Ke.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xv){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,i,s)}text(e,n){let i=this.nodes.text;return new ru(i,i.defaultAttrs,e,Ke.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Fv(t,e){let n=[];for(let i=0;i<e.length;i++){let s=e[i],o=t.marks[s],a=o;if(o)n.push(o);else for(let u in t.marks){let f=t.marks[u];(s=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(s)>-1)&&n.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function tA(t){return t.tag!=null}function nA(t){return t.style!=null}class wr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(s=>{if(tA(s))this.tags.push(s);else if(nA(s)){let o=/[^=]*/.exec(s.style)[0];i.indexOf(o)<0&&i.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let i=new Qv(this,n,!1);return i.addAll(e,Ke.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new Qv(this,n,!0);return i.addAll(e,Ke.none,n.from,n.to),F.maxOpen(i.finish())}matchTag(e,n,i){for(let s=i?this.tags.indexOf(i)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(sA(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,n,i,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(u.indexOf(e)!=0||a.context&&!i.matchesContext(a.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=n))){if(a.getAttrs){let f=a.getAttrs(n);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let n=[];function i(s){let o=s.priority==null?50:s.priority,a=0;for(;a<n.length;a++){let u=n[a];if((u.priority==null?50:u.priority)<o)break}n.splice(a,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(a=>{i(a=Jv(a)),a.mark||a.ignore||a.clearMark||(a.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(a=>{i(a=Jv(a)),a.node||a.ignore||a.mark||(a.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wr(e,wr.schemaRules(e)))}}const wx={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},iA={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},kx={ol:!0,ul:!0},Po=1,Lp=2,Do=4;function Wv(t,e,n){return e!=null?(e?Po:0)|(e==="full"?Lp:0):t&&t.whitespace=="pre"?Po|Lp:n&~Do}class Ac{constructor(e,n,i,s,o,a){this.type=e,this.attrs=n,this.marks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=Ke.none,this.match=o||(a&Do?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,s;return(s=i.findWrapping(e.type))?(this.match=i,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Po)){let i=this.content[this.content.length-1],s;if(i&&i.isText&&(s=/[ \t\r\n\u000c]+$/.exec(i.text))){let o=i;i.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!wx.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Qv{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let s=n.topNode,o,a=Wv(null,n.preserveWhitespace,0)|(i?Do:0);s?o=new Ac(s.type,s.attrs,Ke.none,!0,n.topMatch||s.type.contentMatch,a):i?o=new Ac(null,null,Ke.none,!0,null,a):o=new Ac(e.schema.topNodeType,null,Ke.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,s=this.top,o=s.options&Lp?"full":this.localPreserveWS||(s.options&Po)>0,{schema:a}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(o)if(o==="full")i=i.replace(/\r\n?/g,`
59
+ `);else if(a.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(a.linebreakReplacement.create())){let u=i.split(/\r?\n|\r/);for(let f=0;f<u.length;f++)f&&this.insertNode(a.linebreakReplacement.create(),n,!0),u[f]&&this.insertNode(a.text(u[f]),n,!/\S/.test(u[f]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let u=s.content[s.content.length-1],f=e.previousSibling;(!u||f&&f.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.text))&&(i=i.slice(1))}i&&this.insertNode(a.text(i),n,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,n,i){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),u;kx.hasOwnProperty(a)&&this.parser.normalizeLists&&rA(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,i));e:if(f?f.ignore:iA.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let h,p=this.needsBlock;if(wx.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),h=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let g=f&&f.skip?n:this.readStyles(e,n);g&&this.addAll(e,g),h&&this.sync(o),this.needsBlock=p}else{let h=this.readStyles(e,n);h&&this.addElementByRule(e,f,h,f.consuming===!1?u:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
60
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],a=i.getPropertyValue(o);if(a)for(let u=void 0;;){let f=this.parser.matchStyle(o,a,this,u);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(h=>!f.clearMark(h)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)u=f;else break}}return n}addElementByRule(e,n,i,s){let o,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let f=this.enter(a,n.attrs||null,i,n.preserveWhitespace);f&&(o=!0,i=f)}else{let f=this.parser.schema.marks[n.mark];i=i.concat(f.create(n.attrs))}let u=this.top;if(a&&a.isLeaf)this.findInside(e);else if(s)this.addElement(e,i,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,i,!1));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,i),this.findAround(e,f,!1)}o&&this.sync(u)&&this.open--}addAll(e,n,i,s){let o=i||0;for(let a=i?e.childNodes[i]:e.firstChild,u=s==null?null:e.childNodes[s];a!=u;a=a.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(a,n);this.findAtPoint(e,o)}findPlace(e,n,i){let s,o;for(let a=this.open,u=0;a>=0;a--){let f=this.nodes[a],h=f.findWrapping(e);if(h&&(!s||s.length>h.length+u)&&(s=h,o=f,!h.length))break;if(f.solid){if(i)break;u+=2}}if(!s)return null;this.sync(o);for(let a=0;a<s.length;a++)n=this.enterInner(s[a],null,n,!1);return n}insertNode(e,n,i){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let s=this.findPlace(e,n,i);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let a=Ke.none;for(let u of s.concat(e.marks))(o.type?o.type.allowsMarkType(u.type):Zv(u.type,e.type))&&(a=u.addToSet(a));return o.content.push(e.mark(a)),!0}return!1}enter(e,n,i,s){let o=this.findPlace(e.create(n),i,!1);return o&&(o=this.enterInner(e,n,i,!0,s)),o}enterInner(e,n,i,s=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let u=Wv(e,o,a.options);a.options&Do&&a.content.length==0&&(u|=Do);let f=Ke.none;return i=i.filter(h=>(a.type?a.type.allowsMarkType(h.type):Zv(h.type,e))?(f=h.addToSet(f),!1):!0),this.nodes.push(new Ac(e,n,f,s,null,u)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Po)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let s=i.length-1;s>=0;s--)e+=i[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].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,i){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(i?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,s=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),o=-(i?i.depth+1:0)+(s?0:1),a=(u,f)=>{for(;u>=0;u--){let h=n[u];if(h==""){if(u==n.length-1||u==0)continue;for(;f>=o;f--)if(a(u-1,f))return!0;return!1}else{let p=f>0||f==0&&s?this.nodes[f].type:i&&f>=o?i.node(f-o).type:null;if(!p||p.name!=h&&!p.isInGroup(h))return!1;f--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function rA(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&kx.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function sA(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Jv(t){let e={};for(let n in t)e[n]=t[n];return e}function Zv(t,e){let n=e.schema.nodes;for(let i in n){let s=n[i];if(!s.allowsMarkType(t))continue;let o=[],a=u=>{o.push(u);for(let f=0;f<u.edgeCount;f++){let{type:h,next:p}=u.edge(f);if(h==e||o.indexOf(p)<0&&a(p))return!0}};if(a(s.contentMatch))return!0}}class ys{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=Yh(n).createDocumentFragment());let s=i,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let u=0,f=0;for(;u<o.length&&f<a.marks.length;){let h=a.marks[f];if(!this.marks[h.type.name]){f++;continue}if(!h.eq(o[u][0])||h.type.spec.spanning===!1)break;u++,f++}for(;u<o.length;)s=o.pop()[1];for(;f<a.marks.length;){let h=a.marks[f++],p=this.serializeMark(h,a.isInline,n);p&&(o.push([h,s]),s.appendChild(p.dom),s=p.contentDOM||p.dom)}}s.appendChild(this.serializeNodeInner(a,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:s}=Gc(Yh(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(i),i=o.dom)}return i}serializeMark(e,n,i={}){let s=this.marks[e.type.name];return s&&Gc(Yh(i),s(e,n),null,e.attrs)}static renderSpec(e,n,i=null,s){return Gc(e,n,i,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ys(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=e1(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return e1(e.marks)}}function e1(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function Yh(t){return t.document||window.document}const t1=new WeakMap;function lA(t){let e=t1.get(t);return e===void 0&&t1.set(t,e=oA(t)),e}function oA(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let s=0;s<i.length;s++)n(i[s]);else for(let s in i)n(i[s])}return n(t),e}function Gc(t,e,n,i){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(o=lA(i))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=s.indexOf(" ");a>0&&(n=s.slice(0,a),s=s.slice(a+1));let u,f=n?t.createElementNS(n,s):t.createElement(s),h=e[1],p=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){p=2;for(let g in h)if(h[g]!=null){let b=g.indexOf(" ");b>0?f.setAttributeNS(g.slice(0,b),g.slice(b+1),h[g]):g=="style"&&f.style?f.style.cssText=h[g]:f.setAttribute(g,h[g])}}for(let g=p;g<e.length;g++){let b=e[g];if(b===0){if(g<e.length-1||g>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:v,contentDOM:S}=Gc(t,b,n,i);if(f.appendChild(v),S){if(u)throw new RangeError("Multiple content holes");u=S}}}return{dom:f,contentDOM:u}}const Tx=65535,Ex=Math.pow(2,16);function aA(t,e){return t+e*Ex}function n1(t){return t&Tx}function cA(t){return(t-(t&Tx))/Ex}const Cx=1,Mx=2,Yc=4,Ax=8;class _p{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&Ax)>0}get deletedBefore(){return(this.delInfo&(Cx|Yc))>0}get deletedAfter(){return(this.delInfo&(Mx|Yc))>0}get deletedAcross(){return(this.delInfo&Yc)>0}}class fn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&fn.empty)return fn.empty}recover(e){let n=0,i=n1(e);if(!this.inverted)for(let s=0;s<i;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[i*3]+n+cA(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let s=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?s:0);if(f>e)break;let h=this.ranges[u+o],p=this.ranges[u+a],g=f+h;if(e<=g){let b=h?e==f?-1:e==g?1:n:n,v=f+s+(b<0?0:p);if(i)return v;let S=e==(n<0?f:g)?null:aA(u/3,e-f),w=e==f?Mx:e==g?Cx:Yc;return(n<0?e!=f:e!=g)&&(w|=Ax),new _p(v,w,S)}s+=p-h}return i?e+s:new _p(e+s,0,null)}touches(e,n){let i=0,s=n1(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?i:0);if(f>e)break;let h=this.ranges[u+o],p=f+h;if(e<=p&&u==s*3)return!0;i+=this.ranges[u+a]-h}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let a=this.ranges[s],u=a-(this.inverted?o:0),f=a+(this.inverted?0:o),h=this.ranges[s+n],p=this.ranges[s+i];e(u,u+h,f,f+p),o+=p-h}}invert(){return new fn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?fn.empty:new fn(e<0?[0,-e,0]:[0,0,e])}}fn.empty=new fn([]);class Ko{constructor(e,n,i=0,s=e?e.length:0){this.mirror=n,this.from=i,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ko(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,i=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?i+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?i-s-1:void 0)}}invert(){let e=new Ko;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let s=0;for(let o=this.from;o<this.to;o++){let a=this._maps[o],u=a.mapResult(e,n);if(u.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this._maps[f].recover(u.recover);continue}}s|=u.delInfo,e=u.pos}return i?e:new _p(e,s,null)}}const Xh=Object.create(null);class Ht{getMap(){return fn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Xh[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in Xh)throw new RangeError("Duplicate use of step JSON ID "+e);return Xh[e]=n,n.prototype.jsonID=e,n}}class mt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new mt(e,null)}static fail(e){return new mt(null,e)}static fromReplace(e,n,i,s){try{return mt.ok(e.replace(n,i,s))}catch(o){if(o instanceof tu)return mt.fail(o.message);throw o}}}function wm(t,e,n){let i=[];for(let s=0;s<t.childCount;s++){let o=t.child(s);o.content.size&&(o=o.copy(wm(o.content,e,o))),o.isInline&&(o=e(o,n,s)),i.push(o)}return G.fromArray(i)}class br extends Ht{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),s=i.node(i.sharedDepth(this.to)),o=new F(wm(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),s),n.openStart,n.openEnd);return mt.fromReplace(e,this.from,this.to,o)}invert(){return new Hn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new br(n.pos,i.pos,this.mark)}merge(e){return e instanceof br&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new br(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 br(n.from,n.to,e.markFromJSON(n.mark))}}Ht.jsonID("addMark",br);class Hn extends Ht{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new F(wm(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return mt.fromReplace(e,this.from,this.to,i)}invert(){return new br(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Hn(n.pos,i.pos,this.mark)}merge(e){return e instanceof Hn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Hn(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 Hn(n.from,n.to,e.markFromJSON(n.mark))}}Ht.jsonID("removeMark",Hn);class vr extends Ht{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return mt.fromReplace(e,this.pos,this.pos+1,new F(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(i))return new vr(this.pos,n.marks[s]);return new vr(this.pos,this.mark)}}return new us(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vr(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 vr(n.pos,e.markFromJSON(n.mark))}}Ht.jsonID("addNodeMark",vr);class us extends Ht{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return mt.fromReplace(e,this.pos,this.pos+1,new F(G.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new vr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new us(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 us(n.pos,e.markFromJSON(n.mark))}}Ht.jsonID("removeNodeMark",us);class pt extends Ht{constructor(e,n,i,s=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=s}apply(e){return this.structure&&Bp(e,this.from,this.to)?mt.fail("Structure replace would overwrite content"):mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fn([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),i=this.from==this.to&&pt.MAP_BIAS<0?n:e.mapResult(this.from,1);return i.deletedAcross&&n.deletedAcross?null:new pt(i.pos,Math.max(i.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pt)||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?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(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?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(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 pt(n.from,n.to,F.fromJSON(e,n.slice),!!n.structure)}}pt.MAP_BIAS=1;Ht.jsonID("replace",pt);class xt extends Ht{constructor(e,n,i,s,o,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=s,this.slice=o,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Bp(e,this.from,this.gapFrom)||Bp(e,this.gapTo,this.to)))return mt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return mt.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?mt.fromReplace(e,this.from,this.to,i):mt.fail("Content does not fit in gap")}getMap(){return new fn([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 xt(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),i=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||s<n.pos||o>i.pos?null:new xt(n.pos,i.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 xt(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ht.jsonID("replaceAround",xt);function Bp(t,e,n){let i=t.resolve(e),s=n-e,o=i.depth;for(;s>0&&o>0&&i.indexAfter(o)==i.node(o).childCount;)o--,s--;if(s>0){let a=i.node(o).maybeChild(i.indexAfter(o));for(;s>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,s--}}return!1}function uA(t,e,n,i){let s=[],o=[],a,u;t.doc.nodesBetween(e,n,(f,h,p)=>{if(!f.isInline)return;let g=f.marks;if(!i.isInSet(g)&&p.type.allowsMarkType(i.type)){let b=Math.max(h,e),v=Math.min(h+f.nodeSize,n),S=i.addToSet(g);for(let w=0;w<g.length;w++)g[w].isInSet(S)||(a&&a.to==b&&a.mark.eq(g[w])?a.to=v:s.push(a=new Hn(b,v,g[w])));u&&u.to==b?u.to=v:o.push(u=new br(b,v,i))}}),s.forEach(f=>t.step(f)),o.forEach(f=>t.step(f))}function fA(t,e,n,i){let s=[],o=0;t.doc.nodesBetween(e,n,(a,u)=>{if(!a.isInline)return;o++;let f=null;if(i instanceof Ju){let h=a.marks,p;for(;p=i.isInSet(h);)(f||(f=[])).push(p),h=p.removeFromSet(h)}else i?i.isInSet(a.marks)&&(f=[i]):f=a.marks;if(f&&f.length){let h=Math.min(u+a.nodeSize,n);for(let p=0;p<f.length;p++){let g=f[p],b;for(let v=0;v<s.length;v++){let S=s[v];S.step==o-1&&g.eq(s[v].style)&&(b=S)}b?(b.to=h,b.step=o):s.push({style:g,from:Math.max(u,e),to:h,step:o})}}}),s.forEach(a=>t.step(new Hn(a.from,a.to,a.style)))}function km(t,e,n,i=n.contentMatch,s=!0){let o=t.doc.nodeAt(e),a=[],u=e+1;for(let f=0;f<o.childCount;f++){let h=o.child(f),p=u+h.nodeSize,g=i.matchType(h.type);if(!g)a.push(new pt(u,p,F.empty));else{i=g;for(let b=0;b<h.marks.length;b++)n.allowsMarkType(h.marks[b].type)||t.step(new Hn(u,p,h.marks[b]));if(s&&h.isText&&n.whitespace!="pre"){let b,v=/\r?\n|\r/g,S;for(;b=v.exec(h.text);)S||(S=new F(G.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),a.push(new pt(u+b.index,u+b.index+b[0].length,S))}}u=p}if(!i.validEnd){let f=i.fillBefore(G.empty,!0);t.replace(u,u,new F(f,0,0))}for(let f=a.length-1;f>=0;f--)t.step(a[f])}function dA(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function kl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth,s=0,o=0;;--i){let a=t.$from.node(i),u=t.$from.index(i)+s,f=t.$to.indexAfter(i)-o;if(i<t.depth&&a.canReplace(u,f,n))return i;if(i==0||a.type.spec.isolating||!dA(a,u,f))break;u&&(s=1),f<a.childCount&&(o=1)}return null}function hA(t,e,n){let{$from:i,$to:s,depth:o}=e,a=i.before(o+1),u=s.after(o+1),f=a,h=u,p=G.empty,g=0;for(let S=o,w=!1;S>n;S--)w||i.index(S)>0?(w=!0,p=G.from(i.node(S).copy(p)),g++):f--;let b=G.empty,v=0;for(let S=o,w=!1;S>n;S--)w||s.after(S+1)<s.end(S)?(w=!0,b=G.from(s.node(S).copy(b)),v++):h++;t.step(new xt(f,h,a,u,new F(p.append(b),g,v),p.size-g,!0))}function Tm(t,e,n=null,i=t){let s=pA(t,e),o=s&&mA(i,e);return o?s.map(i1).concat({type:e,attrs:n}).concat(o.map(i1)):null}function i1(t){return{type:t,attrs:null}}function pA(t,e){let{parent:n,startIndex:i,endIndex:s}=t,o=n.contentMatchAt(i).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return n.canReplaceWith(i,s,a)?o:null}function mA(t,e){let{parent:n,startIndex:i,endIndex:s}=t,o=n.child(i),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let h=i;f&&h<s;h++)f=f.matchType(n.child(h).type);return!f||!f.validEnd?null:a}function gA(t,e,n){let i=G.empty;for(let a=n.length-1;a>=0;a--){if(i.size){let u=n[a].type.contentMatch.matchFragment(i);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=G.from(n[a].type.create(n[a].attrs,i))}let s=e.start,o=e.end;t.step(new xt(s,o,s,o,new F(i,0,0),n.length,!0))}function yA(t,e,n,i,s){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(a,u)=>{let f=typeof s=="function"?s(a):s;if(a.isTextblock&&!a.hasMarkup(i,f)&&bA(t.doc,t.mapping.slice(o).map(u),i)){let h=null;if(i.schema.linebreakReplacement){let v=i.whitespace=="pre",S=!!i.contentMatch.matchType(i.schema.linebreakReplacement);v&&!S?h=!1:!v&&S&&(h=!0)}h===!1&&Nx(t,a,u,o),km(t,t.mapping.slice(o).map(u,1),i,void 0,h===null);let p=t.mapping.slice(o),g=p.map(u,1),b=p.map(u+a.nodeSize,1);return t.step(new xt(g,b,g+1,b-1,new F(G.from(i.create(f,null,a.marks)),0,0),1,!0)),h===!0&&Ox(t,a,u,o),!1}})}function Ox(t,e,n,i){e.forEach((s,o)=>{if(s.isText){let a,u=/\r?\n|\r/g;for(;a=u.exec(s.text);){let f=t.mapping.slice(i).map(n+1+o+a.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function Nx(t,e,n,i){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let a=t.mapping.slice(i).map(n+1+o);t.replaceWith(a,a+1,e.type.schema.text(`
61
+ `))}})}function bA(t,e,n){let i=t.resolve(e),s=i.index();return i.parent.canReplaceWith(s,s+1,n)}function vA(t,e,n,i,s){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let a=n.create(i,null,s||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,a);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new xt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new F(G.from(a),0,0),1,!0))}function Di(t,e,n=1,i){let s=t.resolve(e),o=s.depth-n,a=i&&i[i.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!a.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let h=s.depth-1,p=n-2;h>o;h--,p--){let g=s.node(h),b=s.index(h);if(g.type.spec.isolating)return!1;let v=g.content.cutByIndex(b,g.childCount),S=i&&i[p+1];S&&(v=v.replaceChild(0,S.type.create(S.attrs)));let w=i&&i[p]||g;if(!g.canReplace(b+1,g.childCount)||!w.type.validContent(v))return!1}let u=s.indexAfter(o),f=i&&i[0];return s.node(o).canReplaceWith(u,u,f?f.type:s.node(o+1).type)}function SA(t,e,n=1,i){let s=t.doc.resolve(e),o=G.empty,a=G.empty;for(let u=s.depth,f=s.depth-n,h=n-1;u>f;u--,h--){o=G.from(s.node(u).copy(o));let p=i&&i[h];a=G.from(p?p.type.create(p.attrs,a):s.node(u).copy(a))}t.step(new pt(e,e,new F(o.append(a),n,n),!0))}function Or(t,e){let n=t.resolve(e),i=n.index();return Rx(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function xA(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:i}=t.type.schema;for(let s=0;s<e.childCount;s++){let o=e.child(s),a=o.type==i?t.type.schema.nodes.text:o.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function Rx(t,e){return!!(t&&e&&!t.isLeaf&&xA(t,e))}function Zu(t,e,n=-1){let i=t.resolve(e);for(let s=i.depth;;s--){let o,a,u=i.index(s);if(s==i.depth?(o=i.nodeBefore,a=i.nodeAfter):n>0?(o=i.node(s+1),u++,a=i.node(s).maybeChild(u)):(o=i.node(s).maybeChild(u-1),a=i.node(s+1)),o&&!o.isTextblock&&Rx(o,a)&&i.node(s).canReplace(u,u+1))return e;if(s==0)break;e=n<0?i.before(s):i.after(s)}}function wA(t,e,n){let i=null,{linebreakReplacement:s}=t.doc.type.schema,o=t.doc.resolve(e-n),a=o.node().type;if(s&&a.inlineContent){let p=a.whitespace=="pre",g=!!a.contentMatch.matchType(s);p&&!g?i=!1:!p&&g&&(i=!0)}let u=t.steps.length;if(i===!1){let p=t.doc.resolve(e+n);Nx(t,p.node(),p.before(),u)}a.inlineContent&&km(t,e+n-1,a,o.node().contentMatchAt(o.index()),i==null);let f=t.mapping.slice(u),h=f.map(e-n);if(t.step(new pt(h,f.map(e+n,-1),F.empty,!0)),i===!0){let p=t.doc.resolve(h);Ox(t,p.node(),p.before(),t.steps.length)}return t}function kA(t,e,n){let i=t.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),n))return e;if(i.parentOffset==0)for(let s=i.depth-1;s>=0;s--){let o=i.index(s);if(i.node(s).canReplaceWith(o,o,n))return i.before(s+1);if(o>0)return null}if(i.parentOffset==i.parent.content.size)for(let s=i.depth-1;s>=0;s--){let o=i.indexAfter(s);if(i.node(s).canReplaceWith(o,o,n))return i.after(s+1);if(o<i.node(s).childCount)return null}return null}function Dx(t,e,n){let i=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let o=0;o<n.openStart;o++)s=s.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let a=i.depth;a>=0;a--){let u=a==i.depth?0:i.pos<=(i.start(a+1)+i.end(a+1))/2?-1:1,f=i.index(a)+(u>0?1:0),h=i.node(a),p=!1;if(o==1)p=h.canReplace(f,f,s);else{let g=h.contentMatchAt(f).findWrapping(s.firstChild.type);p=g&&h.canReplaceWith(f,f,g[0])}if(p)return u==0?i.pos:u<0?i.before(a+1):i.after(a+1)}return null}function ef(t,e,n=e,i=F.empty){if(e==n&&!i.size)return null;let s=t.resolve(e),o=t.resolve(n);return zx(s,o,i)?new pt(e,n,i):new TA(s,o,i).fit()}function zx(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class TA{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=G.empty;for(let s=0;s<=e.depth;s++){let o=e.node(s);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=G.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,s=this.close(e<0?this.$to:i.doc.resolve(e));if(!s)return null;let o=this.placed,a=i.depth,u=s.depth;for(;a&&u&&o.childCount==1;)o=o.firstChild.content,a--,u--;let f=new F(o,a,u);return e>-1?new xt(i.pos,e,this.$to.pos,this.$to.end(),f,n):f.size||i.pos!=this.$to.pos?new pt(i.pos,s.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,s=this.unplaced.openEnd;i<e;i++){let o=n.firstChild;if(n.childCount>1&&(s=0),o.type.spec.isolating&&s<=i){e=i;break}n=o.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let s,o=null;i?(o=Fh(this.unplaced.content,i-1).firstChild,s=o.content):s=this.unplaced.content;let a=s.firstChild;for(let u=this.depth;u>=0;u--){let{type:f,match:h}=this.frontier[u],p,g=null;if(n==1&&(a?h.matchType(a.type)||(g=h.fillBefore(G.from(a),!1)):o&&f.compatibleContent(o.type)))return{sliceDepth:i,frontierDepth:u,parent:o,inject:g};if(n==2&&a&&(p=h.findWrapping(a.type)))return{sliceDepth:i,frontierDepth:u,parent:o,wrap:p};if(o&&h.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,s=Fh(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new F(e,n+1,Math.max(i,s.size+n>=e.size-i?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:i}=this.unplaced,s=Fh(e,n);if(s.childCount<=1&&n>0){let o=e.size-n<=n+s.size;this.unplaced=new F(Co(e,n-1,1),n-1,o?n-1:i)}else this.unplaced=new F(Co(e,n,1),n,i)}placeNodes({sliceDepth:e,frontierDepth:n,parent:i,inject:s,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let w=0;w<o.length;w++)this.openFrontierNode(o[w]);let a=this.unplaced,u=i?i.content:a.content,f=a.openStart-e,h=0,p=[],{match:g,type:b}=this.frontier[n];if(s){for(let w=0;w<s.childCount;w++)p.push(s.child(w));g=g.matchFragment(s)}let v=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let w=u.child(h),k=g.matchType(w.type);if(!k)break;h++,(h>1||f==0||w.content.size)&&(g=k,p.push(Lx(w.mark(b.allowedMarks(w.marks)),h==1?f:0,h==u.childCount?v:-1)))}let S=h==u.childCount;S||(v=-1),this.placed=Mo(this.placed,n,G.from(p)),this.frontier[n].match=g,S&&v<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,k=u;w<v;w++){let E=k.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),k=E.content}this.unplaced=S?e==0?F.empty:new F(Co(a.content,e-1,1),e-1,v<0?a.openEnd:e-1):new F(Co(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Wh(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:i}=this.$to,s=this.$to.after(i);for(;i>1&&s==this.$to.end(--i);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:i,type:s}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),a=Wh(e,n,s,i,o);if(a){for(let u=n-1;u>=0;u--){let{match:f,type:h}=this.frontier[u],p=Wh(e,u,h,f,!0);if(!p||p.childCount)continue e}return{depth:n,fit:a,move:o?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=Mo(this.placed,n.depth,n.fit)),e=n.move;for(let i=n.depth+1;i<=e.depth;i++){let s=e.node(i),o=s.type.contentMatch.fillBefore(s.content,!0,e.index(i));this.openFrontierNode(s.type,s.attrs,o)}return e}openFrontierNode(e,n=null,i){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Mo(this.placed,this.depth,G.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=Mo(this.placed,this.frontier.length,n))}}function Co(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Co(t.firstChild.content,e-1,n)))}function Mo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Mo(t.lastChild.content,e-1,n)))}function Fh(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Lx(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,Lx(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(G.empty,!0)))),t.copy(i)}function Wh(t,e,n,i,s){let o=t.node(e),a=s?t.indexAfter(e):t.index(e);if(a==o.childCount&&!n.compatibleContent(o.type))return null;let u=i.fillBefore(o.content,!0,a);return u&&!EA(n,o.content,a)?u:null}function EA(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function CA(t){return t.spec.defining||t.spec.definingForContent}function MA(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),o=t.doc.resolve(n);if(zx(s,o,i))return t.step(new pt(e,n,i));let a=Bx(s,o);a[a.length-1]==0&&a.pop();let u=-(s.depth+1);a.unshift(u);for(let b=s.depth,v=s.pos-1;b>0;b--,v--){let S=s.node(b).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;a.indexOf(b)>-1?u=b:s.before(b)==v&&a.splice(1,0,-b)}let f=a.indexOf(u),h=[],p=i.openStart;for(let b=i.content,v=0;;v++){let S=b.firstChild;if(h.push(S),v==i.openStart)break;b=S.content}for(let b=p-1;b>=0;b--){let v=h[b],S=CA(v.type);if(S&&!v.sameMarkup(s.node(Math.abs(u)-1)))p=b;else if(S||!v.type.isTextblock)break}for(let b=i.openStart;b>=0;b--){let v=(b+p+1)%(i.openStart+1),S=h[v];if(S)for(let w=0;w<a.length;w++){let k=a[(w+f)%a.length],E=!0;k<0&&(E=!1,k=-k);let N=s.node(k-1),L=s.index(k-1);if(N.canReplaceWith(L,L,S.type,S.marks))return t.replace(s.before(k),E?o.after(k):n,new F(_x(i.content,0,i.openStart,v),v,i.openEnd))}}let g=t.steps.length;for(let b=a.length-1;b>=0&&(t.replace(e,n,i),!(t.steps.length>g));b--){let v=a[b];v<0||(e=s.before(v),n=o.after(v))}}function _x(t,e,n,i,s){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(_x(o.content,e+1,n,i,o)))}if(e>i){let o=s.contentMatchAt(0),a=o.fillBefore(t).append(t);t=a.append(o.matchFragment(a).fillBefore(G.empty,!0))}return t}function AA(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=kA(t.doc,e,i.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new F(G.from(i),0,0))}function OA(t,e,n){let i=t.doc.resolve(e),s=t.doc.resolve(n);if(i.parent.isTextblock&&s.parent.isTextblock&&i.start()!=s.start()&&i.parentOffset==0&&s.parentOffset==0){let a=i.sharedDepth(n),u=!1;for(let f=i.depth;f>a;f--)i.node(f).type.spec.isolating&&(u=!0);for(let f=s.depth;f>a;f--)s.node(f).type.spec.isolating&&(u=!0);if(!u){for(let f=i.depth;f>0&&e==i.start(f);f--)e=i.before(f);for(let f=s.depth;f>0&&n==s.start(f);f--)n=s.before(f);i=t.doc.resolve(e),s=t.doc.resolve(n)}}let o=Bx(i,s);for(let a=0;a<o.length;a++){let u=o[a],f=a==o.length-1;if(f&&u==0||i.node(u).type.contentMatch.validEnd)return t.delete(i.start(u),s.end(u));if(u>0&&(f||i.node(u-1).canReplace(i.index(u-1),s.indexAfter(u-1))))return t.delete(i.before(u),s.after(u))}for(let a=1;a<=i.depth&&a<=s.depth;a++)if(e-i.start(a)==i.depth-a&&n>i.end(a)&&s.end(a)-n!=s.depth-a&&i.start(a-1)==s.start(a-1)&&i.node(a-1).canReplace(i.index(a-1),s.index(a-1)))return t.delete(i.before(a),n);t.delete(e,n)}function Bx(t,e){let n=[],i=Math.min(t.depth,e.depth);for(let s=i;s>=0;s--){let o=t.start(s);if(o<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(o==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==o-1)&&n.push(s)}return n}class fl extends Ht{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at attribute step's position");let i=Object.create(null);for(let o in n.attrs)i[o]=n.attrs[o];i[this.attr]=this.value;let s=n.type.create(i,null,n.marks);return mt.fromReplace(e,this.pos,this.pos+1,new F(G.from(s),0,n.isLeaf?0:1))}getMap(){return fn.empty}invert(e){return new fl(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 fl(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 fl(n.pos,n.attr,n.value)}}Ht.jsonID("attr",fl);class Go extends Ht{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return mt.ok(i)}getMap(){return fn.empty}invert(e){return new Go(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Go(n.attr,n.value)}}Ht.jsonID("docAttr",Go);let pl=class extends Error{};pl=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};pl.prototype=Object.create(Error.prototype);pl.prototype.constructor=pl;pl.prototype.name="TransformError";class Em{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ko}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new pl(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let s=this.mapping.maps[i];i&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((o,a,u,f)=>{e=Math.min(e,u),n=Math.max(n,f)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,i=F.empty){let s=ef(this.doc,e,n,i);return s&&this.step(s),this}replaceWith(e,n,i){return this.replace(e,n,new F(G.from(i),0,0))}delete(e,n){return this.replace(e,n,F.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return MA(this,e,n,i),this}replaceRangeWith(e,n,i){return AA(this,e,n,i),this}deleteRange(e,n){return OA(this,e,n),this}lift(e,n){return hA(this,e,n),this}join(e,n=1){return wA(this,e,n),this}wrap(e,n){return gA(this,e,n),this}setBlockType(e,n=e,i,s=null){return yA(this,e,n,i,s),this}setNodeMarkup(e,n,i=null,s){return vA(this,e,n,i,s),this}setNodeAttribute(e,n,i){return this.step(new fl(e,n,i)),this}setDocAttribute(e,n){return this.step(new Go(e,n)),this}addNodeMark(e,n){return this.step(new vr(e,n)),this}removeNodeMark(e,n){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(n instanceof Ke)n.isInSet(i.marks)&&this.step(new us(e,n));else{let s=i.marks,o,a=[];for(;o=n.isInSet(s);)a.push(new us(e,o)),s=o.removeFromSet(s);for(let u=a.length-1;u>=0;u--)this.step(a[u])}return this}split(e,n=1,i){return SA(this,e,n,i),this}addMark(e,n,i){return uA(this,e,n,i),this}removeMark(e,n,i){return fA(this,e,n,i),this}clearIncompatible(e,n,i){return km(this,e,n,i),this}}const Qh=Object.create(null);class he{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new Hx(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=F.empty){let i=n.content.lastChild,s=null;for(let u=0;u<n.openEnd;u++)s=i,i=i.lastChild;let o=e.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:f,$to:h}=a[u],p=e.mapping.slice(o);e.replaceRange(p.map(f.pos),p.map(h.pos),u?F.empty:n),u==0&&l1(e,o,(i?i.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:u}=s[o],f=e.mapping.slice(i),h=f.map(a.pos),p=f.map(u.pos);o?e.deleteRange(h,p):(e.replaceRangeWith(h,p,n),l1(e,i,n.isInline?-1:1))}}static findFrom(e,n,i=!1){let s=e.parent.inlineContent?new ce(e):ol(e.node(0),e.parent,e.pos,e.index(),n,i);if(s)return s;for(let o=e.depth-1;o>=0;o--){let a=n<0?ol(e.node(0),e.node(o),e.before(o+1),e.index(o),n,i):ol(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,i);if(a)return a}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new hn(e.node(0))}static atStart(e){return ol(e,e,0,0,1)||new hn(e)}static atEnd(e){return ol(e,e,e.content.size,e.childCount,-1)||new hn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Qh[n.type];if(!i)throw new RangeError(`No selection type ${n.type} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in Qh)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qh[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ce.between(this.$anchor,this.$head).getBookmark()}}he.prototype.visible=!0;class Hx{constructor(e,n){this.$from=e,this.$to=n}}let r1=!1;function s1(t){!r1&&!t.parent.inlineContent&&(r1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ce extends he{constructor(e,n=e){s1(e),s1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let i=e.resolve(n.map(this.head));if(!i.parent.inlineContent)return he.near(i);let s=e.resolve(n.map(this.anchor));return new ce(s.parent.inlineContent?s:i,i)}replace(e,n=F.empty){if(super.replace(e,n),n==F.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof ce&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new tf(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 ce(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,i=n){let s=e.resolve(n);return new this(s,i==n?s:e.resolve(i))}static between(e,n,i){let s=e.pos-n.pos;if((!i||s)&&(i=s>=0?1:-1),!n.parent.inlineContent){let o=he.findFrom(n,i,!0)||he.findFrom(n,-i,!0);if(o)n=o.$head;else return he.near(n,i)}return e.parent.inlineContent||(s==0?e=n:(e=(he.findFrom(e,-i,!0)||he.findFrom(e,i,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new ce(e,n)}}he.jsonID("text",ce);class tf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new tf(e.map(this.anchor),e.map(this.head))}resolve(e){return ce.between(e.resolve(this.anchor),e.resolve(this.head))}}class oe extends he{constructor(e){let n=e.nodeAfter,i=e.node(0).resolve(e.pos+n.nodeSize);super(e,i),this.node=n}map(e,n){let{deleted:i,pos:s}=n.mapResult(this.anchor),o=e.resolve(s);return i?he.near(o):new oe(o)}content(){return new F(G.from(this.node),0,0)}eq(e){return e instanceof oe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Cm(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new oe(e.resolve(n.anchor))}static create(e,n){return new oe(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}oe.prototype.visible=!1;he.jsonID("node",oe);class Cm{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new tf(i,i):new Cm(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&oe.isSelectable(i)?new oe(n):he.near(n)}}class hn extends he{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=F.empty){if(n==F.empty){e.delete(0,e.doc.content.size);let i=he.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new hn(e)}map(e){return new hn(e)}eq(e){return e instanceof hn}getBookmark(){return NA}}he.jsonID("all",hn);const NA={map(){return this},resolve(t){return new hn(t)}};function ol(t,e,n,i,s,o=!1){if(e.inlineContent)return ce.create(t,n);for(let a=i-(s>0?0:1);s>0?a<e.childCount:a>=0;a+=s){let u=e.child(a);if(u.isAtom){if(!o&&oe.isSelectable(u))return oe.create(t,n-(s<0?u.nodeSize:0))}else{let f=ol(t,u,n+s,s<0?u.childCount:0,s,o);if(f)return f}n+=u.nodeSize*s}return null}function l1(t,e,n){let i=t.steps.length-1;if(i<e)return;let s=t.steps[i];if(!(s instanceof pt||s instanceof xt))return;let o=t.mapping.maps[i],a;o.forEach((u,f,h,p)=>{a==null&&(a=p)}),t.setSelection(he.near(t.doc.resolve(a),n))}const o1=1,Oc=2,a1=4;class RA extends Em{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|o1)&~Oc,this.storedMarks=null,this}get selectionSet(){return(this.updated&o1)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Oc,this}ensureMarks(e){return Ke.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&Oc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Oc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let i=this.selection;return n&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||Ke.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,i){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(i==null&&(i=n),!e)return this.deleteRange(n,i);let o=this.storedMarks;if(!o){let a=this.doc.resolve(n);o=i==n?a.marks():a.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(n,i,s.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(he.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|=a1,this}get scrolledIntoView(){return(this.updated&a1)>0}}function c1(t,e){return!e||!t?t:t.bind(e)}class Ao{constructor(e,n,i){this.name=e,this.init=c1(n.init,i),this.apply=c1(n.apply,i)}}const DA=[new Ao("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ao("selection",{init(t,e){return t.selection||he.atStart(e.doc)},apply(t){return t.selection}}),new Ao("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,i){return i.selection.$cursor?t.storedMarks:null}}),new Ao("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Jh{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=DA.slice(),n&&n.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new Ao(i.key,i.spec.state,i))})}}class ul{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 i=0;i<this.config.plugins.length;i++)if(i!=n){let s=this.config.plugins[i];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],i=this.applyInner(e),s=null;for(;;){let o=!1;for(let a=0;a<this.config.plugins.length;a++){let u=this.config.plugins[a];if(u.spec.appendTransaction){let f=s?s[a].n:0,h=s?s[a].state:this,p=f<n.length&&u.spec.appendTransaction.call(u,f?n.slice(f):n,h,i);if(p&&i.filterTransaction(p,a)){if(p.setMeta("appendedTransaction",e),!s){s=[];for(let g=0;g<this.config.plugins.length;g++)s.push(g<a?{state:i,n:n.length}:{state:this,n:0})}n.push(p),i=i.applyInner(p),o=!0}s&&(s[a]={state:i,n:n.length})}}if(!o)return{state:i,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ul(this.config),i=this.config.fields;for(let s=0;s<i.length;s++){let o=i[s];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new RA(this)}static create(e){let n=new Jh(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new ul(n);for(let s=0;s<n.fields.length;s++)i[n.fields[s].name]=n.fields[s].init(e,i);return i}reconfigure(e){let n=new Jh(this.schema,e.plugins),i=n.fields,s=new ul(n);for(let o=0;o<i.length;o++){let a=i[o].name;s[a]=this.hasOwnProperty(a)?this[a]:i[o].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[i],o=s.spec.state;o&&o.toJSON&&(n[i]=o.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,i){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Jh(e.schema,e.plugins),o=new ul(s);return s.fields.forEach(a=>{if(a.name=="doc")o.doc=xr.fromJSON(e.schema,n.doc);else if(a.name=="selection")o.selection=he.fromJSON(o.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let u in i){let f=i[u],h=f.spec.state;if(f.key==a.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){o[a.name]=h.fromJSON.call(f,e,n[u],o);return}}o[a.name]=a.init(e,o)}}),o}}function Ux(t,e,n){for(let i in t){let s=t[i];s instanceof Function?s=s.bind(e):i=="handleDOMEvents"&&(s=Ux(s,e,{})),n[i]=s}return n}class Ye{constructor(e){this.spec=e,this.props={},e.props&&Ux(e.props,this,this.props),this.key=e.key?e.key.key:jx("plugin")}getState(e){return e[this.key]}}const Zh=Object.create(null);function jx(t){return t in Zh?t+"$"+ ++Zh[t]:(Zh[t]=0,t+"$")}class et{constructor(e="key"){this.key=jx(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Mm=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Ix(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Vx=(t,e,n)=>{let i=Ix(t,n);if(!i)return!1;let s=Am(i);if(!s){let a=i.blockRange(),u=a&&kl(a);return u==null?!1:(e&&e(t.tr.lift(a,u).scrollIntoView()),!0)}let o=s.nodeBefore;if(Wx(t,s,e,-1))return!0;if(i.parent.content.size==0&&(ml(o,"end")||oe.isSelectable(o)))for(let a=i.depth;;a--){let u=ef(t.doc,i.before(a),i.after(a),F.empty);if(u&&u.slice.size<u.to-u.from){if(e){let f=t.tr.step(u);f.setSelection(ml(o,"end")?he.findFrom(f.doc.resolve(f.mapping.map(s.pos,-1)),-1):oe.create(f.doc,s.pos-o.nodeSize)),e(f.scrollIntoView())}return!0}if(a==1||i.node(a-1).childCount>1)break}return o.isAtom&&s.depth==i.depth-1?(e&&e(t.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0):!1},zA=(t,e,n)=>{let i=Ix(t,n);if(!i)return!1;let s=Am(i);return s?$x(t,s,e):!1},LA=(t,e,n)=>{let i=Px(t,n);if(!i)return!1;let s=Om(i);return s?$x(t,s,e):!1};function $x(t,e,n){let i=e.nodeBefore,s=i,o=e.pos-1;for(;!s.isTextblock;o--){if(s.type.spec.isolating)return!1;let p=s.lastChild;if(!p)return!1;s=p}let a=e.nodeAfter,u=a,f=e.pos+1;for(;!u.isTextblock;f++){if(u.type.spec.isolating)return!1;let p=u.firstChild;if(!p)return!1;u=p}let h=ef(t.doc,o,f,F.empty);if(!h||h.from!=o||h instanceof pt&&h.slice.size>=f-o)return!1;if(n){let p=t.tr.step(h);p.setSelection(ce.create(p.doc,o)),n(p.scrollIntoView())}return!0}function ml(t,e,n=!1){for(let i=t;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(n&&i.childCount!=1)return!1}return!1}const qx=(t,e,n)=>{let{$head:i,empty:s}=t.selection,o=i;if(!s)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):i.parentOffset>0)return!1;o=Am(i)}let a=o&&o.nodeBefore;return!a||!oe.isSelectable(a)?!1:(e&&e(t.tr.setSelection(oe.create(t.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function Am(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 Px(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Kx=(t,e,n)=>{let i=Px(t,n);if(!i)return!1;let s=Om(i);if(!s)return!1;let o=s.nodeAfter;if(Wx(t,s,e,1))return!0;if(i.parent.content.size==0&&(ml(o,"start")||oe.isSelectable(o))){let a=ef(t.doc,i.before(),i.after(),F.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=t.tr.step(a);u.setSelection(ml(o,"start")?he.findFrom(u.doc.resolve(u.mapping.map(s.pos)),1):oe.create(u.doc,u.mapping.map(s.pos))),e(u.scrollIntoView())}return!0}}return o.isAtom&&s.depth==i.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0):!1},Gx=(t,e,n)=>{let{$head:i,empty:s}=t.selection,o=i;if(!s)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):i.parentOffset<i.parent.content.size)return!1;o=Om(i)}let a=o&&o.nodeAfter;return!a||!oe.isSelectable(a)?!1:(e&&e(t.tr.setSelection(oe.create(t.doc,o.pos)).scrollIntoView()),!0)};function Om(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 _A=(t,e)=>{let n=t.selection,i=n instanceof oe,s;if(i){if(n.node.isTextblock||!Or(t.doc,n.from))return!1;s=n.from}else if(s=Zu(t.doc,n.from,-1),s==null)return!1;if(e){let o=t.tr.join(s);i&&o.setSelection(oe.create(o.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},BA=(t,e)=>{let n=t.selection,i;if(n instanceof oe){if(n.node.isTextblock||!Or(t.doc,n.to))return!1;i=n.to}else if(i=Zu(t.doc,n.to,1),i==null)return!1;return e&&e(t.tr.join(i).scrollIntoView()),!0},HA=(t,e)=>{let{$from:n,$to:i}=t.selection,s=n.blockRange(i),o=s&&kl(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)},Yx=(t,e)=>{let{$head:n,$anchor:i}=t.selection;return!n.parent.type.spec.code||!n.sameParent(i)?!1:(e&&e(t.tr.insertText(`
62
+ `).scrollIntoView()),!0)};function Nm(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 UA=(t,e)=>{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let s=n.node(-1),o=n.indexAfter(-1),a=Nm(s.contentMatchAt(o));if(!a||!s.canReplaceWith(o,o,a))return!1;if(e){let u=n.after(),f=t.tr.replaceWith(u,u,a.createAndFill());f.setSelection(he.near(f.doc.resolve(u),1)),e(f.scrollIntoView())}return!0},Xx=(t,e)=>{let n=t.selection,{$from:i,$to:s}=n;if(n instanceof hn||i.parent.inlineContent||s.parent.inlineContent)return!1;let o=Nm(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!i.parentOffset&&s.index()<s.parent.childCount?i:s).pos,u=t.tr.insert(a,o.createAndFill());u.setSelection(ce.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},Fx=(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 o=n.before();if(Di(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let i=n.blockRange(),s=i&&kl(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)};function jA(t){return(e,n)=>{let{$from:i,$to:s}=e.selection;if(e.selection instanceof oe&&e.selection.node.isBlock)return!i.parentOffset||!Di(e.doc,i.pos)?!1:(n&&n(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let o=[],a,u,f=!1,h=!1;for(let v=i.depth;;v--)if(i.node(v).isBlock){f=i.end(v)==i.pos+(i.depth-v),h=i.start(v)==i.pos-(i.depth-v),u=Nm(i.node(v-1).contentMatchAt(i.indexAfter(v-1))),o.unshift(f&&u?{type:u}:null),a=v;break}else{if(v==1)return!1;o.unshift(null)}let p=e.tr;(e.selection instanceof ce||e.selection instanceof hn)&&p.deleteSelection();let g=p.mapping.map(i.pos),b=Di(p.doc,g,o.length,o);if(b||(o[0]=u?{type:u}:null,b=Di(p.doc,g,o.length,o)),!b)return!1;if(p.split(g,o.length,o),!f&&h&&i.node(a).type!=u){let v=p.mapping.map(i.before(a)),S=p.doc.resolve(v);u&&i.node(a-1).canReplaceWith(S.index(),S.index()+1,u)&&p.setNodeMarkup(p.mapping.map(i.before(a)),u)}return n&&n(p.scrollIntoView()),!0}}const IA=jA(),VA=(t,e)=>{let{$from:n,to:i}=t.selection,s,o=n.sharedDepth(i);return o==0?!1:(s=n.before(o),e&&e(t.tr.setSelection(oe.create(t.doc,s))),!0)};function $A(t,e,n){let i=e.nodeBefore,s=e.nodeAfter,o=e.index();return!i||!s||!i.type.compatibleContent(s.type)?!1:!i.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(s.isTextblock||Or(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Wx(t,e,n,i){let s=e.nodeBefore,o=e.nodeAfter,a,u,f=s.type.spec.isolating||o.type.spec.isolating;if(!f&&$A(t,e,n))return!0;let h=!f&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(u=s.contentMatchAt(s.childCount)).findWrapping(o.type))&&u.matchType(a[0]||o.type).validEnd){if(n){let v=e.pos+o.nodeSize,S=G.empty;for(let E=a.length-1;E>=0;E--)S=G.from(a[E].create(null,S));S=G.from(s.copy(S));let w=t.tr.step(new xt(e.pos-1,v,e.pos,v,new F(S,1,0),a.length,!0)),k=w.doc.resolve(v+2*a.length);k.nodeAfter&&k.nodeAfter.type==s.type&&Or(w.doc,k.pos)&&w.join(k.pos),n(w.scrollIntoView())}return!0}let p=o.type.spec.isolating||i>0&&f?null:he.findFrom(e,1),g=p&&p.$from.blockRange(p.$to),b=g&&kl(g);if(b!=null&&b>=e.depth)return n&&n(t.tr.lift(g,b).scrollIntoView()),!0;if(h&&ml(o,"start",!0)&&ml(s,"end")){let v=s,S=[];for(;S.push(v),!v.isTextblock;)v=v.lastChild;let w=o,k=1;for(;!w.isTextblock;w=w.firstChild)k++;if(v.canReplace(v.childCount,v.childCount,w.content)){if(n){let E=G.empty;for(let L=S.length-1;L>=0;L--)E=G.from(S[L].copy(E));let N=t.tr.step(new xt(e.pos-S.length,e.pos+o.nodeSize,e.pos+k,e.pos+o.nodeSize-k,new F(E,S.length,0),0,!0));n(N.scrollIntoView())}return!0}}return!1}function Qx(t){return function(e,n){let i=e.selection,s=t<0?i.$from:i.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return s.node(o).isTextblock?(n&&n(e.tr.setSelection(ce.create(e.doc,t<0?s.start(o):s.end(o)))),!0):!1}}const qA=Qx(-1),PA=Qx(1);function KA(t,e=null){return function(n,i){let{$from:s,$to:o}=n.selection,a=s.blockRange(o),u=a&&Tm(a,t,e);return u?(i&&i(n.tr.wrap(a,u).scrollIntoView()),!0):!1}}function u1(t,e=null){return function(n,i){let s=!1;for(let o=0;o<n.selection.ranges.length&&!s;o++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[o];n.doc.nodesBetween(a,u,(f,h)=>{if(s)return!1;if(!(!f.isTextblock||f.hasMarkup(t,e)))if(f.type==t)s=!0;else{let p=n.doc.resolve(h),g=p.index();s=p.parent.canReplaceWith(g,g+1,t)}})}if(!s)return!1;if(i){let o=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:f}}=n.selection.ranges[a];o.setBlockType(u,f,t,e)}i(o.scrollIntoView())}return!0}}function Rm(...t){return function(e,n,i){for(let s=0;s<t.length;s++)if(t[s](e,n,i))return!0;return!1}}Rm(Mm,Vx,qx);Rm(Mm,Kx,Gx);Rm(Yx,Xx,Fx,IA);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function GA(t,e=null){return function(n,i){let{$from:s,$to:o}=n.selection,a=s.blockRange(o);if(!a)return!1;let u=i?n.tr:null;return YA(u,a,t,e)?(i&&i(u.scrollIntoView()),!0):!1}}function YA(t,e,n,i=null){let s=!1,o=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=a.resolve(e.start-2);o=new iu(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new iu(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let u=Tm(o,n,i,e);return u?(t&&XA(t,e,u,s,n),!0):!1}function XA(t,e,n,i,s){let o=G.empty;for(let p=n.length-1;p>=0;p--)o=G.from(n[p].type.create(n[p].attrs,o));t.step(new xt(e.start-(i?2:0),e.end,e.start,e.end,new F(o,0,0),n.length,!0));let a=0;for(let p=0;p<n.length;p++)n[p].type==s&&(a=p+1);let u=n.length-a,f=e.start+n.length-(i?2:0),h=e.parent;for(let p=e.startIndex,g=e.endIndex,b=!0;p<g;p++,b=!1)!b&&Di(t.doc,f,u)&&(t.split(f,u),f+=2*u),f+=h.child(p).nodeSize;return t}function FA(t){return function(e,n){let{$from:i,$to:s}=e.selection,o=i.blockRange(s,a=>a.childCount>0&&a.firstChild.type==t);return o?n?i.node(o.depth-1).type==t?WA(e,n,t,o):QA(e,n,o):!0:!1}}function WA(t,e,n,i){let s=t.tr,o=i.end,a=i.$to.end(i.depth);o<a&&(s.step(new xt(o-1,a,o,a,new F(G.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new iu(s.doc.resolve(i.$from.pos),s.doc.resolve(a),i.depth));const u=kl(i);if(u==null)return!1;s.lift(i,u);let f=s.doc.resolve(s.mapping.map(o,-1)-1);return Or(s.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&s.join(f.pos),e(s.scrollIntoView()),!0}function QA(t,e,n){let i=t.tr,s=n.parent;for(let v=n.end,S=n.endIndex-1,w=n.startIndex;S>w;S--)v-=s.child(S).nodeSize,i.delete(v-1,v+1);let o=i.doc.resolve(n.start),a=o.nodeAfter;if(i.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,f=n.endIndex==s.childCount,h=o.node(-1),p=o.index(-1);if(!h.canReplace(p+(u?0:1),p+1,a.content.append(f?G.empty:G.from(s))))return!1;let g=o.pos,b=g+a.nodeSize;return i.step(new xt(g-(u?1:0),b+(f?1:0),g+1,b-1,new F((u?G.empty:G.from(s.copy(G.empty))).append(f?G.empty:G.from(s.copy(G.empty))),u?0:1,f?0:1),u?0:1)),e(i.scrollIntoView()),!0}function JA(t){return function(e,n){let{$from:i,$to:s}=e.selection,o=i.blockRange(s,h=>h.childCount>0&&h.firstChild.type==t);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let u=o.parent,f=u.child(a-1);if(f.type!=t)return!1;if(n){let h=f.lastChild&&f.lastChild.type==u.type,p=G.from(h?t.create():null),g=new F(G.from(t.create(null,G.from(u.type.create(null,p)))),h?3:1,0),b=o.start,v=o.end;n(e.tr.step(new xt(b-(h?3:1),v,b,v,g,1,!0)).scrollIntoView())}return!0}}const Nt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},gl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Hp=null;const Mi=function(t,e,n){let i=Hp||(Hp=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},ZA=function(){Hp=null},fs=function(t,e,n,i){return n&&(f1(t,e,n,i,-1)||f1(t,e,n,i,1))},eO=/^(img|br|input|textarea|hr)$/i;function f1(t,e,n,i,s){for(var o;;){if(t==n&&e==i)return!0;if(e==(s<0?0:On(t))){let a=t.parentNode;if(!a||a.nodeType!=1||ia(t)||eO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Nt(t)+(s<0?0:1),t=a}else if(t.nodeType==1){let a=t.childNodes[e+(s<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((o=a.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=s;else return!1;else t=a,e=s<0?On(t):0}else return!1}}function On(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function tO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=On(t)}else if(t.parentNode&&!ia(t))e=Nt(t),t=t.parentNode;else return null}}function nO(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ia(t))e=Nt(t)+1,t=t.parentNode;else return null}}function iO(t,e,n){for(let i=e==0,s=e==On(t);i||s;){if(t==n)return!0;let o=Nt(t);if(t=t.parentNode,!t)return!1;i=i&&o==0,s=s&&o==On(t)}}function ia(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 nf=function(t){return t.focusNode&&fs(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Zr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function rO(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function sO(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(On(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(On(i.startContainer),i.startOffset)}}}const Zn=typeof navigator<"u"?navigator:null,d1=typeof document<"u"?document:null,Nr=Zn&&Zn.userAgent||"",Up=/Edge\/(\d+)/.exec(Nr),Jx=/MSIE \d/.exec(Nr),jp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Nr),Jt=!!(Jx||jp||Up),kr=Jx?document.documentMode:jp?+jp[1]:Up?+Up[1]:0,Nn=!Jt&&/gecko\/(\d+)/i.test(Nr);Nn&&+(/Firefox\/(\d+)/.exec(Nr)||[0,0])[1];const Ip=!Jt&&/Chrome\/(\d+)/.exec(Nr),Dt=!!Ip,Zx=Ip?+Ip[1]:0,_t=!Jt&&!!Zn&&/Apple Computer/.test(Zn.vendor),yl=_t&&(/Mobile\/\w+/.test(Nr)||!!Zn&&Zn.maxTouchPoints>2),An=yl||(Zn?/Mac/.test(Zn.platform):!1),ew=Zn?/Win/.test(Zn.platform):!1,Ai=/Android \d/.test(Nr),ra=!!d1&&"webkitFontSmoothing"in d1.documentElement.style,lO=ra?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function wi(t,e){return typeof t=="number"?t:t[e]}function aO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,i=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*i}}function h1(t,e,n){let i=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let a=n||t.dom;a;){if(a.nodeType!=1){a=gl(a);continue}let u=a,f=u==o.body,h=f?oO(o):aO(u),p=0,g=0;if(e.top<h.top+wi(i,"top")?g=-(h.top-e.top+wi(s,"top")):e.bottom>h.bottom-wi(i,"bottom")&&(g=e.bottom-e.top>h.bottom-h.top?e.top+wi(s,"top")-h.top:e.bottom-h.bottom+wi(s,"bottom")),e.left<h.left+wi(i,"left")?p=-(h.left-e.left+wi(s,"left")):e.right>h.right-wi(i,"right")&&(p=e.right-h.right+wi(s,"right")),p||g)if(f)o.defaultView.scrollBy(p,g);else{let v=u.scrollLeft,S=u.scrollTop;g&&(u.scrollTop+=g),p&&(u.scrollLeft+=p);let w=u.scrollLeft-v,k=u.scrollTop-S;e={left:e.left-w,top:e.top-k,right:e.right-w,bottom:e.bottom-k}}let b=f?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(b))break;a=b=="absolute"?a.offsetParent:gl(a)}}function cO(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),i,s;for(let o=(e.left+e.right)/2,a=n+1;a<Math.min(innerHeight,e.bottom);a+=5){let u=t.root.elementFromPoint(o,a);if(!u||u==t.dom||!t.dom.contains(u))continue;let f=u.getBoundingClientRect();if(f.top>=n-20){i=u,s=f.top;break}}return{refDOM:i,refTop:s,stack:tw(t.dom)}}function tw(t){let e=[],n=t.ownerDocument;for(let i=t;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=n);i=gl(i));return e}function uO({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;nw(n,i==0?0:i-e)}function nw(t,e){for(let n=0;n<t.length;n++){let{dom:i,top:s,left:o}=t[n];i.scrollTop!=s+e&&(i.scrollTop=s+e),i.scrollLeft!=o&&(i.scrollLeft=o)}}let sl=null;function fO(t){if(t.setActive)return t.setActive();if(sl)return t.focus(sl);let e=tw(t);t.focus(sl==null?{get preventScroll(){return sl={preventScroll:!0},!0}}:void 0),sl||(sl=!1,nw(e,0))}function iw(t,e){let n,i=2e8,s,o=0,a=e.top,u=e.top,f,h;for(let p=t.firstChild,g=0;p;p=p.nextSibling,g++){let b;if(p.nodeType==1)b=p.getClientRects();else if(p.nodeType==3)b=Mi(p).getClientRects();else continue;for(let v=0;v<b.length;v++){let S=b[v];if(S.top<=a&&S.bottom>=u){a=Math.max(S.bottom,a),u=Math.min(S.top,u);let w=S.left>e.left?S.left-e.left:S.right<e.left?e.left-S.right:0;if(w<i){n=p,i=w,s=w&&n.nodeType==3?{left:S.right<e.left?S.right:S.left,top:e.top}:e,p.nodeType==1&&w&&(o=g+(e.left>=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!f&&S.left<=e.left&&S.right>=e.left&&(f=p,h={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(o=g+1)}}return!n&&f&&(n=f,s=h,i=0),n&&n.nodeType==3?dO(n,s):!n||i&&n.nodeType==1?{node:t,offset:o}:iw(n,s)}function dO(t,e){let n=t.nodeValue.length,i=document.createRange(),s;for(let o=0;o<n;o++){i.setEnd(t,o+1),i.setStart(t,o);let a=ur(i,1);if(a.top!=a.bottom&&Dm(e,a)){s={node:t,offset:o+(e.left>=(a.left+a.right)/2?1:0)};break}}return i.detach(),s||{node:t,offset:0}}function Dm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function hO(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function pO(t,e,n){let{node:i,offset:s}=iw(e,n),o=-1;if(i.nodeType==1&&!i.firstChild){let a=i.getBoundingClientRect();o=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(i,s,o)}function mO(t,e,n,i){let s=-1;for(let o=e,a=!1;o!=t.dom;){let u=t.docView.nearestDesc(o,!0),f;if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent||!u.contentDOM)&&((f=u.dom.getBoundingClientRect()).width||f.height)&&(u.node.isBlock&&u.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(u.dom.nodeName)&&(!a&&f.left>i.left||f.top>i.top?s=u.posBefore:(!a&&f.right<i.left||f.bottom<i.top)&&(s=u.posAfter),a=!0),!u.contentDOM&&s<0&&!u.node.isText))return(u.node.isBlock?i.top<(f.top+f.bottom)/2:i.left<(f.left+f.right)/2)?u.posBefore:u.posAfter;o=u.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function rw(t,e,n){let i=t.childNodes.length;if(i&&n.top<n.bottom)for(let s=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-n.top)/(n.bottom-n.top))-2)),o=s;;){let a=t.childNodes[o];if(a.nodeType==1){let u=a.getClientRects();for(let f=0;f<u.length;f++){let h=u[f];if(Dm(e,h))return rw(a,e,h)}}if((o=(o+1)%i)==s)break}return t}function gO(t,e){let n=t.dom.ownerDocument,i,s=0,o=sO(n,e.left,e.top);o&&({node:i,offset:s}=o);let a=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),u;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let h=t.dom.getBoundingClientRect();if(!Dm(e,h)||(a=rw(t.dom,e,h),!a))return null}if(_t)for(let h=a;i&&h;h=gl(h))h.draggable&&(i=void 0);if(a=hO(a,e),i){if(Nn&&i.nodeType==1&&(s=Math.min(s,i.childNodes.length),s<i.childNodes.length)){let p=i.childNodes[s],g;p.nodeName=="IMG"&&(g=p.getBoundingClientRect()).right<=e.left&&g.bottom>e.top&&s++}let h;ra&&s&&i.nodeType==1&&(h=i.childNodes[s-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&s--,i==t.dom&&s==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:(s==0||i.nodeType!=1||i.childNodes[s-1].nodeName!="BR")&&(u=mO(t,i,s,e))}u==null&&(u=pO(t,a,e));let f=t.docView.nearestDesc(a,!0);return{pos:u,inside:f?f.posAtStart-f.border:-1}}function p1(t){return t.top<t.bottom||t.left<t.right}function ur(t,e){let n=t.getClientRects();if(n.length){let i=n[e<0?0:n.length-1];if(p1(i))return i}return Array.prototype.find.call(n,p1)||t.getBoundingClientRect()}const yO=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function sw(t,e,n){let{node:i,offset:s,atom:o}=t.docView.domFromPos(e,n<0?-1:1),a=ra||Nn;if(i.nodeType==3)if(a&&(yO.test(i.nodeValue)||(n<0?!s:s==i.nodeValue.length))){let f=ur(Mi(i,s,s),n);if(Nn&&s&&/\s/.test(i.nodeValue[s-1])&&s<i.nodeValue.length){let h=ur(Mi(i,s-1,s-1),-1);if(h.top==f.top){let p=ur(Mi(i,s,s+1),-1);if(p.top!=f.top)return So(p,p.left<h.left)}}return f}else{let f=s,h=s,p=n<0?1:-1;return n<0&&!s?(h++,p=-1):n>=0&&s==i.nodeValue.length?(f--,p=1):n<0?f--:h++,So(ur(Mi(i,f,h),p),p<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&s&&(n<0||s==On(i))){let f=i.childNodes[s-1];if(f.nodeType==1)return ep(f.getBoundingClientRect(),!1)}if(o==null&&s<On(i)){let f=i.childNodes[s];if(f.nodeType==1)return ep(f.getBoundingClientRect(),!0)}return ep(i.getBoundingClientRect(),n>=0)}if(o==null&&s&&(n<0||s==On(i))){let f=i.childNodes[s-1],h=f.nodeType==3?Mi(f,On(f)-(a?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(h)return So(ur(h,1),!1)}if(o==null&&s<On(i)){let f=i.childNodes[s];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let h=f?f.nodeType==3?Mi(f,0,a?0:1):f.nodeType==1?f:null:null;if(h)return So(ur(h,-1),!0)}return So(ur(i.nodeType==3?Mi(i):i,-n),n>=0)}function So(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 ep(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 lw(t,e,n){let i=t.state,s=t.root.activeElement;i!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{i!=e&&t.updateState(i),s!=t.dom&&s&&s.focus()}}function bO(t,e,n){let i=e.selection,s=n=="up"?i.$from:i.$to;return lw(t,e,()=>{let{node:o}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let u=t.docView.nearestDesc(o,!0);if(!u)break;if(u.node.isBlock){o=u.contentDOM||u.dom;break}o=u.dom.parentNode}let a=sw(t,s.pos,1);for(let u=o.firstChild;u;u=u.nextSibling){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Mi(u,0,u.nodeValue.length).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.bottom>p.top+1&&(n=="up"?a.top-p.top>(p.bottom-a.top)*2:p.bottom-a.bottom>(a.bottom-p.top)*2))return!1}}return!0})}const vO=/[\u0590-\u08ac]/;function SO(t,e,n){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let s=i.parentOffset,o=!s,a=s==i.parent.content.size,u=t.domSelection();return u?!vO.test(i.parent.textContent)||!u.modify?n=="left"||n=="backward"?o:a:lw(t,e,()=>{let{focusNode:f,focusOffset:h,anchorNode:p,anchorOffset:g}=t.domSelectionRange(),b=u.caretBidiLevel;u.modify("move",n,"character");let v=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:S,focusOffset:w}=t.domSelectionRange(),k=S&&!v.contains(S.nodeType==1?S:S.parentNode)||f==S&&h==w;try{u.collapse(p,g),f&&(f!=p||h!=g)&&u.extend&&u.extend(f,h)}catch{}return b!=null&&(u.caretBidiLevel=b),k}):i.pos==i.start()||i.pos==i.end()}let m1=null,g1=null,y1=!1;function xO(t,e,n){return m1==e&&g1==n?y1:(m1=e,g1=n,y1=n=="up"||n=="down"?bO(t,e,n):SO(t,e,n))}const Rn=0,b1=1,es=2,ei=3;class sa{constructor(e,n,i,s){this.parent=e,this.children=n,this.dom=i,this.contentDOM=s,this.dirty=Rn,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,i){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,i=this.posAtStart;;n++){let s=this.children[n];if(s==e)return i;i+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let o,a;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((a=o.pmViewDesc)&&a.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(a)+a.size:this.posAtStart}else{let o,a;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((a=o.pmViewDesc)&&a.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>Nt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!1;break}if(o.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){s=!0;break}if(o.nextSibling)break}}return s??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let i=!0,s=e;s;s=s.parentNode){let o=this.getDesc(s),a;if(o&&(!n||o.node))if(i&&(a=o.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))i=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let i=n;i;i=i.parent)if(i==this)return n}posFromDOM(e,n,i){for(let s=e;s;s=s.parentNode){let o=this.getDesc(s);if(o)return o.localPosFromDOM(e,n,i)}return-1}descAt(e){for(let n=0,i=0;n<this.children.length;n++){let s=this.children[n],o=i+s.size;if(i==e&&o!=i){for(;!s.border&&s.children.length;)for(let a=0;a<s.children.length;a++){let u=s.children[a];if(u.size){s=u;break}}return s}if(e<o)return s.descAt(e-i-s.border);i=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,s=0;for(let o=0;i<this.children.length;i++){let a=this.children[i],u=o+a.size;if(u>e||a instanceof aw){s=e-o;break}o=u}if(s)return this.children[i].domFromPos(s-this.children[i].border,n);for(let o;i&&!(o=this.children[i-1]).size&&o instanceof ow&&o.side>=0;i--);if(n<=0){let o,a=!0;for(;o=i?this.children[i-1]:null,!(!o||o.dom.parentNode==this.contentDOM);i--,a=!1);return o&&n&&a&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Nt(o.dom)+1:0}}else{let o,a=!0;for(;o=i<this.children.length?this.children[i]:null,!(!o||o.dom.parentNode==this.contentDOM);i++,a=!1);return o&&a&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Nt(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,o=-1;for(let a=i,u=0;;u++){let f=this.children[u],h=a+f.size;if(s==-1&&e<=h){let p=a+f.border;if(e>=p&&n<=h-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(e,n,p);e=a;for(let g=u;g>0;g--){let b=this.children[g-1];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(1)){s=Nt(b.dom)+1;break}e-=b.size}s==-1&&(s=0)}if(s>-1&&(h>n||u==this.children.length-1)){n=h;for(let p=u+1;p<this.children.length;p++){let g=this.children[p];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){o=Nt(g.dom);break}n+=g.size}o==-1&&(o=this.contentDOM.childNodes.length);break}a=h}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:o}}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:i}=this.domFromPos(e,0);if(n.nodeType!=1||i==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[i]}setSelection(e,n,i,s=!1){let o=Math.min(e,n),a=Math.max(e,n);for(let v=0,S=0;v<this.children.length;v++){let w=this.children[v],k=S+w.size;if(o>S&&a<k)return w.setSelection(e-S-w.border,n-S-w.border,i,s);S=k}let u=this.domFromPos(e,e?-1:1),f=n==e?u:this.domFromPos(n,n?-1:1),h=i.root.getSelection(),p=i.domSelectionRange(),g=!1;if((Nn||_t)&&e==n){let{node:v,offset:S}=u;if(v.nodeType==3){if(g=!!(S&&v.nodeValue[S-1]==`
63
+ `),g&&S==v.nodeValue.length)for(let w=v,k;w;w=w.parentNode){if(k=w.nextSibling){k.nodeName=="BR"&&(u=f={node:k.parentNode,offset:Nt(k)+1});break}let E=w.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let w=v.childNodes[S-1];g=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(Nn&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let v=p.focusNode.childNodes[p.focusOffset];v&&v.contentEditable=="false"&&(s=!0)}if(!(s||g&&_t)&&fs(u.node,u.offset,p.anchorNode,p.anchorOffset)&&fs(f.node,f.offset,p.focusNode,p.focusOffset))return;let b=!1;if((h.extend||e==n)&&!(g&&Nn)){h.collapse(u.node,u.offset);try{e!=n&&h.extend(f.node,f.offset),b=!0}catch{}}if(!b){if(e>n){let S=u;u=f,f=S}let v=document.createRange();v.setEnd(f.node,f.offset),v.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(v)}}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 i=0,s=0;s<this.children.length;s++){let o=this.children[s],a=i+o.size;if(i==a?e<=a&&n>=i:e<a&&n>i){let u=i+o.border,f=a-o.border;if(e>=u&&n<=f){this.dirty=e==i||n==a?es:b1,e==u&&n==f&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=ei:o.markDirty(e-u,n-u);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?es:ei}i=a}this.dirty=es}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?es:b1;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ow extends sa{constructor(e,n,i,s){let o,a=n.type.toDOM;if(typeof a=="function"&&(a=a(i,()=>{if(!o)return s;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(a.nodeType!=1){let u=document.createElement("span");u.appendChild(a),a=u}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Rn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class wO extends sa{constructor(e,n,i,s){super(e,[],n,null),this.textDOM=i,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ds extends sa{constructor(e,n,i,s,o){super(e,[],i,s),this.mark=n,this.spec=o}static create(e,n,i,s){let o=s.nodeViews[n.type.name],a=o&&o(n,s,i);return(!a||!a.dom)&&(a=ys.renderSpec(document,n.type.spec.toDOM(n,i),null,n.attrs)),new ds(e,n,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&ei||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ei&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Rn){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=Rn}}slice(e,n,i){let s=ds.create(this.parent,this.mark,!0,i),o=this.children,a=this.size;n<a&&(o=$p(o,n,a,i)),e>0&&(o=$p(o,0,e,i));for(let u=0;u<o.length;u++)o[u].parent=s;return s.children=o,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Tr extends sa{constructor(e,n,i,s,o,a,u,f,h){super(e,[],o,a),this.node=n,this.outerDeco=i,this.innerDeco=s,this.nodeDOM=u}static create(e,n,i,s,o,a){let u=o.nodeViews[n.type.name],f,h=u&&u(n,o,()=>{if(!f)return a;if(f.parent)return f.parent.posBeforeChild(f)},i,s),p=h&&h.dom,g=h&&h.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:g}=ys.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!g&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let b=p;return p=fw(p,i,n),h?f=new kO(e,n,i,s,p,g||null,b,h,o,a+1):n.isText?new rf(e,n,i,s,p,b,o):new Tr(e,n,i,s,p,g||null,b,o,a+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 i=this.children[n];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,n,i){return this.dirty==Rn&&e.eq(this.node)&&su(n,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let i=this.node.inlineContent,s=n,o=e.composing?this.localCompositionInfo(e,n):null,a=o&&o.pos>-1?o:null,u=o&&o.pos<0,f=new EO(this,a&&a.node,e);AO(this.node,this.innerDeco,(h,p,g)=>{h.spec.marks?f.syncToMarks(h.spec.marks,i,e,p):h.type.side>=0&&!g&&f.syncToMarks(p==this.node.childCount?Ke.none:this.node.child(p).marks,i,e,p),f.placeWidget(h,e,s)},(h,p,g,b)=>{f.syncToMarks(h.marks,i,e,b);let v;f.findNodeMatch(h,p,g,b)||u&&e.state.selection.from>s&&e.state.selection.to<s+h.nodeSize&&(v=f.findIndexWithChild(o.node))>-1&&f.updateNodeAt(h,p,g,v,e)||f.updateNextNode(h,p,g,e,b,s)||f.addNode(h,p,g,e,s),s+=h.nodeSize}),f.syncToMarks([],i,e,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==es)&&(a&&this.protectLocalComposition(e,a),cw(this.contentDOM,this.children,e),yl&&OO(this.dom))}localCompositionInfo(e,n){let{from:i,to:s}=e.state.selection;if(!(e.state.selection instanceof ce)||i<n||s>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let a=o.nodeValue,u=NO(this.node.content,a,i-n,s-n);return u<0?null:{node:o,pos:u,text:a}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:i,text:s}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let a=new wO(this,o,n,s);e.input.compositionNodes.push(a),this.children=$p(this.children,i,i+s.length,e,a)}update(e,n,i,s){return this.dirty==ei||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,i,s),!0)}updateInner(e,n,i,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Rn}updateOuterDeco(e){if(su(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=uw(this.dom,this.nodeDOM,Vp(this.outerDeco,this.node,n),Vp(e,this.node,n)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function v1(t,e,n,i,s){fw(i,e,t);let o=new Tr(void 0,t,e,n,i,i,i,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class rf extends Tr{constructor(e,n,i,s,o,a,u){super(e,n,i,s,o,null,a,u,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,i,s){return this.dirty==ei||this.dirty!=Rn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Rn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Rn,!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,i){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,i){let s=this.node.cut(e,n),o=document.createTextNode(s.text);return new rf(this.parent,s,this.outerDeco,this.innerDeco,o,o,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ei)}get domAtom(){return!1}isText(e){return this.node.text==e}}class aw extends sa{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class kO extends Tr{constructor(e,n,i,s,o,a,u,f,h,p){super(e,n,i,s,o,a,u,h,p),this.spec=f}update(e,n,i,s){if(this.dirty==ei)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,i);return o&&this.updateInner(e,n,i,s),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,i,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,i,s){this.spec.setSelection?this.spec.setSelection(e,n,i.root):super.setSelection(e,n,i,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function cw(t,e,n){let i=t.firstChild,s=!1;for(let o=0;o<e.length;o++){let a=e[o],u=a.dom;if(u.parentNode==t){for(;u!=i;)i=S1(i),s=!0;i=i.nextSibling}else s=!0,t.insertBefore(u,i);if(a instanceof ds){let f=i?i.previousSibling:t.lastChild;cw(a.contentDOM,a.children,n),i=f?f.nextSibling:t.firstChild}}for(;i;)i=S1(i),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const zo=function(t){t&&(this.nodeName=t)};zo.prototype=Object.create(null);const ts=[new zo];function Vp(t,e,n){if(t.length==0)return ts;let i=n?ts[0]:new zo,s=[i];for(let o=0;o<t.length;o++){let a=t[o].type.attrs;if(a){a.nodeName&&s.push(i=new zo(a.nodeName));for(let u in a){let f=a[u];f!=null&&(n&&s.length==1&&s.push(i=new zo(e.isInline?"span":"div")),u=="class"?i.class=(i.class?i.class+" ":"")+f:u=="style"?i.style=(i.style?i.style+";":"")+f:u!="nodeName"&&(i[u]=f))}}}return s}function uw(t,e,n,i){if(n==ts&&i==ts)return e;let s=e;for(let o=0;o<i.length;o++){let a=i[o],u=n[o];if(o){let f;u&&u.nodeName==a.nodeName&&s!=t&&(f=s.parentNode)&&f.nodeName.toLowerCase()==a.nodeName||(f=document.createElement(a.nodeName),f.pmIsDeco=!0,f.appendChild(s),u=ts[0]),s=f}TO(s,u||ts[0],a)}return s}function TO(t,e,n){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in n)&&t.removeAttribute(i);for(let i in n)i!="class"&&i!="style"&&i!="nodeName"&&n[i]!=e[i]&&t.setAttribute(i,n[i]);if(e.class!=n.class){let i=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<i.length;o++)s.indexOf(i[o])==-1&&t.classList.remove(i[o]);for(let o=0;o<s.length;o++)i.indexOf(s[o])==-1&&t.classList.add(s[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=i.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function fw(t,e,n){return uw(t,t,ts,Vp(e,n,t.nodeType!=1))}function su(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 S1(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class EO{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=CO(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let i=e;i<n;i++)this.top.children[i].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,i,s){let o=0,a=this.stack.length>>1,u=Math.min(a,e.length);for(;o<u&&(o==a-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<a;)this.destroyRest(),this.top.dirty=Rn,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let f=-1,h=this.top.children.length;s<this.preMatch.index&&(h=Math.min(this.index+3,h));for(let p=this.index;p<h;p++){let g=this.top.children[p];if(g.matchesMark(e[a])&&!this.isLocked(g.dom)){f=p;break}}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=ds.create(this.top,e[a],n,i);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,a++}}findNodeMatch(e,n,i,s){let o=-1,a;if(s>=this.preMatch.index&&(a=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&a.matchesNode(e,n,i))o=this.top.children.indexOf(a,this.index);else for(let u=this.index,f=Math.min(this.top.children.length,u+5);u<f;u++){let h=this.top.children[u];if(h.matchesNode(e,n,i)&&!this.preMatch.matched.has(h)){o=u;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,i,s,o){let a=this.top.children[s];return a.dirty==ei&&a.dom==a.contentDOM&&(a.dirty=es),a.update(e,n,i,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==i)return s}return-1}e=n}}updateNextNode(e,n,i,s,o,a){for(let u=this.index;u<this.top.children.length;u++){let f=this.top.children[u];if(f instanceof Tr){let h=this.preMatch.matched.get(f);if(h!=null&&h!=o)return!1;let p=f.dom,g,b=this.isLocked(p)&&!(e.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==e.text&&f.dirty!=ei&&su(n,f.outerDeco));if(!b&&f.update(e,n,i,s))return this.destroyBetween(this.index,u),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!b&&(g=this.recreateWrapper(f,e,n,i,s,a)))return this.destroyBetween(this.index,u),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=es,g.updateChildren(s,a+1),g.dirty=Rn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,i,s,o,a){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!su(i,e.outerDeco)||!s.eq(e.innerDeco))return null;let u=Tr.create(this.top,n,i,s,o,a);if(u.contentDOM){u.children=e.children,e.children=[];for(let f of u.children)f.parent=u}return e.destroy(),u}addNode(e,n,i,s,o){let a=Tr.create(this.top,e,n,i,s,o);a.contentDOM&&a.updateChildren(s,o+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,n,i){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let o=new ow(this.top,e,n,i);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ds;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof rf)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((_t||Dt)&&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 i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let s=new aw(this.top,[],i,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function CO(t,e){let n=e,i=n.children.length,s=t.childCount,o=new Map,a=[];e:for(;s>0;){let u;for(;;)if(i){let h=n.children[i-1];if(h instanceof ds)n=h,i=h.children.length;else{u=h,i--;break}}else{if(n==e)break e;i=n.parent.children.indexOf(n),n=n.parent}let f=u.node;if(f){if(f!=t.child(s-1))break;--s,o.set(u,s),a.push(u)}}return{index:s,matched:o,matches:a.reverse()}}function MO(t,e){return t.type.side-e.type.side}function AO(t,e,n,i){let s=e.locals(t),o=0;if(s.length==0){for(let h=0;h<t.childCount;h++){let p=t.child(h);i(p,s,e.forChild(o,p),h),o+=p.nodeSize}return}let a=0,u=[],f=null;for(let h=0;;){let p,g;for(;a<s.length&&s[a].to==o;){let k=s[a++];k.widget&&(p?(g||(g=[p])).push(k):p=k)}if(p)if(g){g.sort(MO);for(let k=0;k<g.length;k++)n(g[k],h,!!f)}else n(p,h,!!f);let b,v;if(f)v=-1,b=f,f=null;else if(h<t.childCount)v=h,b=t.child(h++);else break;for(let k=0;k<u.length;k++)u[k].to<=o&&u.splice(k--,1);for(;a<s.length&&s[a].from<=o&&s[a].to>o;)u.push(s[a++]);let S=o+b.nodeSize;if(b.isText){let k=S;a<s.length&&s[a].from<k&&(k=s[a].from);for(let E=0;E<u.length;E++)u[E].to<k&&(k=u[E].to);k<S&&(f=b.cut(k-o),b=b.cut(0,k-o),S=k,v=-1)}else for(;a<s.length&&s[a].to<S;)a++;let w=b.isInline&&!b.isLeaf?u.filter(k=>!k.inline):u.slice();i(b,w,e.forChild(o,b),v),o=S}}function OO(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 NO(t,e,n,i){for(let s=0,o=0;s<t.childCount&&o<=i;){let a=t.child(s++),u=o;if(o+=a.nodeSize,!a.isText)continue;let f=a.text;for(;s<t.childCount;){let h=t.child(s++);if(o+=h.nodeSize,!h.isText)break;f+=h.text}if(o>=n){if(o>=i&&f.slice(i-e.length-u,i-u)==e)return i-e.length;let h=u<i?f.lastIndexOf(e,i-u-1):-1;if(h>=0&&h+e.length+u>=n)return u+h;if(n==i&&f.length>=i+e.length-u&&f.slice(i-u,i-u+e.length)==e)return i}}return-1}function $p(t,e,n,i,s){let o=[];for(let a=0,u=0;a<t.length;a++){let f=t[a],h=u,p=u+=f.size;h>=n||p<=e?o.push(f):(h<e&&o.push(f.slice(0,e-h,i)),s&&(o.push(s),s=void 0),p>n&&o.push(f.slice(n-h,f.size,i)))}return o}function zm(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),o=s&&s.size==0,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let u=i.resolve(a),f,h;if(nf(n)){for(f=a;s&&!s.node;)s=s.parent;let g=s.node;if(s&&g.isAtom&&oe.isSelectable(g)&&s.parent&&!(g.isInline&&iO(n.focusNode,n.focusOffset,s.dom))){let b=s.posBefore;h=new oe(a==b?u:i.resolve(b))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=a,b=a;for(let v=0;v<n.rangeCount;v++){let S=n.getRangeAt(v);g=Math.min(g,t.docView.posFromDOM(S.startContainer,S.startOffset,1)),b=Math.max(b,t.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(g<0)return null;[f,a]=b==t.state.selection.anchor?[b,g]:[g,b],u=i.resolve(a)}else f=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null}let p=i.resolve(f);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!o?1:-1;h=Lm(t,p,u,g)}return h}function dw(t){return t.editable?t.hasFocus():pw(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function zi(t,e=!1){let n=t.state.selection;if(hw(t,n),!!dw(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Dt){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&fs(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)DO(t);else{let{anchor:i,head:s}=n,o,a;x1&&!(n instanceof ce)&&(n.$from.parent.inlineContent||(o=w1(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=w1(t,n.to))),t.docView.setSelection(i,s,t,e),x1&&(o&&k1(o),a&&k1(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&RO(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const x1=_t||Dt&&Zx<63;function w1(t,e){let{node:n,offset:i}=t.docView.domFromPos(e,0),s=i<n.childNodes.length?n.childNodes[i]:null,o=i?n.childNodes[i-1]:null;if(_t&&s&&s.contentEditable=="false")return tp(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return tp(s);if(o)return tp(o)}}function tp(t){return t.contentEditable="true",_t&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function k1(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function RO(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),i=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=i||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!dw(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function DO(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,i=n.nodeName=="IMG";i?e.collapse(n.parentNode,Nt(n)+1):e.collapse(n,0),!i&&!t.state.selection.visible&&Jt&&kr<=11&&(n.disabled=!0,n.disabled=!1)}function hw(t,e){if(e instanceof oe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(T1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else T1(t)}function T1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Lm(t,e,n,i){return t.someProp("createSelectionBetween",s=>s(t,e,n))||ce.between(e,n,i)}function E1(t){return t.editable&&!t.hasFocus()?!1:pw(t)}function pw(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 zO(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return fs(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qp(t,e){let{$anchor:n,$head:i}=t.selection,s=e>0?n.max(i):n.min(i),o=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return o&&he.findFrom(o,e)}function fr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function C1(t,e,n){let i=t.state.selection;if(i instanceof ce)if(n.indexOf("s")>-1){let{$head:s}=i,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let a=t.state.doc.resolve(s.pos+o.nodeSize*(e<0?-1:1));return fr(t,new ce(i.$anchor,a))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=qp(t.state,e);return s&&s instanceof oe?fr(t,s):!1}else if(!(An&&n.indexOf("m")>-1)){let s=i.$head,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,a;if(!o||o.isText)return!1;let u=e<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(a=t.docView.descAt(u))&&!a.contentDOM?oe.isSelectable(o)?fr(t,new oe(e<0?t.state.doc.resolve(s.pos-o.nodeSize):s)):ra?fr(t,new ce(t.state.doc.resolve(e<0?u:u+o.nodeSize))):!1:!1}}else return!1;else{if(i instanceof oe&&i.node.isInline)return fr(t,new ce(e>0?i.$to:i.$from));{let s=qp(t.state,e);return s?fr(t,s):!1}}}function lu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Lo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ll(t,e){return e<0?LO(t):_O(t)}function LO(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let s,o,a=!1;for(Nn&&n.nodeType==1&&i<lu(n)&&Lo(n.childNodes[i],-1)&&(a=!0);;)if(i>0){if(n.nodeType!=1)break;{let u=n.childNodes[i-1];if(Lo(u,-1))s=n,o=--i;else if(u.nodeType==3)n=u,i=n.nodeValue.length;else break}}else{if(mw(n))break;{let u=n.previousSibling;for(;u&&Lo(u,-1);)s=n.parentNode,o=Nt(u),u=u.previousSibling;if(u)n=u,i=lu(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}a?Pp(t,n,i):s&&Pp(t,s,o)}function _O(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let s=lu(n),o,a;for(;;)if(i<s){if(n.nodeType!=1)break;let u=n.childNodes[i];if(Lo(u,1))o=n,a=++i;else break}else{if(mw(n))break;{let u=n.nextSibling;for(;u&&Lo(u,1);)o=u.parentNode,a=Nt(u)+1,u=u.nextSibling;if(u)n=u,i=0,s=lu(n);else{if(n=n.parentNode,n==t.dom)break;i=s=0}}}o&&Pp(t,o,a)}function mw(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function BO(t,e){for(;t&&e==t.childNodes.length&&!ia(t);)e=Nt(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 HO(t,e){for(;t&&!e&&!ia(t);)e=Nt(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 Pp(t,e,n){if(e.nodeType!=3){let o,a;(a=BO(e,n))?(e=a,n=0):(o=HO(e,n))&&(e=o,n=o.nodeValue.length)}let i=t.domSelection();if(!i)return;if(nf(i)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),i.removeAllRanges(),i.addRange(o)}else i.extend&&i.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&zi(t)},50)}function M1(t,e){let n=t.state.doc.resolve(e);if(!(Dt||ew)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>s.top&&a<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>s.top&&a<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function A1(t,e,n){let i=t.state.selection;if(i instanceof ce&&!i.empty||n.indexOf("s")>-1||An&&n.indexOf("m")>-1)return!1;let{$from:s,$to:o}=i;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=qp(t.state,e);if(a&&a instanceof oe)return fr(t,a)}if(!s.parent.inlineContent){let a=e<0?s:o,u=i instanceof hn?he.near(a,e):he.findFrom(a,e);return u?fr(t,u):!1}return!1}function O1(t,e){if(!(t.state.selection instanceof ce))return!0;let{$head:n,$anchor:i,empty:s}=t.state.selection;if(!n.sameParent(i))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let a=t.state.tr;return e<0?a.delete(n.pos-o.nodeSize,n.pos):a.delete(n.pos,n.pos+o.nodeSize),t.dispatch(a),!0}return!1}function N1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function UO(t){if(!_t||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 i=e.firstChild;N1(t,i,"true"),setTimeout(()=>N1(t,i,"false"),20)}return!1}function jO(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function IO(t,e){let n=e.keyCode,i=jO(e);if(n==8||An&&n==72&&i=="c")return O1(t,-1)||ll(t,-1);if(n==46&&!e.shiftKey||An&&n==68&&i=="c")return O1(t,1)||ll(t,1);if(n==13||n==27)return!0;if(n==37||An&&n==66&&i=="c"){let s=n==37?M1(t,t.state.selection.from)=="ltr"?-1:1:-1;return C1(t,s,i)||ll(t,s)}else if(n==39||An&&n==70&&i=="c"){let s=n==39?M1(t,t.state.selection.from)=="ltr"?1:-1:1;return C1(t,s,i)||ll(t,s)}else{if(n==38||An&&n==80&&i=="c")return A1(t,-1,i)||ll(t,-1);if(n==40||An&&n==78&&i=="c")return UO(t)||A1(t,1,i)||ll(t,1);if(i==(An?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function _m(t,e){t.someProp("transformCopied",v=>{e=v(e,t)});let n=[],{content:i,openStart:s,openEnd:o}=e;for(;s>1&&o>1&&i.childCount==1&&i.firstChild.childCount==1;){s--,o--;let v=i.firstChild;n.push(v.type.name,v.attrs!=v.type.defaultAttrs?v.attrs:null),i=v.content}let a=t.someProp("clipboardSerializer")||ys.fromSchema(t.state.schema),u=xw(),f=u.createElement("div");f.appendChild(a.serializeFragment(i,{document:u}));let h=f.firstChild,p,g=0;for(;h&&h.nodeType==1&&(p=Sw[h.nodeName.toLowerCase()]);){for(let v=p.length-1;v>=0;v--){let S=u.createElement(p[v]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),g++}h=f.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${s} ${o}${g?` -${g}`:""} ${JSON.stringify(n)}`);let b=t.someProp("clipboardTextSerializer",v=>v(e,t))||e.content.textBetween(0,e.content.size,`
64
+
65
+ `);return{dom:f,text:b,slice:e}}function gw(t,e,n,i,s){let o=s.parent.type.spec.code,a,u;if(!n&&!e)return null;let f=!!e&&(i||o||!n);if(f){if(t.someProp("transformPastedText",b=>{e=b(e,o||i,t)}),o)return u=new F(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
66
+ `))),0,0),t.someProp("transformPasted",b=>{u=b(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",b=>b(e,s,i,t));if(g)u=g;else{let b=s.marks(),{schema:v}=t.state,S=ys.fromSchema(v);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let k=a.appendChild(document.createElement("p"));w&&k.appendChild(S.serializeNode(v.text(w,b)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),a=PO(n),ra&&KO(a);let h=a&&a.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let g=+p[3];g>0;g--){let b=a.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;a=b}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||wr.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||p),context:s,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!VO.test(b.parentNode.nodeName)?{ignore:!0}:null}})),p)u=GO(R1(u,+p[1],+p[2]),p[4]);else if(u=F.maxOpen($O(u.content,s),!0),u.openStart||u.openEnd){let g=0,b=0;for(let v=u.content.firstChild;g<u.openStart&&!v.type.spec.isolating;g++,v=v.firstChild);for(let v=u.content.lastChild;b<u.openEnd&&!v.type.spec.isolating;b++,v=v.lastChild);u=R1(u,g,b)}return t.someProp("transformPasted",g=>{u=g(u,t,f)}),u}const VO=/^(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 $O(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),o,a=[];if(t.forEach(u=>{if(!a)return;let f=s.findWrapping(u.type),h;if(!f)return a=null;if(h=a.length&&o.length&&bw(f,o,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=vw(a[a.length-1],o.length));let p=yw(u,f);a.push(p),s=s.matchType(p.type),o=f}}),a)return G.from(a)}return t}function yw(t,e,n=0){for(let i=e.length-1;i>=n;i--)t=e[i].create(null,G.from(t));return t}function bw(t,e,n,i,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let o=bw(t,e,n,i.lastChild,s+1);if(o)return i.copy(i.content.replaceChild(i.childCount-1,o));if(i.contentMatchAt(i.childCount).matchType(s==t.length-1?n.type:t[s+1]))return i.copy(i.content.append(G.from(yw(n,t,s+1))))}}function vw(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,vw(t.lastChild,e-1)),i=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(i))}function Kp(t,e,n,i,s,o){let a=e<0?t.firstChild:t.lastChild,u=a.content;return t.childCount>1&&(o=0),s<i-1&&(u=Kp(u,e,n,i,s+1,o)),s>=n&&(u=e<0?a.contentMatchAt(0).fillBefore(u,o<=s).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(u))}function R1(t,e,n){return e<t.openStart&&(t=new F(Kp(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new F(Kp(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Sw={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 D1=null;function xw(){return D1||(D1=document.implementation.createHTMLDocument("title"))}let np=null;function qO(t){let e=window.trustedTypes;return e?(np||(np=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),np.createHTML(t)):t}function PO(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=xw().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&Sw[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=qO(t),s)for(let o=0;o<s.length;o++)n=n.querySelector(s[o])||n;return n}function KO(t){let e=t.querySelectorAll(Dt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let i=e[n];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),i)}}function GO(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return t}let{content:s,openStart:o,openEnd:a}=t;for(let u=i.length-2;u>=0;u-=2){let f=n.nodes[i[u]];if(!f||f.hasRequiredAttrs())break;s=G.from(f.create(i[u+1],s)),o++,a++}return new F(s,o,a)}const $t={},qt={},YO={touchstart:!0,touchmove:!0};class XO{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function FO(t){for(let e in $t){let n=$t[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=i=>{QO(t,i)&&!Bm(t,i)&&(t.editable||!(i.type in qt))&&n(t,i)},YO[e]?{passive:!0}:void 0)}_t&&t.dom.addEventListener("input",()=>null),Gp(t)}function Sr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function WO(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 Gp(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=i=>Bm(t,i))})}function Bm(t,e){return t.someProp("handleDOMEvents",n=>{let i=n[e.type];return i?i(t,e)||e.defaultPrevented:!1})}function QO(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 JO(t,e){!Bm(t,e)&&$t[e.type]&&(t.editable||!(e.type in qt))&&$t[e.type](t,e)}qt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!kw(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ai&&Dt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),yl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let i=Date.now();t.input.lastIOSEnter=i,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==i&&(t.someProp("handleKeyDown",s=>s(t,Zr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",i=>i(t,n))||IO(t,n)?n.preventDefault():Sr(t,"key")};qt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};qt.keypress=(t,e)=>{let n=e;if(kw(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||An&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let i=t.state.selection;if(!(i instanceof ce)||!i.$from.sameParent(i.$to)){let s=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",a=>a(t,i.$from.pos,i.$to.pos,s,o))&&t.dispatch(o()),n.preventDefault()}};function sf(t){return{left:t.clientX,top:t.clientY}}function ZO(t,e){let n=e.x-t.clientX,i=e.y-t.clientY;return n*n+i*i<100}function Hm(t,e,n,i,s){if(i==-1)return!1;let o=t.state.doc.resolve(i);for(let a=o.depth+1;a>0;a--)if(t.someProp(e,u=>a>o.depth?u(t,n,o.nodeAfter,o.before(a),s,!0):u(t,n,o.node(a),o.before(a),s,!1)))return!0;return!1}function dl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let i=t.state.tr.setSelection(e);i.setMeta("pointer",!0),t.dispatch(i)}function eN(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return i&&i.isAtom&&oe.isSelectable(i)?(dl(t,new oe(n)),!0):!1}function tN(t,e){if(e==-1)return!1;let n=t.state.selection,i,s;n instanceof oe&&(i=n.node);let o=t.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let u=a>o.depth?o.nodeAfter:o.node(a);if(oe.isSelectable(u)){i&&n.$from.depth>0&&a>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?s=o.before(n.$from.depth):s=o.before(a);break}}return s!=null?(dl(t,oe.create(t.state.doc,s)),!0):!1}function nN(t,e,n,i,s){return Hm(t,"handleClickOn",e,n,i)||t.someProp("handleClick",o=>o(t,e,i))||(s?tN(t,n):eN(t,n))}function iN(t,e,n,i){return Hm(t,"handleDoubleClickOn",e,n,i)||t.someProp("handleDoubleClick",s=>s(t,e,i))}function rN(t,e,n,i){return Hm(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",s=>s(t,e,i))||sN(t,n,i)}function sN(t,e,n){if(n.button!=0)return!1;let i=t.state.doc;if(e==-1)return i.inlineContent?(dl(t,ce.create(i,0,i.content.size)),!0):!1;let s=i.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o),u=s.before(o);if(a.inlineContent)dl(t,ce.create(i,u+1,u+1+a.content.size));else if(oe.isSelectable(a))dl(t,oe.create(i,u));else continue;return!0}}function Um(t){return ou(t)}const ww=An?"metaKey":"ctrlKey";$t.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let i=Um(t),s=Date.now(),o="singleClick";s-t.input.lastClick.time<500&&ZO(n,t.input.lastClick)&&!n[ww]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:o,button:n.button};let a=t.posAtCoords(sf(n));a&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new lN(t,a,n,!!i)):(o=="doubleClick"?iN:rN)(t,a.pos,a.inside,n)?n.preventDefault():Sr(t,"pointer"))};class lN{constructor(e,n,i,s){this.view=e,this.pos=n,this.event=i,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[ww],this.allowDefault=i.shiftKey;let o,a;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),a=n.inside;else{let p=e.state.doc.resolve(n.pos);o=p.parent,a=p.depth?p.before():0}const u=s?null:i.target,f=u?e.docView.nearestDesc(u,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:h}=e.state;i.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||h instanceof oe&&h.from<=a&&h.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Nn&&!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)),Sr(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(()=>zi(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(sf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Sr(this.view,"pointer"):nN(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||_t&&this.mightDrag&&!this.mightDrag.node.isAtom||Dt&&!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)?(dl(this.view,he.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Sr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Sr(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)}}$t.touchstart=t=>{t.input.lastTouch=Date.now(),Um(t),Sr(t,"pointer")};$t.touchmove=t=>{t.input.lastTouch=Date.now(),Sr(t,"pointer")};$t.contextmenu=t=>Um(t);function kw(t,e){return t.composing?!0:_t&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const oN=Ai?5e3:-1;qt.compositionstart=qt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ce&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||Dt&&ew&&aN(t)))t.markCursor=t.state.storedMarks||n.marks(),ou(t,!0),t.markCursor=null;else if(ou(t,!e.selection.empty),Nn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let i=t.domSelectionRange();for(let s=i.focusNode,o=i.focusOffset;s&&s.nodeType==1&&o!=0;){let a=o<0?s.lastChild:s.childNodes[o-1];if(!a)break;if(a.nodeType==3){let u=t.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else s=a,o=-1}}t.input.composing=!0}Tw(t,oN)};function aN(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let i=e.childNodes[n];return i.nodeType==1&&i.contentEditable=="false"}qt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Tw(t,20))};function Tw(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ou(t),e))}function Ew(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=uN());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function cN(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=tO(e.focusNode,e.focusOffset),i=nO(e.focusNode,e.focusOffset);if(n&&i&&n!=i){let s=i.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||i==o)return o;if(!s||!s.isText(i.nodeValue))return i;if(t.input.compositionNode==i){let a=n.pmViewDesc;if(!(!a||!a.isText(n.nodeValue)))return i}}return n||i}function uN(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ou(t,e=!1){if(!(Ai&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ew(t),e||t.docView&&t.docView.dirty){let n=zm(t),i=t.state.selection;return n&&!n.eq(i)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function fN(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 i=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),i.removeAllRanges(),i.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Yo=Jt&&kr<15||yl&&lO<604;$t.copy=qt.cut=(t,e)=>{let n=e,i=t.state.selection,s=n.type=="cut";if(i.empty)return;let o=Yo?null:n.clipboardData,a=i.content(),{dom:u,text:f}=_m(t,a);o?(n.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",f)):fN(t,u),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function dN(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function hN(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,i=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),i.parentNode&&i.parentNode.removeChild(i),n?Xo(t,i.value,null,s,e):Xo(t,i.textContent,i.innerHTML,s,e)},50)}function Xo(t,e,n,i,s){let o=gw(t,e,n,i,t.state.selection.$from);if(t.someProp("handlePaste",f=>f(t,s,o||F.empty)))return!0;if(!o)return!1;let a=dN(o),u=a?t.state.tr.replaceSelectionWith(a,i):t.state.tr.replaceSelection(o);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Cw(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," "):""}qt.paste=(t,e)=>{let n=e;if(t.composing&&!Ai)return;let i=Yo?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;i&&Xo(t,Cw(i),i.getData("text/html"),s,n)?n.preventDefault():hN(t,n)};class Mw{constructor(e,n,i){this.slice=e,this.move=n,this.node=i}}const pN=An?"altKey":"ctrlKey";function Aw(t,e){let n;return t.someProp("dragCopies",i=>{n=n||i(e)}),n!=null?!n:!e[pN]}$t.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let s=t.state.selection,o=s.empty?null:t.posAtCoords(sf(n)),a;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof oe?s.to-1:s.to))){if(i&&i.mightDrag)a=oe.create(t.state.doc,i.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(a=oe.create(t.state.doc,g.posBefore))}}let u=(a||t.state.selection).content(),{dom:f,text:h,slice:p}=_m(t,u);(!n.dataTransfer.files.length||!Dt||Zx>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Yo?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",Yo||n.dataTransfer.setData("text/plain",h),t.dragging=new Mw(p,Aw(t,n),a)};$t.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};qt.dragover=qt.dragenter=(t,e)=>e.preventDefault();qt.drop=(t,e)=>{try{mN(t,e,t.dragging)}finally{t.dragging=null}};function mN(t,e,n){if(!e.dataTransfer)return;let i=t.posAtCoords(sf(e));if(!i)return;let s=t.state.doc.resolve(i.pos),o=n&&n.slice;o?t.someProp("transformPasted",v=>{o=v(o,t,!1)}):o=gw(t,Cw(e.dataTransfer),Yo?null:e.dataTransfer.getData("text/html"),!1,s);let a=!!(n&&Aw(t,e));if(t.someProp("handleDrop",v=>v(t,e,o||F.empty,a))){e.preventDefault();return}if(!o)return;e.preventDefault();let u=o?Dx(t.state.doc,s.pos,o):s.pos;u==null&&(u=s.pos);let f=t.state.tr;if(a){let{node:v}=n;v?v.replace(f):f.deleteSelection()}let h=f.mapping.map(u),p=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,g=f.doc;if(p?f.replaceRangeWith(h,h,o.content.firstChild):f.replaceRange(h,h,o),f.doc.eq(g))return;let b=f.doc.resolve(h);if(p&&oe.isSelectable(o.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(o.content.firstChild))f.setSelection(new oe(b));else{let v=f.mapping.map(u);f.mapping.maps[f.mapping.maps.length-1].forEach((S,w,k,E)=>v=E),f.setSelection(Lm(t,b,f.doc.resolve(v)))}t.focus(),t.dispatch(f.setMeta("uiEvent","drop"))}$t.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())&&zi(t)},20))};$t.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)};$t.beforeinput=(t,e)=>{if(Dt&&Ai&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:i}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=i||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Zr(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in qt)$t[t]=qt[t];function Fo(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 au{constructor(e,n){this.toDOM=e,this.spec=n||ss,this.side=this.spec.side||0}map(e,n,i,s){let{pos:o,deleted:a}=e.mapResult(n.from+s,this.side<0?-1:1);return a?null:new St(o-i,o-i,this)}valid(){return!0}eq(e){return this==e||e instanceof au&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Er{constructor(e,n){this.attrs=e,this.spec=n||ss}map(e,n,i,s){let o=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-i,a=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-i;return o>=a?null:new St(o,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Er&&Fo(this.attrs,e.attrs)&&Fo(this.spec,e.spec)}static is(e){return e.type instanceof Er}destroy(){}}class jm{constructor(e,n){this.attrs=e,this.spec=n||ss}map(e,n,i,s){let o=e.mapResult(n.from+s,1);if(o.deleted)return null;let a=e.mapResult(n.to+s,-1);return a.deleted||a.pos<=o.pos?null:new St(o.pos-i,a.pos-i,this)}valid(e,n){let{index:i,offset:s}=e.content.findIndex(n.from),o;return s==n.from&&!(o=e.child(i)).isText&&s+o.nodeSize==n.to}eq(e){return this==e||e instanceof jm&&Fo(this.attrs,e.attrs)&&Fo(this.spec,e.spec)}destroy(){}}class St{constructor(e,n,i){this.from=e,this.to=n,this.type=i}copy(e,n){return new St(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,i){return this.type.map(e,this,n,i)}static widget(e,n,i){return new St(e,e,new au(n,i))}static inline(e,n,i,s){return new St(e,n,new Er(i,s))}static node(e,n,i,s){return new St(e,n,new jm(i,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Er}get widget(){return this.type instanceof au}}const al=[],ss={};class Xe{constructor(e,n){this.local=e.length?e:al,this.children=n.length?n:al}static create(e,n){return n.length?cu(n,e,0,ss):Lt}find(e,n,i){let s=[];return this.findInner(e??0,n??1e9,s,0,i),s}findInner(e,n,i,s,o){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=n&&u.to>=e&&(!o||o(u.spec))&&i.push(u.copy(u.from+s,u.to+s))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,n-u,i,s+u,o)}}map(e,n,i){return this==Lt||e.maps.length==0?this:this.mapInner(e,n,0,0,i||ss)}mapInner(e,n,i,s,o){let a;for(let u=0;u<this.local.length;u++){let f=this.local[u].map(e,i,s);f&&f.type.valid(n,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?gN(this.children,a||[],e,n,i,s,o):a?new Xe(a.sort(ls),al):Lt}add(e,n){return n.length?this==Lt?Xe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,i){let s,o=0;e.forEach((u,f)=>{let h=f+i,p;if(p=Nw(n,u,h)){for(s||(s=this.children.slice());o<s.length&&s[o]<f;)o+=3;s[o]==f?s[o+2]=s[o+2].addInner(u,p,h+1):s.splice(o,0,f,f+u.nodeSize,cu(p,u,h+1,ss)),o+=3}});let a=Ow(o?Rw(n):n,-i);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Xe(a.length?this.local.concat(a).sort(ls):this.local,s||this.children)}remove(e){return e.length==0||this==Lt?this:this.removeInner(e,0)}removeInner(e,n){let i=this.children,s=this.local;for(let o=0;o<i.length;o+=3){let a,u=i[o]+n,f=i[o+1]+n;for(let p=0,g;p<e.length;p++)(g=e[p])&&g.from>u&&g.to<f&&(e[p]=null,(a||(a=[])).push(g));if(!a)continue;i==this.children&&(i=this.children.slice());let h=i[o+2].removeInner(a,u+1);h!=Lt?i[o+2]=h:(i.splice(o,3),o-=3)}if(s.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let u=0;u<s.length;u++)s[u].eq(a,n)&&(s==this.local&&(s=this.local.slice()),s.splice(u--,1))}return i==this.children&&s==this.local?this:s.length||i.length?new Xe(s,i):Lt}forChild(e,n){if(this==Lt)return this;if(n.isLeaf)return Xe.empty;let i,s;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(i=this.children[u+2]);break}let o=e+1,a=o+n.content.size;for(let u=0;u<this.local.length;u++){let f=this.local[u];if(f.from<a&&f.to>o&&f.type instanceof Er){let h=Math.max(o,f.from)-o,p=Math.min(a,f.to)-o;h<p&&(s||(s=[])).push(f.copy(h,p))}}if(s){let u=new Xe(s.sort(ls),al);return i?new mr([u,i]):u}return i||Lt}eq(e){if(this==e)return!0;if(!(e instanceof Xe)||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 Im(this.localsInner(e))}localsInner(e){if(this==Lt)return al;if(e.inlineContent||!this.local.some(Er.is))return this.local;let n=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Er||n.push(this.local[i]);return n}forEachSet(e){e(this)}}Xe.empty=new Xe([],[]);Xe.removeOverlap=Im;const Lt=Xe.empty;class mr{constructor(e){this.members=e}map(e,n){const i=this.members.map(s=>s.map(e,n,ss));return mr.from(i)}forChild(e,n){if(n.isLeaf)return Xe.empty;let i=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,n);o!=Lt&&(o instanceof mr?i=i.concat(o.members):i.push(o))}return mr.from(i)}eq(e){if(!(e instanceof mr)||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,i=!0;for(let s=0;s<this.members.length;s++){let o=this.members[s].localsInner(e);if(o.length)if(!n)n=o;else{i&&(n=n.slice(),i=!1);for(let a=0;a<o.length;a++)n.push(o[a])}}return n?Im(i?n:n.sort(ls)):al}static from(e){switch(e.length){case 0:return Lt;case 1:return e[0];default:return new mr(e.every(n=>n instanceof Xe)?e:e.reduce((n,i)=>n.concat(i instanceof Xe?i:i.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function gN(t,e,n,i,s,o,a){let u=t.slice();for(let h=0,p=o;h<n.maps.length;h++){let g=0;n.maps[h].forEach((b,v,S,w)=>{let k=w-S-(v-b);for(let E=0;E<u.length;E+=3){let N=u[E+1];if(N<0||b>N+p-g)continue;let L=u[E]+p-g;v>=L?u[E+1]=b<=L?-2:-1:b>=p&&k&&(u[E]+=k,u[E+1]+=k)}g+=k}),p=n.maps[h].map(p,-1)}let f=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){f=!0,u[h+1]=-1;continue}let p=n.map(t[h]+o),g=p-s;if(g<0||g>=i.content.size){f=!0;continue}let b=n.map(t[h+1]+o,-1),v=b-s,{index:S,offset:w}=i.content.findIndex(g),k=i.maybeChild(S);if(k&&w==g&&w+k.nodeSize==v){let E=u[h+2].mapInner(n,k,p+1,t[h]+o+1,a);E!=Lt?(u[h]=g,u[h+1]=v,u[h+2]=E):(u[h+1]=-2,f=!0)}else f=!0}if(f){let h=yN(u,t,e,n,s,o,a),p=cu(h,i,0,a);e=p.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,b=0;g<p.children.length;g+=3){let v=p.children[g];for(;b<u.length&&u[b]<v;)b+=3;u.splice(b,0,p.children[g],p.children[g+1],p.children[g+2])}}return new Xe(e.sort(ls),u)}function Ow(t,e){if(!e||!t.length)return t;let n=[];for(let i=0;i<t.length;i++){let s=t[i];n.push(new St(s.from+e,s.to+e,s.type))}return n}function yN(t,e,n,i,s,o,a){function u(f,h){for(let p=0;p<f.local.length;p++){let g=f.local[p].map(i,s,h);g?n.push(g):a.onRemove&&a.onRemove(f.local[p].spec)}for(let p=0;p<f.children.length;p+=3)u(f.children[p+2],f.children[p]+h+1)}for(let f=0;f<t.length;f+=3)t[f+1]==-1&&u(t[f+2],e[f]+o+1);return n}function Nw(t,e,n){if(e.isLeaf)return null;let i=n+e.nodeSize,s=null;for(let o=0,a;o<t.length;o++)(a=t[o])&&a.from>n&&a.to<i&&((s||(s=[])).push(a),t[o]=null);return s}function Rw(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function cu(t,e,n,i){let s=[],o=!1;e.forEach((u,f)=>{let h=Nw(t,u,f+n);if(h){o=!0;let p=cu(h,u,n+f+1,i);p!=Lt&&s.push(f,f+u.nodeSize,p)}});let a=Ow(o?Rw(t):t,-n).sort(ls);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(i.onRemove&&i.onRemove(a[u].spec),a.splice(u--,1));return a.length||s.length?new Xe(a,s):Lt}function ls(t,e){return t.from-e.from||t.to-e.to}function Im(t){let e=t;for(let n=0;n<e.length-1;n++){let i=e[n];if(i.from!=i.to)for(let s=n+1;s<e.length;s++){let o=e[s];if(o.from==i.from){o.to!=i.to&&(e==t&&(e=t.slice()),e[s]=o.copy(o.from,i.to),z1(e,s+1,o.copy(i.to,o.to)));continue}else{o.from<i.to&&(e==t&&(e=t.slice()),e[n]=i.copy(i.from,o.from),z1(e,s,i.copy(o.from,i.to)));break}}}return e}function z1(t,e,n){for(;e<t.length&&ls(n,t[e])>0;)e++;t.splice(e,0,n)}function ip(t){let e=[];return t.someProp("decorations",n=>{let i=n(t.state);i&&i!=Lt&&e.push(i)}),t.cursorWrapper&&e.push(Xe.create(t.state.doc,[t.cursorWrapper.deco])),mr.from(e)}const bN={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},vN=Jt&&kr<=11;class SN{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 xN{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SN,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let s=0;s<i.length;s++)this.queue.push(i[s]);Jt&&kr<=11&&i.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():_t&&e.composing&&i.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),vN&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.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,bN)),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(E1(this.view)){if(this.suppressingSelectionUpdates)return zi(this.view);if(Jt&&kr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&fs(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,i;for(let o=e.focusNode;o;o=gl(o))n.add(o);for(let o=e.anchorNode;o;o=gl(o))if(n.has(o)){i=o;break}let s=i&&this.view.docView.nearestDesc(i);if(s&&s.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))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 i=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&E1(e)&&!this.ignoreSelectionChange(i),o=-1,a=-1,u=!1,f=[];if(e.editable)for(let p=0;p<n.length;p++){let g=this.registerMutation(n[p],f);g&&(o=o<0?g.from:Math.min(g.from,o),a=a<0?g.to:Math.max(g.to,a),g.typeOver&&(u=!0))}if(f.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let g=p.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){p.parentNode.removeChild(p);break}g=g.firstChild}}}else if(Nn&&f.length){let p=f.filter(g=>g.nodeName=="BR");if(p.length==2){let[g,b]=p;g.parentNode&&g.parentNode.parentNode==b.parentNode?b.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let b of p){let v=b.parentNode;v&&v.nodeName=="LI"&&(!g||TN(e,g)!=v)&&b.remove()}}}let h=null;o<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&nf(i)&&(h=zm(e))&&h.eq(he.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zi(e),this.currentSelection.set(i),e.scrollToSelection()):(o>-1||s)&&(o>-1&&(e.docView.markDirty(o,a),wN(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,EN(e,f)),this.handleDOMChange(o,a,u,f),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||zi(e),this.currentSelection.set(i))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let g=e.addedNodes[p];n.push(g),g.nodeType==3&&(this.lastChangedTextNode=g)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let s=e.previousSibling,o=e.nextSibling;if(Jt&&kr<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:g,nextSibling:b}=e.addedNodes[p];(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g),(!b||Array.prototype.indexOf.call(e.addedNodes,b)<0)&&(o=b)}let a=s&&s.parentNode==e.target?Nt(s)+1:0,u=i.localPosFromDOM(e.target,a,-1),f=o&&o.parentNode==e.target?Nt(o):e.target.childNodes.length,h=i.localPosFromDOM(e.target,f,1);return{from:u,to:h}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let L1=new WeakMap,_1=!1;function wN(t){if(!L1.has(t)&&(L1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Nn,_1)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."),_1=!0}}function B1(t,e){let n=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return fs(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}function kN(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return B1(t,s)}let n;function i(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",i,!0),n?B1(t,n):null}function TN(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let i=t.docView.nearestDesc(n,!0);if(i&&i.node.isBlock)return n}return null}function EN(t,e){var n;let{focusNode:i,focusOffset:s}=t.domSelectionRange();for(let o of e)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let a=o.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let u=a;for(;;){let f=u.firstChild;if(!f||f.nodeType!=1||f.contentEditable=="false"||/^(BR|IMG)$/.test(f.nodeName))break;u=f}u.insertBefore(o,u.firstChild),i==o&&t.domSelection().collapse(o,s)}else o.parentNode.removeChild(o)}}function CN(t,e,n){let{node:i,fromOffset:s,toOffset:o,from:a,to:u}=t.docView.parseRange(e,n),f=t.domSelectionRange(),h,p=f.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(h=[{node:p,offset:f.anchorOffset}],nf(f)||h.push({node:f.focusNode,offset:f.focusOffset})),Dt&&t.input.lastKeyCode===8)for(let k=o;k>s;k--){let E=i.childNodes[k-1],N=E.pmViewDesc;if(E.nodeName=="BR"&&!N){o=k;break}if(!N||N.size)break}let g=t.state.doc,b=t.someProp("domParser")||wr.fromSchema(t.state.schema),v=g.resolve(a),S=null,w=b.parse(i,{topNode:v.parent,topMatch:v.parent.contentMatchAt(v.index()),topOpen:!0,from:s,to:o,preserveWhitespace:v.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:MN,context:v});if(h&&h[0].pos!=null){let k=h[0].pos,E=h[1]&&h[1].pos;E==null&&(E=k),S={anchor:k+a,head:E+a}}return{doc:w,sel:S,from:a,to:u}}function MN(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(_t&&/^(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||_t&&/^(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 AN=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ON(t,e,n,i,s){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let H=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,W=zm(t,H);if(W&&!t.state.selection.eq(W)){if(Dt&&Ai&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",te=>te(t,Zr(13,"Enter"))))return;let ie=t.state.tr.setSelection(W);H=="pointer"?ie.setMeta("pointer",!0):H=="key"&&ie.scrollIntoView(),o&&ie.setMeta("composition",o),t.dispatch(ie)}return}let a=t.state.doc.resolve(e),u=a.sharedDepth(n);e=a.before(u+1),n=t.state.doc.resolve(n).after(u+1);let f=t.state.selection,h=CN(t,e,n),p=t.state.doc,g=p.slice(h.from,h.to),b,v;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(b=t.state.selection.to,v="end"):(b=t.state.selection.from,v="start"),t.input.lastKeyCode=null;let S=DN(g.content,h.doc.content,h.from,b,v);if(S&&t.input.domChangeCount++,(yl&&t.input.lastIOSEnter>Date.now()-225||Ai)&&s.some(H=>H.nodeType==1&&!AN.test(H.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",H=>H(t,Zr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(i&&f instanceof ce&&!f.empty&&f.$head.sameParent(f.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))S={start:f.from,endA:f.to,endB:f.to};else{if(h.sel){let H=H1(t,t.state.doc,h.sel);if(H&&!H.eq(t.state.selection)){let W=t.state.tr.setSelection(H);o&&W.setMeta("composition",o),t.dispatch(W)}}return}t.state.selection.from<t.state.selection.to&&S.start==S.endB&&t.state.selection instanceof ce&&(S.start>t.state.selection.from&&S.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?S.start=t.state.selection.from:S.endA<t.state.selection.to&&S.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),Jt&&kr<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>h.from&&h.doc.textBetween(S.start-h.from-1,S.start-h.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let w=h.doc.resolveNoCache(S.start-h.from),k=h.doc.resolveNoCache(S.endB-h.from),E=p.resolve(S.start),N=w.sameParent(k)&&w.parent.inlineContent&&E.end()>=S.endA;if((yl&&t.input.lastIOSEnter>Date.now()-225&&(!N||s.some(H=>H.nodeName=="DIV"||H.nodeName=="P"))||!N&&w.pos<h.doc.content.size&&(!w.sameParent(k)||!w.parent.inlineContent)&&w.pos<k.pos&&!/\S/.test(h.doc.textBetween(w.pos,k.pos,"","")))&&t.someProp("handleKeyDown",H=>H(t,Zr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&RN(p,S.start,S.endA,w,k)&&t.someProp("handleKeyDown",H=>H(t,Zr(8,"Backspace")))){Ai&&Dt&&t.domObserver.suppressSelectionUpdates();return}Dt&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),Ai&&!N&&w.start()!=k.start()&&k.parentOffset==0&&w.depth==k.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==S.endA&&(S.endB-=2,k=h.doc.resolveNoCache(S.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(H){return H(t,Zr(13,"Enter"))})},20));let L=S.start,V=S.endA,I=H=>{let W=H||t.state.tr.replace(L,V,h.doc.slice(S.start-h.from,S.endB-h.from));if(h.sel){let ie=H1(t,W.doc,h.sel);ie&&!(Dt&&t.composing&&ie.empty&&(S.start!=S.endB||t.input.lastChromeDelete<Date.now()-100)&&(ie.head==L||ie.head==W.mapping.map(V)-1)||Jt&&ie.empty&&ie.head==L)&&W.setSelection(ie)}return o&&W.setMeta("composition",o),W.scrollIntoView()},C;if(N)if(w.pos==k.pos){Jt&&kr<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>zi(t),20));let H=I(t.state.tr.delete(L,V)),W=p.resolve(S.start).marksAcross(p.resolve(S.endA));W&&H.ensureMarks(W),t.dispatch(H)}else if(S.endA==S.endB&&(C=NN(w.parent.content.cut(w.parentOffset,k.parentOffset),E.parent.content.cut(E.parentOffset,S.endA-E.start())))){let H=I(t.state.tr);C.type=="add"?H.addMark(L,V,C.mark):H.removeMark(L,V,C.mark),t.dispatch(H)}else if(w.parent.child(w.index()).isText&&w.index()==k.index()-(k.textOffset?0:1)){let H=w.parent.textBetween(w.parentOffset,k.parentOffset),W=()=>I(t.state.tr.insertText(H,L,V));t.someProp("handleTextInput",ie=>ie(t,L,V,H,W))||t.dispatch(W())}else t.dispatch(I());else t.dispatch(I())}function H1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Lm(t,e.resolve(n.anchor),e.resolve(n.head))}function NN(t,e){let n=t.firstChild.marks,i=e.firstChild.marks,s=n,o=i,a,u,f;for(let p=0;p<i.length;p++)s=i[p].removeFromSet(s);for(let p=0;p<n.length;p++)o=n[p].removeFromSet(o);if(s.length==1&&o.length==0)u=s[0],a="add",f=p=>p.mark(u.addToSet(p.marks));else if(s.length==0&&o.length==1)u=o[0],a="remove",f=p=>p.mark(u.removeFromSet(p.marks));else return null;let h=[];for(let p=0;p<e.childCount;p++)h.push(f(e.child(p)));if(G.from(h).eq(t))return{mark:u,type:a}}function RN(t,e,n,i,s){if(n-e<=s.pos-i.pos||rp(i,!0,!1)<s.pos)return!1;let o=t.resolve(e);if(!i.parent.isTextblock){let u=o.nodeAfter;return u!=null&&n==e+u.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let a=t.resolve(rp(o,!0,!0));return!a.parent.isTextblock||a.pos>n||rp(a,!0,!1)<n?!1:i.parent.content.cut(i.parentOffset).eq(a.parent.content)}function rp(t,e,n){let i=t.depth,s=e?t.end():t.pos;for(;i>0&&(e||t.indexAfter(i)==t.node(i).childCount);)i--,s++,e=!1;if(n){let o=t.node(i).maybeChild(t.indexAfter(i));for(;o&&!o.isLeaf;)o=o.firstChild,s++}return s}function DN(t,e,n,i,s){let o=t.findDiffStart(e,n);if(o==null)return null;let{a,b:u}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let f=Math.max(0,o-Math.min(a,u));i-=a+f-o}if(a<o&&t.size<e.size){let f=i<=o&&i>=a?o-i:0;o-=f,o&&o<e.size&&U1(e.textBetween(o-1,o+1))&&(o+=f?1:-1),u=o+(u-a),a=o}else if(u<o){let f=i<=o&&i>=u?o-i:0;o-=f,o&&o<t.size&&U1(t.textBetween(o-1,o+1))&&(o+=f?1:-1),a=o+(a-u),u=o}return{start:o,endA:a,endB:u}}function U1(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 Dw{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 XO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(q1),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=V1(this),I1(this),this.nodeViews=$1(this),this.docView=v1(this.state.doc,j1(this),ip(this),this.dom,this),this.domObserver=new xN(this,(i,s,o,a)=>ON(this,i,s,o,a)),this.domObserver.start(),FO(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&&Gp(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(q1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let i in this._props)n[i]=this._props[i];n.state=this.state;for(let i in e)n[i]=e[i];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var i;let s=this.state,o=!1,a=!1;e.storedMarks&&this.composing&&(Ew(this),a=!0),this.state=e;let u=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(u||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let v=$1(this);LN(v,this.nodeViews)&&(this.nodeViews=v,o=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&Gp(this),this.editable=V1(this),I1(this);let f=ip(this),h=j1(this),p=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",g=o||!this.docView.matchesNode(e.doc,h,f);(g||!e.selection.eq(s.selection))&&(a=!0);let b=p=="preserve"&&a&&this.dom.style.overflowAnchor==null&&cO(this);if(a){this.domObserver.stop();let v=g&&(Jt||Dt)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&zN(s.selection,e.selection);if(g){let S=Dt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=cN(this)),(o||!this.docView.update(e.doc,h,f,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=v1(e.doc,h,f,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(v=!0)}v||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&zO(this))?zi(this,v):(hw(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((i=this.dragging)===null||i===void 0)&&i.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():b&&uO(b)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof oe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&h1(this,n.getBoundingClientRect(),e)}else h1(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 i=this.directPlugins[n];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let i=this.state.plugins[n];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let i=this.pluginViews[n];i.update&&i.update(this,e)}}updateDraggedNode(e,n){let i=e.node,s=-1;if(i.from<this.state.doc.content.size&&this.state.doc.nodeAt(i.from)==i.node)s=i.from;else{let o=i.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==i.node&&(s=o)}this.dragging=new Mw(e.slice,e.move,s<0?void 0:oe.create(this.state.doc,s))}someProp(e,n){let i=this._props&&this._props[e],s;if(i!=null&&(s=n?n(i):i))return s;for(let a=0;a<this.directPlugins.length;a++){let u=this.directPlugins[a].props[e];if(u!=null&&(s=n?n(u):u))return s}let o=this.state.plugins;if(o)for(let a=0;a<o.length;a++){let u=o[a].props[e];if(u!=null&&(s=n?n(u):u))return s}}hasFocus(){if(Jt){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&&fO(this.dom),zi(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 gO(this,e)}coordsAtPos(e,n=1){return sw(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,i=-1){let s=this.docView.posFromDOM(e,n,i);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return xO(this,n||this.state,e)}pasteHTML(e,n){return Xo(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Xo(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return _m(this,e)}destroy(){this.docView&&(WO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ip(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return JO(this,e)}domSelectionRange(){let e=this.domSelection();return e?_t&&this.root.nodeType===11&&rO(this.dom.ownerDocument)==this.dom&&kN(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Dw.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function j1(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 i in n)i=="class"?e.class+=" "+n[i]:i=="style"?e.style=(e.style?e.style+";":"")+n[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(n[i]))}),e.translate||(e.translate="no"),[St.node(0,t.state.doc.content.size,e)]}function I1(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:St.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function V1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function zN(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 $1(t){let e=Object.create(null);function n(i){for(let s in i)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=i[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function LN(t,e){let n=0,i=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)i++;return n!=i}function q1(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 Cr={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:"'"},uu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_N=typeof navigator<"u"&&/Mac/.test(navigator.platform),BN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rt=0;Rt<10;Rt++)Cr[48+Rt]=Cr[96+Rt]=String(Rt);for(var Rt=1;Rt<=24;Rt++)Cr[Rt+111]="F"+Rt;for(var Rt=65;Rt<=90;Rt++)Cr[Rt]=String.fromCharCode(Rt+32),uu[Rt]=String.fromCharCode(Rt);for(var sp in Cr)uu.hasOwnProperty(sp)||(uu[sp]=Cr[sp]);function HN(t){var e=_N&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||BN&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?uu:Cr)[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 UN=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),jN=typeof navigator<"u"&&/Win/.test(navigator.platform);function IN(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let i,s,o,a;for(let u=0;u<e.length-1;u++){let f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))i=!0;else if(/^(c|ctrl|control)$/i.test(f))s=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))UN?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+f)}return i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function VN(t){let e=Object.create(null);for(let n in t)e[IN(n)]=t[n];return e}function lp(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 $N(t){return new Ye({props:{handleKeyDown:Vm(t)}})}function Vm(t){let e=VN(t);return function(n,i){let s=HN(i),o,a=e[lp(s,i)];if(a&&a(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(i.shiftKey){let u=e[lp(s,i,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(jN&&i.ctrlKey&&i.altKey)&&(o=Cr[i.keyCode])&&o!=s){let u=e[lp(o,i)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var qN=Object.defineProperty,$m=(t,e)=>{for(var n in e)qN(t,n,{get:e[n],enumerable:!0})};function lf(t){const{state:e,transaction:n}=t;let{selection:i}=n,{doc:s}=n,{storedMarks:o}=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 o},get selection(){return i},get doc(){return s},get tr(){return i=n.selection,s=n.doc,o=n.storedMarks,n}}}var of=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:i}=e,{tr:s}=n,o=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([a,u])=>[a,(...h)=>{const p=u(...h)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,a=[],u=!!t,f=t||s.tr,h=()=>(!u&&e&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(f),a.every(g=>g===!0)),p={...Object.fromEntries(Object.entries(n).map(([g,b])=>[g,(...S)=>{const w=this.buildProps(f,e),k=b(...S)(w);return a.push(k),p}])),run:h};return p}createCan(t){const{rawCommands:e,state:n}=this,i=!1,s=t||n.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(e).map(([u,f])=>[u,(...h)=>f(...h)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(t,e=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,a={tr:t,editor:i,view:o,state:lf({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([u,f])=>[u,(...h)=>f(...h)(a)]))}};return a}},zw={};$m(zw,{blur:()=>PN,clearContent:()=>KN,clearNodes:()=>GN,command:()=>YN,createParagraphNear:()=>XN,cut:()=>FN,deleteCurrentNode:()=>WN,deleteNode:()=>QN,deleteRange:()=>JN,deleteSelection:()=>ZN,enter:()=>eR,exitCode:()=>tR,extendMarkRange:()=>nR,first:()=>iR,focus:()=>sR,forEach:()=>lR,insertContent:()=>oR,insertContentAt:()=>uR,joinBackward:()=>hR,joinDown:()=>dR,joinForward:()=>pR,joinItemBackward:()=>mR,joinItemForward:()=>gR,joinTextblockBackward:()=>yR,joinTextblockForward:()=>bR,joinUp:()=>fR,keyboardShortcut:()=>SR,lift:()=>xR,liftEmptyBlock:()=>wR,liftListItem:()=>kR,newlineInCode:()=>TR,resetAttributes:()=>ER,scrollIntoView:()=>CR,selectAll:()=>MR,selectNodeBackward:()=>AR,selectNodeForward:()=>OR,selectParentNode:()=>NR,selectTextblockEnd:()=>RR,selectTextblockStart:()=>DR,setContent:()=>zR,setMark:()=>JR,setMeta:()=>ZR,setNode:()=>eD,setNodeSelection:()=>tD,setTextDirection:()=>nD,setTextSelection:()=>iD,sinkListItem:()=>rD,splitBlock:()=>sD,splitListItem:()=>lD,toggleList:()=>aD,toggleMark:()=>cD,toggleNode:()=>uD,toggleWrap:()=>fD,undoInputRule:()=>dD,unsetAllMarks:()=>hD,unsetMark:()=>pD,unsetTextDirection:()=>mD,updateAttributes:()=>gD,wrapIn:()=>yD,wrapInList:()=>bD});var PN=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),KN=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),GN=()=>({state:t,tr:e,dispatch:n})=>{const{selection:i}=e,{ranges:s}=i;return n&&s.forEach(({$from:o,$to:a})=>{t.doc.nodesBetween(o.pos,a.pos,(u,f)=>{if(u.type.isText)return;const{doc:h,mapping:p}=e,g=h.resolve(p.map(f)),b=h.resolve(p.map(f+u.nodeSize)),v=g.blockRange(b);if(!v)return;const S=kl(v);if(u.type.isTextblock){const{defaultType:w}=g.parent.contentMatchAt(g.index());e.setNodeMarkup(v.start,w)}(S||S===0)&&e.lift(v,S)})}),!0},YN=t=>e=>t(e),XN=()=>({state:t,dispatch:e})=>Xx(t,e),FN=(t,e)=>({editor:n,tr:i})=>{const{state:s}=n,o=s.doc.slice(t.from,t.to);i.deleteRange(t.from,t.to);const a=i.mapping.map(e);return i.insert(a,o.content),i.setSelection(new ce(i.doc.resolve(Math.max(a-1,0)))),!0},WN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,i=n.$anchor.node();if(i.content.size>0)return!1;const s=t.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i.type){if(e){const u=s.before(o),f=s.after(o);t.delete(u,f).scrollIntoView()}return!0}return!1};function gt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var QN=t=>({tr:e,state:n,dispatch:i})=>{const s=gt(t,n.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===s){if(i){const f=o.before(a),h=o.after(a);e.delete(f,h).scrollIntoView()}return!0}return!1},JN=t=>({tr:e,dispatch:n})=>{const{from:i,to:s}=t;return n&&e.delete(i,s),!0},ZN=()=>({state:t,dispatch:e})=>Mm(t,e),eR=()=>({commands:t})=>t.keyboardShortcut("Enter"),tR=()=>({state:t,dispatch:e})=>UA(t,e);function qm(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function fu(t,e,n={strict:!0}){const i=Object.keys(e);return i.length?i.every(s=>n.strict?e[s]===t[s]:qm(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function Lw(t,e,n={}){return t.find(i=>i.type===e&&fu(Object.fromEntries(Object.keys(n).map(s=>[s,i.attrs[s]])),n))}function P1(t,e,n={}){return!!Lw(t,e,n)}function Pm(t,e,n){if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(h=>h.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(h=>h.type===e))return;if(!n){const h=i.node.marks.find(p=>p.type===e);h&&(n=h.attrs)}if(!Lw([...i.node.marks],e,n))return;let o=i.index,a=t.start()+i.offset,u=o+1,f=a+i.node.nodeSize;for(;o>0&&P1([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;u<t.parent.childCount&&P1([...t.parent.child(u).marks],e,n);)f+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:f}}function Li(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var nR=(t,e)=>({tr:n,state:i,dispatch:s})=>{const o=Li(t,i.schema),{doc:a,selection:u}=n,{$from:f,from:h,to:p}=u;if(s){const g=Pm(f,o,e);if(g&&g.from<=h&&g.to>=p){const b=ce.create(a,g.from,g.to);n.setSelection(b)}}return!0},iR=t=>e=>{const n=typeof t=="function"?t(e):t;for(let i=0;i<n.length;i+=1)if(n[i](e))return!0;return!1};function Km(t){return t instanceof ce}function Oi(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function _w(t,e=null){if(!e)return null;const n=he.atStart(t),i=he.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return i;const s=n.from,o=i.to;return e==="all"?ce.create(t,Oi(0,s,o),Oi(t.content.size,s,o)):ce.create(t,Oi(e,s,o),Oi(e,s,o))}function K1(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function du(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function rR(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var sR=(t=null,e={})=>({editor:n,view:i,tr:s,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{(du()||K1())&&i.dom.focus(),rR()&&!du()&&!K1()&&i.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(i.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(i.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(o&&t===null&&!Km(n.state.selection))return a(),!0;const u=_w(s.doc,t)||n.state.selection,f=n.state.selection.eq(u);return o&&(f||s.setSelection(u),f&&s.storedMarks&&s.setStoredMarks(s.storedMarks),a()),!0},lR=(t,e)=>n=>t.every((i,s)=>e(i,{...n,index:s})),oR=(t,e)=>({tr:n,commands:i})=>i.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Bw=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const i=e[n];i.nodeType===3&&i.nodeValue&&/^(\n\s\s|\n)$/.test(i.nodeValue)?t.removeChild(i):i.nodeType===1&&Bw(i)}return t};function Nc(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Bw(n)}function Wo(t,e,n){if(t instanceof xr||t instanceof G)return t;n={slice:!0,parseOptions:{},...n};const i=typeof t=="object"&&t!==null,s=typeof t=="string";if(i)try{if(Array.isArray(t)&&t.length>0)return G.fromArray(t.map(u=>e.nodeFromJSON(u)));const a=e.nodeFromJSON(t);return n.errorOnInvalidContent&&a.check(),a}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),Wo("",e,n)}if(s){if(n.errorOnInvalidContent){let a=!1,u="";const f=new xx({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(a=!0,u=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?wr.fromSchema(f).parseSlice(Nc(t),n.parseOptions):wr.fromSchema(f).parse(Nc(t),n.parseOptions),n.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${u}`)})}const o=wr.fromSchema(e);return n.slice?o.parseSlice(Nc(t),n.parseOptions).content:o.parse(Nc(t),n.parseOptions)}return Wo("",e,n)}function aR(t,e,n){const i=t.steps.length-1;if(i<e)return;const s=t.steps[i];if(!(s instanceof pt||s instanceof xt))return;const o=t.mapping.maps[i];let a=0;o.forEach((u,f,h,p)=>{a===0&&(a=p)}),t.setSelection(he.near(t.doc.resolve(a),n))}var cR=t=>!("type"in t),uR=(t,e,n)=>({tr:i,dispatch:s,editor:o})=>{var a;if(s){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let u;const f=k=>{o.emit("contentError",{editor:o,error:k,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Wo(e,o.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(k){f(k)}try{u=Wo(e,o.schema,{parseOptions:h,errorOnInvalidContent:(a=n.errorOnInvalidContent)!=null?a:o.options.enableContentCheck})}catch(k){return f(k),!1}let{from:p,to:g}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},b=!0,v=!0;if((cR(u)?u:[u]).forEach(k=>{k.check(),b=b?k.isText&&k.marks.length===0:!1,v=v?k.isBlock:!1}),p===g&&v){const{parent:k}=i.doc.resolve(p);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(p-=1,g+=1)}let w;if(b){if(Array.isArray(e))w=e.map(k=>k.text||"").join("");else if(e instanceof G){let k="";e.forEach(E=>{E.text&&(k+=E.text)}),w=k}else typeof e=="object"&&e&&e.text?w=e.text:w=e;i.insertText(w,p,g)}else{w=u;const k=i.doc.resolve(p),E=k.node(),N=k.parentOffset===0,L=E.isText||E.isTextblock,V=E.content.size>0;N&&L&&V&&v&&(p=Math.max(0,p-1)),i.replaceWith(p,g,w)}n.updateSelection&&aR(i,i.steps.length-1,-1),n.applyInputRules&&i.setMeta("applyInputRules",{from:p,text:w}),n.applyPasteRules&&i.setMeta("applyPasteRules",{from:p,text:w})}return!0},fR=()=>({state:t,dispatch:e})=>_A(t,e),dR=()=>({state:t,dispatch:e})=>BA(t,e),hR=()=>({state:t,dispatch:e})=>Vx(t,e),pR=()=>({state:t,dispatch:e})=>Kx(t,e),mR=()=>({state:t,dispatch:e,tr:n})=>{try{const i=Zu(t.doc,t.selection.$from.pos,-1);return i==null?!1:(n.join(i,2),e&&e(n),!0)}catch{return!1}},gR=()=>({state:t,dispatch:e,tr:n})=>{try{const i=Zu(t.doc,t.selection.$from.pos,1);return i==null?!1:(n.join(i,2),e&&e(n),!0)}catch{return!1}},yR=()=>({state:t,dispatch:e})=>zA(t,e),bR=()=>({state:t,dispatch:e})=>LA(t,e);function Hw(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function vR(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let i,s,o,a;for(let u=0;u<e.length-1;u+=1){const f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))i=!0;else if(/^(c|ctrl|control)$/i.test(f))s=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))du()||Hw()?a=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return i&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var SR=t=>({editor:e,view:n,tr:i,dispatch:s})=>{const o=vR(t).split(/-(?!$)/),a=o.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,u))});return f==null||f.steps.forEach(h=>{const p=h.map(i.mapping);p&&s&&i.maybeStep(p)}),!0};function Mr(t,e,n={}){const{from:i,to:s,empty:o}=t.selection,a=e?gt(e,t.schema):null,u=[];t.doc.nodesBetween(i,s,(g,b)=>{if(g.isText)return;const v=Math.max(i,b),S=Math.min(s,b+g.nodeSize);u.push({node:g,from:v,to:S})});const f=s-i,h=u.filter(g=>a?a.name===g.node.type.name:!0).filter(g=>fu(g.node.attrs,n,{strict:!1}));return o?!!h.length:h.reduce((g,b)=>g+b.to-b.from,0)>=f}var xR=(t,e={})=>({state:n,dispatch:i})=>{const s=gt(t,n.schema);return Mr(n,s,e)?HA(n,i):!1},wR=()=>({state:t,dispatch:e})=>Fx(t,e),kR=t=>({state:e,dispatch:n})=>{const i=gt(t,e.schema);return FA(i)(e,n)},TR=()=>({state:t,dispatch:e})=>Yx(t,e);function af(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function G1(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((i,s)=>(n.includes(s)||(i[s]=t[s]),i),{})}var ER=(t,e)=>({tr:n,state:i,dispatch:s})=>{let o=null,a=null;const u=af(typeof t=="string"?t:t.name,i.schema);if(!u)return!1;u==="node"&&(o=gt(t,i.schema)),u==="mark"&&(a=Li(t,i.schema));let f=!1;return n.selection.ranges.forEach(h=>{i.doc.nodesBetween(h.$from.pos,h.$to.pos,(p,g)=>{o&&o===p.type&&(f=!0,s&&n.setNodeMarkup(g,void 0,G1(p.attrs,e))),a&&p.marks.length&&p.marks.forEach(b=>{a===b.type&&(f=!0,s&&n.addMark(g,g+p.nodeSize,a.create(G1(b.attrs,e))))})})}),f},CR=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),MR=()=>({tr:t,dispatch:e})=>{if(e){const n=new hn(t.doc);t.setSelection(n)}return!0},AR=()=>({state:t,dispatch:e})=>qx(t,e),OR=()=>({state:t,dispatch:e})=>Gx(t,e),NR=()=>({state:t,dispatch:e})=>VA(t,e),RR=()=>({state:t,dispatch:e})=>PA(t,e),DR=()=>({state:t,dispatch:e})=>qA(t,e);function Yp(t,e,n={},i={}){return Wo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:i.errorOnInvalidContent})}var zR=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:i={}}={})=>({editor:s,tr:o,dispatch:a,commands:u})=>{const{doc:f}=o;if(i.preserveWhitespace!=="full"){const h=Yp(t,s.schema,i,{errorOnInvalidContent:e??s.options.enableContentCheck});return a&&o.replaceWith(0,f.content.size,h).setMeta("preventUpdate",!n),!0}return a&&o.setMeta("preventUpdate",!n),u.insertContentAt({from:0,to:f.content.size},t,{parseOptions:i,errorOnInvalidContent:e??s.options.enableContentCheck})};function Uw(t,e){const n=Li(e,t.schema),{from:i,to:s,empty:o}=t.selection,a=[];o?(t.storedMarks&&a.push(...t.storedMarks),a.push(...t.selection.$head.marks())):t.doc.nodesBetween(i,s,f=>{a.push(...f.marks)});const u=a.find(f=>f.type.name===n.name);return u?{...u.attrs}:{}}function jw(t,e){const n=new Em(t);return e.forEach(i=>{i.steps.forEach(s=>{n.step(s)})}),n}function LR(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 _R(t,e,n){const i=[];return t.nodesBetween(e.from,e.to,(s,o)=>{n(s)&&i.push({node:s,pos:o})}),i}function Iw(t,e){for(let n=t.depth;n>0;n-=1){const i=t.node(n);if(e(i))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:i}}}function cf(t){return e=>Iw(e.$from,t)}function le(t,e,n){return t.config[e]===void 0&&t.parent?le(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?le(t.parent,e,n):null}):t.config[e]}function Gm(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},i=le(e,"addExtensions",n);return i?[e,...Gm(i())]:e}).flat(10)}function Ym(t,e){const n=ys.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function Vw(t){return typeof t=="function"}function _e(t,e=void 0,...n){return Vw(t)?e?t.bind(e)(...n):t(...n):t}function BR(t={}){return Object.keys(t).length===0&&t.constructor===Object}function bl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),i=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:i}}function $w(t){const e=[],{nodeExtensions:n,markExtensions:i}=bl(t),s=[...n,...i],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},a=n.filter(h=>h.name!=="text").map(h=>h.name),u=i.map(h=>h.name),f=[...a,...u];return t.forEach(h=>{const p={name:h.name,options:h.options,storage:h.storage,extensions:s},g=le(h,"addGlobalAttributes",p);if(!g)return;g().forEach(v=>{let S;Array.isArray(v.types)?S=v.types:v.types==="*"?S=f:v.types==="nodes"?S=a:v.types==="marks"?S=u:S=[],S.forEach(w=>{Object.entries(v.attributes).forEach(([k,E])=>{e.push({type:w,name:k,attribute:{...o,...E}})})})})}),s.forEach(h=>{const p={name:h.name,options:h.options,storage:h.storage},g=le(h,"addAttributes",p);if(!g)return;const b=g();Object.entries(b).forEach(([v,S])=>{const w={...o,...S};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:v,attribute:w})})}),e}function HR(t){const e=[];let n="",i=!1,s=!1,o=0;const a=t.length;for(let u=0;u<a;u+=1){const f=t[u];if(f==="'"&&!s){i=!i,n+=f;continue}if(f==='"'&&!i){s=!s,n+=f;continue}if(!i&&!s){if(f==="("){o+=1,n+=f;continue}if(f===")"&&o>0){o-=1,n+=f;continue}if(f===";"&&o===0){e.push(n),n="";continue}}n+=f}return n&&e.push(n),e}function Y1(t){const e=[],n=HR(t||""),i=n.length;for(let s=0;s<i;s+=1){const o=n[s],a=o.indexOf(":");if(a===-1)continue;const u=o.slice(0,a).trim(),f=o.slice(a+1).trim();u&&f&&e.push([u,f])}return e}function Ze(...t){return t.filter(e=>!!e).reduce((e,n)=>{const i={...e};return Object.entries(n).forEach(([s,o])=>{if(!i[s]){i[s]=o;return}if(s==="class"){const u=o?String(o).split(" "):[],f=i[s]?i[s].split(" "):[],h=u.filter(p=>!f.includes(p));i[s]=[...f,...h].join(" ")}else if(s==="style"){const u=new Map([...Y1(i[s]),...Y1(o)]);i[s]=Array.from(u.entries()).map(([f,h])=>`${f}: ${h}`).join("; ")}else i[s]=o}),i},{})}function Qo(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,i)=>Ze(n,i),{})}function UR(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function X1(t,e){return"style"in t?t:{...t,getAttrs:n=>{const i=t.getAttrs?t.getAttrs(n):t.attrs;if(i===!1)return!1;const s=e.reduce((o,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(n):UR(n.getAttribute(a.name));return u==null?o:{...o,[a.name]:u}},{});return{...i,...s}}}}function F1(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&BR(n)?!1:n!=null))}function W1(t){var e,n;const i={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(i.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(i.validate=t.attribute.validate),[t.name,i]}function jR(t,e){var n;const i=$w(t),{nodeExtensions:s,markExtensions:o}=bl(t),a=(n=s.find(h=>le(h,"topNode")))==null?void 0:n.name,u=Object.fromEntries(s.map(h=>{const p=i.filter(E=>E.type===h.name),g={name:h.name,options:h.options,storage:h.storage,editor:e},b=t.reduce((E,N)=>{const L=le(N,"extendNodeSchema",g);return{...E,...L?L(h):{}}},{}),v=F1({...b,content:_e(le(h,"content",g)),marks:_e(le(h,"marks",g)),group:_e(le(h,"group",g)),inline:_e(le(h,"inline",g)),atom:_e(le(h,"atom",g)),selectable:_e(le(h,"selectable",g)),draggable:_e(le(h,"draggable",g)),code:_e(le(h,"code",g)),whitespace:_e(le(h,"whitespace",g)),linebreakReplacement:_e(le(h,"linebreakReplacement",g)),defining:_e(le(h,"defining",g)),isolating:_e(le(h,"isolating",g)),attrs:Object.fromEntries(p.map(W1))}),S=_e(le(h,"parseHTML",g));S&&(v.parseDOM=S.map(E=>X1(E,p)));const w=le(h,"renderHTML",g);w&&(v.toDOM=E=>w({node:E,HTMLAttributes:Qo(E,p)}));const k=le(h,"renderText",g);return k&&(v.toText=k),[h.name,v]})),f=Object.fromEntries(o.map(h=>{const p=i.filter(k=>k.type===h.name),g={name:h.name,options:h.options,storage:h.storage,editor:e},b=t.reduce((k,E)=>{const N=le(E,"extendMarkSchema",g);return{...k,...N?N(h):{}}},{}),v=F1({...b,inclusive:_e(le(h,"inclusive",g)),excludes:_e(le(h,"excludes",g)),group:_e(le(h,"group",g)),spanning:_e(le(h,"spanning",g)),code:_e(le(h,"code",g)),attrs:Object.fromEntries(p.map(W1))}),S=_e(le(h,"parseHTML",g));S&&(v.parseDOM=S.map(k=>X1(k,p)));const w=le(h,"renderHTML",g);return w&&(v.toDOM=k=>w({mark:k,HTMLAttributes:Qo(k,p)})),[h.name,v]}));return new xx({topNode:a,nodes:u,marks:f})}function IR(t){const e=t.filter((n,i)=>t.indexOf(n)!==i);return Array.from(new Set(e))}function _o(t){return t.sort((n,i)=>{const s=le(n,"priority")||100,o=le(i,"priority")||100;return s>o?-1:s<o?1:0})}function qw(t){const e=_o(Gm(t)),n=IR(e.map(i=>i.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),e}function Pw(t,e,n){const{from:i,to:s}=e,{blockSeparator:o=`
67
+
68
+ `,textSerializers:a={}}=n||{};let u="";return t.nodesBetween(i,s,(f,h,p,g)=>{var b;f.isBlock&&h>i&&(u+=o);const v=a==null?void 0:a[f.type.name];if(v)return p&&(u+=v({node:f,pos:h,parent:p,index:g,range:e})),!1;f.isText&&(u+=(b=f==null?void 0:f.text)==null?void 0:b.slice(Math.max(i,h)-h,s-h))}),u}function Kw(t,e){const n={from:0,to:t.content.size};return Pw(t,n,e)}function Xm(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function VR(t,e){const n=gt(e,t.schema),{from:i,to:s}=t.selection,o=[];t.doc.nodesBetween(i,s,u=>{o.push(u)});const a=o.reverse().find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function Gw(t,e){const n=af(typeof e=="string"?e:e.name,t.schema);return n==="node"?VR(t,e):n==="mark"?Uw(t,e):{}}function $R(t,e=JSON.stringify){const n={};return t.filter(i=>{const s=e(i);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function qR(t){const e=$R(t);return e.length===1?e:e.filter((n,i)=>!e.filter((o,a)=>a!==i).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 Yw(t){const{mapping:e,steps:n}=t,i=[];return e.maps.forEach((s,o)=>{const a=[];if(s.ranges.length)s.forEach((u,f)=>{a.push({from:u,to:f})});else{const{from:u,to:f}=n[o];if(u===void 0||f===void 0)return;a.push({from:u,to:f})}a.forEach(({from:u,to:f})=>{const h=e.slice(o).map(u,-1),p=e.slice(o).map(f),g=e.invert().map(h,-1),b=e.invert().map(p);i.push({oldRange:{from:g,to:b},newRange:{from:h,to:p}})})}),qR(i)}function Fm(t,e,n){const i=[];return t===e?n.resolve(t).marks().forEach(s=>{const o=n.resolve(t),a=Pm(o,s.type);a&&i.push({mark:s,...a})}):n.nodesBetween(t,e,(s,o)=>{!s||(s==null?void 0:s.nodeSize)===void 0||i.push(...s.marks.map(a=>({from:o,to:o+s.nodeSize,mark:a})))}),i}var PR=(t,e,n,i=20)=>{const s=t.doc.resolve(n);let o=i,a=null;for(;o>0&&a===null;){const u=s.node(o);(u==null?void 0:u.type.name)===e?a=u:o-=1}return[a,o]};function xo(t,e){return e.nodes[t]||e.marks[t]||null}function Xc(t,e,n){return Object.fromEntries(Object.entries(n).filter(([i])=>{const s=t.find(o=>o.type===e&&o.name===i);return s?s.attribute.keepOnSplit:!1}))}var KR=(t,e=500)=>{let n="";const i=t.parentOffset;return t.parent.nodesBetween(Math.max(0,i-e),i,(s,o,a,u)=>{var f,h;const p=((h=(f=s.type.spec).toText)==null?void 0:h.call(f,{node:s,pos:o,parent:a,index:u}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?p:p.slice(0,Math.max(0,i-o))}),n};function Xp(t,e,n={}){const{empty:i,ranges:s}=t.selection,o=e?Li(e,t.schema):null;if(i)return!!(t.storedMarks||t.selection.$from.marks()).filter(g=>o?o.name===g.type.name:!0).find(g=>fu(g.attrs,n,{strict:!1}));let a=0;const u=[];if(s.forEach(({$from:g,$to:b})=>{const v=g.pos,S=b.pos;t.doc.nodesBetween(v,S,(w,k)=>{if(o&&w.inlineContent&&!w.type.allowsMarkType(o))return!1;if(!w.isText&&!w.marks.length)return;const E=Math.max(v,k),N=Math.min(S,k+w.nodeSize),L=N-E;a+=L,u.push(...w.marks.map(V=>({mark:V,from:E,to:N})))})}),a===0)return!1;const f=u.filter(g=>o?o.name===g.mark.type.name:!0).filter(g=>fu(g.mark.attrs,n,{strict:!1})).reduce((g,b)=>g+b.to-b.from,0),h=u.filter(g=>o?g.mark.type!==o&&g.mark.type.excludes(o):!0).reduce((g,b)=>g+b.to-b.from,0);return(f>0?f+h:f)>=a}function GR(t,e,n={}){if(!e)return Mr(t,null,n)||Xp(t,null,n);const i=af(e,t.schema);return i==="node"?Mr(t,e,n):i==="mark"?Xp(t,e,n):!1}var YR=(t,e)=>{const{$from:n,$to:i,$anchor:s}=t.selection;if(e){const o=cf(u=>u.type.name===e)(t.selection);if(!o)return!1;const a=t.doc.resolve(o.pos+1);return s.pos+1===a.end()}return!(i.parentOffset<i.parent.nodeSize-2||n.pos!==i.pos)},XR=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Q1(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function op(t,e){const{nodeExtensions:n}=bl(e),i=n.find(a=>a.name===t);if(!i)return!1;const s={name:i.name,options:i.options,storage:i.storage},o=_e(le(i,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function uf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var i;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((i=t.text)!=null?i:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(o=>{s!==!1&&(uf(o,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function Xw(t){return t instanceof oe}var Fw=class Ww{constructor(e){this.position=e}static fromJSON(e){return new Ww(e.position)}toJSON(){return{position:this.position}}};function FR(t,e){const n=e.mapping.mapResult(t.position);return{position:new Fw(n.pos),mapResult:n}}function WR(t){return new Fw(t)}function Qw(t,e,n){const s=t.state.doc.content.size,o=Oi(e,0,s),a=Oi(n,0,s),u=t.coordsAtPos(o),f=t.coordsAtPos(a,-1),h=Math.min(u.top,f.top),p=Math.max(u.bottom,f.bottom),g=Math.min(u.left,f.left),b=Math.max(u.right,f.right),v=b-g,S=p-h,E={top:h,bottom:p,left:g,right:b,width:v,height:S,x:g,y:h};return{...E,toJSON:()=>E}}function QR(t,e,n){var i;const{selection:s}=e;let o=null;if(Km(s)&&(o=s.$cursor),o){const u=(i=t.storedMarks)!=null?i:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(u)||!u.some(h=>h.type.excludes(n)))}const{ranges:a}=s;return a.some(({$from:u,$to:f})=>{let h=u.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(u.pos,f.pos,(p,g,b)=>{if(h)return!1;if(p.isInline){const v=!b||b.type.allowsMarkType(n),S=!!n.isInSet(p.marks)||!p.marks.some(w=>w.type.excludes(n));h=v&&S}return!h}),h})}var JR=(t,e={})=>({tr:n,state:i,dispatch:s})=>{const{selection:o}=n,{empty:a,ranges:u}=o,f=Li(t,i.schema);if(s)if(a){const h=Uw(i,f);n.addStoredMark(f.create({...h,...e}))}else u.forEach(h=>{const p=h.$from.pos,g=h.$to.pos;i.doc.nodesBetween(p,g,(b,v)=>{const S=Math.max(v,p),w=Math.min(v+b.nodeSize,g);b.marks.find(E=>E.type===f)?b.marks.forEach(E=>{f===E.type&&n.addMark(S,w,f.create({...E.attrs,...e}))}):n.addMark(S,w,f.create(e))})});return QR(i,n,f)},ZR=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),eD=(t,e={})=>({state:n,dispatch:i,chain:s})=>{const o=gt(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:u})=>u1(o,{...a,...e})(n)?!0:u.clearNodes()).command(({state:u})=>u1(o,{...a,...e})(u,i)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},tD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:i}=e,s=Oi(t,0,i.content.size),o=oe.create(i,s);e.setSelection(o)}return!0},nD=(t,e)=>({tr:n,state:i,dispatch:s})=>{const{selection:o}=i;let a,u;return typeof e=="number"?(a=e,u=e):e&&"from"in e&&"to"in e?(a=e.from,u=e.to):(a=o.from,u=o.to),s&&n.doc.nodesBetween(a,u,(f,h)=>{f.isText||n.setNodeMarkup(h,void 0,{...f.attrs,dir:t})}),!0},iD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:i}=e,{from:s,to:o}=typeof t=="number"?{from:t,to:t}:t,a=ce.atStart(i).from,u=ce.atEnd(i).to,f=Oi(s,a,u),h=Oi(o,a,u),p=ce.create(i,f,h);e.setSelection(p)}return!0},rD=t=>({state:e,dispatch:n})=>{const i=gt(t,e.schema);return JA(i)(e,n)};function J1(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const i=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(i)}}var sD=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:i,editor:s})=>{const{selection:o,doc:a}=e,{$from:u,$to:f}=o,h=s.extensionManager.attributes,p=Xc(h,u.node().type.name,u.node().attrs);if(o instanceof oe&&o.node.isBlock)return!u.parentOffset||!Di(a,u.pos)?!1:(i&&(t&&J1(n,s.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;const g=f.parentOffset===f.parent.content.size,b=u.depth===0?void 0:LR(u.node(-1).contentMatchAt(u.indexAfter(-1)));let v=g&&b?[{type:b,attrs:p}]:void 0,S=Di(e.doc,e.mapping.map(u.pos),1,v);if(!v&&!S&&Di(e.doc,e.mapping.map(u.pos),1,b?[{type:b}]:void 0)&&(S=!0,v=b?[{type:b,attrs:p}]:void 0),i){if(S&&(o instanceof ce&&e.deleteSelection(),e.split(e.mapping.map(u.pos),1,v),b&&!g&&!u.parentOffset&&u.parent.type!==b)){const w=e.mapping.map(u.before()),k=e.doc.resolve(w);u.node(-1).canReplaceWith(k.index(),k.index()+1,b)&&e.setNodeMarkup(e.mapping.map(u.before()),b)}t&&J1(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return S},lD=(t,e={})=>({tr:n,state:i,dispatch:s,editor:o})=>{var a;const u=gt(t,i.schema),{$from:f,$to:h}=i.selection,p=i.selection.node;if(p&&p.isBlock||f.depth<2||!f.sameParent(h))return!1;const g=f.node(-1);if(g.type!==u)return!1;const b=o.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==u||f.index(-2)!==f.node(-2).childCount-1)return!1;if(s){let E=G.empty;const N=f.index(-1)?1:f.index(-2)?2:3;for(let W=f.depth-N;W>=f.depth-3;W-=1)E=G.from(f.node(W).copy(E));const L=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,V={...Xc(b,f.node().type.name,f.node().attrs),...e},I=((a=u.contentMatch.defaultType)==null?void 0:a.createAndFill(V))||void 0;E=E.append(G.from(u.createAndFill(null,I)||void 0));const C=f.before(f.depth-(N-1));n.replace(C,f.after(-L),new F(E,4-N,0));let H=-1;n.doc.nodesBetween(C,n.doc.content.size,(W,ie)=>{if(H>-1)return!1;W.isTextblock&&W.content.size===0&&(H=ie+1)}),H>-1&&n.setSelection(ce.near(n.doc.resolve(H))),n.scrollIntoView()}return!0}const v=h.pos===f.end()?g.contentMatchAt(0).defaultType:null,S={...Xc(b,g.type.name,g.attrs),...e},w={...Xc(b,f.node().type.name,f.node().attrs),...e};n.delete(f.pos,h.pos);const k=v?[{type:u,attrs:S},{type:v,attrs:w}]:[{type:u,attrs:S}];if(!Di(n.doc,f.pos,2))return!1;if(s){const{selection:E,storedMarks:N}=i,{splittableMarks:L}=o.extensionManager,V=N||E.$to.parentOffset&&E.$from.marks();if(n.split(f.pos,2,k).scrollIntoView(),!V||!s)return!0;const I=V.filter(C=>L.includes(C.type.name));n.ensureMarks(I)}return!0},ap=(t,e)=>{const n=cf(a=>a.type===e)(t.selection);if(!n)return!0;const i=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(i===void 0)return!0;const s=t.doc.nodeAt(i);return n.node.type===(s==null?void 0:s.type)&&Or(t.doc,n.pos)&&t.join(n.pos),!0},cp=(t,e)=>{const n=cf(a=>a.type===e)(t.selection);if(!n)return!0;const i=t.doc.resolve(n.start).after(n.depth);if(i===void 0)return!0;const s=t.doc.nodeAt(i);return n.node.type===(s==null?void 0:s.type)&&Or(t.doc,i)&&t.join(i),!0};function oD(t){const e=t.doc,n=e.firstChild;if(!n)return null;const i=e.resolve(1),s=e.resolve(n.nodeSize-1);return ce.between(i,s)}var aD=(t,e,n,i={})=>({editor:s,tr:o,state:a,dispatch:u,chain:f,commands:h,can:p})=>{const{extensions:g,splittableMarks:b}=s.extensionManager,v=gt(t,a.schema),S=gt(e,a.schema),{selection:w,storedMarks:k}=a,{$from:E,$to:N}=w,L=E.blockRange(N),V=k||w.$to.parentOffset&&w.$from.marks();if(!L)return!1;const I=cf(xe=>op(xe.type.name,g))(w),C=w.from===0&&w.to===a.doc.content.size,H=a.doc.content.content,W=H.length===1?H[0]:null,ie=C&&W&&op(W.type.name,g)?{node:W,pos:0}:null,te=I??ie,ve=!!I&&L.depth>=1&&L.depth-I.depth<=1,pe=!!ie;if((ve||pe)&&te){if(te.node.type===v)return C&&pe?f().command(({tr:xe,dispatch:de})=>{const se=oD(xe);return se?(xe.setSelection(se),de&&de(xe),!0):!1}).liftListItem(S).run():h.liftListItem(S);if(op(te.node.type.name,g)&&v.validContent(te.node.content))return f().command(()=>(o.setNodeMarkup(te.pos,v),!0)).command(()=>ap(o,v)).command(()=>cp(o,v)).run()}return!n||!V||!u?f().command(()=>p().wrapInList(v,i)?!0:h.clearNodes()).wrapInList(v,i).command(()=>ap(o,v)).command(()=>cp(o,v)).run():f().command(()=>{const xe=p().wrapInList(v,i),de=V.filter(se=>b.includes(se.type.name));return o.ensureMarks(de),xe?!0:h.clearNodes()}).wrapInList(v,i).command(()=>ap(o,v)).command(()=>cp(o,v)).run()},cD=(t,e={},n={})=>({state:i,commands:s})=>{const{extendEmptyMarkRange:o=!1}=n,a=Li(t,i.schema);return Xp(i,a,e)?s.unsetMark(a,{extendEmptyMarkRange:o}):s.setMark(a,e)},uD=(t,e,n={})=>({state:i,commands:s})=>{const o=gt(t,i.schema),a=gt(e,i.schema),u=Mr(i,o,n);let f;return i.selection.$anchor.sameParent(i.selection.$head)&&(f=i.selection.$anchor.parent.attrs),u?s.setNode(a,f):s.setNode(o,{...f,...n})},fD=(t,e={})=>({state:n,commands:i})=>{const s=gt(t,n.schema);return Mr(n,s,e)?i.lift(s):i.wrapIn(s,e)},dD=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let i=0;i<n.length;i+=1){const s=n[i];let o;if(s.spec.isInputRules&&(o=s.getState(t))){if(e){const a=t.tr,u=o.transform;for(let f=u.steps.length-1;f>=0;f-=1)a.step(u.steps[f].invert(u.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,t.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},hD=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:i,ranges:s}=n;return i||e&&s.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},pD=(t,e={})=>({tr:n,state:i,dispatch:s})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:u}=n,f=Li(t,i.schema),{$from:h,empty:p,ranges:g}=u;if(!s)return!0;if(p&&a){let{from:b,to:v}=u;const S=(o=h.marks().find(k=>k.type===f))==null?void 0:o.attrs,w=Pm(h,f,S);w&&(b=w.from,v=w.to),n.removeMark(b,v,f)}else g.forEach(b=>{n.removeMark(b.$from.pos,b.$to.pos,f)});return n.removeStoredMark(f),!0},mD=t=>({tr:e,state:n,dispatch:i})=>{const{selection:s}=n;let o,a;return typeof t=="number"?(o=t,a=t):t&&"from"in t&&"to"in t?(o=t.from,a=t.to):(o=s.from,a=s.to),i&&e.doc.nodesBetween(o,a,(u,f)=>{if(u.isText)return;const h={...u.attrs};delete h.dir,e.setNodeMarkup(f,void 0,h)}),!0},gD=(t,e={})=>({tr:n,state:i,dispatch:s})=>{let o=null,a=null;const u=af(typeof t=="string"?t:t.name,i.schema);if(!u)return!1;u==="node"&&(o=gt(t,i.schema)),u==="mark"&&(a=Li(t,i.schema));let f=!1;return n.selection.ranges.forEach(h=>{const p=h.$from.pos,g=h.$to.pos;let b,v,S,w;n.selection.empty?i.doc.nodesBetween(p,g,(k,E)=>{o&&o===k.type&&(f=!0,S=Math.max(E,p),w=Math.min(E+k.nodeSize,g),b=E,v=k)}):i.doc.nodesBetween(p,g,(k,E)=>{E<p&&o&&o===k.type&&(f=!0,S=Math.max(E,p),w=Math.min(E+k.nodeSize,g),b=E,v=k),E>=p&&E<=g&&(o&&o===k.type&&(f=!0,s&&n.setNodeMarkup(E,void 0,{...k.attrs,...e})),a&&k.marks.length&&k.marks.forEach(N=>{if(a===N.type&&(f=!0,s)){const L=Math.max(E,p),V=Math.min(E+k.nodeSize,g);n.addMark(L,V,a.create({...N.attrs,...e}))}}))}),v&&(b!==void 0&&s&&n.setNodeMarkup(b,void 0,{...v.attrs,...e}),a&&v.marks.length&&v.marks.forEach(k=>{a===k.type&&s&&n.addMark(S,w,a.create({...k.attrs,...e}))}))}),f},yD=(t,e={})=>({state:n,dispatch:i})=>{const s=gt(t,n.schema);return KA(s,e)(n,i)},bD=(t,e={})=>({state:n,dispatch:i})=>{const s=gt(t,n.schema);return GA(s,e)(n,i)},vD=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(i=>i.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(i=>i!==e):delete this.callbacks[t]),this}once(t,e){const n=(...i)=>{this.off(t,n),e.apply(this,i)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},ff=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},SD=(t,e)=>{if(qm(e))return e.exec(t);const n=e(t);if(!n)return null;const i=[n.text];return i.index=n.index,i.input=t,i.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),i.push(n.replaceWith)),i};function Rc(t){var e;const{editor:n,from:i,to:s,text:o,rules:a,plugin:u}=t,{view:f}=n;if(f.composing)return!1;const h=f.state.doc.resolve(i);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(b=>b.type.spec.code))return!1;let p=!1;const g=KR(h)+o;return a.forEach(b=>{if(p)return;const v=SD(g,b.find);if(!v)return;const S=f.state.tr,w=lf({state:f.state,transaction:S}),k={from:i-(v[0].length-o.length),to:s},{commands:E,chain:N,can:L}=new of({editor:n,state:w});b.handler({state:w,range:k,match:v,commands:E,chain:N,can:L})===null||!S.steps.length||(b.undoable&&S.setMeta(u,{transform:S,from:i,to:s,text:o}),f.dispatch(S),p=!0)}),p}function xD(t){const{editor:e,rules:n}=t,i=new Ye({state:{init(){return null},apply(s,o,a){const u=s.getMeta(i);if(u)return u;const f=s.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:p}=f;typeof p=="string"?p=p:p=Ym(G.from(p),a.schema);const{from:g}=f,b=g+p.length;Rc({editor:e,from:g,to:b,text:p,rules:n,plugin:i})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,a,u){return Rc({editor:e,from:o,to:a,text:u,rules:n,plugin:i})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&Rc({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:i})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:a}=s.state.selection;return a?Rc({editor:e,from:a.pos,to:a.pos,text:`
69
+ `,rules:n,plugin:i}):!1}},isInputRules:!0});return i}function wD(t){return Object.prototype.toString.call(t).slice(8,-1)}function Dc(t){return wD(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Jw(t,e){const n={...t};return Dc(t)&&Dc(e)&&Object.keys(e).forEach(i=>{Dc(e[i])&&Dc(t[i])?n[i]=Jw(t[i],e[i]):n[i]=e[i]}),n}var Wm=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{..._e(le(this,"addOptions",{name:this.name}))||{}}}get storage(){return{..._e(le(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Jw(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},bs=class Zw extends Wm{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Zw(n)}static handleExit({editor:e,mark:n}){const{tr:i}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const a=s.marks();if(!!!a.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const f=a.find(h=>(h==null?void 0:h.type.name)===n.name);return f&&i.removeStoredMark(f),i.insertText(" ",s.pos),e.view.dispatch(i),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function kD(t){return typeof t=="number"}var TD=class{constructor(t){this.find=t.find,this.handler=t.handler}},ED=(t,e,n)=>{if(qm(e))return[...t.matchAll(e)];const i=e(t,n);return i?i.map(s=>{const o=[s.text];return o.index=s.index,o.input=t,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function CD(t){const{editor:e,state:n,from:i,to:s,rule:o,pasteEvent:a,dropEvent:u}=t,{commands:f,chain:h,can:p}=new of({editor:e,state:n}),g=[];return n.doc.nodesBetween(i,s,(v,S)=>{var w,k,E,N,L;if((k=(w=v.type)==null?void 0:w.spec)!=null&&k.code||!(v.isText||v.isTextblock||v.isInline))return;const V=(L=(N=(E=v.content)==null?void 0:E.size)!=null?N:v.nodeSize)!=null?L:0,I=Math.max(i,S),C=Math.min(s,S+V);if(I>=C)return;const H=v.isText?v.text||"":v.textBetween(I-S,C-S,void 0,"");ED(H,o.find,a).forEach(ie=>{if(ie.index===void 0)return;const te=I+ie.index+1,ve=te+ie[0].length,pe={from:n.tr.mapping.map(te),to:n.tr.mapping.map(ve)},xe=o.handler({state:n,range:pe,match:ie,commands:f,chain:h,can:p,pasteEvent:a,dropEvent:u});g.push(xe)})}),g.every(v=>v!==null)}var zc=null,MD=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function AD(t){const{editor:e,rules:n}=t;let i=null,s=!1,o=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u;try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}const f=({state:p,from:g,to:b,rule:v,pasteEvt:S})=>{const w=p.tr,k=lf({state:p,transaction:w});if(!(!CD({editor:e,state:k,from:Math.max(g-1,0),to:b.b-1,rule:v,pasteEvent:S,dropEvent:u})||!w.steps.length)){try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(p=>new Ye({view(g){const b=S=>{var w;i=(w=g.dom.parentElement)!=null&&w.contains(S.target)?g.dom.parentElement:null,i&&(zc=e)},v=()=>{zc&&(zc=null)};return window.addEventListener("dragstart",b),window.addEventListener("dragend",v),{destroy(){window.removeEventListener("dragstart",b),window.removeEventListener("dragend",v)}}},props:{handleDOMEvents:{drop:(g,b)=>{if(o=i===g.dom.parentElement,u=b,!o){const v=zc;v!=null&&v.isEditable&&setTimeout(()=>{const S=v.state.selection;S&&v.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(g,b)=>{var v;const S=(v=b.clipboardData)==null?void 0:v.getData("text/html");return a=b,s=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(g,b,v)=>{const S=g[0],w=S.getMeta("uiEvent")==="paste"&&!s,k=S.getMeta("uiEvent")==="drop"&&!o,E=S.getMeta("applyPasteRules"),N=!!E;if(!w&&!k&&!N)return;if(N){let{text:I}=E;typeof I=="string"?I=I:I=Ym(G.from(I),v.schema);const{from:C}=E,H=C+I.length,W=MD(I);return f({rule:p,state:v,from:C,to:{b:H},pasteEvt:W})}const L=b.doc.content.findDiffStart(v.doc.content),V=b.doc.content.findDiffEnd(v.doc.content);if(!(!kD(L)||!V||L===V.b))return f({rule:p,state:v,from:L,to:V,pasteEvt:a})}}))}var df=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=qw(t),this.schema=jR(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:xo(e.name,this.schema)},i=le(e,"addCommands",n);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this;return _o([...this.extensions].reverse()).flatMap(i=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:xo(i.name,this.schema)},o=[],a=le(i,"addKeyboardShortcuts",s);let u={};if(i.type==="mark"&&le(i,"exitable",s)&&(u.ArrowRight=()=>bs.handleExit({editor:t,mark:i})),a){const b=Object.fromEntries(Object.entries(a()).map(([v,S])=>[v,()=>S({editor:t})]));u={...u,...b}}const f=$N(u);o.push(f);const h=le(i,"addInputRules",s);if(Q1(i,t.options.enableInputRules)&&h){const b=h();if(b&&b.length){const v=xD({editor:t,rules:b}),S=Array.isArray(v)?v:[v];o.push(...S)}}const p=le(i,"addPasteRules",s);if(Q1(i,t.options.enablePasteRules)&&p){const b=p();if(b&&b.length){const v=AD({editor:t,rules:b});o.push(...v)}}const g=le(i,"addProseMirrorPlugins",s);if(g){const b=g();o.push(...b)}return o})}get attributes(){return $w(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=bl(this.extensions);return Object.fromEntries(e.filter(n=>!!le(n,"addNodeView")).map(n=>{const i=this.attributes.filter(f=>f.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:gt(n.name,this.schema)},o=le(n,"addNodeView",s);if(!o)return[];const a=o();if(!a)return[];const u=(f,h,p,g,b)=>{const v=Qo(f,i);return a({node:f,view:h,getPos:p,decorations:g,innerDecorations:b,editor:t,extension:n,HTMLAttributes:v})};return[n.name,u]}))}dispatchTransaction(t){const{editor:e}=this;return _o([...this.extensions].reverse()).reduceRight((i,s)=>{const o={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:xo(s.name,this.schema)},a=le(s,"dispatchTransaction",o);return a?u=>{a.call(o,{transaction:u,next:i})}:i},t)}transformPastedHTML(t){const{editor:e}=this;return _o([...this.extensions]).reduce((i,s)=>{const o={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:xo(s.name,this.schema)},a=le(s,"transformPastedHTML",o);return a?(u,f)=>{const h=i(u,f);return a.call(o,h)}:i},t||(i=>i))}get markViews(){const{editor:t}=this,{markExtensions:e}=bl(this.extensions);return Object.fromEntries(e.filter(n=>!!le(n,"addMarkView")).map(n=>{const i=this.attributes.filter(u=>u.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Li(n.name,this.schema)},o=le(n,"addMarkView",s);if(!o)return[];const a=(u,f,h)=>{const p=Qo(u,i);return o()({mark:u,view:f,inline:h,editor:t,extension:n,HTMLAttributes:p,updateAttributes:g=>{qD(u,t,g)}})};return[n.name,a]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:xo(e.name,this.schema)};e.type==="mark"&&((n=_e(le(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name);const s=le(e,"onBeforeCreate",i),o=le(e,"onCreate",i),a=le(e,"onUpdate",i),u=le(e,"onSelectionUpdate",i),f=le(e,"onTransaction",i),h=le(e,"onFocus",i),p=le(e,"onBlur",i),g=le(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),a&&this.editor.on("update",a),u&&this.editor.on("selectionUpdate",u),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),p&&this.editor.on("blur",p),g&&this.editor.on("destroy",g)})}};df.resolve=qw;df.sort=_o;df.flatten=Gm;var OD={};$m(OD,{ClipboardTextSerializer:()=>tk,Commands:()=>nk,Delete:()=>ik,Drop:()=>rk,Editable:()=>sk,FocusEvents:()=>ok,Keymap:()=>ak,Paste:()=>ck,Tabindex:()=>uk,TextDirection:()=>fk,focusEventsPluginKey:()=>lk});var nt=class ek extends Wm{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new ek(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},tk=nt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ye({key:new et("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:i,selection:s}=e,{ranges:o}=s,a=Math.min(...o.map(p=>p.$from.pos)),u=Math.max(...o.map(p=>p.$to.pos)),f=Xm(n);return Pw(i,{from:a,to:u},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}}),nk=nt.create({name:"commands",addCommands(){return{...zw}}}),ik=nt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,i,s;const o=()=>{var a,u,f,h;if((h=(f=(u=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:u.filterTransaction)==null?void 0:f.call(u,t))!=null?h:t.getMeta("y-sync$"))return;const p=jw(t.before,[t,...e]);Yw(p).forEach(v=>{p.mapping.mapResult(v.oldRange.from).deletedAfter&&p.mapping.mapResult(v.oldRange.to).deletedBefore&&p.before.nodesBetween(v.oldRange.from,v.oldRange.to,(S,w)=>{const k=w+S.nodeSize-2,E=v.oldRange.from<=w&&k<=v.oldRange.to;this.editor.emit("delete",{type:"node",node:S,from:w,to:k,newFrom:p.mapping.map(w),newTo:p.mapping.map(k),deletedRange:v.oldRange,newRange:v.newRange,partial:!E,editor:this.editor,transaction:t,combinedTransform:p})})});const b=p.mapping;p.steps.forEach((v,S)=>{var w,k;if(v instanceof Hn){const E=b.slice(S).map(v.from,-1),N=b.slice(S).map(v.to),L=b.invert().map(E,-1),V=b.invert().map(N),I=E>0?(w=p.doc.nodeAt(E-1))==null?void 0:w.marks.some(H=>H.eq(v.mark)):!1,C=(k=p.doc.nodeAt(N))==null?void 0:k.marks.some(H=>H.eq(v.mark));this.editor.emit("delete",{type:"mark",mark:v.mark,from:v.from,to:v.to,deletedRange:{from:L,to:V},newRange:{from:E,to:N},partial:!!(C||I),editor:this.editor,transaction:t,combinedTransform:p})}})};(s=(i=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:i.async)==null||s?setTimeout(o,0):o()}}),rk=nt.create({name:"drop",addProseMirrorPlugins(){return[new Ye({key:new et("tiptapDrop"),props:{handleDrop:(t,e,n,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:i})}}})]}}),sk=nt.create({name:"editable",addProseMirrorPlugins(){return[new Ye({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),lk=new et("focusEvents"),ok=nt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ye({key:lk,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const i=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(i),!1},blur:(e,n)=>{t.isFocused=!1;const i=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(i),!1}}}})]}}),ak=nt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:u})=>{const{selection:f,doc:h}=u,{empty:p,$anchor:g}=f,{pos:b,parent:v}=g,S=g.parent.isTextblock&&b>0?u.doc.resolve(b-1):g,w=S.parent.type.spec.isolating,k=g.pos-g.parentOffset,E=w&&S.parent.childCount===1?k===g.pos:he.atStart(h).from===b;return!p||!v.type.isTextblock||v.textContent.length||!E||E&&g.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),i={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...i},o={...i,"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 du()||Hw()?o:s},addProseMirrorPlugins(){return[new Ye({key:new et("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const i=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),s=t.some(w=>w.getMeta("preventClearDocument"));if(!i||s)return;const{empty:o,from:a,to:u}=e.selection,f=he.atStart(e.doc).from,h=he.atEnd(e.doc).to;if(o||!(a===f&&u===h)||!uf(n.doc))return;const b=n.tr,v=lf({state:n,transaction:b}),{commands:S}=new of({editor:this.editor,state:v});if(S.clearNodes(),!!b.steps.length)return b}})]}}),ck=nt.create({name:"paste",addProseMirrorPlugins(){return[new Ye({key:new et("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),uk=nt.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Ye({key:new et("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),fk=nt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=bl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ye({key:new et("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),ND=class Oo{constructor(e,n,i=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=i,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,i=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,i=this.to-1}this.editor.commands.insertContentAt({from:n,to:i},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Oo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Oo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Oo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,i)=>{const s=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,a=n.isInline,u=this.pos+i+(o?0:1);if(u<0||u>this.resolvedPos.doc.nodeSize-2)return;const f=this.resolvedPos.doc.resolve(u);if(!s&&!a&&f.depth<=this.depth)return;const h=new Oo(f,this.editor,s,s||a?n:null);s&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let i=null,s=this.parent;for(;s&&!i;){if(s.node.type.name===e)if(Object.keys(n).length>0){const o=s.node.attrs,a=Object.keys(n);for(let u=0;u<a.length;u+=1){const f=a[u];if(o[f]!==n[f])break}}else i=s;s=s.parent}return i}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},i=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(n);return this.children.forEach(a=>{i&&s.length>0||(a.node.type.name===e&&o.every(f=>n[f]===a.node.attrs[f])&&s.push(a),!(i&&s.length>0)&&(s=s.concat(a.querySelectorAll(e,n,i))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},RD=`.ProseMirror {
70
+ position: relative;
71
+ }
72
+
73
+ .ProseMirror {
74
+ word-wrap: break-word;
75
+ white-space: pre-wrap;
76
+ white-space: break-spaces;
77
+ -webkit-font-variant-ligatures: none;
78
+ font-variant-ligatures: none;
79
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
80
+ }
81
+
82
+ .ProseMirror [contenteditable="false"] {
83
+ white-space: normal;
84
+ }
85
+
86
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
87
+ white-space: pre-wrap;
88
+ }
89
+
90
+ .ProseMirror pre {
91
+ white-space: pre-wrap;
92
+ }
93
+
94
+ img.ProseMirror-separator {
95
+ display: inline !important;
96
+ border: none !important;
97
+ margin: 0 !important;
98
+ width: 0 !important;
99
+ height: 0 !important;
100
+ }
101
+
102
+ .ProseMirror-gapcursor {
103
+ display: none;
104
+ pointer-events: none;
105
+ position: absolute;
106
+ margin: 0;
107
+ }
108
+
109
+ .ProseMirror-gapcursor:after {
110
+ content: "";
111
+ display: block;
112
+ position: absolute;
113
+ top: -2px;
114
+ width: 20px;
115
+ border-top: 1px solid black;
116
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
117
+ }
118
+
119
+ @keyframes ProseMirror-cursor-blink {
120
+ to {
121
+ visibility: hidden;
122
+ }
123
+ }
124
+
125
+ .ProseMirror-hideselection *::selection {
126
+ background: transparent;
127
+ }
128
+
129
+ .ProseMirror-hideselection *::-moz-selection {
130
+ background: transparent;
131
+ }
132
+
133
+ .ProseMirror-hideselection * {
134
+ caret-color: transparent;
135
+ }
136
+
137
+ .ProseMirror-focused .ProseMirror-gapcursor {
138
+ display: block;
139
+ }`;function DD(t,e,n){const i=document.querySelector("style[data-tiptap-style]");if(i!==null)return i;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var zD=class extends vD{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:FR,createMappablePosition:WR},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=_w(e,this.options.autofocus);this.editorState=ul.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=DD(RD,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=Vw(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;n=n.filter(a=>!a.key.startsWith(o))}),e.length===n.length)return;const i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}createExtensionManager(){var t,e,n,i;const o=[...this.options.enableCoreExtensions?[sk,tk.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),nk,ok,ak,uk.configure({value:(i=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:i.value}),rk,ck,ik,fk.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new df(o,this)}createCommandManager(){this.commandManager=new of({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Yp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Yp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,i=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(i):i,o=e.transformPastedHTML,a=this.extensionManager.transformPastedHTML(o);this.editorView=new Dw(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const u=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(u),this.prependClass(),this.injectCSS();const f=this.view.dom;f.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),i=!this.state.selection.eq(e.selection),s=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:t});const a=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),u=a==null?void 0:a.getMeta("focus"),f=a==null?void 0:a.getMeta("blur");u&&this.emit("focus",{editor:this,event:u.event,transaction:a}),f&&this.emit("blur",{editor:this,event:f.event,transaction:a}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Gw(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,i=typeof t=="string"?e:t;return GR(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ym(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
140
+
141
+ `,textSerializers:n={}}=t||{};return Kw(this.state.doc,{blockSeparator:e,textSerializers:{...Xm(this.schema),...n}})}get isEmpty(){return uf(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new ND(e,this)}get $doc(){return this.$pos(0)}};function vl(t){return new ff({find:t.find,handler:({state:e,range:n,match:i})=>{const s=_e(t.getAttributes,void 0,i);if(s===!1||s===null)return null;const{tr:o}=e,a=i[i.length-1],u=i[0];if(a){const f=u.search(/\S/),h=n.from+u.indexOf(a),p=h+a.length;if(Fm(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(w=>w===t.type&&w!==v.mark.type)).filter(v=>v.to>h).length)return null;p<n.to&&o.delete(p,n.to),h>n.from&&o.delete(n.from+f,h);const b=n.from+f+a.length;o.addMark(n.from+f,b,t.type.create(s||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function dk(t){return new ff({find:t.find,handler:({state:e,range:n,match:i})=>{const s=_e(t.getAttributes,void 0,i)||{},{tr:o}=e,a=n.from;let u=n.to;const f=t.type.create(s);if(i[1]){const h=i[0].lastIndexOf(i[1]);let p=a+h;p>u?p=u:u=p+i[1].length;const g=i[0][i[0].length-1];o.insertText(g,a+i[0].length-1),o.replaceWith(p,u,f)}else if(i[0]){const h=t.type.isInline?a:a-1;o.insert(h,t.type.create(s)).delete(o.mapping.map(a),o.mapping.map(u))}o.scrollIntoView()},undoable:t.undoable})}function Fp(t){return new ff({find:t.find,handler:({state:e,range:n,match:i})=>{const s=e.doc.resolve(n.from),o=_e(t.getAttributes,void 0,i)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function Sl(t){return new ff({find:t.find,handler:({state:e,range:n,match:i,chain:s})=>{const o=_e(t.getAttributes,void 0,i)||{},a=e.tr.delete(n.from,n.to),f=a.doc.resolve(n.from).blockRange(),h=f&&Tm(f,t.type,o);if(!h)return null;if(a.wrap(f,h),t.keepMarks&&t.editor){const{selection:g,storedMarks:b}=e,{splittableMarks:v}=t.editor.extensionManager,S=b||g.$to.parentOffset&&g.$from.marks();if(S){const w=S.filter(k=>v.includes(k.type.name));a.ensureMarks(w)}}if(t.keepAttributes){const g=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(g,o).run()}const p=a.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&Or(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(i,p))&&a.join(n.from-1)},undoable:t.undoable})}var LD=t=>"touches"in t,_D=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=u=>{if(!this.isResizing||!this.activeHandle)return;const f=u.clientX-this.startX,h=u.clientY-this.startY;this.handleResize(f,h)},this.handleTouchMove=u=>{if(!this.isResizing||!this.activeHandle)return;const f=u.touches[0];if(!f)return;const h=f.clientX-this.startX,p=f.clientY-this.startY;this.handleResize(h,p)},this.handleMouseUp=()=>{if(!this.isResizing)return;const u=this.element.offsetWidth,f=this.element.offsetHeight;this.onCommit(u,f),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=u=>{u.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=u=>{u.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,i,s,o,a;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(i=t==null?void 0:t.options)!=null&&i.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(o=t.options)!=null&&o.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(a=t.options)!=null&&a.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),i=e.includes("bottom"),s=e.includes("left"),o=e.includes("right");n&&(t.style.top="0"),i&&(t.style.bottom="0"),s&&(t.style.left="0"),o&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,LD(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:i,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),o=this.applyConstraints(i,s,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(t,e,n){let i=this.startWidth,s=this.startHeight;const o=t.includes("right"),a=t.includes("left"),u=t.includes("bottom"),f=t.includes("top");return o?i=this.startWidth+e:a&&(i=this.startWidth-e),u?s=this.startHeight+n:f&&(s=this.startHeight-n),(t==="right"||t==="left")&&(i=this.startWidth+(o?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(u?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(i,s,t):{width:i,height:s}}applyConstraints(t,e,n){var i,s,o,a;if(!n){let h=Math.max(this.minSize.width,t),p=Math.max(this.minSize.height,e);return(i=this.maxSize)!=null&&i.width&&(h=Math.min(this.maxSize.width,h)),(s=this.maxSize)!=null&&s.height&&(p=Math.min(this.maxSize.height,p)),{width:h,height:p}}let u=t,f=e;return u<this.minSize.width&&(u=this.minSize.width,f=u/this.aspectRatio),f<this.minSize.height&&(f=this.minSize.height,u=f*this.aspectRatio),(o=this.maxSize)!=null&&o.width&&u>this.maxSize.width&&(u=this.maxSize.width,f=u/this.aspectRatio),(a=this.maxSize)!=null&&a.height&&f>this.maxSize.height&&(f=this.maxSize.height,u=f*this.aspectRatio),{width:u,height:f}}applyAspectRatio(t,e,n){const i=n==="left"||n==="right",s=n==="top"||n==="bottom";return i?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function BD(t,e){const{selection:n}=t,{$from:i}=n;if(n instanceof oe){const o=i.index();return i.parent.canReplaceWith(o,o+1,e)}let s=i.depth;for(;s>=0;){const o=i.index(s);if(i.node(s).contentMatchAt(o).matchType(e))return!0;s-=1}return!1}var HD={};$m(HD,{createAtomBlockMarkdownSpec:()=>UD,createBlockMarkdownSpec:()=>jD,createInlineMarkdownSpec:()=>$D,parseAttributes:()=>Qm,parseIndentedBlocks:()=>Wp,renderNestedMarkdownContent:()=>Zm,serializeAttributes:()=>Jm});function Qm(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],i=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),s=i.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const h=s.map(p=>p.trim().slice(1));e.class=h.join(" ")}const o=i.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(i.matchAll(a)).forEach(([,h,p])=>{var g;const b=parseInt(((g=p.match(/__QUOTED_(\d+)__/))==null?void 0:g[1])||"0",10),v=n[b];v&&(e[h]=v.slice(1,-1))});const f=i.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return f&&f.split(/\s+/).filter(Boolean).forEach(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(e[p]=!0)}),e}function Jm(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(i=>e.push(`.${i}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,i])=>{n==="class"||n==="id"||(i===!0?e.push(n):i!==!1&&i!=null&&e.push(`${n}="${String(i)}"`))}),e.join(" ")}function UD(t){const{nodeName:e,name:n,parseAttributes:i=Qm,serializeAttributes:s=Jm,defaultAttributes:o={},requiredAttributes:a=[],allowedAttributes:u}=t,f=n||e,h=p=>{if(!u)return p;const g={};return u.forEach(b=>{b in p&&(g[b]=p[b])}),g};return{parseMarkdown:(p,g)=>{const b={...o,...p.attributes};return g.createNode(e,b,[])},markdownTokenizer:{name:e,level:"block",start(p){var g;const b=new RegExp(`^:::${f}(?:\\s|$)`,"m"),v=(g=p.match(b))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(p,g,b){const v=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),S=p.match(v);if(!S)return;const w=S[1]||"",k=i(w);if(!a.find(N=>!(N in k)))return{type:e,raw:S[0],attributes:k}}},renderMarkdown:p=>{const g=h(p.attrs||{}),b=s(g),v=b?` {${b}}`:"";return`:::${f}${v} :::`}}}function jD(t){const{nodeName:e,name:n,getContent:i,parseAttributes:s=Qm,serializeAttributes:o=Jm,defaultAttributes:a={},content:u="block",allowedAttributes:f}=t,h=n||e,p=g=>{if(!f)return g;const b={};return f.forEach(v=>{v in g&&(b[v]=g[v])}),b};return{parseMarkdown:(g,b)=>{let v;if(i){const w=i(g);v=typeof w=="string"?[{type:"text",text:w}]:w}else u==="block"?v=b.parseChildren(g.tokens||[]):v=b.parseInline(g.tokens||[]);const S={...a,...g.attributes};return b.createNode(e,S,v)},markdownTokenizer:{name:e,level:"block",start(g){var b;const v=new RegExp(`^:::${h}`,"m"),S=(b=g.match(v))==null?void 0:b.index;return S!==void 0?S:-1},tokenize(g,b,v){var S;const w=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),k=g.match(w);if(!k)return;const[E,N=""]=k,L=s(N);let V=1;const I=E.length;let C="";const H=/^:::([\w-]*)(\s.*)?/gm,W=g.slice(I);for(H.lastIndex=0;;){const ie=H.exec(W);if(ie===null)break;const te=ie.index,ve=ie[1];if(!((S=ie[2])!=null&&S.endsWith(":::"))){if(ve)V+=1;else if(V-=1,V===0){const pe=W.slice(0,te);C=pe.trim();const xe=g.slice(0,I+te+ie[0].length);let de=[];if(C)if(u==="block")for(de=v.blockTokens(pe),de.forEach(se=>{se.text&&(!se.tokens||se.tokens.length===0)&&(se.tokens=v.inlineTokens(se.text))});de.length>0;){const se=de[de.length-1];if(se.type==="paragraph"&&(!se.text||se.text.trim()===""))de.pop();else break}else de=v.inlineTokens(C);return{type:e,raw:xe,attributes:L,content:C,tokens:de}}}}}},renderMarkdown:(g,b)=>{const v=p(g.attrs||{}),S=o(v),w=S?` {${S}}`:"",k=b.renderChildren(g.content||[],`
142
+
143
+ `);return`:::${h}${w}
144
+
145
+ ${k}
146
+
147
+ :::`}}}function ID(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let i=n.exec(t);for(;i!==null;){const[,s,o,a]=i;e[s]=o||a,i=n.exec(t)}return e}function VD(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function $D(t){const{nodeName:e,name:n,getContent:i,parseAttributes:s=ID,serializeAttributes:o=VD,defaultAttributes:a={},selfClosing:u=!1,allowedAttributes:f}=t,h=n||e,p=b=>{if(!f)return b;const v={};return f.forEach(S=>{const w=typeof S=="string"?S:S.name,k=typeof S=="string"?void 0:S.skipIfDefault;if(w in b){const E=b[w];if(k!==void 0&&E===k)return;v[w]=E}}),v},g=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(b,v)=>{const S={...a,...b.attributes};if(u)return v.createNode(e,S);const w=i?i(b):b.content||"";return w?v.createNode(e,S,[v.createTextNode(w)]):v.createNode(e,S,[])},markdownTokenizer:{name:e,level:"inline",start(b){const v=u?new RegExp(`\\[${g}\\s*[^\\]]*\\]`):new RegExp(`\\[${g}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${g}\\]`),S=b.match(v),w=S==null?void 0:S.index;return w!==void 0?w:-1},tokenize(b,v,S){const w=u?new RegExp(`^\\[${g}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${g}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${g}\\]`),k=b.match(w);if(!k)return;let E="",N="";if(u){const[,V]=k;N=V}else{const[,V,I]=k;N=V,E=I||""}const L=s(N.trim());return{type:e,raw:k[0],content:E.trim(),attributes:L}}},renderMarkdown:b=>{let v="";i?v=i(b):b.content&&b.content.length>0&&(v=b.content.filter(E=>E.type==="text").map(E=>E.text).join(""));const S=p(b.attrs||{}),w=o(S),k=w?` ${w}`:"";return u?`[${h}${k}]`:`[${h}${k}]${v}[/${h}]`}}}function Wp(t,e,n){var i,s,o,a;const u=t.split(`
148
+ `),f=[];let h="",p=0;const g=e.baseIndentSize||2;for(;p<u.length;){const b=u[p],v=b.match(e.itemPattern);if(!v){if(f.length>0)break;if(b.trim()===""){p+=1,h=`${h}${b}
149
+ `;continue}else return}const S=e.extractItemData(v),{indentLevel:w,mainContent:k}=S;h=`${h}${b}
150
+ `;const E=[k];for(p+=1;p<u.length;){const I=u[p];if(I.trim()===""){const H=u.slice(p+1).findIndex(te=>te.trim()!=="");if(H===-1)break;if((((s=(i=u[p+1+H].match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>w){E.push(I),h=`${h}${I}
151
+ `,p+=1;continue}else break}if((((a=(o=I.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:a.length)||0)>w)E.push(I),h=`${h}${I}
152
+ `,p+=1;else break}let N;const L=E.slice(1);if(L.length>0){const I=L.map(C=>C.slice(w+g)).join(`
153
+ `);I.trim()&&(e.customNestedParser?N=e.customNestedParser(I):N=n.blockTokens(I))}const V=e.createToken(S,N);f.push(V)}if(f.length!==0)return{items:f,raw:h}}function Zm(t,e,n,i){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(i):n,[o,...a]=t.content,u=e.renderChildren([o]);let f=`${s}${u}`;return a&&a.length>0&&a.forEach((h,p)=>{var g,b;const v=(b=(g=e.renderChild)==null?void 0:g.call(e,h,p+1))!=null?b:e.renderChildren([h]);if(v!=null){const S=v.split(`
154
+ `).map(w=>w?e.indent(w):e.indent("")).join(`
155
+ `);f+=h.type==="paragraph"?`
156
+
157
+ ${S}`:`
158
+ ${S}`}}),f}function qD(t,e,n={}){const{state:i}=e,{doc:s,tr:o}=i,a=t;s.descendants((u,f)=>{const h=o.mapping.map(f),p=o.mapping.map(f)+u.nodeSize;let g=null;if(u.marks.forEach(v=>{if(v!==a)return!1;g=v}),!g)return;let b=!1;if(Object.keys(n).forEach(v=>{n[v]!==g.attrs[v]&&(b=!0)}),b){const v=t.type.create({...t.attrs,...n});o.removeMark(h,p,t.type),o.addMark(h,p,v)}}),o.docChanged&&e.view.dispatch(o)}var kt=class hk extends Wm{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new hk(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function hs(t){return new TD({find:t.find,handler:({state:e,range:n,match:i,pasteEvent:s})=>{const o=_e(t.getAttributes,void 0,i,s);if(o===!1||o===null)return null;const{tr:a}=e,u=i[i.length-1],f=i[0];let h=n.to;if(u){const p=f.search(/\S/),g=n.from+f.indexOf(u),b=g+u.length;if(Fm(n.from,n.to,e.doc).filter(w=>w.mark.type.excluded.find(E=>E===t.type&&E!==w.mark.type)).filter(w=>w.to>g).length)return null;b<n.to&&a.delete(b,n.to),g>n.from&&a.delete(n.from+p,g),h=n.from+p+u.length,a.addMark(n.from+p,h,t.type.create(o||{})),i.index!==void 0&&i.input!==void 0&&i.index+i[0].length>=i.input.length||a.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:PD,getOwnPropertySymbols:KD}=Object,{hasOwnProperty:GD}=Object.prototype;function up(t,e){return function(i,s,o){return t(i,s,o)&&e(i,s,o)}}function Lc(t){return function(n,i,s){if(!n||!i||typeof n!="object"||typeof i!="object")return t(n,i,s);const{cache:o}=s,a=o.get(n),u=o.get(i);if(a&&u)return a===i&&u===n;o.set(n,i),o.set(i,n);const f=t(n,i,s);return o.delete(n),o.delete(i),f}}function YD(t){return t!=null?t[Symbol.toStringTag]:void 0}function Z1(t){return PD(t).concat(KD(t))}const XD=Object.hasOwn||((t,e)=>GD.call(t,e));function vs(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const FD="__v",WD="__o",QD="_owner",{getOwnPropertyDescriptor:eS,keys:tS}=Object;function JD(t,e){return t.byteLength===e.byteLength&&hu(new Uint8Array(t),new Uint8Array(e))}function ZD(t,e,n){let i=t.length;if(e.length!==i)return!1;for(;i-- >0;)if(!n.equals(t[i],e[i],i,i,t,e,n))return!1;return!0}function e2(t,e){return t.byteLength===e.byteLength&&hu(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function t2(t,e){return vs(t.getTime(),e.getTime())}function n2(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function i2(t,e){return t===e}function nS(t,e,n){const i=t.size;if(i!==e.size)return!1;if(!i)return!0;const s=new Array(i),o=t.entries();let a,u,f=0;for(;(a=o.next())&&!a.done;){const h=e.entries();let p=!1,g=0;for(;(u=h.next())&&!u.done;){if(s[g]){g++;continue}const b=a.value,v=u.value;if(n.equals(b[0],v[0],f,g,t,e,n)&&n.equals(b[1],v[1],b[0],v[0],t,e,n)){p=s[g]=!0;break}g++}if(!p)return!1;f++}return!0}const r2=vs;function s2(t,e,n){const i=tS(t);let s=i.length;if(tS(e).length!==s)return!1;for(;s-- >0;)if(!pk(t,e,n,i[s]))return!1;return!0}function wo(t,e,n){const i=Z1(t);let s=i.length;if(Z1(e).length!==s)return!1;let o,a,u;for(;s-- >0;)if(o=i[s],!pk(t,e,n,o)||(a=eS(t,o),u=eS(e,o),(a||u)&&(!a||!u||a.configurable!==u.configurable||a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}function l2(t,e){return vs(t.valueOf(),e.valueOf())}function o2(t,e){return t.source===e.source&&t.flags===e.flags}function iS(t,e,n){const i=t.size;if(i!==e.size)return!1;if(!i)return!0;const s=new Array(i),o=t.values();let a,u;for(;(a=o.next())&&!a.done;){const f=e.values();let h=!1,p=0;for(;(u=f.next())&&!u.done;){if(!s[p]&&n.equals(a.value,u.value,a.value,u.value,t,e,n)){h=s[p]=!0;break}p++}if(!h)return!1}return!0}function hu(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function a2(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function pk(t,e,n,i){return(i===QD||i===WD||i===FD)&&(t.$$typeof||e.$$typeof)?!0:XD(e,i)&&n.equals(t[i],e[i],i,i,t,e,n)}const c2="[object ArrayBuffer]",u2="[object Arguments]",f2="[object Boolean]",d2="[object DataView]",h2="[object Date]",p2="[object Error]",m2="[object Map]",g2="[object Number]",y2="[object Object]",b2="[object RegExp]",v2="[object Set]",S2="[object String]",x2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},w2="[object URL]",k2=Object.prototype.toString;function T2({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:i,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:u,areObjectsEqual:f,arePrimitiveWrappersEqual:h,areRegExpsEqual:p,areSetsEqual:g,areTypedArraysEqual:b,areUrlsEqual:v,unknownTagComparators:S}){return function(k,E,N){if(k===E)return!0;if(k==null||E==null)return!1;const L=typeof k;if(L!==typeof E)return!1;if(L!=="object")return L==="number"?u(k,E,N):L==="function"?o(k,E,N):!1;const V=k.constructor;if(V!==E.constructor)return!1;if(V===Object)return f(k,E,N);if(Array.isArray(k))return e(k,E,N);if(V===Date)return i(k,E,N);if(V===RegExp)return p(k,E,N);if(V===Map)return a(k,E,N);if(V===Set)return g(k,E,N);const I=k2.call(k);if(I===h2)return i(k,E,N);if(I===b2)return p(k,E,N);if(I===m2)return a(k,E,N);if(I===v2)return g(k,E,N);if(I===y2)return typeof k.then!="function"&&typeof E.then!="function"&&f(k,E,N);if(I===w2)return v(k,E,N);if(I===p2)return s(k,E,N);if(I===u2)return f(k,E,N);if(x2[I])return b(k,E,N);if(I===c2)return t(k,E,N);if(I===d2)return n(k,E,N);if(I===f2||I===g2||I===S2)return h(k,E,N);if(S){let C=S[I];if(!C){const H=YD(k);H&&(C=S[H])}if(C)return C(k,E,N)}return!1}}function E2({circular:t,createCustomConfig:e,strict:n}){let i={areArrayBuffersEqual:JD,areArraysEqual:n?wo:ZD,areDataViewsEqual:e2,areDatesEqual:t2,areErrorsEqual:n2,areFunctionsEqual:i2,areMapsEqual:n?up(nS,wo):nS,areNumbersEqual:r2,areObjectsEqual:n?wo:s2,arePrimitiveWrappersEqual:l2,areRegExpsEqual:o2,areSetsEqual:n?up(iS,wo):iS,areTypedArraysEqual:n?up(hu,wo):hu,areUrlsEqual:a2,unknownTagComparators:void 0};if(e&&(i=Object.assign({},i,e(i))),t){const s=Lc(i.areArraysEqual),o=Lc(i.areMapsEqual),a=Lc(i.areObjectsEqual),u=Lc(i.areSetsEqual);i=Object.assign({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:u})}return i}function C2(t){return function(e,n,i,s,o,a,u){return t(e,n,u)}}function M2({circular:t,comparator:e,createState:n,equals:i,strict:s}){if(n)return function(u,f){const{cache:h=t?new WeakMap:void 0,meta:p}=n();return e(u,f,{cache:h,equals:i,meta:p,strict:s})};if(t)return function(u,f){return e(u,f,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};const o={cache:void 0,equals:i,meta:void 0,strict:s};return function(u,f){return e(u,f,o)}}const A2=Rr();Rr({strict:!0});Rr({circular:!0});Rr({circular:!0,strict:!0});Rr({createInternalComparator:()=>vs});Rr({strict:!0,createInternalComparator:()=>vs});Rr({circular:!0,createInternalComparator:()=>vs});Rr({circular:!0,createInternalComparator:()=>vs,strict:!0});function Rr(t={}){const{circular:e=!1,createInternalComparator:n,createState:i,strict:s=!1}=t,o=E2(t),a=T2(o),u=n?n(a):C2(a);return M2({circular:e,comparator:a,createState:i,equals:u,strict:s})}var fp={exports:{}},dp={};/**
159
+ * @license React
160
+ * use-sync-external-store-shim/with-selector.production.js
161
+ *
162
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
163
+ *
164
+ * This source code is licensed under the MIT license found in the
165
+ * LICENSE file in the root directory of this source tree.
166
+ */var rS;function O2(){if(rS)return dp;rS=1;var t=na(),e=rx();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var i=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,f=t.useDebugValue;return dp.useSyncExternalStoreWithSelector=function(h,p,g,b,v){var S=o(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=u(function(){function E(C){if(!N){if(N=!0,L=C,C=b(C),v!==void 0&&w.hasValue){var H=w.value;if(v(H,C))return V=H}return V=C}if(H=V,i(L,C))return H;var W=b(C);return v!==void 0&&v(H,W)?(L=C,H):(L=C,V=W)}var N=!1,L,V,I=g===void 0?null:g;return[function(){return E(p())},I===null?void 0:function(){return E(I())}]},[p,g,b,v]);var k=s(h,S[0],S[1]);return a(function(){w.hasValue=!0,w.value=k},[k]),f(k),k},dp}var sS;function N2(){return sS||(sS=1,fp.exports=O2()),fp.exports}var R2=N2(),D2=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},z2=({contentComponent:t})=>{const e=sx.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return j.jsx(j.Fragment,{children:Object.values(e)})};function L2(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,i){e={...e,[n]:HM.createPortal(i.reactElement,i.element,n)},t.forEach(s=>s())},removeRenderer(n){const i={...e};delete i[n],e=i,t.forEach(s=>s())}}}var _2=class extends Qe.Component{constructor(t){super(t),this.editorContentRef=Qe.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=L2(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return j.jsxs(j.Fragment,{children:[j.jsx("div",{ref:D2(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&j.jsx(z2,{contentComponent:t.contentComponent})]})}},B2=Ae.forwardRef((t,e)=>{const n=Qe.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Qe.createElement(_2,{key:n,innerRef:e,...t})}),mk=Qe.memo(B2),H2=typeof window<"u"?Ae.useLayoutEffect:Ae.useEffect,U2=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function j2(t){var e;const[n]=Ae.useState(()=>new U2(t.editor)),i=R2.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:A2);return H2(()=>n.watch(t.editor),[t.editor,n]),Ae.useDebugValue(i),i}var I2=!1,Qp=typeof window>"u",V2=Qp||!!(typeof window<"u"&&window.next),$2=class gk{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Qp||V2?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...i)=>{var s,o;return(o=(s=this.options.current).onBeforeCreate)==null?void 0:o.call(s,...i)},onBlur:(...i)=>{var s,o;return(o=(s=this.options.current).onBlur)==null?void 0:o.call(s,...i)},onCreate:(...i)=>{var s,o;return(o=(s=this.options.current).onCreate)==null?void 0:o.call(s,...i)},onDestroy:(...i)=>{var s,o;return(o=(s=this.options.current).onDestroy)==null?void 0:o.call(s,...i)},onFocus:(...i)=>{var s,o;return(o=(s=this.options.current).onFocus)==null?void 0:o.call(s,...i)},onSelectionUpdate:(...i)=>{var s,o;return(o=(s=this.options.current).onSelectionUpdate)==null?void 0:o.call(s,...i)},onTransaction:(...i)=>{var s,o;return(o=(s=this.options.current).onTransaction)==null?void 0:o.call(s,...i)},onUpdate:(...i)=>{var s,o;return(o=(s=this.options.current).onUpdate)==null?void 0:o.call(s,...i)},onContentError:(...i)=>{var s,o;return(o=(s=this.options.current).onContentError)==null?void 0:o.call(s,...i)},onDrop:(...i)=>{var s,o;return(o=(s=this.options.current).onDrop)==null?void 0:o.call(s,...i)},onPaste:(...i)=>{var s,o;return(o=(s=this.options.current).onPaste)==null?void 0:o.call(s,...i)},onDelete:(...i)=>{var s,o;return(o=(s=this.options.current).onDelete)==null?void 0:o.call(s,...i)}};return new zD(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(i=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(i)?!0:i==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,o)=>{var a;return s===((a=n.extensions)==null?void 0:a[o])}):e[i]===n[i])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?gk.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((i,s)=>i===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function q2(t={},e=[]){const n=Ae.useRef(t);n.current=t;const[i]=Ae.useState(()=>new $2(n)),s=sx.useSyncExternalStore(i.subscribe,i.getEditor,i.getServerSnapshot);return Ae.useDebugValue(s),Ae.useEffect(i.onRender(e)),j2({editor:s,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),s}var eg=Ae.createContext({editor:null});eg.Consumer;var yk=()=>Ae.useContext(eg),P2=Ae.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),K2=()=>Ae.useContext(P2);Qe.forwardRef((t,e)=>{const{onDragStart:n}=K2(),i=t.as||"div";return j.jsx(i,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Qe.createContext({markViewContentRef:()=>{}});var tg=Ae.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});tg.displayName="TiptapContext";var G2=()=>Ae.useContext(tg);function bk({editor:t,instance:e,children:n}){const i=t??e;if(!i)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=Ae.useMemo(()=>({editor:i}),[i]),o=Ae.useMemo(()=>({editor:i}),[i]);return j.jsx(eg.Provider,{value:o,children:j.jsx(tg.Provider,{value:s,children:n})})}bk.displayName="Tiptap";function vk({...t}){const{editor:e}=G2();return j.jsx(mk,{editor:e,...t})}vk.displayName="Tiptap.Content";Object.assign(bk,{Content:vk});const Sk=["top","right","bottom","left"],lS=["start","end"],oS=Sk.reduce((t,e)=>t.concat(e,e+"-"+lS[0],e+"-"+lS[1]),[]),ti=Math.min,It=Math.max,pu=Math.round,Jn=t=>({x:t,y:t}),Y2={left:"right",right:"left",bottom:"top",top:"bottom"};function Jp(t,e,n){return It(t,ti(e,n))}function _i(t,e){return typeof t=="function"?t(e):t}function Dn(t){return t.split("-")[0]}function Un(t){return t.split("-")[1]}function xk(t){return t==="x"?"y":"x"}function ng(t){return t==="y"?"height":"width"}function Qn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function ig(t){return xk(Qn(t))}function wk(t,e,n){n===void 0&&(n=!1);const i=Un(t),s=ig(t),o=ng(s);let a=s==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=gu(a)),[a,gu(a)]}function X2(t){const e=gu(t);return[mu(t),e,mu(e)]}function mu(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const aS=["left","right"],cS=["right","left"],F2=["top","bottom"],W2=["bottom","top"];function Q2(t,e,n){switch(t){case"top":case"bottom":return n?e?cS:aS:e?aS:cS;case"left":case"right":return e?F2:W2;default:return[]}}function J2(t,e,n,i){const s=Un(t);let o=Q2(Dn(t),n==="start",i);return s&&(o=o.map(a=>a+"-"+s),e&&(o=o.concat(o.map(mu)))),o}function gu(t){const e=Dn(t);return Y2[e]+t.slice(e.length)}function Z2(t){return{top:0,right:0,bottom:0,left:0,...t}}function rg(t){return typeof t!="number"?Z2(t):{top:t,right:t,bottom:t,left:t}}function xl(t){const{x:e,y:n,width:i,height:s}=t;return{width:i,height:s,top:n,left:e,right:e+i,bottom:n+s,x:e,y:n}}function uS(t,e,n){let{reference:i,floating:s}=t;const o=Qn(e),a=ig(e),u=ng(a),f=Dn(e),h=o==="y",p=i.x+i.width/2-s.width/2,g=i.y+i.height/2-s.height/2,b=i[u]/2-s[u]/2;let v;switch(f){case"top":v={x:p,y:i.y-s.height};break;case"bottom":v={x:p,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:g};break;case"left":v={x:i.x-s.width,y:g};break;default:v={x:i.x,y:i.y}}switch(Un(e)){case"start":v[a]-=b*(n&&h?-1:1);break;case"end":v[a]+=b*(n&&h?-1:1);break}return v}async function ez(t,e){var n;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:a,elements:u,strategy:f}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:b=!1,padding:v=0}=_i(e,t),S=rg(v),k=u[b?g==="floating"?"reference":"floating":g],E=xl(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(k)))==null||n?k:k.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:h,rootBoundary:p,strategy:f})),N=g==="floating"?{x:i,y:s,width:a.floating.width,height:a.floating.height}:a.reference,L=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),V=await(o.isElement==null?void 0:o.isElement(L))?await(o.getScale==null?void 0:o.getScale(L))||{x:1,y:1}:{x:1,y:1},I=xl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:N,offsetParent:L,strategy:f}):N);return{top:(E.top-I.top+S.top)/V.y,bottom:(I.bottom-E.bottom+S.bottom)/V.y,left:(E.left-I.left+S.left)/V.x,right:(I.right-E.right+S.right)/V.x}}const tz=50,nz=async(t,e,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:ez},f=await(a.isRTL==null?void 0:a.isRTL(e));let h=await a.getElementRects({reference:t,floating:e,strategy:s}),{x:p,y:g}=uS(h,i,f),b=i,v=0;const S={};for(let w=0;w<o.length;w++){const k=o[w];if(!k)continue;const{name:E,fn:N}=k,{x:L,y:V,data:I,reset:C}=await N({x:p,y:g,initialPlacement:i,placement:b,strategy:s,middlewareData:S,rects:h,platform:u,elements:{reference:t,floating:e}});p=L??p,g=V??g,S[E]={...S[E],...I},C&&v<tz&&(v++,typeof C=="object"&&(C.placement&&(b=C.placement),C.rects&&(h=C.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:s}):C.rects),{x:p,y:g}=uS(h,b,f)),w=-1)}return{x:p,y:g,placement:b,strategy:s,middlewareData:S}},iz=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:s,rects:o,platform:a,elements:u,middlewareData:f}=e,{element:h,padding:p=0}=_i(t,e)||{};if(h==null)return{};const g=rg(p),b={x:n,y:i},v=ig(s),S=ng(v),w=await a.getDimensions(h),k=v==="y",E=k?"top":"left",N=k?"bottom":"right",L=k?"clientHeight":"clientWidth",V=o.reference[S]+o.reference[v]-b[v]-o.floating[S],I=b[v]-o.reference[v],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(h));let H=C?C[L]:0;(!H||!await(a.isElement==null?void 0:a.isElement(C)))&&(H=u.floating[L]||o.floating[S]);const W=V/2-I/2,ie=H/2-w[S]/2-1,te=ti(g[E],ie),ve=ti(g[N],ie),pe=te,xe=H-w[S]-ve,de=H/2-w[S]/2+W,se=Jp(pe,de,xe),B=!f.arrow&&Un(s)!=null&&de!==se&&o.reference[S]/2-(de<pe?te:ve)-w[S]/2<0,Y=B?de<pe?de-pe:de-xe:0;return{[v]:b[v]+Y,data:{[v]:se,centerOffset:de-se-Y,...B&&{alignmentOffset:Y}},reset:B}}});function rz(t,e,n){return(t?[...n.filter(s=>Un(s)===t),...n.filter(s=>Un(s)!==t)]:n.filter(s=>Dn(s)===s)).filter(s=>t?Un(s)===t||(e?mu(s)!==s:!1):!0)}const sz=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,i,s;const{rects:o,middlewareData:a,placement:u,platform:f,elements:h}=e,{crossAxis:p=!1,alignment:g,allowedPlacements:b=oS,autoAlignment:v=!0,...S}=_i(t,e),w=g!==void 0||b===oS?rz(g||null,v,b):b,k=await f.detectOverflow(e,S),E=((n=a.autoPlacement)==null?void 0:n.index)||0,N=w[E];if(N==null)return{};const L=wk(N,o,await(f.isRTL==null?void 0:f.isRTL(h.floating)));if(u!==N)return{reset:{placement:w[0]}};const V=[k[Dn(N)],k[L[0]],k[L[1]]],I=[...((i=a.autoPlacement)==null?void 0:i.overflows)||[],{placement:N,overflows:V}],C=w[E+1];if(C)return{data:{index:E+1,overflows:I},reset:{placement:C}};const H=I.map(te=>{const ve=Un(te.placement);return[te.placement,ve&&p?te.overflows.slice(0,2).reduce((pe,xe)=>pe+xe,0):te.overflows[0],te.overflows]}).sort((te,ve)=>te[1]-ve[1]),ie=((s=H.filter(te=>te[2].slice(0,Un(te[0])?2:3).every(ve=>ve<=0))[0])==null?void 0:s[0])||H[0][0];return ie!==u?{data:{index:E+1,overflows:I},reset:{placement:ie}}:{}}}},lz=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:s,middlewareData:o,rects:a,initialPlacement:u,platform:f,elements:h}=e,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...k}=_i(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const E=Dn(s),N=Qn(u),L=Dn(u)===u,V=await(f.isRTL==null?void 0:f.isRTL(h.floating)),I=b||(L||!w?[gu(u)]:X2(u)),C=S!=="none";!b&&C&&I.push(...J2(u,w,S,V));const H=[u,...I],W=await f.detectOverflow(e,k),ie=[];let te=((i=o.flip)==null?void 0:i.overflows)||[];if(p&&ie.push(W[E]),g){const de=wk(s,a,V);ie.push(W[de[0]],W[de[1]])}if(te=[...te,{placement:s,overflows:ie}],!ie.every(de=>de<=0)){var ve,pe;const de=(((ve=o.flip)==null?void 0:ve.index)||0)+1,se=H[de];if(se&&(!(g==="alignment"?N!==Qn(se):!1)||te.every(Z=>Qn(Z.placement)===N?Z.overflows[0]>0:!0)))return{data:{index:de,overflows:te},reset:{placement:se}};let B=(pe=te.filter(Y=>Y.overflows[0]<=0).sort((Y,Z)=>Y.overflows[1]-Z.overflows[1])[0])==null?void 0:pe.placement;if(!B)switch(v){case"bestFit":{var xe;const Y=(xe=te.filter(Z=>{if(C){const ye=Qn(Z.placement);return ye===N||ye==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(ye=>ye>0).reduce((ye,Oe)=>ye+Oe,0)]).sort((Z,ye)=>Z[1]-ye[1])[0])==null?void 0:xe[0];Y&&(B=Y);break}case"initialPlacement":B=u;break}if(s!==B)return{reset:{placement:B}}}return{}}}};function fS(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function dS(t){return Sk.some(e=>t[e]>=0)}const oz=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:s="referenceHidden",...o}=_i(t,e);switch(s){case"referenceHidden":{const a=await i.detectOverflow(e,{...o,elementContext:"reference"}),u=fS(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:dS(u)}}}case"escaped":{const a=await i.detectOverflow(e,{...o,altBoundary:!0}),u=fS(a,n.floating);return{data:{escapedOffsets:u,escaped:dS(u)}}}default:return{}}}}};function kk(t){const e=ti(...t.map(o=>o.left)),n=ti(...t.map(o=>o.top)),i=It(...t.map(o=>o.right)),s=It(...t.map(o=>o.bottom));return{x:e,y:n,width:i-e,height:s-n}}function az(t){const e=t.slice().sort((s,o)=>s.y-o.y),n=[];let i=null;for(let s=0;s<e.length;s++){const o=e[s];!i||o.y-i.y>i.height/2?n.push([o]):n[n.length-1].push(o),i=o}return n.map(s=>xl(kk(s)))}const cz=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:i,rects:s,platform:o,strategy:a}=e,{padding:u=2,x:f,y:h}=_i(t,e),p=Array.from(await(o.getClientRects==null?void 0:o.getClientRects(i.reference))||[]),g=az(p),b=xl(kk(p)),v=rg(u);function S(){if(g.length===2&&g[0].left>g[1].right&&f!=null&&h!=null)return g.find(k=>f>k.left-v.left&&f<k.right+v.right&&h>k.top-v.top&&h<k.bottom+v.bottom)||b;if(g.length>=2){if(Qn(n)==="y"){const te=g[0],ve=g[g.length-1],pe=Dn(n)==="top",xe=te.top,de=ve.bottom,se=pe?te.left:ve.left,B=pe?te.right:ve.right,Y=B-se,Z=de-xe;return{top:xe,bottom:de,left:se,right:B,width:Y,height:Z,x:se,y:xe}}const k=Dn(n)==="left",E=It(...g.map(te=>te.right)),N=ti(...g.map(te=>te.left)),L=g.filter(te=>k?te.left===N:te.right===E),V=L[0].top,I=L[L.length-1].bottom,C=N,H=E,W=H-C,ie=I-V;return{top:V,bottom:I,left:C,right:H,width:W,height:ie,x:C,y:V}}return b}const w=await o.getElementRects({reference:{getBoundingClientRect:S},floating:i.floating,strategy:a});return s.reference.x!==w.reference.x||s.reference.y!==w.reference.y||s.reference.width!==w.reference.width||s.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},uz=new Set(["left","top"]);async function fz(t,e){const{placement:n,platform:i,elements:s}=t,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),a=Dn(n),u=Un(n),f=Qn(n)==="y",h=uz.has(a)?-1:1,p=o&&f?-1:1,g=_i(e,t);let{mainAxis:b,crossAxis:v,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(v=u==="end"?S*-1:S),f?{x:v*p,y:b*h}:{x:b*h,y:v*p}}const dz=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:s,y:o,placement:a,middlewareData:u}=e,f=await fz(e,t);return a===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:s+f.x,y:o+f.y,data:{...f,placement:a}}}}},hz=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:s,platform:o}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:f={fn:E=>{let{x:N,y:L}=E;return{x:N,y:L}}},...h}=_i(t,e),p={x:n,y:i},g=await o.detectOverflow(e,h),b=Qn(Dn(s)),v=xk(b);let S=p[v],w=p[b];if(a){const E=v==="y"?"top":"left",N=v==="y"?"bottom":"right",L=S+g[E],V=S-g[N];S=Jp(L,S,V)}if(u){const E=b==="y"?"top":"left",N=b==="y"?"bottom":"right",L=w+g[E],V=w-g[N];w=Jp(L,w,V)}const k=f.fn({...e,[v]:S,[b]:w});return{...k,data:{x:k.x-n,y:k.y-i,enabled:{[v]:a,[b]:u}}}}}},pz=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:s,rects:o,platform:a,elements:u}=e,{apply:f=()=>{},...h}=_i(t,e),p=await a.detectOverflow(e,h),g=Dn(s),b=Un(s),v=Qn(s)==="y",{width:S,height:w}=o.floating;let k,E;g==="top"||g==="bottom"?(k=g,E=b===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(E=g,k=b==="end"?"top":"bottom");const N=w-p.top-p.bottom,L=S-p.left-p.right,V=ti(w-p[k],N),I=ti(S-p[E],L),C=!e.middlewareData.shift;let H=V,W=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(W=L),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(H=N),C&&!b){const te=It(p.left,0),ve=It(p.right,0),pe=It(p.top,0),xe=It(p.bottom,0);v?W=S-2*(te!==0||ve!==0?te+ve:It(p.left,p.right)):H=w-2*(pe!==0||xe!==0?pe+xe:It(p.top,p.bottom))}await f({...e,availableWidth:W,availableHeight:H});const ie=await a.getDimensions(u.floating);return S!==ie.width||w!==ie.height?{reset:{rects:!0}}:{}}}};function hf(){return typeof window<"u"}function Tl(t){return Tk(t)?(t.nodeName||"").toLowerCase():"#document"}function pn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Bi(t){var e;return(e=(Tk(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Tk(t){return hf()?t instanceof Node||t instanceof pn(t).Node:!1}function jn(t){return hf()?t instanceof Element||t instanceof pn(t).Element:!1}function Hi(t){return hf()?t instanceof HTMLElement||t instanceof pn(t).HTMLElement:!1}function hS(t){return!hf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pn(t).ShadowRoot}function la(t){const{overflow:e,overflowX:n,overflowY:i,display:s}=In(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&s!=="inline"&&s!=="contents"}function mz(t){return/^(table|td|th)$/.test(Tl(t))}function pf(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const gz=/transform|translate|scale|rotate|perspective|filter/,yz=/paint|layout|strict|content/,Qr=t=>!!t&&t!=="none";let hp;function sg(t){const e=jn(t)?In(t):t;return Qr(e.transform)||Qr(e.translate)||Qr(e.scale)||Qr(e.rotate)||Qr(e.perspective)||!lg()&&(Qr(e.backdropFilter)||Qr(e.filter))||gz.test(e.willChange||"")||yz.test(e.contain||"")}function bz(t){let e=Ar(t);for(;Hi(e)&&!wl(e);){if(sg(e))return e;if(pf(e))return null;e=Ar(e)}return null}function lg(){return hp==null&&(hp=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hp}function wl(t){return/^(html|body|#document)$/.test(Tl(t))}function In(t){return pn(t).getComputedStyle(t)}function mf(t){return jn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ar(t){if(Tl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||hS(t)&&t.host||Bi(t);return hS(e)?e.host:e}function Ek(t){const e=Ar(t);return wl(e)?t.ownerDocument?t.ownerDocument.body:t.body:Hi(e)&&la(e)?e:Ek(e)}function Ck(t,e,n){var i;e===void 0&&(e=[]);const s=Ek(t),o=s===((i=t.ownerDocument)==null?void 0:i.body),a=pn(s);return o?(Zp(a),e.concat(a,a.visualViewport||[],la(s)?s:[],[])):e.concat(s,Ck(s,[]))}function Zp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Mk(t){const e=In(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Hi(t),o=s?t.offsetWidth:n,a=s?t.offsetHeight:i,u=pu(n)!==o||pu(i)!==a;return u&&(n=o,i=a),{width:n,height:i,$:u}}function Ak(t){return jn(t)?t:t.contextElement}function hl(t){const e=Ak(t);if(!Hi(e))return Jn(1);const n=e.getBoundingClientRect(),{width:i,height:s,$:o}=Mk(e);let a=(o?pu(n.width):n.width)/i,u=(o?pu(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const vz=Jn(0);function Ok(t){const e=pn(t);return!lg()||!e.visualViewport?vz:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Sz(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==pn(t)?!1:e}function Jo(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),o=Ak(t);let a=Jn(1);e&&(i?jn(i)&&(a=hl(i)):a=hl(t));const u=Sz(o,n,i)?Ok(o):Jn(0);let f=(s.left+u.x)/a.x,h=(s.top+u.y)/a.y,p=s.width/a.x,g=s.height/a.y;if(o){const b=pn(o),v=i&&jn(i)?pn(i):i;let S=b,w=Zp(S);for(;w&&i&&v!==S;){const k=hl(w),E=w.getBoundingClientRect(),N=In(w),L=E.left+(w.clientLeft+parseFloat(N.paddingLeft))*k.x,V=E.top+(w.clientTop+parseFloat(N.paddingTop))*k.y;f*=k.x,h*=k.y,p*=k.x,g*=k.y,f+=L,h+=V,S=pn(w),w=Zp(S)}}return xl({width:p,height:g,x:f,y:h})}function gf(t,e){const n=mf(t).scrollLeft;return e?e.left+n:Jo(Bi(t)).left+n}function Nk(t,e){const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-gf(t,n),s=n.top+e.scrollTop;return{x:i,y:s}}function xz(t){let{elements:e,rect:n,offsetParent:i,strategy:s}=t;const o=s==="fixed",a=Bi(i),u=e?pf(e.floating):!1;if(i===a||u&&o)return n;let f={scrollLeft:0,scrollTop:0},h=Jn(1);const p=Jn(0),g=Hi(i);if((g||!g&&!o)&&((Tl(i)!=="body"||la(a))&&(f=mf(i)),g)){const v=Jo(i);h=hl(i),p.x=v.x+i.clientLeft,p.y=v.y+i.clientTop}const b=a&&!g&&!o?Nk(a,f):Jn(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+p.x+b.x,y:n.y*h.y-f.scrollTop*h.y+p.y+b.y}}function wz(t){return Array.from(t.getClientRects())}function kz(t){const e=Bi(t),n=mf(t),i=t.ownerDocument.body,s=It(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=It(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let a=-n.scrollLeft+gf(t);const u=-n.scrollTop;return In(i).direction==="rtl"&&(a+=It(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:a,y:u}}const pS=25;function Tz(t,e){const n=pn(t),i=Bi(t),s=n.visualViewport;let o=i.clientWidth,a=i.clientHeight,u=0,f=0;if(s){o=s.width,a=s.height;const p=lg();(!p||p&&e==="fixed")&&(u=s.offsetLeft,f=s.offsetTop)}const h=gf(i);if(h<=0){const p=i.ownerDocument,g=p.body,b=getComputedStyle(g),v=p.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,S=Math.abs(i.clientWidth-g.clientWidth-v);S<=pS&&(o-=S)}else h<=pS&&(o+=h);return{width:o,height:a,x:u,y:f}}function Ez(t,e){const n=Jo(t,!0,e==="fixed"),i=n.top+t.clientTop,s=n.left+t.clientLeft,o=Hi(t)?hl(t):Jn(1),a=t.clientWidth*o.x,u=t.clientHeight*o.y,f=s*o.x,h=i*o.y;return{width:a,height:u,x:f,y:h}}function mS(t,e,n){let i;if(e==="viewport")i=Tz(t,n);else if(e==="document")i=kz(Bi(t));else if(jn(e))i=Ez(e,n);else{const s=Ok(t);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return xl(i)}function Rk(t,e){const n=Ar(t);return n===e||!jn(n)||wl(n)?!1:In(n).position==="fixed"||Rk(n,e)}function Cz(t,e){const n=e.get(t);if(n)return n;let i=Ck(t,[]).filter(u=>jn(u)&&Tl(u)!=="body"),s=null;const o=In(t).position==="fixed";let a=o?Ar(t):t;for(;jn(a)&&!wl(a);){const u=In(a),f=sg(a);!f&&u.position==="fixed"&&(s=null),(o?!f&&!s:!f&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||la(a)&&!f&&Rk(t,a))?i=i.filter(p=>p!==a):s=u,a=Ar(a)}return e.set(t,i),i}function Mz(t){let{element:e,boundary:n,rootBoundary:i,strategy:s}=t;const a=[...n==="clippingAncestors"?pf(e)?[]:Cz(e,this._c):[].concat(n),i],u=mS(e,a[0],s);let f=u.top,h=u.right,p=u.bottom,g=u.left;for(let b=1;b<a.length;b++){const v=mS(e,a[b],s);f=It(v.top,f),h=ti(v.right,h),p=ti(v.bottom,p),g=It(v.left,g)}return{width:h-g,height:p-f,x:g,y:f}}function Az(t){const{width:e,height:n}=Mk(t);return{width:e,height:n}}function Oz(t,e,n){const i=Hi(e),s=Bi(e),o=n==="fixed",a=Jo(t,!0,o,e);let u={scrollLeft:0,scrollTop:0};const f=Jn(0);function h(){f.x=gf(s)}if(i||!i&&!o)if((Tl(e)!=="body"||la(s))&&(u=mf(e)),i){const v=Jo(e,!0,o,e);f.x=v.x+e.clientLeft,f.y=v.y+e.clientTop}else s&&h();o&&!i&&s&&h();const p=s&&!i&&!o?Nk(s,u):Jn(0),g=a.left+u.scrollLeft-f.x-p.x,b=a.top+u.scrollTop-f.y-p.y;return{x:g,y:b,width:a.width,height:a.height}}function pp(t){return In(t).position==="static"}function gS(t,e){if(!Hi(t)||In(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Bi(t)===n&&(n=n.ownerDocument.body),n}function Dk(t,e){const n=pn(t);if(pf(t))return n;if(!Hi(t)){let s=Ar(t);for(;s&&!wl(s);){if(jn(s)&&!pp(s))return s;s=Ar(s)}return n}let i=gS(t,e);for(;i&&mz(i)&&pp(i);)i=gS(i,e);return i&&wl(i)&&pp(i)&&!sg(i)?n:i||bz(t)||n}const Nz=async function(t){const e=this.getOffsetParent||Dk,n=this.getDimensions,i=await n(t.floating);return{reference:Oz(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Rz(t){return In(t).direction==="rtl"}const Dz={convertOffsetParentRelativeRectToViewportRelativeRect:xz,getDocumentElement:Bi,getClippingRect:Mz,getOffsetParent:Dk,getElementRects:Nz,getClientRects:wz,getDimensions:Az,getScale:hl,isElement:jn,isRTL:Rz},zk=dz,Lk=sz,_k=hz,Bk=lz,Hk=pz,Uk=oz,jk=iz,Ik=cz,Vk=(t,e,n)=>{const i=new Map,s={platform:Dz,...n},o={...s.platform,_c:i};return nz(t,e,{...s,platform:o})};let em,tm;if(typeof WeakMap<"u"){let t=new WeakMap;em=e=>t.get(e),tm=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;em=i=>{for(let s=0;s<t.length;s+=2)if(t[s]==i)return t[s+1]},tm=(i,s)=>(n==10&&(n=0),t[n++]=i,t[n++]=s)}var ot=class{constructor(t,e,n,i){this.width=t,this.height=e,this.map=n,this.problems=i}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const i=e%this.width,s=e/this.width|0;let o=i+1,a=s+1;for(let u=1;o<this.width&&this.map[e+u]==n;u++)o++;for(let u=1;a<this.height&&this.map[e+this.width*u]==n;u++)a++;return{left:i,top:s,right:o,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:i,right:s,top:o,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?i==0:s==this.width)?null:this.map[o*this.width+(n<0?i-1:s)]:(n<0?o==0:a==this.height)?null:this.map[i+this.width*(n<0?o-1:a)]}rectBetween(t,e){const{left:n,right:i,top:s,bottom:o}=this.findCell(t),{left:a,right:u,top:f,bottom:h}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(s,f),right:Math.max(i,u),bottom:Math.max(o,h)}}cellsInRect(t){const e=[],n={};for(let i=t.top;i<t.bottom;i++)for(let s=t.left;s<t.right;s++){const o=i*this.width+s,a=this.map[o];n[a]||(n[a]=!0,!(s==t.left&&s&&this.map[o-1]==a||i==t.top&&i&&this.map[o-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let i=0,s=0;;i++){const o=s+n.child(i).nodeSize;if(i==t){let a=e+t*this.width;const u=(t+1)*this.width;for(;a<u&&this.map[a]<s;)a++;return a==u?o-1:this.map[a]}s=o}}static get(t){return em(t)||tm(t,zz(t))}};function zz(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Lz(t),n=t.childCount,i=[];let s=0,o=null;const a=[];for(let h=0,p=e*n;h<p;h++)i[h]=0;for(let h=0,p=0;h<n;h++){const g=t.child(h);p++;for(let S=0;;S++){for(;s<i.length&&i[s]!=0;)s++;if(S==g.childCount)break;const w=g.child(S),{colspan:k,rowspan:E,colwidth:N}=w.attrs;for(let L=0;L<E;L++){if(L+h>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:p,n:E-L});break}const V=s+L*e;for(let I=0;I<k;I++){i[V+I]==0?i[V+I]=p:(o||(o=[])).push({type:"collision",row:h,pos:p,n:k-I});const C=N&&N[I];if(C){const H=(V+I)%e*2,W=a[H];W==null||W!=C&&a[H+1]==1?(a[H]=C,a[H+1]=1):W==C&&a[H+1]++}}}s+=k,p+=w.nodeSize}const b=(h+1)*e;let v=0;for(;s<b;)i[s++]==0&&v++;v&&(o||(o=[])).push({type:"missing",row:h,n:v}),p++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const u=new ot(e,n,i,o);let f=!1;for(let h=0;!f&&h<a.length;h+=2)a[h]!=null&&a[h+1]<n&&(f=!0);return f&&_z(u,a,t),u}function Lz(t){let e=-1,n=!1;for(let i=0;i<t.childCount;i++){const s=t.child(i);let o=0;if(n)for(let a=0;a<i;a++){const u=t.child(a);for(let f=0;f<u.childCount;f++){const h=u.child(f);a+h.attrs.rowspan>i&&(o+=h.attrs.colspan)}}for(let a=0;a<s.childCount;a++){const u=s.child(a);o+=u.attrs.colspan,u.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function _z(t,e,n){t.problems||(t.problems=[]);const i={};for(let s=0;s<t.map.length;s++){const o=t.map[s];if(i[o])continue;i[o]=!0;const a=n.nodeAt(o);if(!a)throw new RangeError(`No cell with offset ${o} found`);let u=null;const f=a.attrs;for(let h=0;h<f.colspan;h++){const p=e[(s+h)%t.width*2];p!=null&&(!f.colwidth||f.colwidth[h]!=p)&&((u||(u=Bz(f)))[h]=p)}u&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:u})}}function Bz(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Bt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const i=t.nodes[n],s=i.spec.tableRole;s&&(e[s]=i)}}return e}const gr=new et("selectingCells");function ps(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Hz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Vn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function yf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=ps(e.$head)||Uz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Uz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function nm(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function jz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function og(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function $k(t,e,n){const i=t.node(-1),s=ot.get(i),o=t.start(-1),a=s.nextCell(t.pos-o,e,n);return a==null?null:t.node(0).resolve(o+a)}function ms(t,e,n=1){const i={...t,colspan:t.colspan-n};return i.colwidth&&(i.colwidth=i.colwidth.slice(),i.colwidth.splice(e,n),i.colwidth.some(s=>s>0)||(i.colwidth=null)),i}function qk(t,e,n=1){const i={...t,colspan:t.colspan+n};if(i.colwidth){i.colwidth=i.colwidth.slice();for(let s=0;s<n;s++)i.colwidth.splice(e,0,0)}return i}function Iz(t,e,n){const i=Bt(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=i)return!1;return!0}var Ge=class Ei extends he{constructor(e,n=e){const i=e.node(-1),s=ot.get(i),o=e.start(-1),a=s.rectBetween(e.pos-o,n.pos-o),u=e.node(0),f=s.cellsInRect(a).filter(p=>p!=n.pos-o);f.unshift(n.pos-o);const h=f.map(p=>{const g=i.nodeAt(p);if(!g)throw new RangeError(`No cell with offset ${p} found`);const b=o+p+1;return new Hx(u.resolve(b),u.resolve(b+g.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const i=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(nm(i)&&nm(s)&&og(i,s)){const o=this.$anchorCell.node(-1)!=i.node(-1);return o&&this.isRowSelection()?Ei.rowSelection(i,s):o&&this.isColSelection()?Ei.colSelection(i,s):new Ei(i,s)}return ce.between(i,s)}content(){const e=this.$anchorCell.node(-1),n=ot.get(e),i=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i),o={},a=[];for(let f=s.top;f<s.bottom;f++){const h=[];for(let p=f*n.width+s.left,g=s.left;g<s.right;g++,p++){const b=n.map[p];if(o[b])continue;o[b]=!0;const v=n.findCell(b);let S=e.nodeAt(b);if(!S)throw new RangeError(`No cell with offset ${b} found`);const w=s.left-v.left,k=v.right-s.right;if(w>0||k>0){let E=S.attrs;if(w>0&&(E=ms(E,0,w)),k>0&&(E=ms(E,E.colspan-k,k)),v.left<s.left){if(S=S.type.createAndFill(E),!S)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else S=S.type.create(E,S.content)}if(v.top<s.top||v.bottom>s.bottom){const E={...S.attrs,rowspan:Math.min(v.bottom,s.bottom)-Math.max(v.top,s.top)};v.top<s.top?S=S.type.createAndFill(E):S=S.type.create(E,S.content)}h.push(S)}a.push(e.child(f).copy(G.from(h)))}const u=this.isColSelection()&&this.isRowSelection()?e:a;return new F(G.from(u),1,1)}replace(e,n=F.empty){const i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){const{$from:u,$to:f}=s[a],h=e.mapping.slice(i);e.replace(h.map(u.pos),h.map(f.pos),a?F.empty:n)}const o=he.findFrom(e.doc.resolve(e.mapping.slice(i).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new F(G.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),i=ot.get(n),s=this.$anchorCell.start(-1),o=i.cellsInRect(i.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let a=0;a<o.length;a++)e(n.nodeAt(o[a]),s+o[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const i=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(i,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const i=e.node(-1),s=ot.get(i),o=e.start(-1),a=s.findCell(e.pos-o),u=s.findCell(n.pos-o),f=e.node(0);return a.top<=u.top?(a.top>0&&(e=f.resolve(o+s.map[a.left])),u.bottom<s.height&&(n=f.resolve(o+s.map[s.width*(s.height-1)+u.right-1]))):(u.top>0&&(n=f.resolve(o+s.map[u.left])),a.bottom<s.height&&(e=f.resolve(o+s.map[s.width*(s.height-1)+a.right-1]))),new Ei(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=ot.get(e),i=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-i),o=n.colCount(this.$headCell.pos-i);if(Math.min(s,o)>0)return!1;const a=s+this.$anchorCell.nodeAfter.attrs.colspan,u=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,u)==n.width}eq(e){return e instanceof Ei&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const i=e.node(-1),s=ot.get(i),o=e.start(-1),a=s.findCell(e.pos-o),u=s.findCell(n.pos-o),f=e.node(0);return a.left<=u.left?(a.left>0&&(e=f.resolve(o+s.map[a.top*s.width])),u.right<s.width&&(n=f.resolve(o+s.map[s.width*(u.top+1)-1]))):(u.left>0&&(n=f.resolve(o+s.map[u.top*s.width])),a.right<s.width&&(e=f.resolve(o+s.map[s.width*(a.top+1)-1]))),new Ei(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Ei(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,i=n){return new Ei(e.resolve(n),e.resolve(i))}getBookmark(){return new Vz(this.$anchorCell.pos,this.$headCell.pos)}};Ge.prototype.visible=!1;he.jsonID("cell",Ge);var Vz=class Pk{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Pk(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),i=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&i.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&i.index()<i.parent.childCount&&og(n,i)?new Ge(n,i):he.near(i,1)}};function $z(t){if(!(t.selection instanceof Ge))return null;const e=[];return t.selection.forEachCell((n,i)=>{e.push(St.node(i,i+n.nodeSize,{class:"selectedCell"}))}),Xe.create(t.doc,e)}function qz({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,i=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,i--);return n==i&&/row|table/.test(t.node(s).type.spec.tableRole)}function Pz({$from:t,$to:e}){let n,i;for(let s=t.depth;s>0;s--){const o=t.node(s);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let s=e.depth;s>0;s--){const o=e.node(s);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){i=o;break}}return n!==i&&e.parentOffset===0}function Kz(t,e,n){const i=(e||t).selection,s=(e||t).doc;let o,a;if(i instanceof oe&&(a=i.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")o=Ge.create(s,i.from);else if(a=="row"){const u=s.resolve(i.from+1);o=Ge.rowSelection(u,u)}else if(!n){const u=ot.get(i.node),f=i.from+1,h=f+u.map[u.width*u.height-1];o=Ge.create(s,f+1,h)}}else i instanceof ce&&qz(i)?o=ce.create(s,i.from):i instanceof ce&&Pz(i)&&(o=ce.create(s,i.$from.start(),i.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}const Gz=new et("fix-tables");function Kk(t,e,n,i){const s=t.childCount,o=e.childCount;e:for(let a=0,u=0;a<o;a++){const f=e.child(a);for(let h=u,p=Math.min(s,a+3);h<p;h++)if(t.child(h)==f){u=h+1,n+=f.nodeSize;continue e}i(f,n),u<s&&t.child(u).sameMarkup(f)?Kk(t.child(u),f,n+1,i):f.nodesBetween(0,f.content.size,i,n+1),n+=f.nodeSize}}function Gk(t,e){let n;const i=(s,o)=>{s.type.spec.tableRole=="table"&&(n=Yz(t,s,o,n))};return e?e.doc!=t.doc&&Kk(e.doc,t.doc,0,i):t.doc.descendants(i),n}function Yz(t,e,n,i){const s=ot.get(e);if(!s.problems)return i;i||(i=t.tr);const o=[];for(let f=0;f<s.height;f++)o.push(0);for(let f=0;f<s.problems.length;f++){const h=s.problems[f];if(h.type=="collision"){const p=e.nodeAt(h.pos);if(!p)continue;const g=p.attrs;for(let b=0;b<g.rowspan;b++)o[h.row+b]+=h.n;i.setNodeMarkup(i.mapping.map(n+1+h.pos),null,ms(g,g.colspan-h.n,h.n))}else if(h.type=="missing")o[h.row]+=h.n;else if(h.type=="overlong_rowspan"){const p=e.nodeAt(h.pos);if(!p)continue;i.setNodeMarkup(i.mapping.map(n+1+h.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-h.n})}else if(h.type=="colwidth mismatch"){const p=e.nodeAt(h.pos);if(!p)continue;i.setNodeMarkup(i.mapping.map(n+1+h.pos),null,{...p.attrs,colwidth:h.colwidth})}else if(h.type=="zero_sized"){const p=i.mapping.map(n);i.delete(p,p+e.nodeSize)}}let a,u;for(let f=0;f<o.length;f++)o[f]&&(a==null&&(a=f),u=f);for(let f=0,h=n+1;f<s.height;f++){const p=e.child(f),g=h+p.nodeSize,b=o[f];if(b>0){let v="cell";p.firstChild&&(v=p.firstChild.type.spec.tableRole);const S=[];for(let k=0;k<b;k++){const E=Bt(t.schema)[v].createAndFill();E&&S.push(E)}const w=(f==0||a==f-1)&&u==f?h+1:g-1;i.insert(i.mapping.map(w),S)}h=g}return i.setMeta(Gz,{fixTables:!0})}function ni(t){const e=t.selection,n=yf(t),i=n.node(-1),s=n.start(-1),o=ot.get(i);return{...e instanceof Ge?o.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):o.findCell(n.pos-s),tableStart:s,map:o,table:i}}function Yk(t,{map:e,tableStart:n,table:i},s){let o=s>0?-1:0;Iz(e,i,s+o)&&(o=s==0||s==e.width?null:0);for(let a=0;a<e.height;a++){const u=a*e.width+s;if(s>0&&s<e.width&&e.map[u-1]==e.map[u]){const f=e.map[u],h=i.nodeAt(f);t.setNodeMarkup(t.mapping.map(n+f),null,qk(h.attrs,s-e.colCount(f))),a+=h.attrs.rowspan-1}else{const f=o==null?Bt(i.type.schema).cell:i.nodeAt(e.map[u+o]).type,h=e.positionAt(a,s,i);t.insert(t.mapping.map(n+h),f.createAndFill())}}return t}function Xz(t,e){if(!Vn(t))return!1;if(e){const n=ni(t);e(Yk(t.tr,n,n.left))}return!0}function Fz(t,e){if(!Vn(t))return!1;if(e){const n=ni(t);e(Yk(t.tr,n,n.right))}return!0}function Wz(t,{map:e,table:n,tableStart:i},s){const o=t.mapping.maps.length;for(let a=0;a<e.height;){const u=a*e.width+s,f=e.map[u],h=n.nodeAt(f),p=h.attrs;if(s>0&&e.map[u-1]==f||s<e.width-1&&e.map[u+1]==f)t.setNodeMarkup(t.mapping.slice(o).map(i+f),null,ms(p,s-e.colCount(f)));else{const g=t.mapping.slice(o).map(i+f);t.delete(g,g+h.nodeSize)}a+=p.rowspan}}function Qz(t,e){if(!Vn(t))return!1;if(e){const n=ni(t),i=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;Wz(i,n,s),s!=n.left;s--){const o=n.tableStart?i.doc.nodeAt(n.tableStart-1):i.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=ot.get(o)}e(i)}return!0}function Jz(t,e,n){var i;const s=Bt(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((i=e.nodeAt(t.map[o+n*t.width]))===null||i===void 0?void 0:i.type)!=s)return!1;return!0}function Xk(t,{map:e,tableStart:n,table:i},s){let o=n;for(let h=0;h<s;h++)o+=i.child(h).nodeSize;const a=[];let u=s>0?-1:0;Jz(e,i,s+u)&&(u=s==0||s==e.height?null:0);for(let h=0,p=e.width*s;h<e.width;h++,p++)if(s>0&&s<e.height&&e.map[p]==e.map[p-e.width]){const g=e.map[p],b=i.nodeAt(g).attrs;t.setNodeMarkup(n+g,null,{...b,rowspan:b.rowspan+1}),h+=b.colspan-1}else{var f;const g=u==null?Bt(i.type.schema).cell:(f=i.nodeAt(e.map[p+u*e.width]))===null||f===void 0?void 0:f.type,b=g==null?void 0:g.createAndFill();b&&a.push(b)}return t.insert(o,Bt(i.type.schema).row.create(null,a)),t}function Zz(t,e){if(!Vn(t))return!1;if(e){const n=ni(t);e(Xk(t.tr,n,n.top))}return!0}function e3(t,e){if(!Vn(t))return!1;if(e){const n=ni(t);e(Xk(t.tr,n,n.bottom))}return!0}function t3(t,{map:e,table:n,tableStart:i},s){let o=0;for(let h=0;h<s;h++)o+=n.child(h).nodeSize;const a=o+n.child(s).nodeSize,u=t.mapping.maps.length;t.delete(o+i,a+i);const f=new Set;for(let h=0,p=s*e.width;h<e.width;h++,p++){const g=e.map[p];if(!f.has(g)){if(f.add(g),s>0&&g==e.map[p-e.width]){const b=n.nodeAt(g).attrs;t.setNodeMarkup(t.mapping.slice(u).map(g+i),null,{...b,rowspan:b.rowspan-1}),h+=b.colspan-1}else if(s<e.height&&g==e.map[p+e.width]){const b=n.nodeAt(g),v=b.attrs,S=b.type.create({...v,rowspan:b.attrs.rowspan-1},b.content),w=e.positionAt(s+1,h,n);t.insert(t.mapping.slice(u).map(i+w),S),h+=v.colspan-1}}}}function n3(t,e){if(!Vn(t))return!1;if(e){const n=ni(t),i=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;t3(i,n,s),s!=n.top;s--){const o=n.tableStart?i.doc.nodeAt(n.tableStart-1):i.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=ot.get(n.table)}e(i)}return!0}function yS(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function i3({width:t,height:e,map:n},i){let s=i.top*t+i.left,o=s,a=(i.bottom-1)*t+i.left,u=s+(i.right-i.left-1);for(let f=i.top;f<i.bottom;f++){if(i.left>0&&n[o]==n[o-1]||i.right<t&&n[u]==n[u+1])return!0;o+=t,u+=t}for(let f=i.left;f<i.right;f++){if(i.top>0&&n[s]==n[s-t]||i.bottom<e&&n[a]==n[a+t])return!0;s++,a++}return!1}function bS(t,e){const n=t.selection;if(!(n instanceof Ge)||n.$anchorCell.pos==n.$headCell.pos)return!1;const i=ni(t),{map:s}=i;if(i3(s,i))return!1;if(e){const o=t.tr,a={};let u=G.empty,f,h;for(let p=i.top;p<i.bottom;p++)for(let g=i.left;g<i.right;g++){const b=s.map[p*s.width+g],v=i.table.nodeAt(b);if(!(a[b]||!v))if(a[b]=!0,f==null)f=b,h=v;else{yS(v)||(u=u.append(v.content));const S=o.mapping.map(b+i.tableStart);o.delete(S,S+v.nodeSize)}}if(f==null||h==null)return!0;if(o.setNodeMarkup(f+i.tableStart,null,{...qk(h.attrs,h.attrs.colspan,i.right-i.left-h.attrs.colspan),rowspan:i.bottom-i.top}),u.size>0){const p=f+1+h.content.size,g=yS(h)?f+1:p;o.replaceWith(g+i.tableStart,p+i.tableStart,u)}o.setSelection(new Ge(o.doc.resolve(f+i.tableStart))),e(o)}return!0}function vS(t,e){const n=Bt(t.schema);return r3(({node:i})=>n[i.type.spec.tableRole])(t,e)}function r3(t){return(e,n)=>{const i=e.selection;let s,o;if(i instanceof Ge){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{var a;if(s=Hz(i.$from),!s)return!1;o=(a=ps(i.$from))===null||a===void 0?void 0:a.pos}if(s==null||o==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let u=s.attrs;const f=[],h=u.colwidth;u.rowspan>1&&(u={...u,rowspan:1}),u.colspan>1&&(u={...u,colspan:1});const p=ni(e),g=e.tr;for(let v=0;v<p.right-p.left;v++)f.push(h?{...u,colwidth:h&&h[v]?[h[v]]:null}:u);let b;for(let v=p.top;v<p.bottom;v++){let S=p.map.positionAt(v,p.left,p.table);v==p.top&&(S+=s.nodeSize);for(let w=p.left,k=0;w<p.right;w++,k++)w==p.left&&v==p.top||g.insert(b=g.mapping.map(S+p.tableStart,1),t({node:s,row:v,col:w}).createAndFill(f[k]))}g.setNodeMarkup(o,t({node:s,row:p.top,col:p.left}),f[0]),i instanceof Ge&&g.setSelection(new Ge(g.doc.resolve(i.$anchorCell.pos),b?g.doc.resolve(b):void 0)),n(g)}return!0}}function s3(t,e){return function(n,i){if(!Vn(n))return!1;const s=yf(n);if(s.nodeAfter.attrs[t]===e)return!1;if(i){const o=n.tr;n.selection instanceof Ge?n.selection.forEachCell((a,u)=>{a.attrs[t]!==e&&o.setNodeMarkup(u,null,{...a.attrs,[t]:e})}):o.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),i(o)}return!0}}function l3(t){return function(e,n){if(!Vn(e))return!1;if(n){const i=Bt(e.schema),s=ni(e),o=e.tr,a=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),u=a.map(f=>s.table.nodeAt(f));for(let f=0;f<a.length;f++)u[f].type==i.header_cell&&o.setNodeMarkup(s.tableStart+a[f],i.cell,u[f].attrs);if(o.steps.length===0)for(let f=0;f<a.length;f++)o.setNodeMarkup(s.tableStart+a[f],i.header_cell,u[f].attrs);n(o)}return!0}}function SS(t,e,n){const i=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let s=0;s<i.length;s++){const o=e.table.nodeAt(i[s]);if(o&&o.type!==n.header_cell)return!1}return!0}function Zo(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?l3(t):function(n,i){if(!Vn(n))return!1;if(i){const s=Bt(n.schema),o=ni(n),a=n.tr,u=SS("row",o,s),f=SS("column",o,s),h=(t==="column"?u:t==="row"&&f)?1:0,p=t=="column"?{left:0,top:h,right:1,bottom:o.map.height}:t=="row"?{left:h,top:0,right:o.map.width,bottom:1}:o,g=t=="column"?f?s.cell:s.header_cell:t=="row"?u?s.cell:s.header_cell:s.cell;o.map.cellsInRect(p).forEach(b=>{const v=b+o.tableStart,S=a.doc.nodeAt(v);S&&a.setNodeMarkup(v,g,S.attrs)}),i(a)}return!0}}Zo("row",{useDeprecatedLogic:!0});Zo("column",{useDeprecatedLogic:!0});const o3=Zo("cell",{useDeprecatedLogic:!0});function a3(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let i=t.index(-1)-1,s=t.before();i>=0;i--){const o=t.node(-1).child(i),a=o.lastChild;if(a)return s-1-a.nodeSize;s-=o.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let i=t.indexAfter(-1),s=t.after();i<n.childCount;i++){const o=n.child(i);if(o.childCount)return s+1;s+=o.nodeSize}}return null}function xS(t){return function(e,n){if(!Vn(e))return!1;const i=a3(yf(e),t);if(i==null)return!1;if(n){const s=e.doc.resolve(i);n(e.tr.setSelection(ce.between(s,jz(s))).scrollIntoView())}return!0}}function c3(t,e){const n=t.selection.$anchor;for(let i=n.depth;i>0;i--)if(n.node(i).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(i),n.after(i)).scrollIntoView()),!0;return!1}function _c(t,e){const n=t.selection;if(!(n instanceof Ge))return!1;if(e){const i=t.tr,s=Bt(t.schema).cell.createAndFill().content;n.forEachCell((o,a)=>{o.content.eq(s)||i.replace(i.mapping.map(a+1),i.mapping.map(a+o.nodeSize-1),new F(s,0,0))}),i.docChanged&&e(i)}return!0}function u3(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:i}=t;for(;e.childCount==1&&(n>0&&i>0||e.child(0).type.spec.tableRole=="table");)n--,i--,e=e.child(0).content;const s=e.child(0),o=s.type.spec.tableRole,a=s.type.schema,u=[];if(o=="row")for(let f=0;f<e.childCount;f++){let h=e.child(f).content;const p=f?0:Math.max(0,n-1),g=f<e.childCount-1?0:Math.max(0,i-1);(p||g)&&(h=im(Bt(a).row,new F(h,p,g)).content),u.push(h)}else if(o=="cell"||o=="header_cell")u.push(n||i?im(Bt(a).row,new F(e,n,i)).content:e);else return null;return f3(a,u)}function f3(t,e){const n=[];for(let s=0;s<e.length;s++){const o=e[s];for(let a=o.childCount-1;a>=0;a--){const{rowspan:u,colspan:f}=o.child(a).attrs;for(let h=s;h<s+u;h++)n[h]=(n[h]||0)+f}}let i=0;for(let s=0;s<n.length;s++)i=Math.max(i,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(G.empty),n[s]<i){const o=Bt(t).cell.createAndFill(),a=[];for(let u=n[s];u<i;u++)a.push(o);e[s]=e[s].append(G.from(a))}return{height:e.length,width:i,rows:e}}function im(t,e){const n=t.createAndFill();return new Em(n).replace(0,n.content.size,e).doc}function d3({width:t,height:e,rows:n},i,s){if(t!=i){const o=[],a=[];for(let u=0;u<n.length;u++){const f=n[u],h=[];for(let p=o[u]||0,g=0;p<i;g++){let b=f.child(g%f.childCount);p+b.attrs.colspan>i&&(b=b.type.createChecked(ms(b.attrs,b.attrs.colspan,p+b.attrs.colspan-i),b.content)),h.push(b),p+=b.attrs.colspan;for(let v=1;v<b.attrs.rowspan;v++)o[u+v]=(o[u+v]||0)+b.attrs.colspan}a.push(G.from(h))}n=a,t=i}if(e!=s){const o=[];for(let a=0,u=0;a<s;a++,u++){const f=[],h=n[u%e];for(let p=0;p<h.childCount;p++){let g=h.child(p);a+g.attrs.rowspan>s&&(g=g.type.create({...g.attrs,rowspan:Math.max(1,s-g.attrs.rowspan)},g.content)),f.push(g)}o.push(G.from(f))}n=o,e=s}return{width:t,height:e,rows:n}}function h3(t,e,n,i,s,o,a){const u=t.doc.type.schema,f=Bt(u);let h,p;if(s>e.width)for(let g=0,b=0;g<e.height;g++){const v=n.child(g);b+=v.nodeSize;const S=[];let w;v.lastChild==null||v.lastChild.type==f.cell?w=h||(h=f.cell.createAndFill()):w=p||(p=f.header_cell.createAndFill());for(let k=e.width;k<s;k++)S.push(w);t.insert(t.mapping.slice(a).map(b-1+i),S)}if(o>e.height){const g=[];for(let S=0,w=(e.height-1)*e.width;S<Math.max(e.width,s);S++){const k=S>=e.width?!1:n.nodeAt(e.map[w+S]).type==f.header_cell;g.push(k?p||(p=f.header_cell.createAndFill()):h||(h=f.cell.createAndFill()))}const b=f.row.create(null,G.from(g)),v=[];for(let S=e.height;S<o;S++)v.push(b);t.insert(t.mapping.slice(a).map(i+n.nodeSize-2),v)}return!!(h||p)}function wS(t,e,n,i,s,o,a,u){if(a==0||a==e.height)return!1;let f=!1;for(let h=s;h<o;h++){const p=a*e.width+h,g=e.map[p];if(e.map[p-e.width]==g){f=!0;const b=n.nodeAt(g),{top:v,left:S}=e.findCell(g);t.setNodeMarkup(t.mapping.slice(u).map(g+i),null,{...b.attrs,rowspan:a-v}),t.insert(t.mapping.slice(u).map(e.positionAt(a,S,n)),b.type.createAndFill({...b.attrs,rowspan:v+b.attrs.rowspan-a})),h+=b.attrs.colspan-1}}return f}function kS(t,e,n,i,s,o,a,u){if(a==0||a==e.width)return!1;let f=!1;for(let h=s;h<o;h++){const p=h*e.width+a,g=e.map[p];if(e.map[p-1]==g){f=!0;const b=n.nodeAt(g),v=e.colCount(g),S=t.mapping.slice(u).map(g+i);t.setNodeMarkup(S,null,ms(b.attrs,a-v,b.attrs.colspan-(a-v))),t.insert(S+b.nodeSize,b.type.createAndFill(ms(b.attrs,0,a-v))),h+=b.attrs.rowspan-1}}return f}function TS(t,e,n,i,s){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let a=ot.get(o);const{top:u,left:f}=i,h=f+s.width,p=u+s.height,g=t.tr;let b=0;function v(){if(o=n?g.doc.nodeAt(n-1):g.doc,!o)throw new Error("No table found");a=ot.get(o),b=g.mapping.maps.length}h3(g,a,o,n,h,p,b)&&v(),wS(g,a,o,n,f,h,u,b)&&v(),wS(g,a,o,n,f,h,p,b)&&v(),kS(g,a,o,n,u,p,f,b)&&v(),kS(g,a,o,n,u,p,h,b)&&v();for(let S=u;S<p;S++){const w=a.positionAt(S,f,o),k=a.positionAt(S,h,o);g.replace(g.mapping.slice(b).map(w+n),g.mapping.slice(b).map(k+n),new F(s.rows[S-u],0,0))}v(),g.setSelection(new Ge(g.doc.resolve(n+a.positionAt(u,f,o)),g.doc.resolve(n+a.positionAt(p-1,h-1,o)))),e(g)}const p3=Vm({ArrowLeft:Bc("horiz",-1),ArrowRight:Bc("horiz",1),ArrowUp:Bc("vert",-1),ArrowDown:Bc("vert",1),"Shift-ArrowLeft":Hc("horiz",-1),"Shift-ArrowRight":Hc("horiz",1),"Shift-ArrowUp":Hc("vert",-1),"Shift-ArrowDown":Hc("vert",1),Backspace:_c,"Mod-Backspace":_c,Delete:_c,"Mod-Delete":_c});function Fc(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Bc(t,e){return(n,i,s)=>{if(!s)return!1;const o=n.selection;if(o instanceof Ge)return Fc(n,i,he.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const a=Fk(s,t,e);if(a==null)return!1;if(t=="horiz")return Fc(n,i,he.near(n.doc.resolve(o.head+e),e));{const u=n.doc.resolve(a),f=$k(u,t,e);let h;return f?h=he.near(f,1):e<0?h=he.near(n.doc.resolve(u.before(-1)),-1):h=he.near(n.doc.resolve(u.after(-1)),1),Fc(n,i,h)}}}function Hc(t,e){return(n,i,s)=>{if(!s)return!1;const o=n.selection;let a;if(o instanceof Ge)a=o;else{const f=Fk(s,t,e);if(f==null)return!1;a=new Ge(n.doc.resolve(f))}const u=$k(a.$headCell,t,e);return u?Fc(n,i,new Ge(a.$anchorCell,u)):!1}}function m3(t,e){const n=t.state.doc,i=ps(n.resolve(e));return i?(t.dispatch(t.state.tr.setSelection(new Ge(i))),!0):!1}function g3(t,e,n){if(!Vn(t.state))return!1;let i=u3(n);const s=t.state.selection;if(s instanceof Ge){i||(i={width:1,height:1,rows:[G.from(im(Bt(t.state.schema).cell,n))]});const o=s.$anchorCell.node(-1),a=s.$anchorCell.start(-1),u=ot.get(o).rectBetween(s.$anchorCell.pos-a,s.$headCell.pos-a);return i=d3(i,u.right-u.left,u.bottom-u.top),TS(t.state,t.dispatch,a,u,i),!0}else if(i){const o=yf(t.state),a=o.start(-1);return TS(t.state,t.dispatch,a,ot.get(o.node(-1)).findCell(o.pos-a),i),!0}else return!1}function y3(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const i=ES(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof Ge)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&i&&(s=ps(t.state.selection.$anchor))!=null&&((n=mp(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)o(s,e),e.preventDefault();else if(!i)return;function o(f,h){let p=mp(t,h);const g=gr.getState(t.state)==null;if(!p||!og(f,p))if(g)p=f;else return;const b=new Ge(f,p);if(g||!t.state.selection.eq(b)){const v=t.state.tr.setSelection(b);g&&v.setMeta(gr,f.pos),t.dispatch(v)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",u),gr.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(gr,-1))}function u(f){const h=f,p=gr.getState(t.state);let g;if(p!=null)g=t.state.doc.resolve(p);else if(ES(t,h.target)!=i&&(g=mp(t,e),!g))return a();g&&o(g,h)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",u)}function Fk(t,e,n){if(!(t.state.selection instanceof ce))return null;const{$head:i}=t.state.selection;for(let s=i.depth-1;s>=0;s--){const o=i.node(s);if((n<0?i.index(s):i.indexAfter(s))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const a=i.before(s),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?a:null}}return null}function ES(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function mp(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:i,pos:s}=n;return i>=0&&ps(t.state.doc.resolve(i))||ps(t.state.doc.resolve(s))}var b3=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),rm(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,rm(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function rm(t,e,n,i,s,o){let a=0,u=!0,f=e.firstChild;const h=t.firstChild;if(h){for(let g=0,b=0;g<h.childCount;g++){const{colspan:v,colwidth:S}=h.child(g).attrs;for(let w=0;w<v;w++,b++){const k=s==b?o:S&&S[w],E=k?k+"px":"";if(a+=k||i,k||(u=!1),f)f.style.width!=E&&(f.style.width=E),f=f.nextSibling;else{const N=document.createElement("col");N.style.width=E,e.appendChild(N)}}}for(;f;){var p;const g=f.nextSibling;(p=f.parentNode)===null||p===void 0||p.removeChild(f),f=g}u?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}const dn=new et("tableColumnResizing");function v3({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:i=b3,lastColumnResizable:s=!0}={}){const o=new Ye({key:dn,state:{init(a,u){var f;const h=(f=o.spec)===null||f===void 0||(f=f.props)===null||f===void 0?void 0:f.nodeViews,p=Bt(u.schema).table.name;return i&&h&&(h[p]=(g,b)=>new i(g,n,b)),new S3(-1,!1)},apply(a,u){return u.apply(a)}},props:{attributes:a=>{const u=dn.getState(a);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,u)=>{x3(a,u,t,s)},mouseleave:a=>{w3(a)},mousedown:(a,u)=>{k3(a,u,e,n)}},decorations:a=>{const u=dn.getState(a);if(u&&u.activeHandle>-1)return A3(a,u.activeHandle)},nodeViews:{}}});return o}var S3=class Wc{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,i=e.getMeta(dn);if(i&&i.setHandle!=null)return new Wc(i.setHandle,!1);if(i&&i.setDragging!==void 0)return new Wc(n.activeHandle,i.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return nm(e.doc.resolve(s))||(s=-1),new Wc(s,n.dragging)}return n}};function x3(t,e,n,i){if(!t.editable)return;const s=dn.getState(t.state);if(s&&!s.dragging){const o=E3(e.target);let a=-1;if(o){const{left:u,right:f}=o.getBoundingClientRect();e.clientX-u<=n?a=CS(t,e,"left",n):f-e.clientX<=n&&(a=CS(t,e,"right",n))}if(a!=s.activeHandle){if(!i&&a!==-1){const u=t.state.doc.resolve(a),f=u.node(-1),h=ot.get(f),p=u.start(-1);if(h.colCount(u.pos-p)+u.nodeAfter.attrs.colspan-1==h.width-1)return}Wk(t,a)}}}function w3(t){if(!t.editable)return;const e=dn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Wk(t,-1)}function k3(t,e,n,i){var s;if(!t.editable)return!1;const o=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,a=dn.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const u=t.state.doc.nodeAt(a.activeHandle),f=T3(t,a.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(dn,{setDragging:{startX:e.clientX,startWidth:f}}));function h(g){o.removeEventListener("mouseup",h),o.removeEventListener("mousemove",p);const b=dn.getState(t.state);b!=null&&b.dragging&&(C3(t,b.activeHandle,MS(b.dragging,g,n)),t.dispatch(t.state.tr.setMeta(dn,{setDragging:null})))}function p(g){if(!g.which)return h(g);const b=dn.getState(t.state);if(b&&b.dragging){const v=MS(b.dragging,g,n);AS(t,b.activeHandle,v,i)}}return AS(t,a.activeHandle,f,i),o.addEventListener("mouseup",h),o.addEventListener("mousemove",p),e.preventDefault(),!0}function T3(t,e,{colspan:n,colwidth:i}){const s=i&&i[i.length-1];if(s)return s;const o=t.domAtPos(e);let a=o.node.childNodes[o.offset].offsetWidth,u=n;if(i)for(let f=0;f<n;f++)i[f]&&(a-=i[f],u--);return a/u}function E3(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function CS(t,e,n,i){const s=n=="right"?-i:i,o=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!o)return-1;const{pos:a}=o,u=ps(t.state.doc.resolve(a));if(!u)return-1;if(n=="right")return u.pos;const f=ot.get(u.node(-1)),h=u.start(-1),p=f.map.indexOf(u.pos-h);return p%f.width==0?-1:h+f.map[p-1]}function MS(t,e,n){const i=e.clientX-t.startX;return Math.max(n,t.startWidth+i)}function Wk(t,e){t.dispatch(t.state.tr.setMeta(dn,{setHandle:e}))}function C3(t,e,n){const i=t.state.doc.resolve(e),s=i.node(-1),o=ot.get(s),a=i.start(-1),u=o.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1,f=t.state.tr;for(let h=0;h<o.height;h++){const p=h*o.width+u;if(h&&o.map[p]==o.map[p-o.width])continue;const g=o.map[p],b=s.nodeAt(g).attrs,v=b.colspan==1?0:u-o.colCount(g);if(b.colwidth&&b.colwidth[v]==n)continue;const S=b.colwidth?b.colwidth.slice():M3(b.colspan);S[v]=n,f.setNodeMarkup(a+g,null,{...b,colwidth:S})}f.docChanged&&t.dispatch(f)}function AS(t,e,n,i){const s=t.state.doc.resolve(e),o=s.node(-1),a=s.start(-1),u=ot.get(o).colCount(s.pos-a)+s.nodeAfter.attrs.colspan-1;let f=t.domAtPos(s.start(-1)).node;for(;f&&f.nodeName!="TABLE";)f=f.parentNode;f&&rm(o,f.firstChild,f,i,u,n)}function M3(t){return Array(t).fill(0)}function A3(t,e){const n=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return Xe.empty;const o=ot.get(s),a=i.start(-1),u=o.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let h=0;h<o.height;h++){const p=u+h*o.width;if((u==o.width-1||o.map[p]!=o.map[p+1])&&(h==0||o.map[p]!=o.map[p-o.width])){var f;const g=o.map[p],b=a+g+s.nodeAt(g).nodeSize-1,v=document.createElement("div");v.className="column-resize-handle",!((f=dn.getState(t))===null||f===void 0)&&f.dragging&&n.push(St.node(a+g,a+g+s.nodeAt(g).nodeSize,{class:"column-resize-dragging"})),n.push(St.widget(b,v))}}return Xe.create(t.doc,n)}function O3({allowTableNodeSelection:t=!1}={}){return new Ye({key:gr,state:{init(){return null},apply(e,n){const i=e.getMeta(gr);if(i!=null)return i==-1?null:i;if(n==null||!e.docChanged)return n;const{deleted:s,pos:o}=e.mapping.mapResult(n);return s?null:o}},props:{decorations:$z,handleDOMEvents:{mousedown:y3},createSelectionBetween(e){return gr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:m3,handleKeyDown:p3,handlePaste:g3},appendTransaction(e,n,i){return Kz(i,Gk(i,n),t)}})}function N3(t,e){const n=Math.min(t.top,e.top),i=Math.max(t.bottom,e.bottom),s=Math.min(t.left,e.left),a=Math.max(t.right,e.right)-s,u=i-n,f=s,h=n;return new DOMRect(f,h,a,u)}var R3=class{constructor({editor:t,element:e,view:n,pluginKey:i="bubbleMenu",updateDelay:s=250,resizeDelay:o=60,shouldShow:a,appendTo:u,getReferencedVirtualElement:f,options:h}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:g,state:b,from:v,to:S})=>{const{doc:w,selection:k}=b,{empty:E}=k,N=!w.textBetween(v,S).length&&Km(b.selection),L=this.element.contains(document.activeElement);return!(!(g.hasFocus()||L)||E||N||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:g})=>{var b;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}g!=null&&g.relatedTarget&&((b=this.element.parentNode)!=null&&b.contains(g.relatedTarget))||(g==null?void 0:g.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(g,b)=>{const v=!(b!=null&&b.selection.eq(g.state.selection)),S=!(b!=null&&b.doc.eq(g.state.doc));!v&&!S||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(g,v,S,b)},this.updateDelay))},this.updateHandler=(g,b,v,S)=>{const{composing:w}=g;if(w||!b&&!v)return;if(!this.getShouldShow(S)){this.hide();return}this.show(),this.updatePosition()},this.transactionHandler=({transaction:g})=>{const b=g.getMeta(this.pluginKey);b==="updatePosition"?this.updatePosition():b&&typeof b=="object"&&b.type==="updateOptions"?this.updateOptions(b.options):b==="hide"?this.hide():b==="show"&&(this.updatePosition(),this.show())};var p;this.editor=t,this.element=e,this.view=n,this.pluginKey=i,this.updateDelay=s,this.resizeDelay=o,this.appendTo=u,this.scrollTarget=(p=h==null?void 0:h.scrollTarget)!=null?p:window,this.getReferencedVirtualElement=f,this.floatingUIOptions={...this.floatingUIOptions,...h},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Bk(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(_k(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(zk(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(jk(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Hk(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Lk(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(Uk(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(Ik(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e,n;const{selection:i}=this.editor.state,s=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(s)return s;if(!((n=(e=this.view)==null?void 0:e.dom)!=null&&n.parentNode))return;const o=Qw(this.view,i.from,i.to);let a={getBoundingClientRect:()=>o,getClientRects:()=>[o]};if(i instanceof oe){let u=this.view.nodeDOM(i.from);const f=u.dataset.nodeViewWrapper?u:u.querySelector("[data-node-view-wrapper]");f&&(u=f),u&&(a={getBoundingClientRect:()=>u.getBoundingClientRect(),getClientRects:()=>[u.getBoundingClientRect()]})}if(i instanceof Ge){const{$anchorCell:u,$headCell:f}=i,h=u?u.pos:f.pos,p=f?f.pos:u.pos,g=this.view.nodeDOM(h),b=this.view.nodeDOM(p);if(!g||!b)return;const v=g===b?g.getBoundingClientRect():N3(g.getBoundingClientRect(),b.getBoundingClientRect());a={getBoundingClientRect:()=>v,getClientRects:()=>[v]}}return a}updatePosition(){if(!this.isVisible)return;const t=this.virtualElement;t&&Vk(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:n,strategy:i,middlewareData:s})=>{var o,a;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if((o=s.hide)!=null&&o.referenceHidden||(a=s.hide)!=null&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${e}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(t,e){const{state:n}=t,i=n.selection.from!==n.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,e);return}const s=!(e!=null&&e.selection.eq(t.state.selection)),o=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,s,o,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:i}=n,{ranges:s}=i,o=Math.min(...s.map(f=>f.$from.pos)),a=Math.max(...s.map(f=>f.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:o,to:a}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(t){var e;if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=t.getReferencedVirtualElement),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){const n=(e=t.options.scrollTarget)!=null?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Qk=t=>new Ye({key:typeof t.pluginKey=="string"?new et(t.pluginKey):t.pluginKey,view:e=>new R3({view:e,...t})});nt.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Qk({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var D3=class{constructor({editor:t,element:e,view:n,pluginKey:i="floatingMenu",updateDelay:s=250,resizeDelay:o=60,options:a,appendTo:u,shouldShow:f}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:p,state:g})=>{const{selection:b}=g,{$anchor:v,empty:S}=b,w=v.depth===1,k=v.parent.isTextblock&&!v.parent.type.spec.code&&!v.parent.textContent&&v.parent.childCount===0&&!this.getTextContent(v.parent);return!(!p.hasFocus()||!S||!w||!k||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(p,g,b,v)=>{const{composing:S}=p;if(S||!g&&!b)return;if(!this.getShouldShow(v)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:p})=>{var g;if(this.preventHide){this.preventHide=!1;return}p!=null&&p.relatedTarget&&((g=this.element.parentNode)!=null&&g.contains(p.relatedTarget))||(p==null?void 0:p.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:p})=>{const g=p.getMeta(this.pluginKey);g==="updatePosition"?this.updatePosition():g&&typeof g=="object"&&g.type==="updateOptions"?this.updateOptions(g.options):g==="hide"?this.hide():g==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var h;this.editor=t,this.element=e,this.view=n,this.pluginKey=i,this.updateDelay=s,this.resizeDelay=o,this.appendTo=u,this.scrollTarget=(h=a==null?void 0:a.scrollTarget)!=null?h:window,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,f&&(this.shouldShow=f),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return Kw(t,{textSerializers:Xm(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Bk(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(_k(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(zk(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(jk(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Hk(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Lk(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(Uk(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(Ik(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:i}=n,{ranges:s}=i,o=Math.min(...s.map(f=>f.$from.pos)),a=Math.max(...s.map(f=>f.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:o,to:a})}updateOptions(t){var e;if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){const n=(e=t.options.scrollTarget)!=null?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}updatePosition(){var t,e;if(!((e=(t=this.view)==null?void 0:t.dom)!=null&&e.parentNode))return;const{selection:n}=this.editor.state,i=Qw(this.view,n.from,n.to);Vk({getBoundingClientRect:()=>i,getClientRects:()=>[i]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:a,strategy:u,middlewareData:f})=>{var h,p;if((h=f.hide)!=null&&h.referenceHidden||(p=f.hide)!=null&&p.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=u,this.element.style.left=`${o}px`,this.element.style.top=`${a}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const n=!(e!=null&&e.selection.eq(t.state.selection)),i=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,n,i,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Jk=t=>new Ye({key:typeof t.pluginKey=="string"?new et(t.pluginKey):t.pluginKey,view:e=>new D3({view:e,...t})});nt.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:t,dispatch:e})=>(e&&t.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Jk({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Zk(t,e){return t??new et(e)}var z3=typeof window<"u"?Ae.useLayoutEffect:Ae.useEffect,eT=new Set(["left","opacity","position","top","visibility","width"]),L3=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),_3=new Set(["children","className","style"]),B3=new Set(["tabIndex"]),H3=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),U3={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function sm(t,e){return/^on[A-Z]/.test(t)&&typeof e=="function"}function j3(t){return t.startsWith("aria-")||t.startsWith("data-"),t}function I3(t){return t.startsWith("aria-")||t.startsWith("data-")||H3.has(t)}function tT(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function V3(t){var e;const n=t.endsWith("Capture"),s=(n?t.slice(0,-7):t).slice(2);return{eventName:(e=U3[s])!=null?e:s.toLowerCase(),options:n?{capture:!0}:void 0}}function $3(t,e){let n=e.defaultPrevented,i=!1;const s=Object.create(e);return Object.defineProperties(s,{nativeEvent:{value:e},currentTarget:{value:t},target:{value:e.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>i},preventDefault:{value:()=>{n=!0,e.preventDefault()}},stopPropagation:{value:()=>{i=!0,e.stopPropagation()}}}),s}function gp(t){return B3.has(t)}function OS(t,e,n){if(e==="tabIndex"){t.tabIndex=Number(n);return}t[e]=n}function q3(t,e){if(e==="tabIndex"){t.removeAttribute("tabindex");return}const n=t[e];if(typeof n=="boolean"){t[e]=!1;return}if(typeof n=="number"){t[e]=0;return}t[e]=""}function P3(t,e){return typeof e!="number"||e===0||t.startsWith("--")||L3.has(t)?String(e):`${e}px`}function K3(t,e){eT.has(e)||t.style.removeProperty(tT(e))}function G3(t,e,n){eT.has(e)||t.style.setProperty(tT(e),P3(e,n))}function Y3(t,e,n){new Set([...Object.keys(e),...Object.keys(n)]).forEach(s=>{if(_3.has(s)||!I3(s)||sm(s,e[s])||sm(s,n[s]))return;const o=e[s],a=n[s];if(o===a)return;const u=j3(s);if(a==null||a===!1){gp(s)&&q3(t,s),t.removeAttribute(u);return}if(a===!0){gp(s)&&OS(t,s,!0),t.setAttribute(u,"");return}if(gp(s)){OS(t,s,a);return}t.setAttribute(u,String(a))})}function X3(t,e,n){if(e!==n){if(n){t.className=n;return}t.removeAttribute("class")}}function F3(t,e,n){const i=e??{},s=n??{};new Set([...Object.keys(i),...Object.keys(s)]).forEach(a=>{const u=i[a],f=s[a];if(u!==f){if(f==null){K3(t,a);return}G3(t,a,f)}})}function W3(t,e,n){e.forEach(({eventName:s,listener:o,options:a})=>{t.removeEventListener(s,o,a)});const i=[];return Object.entries(n).forEach(([s,o])=>{if(!sm(s,o))return;const{eventName:a,options:u}=V3(s),f=h=>{o($3(t,h))};t.addEventListener(a,f,u),i.push({eventName:a,listener:f,options:u})}),i}function nT(t,e){const n=Ae.useRef({}),i=Ae.useRef([]);z3(()=>{const s=n.current;return X3(t,s.className,e.className),F3(t,s.style,e.style),Y3(t,s,e),i.current=W3(t,i.current,e),n.current=e,()=>{i.current.forEach(({eventName:o,listener:a,options:u})=>{t.removeEventListener(o,a,u)}),i.current=[]}},[t,e])}var Q3=Qe.forwardRef(({pluginKey:t,editor:e,updateDelay:n,resizeDelay:i,appendTo:s,shouldShow:o=null,getReferencedVirtualElement:a,options:u,children:f,...h},p)=>{const g=Ae.useRef(document.createElement("div")),b=Ae.useRef(Zk(t,"bubbleMenu")).current;nT(g.current,h),typeof p=="function"?p(g.current):p&&(p.current=g.current);const{editor:v}=yk(),S=e||v,w={updateDelay:n,resizeDelay:i,appendTo:s,pluginKey:b,shouldShow:o,getReferencedVirtualElement:a,options:u},k=Ae.useRef(w);k.current=w;const[E,N]=Ae.useState(!1),L=Ae.useRef(!0);return Ae.useEffect(()=>{if(S!=null&&S.isDestroyed)return;if(!S){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const V=g.current;V.style.visibility="hidden",V.style.position="absolute";const I=Qk({...k.current,editor:S,element:V});S.registerPlugin(I);const C=k.current.pluginKey;return L.current=!0,N(!0),()=>{N(!1),S.unregisterPlugin(C),window.requestAnimationFrame(()=>{V.parentNode&&V.parentNode.removeChild(V)})}},[S]),Ae.useEffect(()=>{if(!(!E||!S||S.isDestroyed)){if(L.current){L.current=!1;return}S.view.dispatch(S.state.tr.setMeta(b,{type:"updateOptions",options:k.current}))}},[E,S,n,i,o,u,s,a,b]),xm.createPortal(f,g.current)}),J3=Qe.forwardRef(({pluginKey:t,editor:e,updateDelay:n,resizeDelay:i,appendTo:s,shouldShow:o=null,options:a,children:u,...f},h)=>{const p=Ae.useRef(document.createElement("div")),g=Ae.useRef(Zk(t,"floatingMenu")).current;nT(p.current,f),typeof h=="function"?h(p.current):h&&(h.current=p.current);const{editor:b}=yk(),v=e||b,S={updateDelay:n,resizeDelay:i,appendTo:s,pluginKey:g,shouldShow:o,options:a},w=Ae.useRef(S);w.current=S;const[k,E]=Ae.useState(!1),N=Ae.useRef(!0);return Ae.useEffect(()=>{if(v!=null&&v.isDestroyed)return;if(!v){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const L=p.current;L.style.visibility="hidden",L.style.position="absolute";const V=Jk({...w.current,editor:v,element:L});v.registerPlugin(V);const I=w.current.pluginKey;return N.current=!0,E(!0),()=>{E(!1),v.unregisterPlugin(I),window.requestAnimationFrame(()=>{L.parentNode&&L.parentNode.removeChild(L)})}},[v]),Ae.useEffect(()=>{if(!(!k||!v||v.isDestroyed)){if(N.current){N.current=!1;return}v.view.dispatch(v.state.tr.setMeta(g,{type:"updateOptions",options:w.current}))}},[k,v,n,i,o,a,s,g]),xm.createPortal(u,p.current)}),yu=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...i}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,i,n]},Z3=/^\s*>\s$/,eL=kt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return yu("blockquote",{...Ze(this.options.HTMLAttributes,t),children:yu("slot",{})})},parseMarkdown:(t,e)=>{var n;const i=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,i(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",i=[];return t.content.forEach((s,o)=>{var a,u;const p=((u=(a=e.renderChild)==null?void 0:a.call(e,s,o))!=null?u:e.renderChildren([s])).split(`
167
+ `).map(g=>g.trim()===""?n:`${n} ${g}`);i.push(p.join(`
168
+ `))}),i.join(`
169
+ ${n}
170
+ `)},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[Sl({find:Z3,type:this.type})]}}),tL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,iL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,rL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sL=bs.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return yu("strong",{...Ze(this.options.HTMLAttributes,t),children:yu("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[vl({find:tL,type:this.type}),vl({find:iL,type:this.type})]},addPasteRules(){return[hs({find:nL,type:this.type}),hs({find:rL,type:this.type})]}}),lL=/(^|[^`])`([^`]+)`(?!`)$/,oL=/(^|[^`])`([^`]+)`(?!`)/g,aL=bs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ze(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[vl({find:lL,type:this.type})]},addPasteRules(){return[hs({find:oL,type:this.type})]}}),yp=4,cL=/^```([a-z]+)?[\s\n]$/,uL=/^~~~([a-z]+)?[\s\n]$/,fL=kt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:yp,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const o=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ze(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,i;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((i=t.raw)==null?void 0:i.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let i="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?i=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
171
+ `):i=`\`\`\`${s}
172
+
173
+ \`\`\``,i},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:yp,{state:i}=t,{selection:s}=i,{$from:o,empty:a}=s;if(o.parent.type!==this.type)return!1;const u=" ".repeat(n);return a?t.commands.insertContent(u):t.commands.command(({tr:f})=>{const{from:h,to:p}=s,v=i.doc.textBetween(h,p,`
174
+ `,`
175
+ `).split(`
176
+ `).map(S=>u+S).join(`
177
+ `);return f.replaceWith(h,p,i.schema.text(v)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:yp,{state:i}=t,{selection:s}=i,{$from:o,empty:a}=s;return o.parent.type!==this.type?!1:a?t.commands.command(({tr:u})=>{var f;const{pos:h}=o,p=o.start(),g=o.end(),v=i.doc.textBetween(p,g,`
178
+ `,`
179
+ `).split(`
180
+ `);let S=0,w=0;const k=h-p;for(let C=0;C<v.length;C+=1){if(w+v[C].length>=k){S=C;break}w+=v[C].length+1}const N=((f=v[S].match(/^ */))==null?void 0:f[0])||"",L=Math.min(N.length,n);if(L===0)return!0;let V=p;for(let C=0;C<S;C+=1)V+=v[C].length+1;return u.delete(V,V+L),h-V<=L&&u.setSelection(ce.create(u.doc,V)),!0}):t.commands.command(({tr:u})=>{const{from:f,to:h}=s,b=i.doc.textBetween(f,h,`
181
+ `,`
182
+ `).split(`
183
+ `).map(v=>{var S;const w=((S=v.match(/^ */))==null?void 0:S[0])||"",k=Math.min(w.length,n);return v.slice(k)}).join(`
184
+ `);return u.replaceWith(f,h,i.schema.text(b)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type)return!1;const o=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith(`
185
+
186
+ `);return!o||!a?!1:t.chain().command(({tr:u})=>(u.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:i}=e,{$from:s,empty:o}=n;if(!o||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const u=s.after();return u===void 0?!1:i.nodeAt(u)?t.commands.command(({tr:h})=>(h.setSelection(he.near(i.resolve(u))),!0)):t.commands.exitCode()}}},addInputRules(){return[Fp({find:cL,type:this.type,getAttributes:t=>({language:t[1]})}),Fp({find:uL,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ye({key:new et("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),s=i?JSON.parse(i):void 0,o=s==null?void 0:s.mode;if(!n||!o)return!1;const{tr:a,schema:u}=t.state,f=u.text(n.replace(/\r\n?/g,`
187
+ `));return a.replaceSelectionWith(this.type.create({language:o},f)),a.selection.$from.parent.type!==this.type&&a.setSelection(ce.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}}),dL=kt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
188
+
189
+ `):""}),hL=kt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ze(this.options.HTMLAttributes,t)]},renderText(){return`
190
+ `},renderMarkdown:()=>`
191
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:o}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:u}=i.extensionManager,f=o||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:p})=>{if(p&&f&&a){const g=f.filter(b=>u.includes(b.type.name));h.ensureMarks(g)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pL=kt.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]}`,Ze(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const i=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(i);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Fp({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),mL=kt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ze(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!BD(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:i}=n,s=t();return Xw(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:o,tr:a,dispatch:u})=>{if(u){const{$to:f}=a.selection,h=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?a.setSelection(ce.create(a.doc,f.pos+1)):f.nodeAfter.isBlock?a.setSelection(oe.create(a.doc,f.pos)):a.setSelection(ce.create(a.doc,f.pos));else{const p=o.schema.nodes[this.options.nextNodeType]||f.parent.type.contentMatch.defaultType,g=p==null?void 0:p.create();g&&(a.insert(h,g),a.setSelection(ce.create(a.doc,h+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[dk({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),gL=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,yL=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,bL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,vL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,SL=bs.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ze(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[vl({find:gL,type:this.type}),vl({find:bL,type:this.type})]},addPasteRules(){return[hs({find:yL,type:this.type}),hs({find:vL,type:this.type})]}});const xL="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",wL="ελ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",lm="numeric",om="ascii",am="alpha",Bo="asciinumeric",No="alphanumeric",cm="domain",iT="emoji",kL="scheme",TL="slashscheme",bp="whitespace";function EL(t,e){return t in e||(e[t]=[]),e[t]}function ns(t,e,n){e[lm]&&(e[Bo]=!0,e[No]=!0),e[om]&&(e[Bo]=!0,e[am]=!0),e[Bo]&&(e[No]=!0),e[am]&&(e[No]=!0),e[No]&&(e[cm]=!0),e[iT]&&(e[cm]=!0);for(const i in e){const s=EL(i,n);s.indexOf(t)<0&&s.push(t)}}function CL(t,e){const n={};for(const i in e)e[i].indexOf(t)>=0&&(n[i]=!0);return n}function Qt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Qt.groups={};Qt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let i=0;i<e.jr.length;i++){const s=e.jr[i][0],o=e.jr[i][1];if(o&&s.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,i){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,i)},tr(t,e,n,i){i=i||Qt.groups;let s;return e&&e.j?s=e:(s=new Qt(e),n&&i&&ns(e,n,i)),this.jr.push([t,s]),s},ts(t,e,n,i){let s=this;const o=t.length;if(!o)return s;for(let a=0;a<o-1;a++)s=s.tt(t[a]);return s.tt(t[o-1],e,n,i)},tt(t,e,n,i){i=i||Qt.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const o=e;let a,u=s.go(t);if(u?(a=new Qt,Object.assign(a.j,u.j),a.jr.push.apply(a.jr,u.jr),a.jd=u.jd,a.t=u.t):a=new Qt,o){if(i)if(a.t&&typeof a.t=="string"){const f=Object.assign(CL(a.t,i),n);ns(o,f,i)}else n&&ns(o,n,i);a.t=o}return s.j[t]=a,a}};const we=(t,e,n,i,s)=>t.ta(e,n,i,s),st=(t,e,n,i,s)=>t.tr(e,n,i,s),NS=(t,e,n,i,s)=>t.ts(e,n,i,s),X=(t,e,n,i,s)=>t.tt(e,n,i,s),Ci="WORD",um="UWORD",rT="ASCIINUMERICAL",sT="ALPHANUMERICAL",ea="LOCALHOST",fm="TLD",dm="UTLD",Qc="SCHEME",cl="SLASH_SCHEME",ag="NUM",hm="WS",cg="NL",Ho="OPENBRACE",Uo="CLOSEBRACE",bu="OPENBRACKET",vu="CLOSEBRACKET",Su="OPENPAREN",xu="CLOSEPAREN",wu="OPENANGLEBRACKET",ku="CLOSEANGLEBRACKET",Tu="FULLWIDTHLEFTPAREN",Eu="FULLWIDTHRIGHTPAREN",Cu="LEFTCORNERBRACKET",Mu="RIGHTCORNERBRACKET",Au="LEFTWHITECORNERBRACKET",Ou="RIGHTWHITECORNERBRACKET",Nu="FULLWIDTHLESSTHAN",Ru="FULLWIDTHGREATERTHAN",Du="AMPERSAND",zu="APOSTROPHE",Lu="ASTERISK",dr="AT",_u="BACKSLASH",Bu="BACKTICK",Hu="CARET",yr="COLON",ug="COMMA",Uu="DOLLAR",Xn="DOT",ju="EQUALS",fg="EXCLAMATION",Mn="HYPHEN",jo="PERCENT",Iu="PIPE",Vu="PLUS",$u="POUND",Io="QUERY",dg="QUOTE",lT="FULLWIDTHMIDDLEDOT",hg="SEMI",Fn="SLASH",Vo="TILDE",qu="UNDERSCORE",oT="EMOJI",Pu="SYM";var aT=Object.freeze({__proto__:null,ALPHANUMERICAL:sT,AMPERSAND:Du,APOSTROPHE:zu,ASCIINUMERICAL:rT,ASTERISK:Lu,AT:dr,BACKSLASH:_u,BACKTICK:Bu,CARET:Hu,CLOSEANGLEBRACKET:ku,CLOSEBRACE:Uo,CLOSEBRACKET:vu,CLOSEPAREN:xu,COLON:yr,COMMA:ug,DOLLAR:Uu,DOT:Xn,EMOJI:oT,EQUALS:ju,EXCLAMATION:fg,FULLWIDTHGREATERTHAN:Ru,FULLWIDTHLEFTPAREN:Tu,FULLWIDTHLESSTHAN:Nu,FULLWIDTHMIDDLEDOT:lT,FULLWIDTHRIGHTPAREN:Eu,HYPHEN:Mn,LEFTCORNERBRACKET:Cu,LEFTWHITECORNERBRACKET:Au,LOCALHOST:ea,NL:cg,NUM:ag,OPENANGLEBRACKET:wu,OPENBRACE:Ho,OPENBRACKET:bu,OPENPAREN:Su,PERCENT:jo,PIPE:Iu,PLUS:Vu,POUND:$u,QUERY:Io,QUOTE:dg,RIGHTCORNERBRACKET:Mu,RIGHTWHITECORNERBRACKET:Ou,SCHEME:Qc,SEMI:hg,SLASH:Fn,SLASH_SCHEME:cl,SYM:Pu,TILDE:Vo,TLD:fm,UNDERSCORE:qu,UTLD:dm,UWORD:um,WORD:Ci,WS:hm});const ki=/[a-z]/,ko=new RegExp("\\p{L}","u"),vp=new RegExp("\\p{Emoji}","u"),Ti=/\d/,Sp=/\s/,RS="\r",xp=`
192
+ `,ML="️",AL="‍",wp="";let Uc=null,jc=null;function OL(t=[]){const e={};Qt.groups=e;const n=new Qt;Uc==null&&(Uc=DS(xL)),jc==null&&(jc=DS(wL)),X(n,"'",zu),X(n,"{",Ho),X(n,"}",Uo),X(n,"[",bu),X(n,"]",vu),X(n,"(",Su),X(n,")",xu),X(n,"<",wu),X(n,">",ku),X(n,"(",Tu),X(n,")",Eu),X(n,"「",Cu),X(n,"」",Mu),X(n,"『",Au),X(n,"』",Ou),X(n,"<",Nu),X(n,">",Ru),X(n,"&",Du),X(n,"*",Lu),X(n,"@",dr),X(n,"`",Bu),X(n,"^",Hu),X(n,":",yr),X(n,",",ug),X(n,"$",Uu),X(n,".",Xn),X(n,"=",ju),X(n,"!",fg),X(n,"-",Mn),X(n,"%",jo),X(n,"|",Iu),X(n,"+",Vu),X(n,"#",$u),X(n,"?",Io),X(n,'"',dg),X(n,"/",Fn),X(n,";",hg),X(n,"~",Vo),X(n,"_",qu),X(n,"\\",_u),X(n,"・",lT);const i=st(n,Ti,ag,{[lm]:!0});st(i,Ti,i);const s=st(i,ki,rT,{[Bo]:!0}),o=st(i,ko,sT,{[No]:!0}),a=st(n,ki,Ci,{[om]:!0});st(a,Ti,s),st(a,ki,a),st(s,Ti,s),st(s,ki,s);const u=st(n,ko,um,{[am]:!0});st(u,ki),st(u,Ti,o),st(u,ko,u),st(o,Ti,o),st(o,ki),st(o,ko,o);const f=X(n,xp,cg,{[bp]:!0}),h=X(n,RS,hm,{[bp]:!0}),p=st(n,Sp,hm,{[bp]:!0});X(n,wp,p),X(h,xp,f),X(h,wp,p),st(h,Sp,p),X(p,RS),X(p,xp),st(p,Sp,p),X(p,wp,p);const g=st(n,vp,oT,{[iT]:!0});X(g,"#"),st(g,vp,g),X(g,ML,g);const b=X(g,AL);X(b,"#"),st(b,vp,g);const v=[[ki,a],[Ti,s]],S=[[ki,null],[ko,u],[Ti,o]];for(let w=0;w<Uc.length;w++)cr(n,Uc[w],fm,Ci,v);for(let w=0;w<jc.length;w++)cr(n,jc[w],dm,um,S);ns(fm,{tld:!0,ascii:!0},e),ns(dm,{utld:!0,alpha:!0},e),cr(n,"file",Qc,Ci,v),cr(n,"mailto",Qc,Ci,v),cr(n,"http",cl,Ci,v),cr(n,"https",cl,Ci,v),cr(n,"ftp",cl,Ci,v),cr(n,"ftps",cl,Ci,v),ns(Qc,{scheme:!0,ascii:!0},e),ns(cl,{slashscheme:!0,ascii:!0},e),t=t.sort((w,k)=>w[0]>k[0]?1:-1);for(let w=0;w<t.length;w++){const k=t[w][0],N=t[w][1]?{[kL]:!0}:{[TL]:!0};k.indexOf("-")>=0?N[cm]=!0:ki.test(k)?Ti.test(k)?N[Bo]=!0:N[om]=!0:N[lm]=!0,NS(n,k,k,N)}return NS(n,"localhost",ea,{ascii:!0}),n.jd=new Qt(Pu),{start:n,tokens:Object.assign({groups:e},aT)}}function cT(t,e){const n=NL(e.replace(/[A-Z]/g,u=>u.toLowerCase())),i=n.length,s=[];let o=0,a=0;for(;a<i;){let u=t,f=null,h=0,p=null,g=-1,b=-1;for(;a<i&&(f=u.go(n[a]));)u=f,u.accepts()?(g=0,b=0,p=u):g>=0&&(g+=n[a].length,b++),h+=n[a].length,o+=n[a].length,a++;o-=g,a-=b,h-=g,s.push({t:p.t,v:e.slice(o-h,o),s:o-h,e:o})}return s}function NL(t){const e=[],n=t.length;let i=0;for(;i<n;){let s=t.charCodeAt(i),o,a=s<55296||s>56319||i+1===n||(o=t.charCodeAt(i+1))<56320||o>57343?t[i]:t.slice(i,i+2);e.push(a),i+=a.length}return e}function cr(t,e,n,i,s){let o;const a=e.length;for(let u=0;u<a-1;u++){const f=e[u];t.j[f]?o=t.j[f]:(o=new Qt(i),o.jr=s.slice(),t.j[f]=o),t=o}return o=new Qt(n),o.jr=s.slice(),t.j[e[a-1]]=o,o}function DS(t){const e=[],n=[];let i=0,s="0123456789";for(;i<t.length;){let o=0;for(;s.indexOf(t[i+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let a=parseInt(t.substring(i,i+o),10);a>0;a--)n.pop();i+=o}else n.push(t[i]),i++}return e}const ta={defaultProtocol:"http",events:null,format:zS,formatHref:zS,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pg(t,e=null){let n=Object.assign({},ta);t&&(n=Object.assign(n,t instanceof pg?t.o:t));const i=n.ignoreTags,s=[];for(let o=0;o<i.length;o++)s.push(i[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}pg.prototype={o:ta,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const i=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:ta[t],typeof s=="function"&&i&&(s=s(e,n))):typeof s=="function"&&i&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let i=this.o[t];return typeof i=="function"&&e!=null&&(i=i(e,n.t,n)),i},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function zS(t){return t}function uT(t,e){this.t="token",this.v=t,this.tk=e}uT.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),i=t.get("format",e,this);return n&&i.length>n?i.substring(0,n)+"…":i},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=ta.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),i=t.get("formatHref",n,this),s=t.get("tagName",n,e),o=this.toFormattedString(t),a={},u=t.get("className",n,e),f=t.get("target",n,e),h=t.get("rel",n,e),p=t.getObj("attributes",n,e),g=t.getObj("events",n,e);return a.href=i,u&&(a.class=u),f&&(a.target=f),h&&(a.rel=h),p&&Object.assign(a,p),{tagName:s,attributes:a,content:o,eventListeners:g}}};function bf(t,e){class n extends uT{constructor(s,o){super(s,o),this.t=t}}for(const i in e)n.prototype[i]=e[i];return n.t=t,n}const LS=bf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),_S=bf("text"),RL=bf("nl"),Ic=bf("url",{isLink:!0,toHref(t=ta.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ea&&t[1].t===yr}}),Cn=t=>new Qt(t);function DL({groups:t}){const e=t.domain.concat([Du,Lu,dr,_u,Bu,Hu,Uu,ju,Mn,ag,jo,Iu,Vu,$u,Fn,Pu,Vo,qu]),n=[zu,yr,ug,Xn,fg,jo,Io,dg,hg,wu,ku,Ho,Uo,vu,bu,Su,xu,Tu,Eu,Cu,Mu,Au,Ou,Nu,Ru],i=[Du,zu,Lu,_u,Bu,Hu,Uu,ju,Mn,Ho,Uo,jo,Iu,Vu,$u,Io,Fn,Pu,Vo,qu],s=Cn(),o=X(s,Vo);we(o,i,o),we(o,t.domain,o);const a=Cn(),u=Cn(),f=Cn();we(s,t.domain,a),we(s,t.scheme,u),we(s,t.slashscheme,f),we(a,i,o),we(a,t.domain,a);const h=X(a,dr);X(o,dr,h),X(u,dr,h),X(f,dr,h);const p=X(o,Xn);we(p,i,o),we(p,t.domain,o);const g=Cn();we(h,t.domain,g),we(g,t.domain,g);const b=X(g,Xn);we(b,t.domain,g);const v=Cn(LS);we(b,t.tld,v),we(b,t.utld,v),X(h,ea,v);const S=X(g,Mn);X(S,Mn,S),we(S,t.domain,g),we(v,t.domain,g),X(v,Xn,b),X(v,Mn,S);const w=X(v,yr);we(w,t.numeric,LS);const k=X(a,Mn),E=X(a,Xn);X(k,Mn,k),we(k,t.domain,a),we(E,i,o),we(E,t.domain,a);const N=Cn(Ic);we(E,t.tld,N),we(E,t.utld,N),we(N,t.domain,a),we(N,i,o),X(N,Xn,E),X(N,Mn,k),X(N,dr,h);const L=X(N,yr),V=Cn(Ic);we(L,t.numeric,V);const I=Cn(Ic),C=Cn();we(I,e,I),we(I,n,C),we(C,e,I),we(C,n,C),X(N,Fn,I),X(V,Fn,I);const H=X(u,yr),W=X(f,yr),ie=X(W,Fn),te=X(ie,Fn);we(u,t.domain,a),X(u,Xn,E),X(u,Mn,k),we(f,t.domain,a),X(f,Xn,E),X(f,Mn,k),we(H,t.domain,I),X(H,Fn,I),X(H,Io,I),we(te,t.domain,I),we(te,e,I),X(te,Fn,I);const ve=[[Ho,Uo],[bu,vu],[Su,xu],[wu,ku],[Tu,Eu],[Cu,Mu],[Au,Ou],[Nu,Ru]];for(let pe=0;pe<ve.length;pe++){const[xe,de]=ve[pe],se=X(I,xe);X(C,xe,se),X(se,de,I);const B=Cn(Ic);we(se,e,B);const Y=Cn();we(se,n),we(B,e,B),we(B,n,Y),we(Y,e,B),we(Y,n,Y),X(B,de,I),X(Y,de,I)}return X(s,ea,N),X(s,cg,RL),{start:s,tokens:aT}}function zL(t,e,n){let i=n.length,s=0,o=[],a=[];for(;s<i;){let u=t,f=null,h=null,p=0,g=null,b=-1;for(;s<i&&!(f=u.go(n[s].t));)a.push(n[s++]);for(;s<i&&(h=f||u.go(n[s].t));)f=null,u=h,u.accepts()?(b=0,g=u):b>=0&&b++,s++,p++;if(b<0)s-=p,s<i&&(a.push(n[s]),s++);else{a.length>0&&(o.push(kp(_S,e,a)),a=[]),s-=b,p-=b;const v=g.t,S=n.slice(s-p,s);o.push(kp(v,e,S))}}return a.length>0&&o.push(kp(_S,e,a)),o}function kp(t,e,n){const i=n[0].s,s=n[n.length-1].e,o=e.slice(i,s);return new t(o,n)}const LL=typeof console<"u"&&console&&console.warn||(()=>{}),_L="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Je={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function BL(){return Qt.groups={},Je.scanner=null,Je.parser=null,Je.tokenQueue=[],Je.pluginQueue=[],Je.customSchemes=[],Je.initialized=!1,Je}function BS(t,e=!1){if(Je.initialized&&LL(`linkifyjs: already initialized - will not register custom scheme "${t}" ${_L}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
193
+ 1. Must only contain digits, lowercase ASCII letters or "-"
194
+ 2. Cannot start or end with "-"
195
+ 3. "-" cannot repeat`);Je.customSchemes.push([t,e])}function HL(){Je.scanner=OL(Je.customSchemes);for(let t=0;t<Je.tokenQueue.length;t++)Je.tokenQueue[t][1]({scanner:Je.scanner});Je.parser=DL(Je.scanner.tokens);for(let t=0;t<Je.pluginQueue.length;t++)Je.pluginQueue[t][1]({scanner:Je.scanner,parser:Je.parser});return Je.initialized=!0,Je}function mg(t){return Je.initialized||HL(),zL(Je.parser.start,t,cT(Je.scanner.start,t))}mg.scan=cT;function fT(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const i=new pg(n),s=mg(t),o=[];for(let a=0;a<s.length;a++){const u=s[a];u.isLink&&(!e||u.t===e)&&i.check(u)&&o.push(u.toFormattedObject(i))}return o}var gg="[\0-   ᠎ -\u2029  ]",UL=new RegExp(gg),jL=new RegExp(`${gg}$`),IL=new RegExp(gg,"g");function VL(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function $L(t){return new Ye({key:new et("autolink"),appendTransaction:(e,n,i)=>{const s=e.some(h=>h.docChanged)&&!n.doc.eq(i.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!s||o)return;const{tr:a}=i,u=jw(n.doc,[...e]);if(Yw(u).forEach(({newRange:h})=>{const p=_R(i.doc,h,v=>v.isTextblock);let g,b;if(p.length>1)g=p[0],b=i.doc.textBetween(g.pos,g.pos+g.node.nodeSize,void 0," ");else if(p.length){const v=i.doc.textBetween(h.from,h.to," "," ");if(!jL.test(v))return;g=p[0],b=i.doc.textBetween(g.pos,h.to,void 0," ")}if(g&&b){const v=b.split(UL).filter(Boolean);if(v.length<=0)return!1;const S=v[v.length-1],w=g.pos+b.lastIndexOf(S);if(!S)return!1;const k=mg(S).map(E=>E.toObject(t.defaultProtocol));if(!VL(k))return!1;k.filter(E=>E.isLink).map(E=>({...E,from:w+E.start+1,to:w+E.end+1})).filter(E=>i.schema.marks.code?!i.doc.rangeHasMark(E.from,E.to,i.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{Fm(E.from,E.to,i.doc).some(N=>N.mark.type===t.type)||a.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!a.steps.length)return a}})}function qL(t){return new Ye({key:new et("handleClickLink"),props:{handleClick:(e,n,i)=>{var s,o;if(i.button!==0||!e.editable)return!1;let a=null;if(i.target instanceof HTMLAnchorElement)a=i.target;else{const f=i.target;if(!f)return!1;const h=t.editor.view.dom;a=f.closest("a"),a&&!h.contains(a)&&(a=null)}if(!a)return!1;let u=!1;if(t.enableClickSelection&&(u=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const f=Gw(e.state,t.type.name),h=(s=a.href)!=null?s:f.href,p=(o=a.target)!=null?o:f.target;h&&(window.open(h,p),u=!0)}return u}}})}function PL(t){return new Ye({key:new et("handlePasteLink"),props:{handlePaste:(e,n,i)=>{const{shouldAutoLink:s}=t,{state:o}=e,{selection:a}=o,{empty:u}=a;if(u)return!1;let f="";i.content.forEach(p=>{f+=p.textContent});const h=fT(f,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===f);return!f||!h||s!==void 0&&!s(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Jr(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(i=>{const s=typeof i=="string"?i:i.scheme;s&&n.push(s)}),!t||t.replace(IL,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var dT=bs.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"){BS(t);return}BS(t.scheme,t.optionalSlashes)})},onDestroy(){BL()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Jr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Jr(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=>!!Jr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ze(this.options.HTMLAttributes,t),0]:["a",Ze(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,i,s,o;const a=(i=(n=t.attrs)==null?void 0:n.href)!=null?i:"",u=(o=(s=t.attrs)==null?void 0:s.title)!=null?o:"",f=e.renderChildren(t);return u?`[${f}](${a} "${u}")`:`[${f}](${a})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:i=>!!Jr(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:i=>!!Jr(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:i}=this.options,s=fT(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!Jr(a,n),protocols:n,defaultProtocol:i}));s.length&&s.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push($L({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:s=>!!Jr(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(qL({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(PL({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),KL=Object.defineProperty,GL=(t,e)=>{for(var n in e)KL(t,n,{get:e[n],enumerable:!0})},YL="listItem",HS="textStyle",US=/^\s*([-+*])\s$/,hT=kt.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",Ze(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
196
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(YL,this.editor.getAttributes(HS)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Sl({find:US,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Sl({find:US,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(HS),editor:this.editor})),[t]}});function XL(t){var e,n;const i=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(i==null?void 0:i.type)==="list"&&i.ordered&&i.raw===t.text)}function FL(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var pT=kt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ze(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const i=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(XL(t))return{type:"listItem",content:[{type:"paragraph",content:FL(t.text||"",e)}]};if(t.tokens.some(a=>a.type==="paragraph"))s=i(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const f=t.tokens.slice(1),h=i(f);s.push(...h)}}else s=i(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>Zm(t,e,i=>{var s,o;return i.parentType==="bulletList"?"- ":i.parentType==="orderedList"?`${(((o=(s=i.meta)==null?void 0:s.parentAttrs)==null?void 0:o.start)||1)+i.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),WL={};GL(WL,{findListItemPos:()=>oa,getNextListDepth:()=>yg,handleBackspace:()=>pm,handleDelete:()=>mm,hasListBefore:()=>mT,hasListItemAfter:()=>QL,hasListItemBefore:()=>gT,listItemHasSubList:()=>yT,nextListIsDeeper:()=>bT,nextListIsHigher:()=>vT});var oa=(t,e)=>{const{$from:n}=e.selection,i=gt(t,e.schema);let s=null,o=n.depth,a=n.pos,u=null;for(;o>0&&u===null;)s=n.node(o),s.type===i?u=o:(o-=1,a-=1);return u===null?null:{$pos:e.doc.resolve(a),depth:u}},yg=(t,e)=>{const n=oa(t,e);if(!n)return!1;const[,i]=PR(e,t,n.$pos.pos+4);return i},mT=(t,e,n)=>{const{$anchor:i}=t.selection,s=Math.max(0,i.pos-2),o=t.doc.resolve(s).node();return!(!o||!n.includes(o.type.name))},gT=(t,e)=>{var n;const{$anchor:i}=e.selection,s=e.doc.resolve(i.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},yT=(t,e,n)=>{if(!n)return!1;const i=gt(t,e.schema);let s=!1;return n.descendants(o=>{o.type===i&&(s=!0)}),s},pm=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Mr(t.state,e)&&mT(t.state,e,n)){const{$anchor:u}=t.state.selection,f=t.state.doc.resolve(u.before()-1),h=[];f.node().descendants((b,v)=>{b.type.name===e&&h.push({node:b,pos:v})});const p=h.at(-1);if(!p)return!1;const g=t.state.doc.resolve(f.start()+p.pos+1);return t.chain().cut({from:u.start()-1,to:u.end()+1},g.end()).joinForward().run()}if(!Mr(t.state,e)||!XR(t.state))return!1;const i=oa(e,t.state);if(!i)return!1;const o=t.state.doc.resolve(i.$pos.pos-2).node(i.depth),a=yT(e,t.state,o);return gT(e,t.state)&&!a?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},bT=(t,e)=>{const n=yg(t,e),i=oa(t,e);return!i||!n?!1:n>i.depth},vT=(t,e)=>{const n=yg(t,e),i=oa(t,e);return!i||!n?!1:n<i.depth},mm=(t,e)=>{if(!Mr(t.state,e)||!YR(t.state,e))return!1;const{selection:n}=t.state,{$from:i,$to:s}=n;return!n.empty&&i.sameParent(s)?!1:bT(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():vT(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},QL=(t,e)=>{var n;const{$anchor:i}=e.selection,s=e.doc.resolve(i.pos-i.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},ST=nt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&mm(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&mm(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:i})=>{t.state.schema.nodes[n]!==void 0&&pm(t,n,i)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:i})=>{t.state.schema.nodes[n]!==void 0&&pm(t,n,i)&&(e=!0)}),e}}}}),jS=/^(\s*)(\d+)\.\s+(.*)$/,JL=/^\s/;function ZL(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function e_(t){const e=[],n=[];let i=!1;return t.forEach(s=>{if(i){n.push(s);return}if(s.trim()===""){i=!0,n.push(s);return}if(e.length>0&&ZL(s)){i=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function t_(t){const e=[];let n=0,i=0;for(;n<t.length;){const s=t[n],o=s.match(jS);if(!o)break;const[,a,u,f]=o,h=a.length,p=[f];let g=n+1;const b=[s];let v=!1;for(;g<t.length;){const S=t[g];if(S.match(jS))break;if(S.trim()==="")b.push(S),p.push(""),v=!0,g+=1;else if(S.match(JL))b.push(S),p.push(S.slice(h+2)),g+=1;else{if(v)break;b.push(S),p.push(S),g+=1}}e.push({indent:h,number:parseInt(u,10),content:p.join(`
197
+ `).trim(),contentLines:p,raw:b.join(`
198
+ `)}),i=g,n=g}return[e,i]}function xT(t,e,n){const i=[];let s=0;for(;s<t.length;){const o=t[s];if(o.indent===e){const{paragraphLines:a,blockLines:u}=e_(o.contentLines),f=a.join(`
199
+ `).trim(),h=[];f&&h.push({type:"paragraph",raw:f,tokens:n.inlineTokens(f)});const p=u.join(`
200
+ `).trim();if(p){const v=n.blockTokens(p);h.push(...v)}let g=s+1;const b=[];for(;g<t.length&&t[g].indent>e;)b.push(t[g]),g+=1;if(b.length>0){const v=Math.min(...b.map(w=>w.indent)),S=xT(b,v,n);h.push({type:"list",ordered:!0,start:b[0].number,items:S,raw:b.map(w=>w.raw).join(`
201
+ `)})}i.push({type:"list_item",raw:o.raw,tokens:h}),s=g}else s+=1}return i}function n_(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const i=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")i.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const o=e.parseChildren([s]);i.push({type:"paragraph",content:o})}else{const o=e.parseChildren([s]);o.length>0&&i.push(...o)}}),{type:"listItem",content:i}})}var i_="listItem",IS="textStyle",VS=/^(\d+)\.\s$/,wT=kt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ze(this.options.HTMLAttributes,n),0]:["ol",Ze(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,i=t.items?n_(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
202
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var i;const s=t.split(`
203
+ `),[o,a]=t_(s);if(o.length===0)return;const u=xT(o,0,n);return u.length===0?void 0:{type:"list",ordered:!0,start:((i=o[0])==null?void 0:i.number)||1,items:u,raw:s.slice(0,a).join(`
204
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i_,this.editor.getAttributes(IS)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Sl({find:VS,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=Sl({find:VS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(IS)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),r_=/^\s*(\[([( |x])?\])\s$/,kT=kt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ze(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const i=e.parseChildren(t.nestedTokens);n.push(...i)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Zm(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:i})=>{const s=document.createElement("li"),o=document.createElement("label"),a=document.createElement("span"),u=document.createElement("input"),f=document.createElement("div"),h=g=>{var b,v;u.ariaLabel=((v=(b=this.options.a11y)==null?void 0:b.checkboxLabel)==null?void 0:v.call(b,g,u.checked))||`Task item checkbox for ${g.textContent||"empty task item"}`};h(t),o.contentEditable="false",u.type="checkbox",u.addEventListener("mousedown",g=>g.preventDefault()),u.addEventListener("change",g=>{if(!i.isEditable&&!this.options.onReadOnlyChecked){u.checked=!u.checked;return}const{checked:b}=g.target;i.isEditable&&typeof n=="function"&&i.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:v})=>{const S=n();if(typeof S!="number")return!1;const w=v.doc.nodeAt(S);return v.setNodeMarkup(S,void 0,{...w==null?void 0:w.attrs,checked:b}),!0}).run(),!i.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,b)||(u.checked=!u.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([g,b])=>{s.setAttribute(g,b)}),s.dataset.checked=t.attrs.checked,u.checked=t.attrs.checked,o.append(u,a),s.append(o,f),Object.entries(e).forEach(([g,b])=>{s.setAttribute(g,b)});let p=new Set(Object.keys(e));return{dom:s,contentDOM:f,update:g=>{if(g.type!==this.type)return!1;s.dataset.checked=g.attrs.checked,u.checked=g.attrs.checked,h(g);const b=i.extensionManager.attributes,v=Qo(g,b),S=new Set(Object.keys(v)),w=this.options.HTMLAttributes;return p.forEach(k=>{S.has(k)||(k in w?s.setAttribute(k,w[k]):s.removeAttribute(k))}),Object.entries(v).forEach(([k,E])=>{E==null?k in w?s.setAttribute(k,w[k]):s.removeAttribute(k):s.setAttribute(k,E)}),p=S,!0}}}},addInputRules(){return[Sl({find:r_,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),TT=kt.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",Ze(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
205
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const i=o=>{const a=Wp(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:u=>({indentLevel:u[1].length,mainContent:u[4],checked:u[3].toLowerCase()==="x"}),createToken:(u,f)=>({type:"taskItem",raw:"",mainContent:u.mainContent,indentLevel:u.indentLevel,checked:u.checked,text:u.mainContent,tokens:n.inlineTokens(u.mainContent),nestedTokens:f}),customNestedParser:i},n);return a?[{type:"taskList",raw:a.raw,items:a.items}]:n.blockTokens(o)},s=Wp(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,a)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:a}),customNestedParser:i},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});nt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(hT.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(pT.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(ST.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(wT.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(kT.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(TT.configure(this.options.taskList)),t}});var Vc="&nbsp;",Tp=" ",s_=kt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ze(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const i=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Vc||n[0].text===Vc||n[0].raw===Tp||n[0].text===Tp)&&i.length===1&&i[0].type==="text"&&(i[0].text===Vc||i[0].text===Tp)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,i)},renderMarkdown:(t,e,n)=>{var i,s;if(!t)return"";const o=Array.isArray(t.content)?t.content:[];if(o.length===0){const a=Array.isArray((i=n==null?void 0:n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&a.length===0?Vc:""}return e.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),l_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,o_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,a_=bs.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",Ze(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vl({find:l_,type:this.type})]},addPasteRules(){return[hs({find:o_,type:this.type})]}}),c_=kt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),u_=bs.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",Ze(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function f_(t={}){return new Ye({view(e){return new d_(e,t)}})}class d_{constructor(e,n){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=n.width)!==null&&i!==void 0?i:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=a=>{this[s](a)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}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,i,s=this.editorView.dom,o=s.getBoundingClientRect(),a=o.width/s.offsetWidth,u=o.height/s.offsetHeight;if(n){let g=e.nodeBefore,b=e.nodeAfter;if(g||b){let v=this.editorView.nodeDOM(this.cursorPos-(g?g.nodeSize:0));if(v){let S=v.getBoundingClientRect(),w=g?S.bottom:S.top;g&&b&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*u;i={left:S.left,right:S.right,top:w-k,bottom:w+k}}}}if(!i){let g=this.editorView.coordsAtPos(this.cursorPos),b=this.width/2*a;i={left:g.left-b,right:g.left+b,top:g.top,bottom:g.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.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 h,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")h=-pageXOffset,p=-pageYOffset;else{let g=f.getBoundingClientRect(),b=g.width/f.offsetWidth,v=g.height/f.offsetHeight;h=g.left-f.scrollLeft*b,p=g.top-f.scrollTop*v}this.element.style.left=(i.left-h)/a+"px",this.element.style.top=(i.top-p)/u+"px",this.element.style.width=(i.right-i.left)/a+"px",this.element.style.height=(i.bottom-i.top)/u+"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}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=i&&i.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!o){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let u=Dx(this.editorView.state.doc,a,this.editorView.dragging.slice);u!=null&&(a=u)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class lt extends he{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return lt.valid(i)?new lt(i):he.near(i)}content(){return F.empty}eq(e){return e instanceof lt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new lt(e.resolve(n.pos))}getBookmark(){return new bg(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!h_(e)||!p_(e))return!1;let i=n.type.spec.allowGapCursor;if(i!=null)return i;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,i=!1){e:for(;;){if(!i&&lt.valid(e))return e;let s=e.pos,o=null;for(let a=e.depth;;a--){let u=e.node(a);if(n>0?e.indexAfter(a)<u.childCount:e.index(a)>0){o=u.child(n>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;s+=n;let f=e.doc.resolve(s);if(lt.valid(f))return f}for(;;){let a=n>0?o.firstChild:o.lastChild;if(!a){if(o.isAtom&&!o.isText&&!oe.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*n),i=!1;continue e}break}o=a,s+=n;let u=e.doc.resolve(s);if(lt.valid(u))return u}return null}}}lt.prototype.visible=!1;lt.findFrom=lt.findGapCursorFrom;he.jsonID("gapcursor",lt);class bg{constructor(e){this.pos=e}map(e){return new bg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return lt.valid(n)?new lt(n):he.near(n)}}function ET(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function h_(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),i=t.node(e);if(n==0){if(i.type.spec.isolating)return!0;continue}for(let s=i.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||ET(s.type))return!0;if(s.inlineContent)return!1}}return!0}function p_(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),i=t.node(e);if(n==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let s=i.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||ET(s.type))return!0;if(s.inlineContent)return!1}}return!0}function m_(){return new Ye({props:{decorations:v_,createSelectionBetween(t,e,n){return e.pos==n.pos&&lt.valid(n)?new lt(n):null},handleClick:y_,handleKeyDown:g_,handleDOMEvents:{beforeinput:b_}}})}const g_=Vm({ArrowLeft:$c("horiz",-1),ArrowRight:$c("horiz",1),ArrowUp:$c("vert",-1),ArrowDown:$c("vert",1)});function $c(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,s,o){let a=i.selection,u=e>0?a.$to:a.$from,f=a.empty;if(a instanceof ce){if(!o.endOfTextblock(n)||u.depth==0)return!1;f=!1,u=i.doc.resolve(e>0?u.after():u.before())}let h=lt.findGapCursorFrom(u,e,f);return h?(s&&s(i.tr.setSelection(new lt(h))),!0):!1}}function y_(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!lt.valid(i))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&oe.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new lt(i))),!0)}function b_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof lt))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let s=G.empty;for(let a=i.length-1;a>=0;a--)s=G.from(i[a].createAndFill(null,s));let o=t.state.tr.replace(n.pos,n.pos,new F(s,0,0));return o.setSelection(ce.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function v_(t){if(!(t.selection instanceof lt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Xe.create(t.doc,[St.widget(t.selection.head,e,{key:"gapcursor"})])}var Ku=200,wt=function(){};wt.prototype.append=function(e){return e.length?(e=wt.from(e),!this.length&&e||e.length<Ku&&this.leafAppend(e)||this.length<Ku&&e.leafPrepend(this)||this.appendInner(e)):this};wt.prototype.prepend=function(e){return e.length?wt.from(e).append(this):this};wt.prototype.appendInner=function(e){return new S_(this,e)};wt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?wt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};wt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};wt.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)};wt.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var s=[];return this.forEach(function(o,a){return s.push(e(o,a))},n,i),s};wt.from=function(e){return e instanceof wt?e:e&&e.length?new CT(e):wt.empty};var CT=(function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,a,u){for(var f=o;f<a;f++)if(s(this.values[f],u+f)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,a,u){for(var f=o-1;f>=a;f--)if(s(this.values[f],u+f)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Ku)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ku)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(wt);wt.empty=new CT([]);var S_=(function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.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(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,s,o,a){var u=this.left.length;if(s<u&&this.left.forEachInner(i,s,Math.min(o,u),a)===!1||o>u&&this.right.forEachInner(i,Math.max(s-u,0),Math.min(this.length,o)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){var u=this.left.length;if(s>u&&this.right.forEachInvertedInner(i,s-u,Math.max(o,u)-u,a+u)===!1||o<u&&this.left.forEachInvertedInner(i,Math.min(s,u),o,a)===!1)return!1},e.prototype.sliceInner=function(i,s){if(i==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(i,s):i>=o?this.right.slice(i-o,s-o):this.left.slice(i,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(i){var s=this.right.leafAppend(i);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(i){var s=this.left.leafPrepend(i);if(s)return new e(s,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(wt);const x_=500;class Bn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let s,o;n&&(s=this.remapping(i,this.items.length),o=s.maps.length);let a=e.tr,u,f,h=[],p=[];return this.items.forEach((g,b)=>{if(!g.step){s||(s=this.remapping(i,b+1),o=s.maps.length),o--,p.push(g);return}if(s){p.push(new Wn(g.map));let v=g.step.map(s.slice(o)),S;v&&a.maybeStep(v).doc&&(S=a.mapping.maps[a.mapping.maps.length-1],h.push(new Wn(S,void 0,void 0,h.length+p.length))),o--,S&&s.appendMap(S,o)}else a.maybeStep(g.step);if(g.selection)return u=s?g.selection.map(s.slice(o)):g.selection,f=new Bn(this.items.slice(0,i).append(p.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:u}}addTransform(e,n,i,s){let o=[],a=this.eventCount,u=this.items,f=!s&&u.length?u.get(u.length-1):null;for(let p=0;p<e.steps.length;p++){let g=e.steps[p].invert(e.docs[p]),b=new Wn(e.mapping.maps[p],g,n),v;(v=f&&f.merge(b))&&(b=v,p?o.pop():u=u.slice(0,u.length-1)),o.push(b),n&&(a++,n=void 0),s||(f=b)}let h=a-i.depth;return h>k_&&(u=w_(u,h),a-=h),new Bn(u.append(o),a)}remapping(e,n){let i=new Ko;return this.items.forEach((s,o)=>{let a=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?i.maps.length-s.mirrorOffset:void 0;i.appendMap(s.map,a)},e,n),i}addMaps(e){return this.eventCount==0?this:new Bn(this.items.append(e.map(n=>new Wn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],s=Math.max(0,this.items.length-n),o=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(b=>{b.selection&&u--},s);let f=n;this.items.forEach(b=>{let v=o.getMirror(--f);if(v==null)return;a=Math.min(a,v);let S=o.maps[v];if(b.step){let w=e.steps[v].invert(e.docs[v]),k=b.selection&&b.selection.map(o.slice(f+1,v));k&&u++,i.push(new Wn(S,w,k))}else i.push(new Wn(S))},s);let h=[];for(let b=n;b<a;b++)h.push(new Wn(o.maps[b]));let p=this.items.slice(0,s).append(h).append(i),g=new Bn(p,u);return g.emptyItemCount()>x_&&(g=g.compress(this.items.length-i.length)),g}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,s=[],o=0;return this.items.forEach((a,u)=>{if(u>=e)s.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(n.slice(i)),h=f&&f.getMap();if(i--,h&&n.appendMap(h,i),f){let p=a.selection&&a.selection.map(n.slice(i));p&&o++;let g=new Wn(h.invert(),f,p),b,v=s.length-1;(b=s.length&&s[v].merge(g))?s[v]=b:s.push(g)}}else a.map&&i--},this.items.length,0),new Bn(wt.from(s.reverse()),o)}}Bn.empty=new Bn(wt.empty,0);function w_(t,e){let n;return t.forEach((i,s)=>{if(i.selection&&e--==0)return n=s,!1}),t.slice(n)}class Wn{constructor(e,n,i,s){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Wn(n.getMap().invert(),n,this.selection)}}}class hr{constructor(e,n,i,s,o){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=s,this.prevComposition=o}}const k_=20;function T_(t,e,n,i){let s=n.getMeta(as),o;if(s)return s.historyState;n.getMeta(M_)&&(t=new hr(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(as))return a.getMeta(as).redo?new hr(t.done.addTransform(n,void 0,i,Jc(e)),t.undone,$S(n.mapping.maps),t.prevTime,t.prevComposition):new hr(t.done,t.undone.addTransform(n,void 0,i,Jc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=n.getMeta("composition"),f=t.prevTime==0||!a&&t.prevComposition!=u&&(t.prevTime<(n.time||0)-i.newGroupDelay||!E_(n,t.prevRanges)),h=a?Ep(t.prevRanges,n.mapping):$S(n.mapping.maps);return new hr(t.done.addTransform(n,f?e.selection.getBookmark():void 0,i,Jc(e)),Bn.empty,h,n.time,u??t.prevComposition)}else return(o=n.getMeta("rebased"))?new hr(t.done.rebased(n,o),t.undone.rebased(n,o),Ep(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new hr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ep(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function E_(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,s)=>{for(let o=0;o<e.length;o+=2)i<=e[o+1]&&s>=e[o]&&(n=!0)}),n}function $S(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,s,o,a)=>e.push(o,a));return e}function Ep(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let s=e.map(t[i],1),o=e.map(t[i+1],-1);s<=o&&n.push(s,o)}return n}function C_(t,e,n){let i=Jc(e),s=as.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,i);if(!o)return null;let a=o.selection.resolve(o.transform.doc),u=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),s,i),f=new hr(n?u:o.remaining,n?o.remaining:u,null,0,-1);return o.transform.setSelection(a).setMeta(as,{redo:n,historyState:f})}let Cp=!1,qS=null;function Jc(t){let e=t.plugins;if(qS!=e){Cp=!1,qS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Cp=!0;break}}return Cp}const as=new et("history"),M_=new et("closeHistory");function A_(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ye({key:as,state:{init(){return new hr(Bn.empty,Bn.empty,null,0,-1)},apply(e,n,i){return T_(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,s=i=="historyUndo"?AT:i=="historyRedo"?OT:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function MT(t,e){return(n,i)=>{let s=as.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(i){let o=C_(s,n,t);o&&i(e?o.scrollIntoView():o)}return!0}}const AT=MT(!1,!0),OT=MT(!0,!0);nt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const i=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(i)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ye({key:new et("characterCount"),appendTransaction:(e,n,i)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const o=this.storage.characters({node:i.doc});if(o>s){const a=o-s,u=0,f=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const h=i.tr.deleteRange(u,f);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const i=this.options.limit;if(!e.docChanged||i===0||i===null||i===void 0)return!0;const s=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=i||s>i&&o>i&&o<=s)return!0;if(s>i&&o>i&&o>s||!e.getMeta("paste"))return!1;const u=e.selection.$head.pos,f=o-i,h=u-f,p=u;return e.deleteRange(h,p),!(this.storage.characters({node:e.doc})>i)}})]}});var O_=nt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[f_(this.options)]}});nt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ye({key:new et("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:i}=this.editor,{anchor:s}=e,o=[];if(!n||!i)return Xe.create(t,[]);let a=0;this.options.mode==="deepest"&&t.descendants((f,h)=>{if(f.isText)return;if(!(s>=h&&s<=h+f.nodeSize-1))return!1;a+=1});let u=0;return t.descendants((f,h)=>{if(f.isText||!(s>=h&&s<=h+f.nodeSize-1))return!1;if(u+=1,this.options.mode==="deepest"&&a-u>0||this.options.mode==="shallowest"&&u>1)return this.options.mode==="deepest";o.push(St.node(h,h+f.nodeSize,{class:this.options.className}))}),Xe.create(t,o)}}})]}});var N_=nt.create({name:"gapCursor",addProseMirrorPlugins(){return[m_()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=_e(le(t,"allowGapCursor",n)))!=null?e:null}}}),PS="placeholder";function R_(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var D_=nt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:PS,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${R_(this.options.dataAttribute)}`:`data-${PS}`;return[new Ye({key:new et("placeholder"),props:{decorations:({doc:e,selection:n})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,o=[];if(!i)return null;const a=this.editor.isEmpty;return e.descendants((u,f)=>{const h=s>=f&&s<=f+u.nodeSize,p=!u.isLeaf&&uf(u);if(!u.type.isTextblock)return this.options.includeChildren;if((h||!this.options.showOnlyCurrent)&&p){const g=[this.options.emptyNodeClass];a&&g.push(this.options.emptyEditorClass);const b=St.node(f,f+u.nodeSize,{class:g.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:u,pos:f,hasAnchor:h}):this.options.placeholder});o.push(b)}return this.options.includeChildren}),Xe.create(e,o)}}})]}});nt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ye({key:new et("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Xw(n.selection)||t.view.dragging?null:Xe.create(n.doc,[St.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var z_="skipTrailingNode";function KS({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var L_=nt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new et(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Ye({key:e,appendTransaction:(s,o,a)=>{const{doc:u,tr:f,schema:h}=a,p=e.getState(a),g=u.content.size,b=h.nodes[n];if(!s.some(v=>v.getMeta(z_))&&p)return f.insert(g,b.create())},state:{init:(s,o)=>{const a=o.tr.doc.lastChild;return!KS({node:a,types:i})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const a=s.doc.lastChild;return!KS({node:a,types:i})}}})]}}),__=nt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>AT(t,e),redo:()=>({state:t,dispatch:e})=>OT(t,e)}},addProseMirrorPlugins(){return[A_(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()}}}),B_=nt.create({name:"starterKit",addExtensions(){var t,e,n,i;const s=[];return this.options.bold!==!1&&s.push(sL.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(eL.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(hT.configure(this.options.bulletList)),this.options.code!==!1&&s.push(aL.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(fL.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(dL.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(O_.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(N_.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(hL.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(pL.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(__.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(mL.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(SL.configure(this.options.italic)),this.options.listItem!==!1&&s.push(pT.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(ST.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(dT.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(wT.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(s_.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(a_.configure(this.options.strike)),this.options.text!==!1&&s.push(c_.configure(this.options.text)),this.options.underline!==!1&&s.push(u_.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(L_.configure((i=this.options)==null?void 0:i.trailingNode)),s}}),H_=B_,U_=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,j_=kt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},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},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ze(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,i,s,o,a;const u=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",f=(s=(i=t.attrs)==null?void 0:i.alt)!=null?s:"",h=(a=(o=t.attrs)==null?void 0:o.title)!=null?a:"";return h?`![${f}](${u} "${h}")`:`![${f}](${u})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:i}=this.options.resize;return({node:s,getPos:o,HTMLAttributes:a,editor:u})=>{const f=document.createElement("img");Object.entries(a).forEach(([g,b])=>{if(b!=null)switch(g){case"width":case"height":break;default:f.setAttribute(g,b);break}}),f.src=a.src;const h=new _D({element:f,editor:u,node:s,getPos:o,onResize:(g,b)=>{f.style.width=`${g}px`,f.style.height=`${b}px`},onCommit:(g,b)=>{const v=o();v!==void 0&&this.editor.chain().setNodeSelection(v).updateAttributes(this.name,{width:g,height:b}).run()},onUpdate:(g,b,v)=>g.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:i===!0}}),p=h.dom;return p.style.visibility="hidden",p.style.pointerEvents="none",f.onload=()=>{p.style.visibility="",p.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[dk({find:U_,type:this.type,getAttributes:t=>{const[,,e,n,i]=t;return{src:n,alt:e,title:i}}})]}});function Gu(t){return t==="left"||t==="right"||t==="center"?t:null}function I_(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return Gu(e||n)}function V_(t){return Gu(t==null?void 0:t.align)}function NT(){return{default:null,parseHTML:t=>I_(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}var RT=kt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const i=t.getAttribute("colwidth"),s=i?i.split(",").map(o=>parseInt(o,10)):null;if(!s){const o=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),a=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(a&&a>-1&&o&&o[a]){const u=o[a].getAttribute("width");return u?[parseInt(u,10)]:null}}return s}},align:NT()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ze(this.options.HTMLAttributes,t),0]}}),DT=kt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(i=>parseInt(i,10)):null}},align:NT()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ze(this.options.HTMLAttributes,t),0]}}),zT=kt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ze(this.options.HTMLAttributes,t),0]}});function gm(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function GS(t,e,n,i,s,o){var a;let u=0,f=!0,h=e.firstChild;const p=t.firstChild;if(p!==null)for(let b=0,v=0;b<p.childCount;b+=1){const{colspan:S,colwidth:w}=p.child(b).attrs;for(let k=0;k<S;k+=1,v+=1){const E=s===v?o:w&&w[k],N=E?`${E}px`:"";if(u+=E||i,E||(f=!1),h){if(h.style.width!==N){const[L,V]=gm(i,E);h.style.setProperty(L,V)}h=h.nextSibling}else{const L=document.createElement("col"),[V,I]=gm(i,E);L.style.setProperty(V,I),e.appendChild(L)}}}for(;h;){const b=h.nextSibling;(a=h.parentNode)==null||a.removeChild(h),h=b}const g=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);f&&!g?(n.style.width=`${u}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${u}px`)}var $_=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),GS(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,GS(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),i=this.contentDOM.contains(e);return!!(n&&!i&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function q_(t,e,n,i){let s=0,o=!0;const a=[],u=t.firstChild;if(!u)return{};for(let g=0,b=0;g<u.childCount;g+=1){const{colspan:v,colwidth:S}=u.child(g).attrs;for(let w=0;w<v;w+=1,b+=1){const k=n===b?i:S&&S[w];s+=k||e,k||(o=!1);const[E,N]=gm(e,k);a.push(["col",{style:`${E}: ${N}`}])}}const f=o?`${s}px`:"",h=o?"":`${s}px`;return{colgroup:["colgroup",{},...a],tableWidth:f,tableMinWidth:h}}function YS(t,e){return t.createAndFill()}function P_(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const i=t.nodes[n];i.spec.tableRole&&(e[i.spec.tableRole]=i)}),t.cached.tableNodeTypes=e,e}function K_(t,e,n,i,s){const o=P_(t),a=[],u=[];for(let h=0;h<n;h+=1){const p=YS(o.cell);if(p&&u.push(p),i){const g=YS(o.header_cell);g&&a.push(g)}}const f=[];for(let h=0;h<e;h+=1)f.push(o.row.createChecked(null,i&&h===0?a:u));return o.table.createChecked(null,f)}function G_(t){return t instanceof Ge}var qc=({editor:t})=>{const{selection:e}=t.state;if(!G_(e))return!1;let n=0;const i=Iw(e.ranges[0].$from,o=>o.type.name==="table");return i==null||i.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Y_="";function X_(t){return(t||"").replace(/\s+/g," ").trim()}function F_(t,e,n={}){var i;const s=(i=n.cellLineSeparator)!=null?i:Y_;if(!t||!t.content||t.content.length===0)return"";const o=[];t.content.forEach(w=>{const k=[];w.content&&w.content.forEach(E=>{let N="";E.content&&Array.isArray(E.content)&&E.content.length>1?N=E.content.map(H=>e.renderChildren(H)).join(s):N=E.content?e.renderChildren(E.content):"";const L=X_(N),V=E.type==="tableHeader",I=V_(E.attrs);k.push({text:L,isHeader:V,align:I})}),o.push(k)});const a=o.reduce((w,k)=>Math.max(w,k.length),0);if(a===0)return"";const u=new Array(a).fill(0);o.forEach(w=>{var k;for(let E=0;E<a;E+=1){const L=(((k=w[E])==null?void 0:k.text)||"").length;L>u[E]&&(u[E]=L),u[E]<3&&(u[E]=3)}});const f=(w,k)=>w+" ".repeat(Math.max(0,k-w.length)),h=o[0],p=h.some(w=>w.isHeader),g=new Array(a).fill(null);o.forEach(w=>{var k;for(let E=0;E<a;E+=1)!g[E]&&((k=w[E])!=null&&k.align)&&(g[E]=w[E].align)});let b=`
206
+ `;const v=new Array(a).fill(0).map((w,k)=>p&&h[k]&&h[k].text||"");return b+=`| ${v.map((w,k)=>f(w,u[k])).join(" | ")} |
207
+ `,b+=`| ${u.map((w,k)=>{const E=Math.max(3,w),N=g[k];return N==="left"?`:${"-".repeat(E)}`:N==="right"?`${"-".repeat(E)}:`:N==="center"?`:${"-".repeat(E)}:`:"-".repeat(E)}).join(" | ")} |
208
+ `,(p?o.slice(1):o).forEach(w=>{b+=`| ${new Array(a).fill(0).map((k,E)=>f(w[E]&&w[E].text||"",u[E])).join(" | ")} |
209
+ `}),b}var W_=F_,LT=kt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:$_,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:i,tableMinWidth:s}=q_(t,this.options.cellMinWidth),o=e.style;function a(){return o||(i?`width: ${i}`:`min-width: ${s}`)}const u=["table",Ze(this.options.HTMLAttributes,e,{style:a()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},u]:u},parseMarkdown:(t,e)=>{const n=[],i=Array.isArray(t.align)?t.align:[];if(t.header){const s=[];t.header.forEach((o,a)=>{var u;const f=Gu((u=i[a])!=null?u:o.align),h=f?{align:f}:{};s.push(e.createNode("tableHeader",h,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const o=[];s.forEach((a,u)=>{var f;const h=Gu((f=i[u])!=null?f:a.align),p=h?{align:h}:{};o.push(e.createNode("tableCell",p,[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>W_(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:i,dispatch:s,editor:o})=>{const a=K_(o.schema,t,e,n);if(s){const u=i.selection.from+1;i.replaceSelectionWith(a).scrollIntoView().setSelection(ce.near(i.doc.resolve(u)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Xz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Fz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Qz(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Zz(t,e),addRowAfter:()=>({state:t,dispatch:e})=>e3(t,e),deleteRow:()=>({state:t,dispatch:e})=>n3(t,e),deleteTable:()=>({state:t,dispatch:e})=>c3(t,e),mergeCells:()=>({state:t,dispatch:e})=>bS(t,e),splitCell:()=>({state:t,dispatch:e})=>vS(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Zo("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Zo("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>o3(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>bS(t,e)?!0:vS(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:i})=>s3(t,e)(n,i),goToNextCell:()=>({state:t,dispatch:e})=>xS(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>xS(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Gk(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const i=Ge.create(e.doc,t.anchorCell,t.headCell);e.setSelection(i)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:qc,"Mod-Backspace":qc,Delete:qc,"Mod-Delete":qc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[v3({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],O3({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:i})=>new e(n,this.options.cellMinWidth,i)},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:_e(le(t,"tableRole",e))}}});nt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(LT.configure(this.options.table)),this.options.tableCell!==!1&&t.push(RT.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(DT.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(zT.configure(this.options.tableRow)),t}});function vg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ss=vg();function _T(t){Ss=t}var $o={exec:()=>null};function Be(t,e=""){let n=typeof t=="string"?t:t.source;const i={replace:(s,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(Vt.caret,"$1"),n=n.replace(s,a),i},getRegex:()=>new RegExp(n,e)};return i}var Vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Q_=/^(?:[ \t]*(?:\n|$))+/,J_=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Z_=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,aa=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,eB=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Sg=/(?:[*+-]|\d{1,9}[.)])/,BT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,HT=Be(BT).replace(/bull/g,Sg).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tB=Be(BT).replace(/bull/g,Sg).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xg=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nB=/^[^\n]+/,wg=/(?!\s*\])(?:\\.|[^\[\]\\])+/,iB=Be(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wg).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rB=Be(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Sg).getRegex(),vf="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",kg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sB=Be("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",kg).replace("tag",vf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),UT=Be(xg).replace("hr",aa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vf).getRegex(),lB=Be(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",UT).getRegex(),Tg={blockquote:lB,code:J_,def:iB,fences:Z_,heading:eB,hr:aa,html:sB,lheading:HT,list:rB,newline:Q_,paragraph:UT,table:$o,text:nB},XS=Be("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",aa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vf).getRegex(),oB={...Tg,lheading:tB,table:XS,paragraph:Be(xg).replace("hr",aa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",XS).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vf).getRegex()},aB={...Tg,html:Be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",kg).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$o,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Be(xg).replace("hr",aa).replace("heading",` *#{1,6} *[^
210
+ ]`).replace("lheading",HT).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cB=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,uB=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,jT=/^( {2,}|\\)\n(?!\s*$)/,fB=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Sf=/[\p{P}\p{S}]/u,Eg=/[\s\p{P}\p{S}]/u,IT=/[^\s\p{P}\p{S}]/u,dB=Be(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Eg).getRegex(),VT=/(?!~)[\p{P}\p{S}]/u,hB=/(?!~)[\s\p{P}\p{S}]/u,pB=/(?:[^\s\p{P}\p{S}]|~)/u,mB=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,$T=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,gB=Be($T,"u").replace(/punct/g,Sf).getRegex(),yB=Be($T,"u").replace(/punct/g,VT).getRegex(),qT="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bB=Be(qT,"gu").replace(/notPunctSpace/g,IT).replace(/punctSpace/g,Eg).replace(/punct/g,Sf).getRegex(),vB=Be(qT,"gu").replace(/notPunctSpace/g,pB).replace(/punctSpace/g,hB).replace(/punct/g,VT).getRegex(),SB=Be("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,IT).replace(/punctSpace/g,Eg).replace(/punct/g,Sf).getRegex(),xB=Be(/\\(punct)/,"gu").replace(/punct/g,Sf).getRegex(),wB=Be(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kB=Be(kg).replace("(?:-->|$)","-->").getRegex(),TB=Be("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",kB).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Yu=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,EB=Be(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Yu).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),PT=Be(/^!?\[(label)\]\[(ref)\]/).replace("label",Yu).replace("ref",wg).getRegex(),KT=Be(/^!?\[(ref)\](?:\[\])?/).replace("ref",wg).getRegex(),CB=Be("reflink|nolink(?!\\()","g").replace("reflink",PT).replace("nolink",KT).getRegex(),Cg={_backpedal:$o,anyPunctuation:xB,autolink:wB,blockSkip:mB,br:jT,code:uB,del:$o,emStrongLDelim:gB,emStrongRDelimAst:bB,emStrongRDelimUnd:SB,escape:cB,link:EB,nolink:KT,punctuation:dB,reflink:PT,reflinkSearch:CB,tag:TB,text:fB,url:$o},MB={...Cg,link:Be(/^!?\[(label)\]\((.*?)\)/).replace("label",Yu).getRegex(),reflink:Be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Yu).getRegex()},ym={...Cg,emStrongRDelimAst:vB,emStrongLDelim:yB,url:Be(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},AB={...ym,br:Be(jT).replace("{2,}","*").getRegex(),text:Be(ym.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Pc={normal:Tg,gfm:oB,pedantic:aB},To={normal:Cg,gfm:ym,breaks:AB,pedantic:MB},OB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},FS=t=>OB[t];function Yn(t,e){if(e){if(Vt.escapeTest.test(t))return t.replace(Vt.escapeReplace,FS)}else if(Vt.escapeTestNoEncode.test(t))return t.replace(Vt.escapeReplaceNoEncode,FS);return t}function WS(t){try{t=encodeURI(t).replace(Vt.percentDecode,"%")}catch{return null}return t}function QS(t,e){var o;const n=t.replace(Vt.findPipe,(a,u,f)=>{let h=!1,p=u;for(;--p>=0&&f[p]==="\\";)h=!h;return h?"|":" |"}),i=n.split(Vt.splitPipe);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!((o=i.at(-1))!=null&&o.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(Vt.slashPipe,"|");return i}function Eo(t,e,n){const i=t.length;if(i===0)return"";let s=0;for(;s<i&&t.charAt(i-s-1)===e;)s++;return t.slice(0,i-s)}function NB(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])n++;else if(t[i]===e[1]&&(n--,n<0))return i;return n>0?-2:-1}function JS(t,e,n,i,s){const o=e.href,a=e.title||null,u=t[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;const f={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:a,text:u,tokens:i.inlineTokens(u)};return i.state.inLink=!1,f}function RB(t,e,n){const i=t.match(n.other.indentCodeCompensation);if(i===null)return e;const s=i[1];return e.split(`
211
+ `).map(o=>{const a=o.match(n.other.beginningSpace);if(a===null)return o;const[u]=a;return u.length>=s.length?o.slice(s.length):o}).join(`
212
+ `)}var Xu=class{constructor(t){Pe(this,"options");Pe(this,"rules");Pe(this,"lexer");this.options=t||Ss}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Eo(n,`
213
+ `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],i=RB(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const i=Eo(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Eo(e[0],`
214
+ `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=Eo(e[0],`
215
+ `).split(`
216
+ `),i="",s="";const o=[];for(;n.length>0;){let a=!1;const u=[];let f;for(f=0;f<n.length;f++)if(this.rules.other.blockquoteStart.test(n[f]))u.push(n[f]),a=!0;else if(!a)u.push(n[f]);else break;n=n.slice(f);const h=u.join(`
217
+ `),p=h.replace(this.rules.other.blockquoteSetextReplace,`
218
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
219
+ ${h}`:h,s=s?`${s}
220
+ ${p}`:p;const g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,o,!0),this.lexer.state.top=g,n.length===0)break;const b=o.at(-1);if((b==null?void 0:b.type)==="code")break;if((b==null?void 0:b.type)==="blockquote"){const v=b,S=v.raw+`
221
+ `+n.join(`
222
+ `),w=this.blockquote(S);o[o.length-1]=w,i=i.substring(0,i.length-v.raw.length)+w.raw,s=s.substring(0,s.length-v.text.length)+w.text;break}else if((b==null?void 0:b.type)==="list"){const v=b,S=v.raw+`
223
+ `+n.join(`
224
+ `),w=this.list(S);o[o.length-1]=w,i=i.substring(0,i.length-b.raw.length)+w.raw,s=s.substring(0,s.length-v.raw.length)+w.raw,n=S.substring(o.at(-1).raw.length).split(`
225
+ `);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const o=this.rules.other.listItemRegex(n);let a=!1;for(;t;){let f=!1,h="",p="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let g=e[2].split(`
226
+ `,1)[0].replace(this.rules.other.listReplaceTabs,E=>" ".repeat(3*E.length)),b=t.split(`
227
+ `,1)[0],v=!g.trim(),S=0;if(this.options.pedantic?(S=2,p=g.trimStart()):v?S=e[1].length+1:(S=e[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,p=g.slice(S),S+=e[1].length),v&&this.rules.other.blankLine.test(b)&&(h+=b+`
228
+ `,t=t.substring(b.length+1),f=!0),!f){const E=this.rules.other.nextBulletRegex(S),N=this.rules.other.hrRegex(S),L=this.rules.other.fencesBeginRegex(S),V=this.rules.other.headingBeginRegex(S),I=this.rules.other.htmlBeginRegex(S);for(;t;){const C=t.split(`
229
+ `,1)[0];let H;if(b=C,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),H=b):H=b.replace(this.rules.other.tabCharGlobal," "),L.test(b)||V.test(b)||I.test(b)||E.test(b)||N.test(b))break;if(H.search(this.rules.other.nonSpaceChar)>=S||!b.trim())p+=`
230
+ `+H.slice(S);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||L.test(g)||V.test(g)||N.test(g))break;p+=`
231
+ `+b}!v&&!b.trim()&&(v=!0),h+=C+`
232
+ `,t=t.substring(C.length+1),g=H.slice(S)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0));let w=null,k;this.options.gfm&&(w=this.rules.other.listIsTask.exec(p),w&&(k=w[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:h,task:!!w,checked:k,loose:!1,text:p,tokens:[]}),s.raw+=h}const u=s.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let f=0;f<s.items.length;f++)if(this.lexer.state.top=!1,s.items[f].tokens=this.lexer.blockTokens(s.items[f].text,[]),!s.loose){const h=s.items[f].tokens.filter(g=>g.type==="space"),p=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));s.loose=p}if(s.loose)for(let f=0;f<s.items.length;f++)s.items[f].loose=!0;return s}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:i,title:s}}}table(t){var a;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=QS(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
233
+ `):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const u of i)this.rules.other.tableAlignRight.test(u)?o.align.push("right"):this.rules.other.tableAlignCenter.test(u)?o.align.push("center"):this.rules.other.tableAlignLeft.test(u)?o.align.push("left"):o.align.push(null);for(let u=0;u<n.length;u++)o.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:o.align[u]});for(const u of s)o.rows.push(QS(u,o.header.length).map((f,h)=>({text:f,tokens:this.lexer.inline(f),header:!1,align:o.align[h]})));return o}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
234
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const o=Eo(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{const o=NB(e[2],"()");if(o===-2)return;if(o>-1){const u=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,u).trim(),e[3]=""}}let i=e[2],s="";if(this.options.pedantic){const o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),JS(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[i.toLowerCase()];if(!s){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return JS(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const o=[...i[0]].length-1;let a,u,f=o,h=0;const p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*t.length+o);(i=p.exec(e))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(u=[...a].length,i[3]||i[4]){f+=u;continue}else if((i[5]||i[6])&&o%3&&!((o+u)%3)){h+=u;continue}if(f-=u,f>0)continue;u=Math.min(u,u+f+h);const g=[...i[0]][0].length,b=t.slice(0,o+i.index+g+u);if(Math.min(o,u)%2){const S=b.slice(1,-1);return{type:"em",raw:b,text:S,tokens:this.lexer.inlineTokens(S)}}const v=b.slice(2,-2);return{type:"strong",raw:b,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,i;return e[2]==="@"?(n=e[1],i="mailto:"+n):(n=e[1],i=n),{type:"link",raw:e[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let i,s;if(e[2]==="@")i=e[0],s="mailto:"+i;else{let o;do o=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(o!==e[0]);i=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Ni=class bm{constructor(e){Pe(this,"tokens");Pe(this,"options");Pe(this,"state");Pe(this,"tokenizer");Pe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ss,this.options.tokenizer=this.options.tokenizer||new Xu,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:Vt,block:Pc.normal,inline:To.normal};this.options.pedantic?(n.block=Pc.pedantic,n.inline=To.pedantic):this.options.gfm&&(n.block=Pc.gfm,this.options.breaks?n.inline=To.breaks:n.inline=To.gfm),this.tokenizer.rules=n}static get rules(){return{block:Pc,inline:To}}static lex(e,n){return new bm(n).lex(e)}static lexInline(e,n){return new bm(n).inlineTokens(e)}lex(e){e=e.replace(Vt.carriageReturn,`
235
+ `),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],i=!1){var s,o,a;for(this.options.pedantic&&(e=e.replace(Vt.tabCharGlobal," ").replace(Vt.spaceLine,""));e;){let u;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(h=>(u=h.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.space(e)){e=e.substring(u.raw.length);const h=n.at(-1);u.raw.length===1&&h!==void 0?h.raw+=`
236
+ `:n.push(u);continue}if(u=this.tokenizer.code(e)){e=e.substring(u.raw.length);const h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=`
237
+ `+u.raw,h.text+=`
238
+ `+u.text,this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(u=this.tokenizer.fences(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.heading(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.hr(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.blockquote(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.list(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.html(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.def(e)){e=e.substring(u.raw.length);const h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=`
239
+ `+u.raw,h.text+=`
240
+ `+u.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[u.tag]||(this.tokens.links[u.tag]={href:u.href,title:u.title});continue}if(u=this.tokenizer.table(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.lheading(e)){e=e.substring(u.raw.length),n.push(u);continue}let f=e;if((a=this.options.extensions)!=null&&a.startBlock){let h=1/0;const p=e.slice(1);let g;this.options.extensions.startBlock.forEach(b=>{g=b.call({lexer:this},p),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(f=e.substring(0,h+1))}if(this.state.top&&(u=this.tokenizer.paragraph(f))){const h=n.at(-1);i&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=`
241
+ `+u.raw,h.text+=`
242
+ `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u),i=f.length!==e.length,e=e.substring(u.raw.length);continue}if(u=this.tokenizer.text(e)){e=e.substring(u.raw.length);const h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=`
243
+ `+u.raw,h.text+=`
244
+ `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var u,f,h;let i=e,s=null;if(this.tokens.links){const p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,s.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,a="";for(;e;){o||(a=""),o=!1;let p;if((f=(u=this.options.extensions)==null?void 0:u.inline)!=null&&f.some(b=>(p=b.call({lexer:this},e,n))?(e=e.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);const b=n.at(-1);p.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=p.raw,b.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(e,i,a)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),n.push(p);continue}let g=e;if((h=this.options.extensions)!=null&&h.startInline){let b=1/0;const v=e.slice(1);let S;this.options.extensions.startInline.forEach(w=>{S=w.call({lexer:this},v),typeof S=="number"&&S>=0&&(b=Math.min(b,S))}),b<1/0&&b>=0&&(g=e.substring(0,b+1))}if(p=this.tokenizer.inlineText(g)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(a=p.raw.slice(-1)),o=!0;const b=n.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=p.raw,b.text+=p.text):n.push(p);continue}if(e){const b="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(b);break}else throw new Error(b)}}return n}},Fu=class{constructor(t){Pe(this,"options");Pe(this,"parser");this.options=t||Ss}space(t){return""}code({text:t,lang:e,escaped:n}){var o;const i=(o=(e||"").match(Vt.notSpaceStart))==null?void 0:o[0],s=t.replace(Vt.endingNewline,"")+`
245
+ `;return i?'<pre><code class="language-'+Yn(i)+'">'+(n?s:Yn(s,!0))+`</code></pre>
246
+ `:"<pre><code>"+(n?s:Yn(s,!0))+`</code></pre>
247
+ `}blockquote({tokens:t}){return`<blockquote>
248
+ ${this.parser.parse(t)}</blockquote>
249
+ `}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
250
+ `}hr(t){return`<hr>
251
+ `}list(t){const e=t.ordered,n=t.start;let i="";for(let a=0;a<t.items.length;a++){const u=t.items[a];i+=this.listitem(u)}const s=e?"ol":"ul",o=e&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
252
+ `+i+"</"+s+`>
253
+ `}listitem(t){var n;let e="";if(t.task){const i=this.checkbox({checked:!!t.checked});t.loose?((n=t.tokens[0])==null?void 0:n.type)==="paragraph"?(t.tokens[0].text=i+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=i+" "+Yn(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):e+=i+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
254
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
255
+ `}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let i="";for(let s=0;s<t.rows.length;s++){const o=t.rows[s];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
256
+ <thead>
257
+ `+e+`</thead>
258
+ `+i+`</table>
259
+ `}tablerow({text:t}){return`<tr>
260
+ ${t}</tr>
261
+ `}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
262
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Yn(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const i=this.parser.parseInline(n),s=WS(t);if(s===null)return i;t=s;let o='<a href="'+t+'"';return e&&(o+=' title="'+Yn(e)+'"'),o+=">"+i+"</a>",o}image({href:t,title:e,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));const s=WS(t);if(s===null)return Yn(n);t=s;let o=`<img src="${t}" alt="${n}"`;return e&&(o+=` title="${Yn(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Yn(t.text)}},Mg=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Ri=class vm{constructor(e){Pe(this,"options");Pe(this,"renderer");Pe(this,"textRenderer");this.options=e||Ss,this.options.renderer=this.options.renderer||new Fu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Mg}static parse(e,n){return new vm(n).parse(e)}static parseInline(e,n){return new vm(n).parseInline(e)}parse(e,n=!0){var s,o;let i="";for(let a=0;a<e.length;a++){const u=e[a];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[u.type]){const h=u,p=this.options.extensions.renderers[h.type].call({parser:this},h);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(h.type)){i+=p||"";continue}}const f=u;switch(f.type){case"space":{i+=this.renderer.space(f);continue}case"hr":{i+=this.renderer.hr(f);continue}case"heading":{i+=this.renderer.heading(f);continue}case"code":{i+=this.renderer.code(f);continue}case"table":{i+=this.renderer.table(f);continue}case"blockquote":{i+=this.renderer.blockquote(f);continue}case"list":{i+=this.renderer.list(f);continue}case"html":{i+=this.renderer.html(f);continue}case"paragraph":{i+=this.renderer.paragraph(f);continue}case"text":{let h=f,p=this.renderer.text(h);for(;a+1<e.length&&e[a+1].type==="text";)h=e[++a],p+=`
263
+ `+this.renderer.text(h);n?i+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):i+=p;continue}default:{const h='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(e,n=this.renderer){var s,o;let i="";for(let a=0;a<e.length;a++){const u=e[a];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[u.type]){const h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)){i+=h||"";continue}}const f=u;switch(f.type){case"escape":{i+=n.text(f);break}case"html":{i+=n.html(f);break}case"link":{i+=n.link(f);break}case"image":{i+=n.image(f);break}case"strong":{i+=n.strong(f);break}case"em":{i+=n.em(f);break}case"codespan":{i+=n.codespan(f);break}case"br":{i+=n.br(f);break}case"del":{i+=n.del(f);break}case"text":{i+=n.text(f);break}default:{const h='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},Np,Zc=(Np=class{constructor(t){Pe(this,"options");Pe(this,"block");this.options=t||Ss}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ni.lex:Ni.lexInline}provideParser(){return this.block?Ri.parse:Ri.parseInline}},Pe(Np,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Np),DB=class{constructor(...t){Pe(this,"defaults",vg());Pe(this,"options",this.setOptions);Pe(this,"parse",this.parseMarkdown(!0));Pe(this,"parseInline",this.parseMarkdown(!1));Pe(this,"Parser",Ri);Pe(this,"Renderer",Fu);Pe(this,"TextRenderer",Mg);Pe(this,"Lexer",Ni);Pe(this,"Tokenizer",Xu);Pe(this,"Hooks",Zc);this.use(...t)}walkTokens(t,e){var i,s;let n=[];for(const o of t)switch(n=n.concat(e.call(this,o)),o.type){case"table":{const a=o;for(const u of a.header)n=n.concat(this.walkTokens(u.tokens,e));for(const u of a.rows)for(const f of u)n=n.concat(this.walkTokens(f.tokens,e));break}case"list":{const a=o;n=n.concat(this.walkTokens(a.items,e));break}default:{const a=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(u=>{const f=a[u].flat(1/0);n=n.concat(this.walkTokens(f,e))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const o=e.renderers[s.name];o?e.renderers[s.name]=function(...a){let u=s.renderer.apply(this,a);return u===!1&&(u=o.apply(this,a)),u}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=e[s.level];o?o.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),i.extensions=e),n.renderer){const s=this.defaults.renderer||new Fu(this.defaults);for(const o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;const a=o,u=n.renderer[a],f=s[a];s[a]=(...h)=>{let p=u.apply(s,h);return p===!1&&(p=f.apply(s,h)),p||""}}i.renderer=s}if(n.tokenizer){const s=this.defaults.tokenizer||new Xu(this.defaults);for(const o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const a=o,u=n.tokenizer[a],f=s[a];s[a]=(...h)=>{let p=u.apply(s,h);return p===!1&&(p=f.apply(s,h)),p}}i.tokenizer=s}if(n.hooks){const s=this.defaults.hooks||new Zc;for(const o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;const a=o,u=n.hooks[a],f=s[a];Zc.passThroughHooks.has(o)?s[a]=h=>{if(this.defaults.async)return Promise.resolve(u.call(s,h)).then(g=>f.call(s,g));const p=u.call(s,h);return f.call(s,p)}:s[a]=(...h)=>{let p=u.apply(s,h);return p===!1&&(p=f.apply(s,h)),p}}i.hooks=s}if(n.walkTokens){const s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(a){let u=[];return u.push(o.call(this,a)),s&&(u=u.concat(s.call(this,a))),u}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ni.lex(t,e??this.defaults)}parser(t,e){return Ri.parse(t,e??this.defaults)}parseMarkdown(t){return(n,i)=>{const s={...i},o={...this.defaults,...s},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=t);const u=o.hooks?o.hooks.provideLexer():t?Ni.lex:Ni.lexInline,f=o.hooks?o.hooks.provideParser():t?Ri.parse:Ri.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(h=>u(h,o)).then(h=>o.hooks?o.hooks.processAllTokens(h):h).then(h=>o.walkTokens?Promise.all(this.walkTokens(h,o.walkTokens)).then(()=>h):h).then(h=>f(h,o)).then(h=>o.hooks?o.hooks.postprocess(h):h).catch(a);try{o.hooks&&(n=o.hooks.preprocess(n));let h=u(n,o);o.hooks&&(h=o.hooks.processAllTokens(h)),o.walkTokens&&this.walkTokens(h,o.walkTokens);let p=f(h,o);return o.hooks&&(p=o.hooks.postprocess(p)),p}catch(h){return a(h)}}}onError(t,e){return n=>{if(n.message+=`
264
+ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+Yn(n.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(n);throw n}}},gs=new DB;function je(t,e){return gs.parse(t,e)}je.options=je.setOptions=function(t){return gs.setOptions(t),je.defaults=gs.defaults,_T(je.defaults),je};je.getDefaults=vg;je.defaults=Ss;je.use=function(...t){return gs.use(...t),je.defaults=gs.defaults,_T(je.defaults),je};je.walkTokens=function(t,e){return gs.walkTokens(t,e)};je.parseInline=gs.parseInline;je.Parser=Ri;je.parser=Ri.parse;je.Renderer=Fu;je.TextRenderer=Mg;je.Lexer=Ni;je.lexer=Ni.lex;je.Tokenizer=Xu;je.Hooks=Zc;je.parse=je;je.options;je.setOptions;je.use;je.walkTokens;je.parseInline;Ri.parse;Ni.lex;function zB(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}function Sm(t,e){return Array(e+1).join(t)}function GT(t){return t.replace(/^\n*/,"")}function YT(t){for(var e=t.length;e>0&&t[e-1]===`
265
+ `;)e--;return t.substring(0,e)}function XT(t){return YT(GT(t))}var LB=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Ag(t){return Og(t,LB)}var FT=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function WT(t){return Og(t,FT)}function _B(t){return JT(t,FT)}var QT=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function BB(t){return Og(t,QT)}function HB(t){return JT(t,QT)}function Og(t,e){return e.indexOf(t.nodeName)>=0}function JT(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var UB=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ZT(t){return UB.reduce(function(e,n){return e.replace(n[0],n[1])},t)}var Ut={};Ut.paragraph={filter:"p",replacement:function(t){return`
266
+
267
+ `+t+`
268
+
269
+ `}};Ut.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
270
+ `}};Ut.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var i=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&i<3){var s=Sm(i===1?"=":"-",t.length);return`
271
+
272
+ `+t+`
273
+ `+s+`
274
+
275
+ `}else return`
276
+
277
+ `+Sm("#",i)+" "+t+`
278
+
279
+ `}};Ut.blockquote={filter:"blockquote",replacement:function(t){return t=XT(t).replace(/^/gm,"> "),`
280
+
281
+ `+t+`
282
+
283
+ `}};Ut.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
284
+ `+t:`
285
+
286
+ `+t+`
287
+
288
+ `}};Ut.listItem={filter:"li",replacement:function(t,e,n){var i=n.bulletListMarker+" ",s=e.parentNode;if(s.nodeName==="OL"){var o=s.getAttribute("start"),a=Array.prototype.indexOf.call(s.children,e);i=(o?Number(o)+a:a+1)+". "}var u=/\n$/.test(t);return t=XT(t)+(u?`
289
+ `:""),t=t.replace(/\n/gm,`
290
+ `+" ".repeat(i.length)),i+t+(e.nextSibling?`
291
+ `:"")}};Ut.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return`
292
+
293
+ `+e.firstChild.textContent.replace(/\n/g,`
294
+ `)+`
295
+
296
+ `}};Ut.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var i=e.firstChild.getAttribute("class")||"",s=(i.match(/language-(\S+)/)||[null,""])[1],o=e.firstChild.textContent,a=n.fence.charAt(0),u=3,f=new RegExp("^"+a+"{3,}","gm"),h;h=f.exec(o);)h[0].length>=u&&(u=h[0].length+1);var p=Sm(a,u);return`
297
+
298
+ `+p+s+`
299
+ `+o.replace(/\n$/,"")+`
300
+ `+p+`
301
+
302
+ `}};Ut.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
303
+
304
+ `+n.hr+`
305
+
306
+ `}};Ut.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=Ng(e.getAttribute("href")),i=Rg(Wu(e.getAttribute("title"))),s=i?' "'+i+'"':"";return"["+t+"]("+n+s+")"}};Ut.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var i=Ng(e.getAttribute("href")),s=Wu(e.getAttribute("title"));s&&(s=' "'+Rg(s)+'"');var o,a;switch(n.linkReferenceStyle){case"collapsed":o="["+t+"][]",a="["+t+"]: "+i+s;break;case"shortcut":o="["+t+"]",a="["+t+"]: "+i+s;break;default:var u=this.references.length+1;o="["+t+"]["+u+"]",a="["+u+"]: "+i+s}return this.references.push(a),o},references:[],append:function(t){var e="";return this.references.length&&(e=`
307
+
308
+ `+this.references.join(`
309
+ `)+`
310
+
311
+ `,this.references=[]),e}};Ut.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};Ut.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};Ut.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",i=t.match(/`+/gm)||[];i.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};Ut.image={filter:"img",replacement:function(t,e){var n=ZT(Wu(e.getAttribute("alt"))),i=Ng(e.getAttribute("src")||""),s=Wu(e.getAttribute("title")),o=s?' "'+Rg(s)+'"':"";return i?"!["+n+"]("+i+o+")":""}};function Wu(t){return t?t.replace(/(\n+\s*)+/g,`
312
+ `):""}function Ng(t){var e=t.replace(/([<>()])/g,"\\$1");return e.indexOf(" ")>=0?"<"+e+">":e}function Rg(t){return t.replace(/"/g,'\\"')}function eE(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}eE.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=Mp(this.array,t,this.options))||(e=Mp(this._keep,t,this.options))||(e=Mp(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function Mp(t,e,n){for(var i=0;i<t.length;i++){var s=t[i];if(jB(s,e,n))return s}}function jB(t,e,n){var i=t.filter;if(typeof i=="string"){if(i===e.nodeName.toLowerCase())return!0}else if(Array.isArray(i)){if(i.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof i=="function"){if(i.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function IB(t){var e=t.element,n=t.isBlock,i=t.isVoid,s=t.isPre||function(g){return g.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var o=null,a=!1,u=null,f=ZS(u,e,s);f!==e;){if(f.nodeType===3||f.nodeType===4){var h=f.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!a&&h[0]===" "&&(h=h.substr(1)),!h){f=Ap(f);continue}f.data=h,o=f}else if(f.nodeType===1)n(f)||f.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,a=!1):i(f)||s(f)?(o=null,a=!0):o&&(a=!1);else{f=Ap(f);continue}var p=ZS(u,f,s);u=f,f=p}o&&(o.data=o.data.replace(/ $/,""),o.data||Ap(o))}}function Ap(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function ZS(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var Dg=typeof window<"u"?window:{};function VB(){var t=Dg.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function $B(){var t=function(){};return qB()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function qB(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{Dg.ActiveXObject&&(t=!0)}return t}var PB=VB()?Dg.DOMParser:$B();function KB(t,e){var n;if(typeof t=="string"){var i=GB().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=i.getElementById("turndown-root")}else n=t.cloneNode(!0);return IB({element:n,isBlock:Ag,isVoid:WT,isPre:e.preformattedCode?YB:null}),n}var Op;function GB(){return Op=Op||new PB,Op}function YB(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function XB(t,e){return t.isBlock=Ag(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=FB(t),t.flankingWhitespace=WB(t,e),t}function FB(t){return!WT(t)&&!BB(t)&&/^\s*$/i.test(t.textContent)&&!_B(t)&&!HB(t)}function WB(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=QB(t.textContent);return n.leadingAscii&&ex("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&ex("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function QB(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function ex(t,e,n){var i,s,o;return t==="left"?(i=e.previousSibling,s=/ $/):(i=e.nextSibling,s=/^ /),i&&(i.nodeType===3?o=s.test(i.nodeValue):n.preformattedCode&&i.nodeName==="CODE"?o=!1:i.nodeType===1&&!Ag(i)&&(o=s.test(i.textContent))),o}var JB=Array.prototype.reduce;function Qu(t){if(!(this instanceof Qu))return new Qu(t);var e={rules:Ut,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,i){return i.isBlock?`
313
+
314
+ `:""},keepReplacement:function(n,i){return i.isBlock?`
315
+
316
+ `+i.outerHTML+`
317
+
318
+ `:i.outerHTML},defaultReplacement:function(n,i){return i.isBlock?`
319
+
320
+ `+n+`
321
+
322
+ `:n}};this.options=zB({},e,t),this.rules=new eE(this.options)}Qu.prototype={turndown:function(t){if(!tH(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=tE.call(this,new KB(t,this.options));return ZB.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return ZT(t)}};function tE(t){var e=this;return JB.call(t.childNodes,function(n,i){i=new XB(i,e.options);var s="";return i.nodeType===3?s=i.isCode?i.nodeValue:e.escape(i.nodeValue):i.nodeType===1&&(s=eH.call(e,i)),nE(n,s)},"")}function ZB(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=nE(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function eH(t){var e=this.rules.forNode(t),n=tE.call(this,t),i=t.flankingWhitespace;return(i.leading||i.trailing)&&(n=n.trim()),i.leading+e.replacement(n,t,this.options)+i.trailing}function nE(t,e){var n=YT(t),i=GT(e),s=Math.max(t.length-n.length,e.length-i.length),o=`
323
+
324
+ `.substring(0,s);return n+o+i}function tH(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}const nH=new Qu({headingStyle:"atx",bulletListMarker:"-",codeBlockStyle:"fenced"}),pr={nextId:1,pending:new Map,call(t,e={}){const n=this.nextId++,i={id:n,method:t,params:e};return new Promise((s,o)=>{var a;this.pending.set(n,{resolve:s,reject:o}),(a=window.chrome)!=null&&a.webview?window.chrome.webview.postMessage(i):o(new Error("Native bridge is not available."))})}};var tx;(tx=window.chrome)!=null&&tx.webview&&window.chrome.webview.addEventListener("message",t=>{const e=t.data,n=pr.pending.get(e.id);n&&(pr.pending.delete(e.id),e.ok?n.resolve(e.result):n.reject(new Error(e.error||"Native bridge failed.")))});function Kc(t){return je.parse(t||"",{gfm:!0,breaks:!1})}function iH(t){return nH.turndown(t||"")}function Gn({label:t,title:e,active:n,disabled:i,onClick:s,className:o=""}){return j.jsx("button",{type:"button",title:e||t,className:`${n?"active":""} ${o}`.trim(),disabled:i,onClick:s,children:t})}function rH(){const[t,e]=Qe.useState(`# regen.mde
325
+
326
+ Open a Markdown or Word file to begin.`),[n,i]=Qe.useState(""),[s,o]=Qe.useState(""),[a,u]=Qe.useState(""),[f,h]=Qe.useState(""),[p,g]=Qe.useState(""),[b,v]=Qe.useState("Ready"),[S,w]=Qe.useState("compare"),[k,E]=Qe.useState(()=>{var fe,Zt;const J=(fe=window.localStorage)==null?void 0:fe.getItem("build-corpus-editor-theme");return J==="dark"||J==="light"?J:(Zt=window.matchMedia)!=null&&Zt.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}),[N,L]=Qe.useState(!1),[V,I]=Qe.useState(!1),C=q2({extensions:[H_,dT.configure({openOnClick:!1,autolink:!0}),D_.configure({placeholder:"Start writing..."}),j_.configure({inline:!1,allowBase64:!0}),LT.configure({resizable:!0}),zT,DT,RT,TT,kT.configure({nested:!0})],content:Kc(t),immediatelyRender:!1,onUpdate({editor:J}){const fe=iH(J.getHTML());e(fe),L(!0)}}),H=Qe.useCallback(async J=>{v("Opening...");const fe=await pr.call("open",{path:J}),Zt=fe.originalFormat||"",ii=Zt==="markdown";i(fe.workingPath||ii&&fe.sourcePath||""),o(fe.workingPath||""),u(fe.sourcePath||""),h(""),g(Zt),e(fe.content||""),I((fe.content||"").length>5e4),C==null||C.commands.setContent(Kc(fe.content||"")),L(!1),w((fe.content||"").length>5e4?"markdown":"compare"),v(`Opened ${fe.sourcePath}`)},[C]);Qe.useEffect(()=>{pr.call("startup").then(J=>{J.initialPath&&H(J.initialPath)}).catch(J=>v(J.message))},[H]),Qe.useEffect(()=>{C&&!N&&C.commands.setContent(Kc(t))},[C,t,N]),Qe.useEffect(()=>{var J;(J=window.localStorage)==null||J.setItem("build-corpus-editor-theme",k)},[k]);async function W(){try{const J=await pr.call("chooseOpen");J!=null&&J.path&&await H(J.path)}catch(J){v(J.message)}}async function ie(){try{v("Saving...");const J=await pr.call("save",{path:n,content:t});i(J.output),o(J.output),L(!1),v(`Saved Markdown ${J.output}`)}catch(J){v(J.message)}}async function te(J){try{v("Saving as...");const fe=window.__REGEN_MDEDITOR_SMOKE_OUT,Zt=fe?"saveAsDirect":"saveAs",ii={suggestedPath:n||a||s,format:J,content:t};if(fe){const ca=J==="word"?".docx":".md";ii.targetPath=`${fe}\\ui-save-as-${J}${ca}`}const mn=await pr.call(Zt,ii);mn!=null&&mn.output&&(J==="markdown"?(i(mn.output),o(mn.output),L(!1),v(`Saved Markdown ${mn.output}`)):(h(mn.output),v(`Exported Word ${mn.output}`)))}catch(fe){v(fe.message)}}function ve(){const J=(C==null?void 0:C.getAttributes("link").href)||"",fe=window.prompt("URL",J);fe!==null&&(fe.trim()===""?C==null||C.chain().focus().unsetLink().run():C==null||C.chain().focus().extendMarkRange("link").setLink({href:fe.trim()}).run())}async function pe(){try{const J=await pr.call("chooseImage");J!=null&&J.src&&(C==null||C.chain().focus().setImage({src:J.src,alt:J.alt||""}).run())}catch(J){v(J.message)}}function xe(){const J=window.prompt("Image URL");J&&(C==null||C.chain().focus().setImage({src:J.trim()}).run())}function de(J){e(J),L(!0),C&&J.length<=5e4&&C.commands.setContent(Kc(J))}Qe.useEffect(()=>{if(window.__REGEN_MDEDITOR_SMOKE_OUT)return window.__REGEN_MDEDITOR_SMOKE_API={appendMarkdown(J){const fe=`${t}${J}`;return de(fe),fe}},()=>{delete window.__REGEN_MDEDITOR_SMOKE_API}},[t,C]);const se=!!C&&!V,B=a||n||s||"No file open",Y=p?p.toUpperCase():"NEW",Z=t.trim()?t.trim().split(/\s+/).length:0,ye=(t.match(/\n\|/g)||[]).length>1?1:0,Oe=(t.match(/!\[[^\]]*]\(/g)||[]).length,O=(t.match(/https?:\/\//g)||[]).length,K=Math.max(18,Math.min(94,92-Oe*8-ye*5)),Q=Y==="MARKDOWN"?"MD":Y==="NEW"?"NEW":Y,ne=a?`${Y} source loaded`:"No source loaded",me=n?"Markdown target selected":"Unsaved Markdown draft",ke=f?"Word export written":"Word export ready",Re=k==="dark"?"light":"dark";return j.jsxs("main",{className:"app-shell","data-theme":k,children:[j.jsxs("aside",{className:"brand-rail","aria-label":"Primary tools",children:[j.jsx("div",{className:"mark",children:"BC"}),j.jsx("div",{className:"rail-item active",children:"Ed"}),j.jsx("div",{className:"rail-item",children:"Cv"}),j.jsx("div",{className:"rail-item",children:"Tb"}),j.jsx("div",{className:"rail-item",children:"Im"}),j.jsx("div",{className:"rail-item",children:"Qa"}),j.jsx("div",{}),j.jsx("div",{className:"rail-item",children:"?"})]}),j.jsxs("header",{className:"topbar",children:[j.jsxs("div",{className:"file-title",children:[j.jsx("strong",{children:"regen.mde"}),j.jsx("span",{title:B,children:B})]}),j.jsxs("div",{className:"actions",children:[j.jsx("button",{className:"ghost",onClick:W,children:"Open"}),j.jsx("button",{onClick:ie,disabled:!n,children:"Save MD"}),j.jsx("button",{onClick:()=>te("markdown"),children:"Save MD As..."}),j.jsx("button",{onClick:()=>te("word"),children:"Export Word..."}),j.jsx("button",{className:"ghost",onClick:()=>E(Re),children:k==="dark"?"Light":"Dark"}),j.jsx("button",{className:"primary",onClick:()=>v(`Checked ${Z} words, ${ye} tables, ${Oe} images, ${O} links`),children:"Run Check"})]})]}),j.jsxs("section",{className:"side-panel left-panel",children:[j.jsx("h2",{className:"panel-title",children:"Document Flow"}),j.jsxs("div",{className:"source-card",children:[j.jsx("strong",{children:ne}),j.jsx("p",{children:N?"The Markdown draft has unsaved changes.":"The Markdown draft is in sync with its save target."})]}),j.jsxs("div",{className:"format-flow",children:[j.jsxs("div",{className:"flow-step",children:[j.jsx("div",{className:"badge",children:Q}),j.jsxs("div",{children:[j.jsx("b",{children:"Original"}),j.jsx("small",{children:a||"Choose a file to begin"})]}),j.jsx("small",{children:a?"loaded":"empty"})]}),j.jsxs("div",{className:"flow-step",children:[j.jsx("div",{className:"badge",children:"MD"}),j.jsxs("div",{children:[j.jsx("b",{children:"Working draft"}),j.jsx("small",{children:me})]}),j.jsx("small",{children:N?"dirty":"saved"})]}),j.jsxs("div",{className:"flow-step",children:[j.jsx("div",{className:"badge",children:"DOCX"}),j.jsxs("div",{children:[j.jsx("b",{children:"Word export"}),j.jsx("small",{children:ke})]}),j.jsx("small",{children:f?"done":"ready"})]})]}),j.jsx("h2",{className:"panel-title",children:"Insert"}),j.jsxs("div",{className:"insert-grid",children:[j.jsxs("button",{className:"insert-tile",disabled:!se,onClick:()=>C==null?void 0:C.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),children:[j.jsx("b",{children:"Table"}),"Rows, columns, headers"]}),j.jsxs("button",{className:"insert-tile",disabled:!se,onClick:pe,children:[j.jsx("b",{children:"Image"}),"File with alt text"]}),j.jsxs("button",{className:"insert-tile",disabled:!se,onClick:()=>C==null?void 0:C.chain().focus().toggleBlockquote().run(),children:[j.jsx("b",{children:"Callout"}),"Note or quotation"]}),j.jsxs("button",{className:"insert-tile",disabled:!se,onClick:()=>C==null?void 0:C.chain().focus().toggleTaskList().run(),children:[j.jsx("b",{children:"Task"}),"Checklist block"]})]})]}),j.jsxs("section",{className:`workspace ${S}`,children:[j.jsxs("div",{className:"mode-strip",children:[j.jsxs("div",{className:"segmented","aria-label":"Editor mode",children:[j.jsx("button",{className:S==="preview"?"active":"",onClick:()=>w("preview"),disabled:V,children:"Preview"}),j.jsx("button",{className:S==="compare"?"active":"",onClick:()=>w("compare"),disabled:V,children:"Compare"}),j.jsx("button",{className:S==="markdown"?"active":"",onClick:()=>w("markdown"),children:"Markdown"})]}),j.jsxs("div",{className:"actions",children:[j.jsx("button",{className:"ghost",disabled:!se,onClick:()=>C==null?void 0:C.chain().focus().undo().run(),children:"Undo"}),j.jsx("button",{className:"ghost",disabled:!se,onClick:()=>C==null?void 0:C.chain().focus().redo().run(),children:"Redo"}),j.jsx("button",{className:"ghost",disabled:!se,onClick:ve,children:"Link"})]})]}),V&&j.jsx("div",{className:"large-file-notice",children:"Large file: rich preview is paused for performance. Markdown mode stays fully editable."}),j.jsxs("div",{className:"canvas-wrap",children:[S!=="markdown"&&!V&&C&&j.jsx("section",{className:"page-area",children:j.jsxs("article",{className:"page rich",children:[j.jsx("p",{className:"page-label",children:Y==="NEW"?"New Markdown draft":`Converted from ${Y}`}),j.jsxs(Q3,{editor:C,options:{placement:"top"},className:"bubble-menu",children:[j.jsx(Gn,{label:"B",title:"Bold",active:C==null?void 0:C.isActive("bold"),onClick:()=>C==null?void 0:C.chain().focus().toggleBold().run()}),j.jsx(Gn,{label:"I",title:"Italic",active:C==null?void 0:C.isActive("italic"),onClick:()=>C==null?void 0:C.chain().focus().toggleItalic().run()}),j.jsx(Gn,{label:"S",title:"Strike",active:C==null?void 0:C.isActive("strike"),onClick:()=>C==null?void 0:C.chain().focus().toggleStrike().run()}),j.jsx(Gn,{label:"Code",active:C==null?void 0:C.isActive("code"),onClick:()=>C==null?void 0:C.chain().focus().toggleCode().run()}),j.jsx(Gn,{label:"Link",active:C==null?void 0:C.isActive("link"),onClick:ve})]}),j.jsxs(J3,{editor:C,options:{placement:"right-start"},className:"floating-menu",children:[j.jsx(Gn,{label:"H1",onClick:()=>C==null?void 0:C.chain().focus().toggleHeading({level:1}).run()}),j.jsx(Gn,{label:"H2",onClick:()=>C==null?void 0:C.chain().focus().toggleHeading({level:2}).run()}),j.jsx(Gn,{label:"List",onClick:()=>C==null?void 0:C.chain().focus().toggleBulletList().run()}),j.jsx(Gn,{label:"Table",onClick:()=>C==null?void 0:C.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}),j.jsx(Gn,{label:"Image",onClick:pe})]}),j.jsx(mk,{editor:C})]})}),(S==="compare"||S==="markdown"||V)&&j.jsx("aside",{className:"markdown-pane",children:j.jsx("textarea",{className:"source",value:t,onChange:J=>de(J.target.value),spellCheck:"false"})})]})]}),j.jsxs("aside",{className:"side-panel right-panel",children:[j.jsx("h2",{className:"panel-title",children:"Output Health"}),j.jsxs("div",{className:"source-card",children:[j.jsx("strong",{children:"Round-trip confidence"}),j.jsx("p",{children:"Tables, images, links, and headings are tracked as conversion risks."}),j.jsx("div",{className:"meter","aria-label":"Round-trip confidence",children:j.jsx("span",{style:{width:`${K}%`}})})]}),j.jsx("h2",{className:"panel-title",children:"Table Tools"}),j.jsxs("div",{className:"tool-group",children:[j.jsx("button",{disabled:!se||!(C!=null&&C.isActive("table")),onClick:()=>C==null?void 0:C.chain().focus().addRowAfter().run(),children:"Row +"}),j.jsx("button",{disabled:!se||!(C!=null&&C.isActive("table")),onClick:()=>C==null?void 0:C.chain().focus().addColumnAfter().run(),children:"Col +"}),j.jsx("button",{disabled:!se||!(C!=null&&C.isActive("table")),onClick:()=>C==null?void 0:C.chain().focus().deleteRow().run(),children:"Row -"}),j.jsx("button",{disabled:!se||!(C!=null&&C.isActive("table")),onClick:()=>C==null?void 0:C.chain().focus().deleteColumn().run(),children:"Col -"}),j.jsx("button",{disabled:!se||!(C!=null&&C.isActive("table")),onClick:()=>C==null?void 0:C.chain().focus().toggleHeaderRow().run(),children:"Header"}),j.jsx("button",{disabled:!se||!(C!=null&&C.isActive("table")),onClick:()=>C==null?void 0:C.chain().focus().deleteTable().run(),children:"Delete"})]}),j.jsx("h2",{className:"panel-title",children:"Image Tools"}),j.jsxs("div",{className:"tool-group",children:[j.jsx("button",{disabled:!se,onClick:pe,children:"File"}),j.jsx("button",{disabled:!se,onClick:xe,children:"URL"})]}),j.jsxs("div",{className:"checklist",children:[j.jsxs("div",{className:"check",children:[j.jsx("span",{className:"dot"}),j.jsxs("div",{children:[j.jsx("b",{children:"Markdown target"}),j.jsx("br",{}),n||"Choose Save MD As..."]})]}),j.jsxs("div",{className:"check",children:[j.jsx("span",{className:"dot"}),j.jsxs("div",{children:[j.jsx("b",{children:"Word export"}),j.jsx("br",{}),f||"Ready to export with template hook."]})]}),j.jsxs("div",{className:"check",children:[j.jsx("span",{className:Oe?"dot warn":"dot"}),j.jsxs("div",{children:[j.jsx("b",{children:"Images"}),j.jsx("br",{}),Oe," detected. Asset folder policy still needs final pass."]})]}),j.jsxs("div",{className:"check",children:[j.jsx("span",{className:ye?"dot warn":"dot"}),j.jsxs("div",{children:[j.jsx("b",{children:"Tables"}),j.jsx("br",{}),ye," detected. Advanced cell controls are surfaced here."]})]})]})]}),j.jsxs("footer",{className:"statusbar",children:[j.jsxs("span",{children:[b,f?` - Last Word export: ${f}`:""]}),j.jsxs("span",{children:["Words ",Z," | Tables ",ye," | Images ",Oe," | Links ",O]})]})]})}BM.createRoot(document.getElementById("root")).render(j.jsx(rH,{}));