openwriter 0.2.0 → 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.
@@ -0,0 +1,205 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function _u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Tf={exports:{}},sl={},Mf={exports:{}},He={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var uy;function tS(){if(uy)return He;uy=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function g(M){return M===null||typeof M!="object"?null:(M=h&&M[h]||M["@@iterator"],typeof M=="function"?M:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,w={};function x(M,A,X){this.props=M,this.context=A,this.refs=w,this.updater=X||y}x.prototype.isReactComponent={},x.prototype.setState=function(M,A){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,A,"setState")},x.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function C(){}C.prototype=x.prototype;function N(M,A,X){this.props=M,this.context=A,this.refs=w,this.updater=X||y}var I=N.prototype=new C;I.constructor=N,k(I,x.prototype),I.isPureReactComponent=!0;var P=Array.isArray,O=Object.prototype.hasOwnProperty,R={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function te(M,A,X){var Z,ye={},ge=null,ne=null;if(A!=null)for(Z in A.ref!==void 0&&(ne=A.ref),A.key!==void 0&&(ge=""+A.key),A)O.call(A,Z)&&!$.hasOwnProperty(Z)&&(ye[Z]=A[Z]);var be=arguments.length-2;if(be===1)ye.children=X;else if(1<be){for(var Ue=Array(be),Ze=0;Ze<be;Ze++)Ue[Ze]=arguments[Ze+2];ye.children=Ue}if(M&&M.defaultProps)for(Z in be=M.defaultProps,be)ye[Z]===void 0&&(ye[Z]=be[Z]);return{$$typeof:t,type:M,key:ge,ref:ne,props:ye,_owner:R.current}}function le(M,A){return{$$typeof:t,type:M.type,key:A,ref:M.ref,props:M.props,_owner:M._owner}}function ee(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function Q(M){var A={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(X){return A[X]})}var H=/\/+/g;function K(M,A){return typeof M=="object"&&M!==null&&M.key!=null?Q(""+M.key):A.toString(36)}function U(M,A,X,Z,ye){var ge=typeof M;(ge==="undefined"||ge==="boolean")&&(M=null);var ne=!1;if(M===null)ne=!0;else switch(ge){case"string":case"number":ne=!0;break;case"object":switch(M.$$typeof){case t:case e:ne=!0}}if(ne)return ne=M,ye=ye(ne),M=Z===""?"."+K(ne,0):Z,P(ye)?(X="",M!=null&&(X=M.replace(H,"$&/")+"/"),U(ye,A,X,"",function(Ze){return Ze})):ye!=null&&(ee(ye)&&(ye=le(ye,X+(!ye.key||ne&&ne.key===ye.key?"":(""+ye.key).replace(H,"$&/")+"/")+M)),A.push(ye)),1;if(ne=0,Z=Z===""?".":Z+":",P(M))for(var be=0;be<M.length;be++){ge=M[be];var Ue=Z+K(ge,be);ne+=U(ge,A,X,Ue,ye)}else if(Ue=g(M),typeof Ue=="function")for(M=Ue.call(M),be=0;!(ge=M.next()).done;)ge=ge.value,Ue=Z+K(ge,be++),ne+=U(ge,A,X,Ue,ye);else if(ge==="object")throw A=String(M),Error("Objects are not valid as a React child (found: "+(A==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":A)+"). If you meant to render a collection of children, use an array instead.");return ne}function G(M,A,X){if(M==null)return M;var Z=[],ye=0;return U(M,Z,"","",function(ge){return A.call(X,ge,ye++)}),Z}function ie(M){if(M._status===-1){var A=M._result;A=A(),A.then(function(X){(M._status===0||M._status===-1)&&(M._status=1,M._result=X)},function(X){(M._status===0||M._status===-1)&&(M._status=2,M._result=X)}),M._status===-1&&(M._status=0,M._result=A)}if(M._status===1)return M._result.default;throw M._result}var me={current:null},V={transition:null},j={ReactCurrentDispatcher:me,ReactCurrentBatchConfig:V,ReactCurrentOwner:R};function q(){throw Error("act(...) is not supported in production builds of React.")}return He.Children={map:G,forEach:function(M,A,X){G(M,function(){A.apply(this,arguments)},X)},count:function(M){var A=0;return G(M,function(){A++}),A},toArray:function(M){return G(M,function(A){return A})||[]},only:function(M){if(!ee(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},He.Component=x,He.Fragment=n,He.Profiler=i,He.PureComponent=N,He.StrictMode=r,He.Suspense=u,He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,He.act=q,He.cloneElement=function(M,A,X){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var Z=k({},M.props),ye=M.key,ge=M.ref,ne=M._owner;if(A!=null){if(A.ref!==void 0&&(ge=A.ref,ne=R.current),A.key!==void 0&&(ye=""+A.key),M.type&&M.type.defaultProps)var be=M.type.defaultProps;for(Ue in A)O.call(A,Ue)&&!$.hasOwnProperty(Ue)&&(Z[Ue]=A[Ue]===void 0&&be!==void 0?be[Ue]:A[Ue])}var Ue=arguments.length-2;if(Ue===1)Z.children=X;else if(1<Ue){be=Array(Ue);for(var Ze=0;Ze<Ue;Ze++)be[Ze]=arguments[Ze+2];Z.children=be}return{$$typeof:t,type:M.type,key:ye,ref:ge,props:Z,_owner:ne}},He.createContext=function(M){return M={$$typeof:l,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:s,_context:M},M.Consumer=M},He.createElement=te,He.createFactory=function(M){var A=te.bind(null,M);return A.type=M,A},He.createRef=function(){return{current:null}},He.forwardRef=function(M){return{$$typeof:c,render:M}},He.isValidElement=ee,He.lazy=function(M){return{$$typeof:p,_payload:{_status:-1,_result:M},_init:ie}},He.memo=function(M,A){return{$$typeof:f,type:M,compare:A===void 0?null:A}},He.startTransition=function(M){var A=V.transition;V.transition={};try{M()}finally{V.transition=A}},He.unstable_act=q,He.useCallback=function(M,A){return me.current.useCallback(M,A)},He.useContext=function(M){return me.current.useContext(M)},He.useDebugValue=function(){},He.useDeferredValue=function(M){return me.current.useDeferredValue(M)},He.useEffect=function(M,A){return me.current.useEffect(M,A)},He.useId=function(){return me.current.useId()},He.useImperativeHandle=function(M,A,X){return me.current.useImperativeHandle(M,A,X)},He.useInsertionEffect=function(M,A){return me.current.useInsertionEffect(M,A)},He.useLayoutEffect=function(M,A){return me.current.useLayoutEffect(M,A)},He.useMemo=function(M,A){return me.current.useMemo(M,A)},He.useReducer=function(M,A,X){return me.current.useReducer(M,A,X)},He.useRef=function(M){return me.current.useRef(M)},He.useState=function(M){return me.current.useState(M)},He.useSyncExternalStore=function(M,A,X){return me.current.useSyncExternalStore(M,A,X)},He.useTransition=function(){return me.current.useTransition()},He.version="18.3.1",He}var dy;function zl(){return dy||(dy=1,Mf.exports=tS()),Mf.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var fy;function nS(){if(fy)return sl;fy=1;var t=zl(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(c,u,f){var p,h={},g=null,y=null;f!==void 0&&(g=""+f),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(y=u.ref);for(p in u)r.call(u,p)&&!s.hasOwnProperty(p)&&(h[p]=u[p]);if(c&&c.defaultProps)for(p in u=c.defaultProps,u)h[p]===void 0&&(h[p]=u[p]);return{$$typeof:e,type:c,key:g,ref:y,props:h,_owner:i.current}}return sl.Fragment=n,sl.jsx=l,sl.jsxs=l,sl}var py;function rS(){return py||(py=1,Tf.exports=nS()),Tf.exports}var v=rS(),_=zl();const Ri=_u(_);var ec={},Af={exports:{}},Cn={},Of={exports:{}},Rf={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var hy;function iS(){return hy||(hy=1,(function(t){function e(V,j){var q=V.length;V.push(j);e:for(;0<q;){var M=q-1>>>1,A=V[M];if(0<i(A,j))V[M]=j,V[q]=A,q=M;else break e}}function n(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var j=V[0],q=V.pop();if(q!==j){V[0]=q;e:for(var M=0,A=V.length,X=A>>>1;M<X;){var Z=2*(M+1)-1,ye=V[Z],ge=Z+1,ne=V[ge];if(0>i(ye,q))ge<A&&0>i(ne,ye)?(V[M]=ne,V[ge]=q,M=ge):(V[M]=ye,V[Z]=q,M=Z);else if(ge<A&&0>i(ne,q))V[M]=ne,V[ge]=q,M=ge;else break e}}return j}function i(V,j){var q=V.sortIndex-j.sortIndex;return q!==0?q:V.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var u=[],f=[],p=1,h=null,g=3,y=!1,k=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function I(V){for(var j=n(f);j!==null;){if(j.callback===null)r(f);else if(j.startTime<=V)r(f),j.sortIndex=j.expirationTime,e(u,j);else break;j=n(f)}}function P(V){if(w=!1,I(V),!k)if(n(u)!==null)k=!0,ie(O);else{var j=n(f);j!==null&&me(P,j.startTime-V)}}function O(V,j){k=!1,w&&(w=!1,C(te),te=-1),y=!0;var q=g;try{for(I(j),h=n(u);h!==null&&(!(h.expirationTime>j)||V&&!Q());){var M=h.callback;if(typeof M=="function"){h.callback=null,g=h.priorityLevel;var A=M(h.expirationTime<=j);j=t.unstable_now(),typeof A=="function"?h.callback=A:h===n(u)&&r(u),I(j)}else r(u);h=n(u)}if(h!==null)var X=!0;else{var Z=n(f);Z!==null&&me(P,Z.startTime-j),X=!1}return X}finally{h=null,g=q,y=!1}}var R=!1,$=null,te=-1,le=5,ee=-1;function Q(){return!(t.unstable_now()-ee<le)}function H(){if($!==null){var V=t.unstable_now();ee=V;var j=!0;try{j=$(!0,V)}finally{j?K():(R=!1,$=null)}}else R=!1}var K;if(typeof N=="function")K=function(){N(H)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,G=U.port2;U.port1.onmessage=H,K=function(){G.postMessage(null)}}else K=function(){x(H,0)};function ie(V){$=V,R||(R=!0,K())}function me(V,j){te=x(function(){V(t.unstable_now())},j)}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(V){V.callback=null},t.unstable_continueExecution=function(){k||y||(k=!0,ie(O))},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):le=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(V){switch(g){case 1:case 2:case 3:var j=3;break;default:j=g}var q=g;g=j;try{return V()}finally{g=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,j){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var q=g;g=V;try{return j()}finally{g=q}},t.unstable_scheduleCallback=function(V,j,q){var M=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?M+q:M):q=M,V){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=q+A,V={id:p++,callback:j,priorityLevel:V,startTime:q,expirationTime:A,sortIndex:-1},q>M?(V.sortIndex=q,e(f,V),n(u)===null&&V===n(f)&&(w?(C(te),te=-1):w=!0,me(P,q-M))):(V.sortIndex=A,e(u,V),k||y||(k=!0,ie(O))),V},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(V){var j=g;return function(){var q=g;g=j;try{return V.apply(this,arguments)}finally{g=q}}}})(Rf)),Rf}var my;function sS(){return my||(my=1,Of.exports=iS()),Of.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var gy;function oS(){if(gy)return Cn;gy=1;var t=zl(),e=sS();function n(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(o,a){l(o,a),l(o+"Capture",a)}function l(o,a){for(i[o]=a,o=0;o<a.length;o++)r.add(a[o])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,f=/^[: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]*$/,p={},h={};function g(o){return u.call(h,o)?!0:u.call(p,o)?!1:f.test(o)?h[o]=!0:(p[o]=!0,!1)}function y(o,a,d,m){if(d!==null&&d.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function k(o,a,d,m){if(a===null||typeof a>"u"||y(o,a,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function w(o,a,d,m,b,E,S){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=m,this.attributeNamespace=b,this.mustUseProperty=d,this.propertyName=o,this.type=a,this.sanitizeURL=E,this.removeEmptyString=S}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){x[o]=new w(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var a=o[0];x[a]=new w(a,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){x[o]=new w(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){x[o]=new w(o,2,!1,o,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){x[o]=new w(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){x[o]=new w(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){x[o]=new w(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){x[o]=new w(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){x[o]=new w(o,5,!1,o.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function N(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var a=o.replace(C,N);x[a]=new w(a,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var a=o.replace(C,N);x[a]=new w(a,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var a=o.replace(C,N);x[a]=new w(a,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){x[o]=new w(o,1,!1,o.toLowerCase(),null,!1,!1)}),x.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){x[o]=new w(o,1,!1,o.toLowerCase(),null,!0,!0)});function I(o,a,d,m){var b=x.hasOwnProperty(a)?x[a]:null;(b!==null?b.type!==0:m||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(k(a,d,b,m)&&(d=null),m||b===null?g(a)&&(d===null?o.removeAttribute(a):o.setAttribute(a,""+d)):b.mustUseProperty?o[b.propertyName]=d===null?b.type===3?!1:"":d:(a=b.attributeName,m=b.attributeNamespace,d===null?o.removeAttribute(a):(b=b.type,d=b===3||b===4&&d===!0?"":""+d,m?o.setAttributeNS(m,a,d):o.setAttribute(a,d))))}var P=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),R=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),le=Symbol.for("react.profiler"),ee=Symbol.for("react.provider"),Q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),me=Symbol.for("react.offscreen"),V=Symbol.iterator;function j(o){return o===null||typeof o!="object"?null:(o=V&&o[V]||o["@@iterator"],typeof o=="function"?o:null)}var q=Object.assign,M;function A(o){if(M===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);M=a&&a[1]||""}return`
34
+ `+M+o}var X=!1;function Z(o,a){if(!o||X)return"";X=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(W){var m=W}Reflect.construct(o,[],a)}else{try{a.call()}catch(W){m=W}o.call(a.prototype)}else{try{throw Error()}catch(W){m=W}o()}}catch(W){if(W&&m&&typeof W.stack=="string"){for(var b=W.stack.split(`
35
+ `),E=m.stack.split(`
36
+ `),S=b.length-1,T=E.length-1;1<=S&&0<=T&&b[S]!==E[T];)T--;for(;1<=S&&0<=T;S--,T--)if(b[S]!==E[T]){if(S!==1||T!==1)do if(S--,T--,0>T||b[S]!==E[T]){var D=`
37
+ `+b[S].replace(" at new "," at ");return o.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",o.displayName)),D}while(1<=S&&0<=T);break}}}finally{X=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?A(o):""}function ye(o){switch(o.tag){case 5:return A(o.type);case 16:return A("Lazy");case 13:return A("Suspense");case 19:return A("SuspenseList");case 0:case 2:case 15:return o=Z(o.type,!1),o;case 11:return o=Z(o.type.render,!1),o;case 1:return o=Z(o.type,!0),o;default:return""}}function ge(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case $:return"Fragment";case R:return"Portal";case le:return"Profiler";case te:return"StrictMode";case K:return"Suspense";case U:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case Q:return(o.displayName||"Context")+".Consumer";case ee:return(o._context.displayName||"Context")+".Provider";case H:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case G:return a=o.displayName||null,a!==null?a:ge(o.type)||"Memo";case ie:a=o._payload,o=o._init;try{return ge(o(a))}catch{}}return null}function ne(o){var a=o.type;switch(o.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=a.render,o=o.displayName||o.name||"",a.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(a);case 8:return a===te?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function be(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ue(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ze(o){var a=Ue(o)?"checked":"value",d=Object.getOwnPropertyDescriptor(o.constructor.prototype,a),m=""+o[a];if(!o.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var b=d.get,E=d.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return b.call(this)},set:function(S){m=""+S,E.call(this,S)}}),Object.defineProperty(o,a,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(S){m=""+S},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function un(o){o._valueTracker||(o._valueTracker=Ze(o))}function Ve(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var d=a.getValue(),m="";return o&&(m=Ue(o)?o.checked?"true":"false":o.value),o=m,o!==d?(a.setValue(o),!0):!1}function Je(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function bt(o,a){var d=a.checked;return q({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??o._wrapperState.initialChecked})}function Dn(o,a){var d=a.defaultValue==null?"":a.defaultValue,m=a.checked!=null?a.checked:a.defaultChecked;d=be(a.value!=null?a.value:d),o._wrapperState={initialChecked:m,initialValue:d,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function Ke(o,a){a=a.checked,a!=null&&I(o,"checked",a,!1)}function bn(o,a){Ke(o,a);var d=be(a.value),m=a.type;if(d!=null)m==="number"?(d===0&&o.value===""||o.value!=d)&&(o.value=""+d):o.value!==""+d&&(o.value=""+d);else if(m==="submit"||m==="reset"){o.removeAttribute("value");return}a.hasOwnProperty("value")?_r(o,a.type,d):a.hasOwnProperty("defaultValue")&&_r(o,a.type,be(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(o.defaultChecked=!!a.defaultChecked)}function vn(o,a,d){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var m=a.type;if(!(m!=="submit"&&m!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+o._wrapperState.initialValue,d||a===o.value||(o.value=a),o.defaultValue=a}d=o.name,d!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,d!==""&&(o.name=d)}function _r(o,a,d){(a!=="number"||Je(o.ownerDocument)!==o)&&(d==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+d&&(o.defaultValue=""+d))}var cr=Array.isArray;function ur(o,a,d,m){if(o=o.options,a){a={};for(var b=0;b<d.length;b++)a["$"+d[b]]=!0;for(d=0;d<o.length;d++)b=a.hasOwnProperty("$"+o[d].value),o[d].selected!==b&&(o[d].selected=b),b&&m&&(o[d].defaultSelected=!0)}else{for(d=""+be(d),a=null,b=0;b<o.length;b++){if(o[b].value===d){o[b].selected=!0,m&&(o[b].defaultSelected=!0);return}a!==null||o[b].disabled||(a=o[b])}a!==null&&(a.selected=!0)}}function zi(o,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return q({},a,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function Tr(o,a){var d=a.value;if(d==null){if(d=a.children,a=a.defaultValue,d!=null){if(a!=null)throw Error(n(92));if(cr(d)){if(1<d.length)throw Error(n(93));d=d[0]}a=d}a==null&&(a=""),d=a}o._wrapperState={initialValue:be(d)}}function de(o,a){var d=be(a.value),m=be(a.defaultValue);d!=null&&(d=""+d,d!==o.value&&(o.value=d),a.defaultValue==null&&o.defaultValue!==d&&(o.defaultValue=d)),m!=null&&(o.defaultValue=""+m)}function ze(o){var a=o.textContent;a===o._wrapperState.initialValue&&a!==""&&a!==null&&(o.value=a)}function vt(o){switch(o){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function dr(o,a){return o==null||o==="http://www.w3.org/1999/xhtml"?vt(a):o==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var Fi,Vl=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,d,m,b){MSApp.execUnsafeLocalFunction(function(){return o(a,d,m,b)})}:o})(function(o,a){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=a;else{for(Fi=Fi||document.createElement("div"),Fi.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Fi.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;a.firstChild;)o.appendChild(a.firstChild)}});function $i(o,a){if(a){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=a;return}}o.textContent=a}var Ui={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Vu=["Webkit","ms","Moz","O"];Object.keys(Ui).forEach(function(o){Vu.forEach(function(a){a=a+o.charAt(0).toUpperCase()+o.substring(1),Ui[a]=Ui[o]})});function Kl(o,a,d){return a==null||typeof a=="boolean"||a===""?"":d||typeof a!="number"||a===0||Ui.hasOwnProperty(o)&&Ui[o]?(""+a).trim():a+"px"}function Eo(o,a){o=o.style;for(var d in a)if(a.hasOwnProperty(d)){var m=d.indexOf("--")===0,b=Kl(d,a[d],m);d==="float"&&(d="cssFloat"),m?o.setProperty(d,b):o[d]=b}}var Ku=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function wo(o,a){if(a){if(Ku[o]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function xo(o,a){if(o.indexOf("-")===-1)return typeof a.is=="string";switch(o){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 Hi=null;function Ms(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var As=null,Jr=null,Mr=null;function Ar(o){if(o=Wo(o)){if(typeof As!="function")throw Error(n(280));var a=o.stateNode;a&&(a=ma(a),As(o.stateNode,o.type,a))}}function L(o){Jr?Mr?Mr.push(o):Mr=[o]:Jr=o}function Y(){if(Jr){var o=Jr,a=Mr;if(Mr=Jr=null,Ar(o),a)for(o=0;o<a.length;o++)Ar(a[o])}}function pe(o,a){return o(a)}function Pe(){}var dt=!1;function mt(o,a,d){if(dt)return o(a,d);dt=!0;try{return pe(o,a,d)}finally{dt=!1,(Jr!==null||Mr!==null)&&(Pe(),Y())}}function Ee(o,a){var d=o.stateNode;if(d===null)return null;var m=ma(d);if(m===null)return null;d=m[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(o=o.type,m=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!m;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(n(231,a,typeof d));return d}var ke=!1;if(c)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){ke=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{ke=!1}function It(o,a,d,m,b,E,S,T,D){var W=Array.prototype.slice.call(arguments,3);try{a.apply(d,W)}catch(se){this.onError(se)}}var lt=!1,fr=null,Qr=!1,Wi=null,qu={onError:function(o){lt=!0,fr=o}};function So(o,a,d,m,b,E,S,T,D){lt=!1,fr=null,It.apply(qu,arguments)}function Gu(o,a,d,m,b,E,S,T,D){if(So.apply(this,arguments),lt){if(lt){var W=fr;lt=!1,fr=null}else throw Error(n(198));Qr||(Qr=!0,Wi=W)}}function Or(o){var a=o,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(d=a.return),o=a.return;while(o)}return a.tag===3?d:null}function ql(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function Co(o){if(Or(o)!==o)throw Error(n(188))}function Os(o){var a=o.alternate;if(!a){if(a=Or(o),a===null)throw Error(n(188));return a!==o?null:o}for(var d=o,m=a;;){var b=d.return;if(b===null)break;var E=b.alternate;if(E===null){if(m=b.return,m!==null){d=m;continue}break}if(b.child===E.child){for(E=b.child;E;){if(E===d)return Co(b),o;if(E===m)return Co(b),a;E=E.sibling}throw Error(n(188))}if(d.return!==m.return)d=b,m=E;else{for(var S=!1,T=b.child;T;){if(T===d){S=!0,d=b,m=E;break}if(T===m){S=!0,m=b,d=E;break}T=T.sibling}if(!S){for(T=E.child;T;){if(T===d){S=!0,d=E,m=b;break}if(T===m){S=!0,m=E,d=b;break}T=T.sibling}if(!S)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?o:a}function Gl(o){return o=Os(o),o!==null?Yl(o):null}function Yl(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var a=Yl(o);if(a!==null)return a;o=o.sibling}return null}var Jl=e.unstable_scheduleCallback,Qn=e.unstable_cancelCallback,Ql=e.unstable_shouldYield,Xl=e.unstable_requestPaint,kt=e.unstable_now,Yu=e.unstable_getCurrentPriorityLevel,No=e.unstable_ImmediatePriority,Vi=e.unstable_UserBlockingPriority,Rs=e.unstable_NormalPriority,ce=e.unstable_LowPriority,_e=e.unstable_IdlePriority,Fe=null,We=null;function At(o){if(We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(Fe,o,void 0,(o.current.flags&128)===128)}catch{}}var Et=Math.clz32?Math.clz32:dn,pr=Math.log,Is=Math.LN2;function dn(o){return o>>>=0,o===0?32:31-(pr(o)/Is|0)|0}var fn=64,Ki=4194304;function Xr(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function qi(o,a){var d=o.pendingLanes;if(d===0)return 0;var m=0,b=o.suspendedLanes,E=o.pingedLanes,S=d&268435455;if(S!==0){var T=S&~b;T!==0?m=Xr(T):(E&=S,E!==0&&(m=Xr(E)))}else S=d&~b,S!==0?m=Xr(S):E!==0&&(m=Xr(E));if(m===0)return 0;if(a!==0&&a!==m&&(a&b)===0&&(b=m&-m,E=a&-a,b>=E||b===16&&(E&4194240)!==0))return a;if((m&4)!==0&&(m|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=m;0<a;)d=31-Et(a),b=1<<d,m|=o[d],a&=~b;return m}function Ju(o,a){switch(o){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qu(o,a){for(var d=o.suspendedLanes,m=o.pingedLanes,b=o.expirationTimes,E=o.pendingLanes;0<E;){var S=31-Et(E),T=1<<S,D=b[S];D===-1?((T&d)===0||(T&m)!==0)&&(b[S]=Ju(T,a)):D<=a&&(o.expiredLanes|=T),E&=~T}}function _o(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Zl(){var o=fn;return fn<<=1,(fn&4194240)===0&&(fn=64),o}function Zr(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function ei(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-Et(a),o[a]=d}function Pn(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var m=o.eventTimes;for(o=o.expirationTimes;0<d;){var b=31-Et(d),E=1<<b;a[b]=0,m[b]=-1,o[b]=-1,d&=~E}}function To(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var m=31-Et(d),b=1<<m;b&a|o[m]&a&&(o[m]|=a),d&=~b}}var Ge=0;function je(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var Mo,Ot,nt,Gi,hr,Yi=!1,ti=[],fe=null,we=null,De=null,qe=new Map,St=new Map,Ft=[],Xu="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ea(o,a){switch(o){case"focusin":case"focusout":fe=null;break;case"dragenter":case"dragleave":we=null;break;case"mouseover":case"mouseout":De=null;break;case"pointerover":case"pointerout":qe.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":St.delete(a.pointerId)}}function Ao(o,a,d,m,b,E){return o===null||o.nativeEvent!==E?(o={blockedOn:a,domEventName:d,eventSystemFlags:m,nativeEvent:E,targetContainers:[b]},a!==null&&(a=Wo(a),a!==null&&Ot(a)),o):(o.eventSystemFlags|=m,a=o.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),o)}function Sw(o,a,d,m,b){switch(a){case"focusin":return fe=Ao(fe,o,a,d,m,b),!0;case"dragenter":return we=Ao(we,o,a,d,m,b),!0;case"mouseover":return De=Ao(De,o,a,d,m,b),!0;case"pointerover":var E=b.pointerId;return qe.set(E,Ao(qe.get(E)||null,o,a,d,m,b)),!0;case"gotpointercapture":return E=b.pointerId,St.set(E,Ao(St.get(E)||null,o,a,d,m,b)),!0}return!1}function Gh(o){var a=Ji(o.target);if(a!==null){var d=Or(a);if(d!==null){if(a=d.tag,a===13){if(a=ql(d),a!==null){o.blockedOn=a,hr(o.priority,function(){nt(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function ta(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var d=ed(o.domEventName,o.eventSystemFlags,a[0],o.nativeEvent);if(d===null){d=o.nativeEvent;var m=new d.constructor(d.type,d);Hi=m,d.target.dispatchEvent(m),Hi=null}else return a=Wo(d),a!==null&&Ot(a),o.blockedOn=d,!1;a.shift()}return!0}function Yh(o,a,d){ta(o)&&d.delete(a)}function Cw(){Yi=!1,fe!==null&&ta(fe)&&(fe=null),we!==null&&ta(we)&&(we=null),De!==null&&ta(De)&&(De=null),qe.forEach(Yh),St.forEach(Yh)}function Oo(o,a){o.blockedOn===a&&(o.blockedOn=null,Yi||(Yi=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Cw)))}function Ro(o){function a(b){return Oo(b,o)}if(0<ti.length){Oo(ti[0],o);for(var d=1;d<ti.length;d++){var m=ti[d];m.blockedOn===o&&(m.blockedOn=null)}}for(fe!==null&&Oo(fe,o),we!==null&&Oo(we,o),De!==null&&Oo(De,o),qe.forEach(a),St.forEach(a),d=0;d<Ft.length;d++)m=Ft[d],m.blockedOn===o&&(m.blockedOn=null);for(;0<Ft.length&&(d=Ft[0],d.blockedOn===null);)Gh(d),d.blockedOn===null&&Ft.shift()}var Ls=P.ReactCurrentBatchConfig,na=!0;function Nw(o,a,d,m){var b=Ge,E=Ls.transition;Ls.transition=null;try{Ge=1,Zu(o,a,d,m)}finally{Ge=b,Ls.transition=E}}function _w(o,a,d,m){var b=Ge,E=Ls.transition;Ls.transition=null;try{Ge=4,Zu(o,a,d,m)}finally{Ge=b,Ls.transition=E}}function Zu(o,a,d,m){if(na){var b=ed(o,a,d,m);if(b===null)yd(o,a,m,ra,d),ea(o,m);else if(Sw(b,o,a,d,m))m.stopPropagation();else if(ea(o,m),a&4&&-1<Xu.indexOf(o)){for(;b!==null;){var E=Wo(b);if(E!==null&&Mo(E),E=ed(o,a,d,m),E===null&&yd(o,a,m,ra,d),E===b)break;b=E}b!==null&&m.stopPropagation()}else yd(o,a,m,null,d)}}var ra=null;function ed(o,a,d,m){if(ra=null,o=Ms(m),o=Ji(o),o!==null)if(a=Or(o),a===null)o=null;else if(d=a.tag,d===13){if(o=ql(a),o!==null)return o;o=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null);return ra=o,null}function Jh(o){switch(o){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Yu()){case No:return 1;case Vi:return 4;case Rs:case ce:return 16;case _e:return 536870912;default:return 16}default:return 16}}var ni=null,td=null,ia=null;function Qh(){if(ia)return ia;var o,a=td,d=a.length,m,b="value"in ni?ni.value:ni.textContent,E=b.length;for(o=0;o<d&&a[o]===b[o];o++);var S=d-o;for(m=1;m<=S&&a[d-m]===b[E-m];m++);return ia=b.slice(o,1<m?1-m:void 0)}function sa(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function oa(){return!0}function Xh(){return!1}function Tn(o){function a(d,m,b,E,S){this._reactName=d,this._targetInst=b,this.type=m,this.nativeEvent=E,this.target=S,this.currentTarget=null;for(var T in o)o.hasOwnProperty(T)&&(d=o[T],this[T]=d?d(E):E[T]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?oa:Xh,this.isPropagationStopped=Xh,this}return q(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=oa)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=oa)},persist:function(){},isPersistent:oa}),a}var Ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nd=Tn(Ds),Io=q({},Ds,{view:0,detail:0}),Tw=Tn(Io),rd,id,Lo,la=q({},Io,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:od,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Lo&&(Lo&&o.type==="mousemove"?(rd=o.screenX-Lo.screenX,id=o.screenY-Lo.screenY):id=rd=0,Lo=o),rd)},movementY:function(o){return"movementY"in o?o.movementY:id}}),Zh=Tn(la),Mw=q({},la,{dataTransfer:0}),Aw=Tn(Mw),Ow=q({},Io,{relatedTarget:0}),sd=Tn(Ow),Rw=q({},Ds,{animationName:0,elapsedTime:0,pseudoElement:0}),Iw=Tn(Rw),Lw=q({},Ds,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Dw=Tn(Lw),Pw=q({},Ds,{data:0}),em=Tn(Pw),Bw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jw={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"},zw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fw(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=zw[o])?!!a[o]:!1}function od(){return Fw}var $w=q({},Io,{key:function(o){if(o.key){var a=Bw[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=sa(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?jw[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:od,charCode:function(o){return o.type==="keypress"?sa(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?sa(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Uw=Tn($w),Hw=q({},la,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tm=Tn(Hw),Ww=q({},Io,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:od}),Vw=Tn(Ww),Kw=q({},Ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),qw=Tn(Kw),Gw=q({},la,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),Yw=Tn(Gw),Jw=[9,13,27,32],ld=c&&"CompositionEvent"in window,Do=null;c&&"documentMode"in document&&(Do=document.documentMode);var Qw=c&&"TextEvent"in window&&!Do,nm=c&&(!ld||Do&&8<Do&&11>=Do),rm=" ",im=!1;function sm(o,a){switch(o){case"keyup":return Jw.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function om(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ps=!1;function Xw(o,a){switch(o){case"compositionend":return om(a);case"keypress":return a.which!==32?null:(im=!0,rm);case"textInput":return o=a.data,o===rm&&im?null:o;default:return null}}function Zw(o,a){if(Ps)return o==="compositionend"||!ld&&sm(o,a)?(o=Qh(),ia=td=ni=null,Ps=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return nm&&a.locale!=="ko"?null:a.data;default:return null}}var ex={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 lm(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!ex[o.type]:a==="textarea"}function am(o,a,d,m){L(m),a=fa(a,"onChange"),0<a.length&&(d=new nd("onChange","change",null,d,m),o.push({event:d,listeners:a}))}var Po=null,Bo=null;function tx(o){Nm(o,0)}function aa(o){var a=$s(o);if(Ve(a))return o}function nx(o,a){if(o==="change")return a}var cm=!1;if(c){var ad;if(c){var cd="oninput"in document;if(!cd){var um=document.createElement("div");um.setAttribute("oninput","return;"),cd=typeof um.oninput=="function"}ad=cd}else ad=!1;cm=ad&&(!document.documentMode||9<document.documentMode)}function dm(){Po&&(Po.detachEvent("onpropertychange",fm),Bo=Po=null)}function fm(o){if(o.propertyName==="value"&&aa(Bo)){var a=[];am(a,Bo,o,Ms(o)),mt(tx,a)}}function rx(o,a,d){o==="focusin"?(dm(),Po=a,Bo=d,Po.attachEvent("onpropertychange",fm)):o==="focusout"&&dm()}function ix(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return aa(Bo)}function sx(o,a){if(o==="click")return aa(a)}function ox(o,a){if(o==="input"||o==="change")return aa(a)}function lx(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var Xn=typeof Object.is=="function"?Object.is:lx;function jo(o,a){if(Xn(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),m=Object.keys(a);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var b=d[m];if(!u.call(a,b)||!Xn(o[b],a[b]))return!1}return!0}function pm(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function hm(o,a){var d=pm(o);o=0;for(var m;d;){if(d.nodeType===3){if(m=o+d.textContent.length,o<=a&&m>=a)return{node:d,offset:a-o};o=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=pm(d)}}function mm(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?mm(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function gm(){for(var o=window,a=Je();a instanceof o.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)o=a.contentWindow;else break;a=Je(o.document)}return a}function ud(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}function ax(o){var a=gm(),d=o.focusedElem,m=o.selectionRange;if(a!==d&&d&&d.ownerDocument&&mm(d.ownerDocument.documentElement,d)){if(m!==null&&ud(d)){if(a=m.start,o=m.end,o===void 0&&(o=a),"selectionStart"in d)d.selectionStart=a,d.selectionEnd=Math.min(o,d.value.length);else if(o=(a=d.ownerDocument||document)&&a.defaultView||window,o.getSelection){o=o.getSelection();var b=d.textContent.length,E=Math.min(m.start,b);m=m.end===void 0?E:Math.min(m.end,b),!o.extend&&E>m&&(b=m,m=E,E=b),b=hm(d,E);var S=hm(d,m);b&&S&&(o.rangeCount!==1||o.anchorNode!==b.node||o.anchorOffset!==b.offset||o.focusNode!==S.node||o.focusOffset!==S.offset)&&(a=a.createRange(),a.setStart(b.node,b.offset),o.removeAllRanges(),E>m?(o.addRange(a),o.extend(S.node,S.offset)):(a.setEnd(S.node,S.offset),o.addRange(a)))}}for(a=[],o=d;o=o.parentNode;)o.nodeType===1&&a.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<a.length;d++)o=a[d],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var cx=c&&"documentMode"in document&&11>=document.documentMode,Bs=null,dd=null,zo=null,fd=!1;function ym(o,a,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;fd||Bs==null||Bs!==Je(m)||(m=Bs,"selectionStart"in m&&ud(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),zo&&jo(zo,m)||(zo=m,m=fa(dd,"onSelect"),0<m.length&&(a=new nd("onSelect","select",null,a,d),o.push({event:a,listeners:m}),a.target=Bs)))}function ca(o,a){var d={};return d[o.toLowerCase()]=a.toLowerCase(),d["Webkit"+o]="webkit"+a,d["Moz"+o]="moz"+a,d}var js={animationend:ca("Animation","AnimationEnd"),animationiteration:ca("Animation","AnimationIteration"),animationstart:ca("Animation","AnimationStart"),transitionend:ca("Transition","TransitionEnd")},pd={},bm={};c&&(bm=document.createElement("div").style,"AnimationEvent"in window||(delete js.animationend.animation,delete js.animationiteration.animation,delete js.animationstart.animation),"TransitionEvent"in window||delete js.transitionend.transition);function ua(o){if(pd[o])return pd[o];if(!js[o])return o;var a=js[o],d;for(d in a)if(a.hasOwnProperty(d)&&d in bm)return pd[o]=a[d];return o}var vm=ua("animationend"),km=ua("animationiteration"),Em=ua("animationstart"),wm=ua("transitionend"),xm=new Map,Sm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ri(o,a){xm.set(o,a),s(a,[o])}for(var hd=0;hd<Sm.length;hd++){var md=Sm[hd],ux=md.toLowerCase(),dx=md[0].toUpperCase()+md.slice(1);ri(ux,"on"+dx)}ri(vm,"onAnimationEnd"),ri(km,"onAnimationIteration"),ri(Em,"onAnimationStart"),ri("dblclick","onDoubleClick"),ri("focusin","onFocus"),ri("focusout","onBlur"),ri(wm,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fo="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(" "),fx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fo));function Cm(o,a,d){var m=o.type||"unknown-event";o.currentTarget=d,Gu(m,a,void 0,o),o.currentTarget=null}function Nm(o,a){a=(a&4)!==0;for(var d=0;d<o.length;d++){var m=o[d],b=m.event;m=m.listeners;e:{var E=void 0;if(a)for(var S=m.length-1;0<=S;S--){var T=m[S],D=T.instance,W=T.currentTarget;if(T=T.listener,D!==E&&b.isPropagationStopped())break e;Cm(b,T,W),E=D}else for(S=0;S<m.length;S++){if(T=m[S],D=T.instance,W=T.currentTarget,T=T.listener,D!==E&&b.isPropagationStopped())break e;Cm(b,T,W),E=D}}}if(Qr)throw o=Wi,Qr=!1,Wi=null,o}function ft(o,a){var d=a[xd];d===void 0&&(d=a[xd]=new Set);var m=o+"__bubble";d.has(m)||(_m(a,o,2,!1),d.add(m))}function gd(o,a,d){var m=0;a&&(m|=4),_m(d,o,m,a)}var da="_reactListening"+Math.random().toString(36).slice(2);function $o(o){if(!o[da]){o[da]=!0,r.forEach(function(d){d!=="selectionchange"&&(fx.has(d)||gd(d,!1,o),gd(d,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[da]||(a[da]=!0,gd("selectionchange",!1,a))}}function _m(o,a,d,m){switch(Jh(a)){case 1:var b=Nw;break;case 4:b=_w;break;default:b=Zu}d=b.bind(null,a,d,o),b=void 0,!ke||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),m?b!==void 0?o.addEventListener(a,d,{capture:!0,passive:b}):o.addEventListener(a,d,!0):b!==void 0?o.addEventListener(a,d,{passive:b}):o.addEventListener(a,d,!1)}function yd(o,a,d,m,b){var E=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var S=m.tag;if(S===3||S===4){var T=m.stateNode.containerInfo;if(T===b||T.nodeType===8&&T.parentNode===b)break;if(S===4)for(S=m.return;S!==null;){var D=S.tag;if((D===3||D===4)&&(D=S.stateNode.containerInfo,D===b||D.nodeType===8&&D.parentNode===b))return;S=S.return}for(;T!==null;){if(S=Ji(T),S===null)return;if(D=S.tag,D===5||D===6){m=E=S;continue e}T=T.parentNode}}m=m.return}mt(function(){var W=E,se=Ms(d),oe=[];e:{var re=xm.get(o);if(re!==void 0){var ve=nd,Se=o;switch(o){case"keypress":if(sa(d)===0)break e;case"keydown":case"keyup":ve=Uw;break;case"focusin":Se="focus",ve=sd;break;case"focusout":Se="blur",ve=sd;break;case"beforeblur":case"afterblur":ve=sd;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=Zh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=Aw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=Vw;break;case vm:case km:case Em:ve=Iw;break;case wm:ve=qw;break;case"scroll":ve=Tw;break;case"wheel":ve=Yw;break;case"copy":case"cut":case"paste":ve=Dw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=tm}var Ce=(a&4)!==0,Rt=!Ce&&o==="scroll",z=Ce?re!==null?re+"Capture":null:re;Ce=[];for(var B=W,F;B!==null;){F=B;var ue=F.stateNode;if(F.tag===5&&ue!==null&&(F=ue,z!==null&&(ue=Ee(B,z),ue!=null&&Ce.push(Uo(B,ue,F)))),Rt)break;B=B.return}0<Ce.length&&(re=new ve(re,Se,null,d,se),oe.push({event:re,listeners:Ce}))}}if((a&7)===0){e:{if(re=o==="mouseover"||o==="pointerover",ve=o==="mouseout"||o==="pointerout",re&&d!==Hi&&(Se=d.relatedTarget||d.fromElement)&&(Ji(Se)||Se[Rr]))break e;if((ve||re)&&(re=se.window===se?se:(re=se.ownerDocument)?re.defaultView||re.parentWindow:window,ve?(Se=d.relatedTarget||d.toElement,ve=W,Se=Se?Ji(Se):null,Se!==null&&(Rt=Or(Se),Se!==Rt||Se.tag!==5&&Se.tag!==6)&&(Se=null)):(ve=null,Se=W),ve!==Se)){if(Ce=Zh,ue="onMouseLeave",z="onMouseEnter",B="mouse",(o==="pointerout"||o==="pointerover")&&(Ce=tm,ue="onPointerLeave",z="onPointerEnter",B="pointer"),Rt=ve==null?re:$s(ve),F=Se==null?re:$s(Se),re=new Ce(ue,B+"leave",ve,d,se),re.target=Rt,re.relatedTarget=F,ue=null,Ji(se)===W&&(Ce=new Ce(z,B+"enter",Se,d,se),Ce.target=F,Ce.relatedTarget=Rt,ue=Ce),Rt=ue,ve&&Se)t:{for(Ce=ve,z=Se,B=0,F=Ce;F;F=zs(F))B++;for(F=0,ue=z;ue;ue=zs(ue))F++;for(;0<B-F;)Ce=zs(Ce),B--;for(;0<F-B;)z=zs(z),F--;for(;B--;){if(Ce===z||z!==null&&Ce===z.alternate)break t;Ce=zs(Ce),z=zs(z)}Ce=null}else Ce=null;ve!==null&&Tm(oe,re,ve,Ce,!1),Se!==null&&Rt!==null&&Tm(oe,Rt,Se,Ce,!0)}}e:{if(re=W?$s(W):window,ve=re.nodeName&&re.nodeName.toLowerCase(),ve==="select"||ve==="input"&&re.type==="file")var Ne=nx;else if(lm(re))if(cm)Ne=ox;else{Ne=ix;var Re=rx}else(ve=re.nodeName)&&ve.toLowerCase()==="input"&&(re.type==="checkbox"||re.type==="radio")&&(Ne=sx);if(Ne&&(Ne=Ne(o,W))){am(oe,Ne,d,se);break e}Re&&Re(o,re,W),o==="focusout"&&(Re=re._wrapperState)&&Re.controlled&&re.type==="number"&&_r(re,"number",re.value)}switch(Re=W?$s(W):window,o){case"focusin":(lm(Re)||Re.contentEditable==="true")&&(Bs=Re,dd=W,zo=null);break;case"focusout":zo=dd=Bs=null;break;case"mousedown":fd=!0;break;case"contextmenu":case"mouseup":case"dragend":fd=!1,ym(oe,d,se);break;case"selectionchange":if(cx)break;case"keydown":case"keyup":ym(oe,d,se)}var Ie;if(ld)e:{switch(o){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else Ps?sm(o,d)&&(Be="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(Be="onCompositionStart");Be&&(nm&&d.locale!=="ko"&&(Ps||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&Ps&&(Ie=Qh()):(ni=se,td="value"in ni?ni.value:ni.textContent,Ps=!0)),Re=fa(W,Be),0<Re.length&&(Be=new em(Be,o,null,d,se),oe.push({event:Be,listeners:Re}),Ie?Be.data=Ie:(Ie=om(d),Ie!==null&&(Be.data=Ie)))),(Ie=Qw?Xw(o,d):Zw(o,d))&&(W=fa(W,"onBeforeInput"),0<W.length&&(se=new em("onBeforeInput","beforeinput",null,d,se),oe.push({event:se,listeners:W}),se.data=Ie))}Nm(oe,a)})}function Uo(o,a,d){return{instance:o,listener:a,currentTarget:d}}function fa(o,a){for(var d=a+"Capture",m=[];o!==null;){var b=o,E=b.stateNode;b.tag===5&&E!==null&&(b=E,E=Ee(o,d),E!=null&&m.unshift(Uo(o,E,b)),E=Ee(o,a),E!=null&&m.push(Uo(o,E,b))),o=o.return}return m}function zs(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function Tm(o,a,d,m,b){for(var E=a._reactName,S=[];d!==null&&d!==m;){var T=d,D=T.alternate,W=T.stateNode;if(D!==null&&D===m)break;T.tag===5&&W!==null&&(T=W,b?(D=Ee(d,E),D!=null&&S.unshift(Uo(d,D,T))):b||(D=Ee(d,E),D!=null&&S.push(Uo(d,D,T)))),d=d.return}S.length!==0&&o.push({event:a,listeners:S})}var px=/\r\n?/g,hx=/\u0000|\uFFFD/g;function Mm(o){return(typeof o=="string"?o:""+o).replace(px,`
38
+ `).replace(hx,"")}function pa(o,a,d){if(a=Mm(a),Mm(o)!==a&&d)throw Error(n(425))}function ha(){}var bd=null,vd=null;function kd(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Ed=typeof setTimeout=="function"?setTimeout:void 0,mx=typeof clearTimeout=="function"?clearTimeout:void 0,Am=typeof Promise=="function"?Promise:void 0,gx=typeof queueMicrotask=="function"?queueMicrotask:typeof Am<"u"?function(o){return Am.resolve(null).then(o).catch(yx)}:Ed;function yx(o){setTimeout(function(){throw o})}function wd(o,a){var d=a,m=0;do{var b=d.nextSibling;if(o.removeChild(d),b&&b.nodeType===8)if(d=b.data,d==="/$"){if(m===0){o.removeChild(b),Ro(a);return}m--}else d!=="$"&&d!=="$?"&&d!=="$!"||m++;d=b}while(d);Ro(a)}function ii(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return o}function Om(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"){if(a===0)return o;a--}else d==="/$"&&a++}o=o.previousSibling}return null}var Fs=Math.random().toString(36).slice(2),mr="__reactFiber$"+Fs,Ho="__reactProps$"+Fs,Rr="__reactContainer$"+Fs,xd="__reactEvents$"+Fs,bx="__reactListeners$"+Fs,vx="__reactHandles$"+Fs;function Ji(o){var a=o[mr];if(a)return a;for(var d=o.parentNode;d;){if(a=d[Rr]||d[mr]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(o=Om(o);o!==null;){if(d=o[mr])return d;o=Om(o)}return a}o=d,d=o.parentNode}return null}function Wo(o){return o=o[mr]||o[Rr],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function $s(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function ma(o){return o[Ho]||null}var Sd=[],Us=-1;function si(o){return{current:o}}function pt(o){0>Us||(o.current=Sd[Us],Sd[Us]=null,Us--)}function at(o,a){Us++,Sd[Us]=o.current,o.current=a}var oi={},tn=si(oi),kn=si(!1),Qi=oi;function Hs(o,a){var d=o.type.contextTypes;if(!d)return oi;var m=o.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var b={},E;for(E in d)b[E]=a[E];return m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=b),b}function En(o){return o=o.childContextTypes,o!=null}function ga(){pt(kn),pt(tn)}function Rm(o,a,d){if(tn.current!==oi)throw Error(n(168));at(tn,a),at(kn,d)}function Im(o,a,d){var m=o.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var b in m)if(!(b in a))throw Error(n(108,ne(o)||"Unknown",b));return q({},d,m)}function ya(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||oi,Qi=tn.current,at(tn,o),at(kn,kn.current),!0}function Lm(o,a,d){var m=o.stateNode;if(!m)throw Error(n(169));d?(o=Im(o,a,Qi),m.__reactInternalMemoizedMergedChildContext=o,pt(kn),pt(tn),at(tn,o)):pt(kn),at(kn,d)}var Ir=null,ba=!1,Cd=!1;function Dm(o){Ir===null?Ir=[o]:Ir.push(o)}function kx(o){ba=!0,Dm(o)}function li(){if(!Cd&&Ir!==null){Cd=!0;var o=0,a=Ge;try{var d=Ir;for(Ge=1;o<d.length;o++){var m=d[o];do m=m(!0);while(m!==null)}Ir=null,ba=!1}catch(b){throw Ir!==null&&(Ir=Ir.slice(o+1)),Jl(No,li),b}finally{Ge=a,Cd=!1}}return null}var Ws=[],Vs=0,va=null,ka=0,Bn=[],jn=0,Xi=null,Lr=1,Dr="";function Zi(o,a){Ws[Vs++]=ka,Ws[Vs++]=va,va=o,ka=a}function Pm(o,a,d){Bn[jn++]=Lr,Bn[jn++]=Dr,Bn[jn++]=Xi,Xi=o;var m=Lr;o=Dr;var b=32-Et(m)-1;m&=~(1<<b),d+=1;var E=32-Et(a)+b;if(30<E){var S=b-b%5;E=(m&(1<<S)-1).toString(32),m>>=S,b-=S,Lr=1<<32-Et(a)+b|d<<b|m,Dr=E+o}else Lr=1<<E|d<<b|m,Dr=o}function Nd(o){o.return!==null&&(Zi(o,1),Pm(o,1,0))}function _d(o){for(;o===va;)va=Ws[--Vs],Ws[Vs]=null,ka=Ws[--Vs],Ws[Vs]=null;for(;o===Xi;)Xi=Bn[--jn],Bn[jn]=null,Dr=Bn[--jn],Bn[jn]=null,Lr=Bn[--jn],Bn[jn]=null}var Mn=null,An=null,gt=!1,Zn=null;function Bm(o,a){var d=Un(5,null,null,0);d.elementType="DELETED",d.stateNode=a,d.return=o,a=o.deletions,a===null?(o.deletions=[d],o.flags|=16):a.push(d)}function jm(o,a){switch(o.tag){case 5:var d=o.type;return a=a.nodeType!==1||d.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(o.stateNode=a,Mn=o,An=ii(a.firstChild),!0):!1;case 6:return a=o.pendingProps===""||a.nodeType!==3?null:a,a!==null?(o.stateNode=a,Mn=o,An=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(d=Xi!==null?{id:Lr,overflow:Dr}:null,o.memoizedState={dehydrated:a,treeContext:d,retryLane:1073741824},d=Un(18,null,null,0),d.stateNode=a,d.return=o,o.child=d,Mn=o,An=null,!0):!1;default:return!1}}function Td(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Md(o){if(gt){var a=An;if(a){var d=a;if(!jm(o,a)){if(Td(o))throw Error(n(418));a=ii(d.nextSibling);var m=Mn;a&&jm(o,a)?Bm(m,d):(o.flags=o.flags&-4097|2,gt=!1,Mn=o)}}else{if(Td(o))throw Error(n(418));o.flags=o.flags&-4097|2,gt=!1,Mn=o}}}function zm(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;Mn=o}function Ea(o){if(o!==Mn)return!1;if(!gt)return zm(o),gt=!0,!1;var a;if((a=o.tag!==3)&&!(a=o.tag!==5)&&(a=o.type,a=a!=="head"&&a!=="body"&&!kd(o.type,o.memoizedProps)),a&&(a=An)){if(Td(o))throw Fm(),Error(n(418));for(;a;)Bm(o,a),a=ii(a.nextSibling)}if(zm(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"){if(a===0){An=ii(o.nextSibling);break e}a--}else d!=="$"&&d!=="$!"&&d!=="$?"||a++}o=o.nextSibling}An=null}}else An=Mn?ii(o.stateNode.nextSibling):null;return!0}function Fm(){for(var o=An;o;)o=ii(o.nextSibling)}function Ks(){An=Mn=null,gt=!1}function Ad(o){Zn===null?Zn=[o]:Zn.push(o)}var Ex=P.ReactCurrentBatchConfig;function Vo(o,a,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var m=d.stateNode}if(!m)throw Error(n(147,o));var b=m,E=""+o;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===E?a.ref:(a=function(S){var T=b.refs;S===null?delete T[E]:T[E]=S},a._stringRef=E,a)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function wa(o,a){throw o=Object.prototype.toString.call(a),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o))}function $m(o){var a=o._init;return a(o._payload)}function Um(o){function a(z,B){if(o){var F=z.deletions;F===null?(z.deletions=[B],z.flags|=16):F.push(B)}}function d(z,B){if(!o)return null;for(;B!==null;)a(z,B),B=B.sibling;return null}function m(z,B){for(z=new Map;B!==null;)B.key!==null?z.set(B.key,B):z.set(B.index,B),B=B.sibling;return z}function b(z,B){return z=mi(z,B),z.index=0,z.sibling=null,z}function E(z,B,F){return z.index=F,o?(F=z.alternate,F!==null?(F=F.index,F<B?(z.flags|=2,B):F):(z.flags|=2,B)):(z.flags|=1048576,B)}function S(z){return o&&z.alternate===null&&(z.flags|=2),z}function T(z,B,F,ue){return B===null||B.tag!==6?(B=wf(F,z.mode,ue),B.return=z,B):(B=b(B,F),B.return=z,B)}function D(z,B,F,ue){var Ne=F.type;return Ne===$?se(z,B,F.props.children,ue,F.key):B!==null&&(B.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ie&&$m(Ne)===B.type)?(ue=b(B,F.props),ue.ref=Vo(z,B,F),ue.return=z,ue):(ue=Ka(F.type,F.key,F.props,null,z.mode,ue),ue.ref=Vo(z,B,F),ue.return=z,ue)}function W(z,B,F,ue){return B===null||B.tag!==4||B.stateNode.containerInfo!==F.containerInfo||B.stateNode.implementation!==F.implementation?(B=xf(F,z.mode,ue),B.return=z,B):(B=b(B,F.children||[]),B.return=z,B)}function se(z,B,F,ue,Ne){return B===null||B.tag!==7?(B=as(F,z.mode,ue,Ne),B.return=z,B):(B=b(B,F),B.return=z,B)}function oe(z,B,F){if(typeof B=="string"&&B!==""||typeof B=="number")return B=wf(""+B,z.mode,F),B.return=z,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case O:return F=Ka(B.type,B.key,B.props,null,z.mode,F),F.ref=Vo(z,null,B),F.return=z,F;case R:return B=xf(B,z.mode,F),B.return=z,B;case ie:var ue=B._init;return oe(z,ue(B._payload),F)}if(cr(B)||j(B))return B=as(B,z.mode,F,null),B.return=z,B;wa(z,B)}return null}function re(z,B,F,ue){var Ne=B!==null?B.key:null;if(typeof F=="string"&&F!==""||typeof F=="number")return Ne!==null?null:T(z,B,""+F,ue);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case O:return F.key===Ne?D(z,B,F,ue):null;case R:return F.key===Ne?W(z,B,F,ue):null;case ie:return Ne=F._init,re(z,B,Ne(F._payload),ue)}if(cr(F)||j(F))return Ne!==null?null:se(z,B,F,ue,null);wa(z,F)}return null}function ve(z,B,F,ue,Ne){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return z=z.get(F)||null,T(B,z,""+ue,Ne);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case O:return z=z.get(ue.key===null?F:ue.key)||null,D(B,z,ue,Ne);case R:return z=z.get(ue.key===null?F:ue.key)||null,W(B,z,ue,Ne);case ie:var Re=ue._init;return ve(z,B,F,Re(ue._payload),Ne)}if(cr(ue)||j(ue))return z=z.get(F)||null,se(B,z,ue,Ne,null);wa(B,ue)}return null}function Se(z,B,F,ue){for(var Ne=null,Re=null,Ie=B,Be=B=0,Ht=null;Ie!==null&&Be<F.length;Be++){Ie.index>Be?(Ht=Ie,Ie=null):Ht=Ie.sibling;var Qe=re(z,Ie,F[Be],ue);if(Qe===null){Ie===null&&(Ie=Ht);break}o&&Ie&&Qe.alternate===null&&a(z,Ie),B=E(Qe,B,Be),Re===null?Ne=Qe:Re.sibling=Qe,Re=Qe,Ie=Ht}if(Be===F.length)return d(z,Ie),gt&&Zi(z,Be),Ne;if(Ie===null){for(;Be<F.length;Be++)Ie=oe(z,F[Be],ue),Ie!==null&&(B=E(Ie,B,Be),Re===null?Ne=Ie:Re.sibling=Ie,Re=Ie);return gt&&Zi(z,Be),Ne}for(Ie=m(z,Ie);Be<F.length;Be++)Ht=ve(Ie,z,Be,F[Be],ue),Ht!==null&&(o&&Ht.alternate!==null&&Ie.delete(Ht.key===null?Be:Ht.key),B=E(Ht,B,Be),Re===null?Ne=Ht:Re.sibling=Ht,Re=Ht);return o&&Ie.forEach(function(gi){return a(z,gi)}),gt&&Zi(z,Be),Ne}function Ce(z,B,F,ue){var Ne=j(F);if(typeof Ne!="function")throw Error(n(150));if(F=Ne.call(F),F==null)throw Error(n(151));for(var Re=Ne=null,Ie=B,Be=B=0,Ht=null,Qe=F.next();Ie!==null&&!Qe.done;Be++,Qe=F.next()){Ie.index>Be?(Ht=Ie,Ie=null):Ht=Ie.sibling;var gi=re(z,Ie,Qe.value,ue);if(gi===null){Ie===null&&(Ie=Ht);break}o&&Ie&&gi.alternate===null&&a(z,Ie),B=E(gi,B,Be),Re===null?Ne=gi:Re.sibling=gi,Re=gi,Ie=Ht}if(Qe.done)return d(z,Ie),gt&&Zi(z,Be),Ne;if(Ie===null){for(;!Qe.done;Be++,Qe=F.next())Qe=oe(z,Qe.value,ue),Qe!==null&&(B=E(Qe,B,Be),Re===null?Ne=Qe:Re.sibling=Qe,Re=Qe);return gt&&Zi(z,Be),Ne}for(Ie=m(z,Ie);!Qe.done;Be++,Qe=F.next())Qe=ve(Ie,z,Be,Qe.value,ue),Qe!==null&&(o&&Qe.alternate!==null&&Ie.delete(Qe.key===null?Be:Qe.key),B=E(Qe,B,Be),Re===null?Ne=Qe:Re.sibling=Qe,Re=Qe);return o&&Ie.forEach(function(eS){return a(z,eS)}),gt&&Zi(z,Be),Ne}function Rt(z,B,F,ue){if(typeof F=="object"&&F!==null&&F.type===$&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case O:e:{for(var Ne=F.key,Re=B;Re!==null;){if(Re.key===Ne){if(Ne=F.type,Ne===$){if(Re.tag===7){d(z,Re.sibling),B=b(Re,F.props.children),B.return=z,z=B;break e}}else if(Re.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ie&&$m(Ne)===Re.type){d(z,Re.sibling),B=b(Re,F.props),B.ref=Vo(z,Re,F),B.return=z,z=B;break e}d(z,Re);break}else a(z,Re);Re=Re.sibling}F.type===$?(B=as(F.props.children,z.mode,ue,F.key),B.return=z,z=B):(ue=Ka(F.type,F.key,F.props,null,z.mode,ue),ue.ref=Vo(z,B,F),ue.return=z,z=ue)}return S(z);case R:e:{for(Re=F.key;B!==null;){if(B.key===Re)if(B.tag===4&&B.stateNode.containerInfo===F.containerInfo&&B.stateNode.implementation===F.implementation){d(z,B.sibling),B=b(B,F.children||[]),B.return=z,z=B;break e}else{d(z,B);break}else a(z,B);B=B.sibling}B=xf(F,z.mode,ue),B.return=z,z=B}return S(z);case ie:return Re=F._init,Rt(z,B,Re(F._payload),ue)}if(cr(F))return Se(z,B,F,ue);if(j(F))return Ce(z,B,F,ue);wa(z,F)}return typeof F=="string"&&F!==""||typeof F=="number"?(F=""+F,B!==null&&B.tag===6?(d(z,B.sibling),B=b(B,F),B.return=z,z=B):(d(z,B),B=wf(F,z.mode,ue),B.return=z,z=B),S(z)):d(z,B)}return Rt}var qs=Um(!0),Hm=Um(!1),xa=si(null),Sa=null,Gs=null,Od=null;function Rd(){Od=Gs=Sa=null}function Id(o){var a=xa.current;pt(xa),o._currentValue=a}function Ld(o,a,d){for(;o!==null;){var m=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),o===d)break;o=o.return}}function Ys(o,a){Sa=o,Od=Gs=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&a)!==0&&(wn=!0),o.firstContext=null)}function zn(o){var a=o._currentValue;if(Od!==o)if(o={context:o,memoizedValue:a,next:null},Gs===null){if(Sa===null)throw Error(n(308));Gs=o,Sa.dependencies={lanes:0,firstContext:o}}else Gs=Gs.next=o;return a}var es=null;function Dd(o){es===null?es=[o]:es.push(o)}function Wm(o,a,d,m){var b=a.interleaved;return b===null?(d.next=d,Dd(a)):(d.next=b.next,b.next=d),a.interleaved=d,Pr(o,m)}function Pr(o,a){o.lanes|=a;var d=o.alternate;for(d!==null&&(d.lanes|=a),d=o,o=o.return;o!==null;)o.childLanes|=a,d=o.alternate,d!==null&&(d.childLanes|=a),d=o,o=o.return;return d.tag===3?d.stateNode:null}var ai=!1;function Pd(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vm(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Br(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function ci(o,a,d){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(Ye&2)!==0){var b=m.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),m.pending=a,Pr(o,d)}return b=m.interleaved,b===null?(a.next=a,Dd(m)):(a.next=b.next,b.next=a),m.interleaved=a,Pr(o,d)}function Ca(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,To(o,d)}}function Km(o,a){var d=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var b=null,E=null;if(d=d.firstBaseUpdate,d!==null){do{var S={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};E===null?b=E=S:E=E.next=S,d=d.next}while(d!==null);E===null?b=E=a:E=E.next=a}else b=E=a;d={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:E,shared:m.shared,effects:m.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}function Na(o,a,d,m){var b=o.updateQueue;ai=!1;var E=b.firstBaseUpdate,S=b.lastBaseUpdate,T=b.shared.pending;if(T!==null){b.shared.pending=null;var D=T,W=D.next;D.next=null,S===null?E=W:S.next=W,S=D;var se=o.alternate;se!==null&&(se=se.updateQueue,T=se.lastBaseUpdate,T!==S&&(T===null?se.firstBaseUpdate=W:T.next=W,se.lastBaseUpdate=D))}if(E!==null){var oe=b.baseState;S=0,se=W=D=null,T=E;do{var re=T.lane,ve=T.eventTime;if((m&re)===re){se!==null&&(se=se.next={eventTime:ve,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var Se=o,Ce=T;switch(re=a,ve=d,Ce.tag){case 1:if(Se=Ce.payload,typeof Se=="function"){oe=Se.call(ve,oe,re);break e}oe=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ce.payload,re=typeof Se=="function"?Se.call(ve,oe,re):Se,re==null)break e;oe=q({},oe,re);break e;case 2:ai=!0}}T.callback!==null&&T.lane!==0&&(o.flags|=64,re=b.effects,re===null?b.effects=[T]:re.push(T))}else ve={eventTime:ve,lane:re,tag:T.tag,payload:T.payload,callback:T.callback,next:null},se===null?(W=se=ve,D=oe):se=se.next=ve,S|=re;if(T=T.next,T===null){if(T=b.shared.pending,T===null)break;re=T,T=re.next,re.next=null,b.lastBaseUpdate=re,b.shared.pending=null}}while(!0);if(se===null&&(D=oe),b.baseState=D,b.firstBaseUpdate=W,b.lastBaseUpdate=se,a=b.shared.interleaved,a!==null){b=a;do S|=b.lane,b=b.next;while(b!==a)}else E===null&&(b.shared.lanes=0);rs|=S,o.lanes=S,o.memoizedState=oe}}function qm(o,a,d){if(o=a.effects,a.effects=null,o!==null)for(a=0;a<o.length;a++){var m=o[a],b=m.callback;if(b!==null){if(m.callback=null,m=d,typeof b!="function")throw Error(n(191,b));b.call(m)}}}var Ko={},gr=si(Ko),qo=si(Ko),Go=si(Ko);function ts(o){if(o===Ko)throw Error(n(174));return o}function Bd(o,a){switch(at(Go,a),at(qo,o),at(gr,Ko),o=a.nodeType,o){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:dr(null,"");break;default:o=o===8?a.parentNode:a,a=o.namespaceURI||null,o=o.tagName,a=dr(a,o)}pt(gr),at(gr,a)}function Js(){pt(gr),pt(qo),pt(Go)}function Gm(o){ts(Go.current);var a=ts(gr.current),d=dr(a,o.type);a!==d&&(at(qo,o),at(gr,d))}function jd(o){qo.current===o&&(pt(gr),pt(qo))}var wt=si(0);function _a(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var zd=[];function Fd(){for(var o=0;o<zd.length;o++)zd[o]._workInProgressVersionPrimary=null;zd.length=0}var Ta=P.ReactCurrentDispatcher,$d=P.ReactCurrentBatchConfig,ns=0,xt=null,jt=null,$t=null,Ma=!1,Yo=!1,Jo=0,wx=0;function nn(){throw Error(n(321))}function Ud(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!Xn(o[d],a[d]))return!1;return!0}function Hd(o,a,d,m,b,E){if(ns=E,xt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Ta.current=o===null||o.memoizedState===null?Nx:_x,o=d(m,b),Yo){E=0;do{if(Yo=!1,Jo=0,25<=E)throw Error(n(301));E+=1,$t=jt=null,a.updateQueue=null,Ta.current=Tx,o=d(m,b)}while(Yo)}if(Ta.current=Ra,a=jt!==null&&jt.next!==null,ns=0,$t=jt=xt=null,Ma=!1,a)throw Error(n(300));return o}function Wd(){var o=Jo!==0;return Jo=0,o}function yr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?xt.memoizedState=$t=o:$t=$t.next=o,$t}function Fn(){if(jt===null){var o=xt.alternate;o=o!==null?o.memoizedState:null}else o=jt.next;var a=$t===null?xt.memoizedState:$t.next;if(a!==null)$t=a,jt=o;else{if(o===null)throw Error(n(310));jt=o,o={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},$t===null?xt.memoizedState=$t=o:$t=$t.next=o}return $t}function Qo(o,a){return typeof a=="function"?a(o):a}function Vd(o){var a=Fn(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var m=jt,b=m.baseQueue,E=d.pending;if(E!==null){if(b!==null){var S=b.next;b.next=E.next,E.next=S}m.baseQueue=b=E,d.pending=null}if(b!==null){E=b.next,m=m.baseState;var T=S=null,D=null,W=E;do{var se=W.lane;if((ns&se)===se)D!==null&&(D=D.next={lane:0,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),m=W.hasEagerState?W.eagerState:o(m,W.action);else{var oe={lane:se,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null};D===null?(T=D=oe,S=m):D=D.next=oe,xt.lanes|=se,rs|=se}W=W.next}while(W!==null&&W!==E);D===null?S=m:D.next=T,Xn(m,a.memoizedState)||(wn=!0),a.memoizedState=m,a.baseState=S,a.baseQueue=D,d.lastRenderedState=m}if(o=d.interleaved,o!==null){b=o;do E=b.lane,xt.lanes|=E,rs|=E,b=b.next;while(b!==o)}else b===null&&(d.lanes=0);return[a.memoizedState,d.dispatch]}function Kd(o){var a=Fn(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var m=d.dispatch,b=d.pending,E=a.memoizedState;if(b!==null){d.pending=null;var S=b=b.next;do E=o(E,S.action),S=S.next;while(S!==b);Xn(E,a.memoizedState)||(wn=!0),a.memoizedState=E,a.baseQueue===null&&(a.baseState=E),d.lastRenderedState=E}return[E,m]}function Ym(){}function Jm(o,a){var d=xt,m=Fn(),b=a(),E=!Xn(m.memoizedState,b);if(E&&(m.memoizedState=b,wn=!0),m=m.queue,qd(Zm.bind(null,d,m,o),[o]),m.getSnapshot!==a||E||$t!==null&&$t.memoizedState.tag&1){if(d.flags|=2048,Xo(9,Xm.bind(null,d,m,b,a),void 0,null),Ut===null)throw Error(n(349));(ns&30)!==0||Qm(d,a,b)}return b}function Qm(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=xt.updateQueue,a===null?(a={lastEffect:null,stores:null},xt.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function Xm(o,a,d,m){a.value=d,a.getSnapshot=m,eg(a)&&tg(o)}function Zm(o,a,d){return d(function(){eg(a)&&tg(o)})}function eg(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!Xn(o,d)}catch{return!0}}function tg(o){var a=Pr(o,1);a!==null&&rr(a,o,1,-1)}function ng(o){var a=yr();return typeof o=="function"&&(o=o()),a.memoizedState=a.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:o},a.queue=o,o=o.dispatch=Cx.bind(null,xt,o),[a.memoizedState,o]}function Xo(o,a,d,m){return o={tag:o,create:a,destroy:d,deps:m,next:null},a=xt.updateQueue,a===null?(a={lastEffect:null,stores:null},xt.updateQueue=a,a.lastEffect=o.next=o):(d=a.lastEffect,d===null?a.lastEffect=o.next=o:(m=d.next,d.next=o,o.next=m,a.lastEffect=o)),o}function rg(){return Fn().memoizedState}function Aa(o,a,d,m){var b=yr();xt.flags|=o,b.memoizedState=Xo(1|a,d,void 0,m===void 0?null:m)}function Oa(o,a,d,m){var b=Fn();m=m===void 0?null:m;var E=void 0;if(jt!==null){var S=jt.memoizedState;if(E=S.destroy,m!==null&&Ud(m,S.deps)){b.memoizedState=Xo(a,d,E,m);return}}xt.flags|=o,b.memoizedState=Xo(1|a,d,E,m)}function ig(o,a){return Aa(8390656,8,o,a)}function qd(o,a){return Oa(2048,8,o,a)}function sg(o,a){return Oa(4,2,o,a)}function og(o,a){return Oa(4,4,o,a)}function lg(o,a){if(typeof a=="function")return o=o(),a(o),function(){a(null)};if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function ag(o,a,d){return d=d!=null?d.concat([o]):null,Oa(4,4,lg.bind(null,a,o),d)}function Gd(){}function cg(o,a){var d=Fn();a=a===void 0?null:a;var m=d.memoizedState;return m!==null&&a!==null&&Ud(a,m[1])?m[0]:(d.memoizedState=[o,a],o)}function ug(o,a){var d=Fn();a=a===void 0?null:a;var m=d.memoizedState;return m!==null&&a!==null&&Ud(a,m[1])?m[0]:(o=o(),d.memoizedState=[o,a],o)}function dg(o,a,d){return(ns&21)===0?(o.baseState&&(o.baseState=!1,wn=!0),o.memoizedState=d):(Xn(d,a)||(d=Zl(),xt.lanes|=d,rs|=d,o.baseState=!0),a)}function xx(o,a){var d=Ge;Ge=d!==0&&4>d?d:4,o(!0);var m=$d.transition;$d.transition={};try{o(!1),a()}finally{Ge=d,$d.transition=m}}function fg(){return Fn().memoizedState}function Sx(o,a,d){var m=pi(o);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},pg(o))hg(a,d);else if(d=Wm(o,a,d,m),d!==null){var b=hn();rr(d,o,m,b),mg(d,a,m)}}function Cx(o,a,d){var m=pi(o),b={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(pg(o))hg(a,b);else{var E=o.alternate;if(o.lanes===0&&(E===null||E.lanes===0)&&(E=a.lastRenderedReducer,E!==null))try{var S=a.lastRenderedState,T=E(S,d);if(b.hasEagerState=!0,b.eagerState=T,Xn(T,S)){var D=a.interleaved;D===null?(b.next=b,Dd(a)):(b.next=D.next,D.next=b),a.interleaved=b;return}}catch{}finally{}d=Wm(o,a,b,m),d!==null&&(b=hn(),rr(d,o,m,b),mg(d,a,m))}}function pg(o){var a=o.alternate;return o===xt||a!==null&&a===xt}function hg(o,a){Yo=Ma=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function mg(o,a,d){if((d&4194240)!==0){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,To(o,d)}}var Ra={readContext:zn,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useInsertionEffect:nn,useLayoutEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useMutableSource:nn,useSyncExternalStore:nn,useId:nn,unstable_isNewReconciler:!1},Nx={readContext:zn,useCallback:function(o,a){return yr().memoizedState=[o,a===void 0?null:a],o},useContext:zn,useEffect:ig,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,Aa(4194308,4,lg.bind(null,a,o),d)},useLayoutEffect:function(o,a){return Aa(4194308,4,o,a)},useInsertionEffect:function(o,a){return Aa(4,2,o,a)},useMemo:function(o,a){var d=yr();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var m=yr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},m.queue=o,o=o.dispatch=Sx.bind(null,xt,o),[m.memoizedState,o]},useRef:function(o){var a=yr();return o={current:o},a.memoizedState=o},useState:ng,useDebugValue:Gd,useDeferredValue:function(o){return yr().memoizedState=o},useTransition:function(){var o=ng(!1),a=o[0];return o=xx.bind(null,o[1]),yr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var m=xt,b=yr();if(gt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=a(),Ut===null)throw Error(n(349));(ns&30)!==0||Qm(m,a,d)}b.memoizedState=d;var E={value:d,getSnapshot:a};return b.queue=E,ig(Zm.bind(null,m,E,o),[o]),m.flags|=2048,Xo(9,Xm.bind(null,m,E,d,a),void 0,null),d},useId:function(){var o=yr(),a=Ut.identifierPrefix;if(gt){var d=Dr,m=Lr;d=(m&~(1<<32-Et(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Jo++,0<d&&(a+="H"+d.toString(32)),a+=":"}else d=wx++,a=":"+a+"r"+d.toString(32)+":";return o.memoizedState=a},unstable_isNewReconciler:!1},_x={readContext:zn,useCallback:cg,useContext:zn,useEffect:qd,useImperativeHandle:ag,useInsertionEffect:sg,useLayoutEffect:og,useMemo:ug,useReducer:Vd,useRef:rg,useState:function(){return Vd(Qo)},useDebugValue:Gd,useDeferredValue:function(o){var a=Fn();return dg(a,jt.memoizedState,o)},useTransition:function(){var o=Vd(Qo)[0],a=Fn().memoizedState;return[o,a]},useMutableSource:Ym,useSyncExternalStore:Jm,useId:fg,unstable_isNewReconciler:!1},Tx={readContext:zn,useCallback:cg,useContext:zn,useEffect:qd,useImperativeHandle:ag,useInsertionEffect:sg,useLayoutEffect:og,useMemo:ug,useReducer:Kd,useRef:rg,useState:function(){return Kd(Qo)},useDebugValue:Gd,useDeferredValue:function(o){var a=Fn();return jt===null?a.memoizedState=o:dg(a,jt.memoizedState,o)},useTransition:function(){var o=Kd(Qo)[0],a=Fn().memoizedState;return[o,a]},useMutableSource:Ym,useSyncExternalStore:Jm,useId:fg,unstable_isNewReconciler:!1};function er(o,a){if(o&&o.defaultProps){a=q({},a),o=o.defaultProps;for(var d in o)a[d]===void 0&&(a[d]=o[d]);return a}return a}function Yd(o,a,d,m){a=o.memoizedState,d=d(m,a),d=d==null?a:q({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Ia={isMounted:function(o){return(o=o._reactInternals)?Or(o)===o:!1},enqueueSetState:function(o,a,d){o=o._reactInternals;var m=hn(),b=pi(o),E=Br(m,b);E.payload=a,d!=null&&(E.callback=d),a=ci(o,E,b),a!==null&&(rr(a,o,b,m),Ca(a,o,b))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var m=hn(),b=pi(o),E=Br(m,b);E.tag=1,E.payload=a,d!=null&&(E.callback=d),a=ci(o,E,b),a!==null&&(rr(a,o,b,m),Ca(a,o,b))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=hn(),m=pi(o),b=Br(d,m);b.tag=2,a!=null&&(b.callback=a),a=ci(o,b,m),a!==null&&(rr(a,o,m,d),Ca(a,o,m))}};function gg(o,a,d,m,b,E,S){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(m,E,S):a.prototype&&a.prototype.isPureReactComponent?!jo(d,m)||!jo(b,E):!0}function yg(o,a,d){var m=!1,b=oi,E=a.contextType;return typeof E=="object"&&E!==null?E=zn(E):(b=En(a)?Qi:tn.current,m=a.contextTypes,E=(m=m!=null)?Hs(o,b):oi),a=new a(d,E),o.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ia,o.stateNode=a,a._reactInternals=o,m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=b,o.__reactInternalMemoizedMaskedChildContext=E),a}function bg(o,a,d,m){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,m),a.state!==o&&Ia.enqueueReplaceState(a,a.state,null)}function Jd(o,a,d,m){var b=o.stateNode;b.props=d,b.state=o.memoizedState,b.refs={},Pd(o);var E=a.contextType;typeof E=="object"&&E!==null?b.context=zn(E):(E=En(a)?Qi:tn.current,b.context=Hs(o,E)),b.state=o.memoizedState,E=a.getDerivedStateFromProps,typeof E=="function"&&(Yd(o,a,E,d),b.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(a=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),a!==b.state&&Ia.enqueueReplaceState(b,b.state,null),Na(o,d,b,m),b.state=o.memoizedState),typeof b.componentDidMount=="function"&&(o.flags|=4194308)}function Qs(o,a){try{var d="",m=a;do d+=ye(m),m=m.return;while(m);var b=d}catch(E){b=`
39
+ Error generating stack: `+E.message+`
40
+ `+E.stack}return{value:o,source:a,stack:b,digest:null}}function Qd(o,a,d){return{value:o,source:null,stack:d??null,digest:a??null}}function Xd(o,a){try{console.error(a.value)}catch(d){setTimeout(function(){throw d})}}var Mx=typeof WeakMap=="function"?WeakMap:Map;function vg(o,a,d){d=Br(-1,d),d.tag=3,d.payload={element:null};var m=a.value;return d.callback=function(){Fa||(Fa=!0,hf=m),Xd(o,a)},d}function kg(o,a,d){d=Br(-1,d),d.tag=3;var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var b=a.value;d.payload=function(){return m(b)},d.callback=function(){Xd(o,a)}}var E=o.stateNode;return E!==null&&typeof E.componentDidCatch=="function"&&(d.callback=function(){Xd(o,a),typeof m!="function"&&(di===null?di=new Set([this]):di.add(this));var S=a.stack;this.componentDidCatch(a.value,{componentStack:S!==null?S:""})}),d}function Eg(o,a,d){var m=o.pingCache;if(m===null){m=o.pingCache=new Mx;var b=new Set;m.set(a,b)}else b=m.get(a),b===void 0&&(b=new Set,m.set(a,b));b.has(d)||(b.add(d),o=Hx.bind(null,o,a,d),a.then(o,o))}function wg(o){do{var a;if((a=o.tag===13)&&(a=o.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return o;o=o.return}while(o!==null);return null}function xg(o,a,d,m,b){return(o.mode&1)===0?(o===a?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(a=Br(-1,1),a.tag=2,ci(d,a,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=b,o)}var Ax=P.ReactCurrentOwner,wn=!1;function pn(o,a,d,m){a.child=o===null?Hm(a,null,d,m):qs(a,o.child,d,m)}function Sg(o,a,d,m,b){d=d.render;var E=a.ref;return Ys(a,b),m=Hd(o,a,d,m,E,b),d=Wd(),o!==null&&!wn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~b,jr(o,a,b)):(gt&&d&&Nd(a),a.flags|=1,pn(o,a,m,b),a.child)}function Cg(o,a,d,m,b){if(o===null){var E=d.type;return typeof E=="function"&&!Ef(E)&&E.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(a.tag=15,a.type=E,Ng(o,a,E,m,b)):(o=Ka(d.type,null,m,a,a.mode,b),o.ref=a.ref,o.return=a,a.child=o)}if(E=o.child,(o.lanes&b)===0){var S=E.memoizedProps;if(d=d.compare,d=d!==null?d:jo,d(S,m)&&o.ref===a.ref)return jr(o,a,b)}return a.flags|=1,o=mi(E,m),o.ref=a.ref,o.return=a,a.child=o}function Ng(o,a,d,m,b){if(o!==null){var E=o.memoizedProps;if(jo(E,m)&&o.ref===a.ref)if(wn=!1,a.pendingProps=m=E,(o.lanes&b)!==0)(o.flags&131072)!==0&&(wn=!0);else return a.lanes=o.lanes,jr(o,a,b)}return Zd(o,a,d,m,b)}function _g(o,a,d){var m=a.pendingProps,b=m.children,E=o!==null?o.memoizedState:null;if(m.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},at(Zs,On),On|=d;else{if((d&1073741824)===0)return o=E!==null?E.baseLanes|d:d,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:o,cachePool:null,transitions:null},a.updateQueue=null,at(Zs,On),On|=o,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=E!==null?E.baseLanes:d,at(Zs,On),On|=m}else E!==null?(m=E.baseLanes|d,a.memoizedState=null):m=d,at(Zs,On),On|=m;return pn(o,a,b,d),a.child}function Tg(o,a){var d=a.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(a.flags|=512,a.flags|=2097152)}function Zd(o,a,d,m,b){var E=En(d)?Qi:tn.current;return E=Hs(a,E),Ys(a,b),d=Hd(o,a,d,m,E,b),m=Wd(),o!==null&&!wn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~b,jr(o,a,b)):(gt&&m&&Nd(a),a.flags|=1,pn(o,a,d,b),a.child)}function Mg(o,a,d,m,b){if(En(d)){var E=!0;ya(a)}else E=!1;if(Ys(a,b),a.stateNode===null)Da(o,a),yg(a,d,m),Jd(a,d,m,b),m=!0;else if(o===null){var S=a.stateNode,T=a.memoizedProps;S.props=T;var D=S.context,W=d.contextType;typeof W=="object"&&W!==null?W=zn(W):(W=En(d)?Qi:tn.current,W=Hs(a,W));var se=d.getDerivedStateFromProps,oe=typeof se=="function"||typeof S.getSnapshotBeforeUpdate=="function";oe||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(T!==m||D!==W)&&bg(a,S,m,W),ai=!1;var re=a.memoizedState;S.state=re,Na(a,m,S,b),D=a.memoizedState,T!==m||re!==D||kn.current||ai?(typeof se=="function"&&(Yd(a,d,se,m),D=a.memoizedState),(T=ai||gg(a,d,T,m,re,D,W))?(oe||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=D),S.props=m,S.state=D,S.context=W,m=T):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{S=a.stateNode,Vm(o,a),T=a.memoizedProps,W=a.type===a.elementType?T:er(a.type,T),S.props=W,oe=a.pendingProps,re=S.context,D=d.contextType,typeof D=="object"&&D!==null?D=zn(D):(D=En(d)?Qi:tn.current,D=Hs(a,D));var ve=d.getDerivedStateFromProps;(se=typeof ve=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(T!==oe||re!==D)&&bg(a,S,m,D),ai=!1,re=a.memoizedState,S.state=re,Na(a,m,S,b);var Se=a.memoizedState;T!==oe||re!==Se||kn.current||ai?(typeof ve=="function"&&(Yd(a,d,ve,m),Se=a.memoizedState),(W=ai||gg(a,d,W,m,re,Se,D)||!1)?(se||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(m,Se,D),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(m,Se,D)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||T===o.memoizedProps&&re===o.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||T===o.memoizedProps&&re===o.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=Se),S.props=m,S.state=Se,S.context=D,m=W):(typeof S.componentDidUpdate!="function"||T===o.memoizedProps&&re===o.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||T===o.memoizedProps&&re===o.memoizedState||(a.flags|=1024),m=!1)}return ef(o,a,d,m,E,b)}function ef(o,a,d,m,b,E){Tg(o,a);var S=(a.flags&128)!==0;if(!m&&!S)return b&&Lm(a,d,!1),jr(o,a,E);m=a.stateNode,Ax.current=a;var T=S&&typeof d.getDerivedStateFromError!="function"?null:m.render();return a.flags|=1,o!==null&&S?(a.child=qs(a,o.child,null,E),a.child=qs(a,null,T,E)):pn(o,a,T,E),a.memoizedState=m.state,b&&Lm(a,d,!0),a.child}function Ag(o){var a=o.stateNode;a.pendingContext?Rm(o,a.pendingContext,a.pendingContext!==a.context):a.context&&Rm(o,a.context,!1),Bd(o,a.containerInfo)}function Og(o,a,d,m,b){return Ks(),Ad(b),a.flags|=256,pn(o,a,d,m),a.child}var tf={dehydrated:null,treeContext:null,retryLane:0};function nf(o){return{baseLanes:o,cachePool:null,transitions:null}}function Rg(o,a,d){var m=a.pendingProps,b=wt.current,E=!1,S=(a.flags&128)!==0,T;if((T=S)||(T=o!==null&&o.memoizedState===null?!1:(b&2)!==0),T?(E=!0,a.flags&=-129):(o===null||o.memoizedState!==null)&&(b|=1),at(wt,b&1),o===null)return Md(a),o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((a.mode&1)===0?a.lanes=1:o.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(S=m.children,o=m.fallback,E?(m=a.mode,E=a.child,S={mode:"hidden",children:S},(m&1)===0&&E!==null?(E.childLanes=0,E.pendingProps=S):E=qa(S,m,0,null),o=as(o,m,d,null),E.return=a,o.return=a,E.sibling=o,a.child=E,a.child.memoizedState=nf(d),a.memoizedState=tf,o):rf(a,S));if(b=o.memoizedState,b!==null&&(T=b.dehydrated,T!==null))return Ox(o,a,S,m,T,b,d);if(E){E=m.fallback,S=a.mode,b=o.child,T=b.sibling;var D={mode:"hidden",children:m.children};return(S&1)===0&&a.child!==b?(m=a.child,m.childLanes=0,m.pendingProps=D,a.deletions=null):(m=mi(b,D),m.subtreeFlags=b.subtreeFlags&14680064),T!==null?E=mi(T,E):(E=as(E,S,d,null),E.flags|=2),E.return=a,m.return=a,m.sibling=E,a.child=m,m=E,E=a.child,S=o.child.memoizedState,S=S===null?nf(d):{baseLanes:S.baseLanes|d,cachePool:null,transitions:S.transitions},E.memoizedState=S,E.childLanes=o.childLanes&~d,a.memoizedState=tf,m}return E=o.child,o=E.sibling,m=mi(E,{mode:"visible",children:m.children}),(a.mode&1)===0&&(m.lanes=d),m.return=a,m.sibling=null,o!==null&&(d=a.deletions,d===null?(a.deletions=[o],a.flags|=16):d.push(o)),a.child=m,a.memoizedState=null,m}function rf(o,a){return a=qa({mode:"visible",children:a},o.mode,0,null),a.return=o,o.child=a}function La(o,a,d,m){return m!==null&&Ad(m),qs(a,o.child,null,d),o=rf(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Ox(o,a,d,m,b,E,S){if(d)return a.flags&256?(a.flags&=-257,m=Qd(Error(n(422))),La(o,a,S,m)):a.memoizedState!==null?(a.child=o.child,a.flags|=128,null):(E=m.fallback,b=a.mode,m=qa({mode:"visible",children:m.children},b,0,null),E=as(E,b,S,null),E.flags|=2,m.return=a,E.return=a,m.sibling=E,a.child=m,(a.mode&1)!==0&&qs(a,o.child,null,S),a.child.memoizedState=nf(S),a.memoizedState=tf,E);if((a.mode&1)===0)return La(o,a,S,null);if(b.data==="$!"){if(m=b.nextSibling&&b.nextSibling.dataset,m)var T=m.dgst;return m=T,E=Error(n(419)),m=Qd(E,m,void 0),La(o,a,S,m)}if(T=(S&o.childLanes)!==0,wn||T){if(m=Ut,m!==null){switch(S&-S){case 4:b=2;break;case 16:b=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:b=32;break;case 536870912:b=268435456;break;default:b=0}b=(b&(m.suspendedLanes|S))!==0?0:b,b!==0&&b!==E.retryLane&&(E.retryLane=b,Pr(o,b),rr(m,o,b,-1))}return kf(),m=Qd(Error(n(421))),La(o,a,S,m)}return b.data==="$?"?(a.flags|=128,a.child=o.child,a=Wx.bind(null,o),b._reactRetry=a,null):(o=E.treeContext,An=ii(b.nextSibling),Mn=a,gt=!0,Zn=null,o!==null&&(Bn[jn++]=Lr,Bn[jn++]=Dr,Bn[jn++]=Xi,Lr=o.id,Dr=o.overflow,Xi=a),a=rf(a,m.children),a.flags|=4096,a)}function Ig(o,a,d){o.lanes|=a;var m=o.alternate;m!==null&&(m.lanes|=a),Ld(o.return,a,d)}function sf(o,a,d,m,b){var E=o.memoizedState;E===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:b}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=m,E.tail=d,E.tailMode=b)}function Lg(o,a,d){var m=a.pendingProps,b=m.revealOrder,E=m.tail;if(pn(o,a,m.children,d),m=wt.current,(m&2)!==0)m=m&1|2,a.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Ig(o,d,a);else if(o.tag===19)Ig(o,d,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}m&=1}if(at(wt,m),(a.mode&1)===0)a.memoizedState=null;else switch(b){case"forwards":for(d=a.child,b=null;d!==null;)o=d.alternate,o!==null&&_a(o)===null&&(b=d),d=d.sibling;d=b,d===null?(b=a.child,a.child=null):(b=d.sibling,d.sibling=null),sf(a,!1,b,d,E);break;case"backwards":for(d=null,b=a.child,a.child=null;b!==null;){if(o=b.alternate,o!==null&&_a(o)===null){a.child=b;break}o=b.sibling,b.sibling=d,d=b,b=o}sf(a,!0,d,null,E);break;case"together":sf(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Da(o,a){(a.mode&1)===0&&o!==null&&(o.alternate=null,a.alternate=null,a.flags|=2)}function jr(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),rs|=a.lanes,(d&a.childLanes)===0)return null;if(o!==null&&a.child!==o.child)throw Error(n(153));if(a.child!==null){for(o=a.child,d=mi(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=mi(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function Rx(o,a,d){switch(a.tag){case 3:Ag(a),Ks();break;case 5:Gm(a);break;case 1:En(a.type)&&ya(a);break;case 4:Bd(a,a.stateNode.containerInfo);break;case 10:var m=a.type._context,b=a.memoizedProps.value;at(xa,m._currentValue),m._currentValue=b;break;case 13:if(m=a.memoizedState,m!==null)return m.dehydrated!==null?(at(wt,wt.current&1),a.flags|=128,null):(d&a.child.childLanes)!==0?Rg(o,a,d):(at(wt,wt.current&1),o=jr(o,a,d),o!==null?o.sibling:null);at(wt,wt.current&1);break;case 19:if(m=(d&a.childLanes)!==0,(o.flags&128)!==0){if(m)return Lg(o,a,d);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),at(wt,wt.current),m)break;return null;case 22:case 23:return a.lanes=0,_g(o,a,d)}return jr(o,a,d)}var Dg,of,Pg,Bg;Dg=function(o,a){for(var d=a.child;d!==null;){if(d.tag===5||d.tag===6)o.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===a)break;for(;d.sibling===null;){if(d.return===null||d.return===a)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},of=function(){},Pg=function(o,a,d,m){var b=o.memoizedProps;if(b!==m){o=a.stateNode,ts(gr.current);var E=null;switch(d){case"input":b=bt(o,b),m=bt(o,m),E=[];break;case"select":b=q({},b,{value:void 0}),m=q({},m,{value:void 0}),E=[];break;case"textarea":b=zi(o,b),m=zi(o,m),E=[];break;default:typeof b.onClick!="function"&&typeof m.onClick=="function"&&(o.onclick=ha)}wo(d,m);var S;d=null;for(W in b)if(!m.hasOwnProperty(W)&&b.hasOwnProperty(W)&&b[W]!=null)if(W==="style"){var T=b[W];for(S in T)T.hasOwnProperty(S)&&(d||(d={}),d[S]="")}else W!=="dangerouslySetInnerHTML"&&W!=="children"&&W!=="suppressContentEditableWarning"&&W!=="suppressHydrationWarning"&&W!=="autoFocus"&&(i.hasOwnProperty(W)?E||(E=[]):(E=E||[]).push(W,null));for(W in m){var D=m[W];if(T=b!=null?b[W]:void 0,m.hasOwnProperty(W)&&D!==T&&(D!=null||T!=null))if(W==="style")if(T){for(S in T)!T.hasOwnProperty(S)||D&&D.hasOwnProperty(S)||(d||(d={}),d[S]="");for(S in D)D.hasOwnProperty(S)&&T[S]!==D[S]&&(d||(d={}),d[S]=D[S])}else d||(E||(E=[]),E.push(W,d)),d=D;else W==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,T=T?T.__html:void 0,D!=null&&T!==D&&(E=E||[]).push(W,D)):W==="children"?typeof D!="string"&&typeof D!="number"||(E=E||[]).push(W,""+D):W!=="suppressContentEditableWarning"&&W!=="suppressHydrationWarning"&&(i.hasOwnProperty(W)?(D!=null&&W==="onScroll"&&ft("scroll",o),E||T===D||(E=[])):(E=E||[]).push(W,D))}d&&(E=E||[]).push("style",d);var W=E;(a.updateQueue=W)&&(a.flags|=4)}},Bg=function(o,a,d,m){d!==m&&(a.flags|=4)};function Zo(o,a){if(!gt)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:m.sibling=null}}function rn(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,m=0;if(a)for(var b=o.child;b!==null;)d|=b.lanes|b.childLanes,m|=b.subtreeFlags&14680064,m|=b.flags&14680064,b.return=o,b=b.sibling;else for(b=o.child;b!==null;)d|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=o,b=b.sibling;return o.subtreeFlags|=m,o.childLanes=d,a}function Ix(o,a,d){var m=a.pendingProps;switch(_d(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rn(a),null;case 1:return En(a.type)&&ga(),rn(a),null;case 3:return m=a.stateNode,Js(),pt(kn),pt(tn),Fd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(Ea(a)?a.flags|=4:o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Zn!==null&&(yf(Zn),Zn=null))),of(o,a),rn(a),null;case 5:jd(a);var b=ts(Go.current);if(d=a.type,o!==null&&a.stateNode!=null)Pg(o,a,d,m,b),o.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!m){if(a.stateNode===null)throw Error(n(166));return rn(a),null}if(o=ts(gr.current),Ea(a)){m=a.stateNode,d=a.type;var E=a.memoizedProps;switch(m[mr]=a,m[Ho]=E,o=(a.mode&1)!==0,d){case"dialog":ft("cancel",m),ft("close",m);break;case"iframe":case"object":case"embed":ft("load",m);break;case"video":case"audio":for(b=0;b<Fo.length;b++)ft(Fo[b],m);break;case"source":ft("error",m);break;case"img":case"image":case"link":ft("error",m),ft("load",m);break;case"details":ft("toggle",m);break;case"input":Dn(m,E),ft("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!E.multiple},ft("invalid",m);break;case"textarea":Tr(m,E),ft("invalid",m)}wo(d,E),b=null;for(var S in E)if(E.hasOwnProperty(S)){var T=E[S];S==="children"?typeof T=="string"?m.textContent!==T&&(E.suppressHydrationWarning!==!0&&pa(m.textContent,T,o),b=["children",T]):typeof T=="number"&&m.textContent!==""+T&&(E.suppressHydrationWarning!==!0&&pa(m.textContent,T,o),b=["children",""+T]):i.hasOwnProperty(S)&&T!=null&&S==="onScroll"&&ft("scroll",m)}switch(d){case"input":un(m),vn(m,E,!0);break;case"textarea":un(m),ze(m);break;case"select":case"option":break;default:typeof E.onClick=="function"&&(m.onclick=ha)}m=b,a.updateQueue=m,m!==null&&(a.flags|=4)}else{S=b.nodeType===9?b:b.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=vt(d)),o==="http://www.w3.org/1999/xhtml"?d==="script"?(o=S.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof m.is=="string"?o=S.createElement(d,{is:m.is}):(o=S.createElement(d),d==="select"&&(S=o,m.multiple?S.multiple=!0:m.size&&(S.size=m.size))):o=S.createElementNS(o,d),o[mr]=a,o[Ho]=m,Dg(o,a,!1,!1),a.stateNode=o;e:{switch(S=xo(d,m),d){case"dialog":ft("cancel",o),ft("close",o),b=m;break;case"iframe":case"object":case"embed":ft("load",o),b=m;break;case"video":case"audio":for(b=0;b<Fo.length;b++)ft(Fo[b],o);b=m;break;case"source":ft("error",o),b=m;break;case"img":case"image":case"link":ft("error",o),ft("load",o),b=m;break;case"details":ft("toggle",o),b=m;break;case"input":Dn(o,m),b=bt(o,m),ft("invalid",o);break;case"option":b=m;break;case"select":o._wrapperState={wasMultiple:!!m.multiple},b=q({},m,{value:void 0}),ft("invalid",o);break;case"textarea":Tr(o,m),b=zi(o,m),ft("invalid",o);break;default:b=m}wo(d,b),T=b;for(E in T)if(T.hasOwnProperty(E)){var D=T[E];E==="style"?Eo(o,D):E==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&Vl(o,D)):E==="children"?typeof D=="string"?(d!=="textarea"||D!=="")&&$i(o,D):typeof D=="number"&&$i(o,""+D):E!=="suppressContentEditableWarning"&&E!=="suppressHydrationWarning"&&E!=="autoFocus"&&(i.hasOwnProperty(E)?D!=null&&E==="onScroll"&&ft("scroll",o):D!=null&&I(o,E,D,S))}switch(d){case"input":un(o),vn(o,m,!1);break;case"textarea":un(o),ze(o);break;case"option":m.value!=null&&o.setAttribute("value",""+be(m.value));break;case"select":o.multiple=!!m.multiple,E=m.value,E!=null?ur(o,!!m.multiple,E,!1):m.defaultValue!=null&&ur(o,!!m.multiple,m.defaultValue,!0);break;default:typeof b.onClick=="function"&&(o.onclick=ha)}switch(d){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return rn(a),null;case 6:if(o&&a.stateNode!=null)Bg(o,a,o.memoizedProps,m);else{if(typeof m!="string"&&a.stateNode===null)throw Error(n(166));if(d=ts(Go.current),ts(gr.current),Ea(a)){if(m=a.stateNode,d=a.memoizedProps,m[mr]=a,(E=m.nodeValue!==d)&&(o=Mn,o!==null))switch(o.tag){case 3:pa(m.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&pa(m.nodeValue,d,(o.mode&1)!==0)}E&&(a.flags|=4)}else m=(d.nodeType===9?d:d.ownerDocument).createTextNode(m),m[mr]=a,a.stateNode=m}return rn(a),null;case 13:if(pt(wt),m=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(gt&&An!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Fm(),Ks(),a.flags|=98560,E=!1;else if(E=Ea(a),m!==null&&m.dehydrated!==null){if(o===null){if(!E)throw Error(n(318));if(E=a.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(n(317));E[mr]=a}else Ks(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;rn(a),E=!1}else Zn!==null&&(yf(Zn),Zn=null),E=!0;if(!E)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=d,a):(m=m!==null,m!==(o!==null&&o.memoizedState!==null)&&m&&(a.child.flags|=8192,(a.mode&1)!==0&&(o===null||(wt.current&1)!==0?zt===0&&(zt=3):kf())),a.updateQueue!==null&&(a.flags|=4),rn(a),null);case 4:return Js(),of(o,a),o===null&&$o(a.stateNode.containerInfo),rn(a),null;case 10:return Id(a.type._context),rn(a),null;case 17:return En(a.type)&&ga(),rn(a),null;case 19:if(pt(wt),E=a.memoizedState,E===null)return rn(a),null;if(m=(a.flags&128)!==0,S=E.rendering,S===null)if(m)Zo(E,!1);else{if(zt!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(S=_a(o),S!==null){for(a.flags|=128,Zo(E,!1),m=S.updateQueue,m!==null&&(a.updateQueue=m,a.flags|=4),a.subtreeFlags=0,m=d,d=a.child;d!==null;)E=d,o=m,E.flags&=14680066,S=E.alternate,S===null?(E.childLanes=0,E.lanes=o,E.child=null,E.subtreeFlags=0,E.memoizedProps=null,E.memoizedState=null,E.updateQueue=null,E.dependencies=null,E.stateNode=null):(E.childLanes=S.childLanes,E.lanes=S.lanes,E.child=S.child,E.subtreeFlags=0,E.deletions=null,E.memoizedProps=S.memoizedProps,E.memoizedState=S.memoizedState,E.updateQueue=S.updateQueue,E.type=S.type,o=S.dependencies,E.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return at(wt,wt.current&1|2),a.child}o=o.sibling}E.tail!==null&&kt()>eo&&(a.flags|=128,m=!0,Zo(E,!1),a.lanes=4194304)}else{if(!m)if(o=_a(S),o!==null){if(a.flags|=128,m=!0,d=o.updateQueue,d!==null&&(a.updateQueue=d,a.flags|=4),Zo(E,!0),E.tail===null&&E.tailMode==="hidden"&&!S.alternate&&!gt)return rn(a),null}else 2*kt()-E.renderingStartTime>eo&&d!==1073741824&&(a.flags|=128,m=!0,Zo(E,!1),a.lanes=4194304);E.isBackwards?(S.sibling=a.child,a.child=S):(d=E.last,d!==null?d.sibling=S:a.child=S,E.last=S)}return E.tail!==null?(a=E.tail,E.rendering=a,E.tail=a.sibling,E.renderingStartTime=kt(),a.sibling=null,d=wt.current,at(wt,m?d&1|2:d&1),a):(rn(a),null);case 22:case 23:return vf(),m=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==m&&(a.flags|=8192),m&&(a.mode&1)!==0?(On&1073741824)!==0&&(rn(a),a.subtreeFlags&6&&(a.flags|=8192)):rn(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function Lx(o,a){switch(_d(a),a.tag){case 1:return En(a.type)&&ga(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Js(),pt(kn),pt(tn),Fd(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 5:return jd(a),null;case 13:if(pt(wt),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Ks()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return pt(wt),null;case 4:return Js(),null;case 10:return Id(a.type._context),null;case 22:case 23:return vf(),null;case 24:return null;default:return null}}var Pa=!1,sn=!1,Dx=typeof WeakSet=="function"?WeakSet:Set,xe=null;function Xs(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Ct(o,a,m)}else d.current=null}function lf(o,a,d){try{d()}catch(m){Ct(o,a,m)}}var jg=!1;function Px(o,a){if(bd=na,o=gm(),ud(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var b=m.anchorOffset,E=m.focusNode;m=m.focusOffset;try{d.nodeType,E.nodeType}catch{d=null;break e}var S=0,T=-1,D=-1,W=0,se=0,oe=o,re=null;t:for(;;){for(var ve;oe!==d||b!==0&&oe.nodeType!==3||(T=S+b),oe!==E||m!==0&&oe.nodeType!==3||(D=S+m),oe.nodeType===3&&(S+=oe.nodeValue.length),(ve=oe.firstChild)!==null;)re=oe,oe=ve;for(;;){if(oe===o)break t;if(re===d&&++W===b&&(T=S),re===E&&++se===m&&(D=S),(ve=oe.nextSibling)!==null)break;oe=re,re=oe.parentNode}oe=ve}d=T===-1||D===-1?null:{start:T,end:D}}else d=null}d=d||{start:0,end:0}}else d=null;for(vd={focusedElem:o,selectionRange:d},na=!1,xe=a;xe!==null;)if(a=xe,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,xe=o;else for(;xe!==null;){a=xe;try{var Se=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ce=Se.memoizedProps,Rt=Se.memoizedState,z=a.stateNode,B=z.getSnapshotBeforeUpdate(a.elementType===a.type?Ce:er(a.type,Ce),Rt);z.__reactInternalSnapshotBeforeUpdate=B}break;case 3:var F=a.stateNode.containerInfo;F.nodeType===1?F.textContent="":F.nodeType===9&&F.documentElement&&F.removeChild(F.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ue){Ct(a,a.return,ue)}if(o=a.sibling,o!==null){o.return=a.return,xe=o;break}xe=a.return}return Se=jg,jg=!1,Se}function el(o,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var b=m=m.next;do{if((b.tag&o)===o){var E=b.destroy;b.destroy=void 0,E!==void 0&&lf(a,d,E)}b=b.next}while(b!==m)}}function Ba(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function af(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=d;break;default:o=d}typeof a=="function"?a(o):a.current=o}}function zg(o){var a=o.alternate;a!==null&&(o.alternate=null,zg(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&(delete a[mr],delete a[Ho],delete a[xd],delete a[bx],delete a[vx])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Fg(o){return o.tag===5||o.tag===3||o.tag===4}function $g(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Fg(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function cf(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?d.nodeType===8?d.parentNode.insertBefore(o,a):d.insertBefore(o,a):(d.nodeType===8?(a=d.parentNode,a.insertBefore(o,d)):(a=d,a.appendChild(o)),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=ha));else if(m!==4&&(o=o.child,o!==null))for(cf(o,a,d),o=o.sibling;o!==null;)cf(o,a,d),o=o.sibling}function uf(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?d.insertBefore(o,a):d.appendChild(o);else if(m!==4&&(o=o.child,o!==null))for(uf(o,a,d),o=o.sibling;o!==null;)uf(o,a,d),o=o.sibling}var Gt=null,tr=!1;function ui(o,a,d){for(d=d.child;d!==null;)Ug(o,a,d),d=d.sibling}function Ug(o,a,d){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(Fe,d)}catch{}switch(d.tag){case 5:sn||Xs(d,a);case 6:var m=Gt,b=tr;Gt=null,ui(o,a,d),Gt=m,tr=b,Gt!==null&&(tr?(o=Gt,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):Gt.removeChild(d.stateNode));break;case 18:Gt!==null&&(tr?(o=Gt,d=d.stateNode,o.nodeType===8?wd(o.parentNode,d):o.nodeType===1&&wd(o,d),Ro(o)):wd(Gt,d.stateNode));break;case 4:m=Gt,b=tr,Gt=d.stateNode.containerInfo,tr=!0,ui(o,a,d),Gt=m,tr=b;break;case 0:case 11:case 14:case 15:if(!sn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){b=m=m.next;do{var E=b,S=E.destroy;E=E.tag,S!==void 0&&((E&2)!==0||(E&4)!==0)&&lf(d,a,S),b=b.next}while(b!==m)}ui(o,a,d);break;case 1:if(!sn&&(Xs(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(T){Ct(d,a,T)}ui(o,a,d);break;case 21:ui(o,a,d);break;case 22:d.mode&1?(sn=(m=sn)||d.memoizedState!==null,ui(o,a,d),sn=m):ui(o,a,d);break;default:ui(o,a,d)}}function Hg(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new Dx),a.forEach(function(m){var b=Vx.bind(null,o,m);d.has(m)||(d.add(m),m.then(b,b))})}}function nr(o,a){var d=a.deletions;if(d!==null)for(var m=0;m<d.length;m++){var b=d[m];try{var E=o,S=a,T=S;e:for(;T!==null;){switch(T.tag){case 5:Gt=T.stateNode,tr=!1;break e;case 3:Gt=T.stateNode.containerInfo,tr=!0;break e;case 4:Gt=T.stateNode.containerInfo,tr=!0;break e}T=T.return}if(Gt===null)throw Error(n(160));Ug(E,S,b),Gt=null,tr=!1;var D=b.alternate;D!==null&&(D.return=null),b.return=null}catch(W){Ct(b,a,W)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Wg(a,o),a=a.sibling}function Wg(o,a){var d=o.alternate,m=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(nr(a,o),br(o),m&4){try{el(3,o,o.return),Ba(3,o)}catch(Ce){Ct(o,o.return,Ce)}try{el(5,o,o.return)}catch(Ce){Ct(o,o.return,Ce)}}break;case 1:nr(a,o),br(o),m&512&&d!==null&&Xs(d,d.return);break;case 5:if(nr(a,o),br(o),m&512&&d!==null&&Xs(d,d.return),o.flags&32){var b=o.stateNode;try{$i(b,"")}catch(Ce){Ct(o,o.return,Ce)}}if(m&4&&(b=o.stateNode,b!=null)){var E=o.memoizedProps,S=d!==null?d.memoizedProps:E,T=o.type,D=o.updateQueue;if(o.updateQueue=null,D!==null)try{T==="input"&&E.type==="radio"&&E.name!=null&&Ke(b,E),xo(T,S);var W=xo(T,E);for(S=0;S<D.length;S+=2){var se=D[S],oe=D[S+1];se==="style"?Eo(b,oe):se==="dangerouslySetInnerHTML"?Vl(b,oe):se==="children"?$i(b,oe):I(b,se,oe,W)}switch(T){case"input":bn(b,E);break;case"textarea":de(b,E);break;case"select":var re=b._wrapperState.wasMultiple;b._wrapperState.wasMultiple=!!E.multiple;var ve=E.value;ve!=null?ur(b,!!E.multiple,ve,!1):re!==!!E.multiple&&(E.defaultValue!=null?ur(b,!!E.multiple,E.defaultValue,!0):ur(b,!!E.multiple,E.multiple?[]:"",!1))}b[Ho]=E}catch(Ce){Ct(o,o.return,Ce)}}break;case 6:if(nr(a,o),br(o),m&4){if(o.stateNode===null)throw Error(n(162));b=o.stateNode,E=o.memoizedProps;try{b.nodeValue=E}catch(Ce){Ct(o,o.return,Ce)}}break;case 3:if(nr(a,o),br(o),m&4&&d!==null&&d.memoizedState.isDehydrated)try{Ro(a.containerInfo)}catch(Ce){Ct(o,o.return,Ce)}break;case 4:nr(a,o),br(o);break;case 13:nr(a,o),br(o),b=o.child,b.flags&8192&&(E=b.memoizedState!==null,b.stateNode.isHidden=E,!E||b.alternate!==null&&b.alternate.memoizedState!==null||(pf=kt())),m&4&&Hg(o);break;case 22:if(se=d!==null&&d.memoizedState!==null,o.mode&1?(sn=(W=sn)||se,nr(a,o),sn=W):nr(a,o),br(o),m&8192){if(W=o.memoizedState!==null,(o.stateNode.isHidden=W)&&!se&&(o.mode&1)!==0)for(xe=o,se=o.child;se!==null;){for(oe=xe=se;xe!==null;){switch(re=xe,ve=re.child,re.tag){case 0:case 11:case 14:case 15:el(4,re,re.return);break;case 1:Xs(re,re.return);var Se=re.stateNode;if(typeof Se.componentWillUnmount=="function"){m=re,d=re.return;try{a=m,Se.props=a.memoizedProps,Se.state=a.memoizedState,Se.componentWillUnmount()}catch(Ce){Ct(m,d,Ce)}}break;case 5:Xs(re,re.return);break;case 22:if(re.memoizedState!==null){qg(oe);continue}}ve!==null?(ve.return=re,xe=ve):qg(oe)}se=se.sibling}e:for(se=null,oe=o;;){if(oe.tag===5){if(se===null){se=oe;try{b=oe.stateNode,W?(E=b.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none"):(T=oe.stateNode,D=oe.memoizedProps.style,S=D!=null&&D.hasOwnProperty("display")?D.display:null,T.style.display=Kl("display",S))}catch(Ce){Ct(o,o.return,Ce)}}}else if(oe.tag===6){if(se===null)try{oe.stateNode.nodeValue=W?"":oe.memoizedProps}catch(Ce){Ct(o,o.return,Ce)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===o)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===o)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===o)break e;se===oe&&(se=null),oe=oe.return}se===oe&&(se=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:nr(a,o),br(o),m&4&&Hg(o);break;case 21:break;default:nr(a,o),br(o)}}function br(o){var a=o.flags;if(a&2){try{e:{for(var d=o.return;d!==null;){if(Fg(d)){var m=d;break e}d=d.return}throw Error(n(160))}switch(m.tag){case 5:var b=m.stateNode;m.flags&32&&($i(b,""),m.flags&=-33);var E=$g(o);uf(o,E,b);break;case 3:case 4:var S=m.stateNode.containerInfo,T=$g(o);cf(o,T,S);break;default:throw Error(n(161))}}catch(D){Ct(o,o.return,D)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Bx(o,a,d){xe=o,Vg(o)}function Vg(o,a,d){for(var m=(o.mode&1)!==0;xe!==null;){var b=xe,E=b.child;if(b.tag===22&&m){var S=b.memoizedState!==null||Pa;if(!S){var T=b.alternate,D=T!==null&&T.memoizedState!==null||sn;T=Pa;var W=sn;if(Pa=S,(sn=D)&&!W)for(xe=b;xe!==null;)S=xe,D=S.child,S.tag===22&&S.memoizedState!==null?Gg(b):D!==null?(D.return=S,xe=D):Gg(b);for(;E!==null;)xe=E,Vg(E),E=E.sibling;xe=b,Pa=T,sn=W}Kg(o)}else(b.subtreeFlags&8772)!==0&&E!==null?(E.return=b,xe=E):Kg(o)}}function Kg(o){for(;xe!==null;){var a=xe;if((a.flags&8772)!==0){var d=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:sn||Ba(5,a);break;case 1:var m=a.stateNode;if(a.flags&4&&!sn)if(d===null)m.componentDidMount();else{var b=a.elementType===a.type?d.memoizedProps:er(a.type,d.memoizedProps);m.componentDidUpdate(b,d.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var E=a.updateQueue;E!==null&&qm(a,E,m);break;case 3:var S=a.updateQueue;if(S!==null){if(d=null,a.child!==null)switch(a.child.tag){case 5:d=a.child.stateNode;break;case 1:d=a.child.stateNode}qm(a,S,d)}break;case 5:var T=a.stateNode;if(d===null&&a.flags&4){d=T;var D=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&d.focus();break;case"img":D.src&&(d.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var W=a.alternate;if(W!==null){var se=W.memoizedState;if(se!==null){var oe=se.dehydrated;oe!==null&&Ro(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}sn||a.flags&512&&af(a)}catch(re){Ct(a,a.return,re)}}if(a===o){xe=null;break}if(d=a.sibling,d!==null){d.return=a.return,xe=d;break}xe=a.return}}function qg(o){for(;xe!==null;){var a=xe;if(a===o){xe=null;break}var d=a.sibling;if(d!==null){d.return=a.return,xe=d;break}xe=a.return}}function Gg(o){for(;xe!==null;){var a=xe;try{switch(a.tag){case 0:case 11:case 15:var d=a.return;try{Ba(4,a)}catch(D){Ct(a,d,D)}break;case 1:var m=a.stateNode;if(typeof m.componentDidMount=="function"){var b=a.return;try{m.componentDidMount()}catch(D){Ct(a,b,D)}}var E=a.return;try{af(a)}catch(D){Ct(a,E,D)}break;case 5:var S=a.return;try{af(a)}catch(D){Ct(a,S,D)}}}catch(D){Ct(a,a.return,D)}if(a===o){xe=null;break}var T=a.sibling;if(T!==null){T.return=a.return,xe=T;break}xe=a.return}}var jx=Math.ceil,ja=P.ReactCurrentDispatcher,df=P.ReactCurrentOwner,$n=P.ReactCurrentBatchConfig,Ye=0,Ut=null,Lt=null,Yt=0,On=0,Zs=si(0),zt=0,tl=null,rs=0,za=0,ff=0,nl=null,xn=null,pf=0,eo=1/0,zr=null,Fa=!1,hf=null,di=null,$a=!1,fi=null,Ua=0,rl=0,mf=null,Ha=-1,Wa=0;function hn(){return(Ye&6)!==0?kt():Ha!==-1?Ha:Ha=kt()}function pi(o){return(o.mode&1)===0?1:(Ye&2)!==0&&Yt!==0?Yt&-Yt:Ex.transition!==null?(Wa===0&&(Wa=Zl()),Wa):(o=Ge,o!==0||(o=window.event,o=o===void 0?16:Jh(o.type)),o)}function rr(o,a,d,m){if(50<rl)throw rl=0,mf=null,Error(n(185));ei(o,d,m),((Ye&2)===0||o!==Ut)&&(o===Ut&&((Ye&2)===0&&(za|=d),zt===4&&hi(o,Yt)),Sn(o,m),d===1&&Ye===0&&(a.mode&1)===0&&(eo=kt()+500,ba&&li()))}function Sn(o,a){var d=o.callbackNode;Qu(o,a);var m=qi(o,o===Ut?Yt:0);if(m===0)d!==null&&Qn(d),o.callbackNode=null,o.callbackPriority=0;else if(a=m&-m,o.callbackPriority!==a){if(d!=null&&Qn(d),a===1)o.tag===0?kx(Jg.bind(null,o)):Dm(Jg.bind(null,o)),gx(function(){(Ye&6)===0&&li()}),d=null;else{switch(je(m)){case 1:d=No;break;case 4:d=Vi;break;case 16:d=Rs;break;case 536870912:d=_e;break;default:d=Rs}d=iy(d,Yg.bind(null,o))}o.callbackPriority=a,o.callbackNode=d}}function Yg(o,a){if(Ha=-1,Wa=0,(Ye&6)!==0)throw Error(n(327));var d=o.callbackNode;if(to()&&o.callbackNode!==d)return null;var m=qi(o,o===Ut?Yt:0);if(m===0)return null;if((m&30)!==0||(m&o.expiredLanes)!==0||a)a=Va(o,m);else{a=m;var b=Ye;Ye|=2;var E=Xg();(Ut!==o||Yt!==a)&&(zr=null,eo=kt()+500,ss(o,a));do try{$x();break}catch(T){Qg(o,T)}while(!0);Rd(),ja.current=E,Ye=b,Lt!==null?a=0:(Ut=null,Yt=0,a=zt)}if(a!==0){if(a===2&&(b=_o(o),b!==0&&(m=b,a=gf(o,b))),a===1)throw d=tl,ss(o,0),hi(o,m),Sn(o,kt()),d;if(a===6)hi(o,m);else{if(b=o.current.alternate,(m&30)===0&&!zx(b)&&(a=Va(o,m),a===2&&(E=_o(o),E!==0&&(m=E,a=gf(o,E))),a===1))throw d=tl,ss(o,0),hi(o,m),Sn(o,kt()),d;switch(o.finishedWork=b,o.finishedLanes=m,a){case 0:case 1:throw Error(n(345));case 2:ls(o,xn,zr);break;case 3:if(hi(o,m),(m&130023424)===m&&(a=pf+500-kt(),10<a)){if(qi(o,0)!==0)break;if(b=o.suspendedLanes,(b&m)!==m){hn(),o.pingedLanes|=o.suspendedLanes&b;break}o.timeoutHandle=Ed(ls.bind(null,o,xn,zr),a);break}ls(o,xn,zr);break;case 4:if(hi(o,m),(m&4194240)===m)break;for(a=o.eventTimes,b=-1;0<m;){var S=31-Et(m);E=1<<S,S=a[S],S>b&&(b=S),m&=~E}if(m=b,m=kt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*jx(m/1960))-m,10<m){o.timeoutHandle=Ed(ls.bind(null,o,xn,zr),m);break}ls(o,xn,zr);break;case 5:ls(o,xn,zr);break;default:throw Error(n(329))}}}return Sn(o,kt()),o.callbackNode===d?Yg.bind(null,o):null}function gf(o,a){var d=nl;return o.current.memoizedState.isDehydrated&&(ss(o,a).flags|=256),o=Va(o,a),o!==2&&(a=xn,xn=d,a!==null&&yf(a)),o}function yf(o){xn===null?xn=o:xn.push.apply(xn,o)}function zx(o){for(var a=o;;){if(a.flags&16384){var d=a.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var m=0;m<d.length;m++){var b=d[m],E=b.getSnapshot;b=b.value;try{if(!Xn(E(),b))return!1}catch{return!1}}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function hi(o,a){for(a&=~ff,a&=~za,o.suspendedLanes|=a,o.pingedLanes&=~a,o=o.expirationTimes;0<a;){var d=31-Et(a),m=1<<d;o[d]=-1,a&=~m}}function Jg(o){if((Ye&6)!==0)throw Error(n(327));to();var a=qi(o,0);if((a&1)===0)return Sn(o,kt()),null;var d=Va(o,a);if(o.tag!==0&&d===2){var m=_o(o);m!==0&&(a=m,d=gf(o,m))}if(d===1)throw d=tl,ss(o,0),hi(o,a),Sn(o,kt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=a,ls(o,xn,zr),Sn(o,kt()),null}function bf(o,a){var d=Ye;Ye|=1;try{return o(a)}finally{Ye=d,Ye===0&&(eo=kt()+500,ba&&li())}}function is(o){fi!==null&&fi.tag===0&&(Ye&6)===0&&to();var a=Ye;Ye|=1;var d=$n.transition,m=Ge;try{if($n.transition=null,Ge=1,o)return o()}finally{Ge=m,$n.transition=d,Ye=a,(Ye&6)===0&&li()}}function vf(){On=Zs.current,pt(Zs)}function ss(o,a){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,mx(d)),Lt!==null)for(d=Lt.return;d!==null;){var m=d;switch(_d(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&ga();break;case 3:Js(),pt(kn),pt(tn),Fd();break;case 5:jd(m);break;case 4:Js();break;case 13:pt(wt);break;case 19:pt(wt);break;case 10:Id(m.type._context);break;case 22:case 23:vf()}d=d.return}if(Ut=o,Lt=o=mi(o.current,null),Yt=On=a,zt=0,tl=null,ff=za=rs=0,xn=nl=null,es!==null){for(a=0;a<es.length;a++)if(d=es[a],m=d.interleaved,m!==null){d.interleaved=null;var b=m.next,E=d.pending;if(E!==null){var S=E.next;E.next=b,m.next=S}d.pending=m}es=null}return o}function Qg(o,a){do{var d=Lt;try{if(Rd(),Ta.current=Ra,Ma){for(var m=xt.memoizedState;m!==null;){var b=m.queue;b!==null&&(b.pending=null),m=m.next}Ma=!1}if(ns=0,$t=jt=xt=null,Yo=!1,Jo=0,df.current=null,d===null||d.return===null){zt=1,tl=a,Lt=null;break}e:{var E=o,S=d.return,T=d,D=a;if(a=Yt,T.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var W=D,se=T,oe=se.tag;if((se.mode&1)===0&&(oe===0||oe===11||oe===15)){var re=se.alternate;re?(se.updateQueue=re.updateQueue,se.memoizedState=re.memoizedState,se.lanes=re.lanes):(se.updateQueue=null,se.memoizedState=null)}var ve=wg(S);if(ve!==null){ve.flags&=-257,xg(ve,S,T,E,a),ve.mode&1&&Eg(E,W,a),a=ve,D=W;var Se=a.updateQueue;if(Se===null){var Ce=new Set;Ce.add(D),a.updateQueue=Ce}else Se.add(D);break e}else{if((a&1)===0){Eg(E,W,a),kf();break e}D=Error(n(426))}}else if(gt&&T.mode&1){var Rt=wg(S);if(Rt!==null){(Rt.flags&65536)===0&&(Rt.flags|=256),xg(Rt,S,T,E,a),Ad(Qs(D,T));break e}}E=D=Qs(D,T),zt!==4&&(zt=2),nl===null?nl=[E]:nl.push(E),E=S;do{switch(E.tag){case 3:E.flags|=65536,a&=-a,E.lanes|=a;var z=vg(E,D,a);Km(E,z);break e;case 1:T=D;var B=E.type,F=E.stateNode;if((E.flags&128)===0&&(typeof B.getDerivedStateFromError=="function"||F!==null&&typeof F.componentDidCatch=="function"&&(di===null||!di.has(F)))){E.flags|=65536,a&=-a,E.lanes|=a;var ue=kg(E,T,a);Km(E,ue);break e}}E=E.return}while(E!==null)}ey(d)}catch(Ne){a=Ne,Lt===d&&d!==null&&(Lt=d=d.return);continue}break}while(!0)}function Xg(){var o=ja.current;return ja.current=Ra,o===null?Ra:o}function kf(){(zt===0||zt===3||zt===2)&&(zt=4),Ut===null||(rs&268435455)===0&&(za&268435455)===0||hi(Ut,Yt)}function Va(o,a){var d=Ye;Ye|=2;var m=Xg();(Ut!==o||Yt!==a)&&(zr=null,ss(o,a));do try{Fx();break}catch(b){Qg(o,b)}while(!0);if(Rd(),Ye=d,ja.current=m,Lt!==null)throw Error(n(261));return Ut=null,Yt=0,zt}function Fx(){for(;Lt!==null;)Zg(Lt)}function $x(){for(;Lt!==null&&!Ql();)Zg(Lt)}function Zg(o){var a=ry(o.alternate,o,On);o.memoizedProps=o.pendingProps,a===null?ey(o):Lt=a,df.current=null}function ey(o){var a=o;do{var d=a.alternate;if(o=a.return,(a.flags&32768)===0){if(d=Ix(d,a,On),d!==null){Lt=d;return}}else{if(d=Lx(d,a),d!==null){d.flags&=32767,Lt=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{zt=6,Lt=null;return}}if(a=a.sibling,a!==null){Lt=a;return}Lt=a=o}while(a!==null);zt===0&&(zt=5)}function ls(o,a,d){var m=Ge,b=$n.transition;try{$n.transition=null,Ge=1,Ux(o,a,d,m)}finally{$n.transition=b,Ge=m}return null}function Ux(o,a,d,m){do to();while(fi!==null);if((Ye&6)!==0)throw Error(n(327));d=o.finishedWork;var b=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var E=d.lanes|d.childLanes;if(Pn(o,E),o===Ut&&(Lt=Ut=null,Yt=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||$a||($a=!0,iy(Rs,function(){return to(),null})),E=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||E){E=$n.transition,$n.transition=null;var S=Ge;Ge=1;var T=Ye;Ye|=4,df.current=null,Px(o,d),Wg(d,o),ax(vd),na=!!bd,vd=bd=null,o.current=d,Bx(d),Xl(),Ye=T,Ge=S,$n.transition=E}else o.current=d;if($a&&($a=!1,fi=o,Ua=b),E=o.pendingLanes,E===0&&(di=null),At(d.stateNode),Sn(o,kt()),a!==null)for(m=o.onRecoverableError,d=0;d<a.length;d++)b=a[d],m(b.value,{componentStack:b.stack,digest:b.digest});if(Fa)throw Fa=!1,o=hf,hf=null,o;return(Ua&1)!==0&&o.tag!==0&&to(),E=o.pendingLanes,(E&1)!==0?o===mf?rl++:(rl=0,mf=o):rl=0,li(),null}function to(){if(fi!==null){var o=je(Ua),a=$n.transition,d=Ge;try{if($n.transition=null,Ge=16>o?16:o,fi===null)var m=!1;else{if(o=fi,fi=null,Ua=0,(Ye&6)!==0)throw Error(n(331));var b=Ye;for(Ye|=4,xe=o.current;xe!==null;){var E=xe,S=E.child;if((xe.flags&16)!==0){var T=E.deletions;if(T!==null){for(var D=0;D<T.length;D++){var W=T[D];for(xe=W;xe!==null;){var se=xe;switch(se.tag){case 0:case 11:case 15:el(8,se,E)}var oe=se.child;if(oe!==null)oe.return=se,xe=oe;else for(;xe!==null;){se=xe;var re=se.sibling,ve=se.return;if(zg(se),se===W){xe=null;break}if(re!==null){re.return=ve,xe=re;break}xe=ve}}}var Se=E.alternate;if(Se!==null){var Ce=Se.child;if(Ce!==null){Se.child=null;do{var Rt=Ce.sibling;Ce.sibling=null,Ce=Rt}while(Ce!==null)}}xe=E}}if((E.subtreeFlags&2064)!==0&&S!==null)S.return=E,xe=S;else e:for(;xe!==null;){if(E=xe,(E.flags&2048)!==0)switch(E.tag){case 0:case 11:case 15:el(9,E,E.return)}var z=E.sibling;if(z!==null){z.return=E.return,xe=z;break e}xe=E.return}}var B=o.current;for(xe=B;xe!==null;){S=xe;var F=S.child;if((S.subtreeFlags&2064)!==0&&F!==null)F.return=S,xe=F;else e:for(S=B;xe!==null;){if(T=xe,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Ba(9,T)}}catch(Ne){Ct(T,T.return,Ne)}if(T===S){xe=null;break e}var ue=T.sibling;if(ue!==null){ue.return=T.return,xe=ue;break e}xe=T.return}}if(Ye=b,li(),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(Fe,o)}catch{}m=!0}return m}finally{Ge=d,$n.transition=a}}return!1}function ty(o,a,d){a=Qs(d,a),a=vg(o,a,1),o=ci(o,a,1),a=hn(),o!==null&&(ei(o,1,a),Sn(o,a))}function Ct(o,a,d){if(o.tag===3)ty(o,o,d);else for(;a!==null;){if(a.tag===3){ty(a,o,d);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(di===null||!di.has(m))){o=Qs(d,o),o=kg(a,o,1),a=ci(a,o,1),o=hn(),a!==null&&(ei(a,1,o),Sn(a,o));break}}a=a.return}}function Hx(o,a,d){var m=o.pingCache;m!==null&&m.delete(a),a=hn(),o.pingedLanes|=o.suspendedLanes&d,Ut===o&&(Yt&d)===d&&(zt===4||zt===3&&(Yt&130023424)===Yt&&500>kt()-pf?ss(o,0):ff|=d),Sn(o,a)}function ny(o,a){a===0&&((o.mode&1)===0?a=1:(a=Ki,Ki<<=1,(Ki&130023424)===0&&(Ki=4194304)));var d=hn();o=Pr(o,a),o!==null&&(ei(o,a,d),Sn(o,d))}function Wx(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),ny(o,d)}function Vx(o,a){var d=0;switch(o.tag){case 13:var m=o.stateNode,b=o.memoizedState;b!==null&&(d=b.retryLane);break;case 19:m=o.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(a),ny(o,d)}var ry;ry=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||kn.current)wn=!0;else{if((o.lanes&d)===0&&(a.flags&128)===0)return wn=!1,Rx(o,a,d);wn=(o.flags&131072)!==0}else wn=!1,gt&&(a.flags&1048576)!==0&&Pm(a,ka,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Da(o,a),o=a.pendingProps;var b=Hs(a,tn.current);Ys(a,d),b=Hd(null,a,m,o,b,d);var E=Wd();return a.flags|=1,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,En(m)?(E=!0,ya(a)):E=!1,a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,Pd(a),b.updater=Ia,a.stateNode=b,b._reactInternals=a,Jd(a,m,o,d),a=ef(null,a,m,!0,E,d)):(a.tag=0,gt&&E&&Nd(a),pn(null,a,b,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Da(o,a),o=a.pendingProps,b=m._init,m=b(m._payload),a.type=m,b=a.tag=qx(m),o=er(m,o),b){case 0:a=Zd(null,a,m,o,d);break e;case 1:a=Mg(null,a,m,o,d);break e;case 11:a=Sg(null,a,m,o,d);break e;case 14:a=Cg(null,a,m,er(m.type,o),d);break e}throw Error(n(306,m,""))}return a;case 0:return m=a.type,b=a.pendingProps,b=a.elementType===m?b:er(m,b),Zd(o,a,m,b,d);case 1:return m=a.type,b=a.pendingProps,b=a.elementType===m?b:er(m,b),Mg(o,a,m,b,d);case 3:e:{if(Ag(a),o===null)throw Error(n(387));m=a.pendingProps,E=a.memoizedState,b=E.element,Vm(o,a),Na(a,m,null,d);var S=a.memoizedState;if(m=S.element,E.isDehydrated)if(E={element:m,isDehydrated:!1,cache:S.cache,pendingSuspenseBoundaries:S.pendingSuspenseBoundaries,transitions:S.transitions},a.updateQueue.baseState=E,a.memoizedState=E,a.flags&256){b=Qs(Error(n(423)),a),a=Og(o,a,m,d,b);break e}else if(m!==b){b=Qs(Error(n(424)),a),a=Og(o,a,m,d,b);break e}else for(An=ii(a.stateNode.containerInfo.firstChild),Mn=a,gt=!0,Zn=null,d=Hm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Ks(),m===b){a=jr(o,a,d);break e}pn(o,a,m,d)}a=a.child}return a;case 5:return Gm(a),o===null&&Md(a),m=a.type,b=a.pendingProps,E=o!==null?o.memoizedProps:null,S=b.children,kd(m,b)?S=null:E!==null&&kd(m,E)&&(a.flags|=32),Tg(o,a),pn(o,a,S,d),a.child;case 6:return o===null&&Md(a),null;case 13:return Rg(o,a,d);case 4:return Bd(a,a.stateNode.containerInfo),m=a.pendingProps,o===null?a.child=qs(a,null,m,d):pn(o,a,m,d),a.child;case 11:return m=a.type,b=a.pendingProps,b=a.elementType===m?b:er(m,b),Sg(o,a,m,b,d);case 7:return pn(o,a,a.pendingProps,d),a.child;case 8:return pn(o,a,a.pendingProps.children,d),a.child;case 12:return pn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,b=a.pendingProps,E=a.memoizedProps,S=b.value,at(xa,m._currentValue),m._currentValue=S,E!==null)if(Xn(E.value,S)){if(E.children===b.children&&!kn.current){a=jr(o,a,d);break e}}else for(E=a.child,E!==null&&(E.return=a);E!==null;){var T=E.dependencies;if(T!==null){S=E.child;for(var D=T.firstContext;D!==null;){if(D.context===m){if(E.tag===1){D=Br(-1,d&-d),D.tag=2;var W=E.updateQueue;if(W!==null){W=W.shared;var se=W.pending;se===null?D.next=D:(D.next=se.next,se.next=D),W.pending=D}}E.lanes|=d,D=E.alternate,D!==null&&(D.lanes|=d),Ld(E.return,d,a),T.lanes|=d;break}D=D.next}}else if(E.tag===10)S=E.type===a.type?null:E.child;else if(E.tag===18){if(S=E.return,S===null)throw Error(n(341));S.lanes|=d,T=S.alternate,T!==null&&(T.lanes|=d),Ld(S,d,a),S=E.sibling}else S=E.child;if(S!==null)S.return=E;else for(S=E;S!==null;){if(S===a){S=null;break}if(E=S.sibling,E!==null){E.return=S.return,S=E;break}S=S.return}E=S}pn(o,a,b.children,d),a=a.child}return a;case 9:return b=a.type,m=a.pendingProps.children,Ys(a,d),b=zn(b),m=m(b),a.flags|=1,pn(o,a,m,d),a.child;case 14:return m=a.type,b=er(m,a.pendingProps),b=er(m.type,b),Cg(o,a,m,b,d);case 15:return Ng(o,a,a.type,a.pendingProps,d);case 17:return m=a.type,b=a.pendingProps,b=a.elementType===m?b:er(m,b),Da(o,a),a.tag=1,En(m)?(o=!0,ya(a)):o=!1,Ys(a,d),yg(a,m,b),Jd(a,m,b,d),ef(null,a,m,!0,o,d);case 19:return Lg(o,a,d);case 22:return _g(o,a,d)}throw Error(n(156,a.tag))};function iy(o,a){return Jl(o,a)}function Kx(o,a,d,m){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(o,a,d,m){return new Kx(o,a,d,m)}function Ef(o){return o=o.prototype,!(!o||!o.isReactComponent)}function qx(o){if(typeof o=="function")return Ef(o)?1:0;if(o!=null){if(o=o.$$typeof,o===H)return 11;if(o===G)return 14}return 2}function mi(o,a){var d=o.alternate;return d===null?(d=Un(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function Ka(o,a,d,m,b,E){var S=2;if(m=o,typeof o=="function")Ef(o)&&(S=1);else if(typeof o=="string")S=5;else e:switch(o){case $:return as(d.children,b,E,a);case te:S=8,b|=8;break;case le:return o=Un(12,d,a,b|2),o.elementType=le,o.lanes=E,o;case K:return o=Un(13,d,a,b),o.elementType=K,o.lanes=E,o;case U:return o=Un(19,d,a,b),o.elementType=U,o.lanes=E,o;case me:return qa(d,b,E,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case ee:S=10;break e;case Q:S=9;break e;case H:S=11;break e;case G:S=14;break e;case ie:S=16,m=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return a=Un(S,d,a,b),a.elementType=o,a.type=m,a.lanes=E,a}function as(o,a,d,m){return o=Un(7,o,m,a),o.lanes=d,o}function qa(o,a,d,m){return o=Un(22,o,m,a),o.elementType=me,o.lanes=d,o.stateNode={isHidden:!1},o}function wf(o,a,d){return o=Un(6,o,null,a),o.lanes=d,o}function xf(o,a,d){return a=Un(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function Gx(o,a,d,m,b){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zr(0),this.expirationTimes=Zr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zr(0),this.identifierPrefix=m,this.onRecoverableError=b,this.mutableSourceEagerHydrationData=null}function Sf(o,a,d,m,b,E,S,T,D){return o=new Gx(o,a,d,T,D),a===1?(a=1,E===!0&&(a|=8)):a=0,E=Un(3,null,null,a),o.current=E,E.stateNode=o,E.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pd(E),o}function Yx(o,a,d){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:m==null?null:""+m,children:o,containerInfo:a,implementation:d}}function sy(o){if(!o)return oi;o=o._reactInternals;e:{if(Or(o)!==o||o.tag!==1)throw Error(n(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(En(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(o.tag===1){var d=o.type;if(En(d))return Im(o,d,a)}return a}function oy(o,a,d,m,b,E,S,T,D){return o=Sf(d,m,!0,o,b,E,S,T,D),o.context=sy(null),d=o.current,m=hn(),b=pi(d),E=Br(m,b),E.callback=a??null,ci(d,E,b),o.current.lanes=b,ei(o,b,m),Sn(o,m),o}function Ga(o,a,d,m){var b=a.current,E=hn(),S=pi(b);return d=sy(d),a.context===null?a.context=d:a.pendingContext=d,a=Br(E,S),a.payload={element:o},m=m===void 0?null:m,m!==null&&(a.callback=m),o=ci(b,a,S),o!==null&&(rr(o,b,S,E),Ca(o,b,S)),S}function Ya(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function ly(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function Cf(o,a){ly(o,a),(o=o.alternate)&&ly(o,a)}function Jx(){return null}var ay=typeof reportError=="function"?reportError:function(o){console.error(o)};function Nf(o){this._internalRoot=o}Ja.prototype.render=Nf.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(n(409));Ga(o,a,null,null)},Ja.prototype.unmount=Nf.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;is(function(){Ga(null,o,null,null)}),a[Rr]=null}};function Ja(o){this._internalRoot=o}Ja.prototype.unstable_scheduleHydration=function(o){if(o){var a=Gi();o={blockedOn:null,target:o,priority:a};for(var d=0;d<Ft.length&&a!==0&&a<Ft[d].priority;d++);Ft.splice(d,0,o),d===0&&Gh(o)}};function _f(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Qa(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function cy(){}function Qx(o,a,d,m,b){if(b){if(typeof m=="function"){var E=m;m=function(){var W=Ya(S);E.call(W)}}var S=oy(a,m,o,0,null,!1,!1,"",cy);return o._reactRootContainer=S,o[Rr]=S.current,$o(o.nodeType===8?o.parentNode:o),is(),S}for(;b=o.lastChild;)o.removeChild(b);if(typeof m=="function"){var T=m;m=function(){var W=Ya(D);T.call(W)}}var D=Sf(o,0,!1,null,null,!1,!1,"",cy);return o._reactRootContainer=D,o[Rr]=D.current,$o(o.nodeType===8?o.parentNode:o),is(function(){Ga(a,D,d,m)}),D}function Xa(o,a,d,m,b){var E=d._reactRootContainer;if(E){var S=E;if(typeof b=="function"){var T=b;b=function(){var D=Ya(S);T.call(D)}}Ga(a,S,o,b)}else S=Qx(d,a,o,b,m);return Ya(S)}Mo=function(o){switch(o.tag){case 3:var a=o.stateNode;if(a.current.memoizedState.isDehydrated){var d=Xr(a.pendingLanes);d!==0&&(To(a,d|1),Sn(a,kt()),(Ye&6)===0&&(eo=kt()+500,li()))}break;case 13:is(function(){var m=Pr(o,1);if(m!==null){var b=hn();rr(m,o,1,b)}}),Cf(o,1)}},Ot=function(o){if(o.tag===13){var a=Pr(o,134217728);if(a!==null){var d=hn();rr(a,o,134217728,d)}Cf(o,134217728)}},nt=function(o){if(o.tag===13){var a=pi(o),d=Pr(o,a);if(d!==null){var m=hn();rr(d,o,a,m)}Cf(o,a)}},Gi=function(){return Ge},hr=function(o,a){var d=Ge;try{return Ge=o,a()}finally{Ge=d}},As=function(o,a,d){switch(a){case"input":if(bn(o,d),a=d.name,d.type==="radio"&&a!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<d.length;a++){var m=d[a];if(m!==o&&m.form===o.form){var b=ma(m);if(!b)throw Error(n(90));Ve(m),bn(m,b)}}}break;case"textarea":de(o,d);break;case"select":a=d.value,a!=null&&ur(o,!!d.multiple,a,!1)}},pe=bf,Pe=is;var Xx={usingClientEntryPoint:!1,Events:[Wo,$s,ma,L,Y,bf]},il={findFiberByHostInstance:Ji,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Zx={bundleType:il.bundleType,version:il.version,rendererPackageName:il.rendererPackageName,rendererConfig:il.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=Gl(o),o===null?null:o.stateNode},findFiberByHostInstance:il.findFiberByHostInstance||Jx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{Fe=Za.inject(Zx),We=Za}catch{}}return Cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xx,Cn.createPortal=function(o,a){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_f(a))throw Error(n(200));return Yx(o,a,null,d)},Cn.createRoot=function(o,a){if(!_f(o))throw Error(n(299));var d=!1,m="",b=ay;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onRecoverableError!==void 0&&(b=a.onRecoverableError)),a=Sf(o,1,!1,null,null,d,!1,m,b),o[Rr]=a.current,$o(o.nodeType===8?o.parentNode:o),new Nf(a)},Cn.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=Gl(a),o=o===null?null:o.stateNode,o},Cn.flushSync=function(o){return is(o)},Cn.hydrate=function(o,a,d){if(!Qa(a))throw Error(n(200));return Xa(null,o,a,!0,d)},Cn.hydrateRoot=function(o,a,d){if(!_f(o))throw Error(n(405));var m=d!=null&&d.hydratedSources||null,b=!1,E="",S=ay;if(d!=null&&(d.unstable_strictMode===!0&&(b=!0),d.identifierPrefix!==void 0&&(E=d.identifierPrefix),d.onRecoverableError!==void 0&&(S=d.onRecoverableError)),a=oy(a,null,o,1,d??null,b,!1,E,S),o[Rr]=a.current,$o(o),m)for(o=0;o<m.length;o++)d=m[o],b=d._getVersion,b=b(d._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[d,b]:a.mutableSourceEagerHydrationData.push(d,b);return new Ja(a)},Cn.render=function(o,a,d){if(!Qa(a))throw Error(n(200));return Xa(null,o,a,!1,d)},Cn.unmountComponentAtNode=function(o){if(!Qa(o))throw Error(n(40));return o._reactRootContainer?(is(function(){Xa(null,null,o,!1,function(){o._reactRootContainer=null,o[Rr]=null})}),!0):!1},Cn.unstable_batchedUpdates=bf,Cn.unstable_renderSubtreeIntoContainer=function(o,a,d,m){if(!Qa(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Xa(o,a,d,!1,m)},Cn.version="18.3.1-next-f1338f8080-20240426",Cn}var yy;function I0(){if(yy)return Af.exports;yy=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(),Af.exports=oS(),Af.exports}var by;function lS(){if(by)return ec;by=1;var t=I0();return ec.createRoot=t.createRoot,ec.hydrateRoot=t.hydrateRoot,ec}var aS=lS();const cS=_u(aS),L0=[{id:"ink",label:"Ink",description:"Charter + Inter",swatch:{light:"#5b7a9d",dark:"#7d9bba"}},{id:"novel",label:"Novel",description:"Source Serif 4 + Newsreader",swatch:{light:"#a68b6b",dark:"#c4a882"}},{id:"mono",label:"Mono",description:"IBM Plex Mono + Sans",swatch:{light:"#787878",dark:"#a0a0a0"}},{id:"editorial",label:"Editorial",description:"Crimson Pro + Playfair",swatch:{light:"#9e6b6b",dark:"#b88a8a"}},{id:"studio",label:"Studio",description:"Inter everywhere",swatch:{light:"#8b7baa",dark:"#a899c4"}},{id:"calm",label:"Calm",description:"Inter warm tones",swatch:{light:"#8a9e6b",dark:"#a4b886"}},{id:"prose",label:"Prose",description:"Libre Baskerville + Inter",swatch:{light:"#6b9e95",dark:"#8ab8af"}},{id:"craft",label:"Craft",description:"Space Grotesk + Mono",swatch:{light:"#7b6b9e",dark:"#9a8ab8"}},{id:"literata",label:"Literata",description:"Literata + Inter",swatch:{light:"#b09070",dark:"#c8a88a"}},{id:"swiss",label:"Swiss",description:"DM Sans + DM Serif",swatch:{light:"#c47a6b",dark:"#d49a8c"}}],D0=[{id:"default",label:"Tree",icon:"tree"},{id:"timeline",label:"Timeline",icon:"timeline"},{id:"board",label:"Board",icon:"board"},{id:"shelf",label:"Shelf",icon:"shelf"}],P0=[{id:"default",label:"Default"},{id:"frost",label:"Frost"},{id:"minimal",label:"Minimal"},{id:"terminal",label:"Terminal"}],B0=[{id:"seamless",label:"Seamless"},{id:"outline",label:"Outline"},{id:"raised",label:"Raised"},{id:"page",label:"Page"}],j0=[{id:"default",label:"Default"},{id:"web",label:"Web"},{id:"blog",label:"Blog"},{id:"butterick",label:"Butterick"}],Kn={theme:"ow-theme",mode:"ow-theme-mode",sidebarMode:"ow-sidebar-mode",sidebarStyle:"ow-sidebar-style",typography:"ow-typography",canvas:"ow-canvas"};function z0(){const t=localStorage.getItem(Kn.theme);return t&&L0.some(e=>e.id===t)?t:"ink"}function F0(){const t=localStorage.getItem(Kn.mode);return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Tu(){const t=localStorage.getItem(Kn.sidebarMode);return t&&D0.some(e=>e.id===t)?t:"default"}function $0(){const t=localStorage.getItem(Kn.sidebarStyle);return t&&P0.some(e=>e.id===t)?t:"default"}function U0(){const t=localStorage.getItem(Kn.typography);return t&&j0.some(e=>e.id===t)?t:"default"}function H0(){const t=localStorage.getItem(Kn.canvas);return t&&B0.some(e=>e.id===t)?t:"seamless"}function W0(t,e,n,r,i="default",s="seamless"){const l=document.documentElement;l.setAttribute("data-theme",t),l.setAttribute("data-mode",e),l.setAttribute("data-sidebar-mode",n),l.setAttribute("data-sidebar-style",r),i==="default"?l.removeAttribute("data-typography"):l.setAttribute("data-typography",i),s==="seamless"?l.removeAttribute("data-canvas"):l.setAttribute("data-canvas",s),localStorage.setItem(Kn.theme,t),localStorage.setItem(Kn.mode,e),localStorage.setItem(Kn.sidebarMode,n),localStorage.setItem(Kn.sidebarStyle,r),localStorage.setItem(Kn.typography,i),localStorage.setItem(Kn.canvas,s)}function uS(){W0(z0(),F0(),Tu(),$0(),U0(),H0())}var dS=I0();const fS=_u(dS);var If={exports:{}},Lf={};/**
41
+ * @license React
42
+ * use-sync-external-store-shim.production.js
43
+ *
44
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE file in the root directory of this source tree.
48
+ */var vy;function pS(){if(vy)return Lf;vy=1;var t=zl();function e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,l=t.useDebugValue;function c(h,g){var y=g(),k=r({inst:{value:y,getSnapshot:g}}),w=k[0].inst,x=k[1];return s(function(){w.value=y,w.getSnapshot=g,u(w)&&x({inst:w})},[h,y,g]),i(function(){return u(w)&&x({inst:w}),h(function(){u(w)&&x({inst:w})})},[h]),l(y),y}function u(h){var g=h.getSnapshot;h=h.value;try{var y=g();return!n(h,y)}catch{return!0}}function f(h,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Lf.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Lf}var ky;function V0(){return ky||(ky=1,If.exports=pS()),If.exports}var K0=V0();function Qt(t){this.content=t}Qt.prototype={constructor:Qt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Qt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Qt(n)},addToStart:function(t,e){return new Qt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Qt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Qt(i)},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=Qt.from(t),t.size?new Qt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Qt.from(t),t.size?new Qt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Qt.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}};Qt.from=function(t){if(t instanceof Qt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Qt(e)};function q0(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)n++;return n}if(i.content.size||s.content.size){let l=q0(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function G0(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let l=t.child(--i),c=e.child(--s),u=l.nodeSize;if(l==c){n-=u,r-=u;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=0,p=Math.min(l.text.length,c.text.length);for(;f<p&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let f=G0(l.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}class J{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let l=0,c=0;c<n;l++){let u=this.content[l],f=c+u.nodeSize;if(f>e&&r(u,i+c,s||null,l)!==!1&&u.content.size){let p=c+1;u.nodesBetween(Math.max(0,e-p),Math.min(u.content.size,n-p),r,i+p)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new J(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,l=0;l<n;s++){let c=this.content[s],u=l+c.nodeSize;u>e&&((l<e||u>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=u}return new J(r,i)}cutByIndex(e,n){return e==n?J.empty:e==0&&n==this.content.length?this:new J(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new J(i,s)}addToStart(e){return new J([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new J(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return q0(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return G0(this,e,n,r)}findIndex(e){if(e==0)return tc(0,e);if(e==this.size)return tc(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?tc(n+1,s):tc(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return J.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new J(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return J.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new J(n||e,r)}static from(e){if(!e)return J.empty;if(e instanceof J)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new J([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const Df={index:0,offset:0};function tc(t,e){return Df.index=t,Df.offset=e,Df}function Ic(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ic(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ic(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ot=class mp{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ic(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return mp.none;if(e instanceof mp)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ot.none=[];class Lc extends Error{}class he{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=J0(this.content,e+this.openStart,n);return r&&new he(r,this.openStart,this.openEnd)}removeBetween(e,n){return new he(Y0(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 he.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new he(J.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new he(e,r,i)}}he.empty=new he(J.empty,0,0);function Y0(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:l,offset:c}=t.findIndex(n);if(i==e||s.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Y0(s.content,e-i-1,n-i-1)))}function J0(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),l=t.maybeChild(i);if(s==e||l.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=J0(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function hS(t,e,n){if(n.openStart>t.depth)throw new Lc("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Lc("Inconsistent open depths");return Q0(t,e,n,0)}function Q0(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let l=Q0(t,e,n,r+1);return s.copy(s.content.replaceChild(i,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,c=l.content;return gs(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=mS(n,t);return gs(s,Z0(t,l,c,e,r))}else return gs(s,Dc(t,e,r))}function X0(t,e){if(!e.type.compatibleContent(t.type))throw new Lc("Cannot join "+e.type.name+" onto "+t.type.name)}function gp(t,e,n){let r=t.node(n);return X0(r,e.node(n)),r}function ms(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 gl(t,e,n,r){let i=(e||t).node(n),s=0,l=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ms(t.nodeAfter,r),s++));for(let c=s;c<l;c++)ms(i.child(c),r);e&&e.depth==n&&e.textOffset&&ms(e.nodeBefore,r)}function gs(t,e){return t.type.checkContent(e),t.copy(e)}function Z0(t,e,n,r,i){let s=t.depth>i&&gp(t,e,i+1),l=r.depth>i&&gp(n,r,i+1),c=[];return gl(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(X0(s,l),ms(gs(s,Z0(t,e,n,r,i+1)),c)):(s&&ms(gs(s,Dc(t,e,i+1)),c),gl(e,n,i,c),l&&ms(gs(l,Dc(n,r,i+1)),c)),gl(r,null,i,c),new J(c)}function Dc(t,e,n){let r=[];if(gl(null,t,n,r),t.depth>n){let i=gp(t,e,n+1);ms(gs(i,Dc(t,e,n+1)),r)}return gl(e,null,n,r),new J(r)}function mS(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(J.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class _l{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ot.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!i||!s[l].isInSet(i.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Pc(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let l=e;;){let{index:c,offset:u}=l.content.findIndex(s),f=s-u;if(r.push(l,c,i+u),!f||(l=l.child(c),l.isText))break;s=f-1,i+=u+1}return new _l(n,r,s)}static resolveCached(e,n){let r=Ey.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==n)return l}else Ey.set(e,r=new gS);let i=r.elts[r.i]=_l.resolve(e,n);return r.i=(r.i+1)%yS,i}}class gS{constructor(){this.elts=[],this.i=0}}const yS=12,Ey=new WeakMap;class Pc{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const bS=Object.create(null);class or{constructor(e,n,r,i=ot.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ic(this.attrs,n||e.defaultAttrs||bS)&&ot.sameSet(this.marks,r||ot.none)}copy(e=null){return e==this.content?this:new or(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new or(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return he.empty;let i=this.resolve(e),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),f=i.node(l).content.cut(i.pos-c,s.pos-c);return new he(f,i.depth-l,s.depth-l)}replace(e,n,r){return hS(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return _l.resolveCached(this,e)}resolveNoCache(e){return _l.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),ev(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=J.empty,i=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,n);return l?l.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=ot.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ot.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=J.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}or.prototype.text=void 0;class Bc extends or{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ev(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 Bc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Bc(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 ev(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ks{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new vS(e,n);if(r.next==null)return ks.empty;let i=tv(r);r.next&&r.err("Unexpected trailing text");let s=NS(CS(i));return _S(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(l,c){let u=l.matchFragment(e,r);if(u&&(!n||u.validEnd))return J.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:p,next:h}=l.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(h)==-1){i.push(h);let g=s(h,c.concat(p));if(g)return g}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:u}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
49
+ `)}}ks.empty=new ks(!0);class vS{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 tv(t){let e=[];do e.push(kS(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function kS(t){let e=[];do e.push(ES(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ES(t){let e=SS(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=wS(t,e);else break;return e}function wy(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function wS(t,e){let n=wy(t),r=n;return t.eat(",")&&(t.next!="}"?r=wy(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function xS(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let l=n[s];l.isInGroup(e)&&i.push(l)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function SS(t){if(t.eat("(")){let e=tv(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=xS(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 CS(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,u){let f={term:u,to:c};return e[l].push(f),f}function i(l,c){l.forEach(u=>u.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((u,f)=>u.concat(s(f,c)),[]);if(l.type=="seq")for(let u=0;;u++){let f=s(l.exprs[u],c);if(u==l.exprs.length-1)return f;i(f,c=n())}else if(l.type=="star"){let u=n();return r(c,u),i(s(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=n();return i(s(l.expr,c),u),i(s(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let u=c;for(let f=0;f<l.min;f++){let p=n();i(s(l.expr,u),p),u=p}if(l.max==-1)i(s(l.expr,u),u);else for(let f=l.min;f<l.max;f++){let p=n();r(u,p),i(s(l.expr,u),p),u=p}return[r(u)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function nv(t,e){return e-t}function xy(t,e){let n=[];return r(e),n.sort(nv);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:u}=s[l];!c&&n.indexOf(u)==-1&&r(u)}}}function NS(t){let e=Object.create(null);return n(xy(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let p=0;p<i.length;p++)i[p][0]==c&&(f=i[p][1]);xy(t,u).forEach(p=>{f||i.push([c,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let s=e[r.join(",")]=new ks(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(nv);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function _S(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];l.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function rv(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function iv(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function sv(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function ov(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new MS(t,r,e[r]);return n}let Sy=class lv{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ov(e,r.attrs),this.defaultAttrs=rv(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ks.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:iv(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new or(this,this.computeAttrs(e),J.from(n),ot.setFrom(r))}createChecked(e=null,n,r){return n=J.from(n),this.checkContent(n),new or(this,this.computeAttrs(e),n,ot.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=J.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(J.empty,!0);return s?new or(this,e,n.append(s),ot.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){sv(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ot.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new lv(s,n,l));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function TS(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class MS{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?TS(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Mu{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ov(e,i.attrs),this.excluded=null;let s=rv(this.attrs);this.instance=s?new ot(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ot(this,iv(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new Mu(s,i++,n,l)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){sv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class av{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Qt.from(e.nodes),n.marks=Qt.from(e.marks||{}),this.nodes=Sy.compile(this.spec.nodes,this),this.marks=Mu.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],l=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=ks.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=c=="_"?null:c?Cy(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:Cy(this,l.split(" "))}this.nodeFromJSON=i=>or.fromJSON(this,i),this.markFromJSON=i=>ot.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Sy){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Bc(r,r.defaultAttrs,e,ot.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 Cy(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],l=s;if(s)n.push(s);else for(let c in t.marks){let u=t.marks[c];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function AS(t){return t.tag!=null}function OS(t){return t.style!=null}class Ti{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(AS(i))this.tags.push(i);else if(OS(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new _y(this,n,!1);return r.addAll(e,ot.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new _y(this,n,!0);return r.addAll(e,ot.none,n.from,n.to),he.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(LS(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=Ty(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(l=>{r(l=Ty(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ti(e,Ti.schemaRules(e)))}}const cv={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},RS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},uv={ol:!0,ul:!0},Tl=1,yp=2,yl=4;function Ny(t,e,n){return e!=null?(e?Tl:0)|(e==="full"?yp:0):t&&t.whitespace=="pre"?Tl|yp:n&~yl}class nc{constructor(e,n,r,i,s,l){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=ot.none,this.match=s||(l&yl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(J.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Tl)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=J.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(J.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&&!cv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class _y{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,l=Ny(null,n.preserveWhitespace,0)|(r?yl:0);i?s=new nc(i.type,i.attrs,ot.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new nc(null,null,ot.none,!0,null,l):s=new nc(e.schema.topNodeType,null,ot.none,!0,null,l),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&yp?"full":this.localPreserveWS||(i.options&Tl)>0,{schema:l}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
50
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(l.text(c[u]),n,!/\S/.test(c[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],u=e.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),c;uv.hasOwnProperty(l)&&this.parser.normalizeLists&&IS(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:RS.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,p=this.needsBlock;if(cv.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let h=u&&u.skip?n:this.readStyles(e,n);h&&this.addAll(e,h),f&&this.sync(s),this.needsBlock=p}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
51
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let u=this.parser.matchStyle(s,l,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(l,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let u=this.nodes[l],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=ot.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):My(c.type,e.type))&&(l=c.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let c=Ny(e,s,l.options);l.options&yl&&l.content.length==0&&(c|=yl);let u=ot.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):My(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new nc(e,n,u,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Tl)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),l=(c,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(l(c-1,u))return!0;return!1}else{let p=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function IS(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&uv.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function LS(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ty(t){let e={};for(let n in t)e[n]=t[n];return e}function My(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],l=c=>{s.push(c);for(let u=0;u<c.edgeCount;u++){let{type:f,next:p}=c.edge(u);if(f==e||s.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class _s{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Pf(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,u=0;for(;c<s.length&&u<l.marks.length;){let f=l.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<s.length;)i=s.pop()[1];for(;u<l.marks.length;){let f=l.marks[u++],p=this.serializeMark(f,l.isInline,n);p&&(s.push([f,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Nc(Pf(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Nc(Pf(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Nc(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new _s(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Ay(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Ay(e.marks)}}function Ay(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Pf(t){return t.document||window.document}const Oy=new WeakMap;function DS(t){let e=Oy.get(t);return e===void 0&&Oy.set(t,e=PS(t)),e}function PS(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Nc(t,e,n,r){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 i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=DS(r))&&s.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 l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let h in f)if(f[h]!=null){let g=h.indexOf(" ");g>0?u.setAttributeNS(h.slice(0,g),h.slice(g+1),f[h]):h=="style"&&u.style?u.style.cssText=f[h]:u.setAttribute(h,f[h])}}for(let h=p;h<e.length;h++){let g=e[h];if(g===0){if(h<e.length-1||h>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:k}=Nc(t,g,n,r);if(u.appendChild(y),k){if(c)throw new RangeError("Multiple content holes");c=k}}}return{dom:u,contentDOM:c}}const dv=65535,fv=Math.pow(2,16);function BS(t,e){return t+e*fv}function Ry(t){return t&dv}function jS(t){return(t-(t&dv))/fv}const pv=1,hv=2,_c=4,mv=8;class bp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&mv)>0}get deletedBefore(){return(this.delInfo&(pv|_c))>0}get deletedAfter(){return(this.delInfo&(hv|_c))>0}get deletedAcross(){return(this.delInfo&_c)>0}}class Rn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Rn.empty)return Rn.empty}recover(e){let n=0,r=Ry(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+jS(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[c+s],p=this.ranges[c+l],h=u+f;if(e<=h){let g=f?e==u?-1:e==h?1:n:n,y=u+i+(g<0?0:p);if(r)return y;let k=e==(n<0?u:h)?null:BS(c/3,e-u),w=e==u?hv:e==h?pv:_c;return(n<0?e!=u:e!=h)&&(w|=mv),new bp(y,w,k)}i+=p-f}return r?e+i:new bp(e+i,0,null)}touches(e,n){let r=0,i=Ry(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[c+s],p=u+f;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+l]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?s:0),u=l+(this.inverted?0:s),f=this.ranges[i+n],p=this.ranges[i+r];e(c,c+f,u,u+p),s+=p-f}}invert(){return new Rn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Rn.empty:new Rn(e<0?[0,-e,0]:[0,0,e])}}Rn.empty=new Rn([]);class Ml{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ml(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Ml;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(e,n);if(c.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new bp(e,i,null)}}const Bf=Object.create(null);class cn{getMap(){return Rn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Bf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Bf)throw new RangeError("Duplicate use of step JSON ID "+e);return Bf[e]=n,n.prototype.jsonID=e,n}}class Pt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Pt(e,null)}static fail(e){return new Pt(null,e)}static fromReplace(e,n,r,i){try{return Pt.ok(e.replace(n,r,i))}catch(s){if(s instanceof Lc)return Pt.fail(s.message);throw s}}}function th(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(th(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return J.fromArray(r)}class Ci extends cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new he(th(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return Pt.fromReplace(e,this.from,this.to,s)}invert(){return new sr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ci(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ci&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ci(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 Ci(n.from,n.to,e.markFromJSON(n.mark))}}cn.jsonID("addMark",Ci);class sr extends cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new he(th(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Pt.fromReplace(e,this.from,this.to,r)}invert(){return new Ci(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 sr(n.from,n.to,e.markFromJSON(n.mark))}}cn.jsonID("removeMark",sr);class Ni extends cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Pt.fromReplace(e,this.pos,this.pos+1,new he(J.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Ni(this.pos,n.marks[i]);return new Ni(this.pos,this.mark)}}return new Es(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ni(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 Ni(n.pos,e.markFromJSON(n.mark))}}cn.jsonID("addNodeMark",Ni);class Es extends cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Pt.fromReplace(e,this.pos,this.pos+1,new he(J.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ni(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Es(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 Es(n.pos,e.markFromJSON(n.mark))}}cn.jsonID("removeNodeMark",Es);class Wt extends cn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&vp(e,this.from,this.to)?Pt.fail("Structure replace would overwrite content"):Pt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Rn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Wt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Wt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Wt)||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?he.empty:new he(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Wt(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?he.empty:new he(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Wt(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 Wt(n.from,n.to,he.fromJSON(e,n.slice),!!n.structure)}}cn.jsonID("replace",Wt);class Vt extends cn{constructor(e,n,r,i,s,l,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(e){if(this.structure&&(vp(e,this.from,this.gapFrom)||vp(e,this.gapTo,this.to)))return Pt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Pt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Pt.fromReplace(e,this.from,this.to,r):Pt.fail("Content does not fit in gap")}getMap(){return new Rn([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 Vt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Vt(n.pos,r.pos,i,s,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 Vt(n.from,n.to,n.gapFrom,n.gapTo,he.fromJSON(e,n.slice),n.insert,!!n.structure)}}cn.jsonID("replaceAround",Vt);function vp(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function zS(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(u,f,p)=>{if(!u.isInline)return;let h=u.marks;if(!r.isInSet(h)&&p.type.allowsMarkType(r.type)){let g=Math.max(f,e),y=Math.min(f+u.nodeSize,n),k=r.addToSet(h);for(let w=0;w<h.length;w++)h[w].isInSet(k)||(l&&l.to==g&&l.mark.eq(h[w])?l.to=y:i.push(l=new sr(g,y,h[w])));c&&c.to==g?c.to=y:s.push(c=new Ci(g,y,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function FS(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let u=null;if(r instanceof Mu){let f=l.marks,p;for(;p=r.isInSet(f);)(u||(u=[])).push(p),f=p.removeFromSet(f)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let f=Math.min(c+l.nodeSize,n);for(let p=0;p<u.length;p++){let h=u[p],g;for(let y=0;y<i.length;y++){let k=i[y];k.step==s-1&&h.eq(i[y].style)&&(g=k)}g?(g.to=f,g.step=s):i.push({style:h,from:Math.max(c,e),to:f,step:s})}}}),i.forEach(l=>t.step(new sr(l.from,l.to,l.style)))}function nh(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),p=c+f.nodeSize,h=r.matchType(f.type);if(!h)l.push(new Wt(c,p,he.empty));else{r=h;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new sr(c,p,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,y=/\r?\n|\r/g,k;for(;g=y.exec(f.text);)k||(k=new he(J.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new Wt(c+g.index,c+g.index+g[0].length,k))}}c=p}if(!r.validEnd){let u=r.fillBefore(J.empty,!0);t.replace(c,c,new he(u,0,0))}for(let u=l.length-1;u>=0;u--)t.step(l[u])}function $S(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vo(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,u,n))return r;if(r==0||l.type.spec.isolating||!$S(l,c,u))break;c&&(i=1),u<l.childCount&&(s=1)}return null}function US(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),u=l,f=c,p=J.empty,h=0;for(let k=s,w=!1;k>n;k--)w||r.index(k)>0?(w=!0,p=J.from(r.node(k).copy(p)),h++):u--;let g=J.empty,y=0;for(let k=s,w=!1;k>n;k--)w||i.after(k+1)<i.end(k)?(w=!0,g=J.from(i.node(k).copy(g)),y++):f++;t.step(new Vt(u,f,l,c,new he(p.append(g),h,y),p.size-h,!0))}function rh(t,e,n=null,r=t){let i=HS(t,e),s=i&&WS(r,e);return s?i.map(Iy).concat({type:e,attrs:n}).concat(s.map(Iy)):null}function Iy(t){return{type:t,attrs:null}}function HS(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return n.canReplaceWith(r,i,l)?s:null}function WS(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let u=(l.length?l[l.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:l}function VS(t,e,n){let r=J.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=J.from(n[l].type.create(n[l].attrs,r))}let i=e.start,s=e.end;t.step(new Vt(i,s,i,s,new he(r,0,0),n.length,!0))}function KS(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(l,c)=>{let u=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,u)&&qS(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",k=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!k?f=!1:!y&&k&&(f=!0)}f===!1&&yv(t,l,c,s),nh(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let p=t.mapping.slice(s),h=p.map(c,1),g=p.map(c+l.nodeSize,1);return t.step(new Vt(h,g,h+1,g-1,new he(J.from(r.create(u,null,l.marks)),0,0),1,!0)),f===!0&&gv(t,l,c,s),!1}})}function gv(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function yv(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(n+1+s);t.replaceWith(l,l+1,e.type.schema.text(`
52
+ `))}})}function qS(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function GS(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Vt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new he(J.from(l),0,0),1,!0))}function qr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,p=n-2;f>s;f--,p--){let h=i.node(f),g=i.index(f);if(h.type.spec.isolating)return!1;let y=h.content.cutByIndex(g,h.childCount),k=r&&r[p+1];k&&(y=y.replaceChild(0,k.type.create(k.attrs)));let w=r&&r[p]||h;if(!h.canReplace(g+1,h.childCount)||!w.type.validContent(y))return!1}let c=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(c,c,u?u.type:i.node(s+1).type)}function YS(t,e,n=1,r){let i=t.doc.resolve(e),s=J.empty,l=J.empty;for(let c=i.depth,u=i.depth-n,f=n-1;c>u;c--,f--){s=J.from(i.node(c).copy(s));let p=r&&r[f];l=J.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}t.step(new Wt(e,e,new he(s.append(l),n,n),!0))}function Pi(t,e){let n=t.resolve(e),r=n.index();return bv(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function JS(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),l=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(l),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function bv(t,e){return!!(t&&e&&!t.isLeaf&&JS(t,e))}function Au(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,l,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,l=r.nodeAfter):n>0?(s=r.node(i+1),c++,l=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),l=r.node(i+1)),s&&!s.isTextblock&&bv(s,l)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function QS(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),l=s.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",h=!!l.contentMatch.matchType(i);p&&!h?r=!1:!p&&h&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);yv(t,p.node(),p.before(),c)}l.inlineContent&&nh(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),f=u.map(e-n);if(t.step(new Wt(f,u.map(e+n,-1),he.empty,!0)),r===!0){let p=t.doc.resolve(f);gv(t,p.node(),p.before(),t.steps.length)}return t}function XS(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function vv(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,u=r.index(l)+(c>0?1:0),f=r.node(l),p=!1;if(s==1)p=f.canReplace(u,u,i);else{let h=f.contentMatchAt(u).findWrapping(i.firstChild.type);p=h&&f.canReplaceWith(u,u,h[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function Ou(t,e,n=e,r=he.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return kv(i,s,r)?new Wt(e,n,r):new ZS(i,s,r).fit()}function kv(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class ZS{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=J.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=J.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let u=new he(s,l,c);return e>-1?new Vt(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Wt(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=jf(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:f}=this.frontier[c],p,h=null;if(n==1&&(l?f.matchType(l.type)||(h=f.fillBefore(J.from(l),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:h};if(n==2&&l&&(p=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=jf(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new he(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=jf(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new he(dl(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new he(dl(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let w=0;w<s.length;w++)this.openFrontierNode(s[w]);let l=this.unplaced,c=r?r.content:l.content,u=l.openStart-e,f=0,p=[],{match:h,type:g}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)p.push(i.child(w));h=h.matchFragment(i)}let y=c.size+e-(l.content.size-l.openEnd);for(;f<c.childCount;){let w=c.child(f),x=h.matchType(w.type);if(!x)break;f++,(f>1||u==0||w.content.size)&&(h=x,p.push(Ev(w.mark(g.allowedMarks(w.marks)),f==1?u:0,f==c.childCount?y:-1)))}let k=f==c.childCount;k||(y=-1),this.placed=fl(this.placed,n,J.from(p)),this.frontier[n].match=h,k&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,x=c;w<y;w++){let C=x.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),x=C.content}this.unplaced=k?e==0?he.empty:new he(dl(l.content,e-1,1),e-1,y<0?l.openEnd:e-1):new he(dl(l.content,e,f),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!zf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),l=zf(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],p=zf(e,c,f,u,!0);if(!p||p.childCount)continue e}return{depth:n,fit:l,move:s?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=fl(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=fl(this.placed,this.depth,J.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(J.empty,!0);n.childCount&&(this.placed=fl(this.placed,this.frontier.length,n))}}function dl(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(dl(t.firstChild.content,e-1,n)))}function fl(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(fl(t.lastChild.content,e-1,n)))}function jf(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ev(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ev(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(J.empty,!0)))),t.copy(r)}function zf(t,e,n,r,i){let s=t.node(e),l=i?t.indexAfter(e):t.index(e);if(l==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!e1(n,s.content,l)?c:null}function e1(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function t1(t){return t.spec.defining||t.spec.definingForContent}function n1(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(kv(i,s,r))return t.step(new Wt(e,n,r));let l=xv(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let g=i.depth,y=i.pos-1;g>0;g--,y--){let k=i.node(g).type.spec;if(k.defining||k.definingAsContext||k.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==y&&l.splice(1,0,-g)}let u=l.indexOf(c),f=[],p=r.openStart;for(let g=r.content,y=0;;y++){let k=g.firstChild;if(f.push(k),y==r.openStart)break;g=k.content}for(let g=p-1;g>=0;g--){let y=f[g],k=t1(y.type);if(k&&!y.sameMarkup(i.node(Math.abs(c)-1)))p=g;else if(k||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+p+1)%(r.openStart+1),k=f[y];if(k)for(let w=0;w<l.length;w++){let x=l[(w+u)%l.length],C=!0;x<0&&(C=!1,x=-x);let N=i.node(x-1),I=i.index(x-1);if(N.canReplaceWith(I,I,k.type,k.marks))return t.replace(i.before(x),C?s.after(x):n,new he(wv(r.content,0,r.openStart,y),y,r.openEnd))}}let h=t.steps.length;for(let g=l.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>h));g--){let y=l[g];y<0||(e=i.before(y),n=s.after(y))}}function wv(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(wv(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),l=s.fillBefore(t).append(t);t=l.append(s.matchFragment(l).fillBefore(J.empty,!0))}return t}function r1(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=XS(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new he(J.from(r),0,0))}function i1(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=xv(r,i);for(let l=0;l<s.length;l++){let c=s[l],u=l==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function xv(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class uo extends cn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Pt.fromReplace(e,this.pos,this.pos+1,new he(J.from(i),0,n.isLeaf?0:1))}getMap(){return Rn.empty}invert(e){return new uo(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 uo(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 uo(n.pos,n.attr,n.value)}}cn.jsonID("attr",uo);class Al extends cn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Pt.ok(r)}getMap(){return Rn.empty}invert(e){return new Al(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 Al(n.attr,n.value)}}cn.jsonID("docAttr",Al);let po=class extends Error{};po=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};po.prototype=Object.create(Error.prototype);po.prototype.constructor=po;po.prototype.name="TransformError";class ih{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ml}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new po(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,l,c,u)=>{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=he.empty){let i=Ou(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new he(J.from(r),0,0))}delete(e,n){return this.replace(e,n,he.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return n1(this,e,n,r),this}replaceRangeWith(e,n,r){return r1(this,e,n,r),this}deleteRange(e,n){return i1(this,e,n),this}lift(e,n){return US(this,e,n),this}join(e,n=1){return QS(this,e,n),this}wrap(e,n){return VS(this,e,n),this}setBlockType(e,n=e,r,i=null){return KS(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return GS(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new uo(e,n,r)),this}setDocAttribute(e,n){return this.step(new Al(e,n)),this}addNodeMark(e,n){return this.step(new Ni(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ot)n.isInSet(r.marks)&&this.step(new Es(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new Es(e,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(e,n=1,r){return YS(this,e,n,r),this}addMark(e,n,r){return zS(this,e,n,r),this}removeMark(e,n,r){return FS(this,e,n,r),this}clearIncompatible(e,n,r){return nh(this,e,n,r),this}}const Ff=Object.create(null);class Le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Sv(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=he.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:u,$to:f}=l[c],p=e.mapping.slice(s);e.replaceRange(p.map(u.pos),p.map(f.pos),c?he.empty:n),c==0&&Py(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:c}=i[s],u=e.mapping.slice(r),f=u.map(l.pos),p=u.map(c.pos);s?e.deleteRange(f,p):(e.replaceRangeWith(f,p,n),Py(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Ae(e):io(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let l=n<0?io(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):io(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ln(e.node(0))}static atStart(e){return io(e,e,0,0,1)||new Ln(e)}static atEnd(e){return io(e,e,e.content.size,e.childCount,-1)||new Ln(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ff[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ff)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ff[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ae.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class Sv{constructor(e,n){this.$from=e,this.$to=n}}let Ly=!1;function Dy(t){!Ly&&!t.parent.inlineContent&&(Ly=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ae extends Le{constructor(e,n=e){Dy(e),Dy(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Le.near(r);let i=e.resolve(n.map(this.anchor));return new Ae(i.parent.inlineContent?i:r,r)}replace(e,n=he.empty){if(super.replace(e,n),n==he.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ru(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 Ae(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Le.findFrom(n,r,!0)||Le.findFrom(n,-r,!0);if(s)n=s.$head;else return Le.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Le.findFrom(e,-r,!0)||Le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Ae(e,n)}}Le.jsonID("text",Ae);class Ru{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ru(e.map(this.anchor),e.map(this.head))}resolve(e){return Ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Me extends Le{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Le.near(s):new Me(s)}content(){return new he(J.from(this.node),0,0)}eq(e){return e instanceof Me&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new sh(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Me(e.resolve(n.anchor))}static create(e,n){return new Me(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Me.prototype.visible=!1;Le.jsonID("node",Me);class sh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ru(r,r):new sh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Me.isSelectable(r)?new Me(n):Le.near(n)}}class Ln extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=he.empty){if(n==he.empty){e.delete(0,e.doc.content.size);let r=Le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ln(e)}map(e){return new Ln(e)}eq(e){return e instanceof Ln}getBookmark(){return s1}}Le.jsonID("all",Ln);const s1={map(){return this},resolve(t){return new Ln(t)}};function io(t,e,n,r,i,s=!1){if(e.inlineContent)return Ae.create(t,n);for(let l=r-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let c=e.child(l);if(c.isAtom){if(!s&&Me.isSelectable(c))return Me.create(t,n-(i<0?c.nodeSize:0))}else{let u=io(t,c,n+i,i<0?c.childCount:0,i,s);if(u)return u}n+=c.nodeSize*i}return null}function Py(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Wt||i instanceof Vt))return;let s=t.mapping.maps[r],l;s.forEach((c,u,f,p)=>{l==null&&(l=p)}),t.setSelection(Le.near(t.doc.resolve(l),n))}const By=1,rc=2,jy=4;class o1 extends ih{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|By)&~rc,this.storedMarks=null,this}get selectionSet(){return(this.updated&By)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=rc,this}ensureMarks(e){return ot.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&rc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~rc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ot.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(n);s=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Le.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|=jy,this}get scrolledIntoView(){return(this.updated&jy)>0}}function zy(t,e){return!e||!t?t:t.bind(e)}class pl{constructor(e,n,r){this.name=e,this.init=zy(n.init,r),this.apply=zy(n.apply,r)}}const l1=[new pl("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new pl("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new pl("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new pl("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class $f{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=l1.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new pl(r.key,r.spec.state,r))})}}class co{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let u=i?i[l].n:0,f=i?i[l].state:this,p=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,f,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let h=0;h<this.config.plugins.length;h++)i.push(h<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new co(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new o1(this)}static create(e){let n=new $f(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new co(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new $f(this.schema,e.plugins),r=n.fields,i=new co(n);for(let s=0;s<r.length;s++){let l=r[s].name;i[l]=this.hasOwnProperty(l)?this[l]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new $f(e.schema,e.plugins),s=new co(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=or.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=Le.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],f=u.spec.state;if(u.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=f.fromJSON.call(u,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function Cv(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Cv(i,e,{})),n[r]=i}return n}class it{constructor(e){this.spec=e,this.props={},e.props&&Cv(e.props,this,this.props),this.key=e.key?e.key.key:Nv("plugin")}getState(e){return e[this.key]}}const Uf=Object.create(null);function Nv(t){return t in Uf?t+"$"+ ++Uf[t]:(Uf[t]=0,t+"$")}class ut{constructor(e="key"){this.key=Nv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const oh=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function _v(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Tv=(t,e,n)=>{let r=_v(t,n);if(!r)return!1;let i=lh(r);if(!i){let l=r.blockRange(),c=l&&vo(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(Bv(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ho(s,"end")||Me.isSelectable(s)))for(let l=r.depth;;l--){let c=Ou(t.doc,r.before(l),r.after(l),he.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(ho(s,"end")?Le.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Me.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},a1=(t,e,n)=>{let r=_v(t,n);if(!r)return!1;let i=lh(r);return i?Mv(t,i,e):!1},c1=(t,e,n)=>{let r=Ov(t,n);if(!r)return!1;let i=ah(r);return i?Mv(t,i,e):!1};function Mv(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let l=e.nodeAfter,c=l,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let f=Ou(t.doc,s,u,he.empty);if(!f||f.from!=s||f instanceof Wt&&f.slice.size>=u-s)return!1;if(n){let p=t.tr.step(f);p.setSelection(Ae.create(p.doc,s)),n(p.scrollIntoView())}return!0}function ho(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Av=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=lh(r)}let l=s&&s.nodeBefore;return!l||!Me.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Me.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function lh(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 Ov(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Rv=(t,e,n)=>{let r=Ov(t,n);if(!r)return!1;let i=ah(r);if(!i)return!1;let s=i.nodeAfter;if(Bv(t,i,e,1))return!0;if(r.parent.content.size==0&&(ho(s,"start")||Me.isSelectable(s))){let l=Ou(t.doc,r.before(),r.after(),he.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(ho(s,"start")?Le.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Me.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Iv=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=ah(r)}let l=s&&s.nodeAfter;return!l||!Me.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Me.create(t.doc,s.pos)).scrollIntoView()),!0)};function ah(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 u1=(t,e)=>{let n=t.selection,r=n instanceof Me,i;if(r){if(n.node.isTextblock||!Pi(t.doc,n.from))return!1;i=n.from}else if(i=Au(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Me.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},d1=(t,e)=>{let n=t.selection,r;if(n instanceof Me){if(n.node.isTextblock||!Pi(t.doc,n.to))return!1;r=n.to}else if(r=Au(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},f1=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&vo(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Lv=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
53
+ `).scrollIntoView()),!0)};function ch(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 p1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),l=ch(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,l.createAndFill());u.setSelection(Le.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},Dv=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ln||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=ch(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=t.tr.insert(l,s.createAndFill());c.setSelection(Ae.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},Pv=(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 s=n.before();if(qr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&vo(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function h1(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Me&&e.selection.node.isBlock)return!r.parentOffset||!qr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,u=!1,f=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),f=r.start(y)==r.pos-(r.depth-y),c=ch(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),s.unshift(u&&c?{type:c}:null),l=y;break}else{if(y==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof Ae||e.selection instanceof Ln)&&p.deleteSelection();let h=p.mapping.map(r.pos),g=qr(p.doc,h,s.length,s);if(g||(s[0]=c?{type:c}:null,g=qr(p.doc,h,s.length,s)),!g)return!1;if(p.split(h,s.length,s),!u&&f&&r.node(l).type!=c){let y=p.mapping.map(r.before(l)),k=p.doc.resolve(y);c&&r.node(l-1).canReplaceWith(k.index(),k.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const m1=h1(),g1=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Me.create(t.doc,i))),!0)};function y1(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Pi(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Bv(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&y1(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let y=e.pos+s.nodeSize,k=J.empty;for(let C=l.length-1;C>=0;C--)k=J.from(l[C].create(null,k));k=J.from(i.copy(k));let w=t.tr.step(new Vt(e.pos-1,y,e.pos,y,new he(k,1,0),l.length,!0)),x=w.doc.resolve(y+2*l.length);x.nodeAfter&&x.nodeAfter.type==i.type&&Pi(w.doc,x.pos)&&w.join(x.pos),n(w.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&u?null:Le.findFrom(e,1),h=p&&p.$from.blockRange(p.$to),g=h&&vo(h);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(h,g).scrollIntoView()),!0;if(f&&ho(s,"start",!0)&&ho(i,"end")){let y=i,k=[];for(;k.push(y),!y.isTextblock;)y=y.lastChild;let w=s,x=1;for(;!w.isTextblock;w=w.firstChild)x++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let C=J.empty;for(let I=k.length-1;I>=0;I--)C=J.from(k[I].copy(C));let N=t.tr.step(new Vt(e.pos-k.length,e.pos+s.nodeSize,e.pos+x,e.pos+s.nodeSize-x,new he(C,k.length,0),0,!0));n(N.scrollIntoView())}return!0}}return!1}function jv(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(Ae.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const b1=jv(-1),v1=jv(1);function k1(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&rh(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function Fy(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let p=n.doc.resolve(f),h=p.index();i=p.parent.canReplaceWith(h,h+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:u}}=n.selection.ranges[l];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function uh(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}uh(oh,Tv,Av);uh(oh,Rv,Iv);uh(Lv,Dv,Pv,m1);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function E1(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s);if(!l)return!1;let c=r?n.tr:null;return w1(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function w1(t,e,n,r=null){let i=!1,s=e,l=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 u=l.resolve(e.start-2);s=new Pc(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Pc(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=rh(s,n,r,e);return c?(t&&x1(t,e,c,i,n),!0):!1}function x1(t,e,n,r,i){let s=J.empty;for(let p=n.length-1;p>=0;p--)s=J.from(n[p].type.create(n[p].attrs,s));t.step(new Vt(e.start-(r?2:0),e.end,e.start,e.end,new he(s,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==i&&(l=p+1);let c=n.length-l,u=e.start+n.length-(r?2:0),f=e.parent;for(let p=e.startIndex,h=e.endIndex,g=!0;p<h;p++,g=!1)!g&&qr(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=f.child(p).nodeSize;return t}function S1(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?C1(e,n,t,s):N1(e,n,s):!0:!1}}function C1(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new Vt(s-1,l,s,l,new he(J.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Pc(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=vo(r);if(c==null)return!1;i.lift(r,c);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Pi(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function N1(t,e,n){let r=t.tr,i=n.parent;for(let y=n.end,k=n.endIndex-1,w=n.startIndex;k>w;k--)y-=i.child(k).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==i.childCount,f=s.node(-1),p=s.index(-1);if(!f.canReplace(p+(c?0:1),p+1,l.content.append(u?J.empty:J.from(i))))return!1;let h=s.pos,g=h+l.nodeSize;return r.step(new Vt(h-(c?1:0),g+(u?1:0),h+1,g-1,new he((c?J.empty:J.from(i.copy(J.empty))).append(u?J.empty:J.from(i.copy(J.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function _1(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,u=c.child(l-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,p=J.from(f?t.create():null),h=new he(J.from(t.create(null,J.from(c.type.create(null,p)))),f?3:1,0),g=s.start,y=s.end;n(e.tr.step(new Vt(g-(f?3:1),y,g,y,h,1,!0)).scrollIntoView())}return!0}}const Xt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},mo=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let kp=null;const Vr=function(t,e,n){let r=kp||(kp=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},T1=function(){kp=null},ws=function(t,e,n,r){return n&&($y(t,e,n,r,-1)||$y(t,e,n,r,1))},M1=/^(img|br|input|textarea|hr)$/i;function $y(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:qn(t))){let l=t.parentNode;if(!l||l.nodeType!=1||Fl(t)||M1.test(t.nodeName)||t.contentEditable=="false")return!1;e=Xt(t)+(i<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=l,e=i<0?qn(t):0}else return!1}}function qn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function A1(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=qn(t)}else if(t.parentNode&&!Fl(t))e=Xt(t),t=t.parentNode;else return null}}function O1(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&&!Fl(t))e=Xt(t)+1,t=t.parentNode;else return null}}function R1(t,e,n){for(let r=e==0,i=e==qn(t);r||i;){if(t==n)return!0;let s=Xt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==qn(t)}}function Fl(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 Iu=function(t){return t.focusNode&&ws(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function us(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function I1(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function L1(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(qn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(qn(r.startContainer),r.startOffset)}}}const Sr=typeof navigator<"u"?navigator:null,Uy=typeof document<"u"?document:null,Bi=Sr&&Sr.userAgent||"",Ep=/Edge\/(\d+)/.exec(Bi),zv=/MSIE \d/.exec(Bi),wp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bi),_n=!!(zv||wp||Ep),Mi=zv?document.documentMode:wp?+wp[1]:Ep?+Ep[1]:0,Gn=!_n&&/gecko\/(\d+)/i.test(Bi);Gn&&+(/Firefox\/(\d+)/.exec(Bi)||[0,0])[1];const xp=!_n&&/Chrome\/(\d+)/.exec(Bi),en=!!xp,Fv=xp?+xp[1]:0,ln=!_n&&!!Sr&&/Apple Computer/.test(Sr.vendor),go=ln&&(/Mobile\/\w+/.test(Bi)||!!Sr&&Sr.maxTouchPoints>2),Vn=go||(Sr?/Mac/.test(Sr.platform):!1),$v=Sr?/Win/.test(Sr.platform):!1,Kr=/Android \d/.test(Bi),$l=!!Uy&&"webkitFontSmoothing"in Uy.documentElement.style,D1=$l?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function P1(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 Fr(t,e){return typeof t=="number"?t:t[e]}function B1(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Hy(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(l.nodeType!=1){l=mo(l);continue}let c=l,u=c==s.body,f=u?P1(s):B1(c),p=0,h=0;if(e.top<f.top+Fr(r,"top")?h=-(f.top-e.top+Fr(i,"top")):e.bottom>f.bottom-Fr(r,"bottom")&&(h=e.bottom-e.top>f.bottom-f.top?e.top+Fr(i,"top")-f.top:e.bottom-f.bottom+Fr(i,"bottom")),e.left<f.left+Fr(r,"left")?p=-(f.left-e.left+Fr(i,"left")):e.right>f.right-Fr(r,"right")&&(p=e.right-f.right+Fr(i,"right")),p||h)if(u)s.defaultView.scrollBy(p,h);else{let y=c.scrollLeft,k=c.scrollTop;h&&(c.scrollTop+=h),p&&(c.scrollLeft+=p);let w=c.scrollLeft-y,x=c.scrollTop-k;e={left:e.left-w,top:e.top-x,right:e.right-w,bottom:e.bottom-x}}let g=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:mo(l)}}function j1(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(s,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:Uv(t.dom)}}function Uv(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=mo(r));return e}function z1({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Hv(n,r==0?0:r-e)}function Hv(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let no=null;function F1(t){if(t.setActive)return t.setActive();if(no)return t.focus(no);let e=Uv(t);t.focus(no==null?{get preventScroll(){return no={preventScroll:!0},!0}}:void 0),no||(no=!1,Hv(e,0))}function Wv(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,u,f;for(let p=t.firstChild,h=0;p;p=p.nextSibling,h++){let g;if(p.nodeType==1)g=p.getClientRects();else if(p.nodeType==3)g=Vr(p).getClientRects();else continue;for(let y=0;y<g.length;y++){let k=g[y];if(k.top<=l&&k.bottom>=c){l=Math.max(k.bottom,l),c=Math.min(k.top,c);let w=k.left>e.left?k.left-e.left:k.right<e.left?e.left-k.right:0;if(w<r){n=p,r=w,i=w&&n.nodeType==3?{left:k.right<e.left?k.right:k.left,top:e.top}:e,p.nodeType==1&&w&&(s=h+(e.left>=(k.left+k.right)/2?1:0));continue}}else k.top>e.top&&!u&&k.left<=e.left&&k.right>=e.left&&(u=p,f={left:Math.max(k.left,Math.min(k.right,e.left)),top:k.top});!n&&(e.left>=k.right&&e.top>=k.top||e.left>=k.left&&e.top>=k.bottom)&&(s=h+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?$1(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:Wv(n,i)}function $1(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let l=bi(r,1);if(l.top!=l.bottom&&dh(e,l)){i={node:t,offset:s+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function dh(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function U1(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function H1(t,e,n){let{node:r,offset:i}=Wv(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function W1(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?i=c.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Vv(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let l=t.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let u=0;u<c.length;u++){let f=c[u];if(dh(e,f))return Vv(l,e,f)}}if((s=(s+1)%r)==i)break}return t}function V1(t,e){let n=t.dom.ownerDocument,r,i=0,s=L1(n,e.left,e.top);s&&({node:r,offset:i}=s);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let f=t.dom.getBoundingClientRect();if(!dh(e,f)||(l=Vv(t.dom,e,f),!l))return null}if(ln)for(let f=l;r&&f;f=mo(f))f.draggable&&(r=void 0);if(l=U1(l,e),r){if(Gn&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],h;p.nodeName=="IMG"&&(h=p.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}let f;$l&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=W1(t,r,i,e))}c==null&&(c=H1(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function Wy(t){return t.top<t.bottom||t.left<t.right}function bi(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Wy(r))return r}return Array.prototype.find.call(n,Wy)||t.getBoundingClientRect()}const K1=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Kv(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=$l||Gn;if(r.nodeType==3)if(l&&(K1.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=bi(Vr(r,i,i),n);if(Gn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=bi(Vr(r,i-1,i-1),-1);if(f.top==u.top){let p=bi(Vr(r,i,i+1),-1);if(p.top!=u.top)return ol(p,p.left<f.left)}}return u}else{let u=i,f=i,p=n<0?1:-1;return n<0&&!i?(f++,p=-1):n>=0&&i==r.nodeValue.length?(u--,p=1):n<0?u--:f++,ol(bi(Vr(r,u,f),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==qn(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Hf(u.getBoundingClientRect(),!1)}if(s==null&&i<qn(r)){let u=r.childNodes[i];if(u.nodeType==1)return Hf(u.getBoundingClientRect(),!0)}return Hf(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==qn(r))){let u=r.childNodes[i-1],f=u.nodeType==3?Vr(u,qn(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return ol(bi(f,1),!1)}if(s==null&&i<qn(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?Vr(u,0,l?0:1):u.nodeType==1?u:null:null;if(f)return ol(bi(f,-1),!0)}return ol(bi(r.nodeType==3?Vr(r):r,-n),n>=0)}function ol(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 Hf(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 qv(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function q1(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return qv(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=Kv(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Vr(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let p=u[f];if(p.bottom>p.top+1&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const G1=/[\u0590-\u08ac]/;function Y1(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=t.domSelection();return c?!G1.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:qv(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:p,anchorOffset:h}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:k,focusOffset:w}=t.domSelectionRange(),x=k&&!y.contains(k.nodeType==1?k:k.parentNode)||u==k&&f==w;try{c.collapse(p,h),u&&(u!=p||f!=h)&&c.extend&&c.extend(u,f)}catch{}return g!=null&&(c.caretBidiLevel=g),x}):r.pos==r.start()||r.pos==r.end()}let Vy=null,Ky=null,qy=!1;function J1(t,e,n){return Vy==e&&Ky==n?qy:(Vy=e,Ky=n,qy=n=="up"||n=="down"?q1(t,e,n):Y1(t,e,n))}const Yn=0,Gy=1,ds=2,Cr=3;class Ul{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Yn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,l;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Xt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!n||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let c=i.children[l];if(c.size){i=c;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let l=this.children[r],c=s+l.size;if(c>e||l instanceof Yv){i=e-s;break}s=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Gv&&s.side>=0;r--);if(n<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&n&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Xt(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Xt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=r,c=0;;c++){let u=this.children[c],f=l+u.size;if(i==-1&&e<=f){let p=l+u.border;if(e>=p&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,p);e=l;for(let h=c;h>0;h--){let g=this.children[h-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Xt(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let p=c+1;p<this.children.length;p++){let h=this.children[p];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){s=Xt(h.dom);break}n+=h.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=f}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),l=Math.max(e,n);for(let y=0,k=0;y<this.children.length;y++){let w=this.children[y],x=k+w.size;if(s>k&&l<x)return w.setSelection(e-k-w.border,n-k-w.border,r,i);k=x}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),p=r.domSelectionRange(),h=!1;if((Gn||ln)&&e==n){let{node:y,offset:k}=c;if(y.nodeType==3){if(h=!!(k&&y.nodeValue[k-1]==`
54
+ `),h&&k==y.nodeValue.length)for(let w=y,x;w;w=w.parentNode){if(x=w.nextSibling){x.nodeName=="BR"&&(c=u={node:x.parentNode,offset:Xt(x)+1});break}let C=w.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let w=y.childNodes[k-1];h=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(Gn&&p.focusNode&&p.focusNode!=u.node&&p.focusNode.nodeType==1){let y=p.focusNode.childNodes[p.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||h&&ln)&&ws(c.node,c.offset,p.anchorNode,p.anchorOffset)&&ws(u.node,u.offset,p.focusNode,p.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(h&&Gn)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let k=c;c=u,u=k}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],l=r+s.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let c=r+s.border,u=l-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==l?ds:Gy,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Cr:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ds:Cr}r=l}this.dirty=ds}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ds:Gy;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Gv extends Ul{constructor(e,n,r,i){let s,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Yn&&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 Q1 extends Ul{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}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 xs extends Ul{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],l=s&&s(n,i,r);return(!l||!l.dom)&&(l=_s.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new xs(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Cr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Cr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Yn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Yn}}slice(e,n,r){let i=xs.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=Cp(s,n,l,r)),e>0&&(s=Cp(s,0,e,r));for(let c=0;c<s.length;c++)s[c].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ai extends Ul{constructor(e,n,r,i,s,l,c,u,f){super(e,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,l){let c=s.nodeViews[n.type.name],u,f=c&&c(n,s,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,i),p=f&&f.dom,h=f&&f.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:h}=_s.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!h&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let g=p;return p=Xv(p,r,n),f?u=new X1(e,n,r,i,p,h||null,g,f,s,l+1):n.isText?new Lu(e,n,r,i,p,g,s):new Ai(e,n,r,i,p,h||null,g,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>J.empty)}return e}matchesNode(e,n,r){return this.dirty==Yn&&e.eq(this.node)&&jc(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,u=new eC(this,l&&l.node,e);rC(this.node,this.innerDeco,(f,p,h)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,p):f.type.side>=0&&!h&&u.syncToMarks(p==this.node.childCount?ot.none:this.node.child(p).marks,r,e,p),u.placeWidget(f,e,i)},(f,p,h,g)=>{u.syncToMarks(f.marks,r,e,g);let y;u.findNodeMatch(f,p,h,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(y=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,p,h,y,e)||u.updateNextNode(f,p,h,e,g,i)||u.addNode(f,p,h,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==ds)&&(l&&this.protectLocalComposition(e,l),Jv(this.contentDOM,this.children,e),go&&iC(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Ae)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,c=sC(this.node.content,l,r-n,i-n);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new Q1(this,s,n,i);e.input.compositionNodes.push(l),this.children=Cp(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Cr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Yn}updateOuterDeco(e){if(jc(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Qv(this.dom,this.nodeDOM,Sp(this.outerDeco,this.node,n),Sp(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Yy(t,e,n,r,i){Xv(r,e,t);let s=new Ai(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Lu extends Ai{constructor(e,n,r,i,s,l,c){super(e,n,r,i,s,null,l,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Cr||this.dirty!=Yn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Yn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Yn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Lu(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Cr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Yv extends Ul{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Yn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class X1 extends Ai{constructor(e,n,r,i,s,l,c,u,f,p){super(e,n,r,i,s,l,c,f,p),this.spec=u}update(e,n,r,i){if(this.dirty==Cr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 Jv(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let l=e[s],c=l.dom;if(c.parentNode==t){for(;c!=r;)r=Jy(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof xs){let u=r?r.previousSibling:t.lastChild;Jv(l.contentDOM,l.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Jy(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const bl=function(t){t&&(this.nodeName=t)};bl.prototype=Object.create(null);const fs=[new bl];function Sp(t,e,n){if(t.length==0)return fs;let r=n?fs[0]:new bl,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new bl(l.nodeName));for(let c in l){let u=l[c];u!=null&&(n&&i.length==1&&i.push(r=new bl(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return i}function Qv(t,e,n,r){if(n==fs&&r==fs)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let u;c&&c.nodeName==l.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==l.nodeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(i),c=fs[0]),i=u}Z1(i,c||fs[0],l)}return i}function Z1(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Xv(t,e,n){return Qv(t,t,fs,Sp(e,n,t.nodeType!=1))}function jc(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 Jy(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class eC{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=tC(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,l=this.stack.length>>1,c=Math.min(l,e.length);for(;s<c&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=Yn,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let p=this.index;p<f;p++){let h=this.top.children[p];if(h.matchesMark(e[l])&&!this.isLocked(h.dom)){u=p;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let p=xs.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let l=this.top.children[i];return l.dirty==Cr&&l.dom==l.contentDOM&&(l.dirty=ds),l.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof Ai){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let p=u.dom,h,g=this.isLocked(p)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Cr&&jc(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,c),u.dom!=p&&(this.changed=!0),this.index++,!0;if(!g&&(h=this.recreateWrapper(u,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=ds,h.updateChildren(i,l+1),h.dirty=Yn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,l){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!jc(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=Ai.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=Ai.create(this.top,e,n,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Gv(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof xs;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Lu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ln||en)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Yv(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function tC(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,l=[];e:for(;i>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof xs)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function nC(t,e){return t.type.side-e.type.side}function rC(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let p=t.child(f);r(p,i,e.forChild(s,p),f),s+=p.nodeSize}return}let l=0,c=[],u=null;for(let f=0;;){let p,h;for(;l<i.length&&i[l].to==s;){let x=i[l++];x.widget&&(p?(h||(h=[p])).push(x):p=x)}if(p)if(h){h.sort(nC);for(let x=0;x<h.length;x++)n(h[x],f,!!u)}else n(p,f,!!u);let g,y;if(u)y=-1,g=u,u=null;else if(f<t.childCount)y=f,g=t.child(f++);else break;for(let x=0;x<c.length;x++)c[x].to<=s&&c.splice(x--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let k=s+g.nodeSize;if(g.isText){let x=k;l<i.length&&i[l].from<x&&(x=i[l].from);for(let C=0;C<c.length;C++)c[C].to<x&&(x=c[C].to);x<k&&(u=g.cut(x-s),g=g.cut(0,x-s),k=x,y=-1)}else for(;l<i.length&&i[l].to<k;)l++;let w=g.isInline&&!g.isLeaf?c.filter(x=>!x.inline):c.slice();r(g,w,e.forChild(s,g),y),s=k}}function iC(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 sC(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let l=t.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let u=l.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?u.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Cp(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let u=t[l],f=c,p=c+=u.size;f>=n||p<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),p>n&&s.push(u.slice(n-f,u.size,r)))}return s}function fh(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),u,f;if(Iu(n)){for(u=l;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&Me.isSelectable(h)&&i.parent&&!(h.isInline&&R1(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Me(l==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let h=l,g=l;for(let y=0;y<n.rangeCount;y++){let k=n.getRangeAt(y);h=Math.min(h,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(h<0)return null;[u,l]=g==t.state.selection.anchor?[g,h]:[h,g],c=r.resolve(l)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let p=r.resolve(u);if(!f){let h=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;f=ph(t,p,c,h)}return f}function Zv(t){return t.editable?t.hasFocus():tk(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Gr(t,e=!1){let n=t.state.selection;if(ek(t,n),!!Zv(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&en){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ws(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)lC(t);else{let{anchor:r,head:i}=n,s,l;Qy&&!(n instanceof Ae)&&(n.$from.parent.inlineContent||(s=Xy(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=Xy(t,n.to))),t.docView.setSelection(r,i,t,e),Qy&&(s&&Zy(s),l&&Zy(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&oC(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Qy=ln||en&&Fv<63;function Xy(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(ln&&i&&i.contentEditable=="false")return Wf(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Wf(i);if(s)return Wf(s)}}function Wf(t){return t.contentEditable="true",ln&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Zy(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function oC(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Zv(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function lC(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Xt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_n&&Mi<=11&&(n.disabled=!0,n.disabled=!1)}function ek(t,e){if(e instanceof Me){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(eb(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else eb(t)}function eb(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ph(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ae.between(e,n,r)}function tb(t){return t.editable&&!t.hasFocus()?!1:tk(t)}function tk(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 aC(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ws(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Np(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Le.findFrom(s,e)}function vi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function nb(t,e,n){let r=t.state.selection;if(r instanceof Ae)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return vi(t,new Ae(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Np(t.state,e);return i&&i instanceof Me?vi(t,i):!1}else if(!(Vn&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,l;if(!s||s.isText)return!1;let c=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(l=t.docView.descAt(c))&&!l.contentDOM?Me.isSelectable(s)?vi(t,new Me(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):$l?vi(t,new Ae(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Me&&r.node.isInline)return vi(t,new Ae(e>0?r.$to:r.$from));{let i=Np(t.state,e);return i?vi(t,i):!1}}}function zc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vl(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ro(t,e){return e<0?cC(t):uC(t)}function cC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,l=!1;for(Gn&&n.nodeType==1&&r<zc(n)&&vl(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(vl(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(nk(n))break;{let c=n.previousSibling;for(;c&&vl(c,-1);)i=n.parentNode,s=Xt(c),c=c.previousSibling;if(c)n=c,r=zc(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?_p(t,n,r):i&&_p(t,i,s)}function uC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=zc(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(vl(c,1))s=n,l=++r;else break}else{if(nk(n))break;{let c=n.nextSibling;for(;c&&vl(c,1);)s=c.parentNode,l=Xt(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=zc(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&_p(t,s,l)}function nk(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function dC(t,e){for(;t&&e==t.childNodes.length&&!Fl(t);)e=Xt(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 fC(t,e){for(;t&&!e&&!Fl(t);)e=Xt(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 _p(t,e,n){if(e.nodeType!=3){let s,l;(l=dC(e,n))?(e=l,n=0):(s=fC(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Iu(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Gr(t)},50)}function rb(t,e){let n=t.state.doc.resolve(e);if(!(en||$v)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function ib(t,e,n){let r=t.state.selection;if(r instanceof Ae&&!r.empty||n.indexOf("s")>-1||Vn&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Np(t.state,e);if(l&&l instanceof Me)return vi(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof Ln?Le.near(l,e):Le.findFrom(l,e);return c?vi(t,c):!1}return!1}function sb(t,e){if(!(t.state.selection instanceof Ae))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let l=t.state.tr;return e<0?l.delete(n.pos-s.nodeSize,n.pos):l.delete(n.pos,n.pos+s.nodeSize),t.dispatch(l),!0}return!1}function ob(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function pC(t){if(!ln||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ob(t,r,"true"),setTimeout(()=>ob(t,r,"false"),20)}return!1}function hC(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function mC(t,e){let n=e.keyCode,r=hC(e);if(n==8||Vn&&n==72&&r=="c")return sb(t,-1)||ro(t,-1);if(n==46&&!e.shiftKey||Vn&&n==68&&r=="c")return sb(t,1)||ro(t,1);if(n==13||n==27)return!0;if(n==37||Vn&&n==66&&r=="c"){let i=n==37?rb(t,t.state.selection.from)=="ltr"?-1:1:-1;return nb(t,i,r)||ro(t,i)}else if(n==39||Vn&&n==70&&r=="c"){let i=n==39?rb(t,t.state.selection.from)=="ltr"?1:-1:1;return nb(t,i,r)||ro(t,i)}else{if(n==38||Vn&&n==80&&r=="c")return ib(t,-1,r)||ro(t,-1);if(n==40||Vn&&n==78&&r=="c")return pC(t)||ib(t,1,r)||ro(t,1);if(r==(Vn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function hh(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let l=t.someProp("clipboardSerializer")||_s.fromSchema(t.state.schema),c=ak(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));let f=u.firstChild,p,h=0;for(;f&&f.nodeType==1&&(p=lk[f.nodeName.toLowerCase()]);){for(let y=p.length-1;y>=0;y--){let k=c.createElement(p[y]);for(;u.firstChild;)k.appendChild(u.firstChild);u.appendChild(k),h++}f=u.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
55
+
56
+ `);return{dom:u,text:g,slice:e}}function rk(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new he(J.from(t.state.schema.text(e.replace(/\r\n?/g,`
57
+ `))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let h=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(h)c=h;else{let g=i.marks(),{schema:y}=t.state,k=_s.fromSchema(y);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let x=l.appendChild(document.createElement("p"));w&&x.appendChild(k.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),l=vC(n),$l&&kC(l);let f=l&&l.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let h=+p[3];h>0;h--){let g=l.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;l=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Ti.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||p),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!gC.test(g.parentNode.nodeName)?{ignore:!0}:null}})),p)c=EC(lb(c,+p[1],+p[2]),p[4]);else if(c=he.maxOpen(yC(c.content,i),!0),c.openStart||c.openEnd){let h=0,g=0;for(let y=c.content.firstChild;h<c.openStart&&!y.type.spec.isolating;h++,y=y.firstChild);for(let y=c.content.lastChild;g<c.openEnd&&!y.type.spec.isolating;g++,y=y.lastChild);c=lb(c,h,g)}return t.someProp("transformPasted",h=>{c=h(c,t,u)}),c}const gC=/^(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 yC(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,l=[];if(t.forEach(c=>{if(!l)return;let u=i.findWrapping(c.type),f;if(!u)return l=null;if(f=l.length&&s.length&&sk(u,s,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=ok(l[l.length-1],s.length));let p=ik(c,u);l.push(p),i=i.matchType(p.type),s=u}}),l)return J.from(l)}return t}function ik(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,J.from(t));return t}function sk(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=sk(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(J.from(ik(n,t,i+1))))}}function ok(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ok(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(J.empty,!0);return t.copy(n.append(r))}function Tp(t,e,n,r,i,s){let l=e<0?t.firstChild:t.lastChild,c=l.content;return t.childCount>1&&(s=0),i<r-1&&(c=Tp(c,e,n,r,i+1,s)),i>=n&&(c=e<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(J.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function lb(t,e,n){return e<t.openStart&&(t=new he(Tp(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new he(Tp(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const lk={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 ab=null;function ak(){return ab||(ab=document.implementation.createHTMLDocument("title"))}let Vf=null;function bC(t){let e=window.trustedTypes;return e?(Vf||(Vf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Vf.createHTML(t)):t}function vC(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=ak().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&lk[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=bC(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function kC(t){let e=t.querySelectorAll(en?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function EC(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:l}=t;for(let c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=J.from(u.create(r[c+1],i)),s++,l++}return new he(i,s,l)}const gn={},yn={},wC={touchstart:!0,touchmove:!0};class xC{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 SC(t){for(let e in gn){let n=gn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{NC(t,r)&&!mh(t,r)&&(t.editable||!(r.type in yn))&&n(t,r)},wC[e]?{passive:!0}:void 0)}ln&&t.dom.addEventListener("input",()=>null),Mp(t)}function _i(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function CC(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 Mp(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>mh(t,r))})}function mh(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function NC(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 _C(t,e){!mh(t,e)&&gn[e.type]&&(t.editable||!(e.type in yn))&&gn[e.type](t,e)}yn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!uk(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Kr&&en&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),go&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,us(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||mC(t,n)?n.preventDefault():_i(t,"key")};yn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};yn.keypress=(t,e)=>{let n=e;if(uk(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vn&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",l=>l(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Du(t){return{left:t.clientX,top:t.clientY}}function TC(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function gh(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(t.someProp(e,c=>l>s.depth?c(t,n,s.nodeAfter,s.before(l),i,!0):c(t,n,s.node(l),s.before(l),i,!1)))return!0;return!1}function fo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function MC(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Me.isSelectable(r)?(fo(t,new Me(n)),!0):!1}function AC(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Me&&(r=n.node);let s=t.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(Me.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(l);break}}return i!=null?(fo(t,Me.create(t.state.doc,i)),!0):!1}function OC(t,e,n,r,i){return gh(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?AC(t,n):MC(t,n))}function RC(t,e,n,r){return gh(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function IC(t,e,n,r){return gh(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||LC(t,n,r)}function LC(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(fo(t,Ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(l.inlineContent)fo(t,Ae.create(r,c+1,c+1+l.content.size));else if(Me.isSelectable(l))fo(t,Me.create(r,c));else continue;return!0}}function yh(t){return Fc(t)}const ck=Vn?"metaKey":"ctrlKey";gn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=yh(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&TC(n,t.input.lastClick)&&!n[ck]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let l=t.posAtCoords(Du(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new DC(t,l,n,!!r)):(s=="doubleClick"?RC:IC)(t,l.pos,l.inside,n)?n.preventDefault():_i(t,"pointer"))};class DC{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[ck],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let p=e.state.doc.resolve(n.pos);s=p.parent,l=p.depth?p.before():0}const c=i?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Me&&f.from<=l&&f.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Gn&&!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)),_i(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(()=>Gr(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(Du(e))),this.updateAllowDefault(e),this.allowDefault||!n?_i(this.view,"pointer"):OC(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ln&&this.mightDrag&&!this.mightDrag.node.isAtom||en&&!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)?(fo(this.view,Le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):_i(this.view,"pointer")}move(e){this.updateAllowDefault(e),_i(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)}}gn.touchstart=t=>{t.input.lastTouch=Date.now(),yh(t),_i(t,"pointer")};gn.touchmove=t=>{t.input.lastTouch=Date.now(),_i(t,"pointer")};gn.contextmenu=t=>yh(t);function uk(t,e){return t.composing?!0:ln&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const PC=Kr?5e3:-1;yn.compositionstart=yn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||en&&$v&&BC(t)))t.markCursor=t.state.storedMarks||n.marks(),Fc(t,!0),t.markCursor=null;else if(Fc(t,!e.selection.empty),Gn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let l=s<0?i.lastChild:i.childNodes[s-1];if(!l)break;if(l.nodeType==3){let c=t.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}t.input.composing=!0}dk(t,PC)};function BC(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}yn.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++,dk(t,20))};function dk(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Fc(t),e))}function fk(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=zC());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function jC(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=A1(e.focusNode,e.focusOffset),r=O1(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function zC(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Fc(t,e=!1){if(!(Kr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),fk(t),e||t.docView&&t.docView.dirty){let n=fh(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function FC(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Ol=_n&&Mi<15||go&&D1<604;gn.copy=yn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Ol?null:n.clipboardData,l=r.content(),{dom:c,text:u}=hh(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):FC(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function $C(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function UC(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Rl(t,r.value,null,i,e):Rl(t,r.textContent,r.innerHTML,i,e)},50)}function Rl(t,e,n,r,i){let s=rk(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||he.empty)))return!0;if(!s)return!1;let l=$C(s),c=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pk(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," "):""}yn.paste=(t,e)=>{let n=e;if(t.composing&&!Kr)return;let r=Ol?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Rl(t,pk(r),r.getData("text/html"),i,n)?n.preventDefault():UC(t,n)};class hk{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const HC=Vn?"altKey":"ctrlKey";function mk(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[HC]}gn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Du(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Me?i.to-1:i.to))){if(r&&r.mightDrag)l=Me.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(l=Me.create(t.state.doc,h.posBefore))}}let c=(l||t.state.selection).content(),{dom:u,text:f,slice:p}=hh(t,c);(!n.dataTransfer.files.length||!en||Fv>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ol?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ol||n.dataTransfer.setData("text/plain",f),t.dragging=new hk(p,mk(t,n),l)};gn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};yn.dragover=yn.dragenter=(t,e)=>e.preventDefault();yn.drop=(t,e)=>{try{WC(t,e,t.dragging)}finally{t.dragging=null}};function WC(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Du(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",y=>{s=y(s,t,!1)}):s=rk(t,pk(e.dataTransfer),Ol?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&mk(t,e));if(t.someProp("handleDrop",y=>y(t,e,s||he.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?vv(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(l){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let f=u.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=u.doc;if(p?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(h))return;let g=u.doc.resolve(f);if(p&&Me.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Me(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((k,w,x,C)=>y=C),u.setSelection(ph(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}gn.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())&&Gr(t)},20))};gn.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)};gn.beforeinput=(t,e)=>{if(en&&Kr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,us(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in yn)gn[t]=yn[t];function Il(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 $c{constructor(e,n){this.toDOM=e,this.spec=n||ys,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:l}=e.mapResult(n.from+i,this.side<0?-1:1);return l?null:new yt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof $c&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Il(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Oi{constructor(e,n){this.attrs=e,this.spec=n||ys}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new yt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Oi&&Il(this.attrs,e.attrs)&&Il(this.spec,e.spec)}static is(e){return e.type instanceof Oi}destroy(){}}class bh{constructor(e,n){this.attrs=e,this.spec=n||ys}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let l=e.mapResult(n.to+i,-1);return l.deleted||l.pos<=s.pos?null:new yt(s.pos-r,l.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof bh&&Il(this.attrs,e.attrs)&&Il(this.spec,e.spec)}destroy(){}}class yt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new yt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new yt(e,e,new $c(n,r))}static inline(e,n,r,i){return new yt(e,n,new Oi(r,i))}static node(e,n,r,i){return new yt(e,n,new bh(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Oi}get widget(){return this.type instanceof $c}}const so=[],ys={};class rt{constructor(e,n){this.local=e.length?e:so,this.children=n.length?n:so}static create(e,n){return n.length?Uc(n,e,0,ys):on}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let c=this.children[l]+1;this.children[l+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==on||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ys)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,i);u&&u.type.valid(n,u)?(l||(l=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?VC(this.children,l||[],e,n,r,i,s):l?new rt(l.sort(bs),so):on}add(e,n){return n.length?this==on?rt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,u)=>{let f=u+r,p;if(p=yk(n,c,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(c,p,f+1):i.splice(s,0,u,u+c.nodeSize,Uc(p,c,f+1,ys)),s+=3}});let l=gk(s?bk(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new rt(l.length?this.local.concat(l).sort(bs):this.local,i||this.children)}remove(e){return e.length==0||this==on?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,u=r[s+1]+n;for(let p=0,h;p<e.length;p++)(h=e[p])&&h.from>c&&h.to<u&&(e[p]=null,(l||(l=[])).push(h));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(l,c+1);f!=on?r[s+2]=f:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let c=0;c<i.length;c++)i[c].eq(l,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new rt(i,r):on}forChild(e,n){if(this==on)return this;if(n.isLeaf)return rt.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<l&&u.to>s&&u.type instanceof Oi){let f=Math.max(s,u.from)-s,p=Math.min(l,u.to)-s;f<p&&(i||(i=[])).push(u.copy(f,p))}}if(i){let c=new rt(i.sort(bs),so);return r?new wi([c,r]):c}return r||on}eq(e){if(this==e)return!0;if(!(e instanceof rt)||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 vh(this.localsInner(e))}localsInner(e){if(this==on)return so;if(e.inlineContent||!this.local.some(Oi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Oi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}rt.empty=new rt([],[]);rt.removeOverlap=vh;const on=rt.empty;class wi{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,ys));return wi.from(r)}forChild(e,n){if(n.isLeaf)return rt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=on&&(s instanceof wi?r=r.concat(s.members):r.push(s))}return wi.from(r)}eq(e){if(!(e instanceof wi)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let l=0;l<s.length;l++)n.push(s[l])}}return n?vh(r?n:n.sort(bs)):so}static from(e){switch(e.length){case 0:return on;case 1:return e[0];default:return new wi(e.every(n=>n instanceof rt)?e:e.reduce((n,r)=>n.concat(r instanceof rt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function VC(t,e,n,r,i,s,l){let c=t.slice();for(let f=0,p=s;f<n.maps.length;f++){let h=0;n.maps[f].forEach((g,y,k,w)=>{let x=w-k-(y-g);for(let C=0;C<c.length;C+=3){let N=c[C+1];if(N<0||g>N+p-h)continue;let I=c[C]+p-h;y>=I?c[C+1]=g<=I?-2:-1:g>=p&&x&&(c[C]+=x,c[C+1]+=x)}h+=x}),p=n.maps[f].map(p,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[f+1]=-1;continue}let p=n.map(t[f]+s),h=p-i;if(h<0||h>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),y=g-i,{index:k,offset:w}=r.content.findIndex(h),x=r.maybeChild(k);if(x&&w==h&&w+x.nodeSize==y){let C=c[f+2].mapInner(n,x,p+1,t[f]+s+1,l);C!=on?(c[f]=h,c[f+1]=y,c[f+2]=C):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=KC(c,t,e,n,i,s,l),p=Uc(f,r,0,l);e=p.local;for(let h=0;h<c.length;h+=3)c[h+1]<0&&(c.splice(h,3),h-=3);for(let h=0,g=0;h<p.children.length;h+=3){let y=p.children[h];for(;g<c.length&&c[g]<y;)g+=3;c.splice(g,0,p.children[h],p.children[h+1],p.children[h+2])}}return new rt(e.sort(bs),c)}function gk(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new yt(i.from+e,i.to+e,i.type))}return n}function KC(t,e,n,r,i,s,l){function c(u,f){for(let p=0;p<u.local.length;p++){let h=u.local[p].map(r,i,f);h?n.push(h):l.onRemove&&l.onRemove(u.local[p].spec)}for(let p=0;p<u.children.length;p+=3)c(u.children[p+2],u.children[p]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function yk(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,l;s<t.length;s++)(l=t[s])&&l.from>n&&l.to<r&&((i||(i=[])).push(l),t[s]=null);return i}function bk(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Uc(t,e,n,r){let i=[],s=!1;e.forEach((c,u)=>{let f=yk(t,c,u+n);if(f){s=!0;let p=Uc(f,c,n+u+1,r);p!=on&&i.push(u,u+c.nodeSize,p)}});let l=gk(s?bk(t):t,-n).sort(bs);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||i.length?new rt(l,i):on}function bs(t,e){return t.from-e.from||t.to-e.to}function vh(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),cb(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),cb(e,i,r.copy(s.from,r.to)));break}}}return e}function cb(t,e,n){for(;e<t.length&&bs(n,t[e])>0;)e++;t.splice(e,0,n)}function Kf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=on&&e.push(r)}),t.cursorWrapper&&e.push(rt.create(t.state.doc,[t.cursorWrapper.deco])),wi.from(e)}const qC={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},GC=_n&&Mi<=11;class YC{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 JC{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new YC,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);_n&&Mi<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ln&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),GC&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,qC)),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(tb(this.view)){if(this.suppressingSelectionUpdates)return Gr(this.view);if(_n&&Mi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ws(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=mo(s))n.add(s);for(let s=e.anchorNode;s;s=mo(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&tb(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,u=[];if(e.editable)for(let p=0;p<n.length;p++){let h=this.registerMutation(n[p],u);h&&(s=s<0?h.from:Math.min(h.from,s),l=l<0?h.to:Math.max(h.to,l),h.typeOver&&(c=!0))}if(u.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of u)if(p.nodeName=="BR"&&p.parentNode){let h=p.nextSibling;h&&h.nodeType==1&&h.contentEditable=="false"&&p.parentNode.removeChild(p)}}else if(Gn&&u.length){let p=u.filter(h=>h.nodeName=="BR");if(p.length==2){let[h,g]=p;h.parentNode&&h.parentNode.parentNode==g.parentNode?g.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let g of p){let y=g.parentNode;y&&y.nodeName=="LI"&&(!h||ZC(e,h)!=y)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Iu(r)&&(f=fh(e))&&f.eq(Le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Gr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),QC(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,eN(e,u)),this.handleDOMChange(s,l,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Gr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let h=e.addedNodes[p];n.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(_n&&Mi<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:h,nextSibling:g}=e.addedNodes[p];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let l=i&&i.parentNode==e.target?Xt(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),u=s&&s.parentNode==e.target?Xt(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:c,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ub=new WeakMap,db=!1;function QC(t){if(!ub.has(t)&&(ub.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Gn,db)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."),db=!0}}function fb(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ws(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function XC(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return fb(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?fb(t,n):null}function ZC(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function eN(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function tN(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),u=t.domSelectionRange(),f,p=u.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(f=[{node:p,offset:u.anchorOffset}],Iu(u)||f.push({node:u.focusNode,offset:u.focusOffset})),en&&t.input.lastKeyCode===8)for(let x=s;x>i;x--){let C=r.childNodes[x-1],N=C.pmViewDesc;if(C.nodeName=="BR"&&!N){s=x;break}if(!N||N.size)break}let h=t.state.doc,g=t.someProp("domParser")||Ti.fromSchema(t.state.schema),y=h.resolve(l),k=null,w=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:i,to:s,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:nN,context:y});if(f&&f[0].pos!=null){let x=f[0].pos,C=f[1]&&f[1].pos;C==null&&(C=x),k={anchor:x+l,head:C+l}}return{doc:w,sel:k,from:l,to:c}}function nN(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ln&&/^(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||ln&&/^(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 rN=/^(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 iN(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let $=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,te=fh(t,$);if(te&&!t.state.selection.eq(te)){if(en&&Kr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ee=>ee(t,us(13,"Enter"))))return;let le=t.state.tr.setSelection(te);$=="pointer"?le.setMeta("pointer",!0):$=="key"&&le.scrollIntoView(),s&&le.setMeta("composition",s),t.dispatch(le)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,f=tN(t,e,n),p=t.state.doc,h=p.slice(f.from,f.to),g,y;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,y="end"):(g=t.state.selection.from,y="start"),t.input.lastKeyCode=null;let k=lN(h.content,f.doc.content,f.from,g,y);if(k&&t.input.domChangeCount++,(go&&t.input.lastIOSEnter>Date.now()-225||Kr)&&i.some($=>$.nodeType==1&&!rN.test($.nodeName))&&(!k||k.endA>=k.endB)&&t.someProp("handleKeyDown",$=>$(t,us(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!k)if(r&&u instanceof Ae&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))k={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let $=pb(t,t.state.doc,f.sel);if($&&!$.eq(t.state.selection)){let te=t.state.tr.setSelection($);s&&te.setMeta("composition",s),t.dispatch(te)}}return}t.state.selection.from<t.state.selection.to&&k.start==k.endB&&t.state.selection instanceof Ae&&(k.start>t.state.selection.from&&k.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?k.start=t.state.selection.from:k.endA<t.state.selection.to&&k.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(k.endB+=t.state.selection.to-k.endA,k.endA=t.state.selection.to)),_n&&Mi<=11&&k.endB==k.start+1&&k.endA==k.start&&k.start>f.from&&f.doc.textBetween(k.start-f.from-1,k.start-f.from+1)=="  "&&(k.start--,k.endA--,k.endB--);let w=f.doc.resolveNoCache(k.start-f.from),x=f.doc.resolveNoCache(k.endB-f.from),C=p.resolve(k.start),N=w.sameParent(x)&&w.parent.inlineContent&&C.end()>=k.endA;if((go&&t.input.lastIOSEnter>Date.now()-225&&(!N||i.some($=>$.nodeName=="DIV"||$.nodeName=="P"))||!N&&w.pos<f.doc.content.size&&(!w.sameParent(x)||!w.parent.inlineContent)&&w.pos<x.pos&&!/\S/.test(f.doc.textBetween(w.pos,x.pos,"","")))&&t.someProp("handleKeyDown",$=>$(t,us(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>k.start&&oN(p,k.start,k.endA,w,x)&&t.someProp("handleKeyDown",$=>$(t,us(8,"Backspace")))){Kr&&en&&t.domObserver.suppressSelectionUpdates();return}en&&k.endB==k.start&&(t.input.lastChromeDelete=Date.now()),Kr&&!N&&w.start()!=x.start()&&x.parentOffset==0&&w.depth==x.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==k.endA&&(k.endB-=2,x=f.doc.resolveNoCache(k.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function($){return $(t,us(13,"Enter"))})},20));let I=k.start,P=k.endA,O=$=>{let te=$||t.state.tr.replace(I,P,f.doc.slice(k.start-f.from,k.endB-f.from));if(f.sel){let le=pb(t,te.doc,f.sel);le&&!(en&&t.composing&&le.empty&&(k.start!=k.endB||t.input.lastChromeDelete<Date.now()-100)&&(le.head==I||le.head==te.mapping.map(P)-1)||_n&&le.empty&&le.head==I)&&te.setSelection(le)}return s&&te.setMeta("composition",s),te.scrollIntoView()},R;if(N)if(w.pos==x.pos){_n&&Mi<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Gr(t),20));let $=O(t.state.tr.delete(I,P)),te=p.resolve(k.start).marksAcross(p.resolve(k.endA));te&&$.ensureMarks(te),t.dispatch($)}else if(k.endA==k.endB&&(R=sN(w.parent.content.cut(w.parentOffset,x.parentOffset),C.parent.content.cut(C.parentOffset,k.endA-C.start())))){let $=O(t.state.tr);R.type=="add"?$.addMark(I,P,R.mark):$.removeMark(I,P,R.mark),t.dispatch($)}else if(w.parent.child(w.index()).isText&&w.index()==x.index()-(x.textOffset?0:1)){let $=w.parent.textBetween(w.parentOffset,x.parentOffset),te=()=>O(t.state.tr.insertText($,I,P));t.someProp("handleTextInput",le=>le(t,I,P,$,te))||t.dispatch(te())}else t.dispatch(O());else t.dispatch(O())}function pb(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ph(t,e.resolve(n.anchor),e.resolve(n.head))}function sN(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,u;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",u=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",u=p=>p.mark(c.removeFromSet(p.marks));else return null;let f=[];for(let p=0;p<e.childCount;p++)f.push(u(e.child(p)));if(J.from(f).eq(t))return{mark:c,type:l}}function oN(t,e,n,r,i){if(n-e<=i.pos-r.pos||qf(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==e+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=t.resolve(qf(s,!0,!0));return!l.parent.isTextblock||l.pos>n||qf(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function qf(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function lN(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,s-Math.min(l,c));r-=l+u-s}if(l<s&&t.size<e.size){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<e.size&&hb(e.textBetween(s-1,s+1))&&(s+=u?1:-1),c=s+(c-l),l=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,s&&s<t.size&&hb(t.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function hb(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 vk{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 xC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(vb),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=yb(this),gb(this),this.nodeViews=bb(this),this.docView=Yy(this.state.doc,mb(this),Kf(this),this.dom,this),this.domObserver=new JC(this,(r,i,s,l)=>iN(this,r,i,s,l)),this.domObserver.start(),SC(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&&Mp(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(vb),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(fk(this),l=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=bb(this);cN(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Mp(this),this.editable=yb(this),gb(this);let u=Kf(this),f=mb(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=s||!this.docView.matchesNode(e.doc,f,u);(h||!e.selection.eq(i.selection))&&(l=!0);let g=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&j1(this);if(l){this.domObserver.stop();let y=h&&(_n||en)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&aN(i.selection,e.selection);if(h){let k=en?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=jC(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=Yy(e.doc,f,u,this.dom,this)),k&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&aC(this))?Gr(this,y):(ek(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():g&&z1(g)}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 Me){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Hy(this,n.getBoundingClientRect(),e)}else Hy(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new hk(e.slice,e.move,i<0?void 0:Me.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[e];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let c=s[l].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(_n){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&&F1(this.dom),Gr(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 V1(this,e)}coordsAtPos(e,n=1){return Kv(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return J1(this,n||this.state,e)}pasteHTML(e,n){return Rl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return hh(this,e)}destroy(){this.docView&&(CC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Kf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,T1())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return _C(this,e)}domSelectionRange(){let e=this.domSelection();return e?ln&&this.root.nodeType===11&&I1(this.dom.ownerDocument)==this.dom&&XC(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}vk.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function mb(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[yt.node(0,t.state.doc.content.size,e)]}function gb(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:yt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function yb(t){return!t.someProp("editable",e=>e(t.state)===!1)}function aN(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 bb(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function cN(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function vb(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 Ii={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:"'"},Hc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uN=typeof navigator<"u"&&/Mac/.test(navigator.platform),dN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Zt=0;Zt<10;Zt++)Ii[48+Zt]=Ii[96+Zt]=String(Zt);for(var Zt=1;Zt<=24;Zt++)Ii[Zt+111]="F"+Zt;for(var Zt=65;Zt<=90;Zt++)Ii[Zt]=String.fromCharCode(Zt+32),Hc[Zt]=String.fromCharCode(Zt);for(var Gf in Ii)Hc.hasOwnProperty(Gf)||(Hc[Gf]=Ii[Gf]);function fN(t){var e=uN&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||dN&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Hc:Ii)[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 pN=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),hN=typeof navigator<"u"&&/Win/.test(navigator.platform);function mN(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c++){let u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))pN?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function gN(t){let e=Object.create(null);for(let n in t)e[mN(n)]=t[n];return e}function Yf(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 yN(t){return new it({props:{handleKeyDown:kh(t)}})}function kh(t){let e=gN(t);return function(n,r){let i=fN(r),s,l=e[Yf(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[Yf(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(hN&&r.ctrlKey&&r.altKey)&&(s=Ii[r.keyCode])&&s!=i){let c=e[Yf(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var bN=Object.defineProperty,Eh=(t,e)=>{for(var n in e)bN(t,n,{get:e[n],enumerable:!0})};function Pu(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=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 s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var Bu=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...f)=>{const p=c(...f)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,l=[],c=!!t,u=t||i.tr,f=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(h=>h===!0)),p={...Object.fromEntries(Object.entries(n).map(([h,g])=>[h,(...k)=>{const w=this.buildProps(u,e),x=g(...k)(w);return l.push(x),p}])),run:f};return p}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...f)=>u(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,l={tr:t,editor:r,view:s,state:Pu({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...f)=>u(...f)(l)]))}};return l}},kk={};Eh(kk,{blur:()=>vN,clearContent:()=>kN,clearNodes:()=>EN,command:()=>wN,createParagraphNear:()=>xN,cut:()=>SN,deleteCurrentNode:()=>CN,deleteNode:()=>NN,deleteRange:()=>_N,deleteSelection:()=>TN,enter:()=>MN,exitCode:()=>AN,extendMarkRange:()=>ON,first:()=>RN,focus:()=>LN,forEach:()=>DN,insertContent:()=>PN,insertContentAt:()=>zN,joinBackward:()=>UN,joinDown:()=>$N,joinForward:()=>HN,joinItemBackward:()=>WN,joinItemForward:()=>VN,joinTextblockBackward:()=>KN,joinTextblockForward:()=>qN,joinUp:()=>FN,keyboardShortcut:()=>YN,lift:()=>JN,liftEmptyBlock:()=>QN,liftListItem:()=>XN,newlineInCode:()=>ZN,resetAttributes:()=>e_,scrollIntoView:()=>t_,selectAll:()=>n_,selectNodeBackward:()=>r_,selectNodeForward:()=>i_,selectParentNode:()=>s_,selectTextblockEnd:()=>o_,selectTextblockStart:()=>l_,setContent:()=>a_,setMark:()=>N_,setMeta:()=>__,setNode:()=>T_,setNodeSelection:()=>M_,setTextDirection:()=>A_,setTextSelection:()=>O_,sinkListItem:()=>R_,splitBlock:()=>I_,splitListItem:()=>L_,toggleList:()=>D_,toggleMark:()=>P_,toggleNode:()=>B_,toggleWrap:()=>j_,undoInputRule:()=>z_,unsetAllMarks:()=>F_,unsetMark:()=>$_,unsetTextDirection:()=>U_,updateAttributes:()=>H_,wrapIn:()=>W_,wrapInList:()=>V_});var vN=()=>({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}),EN=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:p}=e,h=f.resolve(p.map(u)),g=f.resolve(p.map(u+c.nodeSize)),y=h.blockRange(g);if(!y)return;const k=vo(y);if(c.type.isTextblock){const{defaultType:w}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(y.start,w)}(k||k===0)&&e.lift(y,k)})}),!0},wN=t=>e=>t(e),xN=()=>({state:t,dispatch:e})=>Dv(t,e),SN=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new Ae(r.doc.resolve(Math.max(l-1,0)))),!0},CN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const c=i.before(s),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1};function Bt(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 NN=t=>({tr:e,state:n,dispatch:r})=>{const i=Bt(t,n.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const u=s.before(l),f=s.after(l);e.delete(u,f).scrollIntoView()}return!0}return!1},_N=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},TN=()=>({state:t,dispatch:e})=>oh(t,e),MN=()=>({commands:t})=>t.keyboardShortcut("Enter"),AN=()=>({state:t,dispatch:e})=>p1(t,e);function wh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Wc(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:wh(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Ek(t,e,n={}){return t.find(r=>r.type===e&&Wc(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function kb(t,e,n={}){return!!Ek(t,e,n)}function xh(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!Ek([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,u=l+1,f=c+i.node.nodeSize;for(;l>0&&kb([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;u<t.parent.childCount&&kb([...t.parent.child(u).marks],e,n);)f+=t.parent.child(u).nodeSize,u+=1;return{from:c,to:f}}function Yr(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 ON=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Yr(t,r.schema),{doc:l,selection:c}=n,{$from:u,from:f,to:p}=c;if(i){const h=xh(u,s,e);if(h&&h.from<=f&&h.to>=p){const g=Ae.create(l,h.from,h.to);n.setSelection(g)}}return!0},RN=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function wk(t){return t instanceof Ae}function ps(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function xk(t,e=null){if(!e)return null;const n=Le.atStart(t),r=Le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Ae.create(t,ps(0,i,s),ps(t.content.size,i,s)):Ae.create(t,ps(e,i,s),ps(e,i,s))}function Eb(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Vc(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function IN(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var LN=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Vc()||Eb())&&r.dom.focus(),IN()&&!Vc()&&!Eb()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!wk(n.state.selection))return l(),!0;const c=xk(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},DN=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),PN=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Sk=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Sk(r)}return t};function ic(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 Sk(n)}function Ll(t,e,n){if(t instanceof or||t instanceof J)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return J.fromArray(t.map(c=>e.nodeFromJSON(c)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Ll("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const u=new av({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:f=>(l=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?Ti.fromSchema(u).parseSlice(ic(t),n.parseOptions):Ti.fromSchema(u).parse(ic(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=Ti.fromSchema(e);return n.slice?s.parseSlice(ic(t),n.parseOptions).content:s.parse(ic(t),n.parseOptions)}return Ll("",e,n)}function BN(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Wt||i instanceof Vt))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,u,f,p)=>{l===0&&(l=p)}),t.setSelection(Le.near(t.doc.resolve(l),n))}var jN=t=>!("type"in t),zN=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=x=>{s.emit("contentError",{editor:s,error:x,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ll(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(x){u(x)}try{c=Ll(e,s.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(x){return u(x),!1}let{from:p,to:h}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((jN(c)?c:[c]).forEach(x=>{x.check(),g=g?x.isText&&x.marks.length===0:!1,y=y?x.isBlock:!1}),p===h&&y){const{parent:x}=r.doc.resolve(p);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(p-=1,h+=1)}let w;if(g){if(Array.isArray(e))w=e.map(x=>x.text||"").join("");else if(e instanceof J){let x="";e.forEach(C=>{C.text&&(x+=C.text)}),w=x}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,p,h)}else{w=c;const x=r.doc.resolve(p),C=x.node(),N=x.parentOffset===0,I=C.isText||C.isTextblock,P=C.content.size>0;N&&I&&P&&(p=Math.max(0,p-1)),r.replaceWith(p,h,w)}n.updateSelection&&BN(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:w})}return!0},FN=()=>({state:t,dispatch:e})=>u1(t,e),$N=()=>({state:t,dispatch:e})=>d1(t,e),UN=()=>({state:t,dispatch:e})=>Tv(t,e),HN=()=>({state:t,dispatch:e})=>Rv(t,e),WN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Au(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},VN=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Au(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},KN=()=>({state:t,dispatch:e})=>a1(t,e),qN=()=>({state:t,dispatch:e})=>c1(t,e);function Ck(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function GN(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c+=1){const u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Vc()||Ck()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var YN=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=GN(t).split(/-(?!$)/),l=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u==null||u.steps.forEach(f=>{const p=f.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Li(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?Bt(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(h,g)=>{if(h.isText)return;const y=Math.max(r,g),k=Math.min(i,g+h.nodeSize);c.push({node:h,from:y,to:k})});const u=i-r,f=c.filter(h=>l?l.name===h.node.type.name:!0).filter(h=>Wc(h.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((h,g)=>h+g.to-g.from,0)>=u}var JN=(t,e={})=>({state:n,dispatch:r})=>{const i=Bt(t,n.schema);return Li(n,i,e)?f1(n,r):!1},QN=()=>({state:t,dispatch:e})=>Pv(t,e),XN=t=>({state:e,dispatch:n})=>{const r=Bt(t,e.schema);return S1(r)(e,n)},ZN=()=>({state:t,dispatch:e})=>Lv(t,e);function ju(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function wb(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var e_=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=ju(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=Bt(t,r.schema)),c==="mark"&&(l=Yr(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(p,h)=>{s&&s===p.type&&(u=!0,i&&n.setNodeMarkup(h,void 0,wb(p.attrs,e))),l&&p.marks.length&&p.marks.forEach(g=>{l===g.type&&(u=!0,i&&n.addMark(h,h+p.nodeSize,l.create(wb(g.attrs,e))))})})}),u},t_=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),n_=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ln(t.doc);t.setSelection(n)}return!0},r_=()=>({state:t,dispatch:e})=>Av(t,e),i_=()=>({state:t,dispatch:e})=>Iv(t,e),s_=()=>({state:t,dispatch:e})=>g1(t,e),o_=()=>({state:t,dispatch:e})=>v1(t,e),l_=()=>({state:t,dispatch:e})=>b1(t,e);function Ap(t,e,n={},r={}){return Ll(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var a_=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{const{doc:u}=s;if(r.preserveWhitespace!=="full"){const f=Ap(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return l&&s.replaceWith(0,u.content.size,f).setMeta("preventUpdate",!n),!0}return l&&s.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Nk(t,e){const n=Yr(e,t.schema),{from:r,to:i,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function Sh(t,e){const n=new ih(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function c_(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 Kc(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function _k(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function Tk(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function zu(t){return e=>Tk(e.$from,t)}function Te(t,e,n){return t.config[e]===void 0&&t.parent?Te(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Te(t.parent,e,n):null}):t.config[e]}function Ch(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Te(e,"addExtensions",n);return r?[e,...Ch(r())]:e}).flat(10)}function Nh(t,e){const n=_s.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function Mk(t){return typeof t=="function"}function et(t,e=void 0,...n){return Mk(t)?e?t.bind(e)(...n):t(...n):t}function u_(t={}){return Object.keys(t).length===0&&t.constructor===Object}function yo(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Ak(t){const e=[],{nodeExtensions:n,markExtensions:r}=yo(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage,extensions:i},u=Te(l,"addGlobalAttributes",c);if(!u)return;u().forEach(p=>{p.types.forEach(h=>{Object.entries(p.attributes).forEach(([g,y])=>{e.push({type:h,name:g,attribute:{...s,...y}})})})})}),i.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage},u=Te(l,"addAttributes",c);if(!u)return;const f=u();Object.entries(f).forEach(([p,h])=>{const g={...s,...h};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:l.name,name:p,attribute:g})})}),e}function tt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const c=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=c.filter(p=>!u.includes(p));r[i]=[...u,...f].join(" ")}else if(i==="style"){const c=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],f=new Map;u.forEach(p=>{const[h,g]=p.split(":").map(y=>y.trim());f.set(h,g)}),c.forEach(p=>{const[h,g]=p.split(":").map(y=>y.trim());f.set(h,g)}),r[i]=Array.from(f.entries()).map(([p,h])=>`${p}: ${h}`).join("; ")}else r[i]=s}),r},{})}function Dl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>tt(n,r),{})}function d_(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function xb(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):d_(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function Sb(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&u_(n)?!1:n!=null))}function Cb(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function f_(t,e){var n;const r=Ak(t),{nodeExtensions:i,markExtensions:s}=yo(t),l=(n=i.find(f=>Te(f,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.map(f=>{const p=r.filter(C=>C.type===f.name),h={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((C,N)=>{const I=Te(N,"extendNodeSchema",h);return{...C,...I?I(f):{}}},{}),y=Sb({...g,content:et(Te(f,"content",h)),marks:et(Te(f,"marks",h)),group:et(Te(f,"group",h)),inline:et(Te(f,"inline",h)),atom:et(Te(f,"atom",h)),selectable:et(Te(f,"selectable",h)),draggable:et(Te(f,"draggable",h)),code:et(Te(f,"code",h)),whitespace:et(Te(f,"whitespace",h)),linebreakReplacement:et(Te(f,"linebreakReplacement",h)),defining:et(Te(f,"defining",h)),isolating:et(Te(f,"isolating",h)),attrs:Object.fromEntries(p.map(Cb))}),k=et(Te(f,"parseHTML",h));k&&(y.parseDOM=k.map(C=>xb(C,p)));const w=Te(f,"renderHTML",h);w&&(y.toDOM=C=>w({node:C,HTMLAttributes:Dl(C,p)}));const x=Te(f,"renderText",h);return x&&(y.toText=x),[f.name,y]})),u=Object.fromEntries(s.map(f=>{const p=r.filter(x=>x.type===f.name),h={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((x,C)=>{const N=Te(C,"extendMarkSchema",h);return{...x,...N?N(f):{}}},{}),y=Sb({...g,inclusive:et(Te(f,"inclusive",h)),excludes:et(Te(f,"excludes",h)),group:et(Te(f,"group",h)),spanning:et(Te(f,"spanning",h)),code:et(Te(f,"code",h)),attrs:Object.fromEntries(p.map(Cb))}),k=et(Te(f,"parseHTML",h));k&&(y.parseDOM=k.map(x=>xb(x,p)));const w=Te(f,"renderHTML",h);return w&&(y.toDOM=x=>w({mark:x,HTMLAttributes:Dl(x,p)})),[f.name,y]}));return new av({topNode:l,nodes:c,marks:u})}function p_(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function qc(t){return t.sort((n,r)=>{const i=Te(n,"priority")||100,s=Te(r,"priority")||100;return i>s?-1:i<s?1:0})}function Ok(t){const e=qc(Ch(t)),n=p_(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Rk(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
58
+
59
+ `,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,p,h)=>{var g;u.isBlock&&f>r&&(c+=s);const y=l==null?void 0:l[u.type.name];if(y)return p&&(c+=y({node:u,pos:f,parent:p,index:h,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function h_(t,e){const n={from:0,to:t.content.size};return Rk(t,n,e)}function Ik(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function m_(t,e){const n=Bt(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function Lk(t,e){const n=ju(typeof e=="string"?e:e.name,t.schema);return n==="node"?m_(t,e):n==="mark"?Nk(t,e):{}}function g_(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function y_(t){const e=g_(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,l)=>l!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function _h(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,u)=>{l.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}l.forEach(({from:c,to:u})=>{const f=e.slice(s).map(c,-1),p=e.slice(s).map(u),h=e.invert().map(f,-1),g=e.invert().map(p);r.push({oldRange:{from:h,to:g},newRange:{from:f,to:p}})})}),y_(r)}function Th(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=xh(s,i.type);l&&r.push({mark:i,...l})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}var b_=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,l=null;for(;s>0&&l===null;){const c=i.node(s);(c==null?void 0:c.type.name)===e?l=c:s-=1}return[l,s]};function sc(t,e){return e.nodes[t]||e.marks[t]||null}function Tc(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var v_=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var u,f;const p=((f=(u=i.type.spec).toText)==null?void 0:f.call(u,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function Op(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Yr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(h=>s?s.name===h.type.name:!0).find(h=>Wc(h.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:h,$to:g})=>{const y=h.pos,k=g.pos;t.doc.nodesBetween(y,k,(w,x)=>{if(!w.isText&&!w.marks.length)return;const C=Math.max(y,x),N=Math.min(k,x+w.nodeSize),I=N-C;l+=I,c.push(...w.marks.map(P=>({mark:P,from:C,to:N})))})}),l===0)return!1;const u=c.filter(h=>s?s.name===h.mark.type.name:!0).filter(h=>Wc(h.mark.attrs,n,{strict:!1})).reduce((h,g)=>h+g.to-g.from,0),f=c.filter(h=>s?h.mark.type!==s&&h.mark.type.excludes(s):!0).reduce((h,g)=>h+g.to-g.from,0);return(u>0?u+f:u)>=l}function k_(t,e,n={}){if(!e)return Li(t,null,n)||Op(t,null,n);const r=ju(e,t.schema);return r==="node"?Li(t,e,n):r==="mark"?Op(t,e,n):!1}var E_=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=zu(c=>c.type.name===e)(t.selection);if(!s)return!1;const l=t.doc.resolve(s.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},w_=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Nb(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function _b(t,e){const{nodeExtensions:n}=yo(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=et(Te(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Fu(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(Fu(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Dk(t){return t instanceof Me}var Pk=class Bk{constructor(e){this.position=e}static fromJSON(e){return new Bk(e.position)}toJSON(){return{position:this.position}}};function x_(t,e){const n=e.mapping.mapResult(t.position);return{position:new Pk(n.pos),mapResult:n}}function S_(t){return new Pk(t)}function C_(t,e,n){var r;const{selection:i}=e;let s=null;if(wk(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(f=>f.type.excludes(n)))}const{ranges:l}=i;return l.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(p,h,g)=>{if(f)return!1;if(p.isInline){const y=!g||g.type.allowsMarkType(n),k=!!n.isInSet(p.marks)||!p.marks.some(w=>w.type.excludes(n));f=y&&k}return!f}),f})}var N_=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,u=Yr(t,r.schema);if(i)if(l){const f=Nk(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const p=f.$from.pos,h=f.$to.pos;r.doc.nodesBetween(p,h,(g,y)=>{const k=Math.max(y,p),w=Math.min(y+g.nodeSize,h);g.marks.find(C=>C.type===u)?g.marks.forEach(C=>{u===C.type&&n.addMark(k,w,u.create({...C.attrs,...e}))}):n.addMark(k,w,u.create(e))})});return C_(r,n,u)},__=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),T_=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Bt(t,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>Fy(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>Fy(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},M_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ps(t,0,r.content.size),s=Me.create(r,i);e.setSelection(s)}return!0},A_=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let l,c;return typeof e=="number"?(l=e,c=e):e&&"from"in e&&"to"in e?(l=e.from,c=e.to):(l=s.from,c=s.to),i&&n.doc.nodesBetween(l,c,(u,f)=>{u.isText||n.setNodeMarkup(f,void 0,{...u.attrs,dir:t})}),!0},O_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=Ae.atStart(r).from,c=Ae.atEnd(r).to,u=ps(i,l,c),f=ps(s,l,c),p=Ae.create(r,u,f);e.setSelection(p)}return!0},R_=t=>({state:e,dispatch:n})=>{const r=Bt(t,e.schema);return _1(r)(e,n)};function Tb(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}var I_=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,p=Tc(f,c.node().type.name,c.node().attrs);if(s instanceof Me&&s.node.isBlock)return!c.parentOffset||!qr(l,c.pos)?!1:(r&&(t&&Tb(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const h=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:c_(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=h&&g?[{type:g,attrs:p}]:void 0,k=qr(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!k&&qr(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(k=!0,y=g?[{type:g,attrs:p}]:void 0),r){if(k&&(s instanceof Ae&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!h&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),x=e.doc.resolve(w);c.node(-1).canReplaceWith(x.index(),x.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&Tb(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return k},L_=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=Bt(t,r.schema),{$from:u,$to:f}=r.selection,p=r.selection.node;if(p&&p.isBlock||u.depth<2||!u.sameParent(f))return!1;const h=u.node(-1);if(h.type!==c)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let C=J.empty;const N=u.index(-1)?1:u.index(-2)?2:3;for(let te=u.depth-N;te>=u.depth-3;te-=1)C=J.from(u.node(te).copy(C));const I=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,P={...Tc(g,u.node().type.name,u.node().attrs),...e},O=((l=c.contentMatch.defaultType)==null?void 0:l.createAndFill(P))||void 0;C=C.append(J.from(c.createAndFill(null,O)||void 0));const R=u.before(u.depth-(N-1));n.replace(R,u.after(-I),new he(C,4-N,0));let $=-1;n.doc.nodesBetween(R,n.doc.content.size,(te,le)=>{if($>-1)return!1;te.isTextblock&&te.content.size===0&&($=le+1)}),$>-1&&n.setSelection(Ae.near(n.doc.resolve($))),n.scrollIntoView()}return!0}const y=f.pos===u.end()?h.contentMatchAt(0).defaultType:null,k={...Tc(g,h.type.name,h.attrs),...e},w={...Tc(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const x=y?[{type:c,attrs:k},{type:y,attrs:w}]:[{type:c,attrs:k}];if(!qr(n.doc,u.pos,2))return!1;if(i){const{selection:C,storedMarks:N}=r,{splittableMarks:I}=s.extensionManager,P=N||C.$to.parentOffset&&C.$from.marks();if(n.split(u.pos,2,x).scrollIntoView(),!P||!i)return!0;const O=P.filter(R=>I.includes(R.type.name));n.ensureMarks(O)}return!0},Jf=(t,e)=>{const n=zu(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pi(t.doc,n.pos)&&t.join(n.pos),!0},Qf=(t,e)=>{const n=zu(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pi(t.doc,r)&&t.join(r),!0},D_=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:u,commands:f,can:p})=>{const{extensions:h,splittableMarks:g}=i.extensionManager,y=Bt(t,l.schema),k=Bt(e,l.schema),{selection:w,storedMarks:x}=l,{$from:C,$to:N}=w,I=C.blockRange(N),P=x||w.$to.parentOffset&&w.$from.marks();if(!I)return!1;const O=zu(R=>_b(R.type.name,h))(w);if(I.depth>=1&&O&&I.depth-O.depth<=1){if(O.node.type===y)return f.liftListItem(k);if(_b(O.node.type.name,h)&&y.validContent(O.node.content)&&c)return u().command(()=>(s.setNodeMarkup(O.pos,y),!0)).command(()=>Jf(s,y)).command(()=>Qf(s,y)).run()}return!n||!P||!c?u().command(()=>p().wrapInList(y,r)?!0:f.clearNodes()).wrapInList(y,r).command(()=>Jf(s,y)).command(()=>Qf(s,y)).run():u().command(()=>{const R=p().wrapInList(y,r),$=P.filter(te=>g.includes(te.type.name));return s.ensureMarks($),R?!0:f.clearNodes()}).wrapInList(y,r).command(()=>Jf(s,y)).command(()=>Qf(s,y)).run()},P_=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=Yr(t,r.schema);return Op(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},B_=(t,e,n={})=>({state:r,commands:i})=>{const s=Bt(t,r.schema),l=Bt(e,r.schema),c=Li(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(l,u):i.setNode(s,{...u,...n})},j_=(t,e={})=>({state:n,commands:r})=>{const i=Bt(t,n.schema);return Li(n,i,e)?r.lift(i):r.wrapIn(i,e)},z_=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const l=t.tr,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else l.delete(s.from,s.to)}return!0}}return!1},F_=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},$_=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,u=Yr(t,r.schema),{$from:f,empty:p,ranges:h}=c;if(!i)return!0;if(p&&l){let{from:g,to:y}=c;const k=(s=f.marks().find(x=>x.type===u))==null?void 0:s.attrs,w=xh(f,u,k);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else h.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},U_=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,l;return typeof t=="number"?(s=t,l=t):t&&"from"in t&&"to"in t?(s=t.from,l=t.to):(s=i.from,l=i.to),r&&e.doc.nodesBetween(s,l,(c,u)=>{if(c.isText)return;const f={...c.attrs};delete f.dir,e.setNodeMarkup(u,void 0,f)}),!0},H_=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=ju(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=Bt(t,r.schema)),c==="mark"&&(l=Yr(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{const p=f.$from.pos,h=f.$to.pos;let g,y,k,w;n.selection.empty?r.doc.nodesBetween(p,h,(x,C)=>{s&&s===x.type&&(u=!0,k=Math.max(C,p),w=Math.min(C+x.nodeSize,h),g=C,y=x)}):r.doc.nodesBetween(p,h,(x,C)=>{C<p&&s&&s===x.type&&(u=!0,k=Math.max(C,p),w=Math.min(C+x.nodeSize,h),g=C,y=x),C>=p&&C<=h&&(s&&s===x.type&&(u=!0,i&&n.setNodeMarkup(C,void 0,{...x.attrs,...e})),l&&x.marks.length&&x.marks.forEach(N=>{if(l===N.type&&(u=!0,i)){const I=Math.max(C,p),P=Math.min(C+x.nodeSize,h);n.addMark(I,P,l.create({...N.attrs,...e}))}}))}),y&&(g!==void 0&&i&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),l&&y.marks.length&&y.marks.forEach(x=>{l===x.type&&i&&n.addMark(k,w,l.create({...x.attrs,...e}))}))}),u},W_=(t,e={})=>({state:n,dispatch:r})=>{const i=Bt(t,n.schema);return k1(i,e)(n,r)},V_=(t,e={})=>({state:n,dispatch:r})=>{const i=Bt(t,n.schema);return E1(i,e)(n,r)},K_=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Hl=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},q_=(t,e)=>{if(wh(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function oc(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||(e=f.nodeBefore||f.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let p=!1;const h=v_(f)+s;return l.forEach(g=>{if(p)return;const y=q_(h,g.find);if(!y)return;const k=u.state.tr,w=Pu({state:u.state,transaction:k}),x={from:r-(y[0].length-s.length),to:i},{commands:C,chain:N,can:I}=new Bu({editor:n,state:w});g.handler({state:w,range:x,match:y,commands:C,chain:N,can:I})===null||!k.steps.length||(g.undoable&&k.setMeta(c,{transform:k,from:r,to:i,text:s}),u.dispatch(k),p=!0)}),p}function G_(t){const{editor:e,rules:n}=t,r=new it({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:p}=u;typeof p=="string"?p=p:p=Nh(J.from(p),l.schema);const{from:h}=u,g=h+p.length;oc({editor:e,from:h,to:g,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return oc({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&oc({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?oc({editor:e,from:l.pos,to:l.pos,text:`
60
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Y_(t){return Object.prototype.toString.call(t).slice(8,-1)}function lc(t){return Y_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function jk(t,e){const n={...t};return lc(t)&&lc(e)&&Object.keys(e).forEach(r=>{lc(e[r])&&lc(t[r])?n[r]=jk(t[r],e[r]):n[r]=e[r]}),n}var Mh=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{...et(Te(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...et(Te(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>jk(this.options,t)});return e.name=this.name,e.parent=this.parent,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}},lr=class zk extends Mh{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new zk(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(f=>(f==null?void 0:f.type.name)===n.name))return!1;const u=l.find(f=>(f==null?void 0:f.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function J_(t){return typeof t=="number"}var Q_=class{constructor(t){this.find=t.find,this.handler=t.handler}},X_=(t,e,n)=>{if(wh(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Z_(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:u,chain:f,can:p}=new Bu({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,i,(y,k)=>{var w,x,C,N,I;if((x=(w=y.type)==null?void 0:w.spec)!=null&&x.code||!(y.isText||y.isTextblock||y.isInline))return;const P=(I=(N=(C=y.content)==null?void 0:C.size)!=null?N:y.nodeSize)!=null?I:0,O=Math.max(r,k),R=Math.min(i,k+P);if(O>=R)return;const $=y.isText?y.text||"":y.textBetween(O-k,R-k,void 0,"");X_($,s.find,l).forEach(le=>{if(le.index===void 0)return;const ee=O+le.index+1,Q=ee+le[0].length,H={from:n.tr.mapping.map(ee),to:n.tr.mapping.map(Q)},K=s.handler({state:n,range:H,match:le,commands:u,chain:f,can:p,pasteEvent:l,dropEvent:c});h.push(K)})}),h.every(y=>y!==null)}var ac=null,eT=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function tT(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:p,from:h,to:g,rule:y,pasteEvt:k})=>{const w=p.tr,x=Pu({state:p,transaction:w});if(!(!Z_({editor:e,state:x,from:Math.max(h-1,0),to:g.b-1,rule:y,pasteEvent:k,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(p=>new it({view(h){const g=k=>{var w;r=(w=h.dom.parentElement)!=null&&w.contains(k.target)?h.dom.parentElement:null,r&&(ac=e)},y=()=>{ac&&(ac=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(h,g)=>{if(s=r===h.dom.parentElement,c=g,!s){const y=ac;y!=null&&y.isEditable&&setTimeout(()=>{const k=y.state.selection;k&&y.commands.deleteRange({from:k.from,to:k.to})},10)}return!1},paste:(h,g)=>{var y;const k=(y=g.clipboardData)==null?void 0:y.getData("text/html");return l=g,i=!!(k!=null&&k.includes("data-pm-slice")),!1}}},appendTransaction:(h,g,y)=>{const k=h[0],w=k.getMeta("uiEvent")==="paste"&&!i,x=k.getMeta("uiEvent")==="drop"&&!s,C=k.getMeta("applyPasteRules"),N=!!C;if(!w&&!x&&!N)return;if(N){let{text:O}=C;typeof O=="string"?O=O:O=Nh(J.from(O),y.schema);const{from:R}=C,$=R+O.length,te=eT(O);return u({rule:p,state:y,from:R,to:{b:$},pasteEvt:te})}const I=g.doc.content.findDiffStart(y.doc.content),P=g.doc.content.findDiffEnd(y.doc.content);if(!(!J_(I)||!P||I===P.b))return u({rule:p,state:y,from:I,to:P,pasteEvt:l})}}))}var $u=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Ok(t),this.schema=f_(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:sc(e.name,this.schema)},r=Te(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return qc([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:sc(r.name,this.schema)},s=[],l=Te(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&Te(r,"exitable",i)&&(c.ArrowRight=()=>lr.handleExit({editor:t,mark:r})),l){const g=Object.fromEntries(Object.entries(l()).map(([y,k])=>[y,()=>k({editor:t})]));c={...c,...g}}const u=yN(c);s.push(u);const f=Te(r,"addInputRules",i);if(Nb(r,t.options.enableInputRules)&&f){const g=f();if(g&&g.length){const y=G_({editor:t,rules:g}),k=Array.isArray(y)?y:[y];s.push(...k)}}const p=Te(r,"addPasteRules",i);if(Nb(r,t.options.enablePasteRules)&&p){const g=p();if(g&&g.length){const y=tT({editor:t,rules:g});s.push(...y)}}const h=Te(r,"addProseMirrorPlugins",i);if(h){const g=h();s.push(...g)}return s})}get attributes(){return Ak(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=yo(this.extensions);return Object.fromEntries(e.filter(n=>!!Te(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Bt(n.name,this.schema)},s=Te(n,"addNodeView",i);if(!s)return[];const l=s();if(!l)return[];const c=(u,f,p,h,g)=>{const y=Dl(u,r);return l({node:u,view:f,getPos:p,decorations:h,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return qc([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:sc(i.name,this.schema)},l=Te(i,"dispatchTransaction",s);return l?c=>{l.call(s,{transaction:c,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=yo(this.extensions);return Object.fromEntries(e.filter(n=>!!Te(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Yr(n.name,this.schema)},s=Te(n,"addMarkView",i);if(!s)return[];const l=(c,u,f)=>{const p=Dl(c,r);return s()({mark:c,view:u,inline:f,editor:t,extension:n,HTMLAttributes:p,updateAttributes:h=>{gT(c,t,h)}})};return[n.name,l]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sc(e.name,this.schema)};e.type==="mark"&&((n=et(Te(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=Te(e,"onBeforeCreate",r),s=Te(e,"onCreate",r),l=Te(e,"onUpdate",r),c=Te(e,"onSelectionUpdate",r),u=Te(e,"onTransaction",r),f=Te(e,"onFocus",r),p=Te(e,"onBlur",r),h=Te(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),f&&this.editor.on("focus",f),p&&this.editor.on("blur",p),h&&this.editor.on("destroy",h)})}};$u.resolve=Ok;$u.sort=qc;$u.flatten=Ch;var nT={};Eh(nT,{ClipboardTextSerializer:()=>$k,Commands:()=>Uk,Delete:()=>Hk,Drop:()=>Wk,Editable:()=>Vk,FocusEvents:()=>qk,Keymap:()=>Gk,Paste:()=>Yk,Tabindex:()=>Jk,TextDirection:()=>Qk,focusEventsPluginKey:()=>Kk});var Xe=class Fk extends Mh{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Fk(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},$k=Xe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new it({key:new ut("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,l=Math.min(...s.map(p=>p.$from.pos)),c=Math.max(...s.map(p=>p.$to.pos)),u=Ik(n);return Rk(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),Uk=Xe.create({name:"commands",addCommands(){return{...kk}}}),Hk=Xe.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var l,c,u,f;if((f=(u=(c=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?f:t.getMeta("y-sync$"))return;const p=Sh(t.before,[t,...e]);_h(p).forEach(y=>{p.mapping.mapResult(y.oldRange.from).deletedAfter&&p.mapping.mapResult(y.oldRange.to).deletedBefore&&p.before.nodesBetween(y.oldRange.from,y.oldRange.to,(k,w)=>{const x=w+k.nodeSize-2,C=y.oldRange.from<=w&&x<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:k,from:w,to:x,newFrom:p.mapping.map(w),newTo:p.mapping.map(x),deletedRange:y.oldRange,newRange:y.newRange,partial:!C,editor:this.editor,transaction:t,combinedTransform:p})})});const g=p.mapping;p.steps.forEach((y,k)=>{var w,x;if(y instanceof sr){const C=g.slice(k).map(y.from,-1),N=g.slice(k).map(y.to),I=g.invert().map(C,-1),P=g.invert().map(N),O=(w=p.doc.nodeAt(C-1))==null?void 0:w.marks.some($=>$.eq(y.mark)),R=(x=p.doc.nodeAt(N))==null?void 0:x.marks.some($=>$.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:I,to:P},newRange:{from:C,to:N},partial:!!(R||O),editor:this.editor,transaction:t,combinedTransform:p})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Wk=Xe.create({name:"drop",addProseMirrorPlugins(){return[new it({key:new ut("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Vk=Xe.create({name:"editable",addProseMirrorPlugins(){return[new it({key:new ut("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Kk=new ut("focusEvents"),qk=Xe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new it({key:Kk,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Gk=Xe.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:p,$anchor:h}=u,{pos:g,parent:y}=h,k=h.parent.isTextblock&&g>0?c.doc.resolve(g-1):h,w=k.parent.type.spec.isolating,x=h.pos-h.parentOffset,C=w&&k.parent.childCount===1?x===h.pos:Le.atStart(f).from===g;return!p||!y.type.isTextblock||y.textContent.length||!C||C&&h.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.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()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Vc()||Ck()?s:i},addProseMirrorPlugins(){return[new it({key:new ut("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),i=t.some(w=>w.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,u=Le.atStart(e.doc).from,f=Le.atEnd(e.doc).to;if(s||!(l===u&&c===f)||!Fu(n.doc))return;const g=n.tr,y=Pu({state:n,transaction:g}),{commands:k}=new Bu({editor:this.editor,state:y});if(k.clearNodes(),!!g.steps.length)return g}})]}}),Yk=Xe.create({name:"paste",addProseMirrorPlugins(){return[new it({key:new ut("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Jk=Xe.create({name:"tabindex",addProseMirrorPlugins(){return[new it({key:new ut("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Qk=Xe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=yo(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 it({key:new ut("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),rT=class hl{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new hl(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 hl(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 hl(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,l=n.isInline,c=this.pos+r+(s?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!i&&!l&&u.depth<=this.depth)return;const f=new hl(u,this.editor,i,i||l?n:null);i&&(f.actualDepth=this.depth+1),e.push(f)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const u=l[c];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===e&&s.every(u=>n[u]===l.node.attrs[u])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},iT=`.ProseMirror {
61
+ position: relative;
62
+ }
63
+
64
+ .ProseMirror {
65
+ word-wrap: break-word;
66
+ white-space: pre-wrap;
67
+ white-space: break-spaces;
68
+ -webkit-font-variant-ligatures: none;
69
+ font-variant-ligatures: none;
70
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
71
+ }
72
+
73
+ .ProseMirror [contenteditable="false"] {
74
+ white-space: normal;
75
+ }
76
+
77
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
78
+ white-space: pre-wrap;
79
+ }
80
+
81
+ .ProseMirror pre {
82
+ white-space: pre-wrap;
83
+ }
84
+
85
+ img.ProseMirror-separator {
86
+ display: inline !important;
87
+ border: none !important;
88
+ margin: 0 !important;
89
+ width: 0 !important;
90
+ height: 0 !important;
91
+ }
92
+
93
+ .ProseMirror-gapcursor {
94
+ display: none;
95
+ pointer-events: none;
96
+ position: absolute;
97
+ margin: 0;
98
+ }
99
+
100
+ .ProseMirror-gapcursor:after {
101
+ content: "";
102
+ display: block;
103
+ position: absolute;
104
+ top: -2px;
105
+ width: 20px;
106
+ border-top: 1px solid black;
107
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
108
+ }
109
+
110
+ @keyframes ProseMirror-cursor-blink {
111
+ to {
112
+ visibility: hidden;
113
+ }
114
+ }
115
+
116
+ .ProseMirror-hideselection *::selection {
117
+ background: transparent;
118
+ }
119
+
120
+ .ProseMirror-hideselection *::-moz-selection {
121
+ background: transparent;
122
+ }
123
+
124
+ .ProseMirror-hideselection * {
125
+ caret-color: transparent;
126
+ }
127
+
128
+ .ProseMirror-focused .ProseMirror-gapcursor {
129
+ display: block;
130
+ }`;function sT(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var oT=class extends K_{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:x_,createMappablePosition:S_},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=xk(e,this.options.autofocus);this.editorState=co.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=sT(iT,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=Mk(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(l=>!l.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[Vk,$k.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Uk,qk,Gk,Jk,Wk,Yk,Hk,Qk.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new $u(r,this)}createCommandManager(){this.commandManager=new Bu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Ap(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=Ap(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new vk(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const l=this.view.dom;l.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(f=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(f)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const l=n.findLast(f=>f.getMeta("focus")||f.getMeta("blur")),c=l==null?void 0:l.getMeta("focus"),u=l==null?void 0:l.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(t.getMeta("preventUpdate")||!n.some(f=>f.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Lk(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return k_(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Nh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
131
+
132
+ `,textSerializers:n={}}=t||{};return h_(this.state.doc,{blockSeparator:e,textSerializers:{...Ik(this.schema),...n}})}get isEmpty(){return Fu(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}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 rT(e,this)}get $doc(){return this.$pos(0)}};function Ss(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=et(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];if(l){const u=c.search(/\S/),f=n.from+c.indexOf(l),p=f+l.length;if(Th(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>f).length)return null;p<n.to&&s.delete(p,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+l.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function Xk(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=et(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let p=l+f;p>c?p=c:c=p+r[1].length;const h=r[0][r[0].length-1];s.insertText(h,l+r[0].length-1),s.replaceWith(p,c,u)}else if(r[0]){const f=t.type.isInline?l:l-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()},undoable:t.undoable})}function Rp(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=et(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function Mt(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r})=>{let i=t.replace,s=n.from;const l=n.to;if(r[1]){const c=r[0].lastIndexOf(r[1]);i+=r[0].slice(c+r[1].length),s+=c;const u=s-l;u>0&&(i=r[0].slice(c-u,c)+i,s=l)}e.tr.insertText(i,s,l)},undoable:t.undoable})}function bo(t){return new Hl({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=et(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),u=l.doc.resolve(n.from).blockRange(),f=u&&rh(u,t.type,s);if(!f)return null;if(l.wrap(u,f),t.keepMarks&&t.editor){const{selection:h,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,k=g||h.$to.parentOffset&&h.$from.marks();if(k){const w=k.filter(x=>y.includes(x.type.name));l.ensureMarks(w)}}if(t.keepAttributes){const h=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(h,s).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&Pi(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(n.from-1)},undoable:t.undoable})}var lT=t=>"touches"in t,aT=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=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,f=c.clientY-this.startY;this.handleResize(u,f)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const f=u.clientX-this.startX,p=u.clientY-this.startY;this.handleResize(f,p)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),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=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,i,s,l;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),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(i=t.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(l=t.options)!=null&&l.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="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"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(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,lT(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:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),l=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return s?r=this.startWidth+e:l&&(r=this.startWidth-e),c?i=this.startHeight+n:u&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,s,l;if(!n){let f=Math.max(this.minSize.width,t),p=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(f=Math.min(this.maxSize.width,f)),(i=this.maxSize)!=null&&i.height&&(p=Math.min(this.maxSize.height,p)),{width:f,height:p}}let c=t,u=e;return c<this.minSize.width&&(c=this.minSize.width,u=c/this.aspectRatio),u<this.minSize.height&&(u=this.minSize.height,c=u*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&c>this.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(l=this.maxSize)!=null&&l.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function cT(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Me){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var uT={};Eh(uT,{createAtomBlockMarkdownSpec:()=>dT,createBlockMarkdownSpec:()=>fT,createInlineMarkdownSpec:()=>mT,parseAttributes:()=>Ah,parseIndentedBlocks:()=>Ip,renderNestedMarkdownContent:()=>Rh,serializeAttributes:()=>Oh});function Ah(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,f=>(n.push(f),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const f=i.map(p=>p.trim().slice(1));e.class=f.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,f,p])=>{var h;const g=parseInt(((h=p.match(/__QUOTED_(\d+)__/))==null?void 0:h[1])||"0",10),y=n[g];y&&(e[f]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(e[p]=!0)}),e}function Oh(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function dT(t){const{nodeName:e,name:n,parseAttributes:r=Ah,serializeAttributes:i=Oh,defaultAttributes:s={},requiredAttributes:l=[],allowedAttributes:c}=t,u=n||e,f=p=>{if(!c)return p;const h={};return c.forEach(g=>{g in p&&(h[g]=p[g])}),h};return{parseMarkdown:(p,h)=>{const g={...s,...p.attributes};return h.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(p){var h;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(h=p.match(g))==null?void 0:h.index;return y!==void 0?y:-1},tokenize(p,h,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),k=p.match(y);if(!k)return;const w=k[1]||"",x=r(w);if(!l.find(N=>!(N in x)))return{type:e,raw:k[0],attributes:x}}},renderMarkdown:p=>{const h=f(p.attrs||{}),g=i(h),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function fT(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Ah,serializeAttributes:s=Oh,defaultAttributes:l={},content:c="block",allowedAttributes:u}=t,f=n||e,p=h=>{if(!u)return h;const g={};return u.forEach(y=>{y in h&&(g[y]=h[y])}),g};return{parseMarkdown:(h,g)=>{let y;if(r){const w=r(h);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=g.parseChildren(h.tokens||[]):y=g.parseInline(h.tokens||[]);const k={...l,...h.attributes};return g.createNode(e,k,y)},markdownTokenizer:{name:e,level:"block",start(h){var g;const y=new RegExp(`^:::${f}`,"m"),k=(g=h.match(y))==null?void 0:g.index;return k!==void 0?k:-1},tokenize(h,g,y){var k;const w=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=h.match(w);if(!x)return;const[C,N=""]=x,I=i(N);let P=1;const O=C.length;let R="";const $=/^:::([\w-]*)(\s.*)?/gm,te=h.slice(O);for($.lastIndex=0;;){const le=$.exec(te);if(le===null)break;const ee=le.index,Q=le[1];if(!((k=le[2])!=null&&k.endsWith(":::"))){if(Q)P+=1;else if(P-=1,P===0){const H=te.slice(0,ee);R=H.trim();const K=h.slice(0,O+ee+le[0].length);let U=[];if(R)if(c==="block")for(U=y.blockTokens(H),U.forEach(G=>{G.text&&(!G.tokens||G.tokens.length===0)&&(G.tokens=y.inlineTokens(G.text))});U.length>0;){const G=U[U.length-1];if(G.type==="paragraph"&&(!G.text||G.text.trim()===""))U.pop();else break}else U=y.inlineTokens(R);return{type:e,raw:K,attributes:I,content:R,tokens:U}}}}}},renderMarkdown:(h,g)=>{const y=p(h.attrs||{}),k=s(y),w=k?` {${k}}`:"",x=g.renderChildren(h.content||[],`
133
+
134
+ `);return`:::${f}${w}
135
+
136
+ ${x}
137
+
138
+ :::`}}}function pT(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,l]=r;e[i]=s||l,r=n.exec(t)}return e}function hT(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function mT(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=pT,serializeAttributes:s=hT,defaultAttributes:l={},selfClosing:c=!1,allowedAttributes:u}=t,f=n||e,p=g=>{if(!u)return g;const y={};return u.forEach(k=>{const w=typeof k=="string"?k:k.name,x=typeof k=="string"?void 0:k.skipIfDefault;if(w in g){const C=g[w];if(x!==void 0&&C===x)return;y[w]=C}}),y},h=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const k={...l,...g.attributes};if(c)return y.createNode(e,k);const w=r?r(g):g.content||"";return w?y.createNode(e,k,[y.createTextNode(w)]):y.createNode(e,k,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${h}\\s*[^\\]]*\\]`):new RegExp(`\\[${h}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${h}\\]`),k=g.match(y),w=k==null?void 0:k.index;return w!==void 0?w:-1},tokenize(g,y,k){const w=c?new RegExp(`^\\[${h}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${h}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${h}\\]`),x=g.match(w);if(!x)return;let C="",N="";if(c){const[,P]=x;N=P}else{const[,P,O]=x;N=P,C=O||""}const I=i(N.trim());return{type:e,raw:x[0],content:C.trim(),attributes:I}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(C=>C.type==="text").map(C=>C.text).join(""));const k=p(g.attrs||{}),w=s(k),x=w?` ${w}`:"";return c?`[${f}${x}]`:`[${f}${x}]${y}[/${f}]`}}}function Ip(t,e,n){var r,i,s,l;const c=t.split(`
139
+ `),u=[];let f="",p=0;const h=e.baseIndentSize||2;for(;p<c.length;){const g=c[p],y=g.match(e.itemPattern);if(!y){if(u.length>0)break;if(g.trim()===""){p+=1,f=`${f}${g}
140
+ `;continue}else return}const k=e.extractItemData(y),{indentLevel:w,mainContent:x}=k;f=`${f}${g}
141
+ `;const C=[x];for(p+=1;p<c.length;){const O=c[p];if(O.trim()===""){const $=c.slice(p+1).findIndex(ee=>ee.trim()!=="");if($===-1)break;if((((i=(r=c[p+1+$].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>w){C.push(O),f=`${f}${O}
142
+ `,p+=1;continue}else break}if((((l=(s=O.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>w)C.push(O),f=`${f}${O}
143
+ `,p+=1;else break}let N;const I=C.slice(1);if(I.length>0){const O=I.map(R=>R.slice(w+h)).join(`
144
+ `);O.trim()&&(e.customNestedParser?N=e.customNestedParser(O):N=n.blockTokens(O))}const P=e.createToken(k,N);u.push(P)}if(u.length!==0)return{items:u,raw:f}}function Rh(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...l]=t.content,c=e.renderChildren([s]),u=[`${i}${c}`];return l&&l.length>0&&l.forEach(f=>{const p=e.renderChildren([f]);if(p){const h=p.split(`
145
+ `).map(g=>g?e.indent(g):"").join(`
146
+ `);u.push(h)}}),u.join(`
147
+ `)}function gT(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,l=t;i.descendants((c,u)=>{const f=s.mapping.map(u),p=s.mapping.map(u)+c.nodeSize;let h=null;if(c.marks.forEach(y=>{if(y!==l)return!1;h=y}),!h)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==h.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});s.removeMark(f,p,t.type),s.addMark(f,p,y)}}),s.docChanged&&e.view.dispatch(s)}var qt=class Zk extends Mh{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Zk(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Di(t){return new Q_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=et(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],u=r[0];let f=n.to;if(c){const p=u.search(/\S/),h=n.from+u.indexOf(c),g=h+c.length;if(Th(n.from,n.to,e.doc).filter(k=>k.mark.type.excluded.find(x=>x===t.type&&x!==k.mark.type)).filter(k=>k.to>h).length)return null;g<n.to&&l.delete(g,n.to),h>n.from&&l.delete(n.from+p,h),f=n.from+p+c.length,l.addMark(n.from+p,f,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:yT,getOwnPropertySymbols:bT}=Object,{hasOwnProperty:vT}=Object.prototype;function Xf(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function cc(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,l=s.get(n),c=s.get(r);if(l&&c)return l===r&&c===n;s.set(n,r),s.set(r,n);const u=t(n,r,i);return s.delete(n),s.delete(r),u}}function kT(t){return t!=null?t[Symbol.toStringTag]:void 0}function Mb(t){return yT(t).concat(bT(t))}const ET=Object.hasOwn||((t,e)=>vT.call(t,e));function Ts(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const wT="__v",xT="__o",ST="_owner",{getOwnPropertyDescriptor:Ab,keys:Ob}=Object;function CT(t,e){return t.byteLength===e.byteLength&&Gc(new Uint8Array(t),new Uint8Array(e))}function NT(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function _T(t,e){return t.byteLength===e.byteLength&&Gc(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function TT(t,e){return Ts(t.getTime(),e.getTime())}function MT(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function AT(t,e){return t===e}function Rb(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let l,c,u=0;for(;(l=s.next())&&!l.done;){const f=e.entries();let p=!1,h=0;for(;(c=f.next())&&!c.done;){if(i[h]){h++;continue}const g=l.value,y=c.value;if(n.equals(g[0],y[0],u,h,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){p=i[h]=!0;break}h++}if(!p)return!1;u++}return!0}const OT=Ts;function RT(t,e,n){const r=Ob(t);let i=r.length;if(Ob(e).length!==i)return!1;for(;i-- >0;)if(!eE(t,e,n,r[i]))return!1;return!0}function ll(t,e,n){const r=Mb(t);let i=r.length;if(Mb(e).length!==i)return!1;let s,l,c;for(;i-- >0;)if(s=r[i],!eE(t,e,n,s)||(l=Ab(t,s),c=Ab(e,s),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function IT(t,e){return Ts(t.valueOf(),e.valueOf())}function LT(t,e){return t.source===e.source&&t.flags===e.flags}function Ib(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let l,c;for(;(l=s.next())&&!l.done;){const u=e.values();let f=!1,p=0;for(;(c=u.next())&&!c.done;){if(!i[p]&&n.equals(l.value,c.value,l.value,c.value,t,e,n)){f=i[p]=!0;break}p++}if(!f)return!1}return!0}function Gc(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 DT(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 eE(t,e,n,r){return(r===ST||r===xT||r===wT)&&(t.$$typeof||e.$$typeof)?!0:ET(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const PT="[object ArrayBuffer]",BT="[object Arguments]",jT="[object Boolean]",zT="[object DataView]",FT="[object Date]",$T="[object Error]",UT="[object Map]",HT="[object Number]",WT="[object Object]",VT="[object RegExp]",KT="[object Set]",qT="[object String]",GT={"[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},YT="[object URL]",JT=Object.prototype.toString;function QT({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:l,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:f,areRegExpsEqual:p,areSetsEqual:h,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:k}){return function(x,C,N){if(x===C)return!0;if(x==null||C==null)return!1;const I=typeof x;if(I!==typeof C)return!1;if(I!=="object")return I==="number"?c(x,C,N):I==="function"?s(x,C,N):!1;const P=x.constructor;if(P!==C.constructor)return!1;if(P===Object)return u(x,C,N);if(Array.isArray(x))return e(x,C,N);if(P===Date)return r(x,C,N);if(P===RegExp)return p(x,C,N);if(P===Map)return l(x,C,N);if(P===Set)return h(x,C,N);const O=JT.call(x);if(O===FT)return r(x,C,N);if(O===VT)return p(x,C,N);if(O===UT)return l(x,C,N);if(O===KT)return h(x,C,N);if(O===WT)return typeof x.then!="function"&&typeof C.then!="function"&&u(x,C,N);if(O===YT)return y(x,C,N);if(O===$T)return i(x,C,N);if(O===BT)return u(x,C,N);if(GT[O])return g(x,C,N);if(O===PT)return t(x,C,N);if(O===zT)return n(x,C,N);if(O===jT||O===HT||O===qT)return f(x,C,N);if(k){let R=k[O];if(!R){const $=kT(x);$&&(R=k[$])}if(R)return R(x,C,N)}return!1}}function XT({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:CT,areArraysEqual:n?ll:NT,areDataViewsEqual:_T,areDatesEqual:TT,areErrorsEqual:MT,areFunctionsEqual:AT,areMapsEqual:n?Xf(Rb,ll):Rb,areNumbersEqual:OT,areObjectsEqual:n?ll:RT,arePrimitiveWrappersEqual:IT,areRegExpsEqual:LT,areSetsEqual:n?Xf(Ib,ll):Ib,areTypedArraysEqual:n?Xf(Gc,ll):Gc,areUrlsEqual:DT,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=cc(r.areArraysEqual),s=cc(r.areMapsEqual),l=cc(r.areObjectsEqual),c=cc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return r}function ZT(t){return function(e,n,r,i,s,l,c){return t(e,n,c)}}function eM({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(c,u){const{cache:f=t?new WeakMap:void 0,meta:p}=n();return e(c,u,{cache:f,equals:r,meta:p,strict:i})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,u){return e(c,u,s)}}const tM=ji();ji({strict:!0});ji({circular:!0});ji({circular:!0,strict:!0});ji({createInternalComparator:()=>Ts});ji({strict:!0,createInternalComparator:()=>Ts});ji({circular:!0,createInternalComparator:()=>Ts});ji({circular:!0,createInternalComparator:()=>Ts,strict:!0});function ji(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=XT(t),l=QT(s),c=n?n(l):ZT(l);return eM({circular:e,comparator:l,createState:r,equals:c,strict:i})}var Zf={exports:{}},ep={};/**
148
+ * @license React
149
+ * use-sync-external-store-shim/with-selector.production.js
150
+ *
151
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
152
+ *
153
+ * This source code is licensed under the MIT license found in the
154
+ * LICENSE file in the root directory of this source tree.
155
+ */var Lb;function nM(){if(Lb)return ep;Lb=1;var t=zl(),e=V0();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return ep.useSyncExternalStoreWithSelector=function(f,p,h,g,y){var k=s(null);if(k.current===null){var w={hasValue:!1,value:null};k.current=w}else w=k.current;k=c(function(){function C(R){if(!N){if(N=!0,I=R,R=g(R),y!==void 0&&w.hasValue){var $=w.value;if(y($,R))return P=$}return P=R}if($=P,r(I,R))return $;var te=g(R);return y!==void 0&&y($,te)?(I=R,$):(I=R,P=te)}var N=!1,I,P,O=h===void 0?null:h;return[function(){return C(p())},O===null?void 0:function(){return C(O())}]},[p,h,g,y]);var x=i(f,k[0],k[1]);return l(function(){w.hasValue=!0,w.value=x},[x]),u(x),x},ep}var Db;function rM(){return Db||(Db=1,Zf.exports=nM()),Zf.exports}var iM=rM(),sM=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},oM=({contentComponent:t})=>{const e=K0.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return v.jsx(v.Fragment,{children:Object.values(e)})};function lM(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:fS.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var aM=class extends Ri.Component{constructor(t){var e;super(t),this.editorContentRef=Ri.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}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=lM(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((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 v.jsxs(v.Fragment,{children:[v.jsx("div",{ref:sM(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&v.jsx(oM,{contentComponent:t.contentComponent})]})}},cM=_.forwardRef((t,e)=>{const n=Ri.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ri.createElement(aM,{key:n,innerRef:e,...t})}),tE=Ri.memo(cM),uM=typeof window<"u"?_.useLayoutEffect:_.useEffect,dM=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function fM(t){var e;const[n]=_.useState(()=>new dM(t.editor)),r=iM.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:tM);return uM(()=>n.watch(t.editor),[t.editor,n]),_.useDebugValue(r),r}var pM=!1,Lp=typeof window>"u",hM=Lp||!!(typeof window<"u"&&window.next),mM=class nE{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?Lp||hM?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new oT(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var l;return i===((l=n.extensions)==null?void 0:l[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?nE.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))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 gM(t={},e=[]){const n=_.useRef(t);n.current=t;const[r]=_.useState(()=>new mM(n)),i=K0.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return _.useDebugValue(i),_.useEffect(r.onRender(e)),fM({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var rE=_.createContext({editor:null});rE.Consumer;var yM=_.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),bM=()=>_.useContext(yM);Ri.forwardRef((t,e)=>{const{onDragStart:n}=bM(),r=t.as||"div";return v.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Ri.createContext({markViewContentRef:()=>{}});var Ih=_.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Ih.displayName="TiptapContext";var vM=()=>_.useContext(Ih);function iE({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=_.useMemo(()=>({editor:r}),[r]),s=_.useMemo(()=>({editor:r}),[r]);return v.jsx(rE.Provider,{value:s,children:v.jsx(Ih.Provider,{value:i,children:n})})}iE.displayName="Tiptap";function sE({...t}){const{editor:e}=vM();return v.jsx(tE,{editor:e,...t})}sE.displayName="Tiptap.Content";Object.assign(iE,{Content:sE});var kM=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,EM=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,wM=lr.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",tt(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const s=i[2].trim(),l=n.inlineTokens(s);return{type:"highlight",raw:i[0],text:s,tokens:l}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ss({find:kM,type:this.type})]},addPasteRules(){return[Di({find:EM,type:this.type})]}}),xM=wM,SM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,CM=qt.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",tt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,i,s,l;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",f=(l=(s=t.attrs)==null?void 0:s.title)!=null?l:"";return f?`![${u}](${c} "${f}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:s,HTMLAttributes:l,editor:c})=>{const u=document.createElement("img");Object.entries(l).forEach(([h,g])=>{if(g!=null)switch(h){case"width":case"height":break;default:u.setAttribute(h,g);break}}),u.src=l.src;const f=new aT({element:u,editor:c,node:i,getPos:s,onResize:(h,g)=>{u.style.width=`${h}px`,u.style.height=`${g}px`},onCommit:(h,g)=>{const y=s();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:h,height:g}).run()},onUpdate:(h,g,y)=>h.type===i.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),p=f.dom;return p.style.visibility="hidden",p.style.pointerEvents="none",u.onload=()=>{p.style.visibility="",p.style.pointerEvents=""},f}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Xk({find:SM,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),NM=CM;const _M="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",TM="ελ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",Dp="numeric",Pp="ascii",Bp="alpha",kl="asciinumeric",ml="alphanumeric",jp="domain",oE="emoji",MM="scheme",AM="slashscheme",tp="whitespace";function OM(t,e){return t in e||(e[t]=[]),e[t]}function hs(t,e,n){e[Dp]&&(e[kl]=!0,e[ml]=!0),e[Pp]&&(e[kl]=!0,e[Bp]=!0),e[kl]&&(e[ml]=!0),e[Bp]&&(e[ml]=!0),e[ml]&&(e[jp]=!0),e[oE]&&(e[jp]=!0);for(const r in e){const i=OM(r,n);i.indexOf(t)<0&&i.push(t)}}function RM(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Nn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Nn.groups={};Nn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||Nn.groups;let i;return e&&e.j?i=e:(i=new Nn(e),n&&r&&hs(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(t[l]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||Nn.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let l,c=i.go(t);if(c?(l=new Nn,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Nn,s){if(r)if(l.t&&typeof l.t=="string"){const u=Object.assign(RM(l.t,r),n);hs(s,u,r)}else n&&hs(s,n,r);l.t=s}return i.j[t]=l,l}};const $e=(t,e,n,r,i)=>t.ta(e,n,r,i),Nt=(t,e,n,r,i)=>t.tr(e,n,r,i),Pb=(t,e,n,r,i)=>t.ts(e,n,r,i),ae=(t,e,n,r,i)=>t.tt(e,n,r,i),Hr="WORD",zp="UWORD",lE="ASCIINUMERICAL",aE="ALPHANUMERICAL",Pl="LOCALHOST",Fp="TLD",$p="UTLD",Mc="SCHEME",oo="SLASH_SCHEME",Lh="NUM",Up="WS",Dh="NL",El="OPENBRACE",wl="CLOSEBRACE",Yc="OPENBRACKET",Jc="CLOSEBRACKET",Qc="OPENPAREN",Xc="CLOSEPAREN",Zc="OPENANGLEBRACKET",eu="CLOSEANGLEBRACKET",tu="FULLWIDTHLEFTPAREN",nu="FULLWIDTHRIGHTPAREN",ru="LEFTCORNERBRACKET",iu="RIGHTCORNERBRACKET",su="LEFTWHITECORNERBRACKET",ou="RIGHTWHITECORNERBRACKET",lu="FULLWIDTHLESSTHAN",au="FULLWIDTHGREATERTHAN",cu="AMPERSAND",uu="APOSTROPHE",du="ASTERISK",ki="AT",fu="BACKSLASH",pu="BACKTICK",hu="CARET",xi="COLON",Ph="COMMA",mu="DOLLAR",Er="DOT",gu="EQUALS",Bh="EXCLAMATION",Wn="HYPHEN",xl="PERCENT",yu="PIPE",bu="PLUS",vu="POUND",Sl="QUERY",jh="QUOTE",cE="FULLWIDTHMIDDLEDOT",zh="SEMI",wr="SLASH",Cl="TILDE",ku="UNDERSCORE",uE="EMOJI",Eu="SYM";var dE=Object.freeze({__proto__:null,ALPHANUMERICAL:aE,AMPERSAND:cu,APOSTROPHE:uu,ASCIINUMERICAL:lE,ASTERISK:du,AT:ki,BACKSLASH:fu,BACKTICK:pu,CARET:hu,CLOSEANGLEBRACKET:eu,CLOSEBRACE:wl,CLOSEBRACKET:Jc,CLOSEPAREN:Xc,COLON:xi,COMMA:Ph,DOLLAR:mu,DOT:Er,EMOJI:uE,EQUALS:gu,EXCLAMATION:Bh,FULLWIDTHGREATERTHAN:au,FULLWIDTHLEFTPAREN:tu,FULLWIDTHLESSTHAN:lu,FULLWIDTHMIDDLEDOT:cE,FULLWIDTHRIGHTPAREN:nu,HYPHEN:Wn,LEFTCORNERBRACKET:ru,LEFTWHITECORNERBRACKET:su,LOCALHOST:Pl,NL:Dh,NUM:Lh,OPENANGLEBRACKET:Zc,OPENBRACE:El,OPENBRACKET:Yc,OPENPAREN:Qc,PERCENT:xl,PIPE:yu,PLUS:bu,POUND:vu,QUERY:Sl,QUOTE:jh,RIGHTCORNERBRACKET:iu,RIGHTWHITECORNERBRACKET:ou,SCHEME:Mc,SEMI:zh,SLASH:wr,SLASH_SCHEME:oo,SYM:Eu,TILDE:Cl,TLD:Fp,UNDERSCORE:ku,UTLD:$p,UWORD:zp,WORD:Hr,WS:Up});const $r=/[a-z]/,al=new RegExp("\\p{L}","u"),np=new RegExp("\\p{Emoji}","u"),Ur=/\d/,rp=/\s/,Bb="\r",ip=`
156
+ `,IM="️",LM="‍",sp="";let uc=null,dc=null;function DM(t=[]){const e={};Nn.groups=e;const n=new Nn;uc==null&&(uc=jb(_M)),dc==null&&(dc=jb(TM)),ae(n,"'",uu),ae(n,"{",El),ae(n,"}",wl),ae(n,"[",Yc),ae(n,"]",Jc),ae(n,"(",Qc),ae(n,")",Xc),ae(n,"<",Zc),ae(n,">",eu),ae(n,"(",tu),ae(n,")",nu),ae(n,"「",ru),ae(n,"」",iu),ae(n,"『",su),ae(n,"』",ou),ae(n,"<",lu),ae(n,">",au),ae(n,"&",cu),ae(n,"*",du),ae(n,"@",ki),ae(n,"`",pu),ae(n,"^",hu),ae(n,":",xi),ae(n,",",Ph),ae(n,"$",mu),ae(n,".",Er),ae(n,"=",gu),ae(n,"!",Bh),ae(n,"-",Wn),ae(n,"%",xl),ae(n,"|",yu),ae(n,"+",bu),ae(n,"#",vu),ae(n,"?",Sl),ae(n,'"',jh),ae(n,"/",wr),ae(n,";",zh),ae(n,"~",Cl),ae(n,"_",ku),ae(n,"\\",fu),ae(n,"・",cE);const r=Nt(n,Ur,Lh,{[Dp]:!0});Nt(r,Ur,r);const i=Nt(r,$r,lE,{[kl]:!0}),s=Nt(r,al,aE,{[ml]:!0}),l=Nt(n,$r,Hr,{[Pp]:!0});Nt(l,Ur,i),Nt(l,$r,l),Nt(i,Ur,i),Nt(i,$r,i);const c=Nt(n,al,zp,{[Bp]:!0});Nt(c,$r),Nt(c,Ur,s),Nt(c,al,c),Nt(s,Ur,s),Nt(s,$r),Nt(s,al,s);const u=ae(n,ip,Dh,{[tp]:!0}),f=ae(n,Bb,Up,{[tp]:!0}),p=Nt(n,rp,Up,{[tp]:!0});ae(n,sp,p),ae(f,ip,u),ae(f,sp,p),Nt(f,rp,p),ae(p,Bb),ae(p,ip),Nt(p,rp,p),ae(p,sp,p);const h=Nt(n,np,uE,{[oE]:!0});ae(h,"#"),Nt(h,np,h),ae(h,IM,h);const g=ae(h,LM);ae(g,"#"),Nt(g,np,h);const y=[[$r,l],[Ur,i]],k=[[$r,null],[al,c],[Ur,s]];for(let w=0;w<uc.length;w++)yi(n,uc[w],Fp,Hr,y);for(let w=0;w<dc.length;w++)yi(n,dc[w],$p,zp,k);hs(Fp,{tld:!0,ascii:!0},e),hs($p,{utld:!0,alpha:!0},e),yi(n,"file",Mc,Hr,y),yi(n,"mailto",Mc,Hr,y),yi(n,"http",oo,Hr,y),yi(n,"https",oo,Hr,y),yi(n,"ftp",oo,Hr,y),yi(n,"ftps",oo,Hr,y),hs(Mc,{scheme:!0,ascii:!0},e),hs(oo,{slashscheme:!0,ascii:!0},e),t=t.sort((w,x)=>w[0]>x[0]?1:-1);for(let w=0;w<t.length;w++){const x=t[w][0],N=t[w][1]?{[MM]:!0}:{[AM]:!0};x.indexOf("-")>=0?N[jp]=!0:$r.test(x)?Ur.test(x)?N[kl]=!0:N[Pp]=!0:N[Dp]=!0,Pb(n,x,x,N)}return Pb(n,"localhost",Pl,{ascii:!0}),n.jd=new Nn(Eu),{start:n,tokens:Object.assign({groups:e},dE)}}function fE(t,e){const n=PM(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,u=null,f=0,p=null,h=-1,g=-1;for(;l<r&&(u=c.go(n[l]));)c=u,c.accepts()?(h=0,g=0,p=c):h>=0&&(h+=n[l].length,g++),f+=n[l].length,s+=n[l].length,l++;s-=h,l-=g,f-=h,i.push({t:p.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function PM(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,l=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(l),r+=l.length}return e}function yi(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new Nn(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new Nn(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function jb(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let l=parseInt(t.substring(r,r+s),10);l>0;l--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Bl={defaultProtocol:"http",events:null,format:zb,formatHref:zb,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Fh(t,e=null){let n=Object.assign({},Bl);t&&(n=Object.assign(n,t instanceof Fh?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Fh.prototype={o:Bl,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Bl[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function zb(t){return t}function pE(t,e){this.t="token",this.v=t,this.tk=e}pE.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Bl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),l={},c=t.get("className",n,e),u=t.get("target",n,e),f=t.get("rel",n,e),p=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),u&&(l.target=u),f&&(l.rel=f),p&&Object.assign(l,p),{tagName:i,attributes:l,content:s,eventListeners:h}}};function Uu(t,e){class n extends pE{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Fb=Uu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$b=Uu("text"),BM=Uu("nl"),fc=Uu("url",{isLink:!0,toHref(t=Bl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Pl&&t[1].t===xi}}),Hn=t=>new Nn(t);function jM({groups:t}){const e=t.domain.concat([cu,du,ki,fu,pu,hu,mu,gu,Wn,Lh,xl,yu,bu,vu,wr,Eu,Cl,ku]),n=[uu,xi,Ph,Er,Bh,xl,Sl,jh,zh,Zc,eu,El,wl,Jc,Yc,Qc,Xc,tu,nu,ru,iu,su,ou,lu,au],r=[cu,uu,du,fu,pu,hu,mu,gu,Wn,El,wl,xl,yu,bu,vu,Sl,wr,Eu,Cl,ku],i=Hn(),s=ae(i,Cl);$e(s,r,s),$e(s,t.domain,s);const l=Hn(),c=Hn(),u=Hn();$e(i,t.domain,l),$e(i,t.scheme,c),$e(i,t.slashscheme,u),$e(l,r,s),$e(l,t.domain,l);const f=ae(l,ki);ae(s,ki,f),ae(c,ki,f),ae(u,ki,f);const p=ae(s,Er);$e(p,r,s),$e(p,t.domain,s);const h=Hn();$e(f,t.domain,h),$e(h,t.domain,h);const g=ae(h,Er);$e(g,t.domain,h);const y=Hn(Fb);$e(g,t.tld,y),$e(g,t.utld,y),ae(f,Pl,y);const k=ae(h,Wn);ae(k,Wn,k),$e(k,t.domain,h),$e(y,t.domain,h),ae(y,Er,g),ae(y,Wn,k);const w=ae(y,xi);$e(w,t.numeric,Fb);const x=ae(l,Wn),C=ae(l,Er);ae(x,Wn,x),$e(x,t.domain,l),$e(C,r,s),$e(C,t.domain,l);const N=Hn(fc);$e(C,t.tld,N),$e(C,t.utld,N),$e(N,t.domain,l),$e(N,r,s),ae(N,Er,C),ae(N,Wn,x),ae(N,ki,f);const I=ae(N,xi),P=Hn(fc);$e(I,t.numeric,P);const O=Hn(fc),R=Hn();$e(O,e,O),$e(O,n,R),$e(R,e,O),$e(R,n,R),ae(N,wr,O),ae(P,wr,O);const $=ae(c,xi),te=ae(u,xi),le=ae(te,wr),ee=ae(le,wr);$e(c,t.domain,l),ae(c,Er,C),ae(c,Wn,x),$e(u,t.domain,l),ae(u,Er,C),ae(u,Wn,x),$e($,t.domain,O),ae($,wr,O),ae($,Sl,O),$e(ee,t.domain,O),$e(ee,e,O),ae(ee,wr,O);const Q=[[El,wl],[Yc,Jc],[Qc,Xc],[Zc,eu],[tu,nu],[ru,iu],[su,ou],[lu,au]];for(let H=0;H<Q.length;H++){const[K,U]=Q[H],G=ae(O,K);ae(R,K,G),ae(G,U,O);const ie=Hn(fc);$e(G,e,ie);const me=Hn();$e(G,n),$e(ie,e,ie),$e(ie,n,me),$e(me,e,ie),$e(me,n,me),ae(ie,U,O),ae(me,U,O)}return ae(i,Pl,N),ae(i,Dh,BM),{start:i,tokens:dE}}function zM(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,u=null,f=null,p=0,h=null,g=-1;for(;i<r&&!(u=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(f=u||c.go(n[i].t));)u=null,c=f,c.accepts()?(g=0,h=c):g>=0&&g++,i++,p++;if(g<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(op($b,e,l)),l=[]),i-=g,p-=g;const y=h.t,k=n.slice(i-p,i);s.push(op(y,e,k))}}return l.length>0&&s.push(op($b,e,l)),s}function op(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const FM=typeof console<"u"&&console&&console.warn||(()=>{}),$M="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ht={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function UM(){return Nn.groups={},ht.scanner=null,ht.parser=null,ht.tokenQueue=[],ht.pluginQueue=[],ht.customSchemes=[],ht.initialized=!1,ht}function Ub(t,e=!1){if(ht.initialized&&FM(`linkifyjs: already initialized - will not register custom scheme "${t}" ${$M}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
157
+ 1. Must only contain digits, lowercase ASCII letters or "-"
158
+ 2. Cannot start or end with "-"
159
+ 3. "-" cannot repeat`);ht.customSchemes.push([t,e])}function HM(){ht.scanner=DM(ht.customSchemes);for(let t=0;t<ht.tokenQueue.length;t++)ht.tokenQueue[t][1]({scanner:ht.scanner});ht.parser=jM(ht.scanner.tokens);for(let t=0;t<ht.pluginQueue.length;t++)ht.pluginQueue[t][1]({scanner:ht.scanner,parser:ht.parser});return ht.initialized=!0,ht}function $h(t){return ht.initialized||HM(),zM(ht.parser.start,t,fE(ht.scanner.start,t))}$h.scan=fE;function hE(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Fh(n),i=$h(t),s=[];for(let l=0;l<i.length;l++){const c=i[l];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}var Uh="[\0-   ᠎ -\u2029  ]",WM=new RegExp(Uh),VM=new RegExp(`${Uh}$`),KM=new RegExp(Uh,"g");function qM(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function GM(t){return new it({key:new ut("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=Sh(n.doc,[...e]);if(_h(c).forEach(({newRange:f})=>{const p=_k(r.doc,f,y=>y.isTextblock);let h,g;if(p.length>1)h=p[0],g=r.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ");else if(p.length){const y=r.doc.textBetween(f.from,f.to," "," ");if(!VM.test(y))return;h=p[0],g=r.doc.textBetween(h.pos,f.to,void 0," ")}if(h&&g){const y=g.split(WM).filter(Boolean);if(y.length<=0)return!1;const k=y[y.length-1],w=h.pos+g.lastIndexOf(k);if(!k)return!1;const x=$h(k).map(C=>C.toObject(t.defaultProtocol));if(!qM(x))return!1;x.filter(C=>C.isLink).map(C=>({...C,from:w+C.start+1,to:w+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{Th(C.from,C.to,r.doc).some(N=>N.mark.type===t.type)||l.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!l.steps.length)return l}})}function YM(t){return new it({key:new ut("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{const u=r.target;if(!u)return!1;const f=t.editor.view.dom;l=u.closest("a"),l&&!f.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=Lk(e.state,t.type.name),f=(i=l.href)!=null?i:u.href,p=(s=l.target)!=null?s:u.target;f&&(window.open(f,p),c=!0)}return c}}})}function JM(t){return new it({key:new ut("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:l}=s,{empty:c}=l;if(c)return!1;let u="";r.content.forEach(p=>{u+=p.textContent});const f=hE(u,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===u);return!u||!f||i!==void 0&&!i(f.value)?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function cs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(KM,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var mE=lr.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"){Ub(t);return}Ub(t.scheme,t.optionalSlashes)})},onDestroy(){UM()},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)=>!!cs(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 i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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=>!!cs(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=>!!cs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",tt(this.options.HTMLAttributes,t),0]:["a",tt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const l=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",u=e.renderChildren(t);return c?`[${u}](${l} "${c}")`:`[${u}](${l})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!cs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!cs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Di({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=hE(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!cs(l,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.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(GM({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!cs(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(YM({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(JM({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),QM=mE;function XM(t={}){return new it({view(e){return new ZM(e,t)}})}class ZM{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=l=>{this[i](l)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let h=e.nodeBefore,g=e.nodeAfter;if(h||g){let y=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(y){let k=y.getBoundingClientRect(),w=h?k.bottom:k.top;h&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*c;r={left:k.left,right:k.right,top:w-x,bottom:w+x}}}}if(!r){let h=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*l;r={left:h.left-g,right:h.left+g,top:h.top,bottom:h.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.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 f,p;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,p=-pageYOffset;else{let h=u.getBoundingClientRect(),g=h.width/u.offsetWidth,y=h.height/u.offsetHeight;f=h.left-u.scrollLeft*g,p=h.top-u.scrollTop*y}this.element.style.left=(r.left-f)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=vv(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class _t extends Le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return _t.valid(r)?new _t(r):Le.near(r)}content(){return he.empty}eq(e){return e instanceof _t&&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 _t(e.resolve(n.pos))}getBookmark(){return new Hh(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!eA(e)||!tA(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&_t.valid(e))return e;let i=e.pos,s=null;for(let l=e.depth;;l--){let c=e.node(l);if(n>0?e.indexAfter(l)<c.childCount:e.index(l)>0){s=c.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=n;let u=e.doc.resolve(i);if(_t.valid(u))return u}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Me.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=l,i+=n;let c=e.doc.resolve(i);if(_t.valid(c))return c}return null}}}_t.prototype.visible=!1;_t.findFrom=_t.findGapCursorFrom;Le.jsonID("gapcursor",_t);class Hh{constructor(e){this.pos=e}map(e){return new Hh(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return _t.valid(n)?new _t(n):Le.near(n)}}function gE(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function eA(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||gE(i.type))return!0;if(i.inlineContent)return!1}}return!0}function tA(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||gE(i.type))return!0;if(i.inlineContent)return!1}}return!0}function nA(){return new it({props:{decorations:oA,createSelectionBetween(t,e,n){return e.pos==n.pos&&_t.valid(n)?new _t(n):null},handleClick:iA,handleKeyDown:rA,handleDOMEvents:{beforeinput:sA}}})}const rA=kh({ArrowLeft:pc("horiz",-1),ArrowRight:pc("horiz",1),ArrowUp:pc("vert",-1),ArrowDown:pc("vert",1)});function pc(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let l=r.selection,c=e>0?l.$to:l.$from,u=l.empty;if(l instanceof Ae){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=_t.findGapCursorFrom(c,e,u);return f?(i&&i(r.tr.setSelection(new _t(f))),!0):!1}}function iA(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!_t.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Me.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new _t(r))),!0)}function sA(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof _t))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=J.empty;for(let l=r.length-1;l>=0;l--)i=J.from(r[l].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new he(i,0,0));return s.setSelection(Ae.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function oA(t){if(!(t.selection instanceof _t))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",rt.create(t.doc,[yt.widget(t.selection.head,e,{key:"gapcursor"})])}var wu=200,Kt=function(){};Kt.prototype.append=function(e){return e.length?(e=Kt.from(e),!this.length&&e||e.length<wu&&this.leafAppend(e)||this.length<wu&&e.leafPrepend(this)||this.appendInner(e)):this};Kt.prototype.prepend=function(e){return e.length?Kt.from(e).append(this):this};Kt.prototype.appendInner=function(e){return new lA(this,e)};Kt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Kt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Kt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Kt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Kt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(e(s,l))},n,r),i};Kt.from=function(e){return e instanceof Kt?e:e&&e.length?new yE(e):Kt.empty};var yE=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,l,c){for(var u=s;u<l;u++)if(i(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var u=s-1;u>=l;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=wu)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=wu)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Kt);Kt.empty=new yE([]);var lA=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,l){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),l)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,l+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,l)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Kt);const aA=500;class ir{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=e.tr,c,u,f=[],p=[];return this.items.forEach((h,g)=>{if(!h.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,p.push(h);return}if(i){p.push(new xr(h.map));let y=h.step.map(i.slice(s)),k;y&&l.maybeStep(y).doc&&(k=l.mapping.maps[l.mapping.maps.length-1],f.push(new xr(k,void 0,void 0,f.length+p.length))),s--,k&&i.appendMap(k,s)}else l.maybeStep(h.step);if(h.selection)return c=i?h.selection.map(i.slice(s)):h.selection,u=new ir(this.items.slice(0,r).append(p.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let h=e.steps[p].invert(e.docs[p]),g=new xr(e.mapping.maps[p],h,n),y;(y=u&&u.merge(g))&&(g=y,p?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(u=g)}let f=l-r.depth;return f>uA&&(c=cA(c,f),l-=f),new ir(c.append(s),l)}remapping(e,n){let r=new Ml;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new ir(this.items.append(e.map(n=>new xr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,l=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let u=n;this.items.forEach(g=>{let y=s.getMirror(--u);if(y==null)return;l=Math.min(l,y);let k=s.maps[y];if(g.step){let w=e.steps[y].invert(e.docs[y]),x=g.selection&&g.selection.map(s.slice(u+1,y));x&&c++,r.push(new xr(k,w,x))}else r.push(new xr(k))},i);let f=[];for(let g=n;g<l;g++)f.push(new xr(s.maps[g]));let p=this.items.slice(0,i).append(f).append(r),h=new ir(p,c);return h.emptyItemCount()>aA&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((l,c)=>{if(c>=e)i.push(l),l.selection&&s++;else if(l.step){let u=l.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let h=new xr(f.invert(),u,p),g,y=i.length-1;(g=i.length&&i[y].merge(h))?i[y]=g:i.push(h)}}else l.map&&r--},this.items.length,0),new ir(Kt.from(i.reverse()),s)}}ir.empty=new ir(Kt.empty,0);function cA(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class xr{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new xr(n.getMap().invert(),n,this.selection)}}}class Ei{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const uA=20;function dA(t,e,n,r){let i=n.getMeta(vs),s;if(i)return i.historyState;n.getMeta(hA)&&(t=new Ei(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(vs))return l.getMeta(vs).redo?new Ei(t.done.addTransform(n,void 0,r,Ac(e)),t.undone,Hb(n.mapping.maps),t.prevTime,t.prevComposition):new Ei(t.done,t.undone.addTransform(n,void 0,r,Ac(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!fA(n,t.prevRanges)),f=l?lp(t.prevRanges,n.mapping):Hb(n.mapping.maps);return new Ei(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Ac(e)),ir.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Ei(t.done.rebased(n,s),t.undone.rebased(n,s),lp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ei(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),lp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function fA(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Hb(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,l)=>e.push(s,l));return e}function lp(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function pA(t,e,n){let r=Ac(e),i=vs.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new Ei(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(vs,{redo:n,historyState:u})}let ap=!1,Wb=null;function Ac(t){let e=t.plugins;if(Wb!=e){ap=!1,Wb=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ap=!0;break}}return ap}const vs=new ut("history"),hA=new ut("closeHistory");function mA(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new it({key:vs,state:{init(){return new Ei(ir.empty,ir.empty,null,0,-1)},apply(e,n,r){return dA(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?vE:r=="historyRedo"?kE:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function bE(t,e){return(n,r)=>{let i=vs.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=pA(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const vE=bE(!1,!0),kE=bE(!0,!0);Xe.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 r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new it({key:new ut("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const l=s-i,c=0,u=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const f=r.tr.deleteRange(c,u);return t=!0,f}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=s-r,f=c-u,p=c;return e.deleteRange(f,p),!(this.storage.characters({node:e.doc})>r)}})]}});var gA=Xe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[XM(this.options)]}});Xe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new it({key:new ut("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return rt.create(t,[]);let l=0;this.options.mode==="deepest"&&t.descendants((u,f)=>{if(u.isText)return;if(!(i>=f&&i<=f+u.nodeSize-1))return!1;l+=1});let c=0;return t.descendants((u,f)=>{if(u.isText||!(i>=f&&i<=f+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&l-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";s.push(yt.node(f,f+u.nodeSize,{class:this.options.className}))}),rt.create(t,s)}}})]}});var yA=Xe.create({name:"gapCursor",addProseMirrorPlugins(){return[nA()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=et(Te(t,"allowGapCursor",n)))!=null?e:null}}}),Vb="placeholder";function bA(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var vA=Xe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Vb,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${bA(this.options.dataAttribute)}`:`data-${Vb}`;return[new it({key:new ut("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,s=[];if(!r)return null;const l=this.editor.isEmpty;return e.descendants((c,u)=>{const f=i>=u&&i<=u+c.nodeSize,p=!c.isLeaf&&Fu(c);if((f||!this.options.showOnlyCurrent)&&p){const h=[this.options.emptyNodeClass];l&&h.push(this.options.emptyEditorClass);const g=yt.node(u,u+c.nodeSize,{class:h.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:f}):this.options.placeholder});s.push(g)}return this.options.includeChildren}),rt.create(e,s)}}})]}});Xe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new it({key:new ut("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Dk(n.selection)||t.view.dragging?null:rt.create(n.doc,[yt.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Kb({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var kA=Xe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ut(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new it({key:e,appendTransaction:(i,s,l)=>{const{doc:c,tr:u,schema:f}=l,p=e.getState(l),h=c.content.size,g=f.nodes[n];if(p)return u.insert(h,g.create())},state:{init:(i,s)=>{const l=s.tr.doc.lastChild;return!Kb({node:l,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const l=i.doc.lastChild;return!Kb({node:l,types:r})}}})]}}),EA=Xe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>vE(t,e),redo:()=>({state:t,dispatch:e})=>kE(t,e)}},addProseMirrorPlugins(){return[mA(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()}}}),wA=vA,xA=lr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),SA=xA,CA=lr.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),NA=CA;let Hp,Wp;if(typeof WeakMap<"u"){let t=new WeakMap;Hp=e=>t.get(e),Wp=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Hp=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Wp=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Tt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,l=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;l<this.height&&this.map[e+this.width*c]==n;c++)l++;return{left:r,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:l==this.height)?null:this.map[r+this.width*(n<0?s-1:l)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:l,right:c,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,u),right:Math.max(r,c),bottom:Math.max(s,f)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==t.left&&i&&this.map[s-1]==l||r==t.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let l=e+t*this.width;const c=(t+1)*this.width;for(;l<c&&this.map[l]<i;)l++;return l==c?s-1:this.map[l]}i=s}}static get(t){return Hp(t)||Wp(t,_A(t))}};function _A(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=TA(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let f=0,p=e*n;f<p;f++)r[f]=0;for(let f=0,p=0;f<n;f++){const h=t.child(f);p++;for(let k=0;;k++){for(;i<r.length&&r[i]!=0;)i++;if(k==h.childCount)break;const w=h.child(k),{colspan:x,rowspan:C,colwidth:N}=w.attrs;for(let I=0;I<C;I++){if(I+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:p,n:C-I});break}const P=i+I*e;for(let O=0;O<x;O++){r[P+O]==0?r[P+O]=p:(s||(s=[])).push({type:"collision",row:f,pos:p,n:x-O});const R=N&&N[O];if(R){const $=(P+O)%e*2,te=l[$];te==null||te!=R&&l[$+1]==1?(l[$]=R,l[$+1]=1):te==R&&l[$+1]++}}}i+=x,p+=w.nodeSize}const g=(f+1)*e;let y=0;for(;i<g;)r[i++]==0&&y++;y&&(s||(s=[])).push({type:"missing",row:f,n:y}),p++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Tt(e,n,r,s);let u=!1;for(let f=0;!u&&f<l.length;f+=2)l[f]!=null&&l[f+1]<n&&(u=!0);return u&&MA(c,l,t),c}function TA(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let l=0;l<r;l++){const c=t.child(l);for(let u=0;u<c.childCount;u++){const f=c.child(u);l+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const c=i.child(l);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function MA(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let c=null;const u=l.attrs;for(let f=0;f<u.colspan;f++){const p=e[(i+f)%t.width*2];p!=null&&(!u.colwidth||u.colwidth[f]!=p)&&((c||(c=AA(u)))[f]=p)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function AA(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function an(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Si=new ut("selectingCells");function Cs(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 OA(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 ar(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 Hu(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=Cs(e.$head)||RA(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function RA(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Vp(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function IA(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Wh(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function EE(t,e,n){const r=t.node(-1),i=Tt.get(r),s=t.start(-1),l=i.nextCell(t.pos-s,e,n);return l==null?null:t.node(0).resolve(s+l)}function Ns(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function wE(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function LA(t,e,n){const r=an(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var ct=class Wr extends Le{constructor(e,n=e){const r=e.node(-1),i=Tt.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),u=i.cellsInRect(l).filter(p=>p!=n.pos-s);u.unshift(n.pos-s);const f=u.map(p=>{const h=r.nodeAt(p);if(!h)throw new RangeError(`No cell with offset ${p} found`);const g=s+p+1;return new Sv(c.resolve(g),c.resolve(g+h.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Vp(r)&&Vp(i)&&Wh(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Wr.rowSelection(r,i):s&&this.isColSelection()?Wr.colSelection(r,i):new Wr(r,i)}return Ae.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Tt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let p=u*n.width+i.left,h=i.left;h<i.right;h++,p++){const g=n.map[p];if(s[g])continue;s[g]=!0;const y=n.findCell(g);let k=e.nodeAt(g);if(!k)throw new RangeError(`No cell with offset ${g} found`);const w=i.left-y.left,x=y.right-i.right;if(w>0||x>0){let C=k.attrs;if(w>0&&(C=Ns(C,0,w)),x>0&&(C=Ns(C,C.colspan-x,x)),y.left<i.left){if(k=k.type.createAndFill(C),!k)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else k=k.type.create(C,k.content)}if(y.top<i.top||y.bottom>i.bottom){const C={...k.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top<i.top?k=k.type.createAndFill(C):k=k.type.create(C,k.content)}f.push(k)}l.push(e.child(u).copy(J.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new he(J.from(c),1,1)}replace(e,n=he.empty){const r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:c,$to:u}=i[l],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(u.pos),l?he.empty:n)}const s=Le.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new he(J.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Tt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)e(n.nodeAt(s[l]),i+s[l])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Tt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.top<=c.top?(l.top>0&&(e=u.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=u.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new Wr(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Tt.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,c=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,c)==n.width}eq(e){return e instanceof Wr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Tt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.left<=c.left?(l.left>0&&(e=u.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=u.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=u.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=u.resolve(s+i.map[i.width*(l.top+1)-1]))),new Wr(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Wr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Wr(e.resolve(n),e.resolve(r))}getBookmark(){return new DA(this.$anchorCell.pos,this.$headCell.pos)}};ct.prototype.visible=!1;Le.jsonID("cell",ct);var DA=class xE{constructor(e,n){this.anchor=e,this.head=n}map(e){return new xE(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Wh(n,r)?new ct(n,r):Le.near(r,1)}};function PA(t){if(!(t.selection instanceof ct))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(yt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),rt.create(t.doc,e)}function BA({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function jA({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function zA(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,l;if(r instanceof Me&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=ct.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=ct.rowSelection(c,c)}else if(!n){const c=Tt.get(r.node),u=r.from+1,f=u+c.map[c.width*c.height-1];s=ct.create(i,u+1,f)}}else r instanceof Ae&&BA(r)?s=Ae.create(i,r.from):r instanceof Ae&&jA(r)&&(s=Ae.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const FA=new ut("fix-tables");function SE(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const u=e.child(l);for(let f=c,p=Math.min(i,l+3);f<p;f++)if(t.child(f)==u){c=f+1,n+=u.nodeSize;continue e}r(u,n),c<i&&t.child(c).sameMarkup(u)?SE(t.child(c),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function CE(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=$A(t,i,s,n))};return e?e.doc!=t.doc&&SE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function $A(t,e,n,r){const i=Tt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const p=e.nodeAt(f.pos);if(!p)continue;const h=p.attrs;for(let g=0;g<h.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,Ns(h,h.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const p=e.nodeAt(f.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const p=e.nodeAt(f.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...p.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const p=r.mapping.map(n);r.delete(p,p+e.nodeSize)}}let l,c;for(let u=0;u<s.length;u++)s[u]&&(l==null&&(l=u),c=u);for(let u=0,f=n+1;u<i.height;u++){const p=e.child(u),h=f+p.nodeSize,g=s[u];if(g>0){let y="cell";p.firstChild&&(y=p.firstChild.type.spec.tableRole);const k=[];for(let x=0;x<g;x++){const C=an(t.schema)[y].createAndFill();C&&k.push(C)}const w=(u==0||l==u-1)&&c==u?f+1:h-1;r.insert(r.mapping.map(w),k)}f=h}return r.setMeta(FA,{fixTables:!0})}function Nr(t){const e=t.selection,n=Hu(t),r=n.node(-1),i=n.start(-1),s=Tt.get(r);return{...e instanceof ct?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function NE(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;LA(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const c=l*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const u=e.map[c],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,wE(f.attrs,i-e.colCount(u))),l+=f.attrs.rowspan-1}else{const u=s==null?an(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(l,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function UA(t,e){if(!ar(t))return!1;if(e){const n=Nr(t);e(NE(t.tr,n,n.left))}return!0}function HA(t,e){if(!ar(t))return!1;if(e){const n=Nr(t);e(NE(t.tr,n,n.right))}return!0}function WA(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let l=0;l<e.height;){const c=l*e.width+i,u=e.map[c],f=n.nodeAt(u),p=f.attrs;if(i>0&&e.map[c-1]==u||i<e.width-1&&e.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Ns(p,i-e.colCount(u)));else{const h=t.mapping.slice(s).map(r+u);t.delete(h,h+f.nodeSize)}l+=p.rowspan}}function VA(t,e){if(!ar(t))return!1;if(e){const n=Nr(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;WA(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Tt.get(s)}e(r)}return!0}function KA(t,e,n){var r;const i=an(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function _E(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const l=[];let c=i>0?-1:0;KA(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let f=0,p=e.width*i;f<e.width;f++,p++)if(i>0&&i<e.height&&e.map[p]==e.map[p-e.width]){const h=e.map[p],g=r.nodeAt(h).attrs;t.setNodeMarkup(n+h,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const h=c==null?an(r.type.schema).cell:(u=r.nodeAt(e.map[p+c*e.width]))===null||u===void 0?void 0:u.type,g=h==null?void 0:h.createAndFill();g&&l.push(g)}return t.insert(s,an(r.type.schema).row.create(null,l)),t}function qA(t,e){if(!ar(t))return!1;if(e){const n=Nr(t);e(_E(t.tr,n,n.top))}return!0}function GA(t,e){if(!ar(t))return!1;if(e){const n=Nr(t);e(_E(t.tr,n,n.bottom))}return!0}function YA(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const u=new Set;for(let f=0,p=i*e.width;f<e.width;f++,p++){const h=e.map[p];if(!u.has(h)){if(u.add(h),i>0&&h==e.map[p-e.width]){const g=n.nodeAt(h).attrs;t.setNodeMarkup(t.mapping.slice(c).map(h+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&h==e.map[p+e.width]){const g=n.nodeAt(h),y=g.attrs,k=g.type.create({...y,rowspan:g.attrs.rowspan-1},g.content),w=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+w),k),f+=y.colspan-1}}}}function JA(t,e){if(!ar(t))return!1;if(e){const n=Nr(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;YA(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Tt.get(n.table)}e(r)}return!0}function qb(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function QA({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,l=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[c]==n[c+1])return!0;s+=t,c+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function Gb(t,e){const n=t.selection;if(!(n instanceof ct)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Nr(t),{map:i}=r;if(QA(i,r))return!1;if(e){const s=t.tr,l={};let c=J.empty,u,f;for(let p=r.top;p<r.bottom;p++)for(let h=r.left;h<r.right;h++){const g=i.map[p*i.width+h],y=r.table.nodeAt(g);if(!(l[g]||!y))if(l[g]=!0,u==null)u=g,f=y;else{qb(y)||(c=c.append(y.content));const k=s.mapping.map(g+r.tableStart);s.delete(k,k+y.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...wE(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const p=u+1+f.content.size,h=qb(f)?u+1:p;s.replaceWith(h+r.tableStart,p+r.tableStart,c)}s.setSelection(new ct(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function Yb(t,e){const n=an(t.schema);return XA(({node:r})=>n[r.type.spec.tableRole])(t,e)}function XA(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof ct){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=OA(r.$from),!i)return!1;s=(l=Cs(r.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const u=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const p=Nr(e),h=e.tr;for(let y=0;y<p.right-p.left;y++)u.push(f?{...c,colwidth:f&&f[y]?[f[y]]:null}:c);let g;for(let y=p.top;y<p.bottom;y++){let k=p.map.positionAt(y,p.left,p.table);y==p.top&&(k+=i.nodeSize);for(let w=p.left,x=0;w<p.right;w++,x++)w==p.left&&y==p.top||h.insert(g=h.mapping.map(k+p.tableStart,1),t({node:i,row:y,col:w}).createAndFill(u[x]))}h.setNodeMarkup(s,t({node:i,row:p.top,col:p.left}),u[0]),r instanceof ct&&h.setSelection(new ct(h.doc.resolve(r.$anchorCell.pos),g?h.doc.resolve(g):void 0)),n(h)}return!0}}function ZA(t,e){return function(n,r){if(!ar(n))return!1;const i=Hu(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof ct?n.selection.forEachCell((l,c)=>{l.attrs[t]!==e&&s.setNodeMarkup(c,null,{...l.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function eO(t){return function(e,n){if(!ar(e))return!1;if(n){const r=an(e.schema),i=Nr(e),s=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=l.map(u=>i.table.nodeAt(u));for(let u=0;u<l.length;u++)c[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[u],r.cell,c[u].attrs);if(s.steps.length===0)for(let u=0;u<l.length;u++)s.setNodeMarkup(i.tableStart+l[u],r.header_cell,c[u].attrs);n(s)}return!0}}function Jb(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function jl(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?eO(t):function(n,r){if(!ar(n))return!1;if(r){const i=an(n.schema),s=Nr(n),l=n.tr,c=Jb("row",s,i),u=Jb("column",s,i),f=(t==="column"?c:t==="row"&&u)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,h=t=="column"?u?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const y=g+s.tableStart,k=l.doc.nodeAt(y);k&&l.setNodeMarkup(y,h,k.attrs)}),r(l)}return!0}}jl("row",{useDeprecatedLogic:!0});jl("column",{useDeprecatedLogic:!0});const tO=jl("cell",{useDeprecatedLogic:!0});function nO(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Qb(t){return function(e,n){if(!ar(e))return!1;const r=nO(Hu(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Ae.between(i,IA(i))).scrollIntoView())}return!0}}function rO(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function hc(t,e){const n=t.selection;if(!(n instanceof ct))return!1;if(e){const r=t.tr,i=an(t.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new he(i,0,0))}),r.docChanged&&e(r)}return!0}function iO(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,l=i.type.schema,c=[];if(s=="row")for(let u=0;u<e.childCount;u++){let f=e.child(u).content;const p=u?0:Math.max(0,n-1),h=u<e.childCount-1?0:Math.max(0,r-1);(p||h)&&(f=Kp(an(l).row,new he(f,p,h)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?Kp(an(l).row,new he(e,n,r)).content:e);else return null;return sO(l,c)}function sO(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:c,colspan:u}=s.child(l).attrs;for(let f=i;f<i+c;f++)n[f]=(n[f]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(J.empty),n[i]<r){const s=an(t).cell.createAndFill(),l=[];for(let c=n[i];c<r;c++)l.push(s);e[i]=e[i].append(J.from(l))}return{height:e.length,width:r,rows:e}}function Kp(t,e){const n=t.createAndFill();return new ih(n).replace(0,n.content.size,e).doc}function oO({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const u=n[c],f=[];for(let p=s[c]||0,h=0;p<r;h++){let g=u.child(h%u.childCount);p+g.attrs.colspan>r&&(g=g.type.createChecked(Ns(g.attrs,g.attrs.colspan,p+g.attrs.colspan-r),g.content)),f.push(g),p+=g.attrs.colspan;for(let y=1;y<g.attrs.rowspan;y++)s[c+y]=(s[c+y]||0)+g.attrs.colspan}l.push(J.from(f))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const u=[],f=n[c%e];for(let p=0;p<f.childCount;p++){let h=f.child(p);l+h.attrs.rowspan>i&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,i-h.attrs.rowspan)},h.content)),u.push(h)}s.push(J.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function lO(t,e,n,r,i,s,l){const c=t.doc.type.schema,u=an(c);let f,p;if(i>e.width)for(let h=0,g=0;h<e.height;h++){const y=n.child(h);g+=y.nodeSize;const k=[];let w;y.lastChild==null||y.lastChild.type==u.cell?w=f||(f=u.cell.createAndFill()):w=p||(p=u.header_cell.createAndFill());for(let x=e.width;x<i;x++)k.push(w);t.insert(t.mapping.slice(l).map(g-1+r),k)}if(s>e.height){const h=[];for(let k=0,w=(e.height-1)*e.width;k<Math.max(e.width,i);k++){const x=k>=e.width?!1:n.nodeAt(e.map[w+k]).type==u.header_cell;h.push(x?p||(p=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,J.from(h)),y=[];for(let k=e.height;k<s;k++)y.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),y)}return!!(f||p)}function Xb(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const p=l*e.width+f,h=e.map[p];if(e.map[p-e.width]==h){u=!0;const g=n.nodeAt(h),{top:y,left:k}=e.findCell(h);t.setNodeMarkup(t.mapping.slice(c).map(h+r),null,{...g.attrs,rowspan:l-y}),t.insert(t.mapping.slice(c).map(e.positionAt(l,k,n)),g.type.createAndFill({...g.attrs,rowspan:y+g.attrs.rowspan-l})),f+=g.attrs.colspan-1}}return u}function Zb(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const p=f*e.width+l,h=e.map[p];if(e.map[p-1]==h){u=!0;const g=n.nodeAt(h),y=e.colCount(h),k=t.mapping.slice(c).map(h+r);t.setNodeMarkup(k,null,Ns(g.attrs,l-y,g.attrs.colspan-(l-y))),t.insert(k+g.nodeSize,g.type.createAndFill(Ns(g.attrs,0,l-y))),f+=g.attrs.rowspan-1}}return u}function e0(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let l=Tt.get(s);const{top:c,left:u}=r,f=u+i.width,p=c+i.height,h=t.tr;let g=0;function y(){if(s=n?h.doc.nodeAt(n-1):h.doc,!s)throw new Error("No table found");l=Tt.get(s),g=h.mapping.maps.length}lO(h,l,s,n,f,p,g)&&y(),Xb(h,l,s,n,u,f,c,g)&&y(),Xb(h,l,s,n,u,f,p,g)&&y(),Zb(h,l,s,n,c,p,u,g)&&y(),Zb(h,l,s,n,c,p,f,g)&&y();for(let k=c;k<p;k++){const w=l.positionAt(k,u,s),x=l.positionAt(k,f,s);h.replace(h.mapping.slice(g).map(w+n),h.mapping.slice(g).map(x+n),new he(i.rows[k-c],0,0))}y(),h.setSelection(new ct(h.doc.resolve(n+l.positionAt(c,u,s)),h.doc.resolve(n+l.positionAt(p-1,f-1,s)))),e(h)}const aO=kh({ArrowLeft:mc("horiz",-1),ArrowRight:mc("horiz",1),ArrowUp:mc("vert",-1),ArrowDown:mc("vert",1),"Shift-ArrowLeft":gc("horiz",-1),"Shift-ArrowRight":gc("horiz",1),"Shift-ArrowUp":gc("vert",-1),"Shift-ArrowDown":gc("vert",1),Backspace:hc,"Mod-Backspace":hc,Delete:hc,"Mod-Delete":hc});function Oc(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function mc(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof ct)return Oc(n,r,Le.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=TE(i,t,e);if(l==null)return!1;if(t=="horiz")return Oc(n,r,Le.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),u=EE(c,t,e);let f;return u?f=Le.near(u,1):e<0?f=Le.near(n.doc.resolve(c.before(-1)),-1):f=Le.near(n.doc.resolve(c.after(-1)),1),Oc(n,r,f)}}}function gc(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof ct)l=s;else{const u=TE(i,t,e);if(u==null)return!1;l=new ct(n.doc.resolve(u))}const c=EE(l.$headCell,t,e);return c?Oc(n,r,new ct(l.$anchorCell,c)):!1}}function cO(t,e){const n=t.state.doc,r=Cs(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ct(r))),!0):!1}function uO(t,e,n){if(!ar(t.state))return!1;let r=iO(n);const i=t.state.selection;if(i instanceof ct){r||(r={width:1,height:1,rows:[J.from(Kp(an(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=Tt.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=oO(r,c.right-c.left,c.bottom-c.top),e0(t.state,t.dispatch,l,c,r),!0}else if(r){const s=Hu(t.state),l=s.start(-1);return e0(t.state,t.dispatch,l,Tt.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function dO(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=t0(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof ct)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Cs(t.state.selection.$anchor))!=null&&((n=cp(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,f){let p=cp(t,f);const h=Si.getState(t.state)==null;if(!p||!Wh(u,p))if(h)p=u;else return;const g=new ct(u,p);if(h||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);h&&y.setMeta(Si,u.pos),t.dispatch(y)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),Si.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Si,-1))}function c(u){const f=u,p=Si.getState(t.state);let h;if(p!=null)h=t.state.doc.resolve(p);else if(t0(t,f.target)!=r&&(h=cp(t,e),!h))return l();h&&s(h,f)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",c)}function TE(t,e,n){if(!(t.state.selection instanceof Ae))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?l:null}}return null}function t0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function cp(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Cs(t.state.doc.resolve(r))||Cs(t.state.doc.resolve(i))}var fO=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")),qp(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,qp(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function qp(t,e,n,r,i,s){let l=0,c=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let h=0,g=0;h<f.childCount;h++){const{colspan:y,colwidth:k}=f.child(h).attrs;for(let w=0;w<y;w++,g++){const x=i==g?s:k&&k[w],C=x?x+"px":"";if(l+=x||r,x||(c=!1),u)u.style.width!=C&&(u.style.width=C),u=u.nextSibling;else{const N=document.createElement("col");N.style.width=C,e.appendChild(N)}}}for(;u;){var p;const h=u.nextSibling;(p=u.parentNode)===null||p===void 0||p.removeChild(u),u=h}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const In=new ut("tableColumnResizing");function pO({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=fO,lastColumnResizable:i=!0}={}){const s=new it({key:In,state:{init(l,c){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,p=an(c.schema).table.name;return r&&f&&(f[p]=(h,g)=>new r(h,n,g)),new hO(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=In.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{mO(l,c,t,i)},mouseleave:l=>{gO(l)},mousedown:(l,c)=>{yO(l,c,e,n)}},decorations:l=>{const c=In.getState(l);if(c&&c.activeHandle>-1)return wO(l,c.activeHandle)},nodeViews:{}}});return s}var hO=class Rc{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(In);if(r&&r.setHandle!=null)return new Rc(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Rc(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Vp(e.doc.resolve(i))||(i=-1),new Rc(i,n.dragging)}return n}};function mO(t,e,n,r){if(!t.editable)return;const i=In.getState(t.state);if(i&&!i.dragging){const s=vO(e.target);let l=-1;if(s){const{left:c,right:u}=s.getBoundingClientRect();e.clientX-c<=n?l=n0(t,e,"left",n):u-e.clientX<=n&&(l=n0(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),u=c.node(-1),f=Tt.get(u),p=c.start(-1);if(f.colCount(c.pos-p)+c.nodeAfter.attrs.colspan-1==f.width-1)return}ME(t,l)}}}function gO(t){if(!t.editable)return;const e=In.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&ME(t,-1)}function yO(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=In.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),u=bO(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(In,{setDragging:{startX:e.clientX,startWidth:u}}));function f(h){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",p);const g=In.getState(t.state);g!=null&&g.dragging&&(kO(t,g.activeHandle,r0(g.dragging,h,n)),t.dispatch(t.state.tr.setMeta(In,{setDragging:null})))}function p(h){if(!h.which)return f(h);const g=In.getState(t.state);if(g&&g.dragging){const y=r0(g.dragging,h,n);i0(t,g.activeHandle,y,r)}}return i0(t,l.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",p),e.preventDefault(),!0}function bO(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let u=0;u<n;u++)r[u]&&(l-=r[u],c--);return l/c}function vO(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function n0(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:l}=s,c=Cs(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const u=Tt.get(c.node(-1)),f=c.start(-1),p=u.map.indexOf(c.pos-f);return p%u.width==0?-1:f+u.map[p-1]}function r0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function ME(t,e){t.dispatch(t.state.tr.setMeta(In,{setHandle:e}))}function kO(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Tt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const p=f*s.width+c;if(f&&s.map[p]==s.map[p-s.width])continue;const h=s.map[p],g=i.nodeAt(h).attrs,y=g.colspan==1?0:c-s.colCount(h);if(g.colwidth&&g.colwidth[y]==n)continue;const k=g.colwidth?g.colwidth.slice():EO(g.colspan);k[y]=n,u.setNodeMarkup(l+h,null,{...g,colwidth:k})}u.docChanged&&t.dispatch(u)}function i0(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=Tt.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&qp(s,u.firstChild,u,r,c,n)}function EO(t){return Array(t).fill(0)}function wO(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return rt.empty;const s=Tt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const p=c+f*s.width;if((c==s.width-1||s.map[p]!=s.map[p+1])&&(f==0||s.map[p]!=s.map[p-s.width])){var u;const h=s.map[p],g=l+h+i.nodeAt(h).nodeSize-1,y=document.createElement("div");y.className="column-resize-handle",!((u=In.getState(t))===null||u===void 0)&&u.dragging&&n.push(yt.node(l+h,l+h+i.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),n.push(yt.widget(g,y))}}return rt.create(t.doc,n)}function xO({allowTableNodeSelection:t=!1}={}){return new it({key:Si,state:{init(){return null},apply(e,n){const r=e.getMeta(Si);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:PA,handleDOMEvents:{mousedown:dO},createSelectionBetween(e){return Si.getState(e.state)!=null?e.state.selection:null},handleTripleClick:cO,handleKeyDown:aO,handlePaste:uO},appendTransaction(e,n,r){return zA(r,CE(r,n),t)}})}var AE=qt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),i=r?r.split(",").map(s=>parseInt(s,10)):null;if(!i){const s=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),l=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(l&&l>-1&&s&&s[l]){const c=s[l].getAttribute("width");return c?[parseInt(c,10)]:null}}return i}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",tt(this.options.HTMLAttributes,t),0]}}),OE=qt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",tt(this.options.HTMLAttributes,t),0]}}),RE=qt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",tt(this.options.HTMLAttributes,t),0]}});function Gp(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function s0(t,e,n,r,i,s){var l;let c=0,u=!0,f=e.firstChild;const p=t.firstChild;if(p!==null)for(let g=0,y=0;g<p.childCount;g+=1){const{colspan:k,colwidth:w}=p.child(g).attrs;for(let x=0;x<k;x+=1,y+=1){const C=i===y?s:w&&w[x],N=C?`${C}px`:"";if(c+=C||r,C||(u=!1),f){if(f.style.width!==N){const[I,P]=Gp(r,C);f.style.setProperty(I,P)}f=f.nextSibling}else{const I=document.createElement("col"),[P,O]=Gp(r,C);I.style.setProperty(P,O),e.appendChild(I)}}}for(;f;){const g=f.nextSibling;(l=f.parentNode)==null||l.removeChild(f),f=g}const h=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);u&&!h?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}var SO=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")),s0(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,s0(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function CO(t,e,n,r){let i=0,s=!0;const l=[],c=t.firstChild;if(!c)return{};for(let h=0,g=0;h<c.childCount;h+=1){const{colspan:y,colwidth:k}=c.child(h).attrs;for(let w=0;w<y;w+=1,g+=1){const x=n===g?r:k&&k[w];i+=x||e,x||(s=!1);const[C,N]=Gp(e,x);l.push(["col",{style:`${C}: ${N}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:u,tableMinWidth:f}}function o0(t,e){return t.createAndFill()}function NO(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function _O(t,e,n,r,i){const s=NO(t),l=[],c=[];for(let f=0;f<n;f+=1){const p=o0(s.cell);if(p&&c.push(p),r){const h=o0(s.header_cell);h&&l.push(h)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?l:c));return s.table.createChecked(null,u)}function TO(t){return t instanceof ct}var yc=({editor:t})=>{const{selection:e}=t.state;if(!TO(e))return!1;let n=0;const r=Tk(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},MO="";function AO(t){return(t||"").replace(/\s+/g," ").trim()}function OO(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:MO;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(k=>{const w=[];k.content&&k.content.forEach(x=>{let C="";x.content&&Array.isArray(x.content)&&x.content.length>1?C=x.content.map(O=>e.renderChildren(O)).join(i):C=x.content?e.renderChildren(x.content):"";const N=AO(C),I=x.type==="tableHeader";w.push({text:N,isHeader:I})}),s.push(w)});const l=s.reduce((k,w)=>Math.max(k,w.length),0);if(l===0)return"";const c=new Array(l).fill(0);s.forEach(k=>{var w;for(let x=0;x<l;x+=1){const N=(((w=k[x])==null?void 0:w.text)||"").length;N>c[x]&&(c[x]=N),c[x]<3&&(c[x]=3)}});const u=(k,w)=>k+" ".repeat(Math.max(0,w-k.length)),f=s[0],p=f.some(k=>k.isHeader);let h=`
160
+ `;const g=new Array(l).fill(0).map((k,w)=>p&&f[w]&&f[w].text||"");return h+=`| ${g.map((k,w)=>u(k,c[w])).join(" | ")} |
161
+ `,h+=`| ${c.map(k=>"-".repeat(Math.max(3,k))).join(" | ")} |
162
+ `,(p?s.slice(1):s).forEach(k=>{h+=`| ${new Array(l).fill(0).map((w,x)=>u(k[x]&&k[x].text||"",c[x])).join(" | ")} |
163
+ `}),h}var RO=OO,IE=qt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:SO,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=CO(t,this.options.cellMinWidth),s=e.style;function l(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const c=["table",tt(this.options.HTMLAttributes,e,{style:l()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const i=[];r.forEach(s=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>RO(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const l=_O(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(Ae.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>UA(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>HA(t,e),deleteColumn:()=>({state:t,dispatch:e})=>VA(t,e),addRowBefore:()=>({state:t,dispatch:e})=>qA(t,e),addRowAfter:()=>({state:t,dispatch:e})=>GA(t,e),deleteRow:()=>({state:t,dispatch:e})=>JA(t,e),deleteTable:()=>({state:t,dispatch:e})=>rO(t,e),mergeCells:()=>({state:t,dispatch:e})=>Gb(t,e),splitCell:()=>({state:t,dispatch:e})=>Yb(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>jl("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>jl("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>tO(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Gb(t,e)?!0:Yb(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>ZA(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Qb(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Qb(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&CE(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=ct.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:yc,"Mod-Backspace":yc,Delete:yc,"Mod-Delete":yc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[pO({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],xO({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:et(Te(t,"tableRole",e))}}});Xe.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(IE.configure(this.options.table)),this.options.tableCell!==!1&&t.push(AE.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(OE.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(RE.configure(this.options.tableRow)),t}});var IO=Object.defineProperty,LO=(t,e)=>{for(var n in e)IO(t,n,{get:e[n],enumerable:!0})},DO="listItem",l0="textStyle",a0=/^\s*([-+*])\s$/,LE=qt.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",tt(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,`
164
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(DO,this.editor.getAttributes(l0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=bo({find:a0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bo({find:a0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(l0),editor:this.editor})),[t]}}),DE=qt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",tt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const l=t.tokens.slice(1),c=e.parseChildren(l);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Rh(t,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),PO={};LO(PO,{findListItemPos:()=>Wl,getNextListDepth:()=>Vh,handleBackspace:()=>Yp,handleDelete:()=>Jp,hasListBefore:()=>PE,hasListItemAfter:()=>BO,hasListItemBefore:()=>BE,listItemHasSubList:()=>jE,nextListIsDeeper:()=>zE,nextListIsHigher:()=>FE});var Wl=(t,e)=>{const{$from:n}=e.selection,r=Bt(t,e.schema);let i=null,s=n.depth,l=n.pos,c=null;for(;s>0&&c===null;)i=n.node(s),i.type===r?c=s:(s-=1,l-=1);return c===null?null:{$pos:e.doc.resolve(l),depth:c}},Vh=(t,e)=>{const n=Wl(t,e);if(!n)return!1;const[,r]=b_(e,t,n.$pos.pos+4);return r},PE=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},BE=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},jE=(t,e,n)=>{if(!n)return!1;const r=Bt(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},Yp=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Li(t.state,e)&&PE(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),f=[];u.node().descendants((g,y)=>{g.type.name===e&&f.push({node:g,pos:y})});const p=f.at(-1);if(!p)return!1;const h=t.state.doc.resolve(u.start()+p.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},h.end()).joinForward().run()}if(!Li(t.state,e)||!w_(t.state))return!1;const r=Wl(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=jE(e,t.state,s);return BE(e,t.state)&&!l?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},zE=(t,e)=>{const n=Vh(t,e),r=Wl(t,e);return!r||!n?!1:n>r.depth},FE=(t,e)=>{const n=Vh(t,e),r=Wl(t,e);return!r||!n?!1:n<r.depth},Jp=(t,e)=>{if(!Li(t.state,e)||!E_(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:zE(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():FE(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},BO=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},$E=Xe.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&&Jp(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&&Jp(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Yp(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Yp(t,n,r)&&(e=!0)}),e}}}}),c0=/^(\s*)(\d+)\.\s+(.*)$/,jO=/^\s/;function zO(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(c0);if(!s)break;const[,l,c,u]=s,f=l.length;let p=u,h=n+1;const g=[i];for(;h<t.length;){const y=t[h];if(y.match(c0))break;if(y.trim()==="")g.push(y),p+=`
165
+ `,h+=1;else if(y.match(jO))g.push(y),p+=`
166
+ ${y.slice(f+2)}`,h+=1;else break}e.push({indent:f,number:parseInt(c,10),content:p.trim(),raw:g.join(`
167
+ `)}),r=h,n=h}return[e,r]}function UE(t,e,n){var r;const i=[];let s=0;for(;s<t.length;){const l=t[s];if(l.indent===e){const c=l.content.split(`
168
+ `),u=((r=c[0])==null?void 0:r.trim())||"",f=[];u&&f.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const p=c.slice(1).join(`
169
+ `).trim();if(p){const y=n.blockTokens(p);f.push(...y)}let h=s+1;const g=[];for(;h<t.length&&t[h].indent>e;)g.push(t[h]),h+=1;if(g.length>0){const y=Math.min(...g.map(w=>w.indent)),k=UE(g,y,n);f.push({type:"list",ordered:!0,start:g[0].number,items:k,raw:g.map(w=>w.raw).join(`
170
+ `)})}i.push({type:"list_item",raw:l.raw,tokens:f}),s=h}else s+=1}return i}function FO(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var $O="listItem",u0="textStyle",d0=/^(\d+)\.\s$/,HE=qt.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",tt(this.options.HTMLAttributes,n),0]:["ol",tt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?FO(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
171
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
172
+ `),[s,l]=zO(i);if(s.length===0)return;const c=UE(s,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:c,raw:i.slice(0,l).join(`
173
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes($O,this.editor.getAttributes(u0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=bo({find:d0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bo({find:d0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(u0)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),UO=/^\s*(\[([( |x])?\])\s$/,WE=qt.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",tt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Rh(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),f=h=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,h,c.checked))||`Task item checkbox for ${h.textContent||"empty task item"}`};f(t),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",h=>h.preventDefault()),c.addEventListener("change",h=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=h.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const k=n();if(typeof k!="number")return!1;const w=y.doc.nodeAt(k);return y.setNodeMarkup(k,void 0,{...w==null?void 0:w.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([h,g])=>{i.setAttribute(h,g)}),i.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,s.append(c,l),i.append(s,u),Object.entries(e).forEach(([h,g])=>{i.setAttribute(h,g)});let p=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:h=>{if(h.type!==this.type)return!1;i.dataset.checked=h.attrs.checked,c.checked=h.attrs.checked,f(h);const g=r.extensionManager.attributes,y=Dl(h,g),k=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return p.forEach(x=>{k.has(x)||(x in w?i.setAttribute(x,w[x]):i.removeAttribute(x))}),Object.entries(y).forEach(([x,C])=>{C==null?x in w?i.setAttribute(x,w[x]):i.removeAttribute(x):i.setAttribute(x,C)}),p=k,!0}}}},addInputRules(){return[bo({find:UO,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),VE=qt.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",tt(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,`
174
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const l=Ip(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return l?[{type:"taskList",raw:l.raw,items:l.items}]:n.blockTokens(s)},i=Ip(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,l)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:l}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.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()}}});Xe.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(LE.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(DE.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push($E.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(HE.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(WE.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(VE.configure(this.options.taskList)),t}});var HO=WE,WO=VE,VO=20,KE=(t,e=0)=>{const n=[];return!t.children.length||e>VO||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...KE(r,e+1))}),n},KO=t=>{if(!t.children.length)return;const e=KE(t);e&&e.forEach(n=>{var r,i;const s=n.getAttribute("style"),l=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${l};${s}`)})},qE=lr.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&KO(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),qO=Xe.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),c=s.slice(1).join(":").trim();if(l==="background-color")return c.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),GO=Xe.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),c=s.slice(1).join(":").trim();if(l==="color")return c.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),YO=Xe.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),JO=Xe.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),QO=Xe.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Xe.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(qO.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(GO.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(YO.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(JO.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(QO.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(qE.configure(this.options.textStyle)),t}});var XO=t=>Mt({find:/--$/,replace:t??"—"}),ZO=t=>Mt({find:/\.\.\.$/,replace:t??"…"}),eR=t=>Mt({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),tR=t=>Mt({find:/"$/,replace:t??"”"}),nR=t=>Mt({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),rR=t=>Mt({find:/'$/,replace:t??"’"}),iR=t=>Mt({find:/<-$/,replace:t??"←"}),sR=t=>Mt({find:/->$/,replace:t??"→"}),oR=t=>Mt({find:/\(c\)$/,replace:t??"©"}),lR=t=>Mt({find:/\(tm\)$/,replace:t??"™"}),aR=t=>Mt({find:/\(sm\)$/,replace:t??"℠"}),cR=t=>Mt({find:/\(r\)$/,replace:t??"®"}),uR=t=>Mt({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),dR=t=>Mt({find:/\+\/-$/,replace:t??"±"}),fR=t=>Mt({find:/!=$/,replace:t??"≠"}),pR=t=>Mt({find:/<<$/,replace:t??"«"}),hR=t=>Mt({find:/>>$/,replace:t??"»"}),mR=t=>Mt({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),gR=t=>Mt({find:/\^2$/,replace:t??"²"}),yR=t=>Mt({find:/\^3$/,replace:t??"³"}),bR=t=>Mt({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),vR=t=>Mt({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),kR=Xe.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(XO(this.options.emDash)),this.options.ellipsis!==!1&&t.push(ZO(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(eR(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(tR(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(nR(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(rR(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(iR(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(sR(this.options.rightArrow)),this.options.copyright!==!1&&t.push(oR(this.options.copyright)),this.options.trademark!==!1&&t.push(lR(this.options.trademark)),this.options.servicemark!==!1&&t.push(aR(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(cR(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(uR(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(dR(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(fR(this.options.notEqual)),this.options.laquo!==!1&&t.push(pR(this.options.laquo)),this.options.raquo!==!1&&t.push(hR(this.options.raquo)),this.options.multiplication!==!1&&t.push(mR(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(gR(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(yR(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(bR(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(vR(this.options.threeQuarters)),t}}),ER=kR,GE=lr.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",tt(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 i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},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()}}}),wR=GE,Jt=[];for(var up=0;up<256;++up)Jt.push((up+256).toString(16).slice(1));function xR(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}var bc,SR=new Uint8Array(16);function CR(){if(!bc&&(bc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!bc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bc(SR)}var NR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const f0={randomUUID:NR};function _R(t,e,n){if(f0.randomUUID&&!t)return f0.randomUUID();t=t||{};var r=t.random||(t.rng||CR)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,xR(r)}function TR(t){const e=new Set,n=new Set;return t.forEach(r=>{e.has(r)?n.add(r):e.add(r)}),Array.from(n)}var MR=Xe.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>_R(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>t[this.options.attributeName]?{[`data-${this.options.attributeName}`]:t[this.options.attributeName]}:{}}}}]},onCreate(){var t;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(c=>c.name==="collaboration"),n=this.editor.extensionManager.extensions.find(c=>c.name==="collaborationCaret"),i=[e,n].filter(Boolean).find(c=>{var u;return(u=c==null?void 0:c.options)==null?void 0:u.provider}),s=(t=i==null?void 0:i.options)==null?void 0:t.provider,l=()=>{const{view:c,state:u}=this.editor,{tr:f,doc:p}=u,{types:h,attributeName:g,generateID:y}=this.options;Kc(p,w=>h.includes(w.type.name)&&w.attrs[g]===null).forEach(({node:w,pos:x})=>{f.setNodeMarkup(x,void 0,{...w.attrs,[g]:y({node:w,pos:x})})}),f.setMeta("addToHistory",!1),c.dispatch(f),s&&s.off("synced",l)};if(i){if(!s)return l();s.on("synced",l)}else return l()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let t=null,e=!1;return[new it({key:new ut("uniqueID"),appendTransaction:(n,r,i)=>{const s=n.some(w=>w.docChanged)&&!r.doc.eq(i.doc),l=this.options.filterTransaction&&n.some(w=>{var x,C;return!((C=(x=this.options).filterTransaction)!=null&&C.call(x,w))});if(n.find(w=>w.getMeta("y-sync$"))||!s||l)return;const{tr:u}=i,{types:f,attributeName:p,generateID:h}=this.options,g=Sh(r.doc,n),{mapping:y}=g;if(_h(g).forEach(({newRange:w})=>{const x=_k(i.doc,w,N=>f.includes(N.type.name)),C=x.map(({node:N})=>N.attrs[p]).filter(N=>N!==null);x.forEach(({node:N,pos:I},P)=>{var O;const R=(O=u.doc.nodeAt(I))==null?void 0:O.attrs[p];if(R===null){u.setNodeMarkup(I,void 0,{...N.attrs,[p]:h({node:N,pos:I})});return}const $=x[P+1];if($&&N.content.size===0){const Q=u.doc.nodeAt($.pos);if(Q!=null&&Q.attrs[p]&&Q.attrs[p]!==R)return;u.setNodeMarkup($.pos,void 0,{...$.node.attrs,[p]:R}),C[P+1]=R;const H=h({node:N,pos:I});return u.setNodeMarkup(I,void 0,{...N.attrs,[p]:H}),C[P]=H,u}const te=TR(C),{deleted:le}=y.invert().mapResult(I);le&&te.includes(R)&&u.setNodeMarkup(I,void 0,{...N.attrs,[p]:h({node:N,pos:I})})})}),!!u.steps.length)return u.setStoredMarks(i.tr.storedMarks),u.setMeta("__uniqueIDTransaction",!0),u},view(n){const r=i=>{var s;t=(s=n.dom.parentElement)!=null&&s.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var i,s;return(t!==n.dom.parentElement||((i=r.dataTransfer)==null?void 0:i.effectAllowed)==="copyMove"||((s=r.dataTransfer)==null?void 0:s.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:i}=this.options,s=l=>{const c=[];return l.forEach(u=>{if(u.isText){c.push(u);return}if(!r.includes(u.type.name)){c.push(u.copy(s(u.content)));return}const f=u.type.create({...u.attrs,[i]:null},s(u.content),u.marks);c.push(f)}),J.from(c)};return e=!1,new he(s(n.content),n.openStart,n.openEnd)}}})]}}),AR=MR,xu=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},OR=/^\s*>\s$/,RR=qt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return xu("blockquote",{...tt(this.options.HTMLAttributes,t),children:xu("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const c=e.renderChildren([i]).split(`
175
+ `).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(`
176
+ `))}),r.join(`
177
+ ${n}
178
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[bo({find:OR,type:this.type})]}}),IR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,LR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,DR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,PR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,BR=lr.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 xu("strong",{...tt(this.options.HTMLAttributes,t),children:xu("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),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[Ss({find:IR,type:this.type}),Ss({find:DR,type:this.type})]},addPasteRules(){return[Di({find:LR,type:this.type}),Di({find:PR,type:this.type})]}}),jR=/(^|[^`])`([^`]+)`(?!`)$/,zR=/(^|[^`])`([^`]+)`(?!`)/g,FR=lr.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",tt(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[Ss({find:jR,type:this.type})]},addPasteRules(){return[Di({find:zR,type:this.type})]}}),dp=4,$R=/^```([a-z]+)?[\s\n]$/,UR=/^~~~([a-z]+)?[\s\n]$/,YE=qt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:dp,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 s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",tt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
179
+ `):r=`\`\`\`${i}
180
+
181
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:dp,{state:r}=t,{selection:i}=r,{$from:s,empty:l}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(n);return l?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:f,to:p}=i,y=r.doc.textBetween(f,p,`
182
+ `,`
183
+ `).split(`
184
+ `).map(k=>c+k).join(`
185
+ `);return u.replaceWith(f,p,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:dp,{state:r}=t,{selection:i}=r,{$from:s,empty:l}=i;return s.parent.type!==this.type?!1:l?t.commands.command(({tr:c})=>{var u;const{pos:f}=s,p=s.start(),h=s.end(),y=r.doc.textBetween(p,h,`
186
+ `,`
187
+ `).split(`
188
+ `);let k=0,w=0;const x=f-p;for(let R=0;R<y.length;R+=1){if(w+y[R].length>=x){k=R;break}w+=y[R].length+1}const N=((u=y[k].match(/^ */))==null?void 0:u[0])||"",I=Math.min(N.length,n);if(I===0)return!0;let P=p;for(let R=0;R<k;R+=1)P+=y[R].length+1;return c.delete(P,P+I),f-P<=I&&c.setSelection(Ae.create(c.doc,P)),!0}):t.commands.command(({tr:c})=>{const{from:u,to:f}=i,g=r.doc.textBetween(u,f,`
189
+ `,`
190
+ `).split(`
191
+ `).map(y=>{var k;const w=((k=y.match(/^ */))==null?void 0:k[0])||"",x=Math.min(w.length,n);return y.slice(x)}).join(`
192
+ `);return c.replaceWith(u,f,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
193
+
194
+ `);return!s||!l?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection(Le.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Rp({find:$R,type:this.type,getAttributes:t=>({language:t[1]})}),Rp({find:UR,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new it({key:new ut("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:l,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,`
195
+ `));return l.replaceSelectionWith(this.type.create({language:s},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(Ae.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),HR=YE,WR=qt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
196
+
197
+ `):""}),VR=qt.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",tt(this.options.HTMLAttributes,t)]},renderText(){return`
198
+ `},renderMarkdown:()=>`
199
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:p})=>{if(p&&u&&l){const h=u.filter(g=>c.includes(g.type.name));f.ensureMarks(h)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),KR=qt.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]}`,tt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${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=>Rp({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),qR=qt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",tt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!cT(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return Dk(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:l,dispatch:c})=>{if(c){const{$to:u}=l.selection,f=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?l.setSelection(Ae.create(l.doc,u.pos+1)):u.nodeAfter.isBlock?l.setSelection(Me.create(l.doc,u.pos)):l.setSelection(Ae.create(l.doc,u.pos));else{const p=s.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,h=p==null?void 0:p.create();h&&(l.insert(f,h),l.setSelection(Ae.create(l.doc,f+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Xk({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),GR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,YR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,JR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,QR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,XR=lr.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",tt(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||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ss({find:GR,type:this.type}),Ss({find:JR,type:this.type})]},addPasteRules(){return[Di({find:YR,type:this.type}),Di({find:QR,type:this.type})]}}),p0="&nbsp;",ZR=" ",eI=qt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",tt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===p0||r[0].text===ZR)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?p0:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),tI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,nI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,rI=lr.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",tt(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[Ss({find:tI,type:this.type})]},addPasteRules(){return[Di({find:nI,type:this.type})]}}),iI=qt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),sI=Xe.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(BR.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(RR.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(LE.configure(this.options.bulletList)),this.options.code!==!1&&i.push(FR.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(YE.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(WR.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(gA.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(yA.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(VR.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(KR.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(EA.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(qR.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(XR.configure(this.options.italic)),this.options.listItem!==!1&&i.push(DE.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push($E.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(mE.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(HE.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(eI.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(rI.configure(this.options.strike)),this.options.text!==!1&&i.push(iI.configure(this.options.text)),this.options.underline!==!1&&i.push(GE.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(kA.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),oI=sI,fp,h0;function lI(){if(h0)return fp;h0=1;function t(L){return L instanceof Map?L.clear=L.delete=L.set=function(){throw new Error("map is read-only")}:L instanceof Set&&(L.add=L.clear=L.delete=function(){throw new Error("set is read-only")}),Object.freeze(L),Object.getOwnPropertyNames(L).forEach(Y=>{const pe=L[Y],Pe=typeof pe;(Pe==="object"||Pe==="function")&&!Object.isFrozen(pe)&&t(pe)}),L}class e{constructor(Y){Y.data===void 0&&(Y.data={}),this.data=Y.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(L){return L.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(L,...Y){const pe=Object.create(null);for(const Pe in L)pe[Pe]=L[Pe];return Y.forEach(function(Pe){for(const dt in Pe)pe[dt]=Pe[dt]}),pe}const i="</span>",s=L=>!!L.scope,l=(L,{prefix:Y})=>{if(L.startsWith("language:"))return L.replace("language:","language-");if(L.includes(".")){const pe=L.split(".");return[`${Y}${pe.shift()}`,...pe.map((Pe,dt)=>`${Pe}${"_".repeat(dt+1)}`)].join(" ")}return`${Y}${L}`};class c{constructor(Y,pe){this.buffer="",this.classPrefix=pe.classPrefix,Y.walk(this)}addText(Y){this.buffer+=n(Y)}openNode(Y){if(!s(Y))return;const pe=l(Y.scope,{prefix:this.classPrefix});this.span(pe)}closeNode(Y){s(Y)&&(this.buffer+=i)}value(){return this.buffer}span(Y){this.buffer+=`<span class="${Y}">`}}const u=(L={})=>{const Y={children:[]};return Object.assign(Y,L),Y};class f{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(Y){this.top.children.push(Y)}openNode(Y){const pe=u({scope:Y});this.add(pe),this.stack.push(pe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Y){return this.constructor._walk(Y,this.rootNode)}static _walk(Y,pe){return typeof pe=="string"?Y.addText(pe):pe.children&&(Y.openNode(pe),pe.children.forEach(Pe=>this._walk(Y,Pe)),Y.closeNode(pe)),Y}static _collapse(Y){typeof Y!="string"&&Y.children&&(Y.children.every(pe=>typeof pe=="string")?Y.children=[Y.children.join("")]:Y.children.forEach(pe=>{f._collapse(pe)}))}}class p extends f{constructor(Y){super(),this.options=Y}addText(Y){Y!==""&&this.add(Y)}startScope(Y){this.openNode(Y)}endScope(){this.closeNode()}__addSublanguage(Y,pe){const Pe=Y.root;pe&&(Pe.scope=`language:${pe}`),this.add(Pe)}toHTML(){return new c(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function h(L){return L?typeof L=="string"?L:L.source:null}function g(L){return w("(?=",L,")")}function y(L){return w("(?:",L,")*")}function k(L){return w("(?:",L,")?")}function w(...L){return L.map(pe=>h(pe)).join("")}function x(L){const Y=L[L.length-1];return typeof Y=="object"&&Y.constructor===Object?(L.splice(L.length-1,1),Y):{}}function C(...L){return"("+(x(L).capture?"":"?:")+L.map(Pe=>h(Pe)).join("|")+")"}function N(L){return new RegExp(L.toString()+"|").exec("").length-1}function I(L,Y){const pe=L&&L.exec(Y);return pe&&pe.index===0}const P=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function O(L,{joinWith:Y}){let pe=0;return L.map(Pe=>{pe+=1;const dt=pe;let mt=h(Pe),Ee="";for(;mt.length>0;){const ke=P.exec(mt);if(!ke){Ee+=mt;break}Ee+=mt.substring(0,ke.index),mt=mt.substring(ke.index+ke[0].length),ke[0][0]==="\\"&&ke[1]?Ee+="\\"+String(Number(ke[1])+dt):(Ee+=ke[0],ke[0]==="("&&pe++)}return Ee}).map(Pe=>`(${Pe})`).join(Y)}const R=/\b\B/,$="[a-zA-Z]\\w*",te="[a-zA-Z_]\\w*",le="\\b\\d+(\\.\\d+)?",ee="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Q="\\b(0b[01]+)",H="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",K=(L={})=>{const Y=/^#![ ]*\//;return L.binary&&(L.begin=w(Y,/.*\b/,L.binary,/\b.*/)),r({scope:"meta",begin:Y,end:/$/,relevance:0,"on:begin":(pe,Pe)=>{pe.index!==0&&Pe.ignoreMatch()}},L)},U={begin:"\\\\[\\s\\S]",relevance:0},G={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[U]},ie={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[U]},me={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},V=function(L,Y,pe={}){const Pe=r({scope:"comment",begin:L,end:Y,contains:[]},pe);Pe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const dt=C("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Pe.contains.push({begin:w(/[ ]+/,"(",dt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},j=V("//","$"),q=V("/\\*","\\*/"),M=V("#","$"),A={scope:"number",begin:le,relevance:0},X={scope:"number",begin:ee,relevance:0},Z={scope:"number",begin:Q,relevance:0},ye={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[U,{begin:/\[/,end:/\]/,relevance:0,contains:[U]}]},ge={scope:"title",begin:$,relevance:0},ne={scope:"title",begin:te,relevance:0},be={begin:"\\.\\s*"+te,relevance:0};var Ze=Object.freeze({__proto__:null,APOS_STRING_MODE:G,BACKSLASH_ESCAPE:U,BINARY_NUMBER_MODE:Z,BINARY_NUMBER_RE:Q,COMMENT:V,C_BLOCK_COMMENT_MODE:q,C_LINE_COMMENT_MODE:j,C_NUMBER_MODE:X,C_NUMBER_RE:ee,END_SAME_AS_BEGIN:function(L){return Object.assign(L,{"on:begin":(Y,pe)=>{pe.data._beginMatch=Y[1]},"on:end":(Y,pe)=>{pe.data._beginMatch!==Y[1]&&pe.ignoreMatch()}})},HASH_COMMENT_MODE:M,IDENT_RE:$,MATCH_NOTHING_RE:R,METHOD_GUARD:be,NUMBER_MODE:A,NUMBER_RE:le,PHRASAL_WORDS_MODE:me,QUOTE_STRING_MODE:ie,REGEXP_MODE:ye,RE_STARTERS_RE:H,SHEBANG:K,TITLE_MODE:ge,UNDERSCORE_IDENT_RE:te,UNDERSCORE_TITLE_MODE:ne});function un(L,Y){L.input[L.index-1]==="."&&Y.ignoreMatch()}function Ve(L,Y){L.className!==void 0&&(L.scope=L.className,delete L.className)}function Je(L,Y){Y&&L.beginKeywords&&(L.begin="\\b("+L.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",L.__beforeBegin=un,L.keywords=L.keywords||L.beginKeywords,delete L.beginKeywords,L.relevance===void 0&&(L.relevance=0))}function bt(L,Y){Array.isArray(L.illegal)&&(L.illegal=C(...L.illegal))}function Dn(L,Y){if(L.match){if(L.begin||L.end)throw new Error("begin & end are not supported with match");L.begin=L.match,delete L.match}}function Ke(L,Y){L.relevance===void 0&&(L.relevance=1)}const bn=(L,Y)=>{if(!L.beforeMatch)return;if(L.starts)throw new Error("beforeMatch cannot be used with starts");const pe=Object.assign({},L);Object.keys(L).forEach(Pe=>{delete L[Pe]}),L.keywords=pe.keywords,L.begin=w(pe.beforeMatch,g(pe.begin)),L.starts={relevance:0,contains:[Object.assign(pe,{endsParent:!0})]},L.relevance=0,delete pe.beforeMatch},vn=["of","and","for","in","not","or","if","then","parent","list","value"],_r="keyword";function cr(L,Y,pe=_r){const Pe=Object.create(null);return typeof L=="string"?dt(pe,L.split(" ")):Array.isArray(L)?dt(pe,L):Object.keys(L).forEach(function(mt){Object.assign(Pe,cr(L[mt],Y,mt))}),Pe;function dt(mt,Ee){Y&&(Ee=Ee.map(ke=>ke.toLowerCase())),Ee.forEach(function(ke){const Oe=ke.split("|");Pe[Oe[0]]=[mt,ur(Oe[0],Oe[1])]})}}function ur(L,Y){return Y?Number(Y):zi(L)?0:1}function zi(L){return vn.includes(L.toLowerCase())}const Tr={},de=L=>{console.error(L)},ze=(L,...Y)=>{console.log(`WARN: ${L}`,...Y)},vt=(L,Y)=>{Tr[`${L}/${Y}`]||(console.log(`Deprecated as of ${L}. ${Y}`),Tr[`${L}/${Y}`]=!0)},dr=new Error;function Fi(L,Y,{key:pe}){let Pe=0;const dt=L[pe],mt={},Ee={};for(let ke=1;ke<=Y.length;ke++)Ee[ke+Pe]=dt[ke],mt[ke+Pe]=!0,Pe+=N(Y[ke-1]);L[pe]=Ee,L[pe]._emit=mt,L[pe]._multi=!0}function Vl(L){if(Array.isArray(L.begin)){if(L.skip||L.excludeBegin||L.returnBegin)throw de("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),dr;if(typeof L.beginScope!="object"||L.beginScope===null)throw de("beginScope must be object"),dr;Fi(L,L.begin,{key:"beginScope"}),L.begin=O(L.begin,{joinWith:""})}}function $i(L){if(Array.isArray(L.end)){if(L.skip||L.excludeEnd||L.returnEnd)throw de("skip, excludeEnd, returnEnd not compatible with endScope: {}"),dr;if(typeof L.endScope!="object"||L.endScope===null)throw de("endScope must be object"),dr;Fi(L,L.end,{key:"endScope"}),L.end=O(L.end,{joinWith:""})}}function Ui(L){L.scope&&typeof L.scope=="object"&&L.scope!==null&&(L.beginScope=L.scope,delete L.scope)}function Vu(L){Ui(L),typeof L.beginScope=="string"&&(L.beginScope={_wrap:L.beginScope}),typeof L.endScope=="string"&&(L.endScope={_wrap:L.endScope}),Vl(L),$i(L)}function Kl(L){function Y(Ee,ke){return new RegExp(h(Ee),"m"+(L.case_insensitive?"i":"")+(L.unicodeRegex?"u":"")+(ke?"g":""))}class pe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ke,Oe){Oe.position=this.position++,this.matchIndexes[this.matchAt]=Oe,this.regexes.push([Oe,ke]),this.matchAt+=N(ke)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ke=this.regexes.map(Oe=>Oe[1]);this.matcherRe=Y(O(ke,{joinWith:"|"}),!0),this.lastIndex=0}exec(ke){this.matcherRe.lastIndex=this.lastIndex;const Oe=this.matcherRe.exec(ke);if(!Oe)return null;const It=Oe.findIndex((fr,Qr)=>Qr>0&&fr!==void 0),lt=this.matchIndexes[It];return Oe.splice(0,It),Object.assign(Oe,lt)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ke){if(this.multiRegexes[ke])return this.multiRegexes[ke];const Oe=new pe;return this.rules.slice(ke).forEach(([It,lt])=>Oe.addRule(It,lt)),Oe.compile(),this.multiRegexes[ke]=Oe,Oe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ke,Oe){this.rules.push([ke,Oe]),Oe.type==="begin"&&this.count++}exec(ke){const Oe=this.getMatcher(this.regexIndex);Oe.lastIndex=this.lastIndex;let It=Oe.exec(ke);if(this.resumingScanAtSamePosition()&&!(It&&It.index===this.lastIndex)){const lt=this.getMatcher(0);lt.lastIndex=this.lastIndex+1,It=lt.exec(ke)}return It&&(this.regexIndex+=It.position+1,this.regexIndex===this.count&&this.considerAll()),It}}function dt(Ee){const ke=new Pe;return Ee.contains.forEach(Oe=>ke.addRule(Oe.begin,{rule:Oe,type:"begin"})),Ee.terminatorEnd&&ke.addRule(Ee.terminatorEnd,{type:"end"}),Ee.illegal&&ke.addRule(Ee.illegal,{type:"illegal"}),ke}function mt(Ee,ke){const Oe=Ee;if(Ee.isCompiled)return Oe;[Ve,Dn,Vu,bn].forEach(lt=>lt(Ee,ke)),L.compilerExtensions.forEach(lt=>lt(Ee,ke)),Ee.__beforeBegin=null,[Je,bt,Ke].forEach(lt=>lt(Ee,ke)),Ee.isCompiled=!0;let It=null;return typeof Ee.keywords=="object"&&Ee.keywords.$pattern&&(Ee.keywords=Object.assign({},Ee.keywords),It=Ee.keywords.$pattern,delete Ee.keywords.$pattern),It=It||/\w+/,Ee.keywords&&(Ee.keywords=cr(Ee.keywords,L.case_insensitive)),Oe.keywordPatternRe=Y(It,!0),ke&&(Ee.begin||(Ee.begin=/\B|\b/),Oe.beginRe=Y(Oe.begin),!Ee.end&&!Ee.endsWithParent&&(Ee.end=/\B|\b/),Ee.end&&(Oe.endRe=Y(Oe.end)),Oe.terminatorEnd=h(Oe.end)||"",Ee.endsWithParent&&ke.terminatorEnd&&(Oe.terminatorEnd+=(Ee.end?"|":"")+ke.terminatorEnd)),Ee.illegal&&(Oe.illegalRe=Y(Ee.illegal)),Ee.contains||(Ee.contains=[]),Ee.contains=[].concat(...Ee.contains.map(function(lt){return Ku(lt==="self"?Ee:lt)})),Ee.contains.forEach(function(lt){mt(lt,Oe)}),Ee.starts&&mt(Ee.starts,ke),Oe.matcher=dt(Oe),Oe}if(L.compilerExtensions||(L.compilerExtensions=[]),L.contains&&L.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return L.classNameAliases=r(L.classNameAliases||{}),mt(L)}function Eo(L){return L?L.endsWithParent||Eo(L.starts):!1}function Ku(L){return L.variants&&!L.cachedVariants&&(L.cachedVariants=L.variants.map(function(Y){return r(L,{variants:null},Y)})),L.cachedVariants?L.cachedVariants:Eo(L)?r(L,{starts:L.starts?r(L.starts):null}):Object.isFrozen(L)?r(L):L}var wo="11.11.1";class xo extends Error{constructor(Y,pe){super(Y),this.name="HTMLInjectionError",this.html=pe}}const Hi=n,Ms=r,As=Symbol("nomatch"),Jr=7,Mr=function(L){const Y=Object.create(null),pe=Object.create(null),Pe=[];let dt=!0;const mt="Could not find the language '{}', did you forget to load/include a language module?",Ee={disableAutodetect:!0,name:"Plain text",contains:[]};let ke={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function Oe(ce){return ke.noHighlightRe.test(ce)}function It(ce){let _e=ce.className+" ";_e+=ce.parentNode?ce.parentNode.className:"";const Fe=ke.languageDetectRe.exec(_e);if(Fe){const We=Qn(Fe[1]);return We||(ze(mt.replace("{}",Fe[1])),ze("Falling back to no-highlight mode for this block.",ce)),We?Fe[1]:"no-highlight"}return _e.split(/\s+/).find(We=>Oe(We)||Qn(We))}function lt(ce,_e,Fe){let We="",At="";typeof _e=="object"?(We=ce,Fe=_e.ignoreIllegals,At=_e.language):(vt("10.7.0","highlight(lang, code, ...args) has been deprecated."),vt("10.7.0",`Please use highlight(code, options) instead.
200
+ https://github.com/highlightjs/highlight.js/issues/2277`),At=ce,We=_e),Fe===void 0&&(Fe=!0);const Et={code:We,language:At};Vi("before:highlight",Et);const pr=Et.result?Et.result:fr(Et.language,Et.code,Fe);return pr.code=Et.code,Vi("after:highlight",pr),pr}function fr(ce,_e,Fe,We){const At=Object.create(null);function Et(fe,we){return fe.keywords[we]}function pr(){if(!je.keywords){Ot.addText(nt);return}let fe=0;je.keywordPatternRe.lastIndex=0;let we=je.keywordPatternRe.exec(nt),De="";for(;we;){De+=nt.substring(fe,we.index);const qe=Pn.case_insensitive?we[0].toLowerCase():we[0],St=Et(je,qe);if(St){const[Ft,Xu]=St;if(Ot.addText(De),De="",At[qe]=(At[qe]||0)+1,At[qe]<=Jr&&(Gi+=Xu),Ft.startsWith("_"))De+=we[0];else{const ea=Pn.classNameAliases[Ft]||Ft;fn(we[0],ea)}}else De+=we[0];fe=je.keywordPatternRe.lastIndex,we=je.keywordPatternRe.exec(nt)}De+=nt.substring(fe),Ot.addText(De)}function Is(){if(nt==="")return;let fe=null;if(typeof je.subLanguage=="string"){if(!Y[je.subLanguage]){Ot.addText(nt);return}fe=fr(je.subLanguage,nt,!0,Mo[je.subLanguage]),Mo[je.subLanguage]=fe._top}else fe=Wi(nt,je.subLanguage.length?je.subLanguage:null);je.relevance>0&&(Gi+=fe.relevance),Ot.__addSublanguage(fe._emitter,fe.language)}function dn(){je.subLanguage!=null?Is():pr(),nt=""}function fn(fe,we){fe!==""&&(Ot.startScope(we),Ot.addText(fe),Ot.endScope())}function Ki(fe,we){let De=1;const qe=we.length-1;for(;De<=qe;){if(!fe._emit[De]){De++;continue}const St=Pn.classNameAliases[fe[De]]||fe[De],Ft=we[De];St?fn(Ft,St):(nt=Ft,pr(),nt=""),De++}}function Xr(fe,we){return fe.scope&&typeof fe.scope=="string"&&Ot.openNode(Pn.classNameAliases[fe.scope]||fe.scope),fe.beginScope&&(fe.beginScope._wrap?(fn(nt,Pn.classNameAliases[fe.beginScope._wrap]||fe.beginScope._wrap),nt=""):fe.beginScope._multi&&(Ki(fe.beginScope,we),nt="")),je=Object.create(fe,{parent:{value:je}}),je}function qi(fe,we,De){let qe=I(fe.endRe,De);if(qe){if(fe["on:end"]){const St=new e(fe);fe["on:end"](we,St),St.isMatchIgnored&&(qe=!1)}if(qe){for(;fe.endsParent&&fe.parent;)fe=fe.parent;return fe}}if(fe.endsWithParent)return qi(fe.parent,we,De)}function Ju(fe){return je.matcher.regexIndex===0?(nt+=fe[0],1):(ti=!0,0)}function Qu(fe){const we=fe[0],De=fe.rule,qe=new e(De),St=[De.__beforeBegin,De["on:begin"]];for(const Ft of St)if(Ft&&(Ft(fe,qe),qe.isMatchIgnored))return Ju(we);return De.skip?nt+=we:(De.excludeBegin&&(nt+=we),dn(),!De.returnBegin&&!De.excludeBegin&&(nt=we)),Xr(De,fe),De.returnBegin?0:we.length}function _o(fe){const we=fe[0],De=_e.substring(fe.index),qe=qi(je,fe,De);if(!qe)return As;const St=je;je.endScope&&je.endScope._wrap?(dn(),fn(we,je.endScope._wrap)):je.endScope&&je.endScope._multi?(dn(),Ki(je.endScope,fe)):St.skip?nt+=we:(St.returnEnd||St.excludeEnd||(nt+=we),dn(),St.excludeEnd&&(nt=we));do je.scope&&Ot.closeNode(),!je.skip&&!je.subLanguage&&(Gi+=je.relevance),je=je.parent;while(je!==qe.parent);return qe.starts&&Xr(qe.starts,fe),St.returnEnd?0:we.length}function Zl(){const fe=[];for(let we=je;we!==Pn;we=we.parent)we.scope&&fe.unshift(we.scope);fe.forEach(we=>Ot.openNode(we))}let Zr={};function ei(fe,we){const De=we&&we[0];if(nt+=fe,De==null)return dn(),0;if(Zr.type==="begin"&&we.type==="end"&&Zr.index===we.index&&De===""){if(nt+=_e.slice(we.index,we.index+1),!dt){const qe=new Error(`0 width match regex (${ce})`);throw qe.languageName=ce,qe.badRule=Zr.rule,qe}return 1}if(Zr=we,we.type==="begin")return Qu(we);if(we.type==="illegal"&&!Fe){const qe=new Error('Illegal lexeme "'+De+'" for mode "'+(je.scope||"<unnamed>")+'"');throw qe.mode=je,qe}else if(we.type==="end"){const qe=_o(we);if(qe!==As)return qe}if(we.type==="illegal"&&De==="")return nt+=`
201
+ `,1;if(Yi>1e5&&Yi>we.index*3)throw new Error("potential infinite loop, way more iterations than matches");return nt+=De,De.length}const Pn=Qn(ce);if(!Pn)throw de(mt.replace("{}",ce)),new Error('Unknown language: "'+ce+'"');const To=Kl(Pn);let Ge="",je=We||To;const Mo={},Ot=new ke.__emitter(ke);Zl();let nt="",Gi=0,hr=0,Yi=0,ti=!1;try{if(Pn.__emitTokens)Pn.__emitTokens(_e,Ot);else{for(je.matcher.considerAll();;){Yi++,ti?ti=!1:je.matcher.considerAll(),je.matcher.lastIndex=hr;const fe=je.matcher.exec(_e);if(!fe)break;const we=_e.substring(hr,fe.index),De=ei(we,fe);hr=fe.index+De}ei(_e.substring(hr))}return Ot.finalize(),Ge=Ot.toHTML(),{language:ce,value:Ge,relevance:Gi,illegal:!1,_emitter:Ot,_top:je}}catch(fe){if(fe.message&&fe.message.includes("Illegal"))return{language:ce,value:Hi(_e),illegal:!0,relevance:0,_illegalBy:{message:fe.message,index:hr,context:_e.slice(hr-100,hr+100),mode:fe.mode,resultSoFar:Ge},_emitter:Ot};if(dt)return{language:ce,value:Hi(_e),illegal:!1,relevance:0,errorRaised:fe,_emitter:Ot,_top:je};throw fe}}function Qr(ce){const _e={value:Hi(ce),illegal:!1,relevance:0,_top:Ee,_emitter:new ke.__emitter(ke)};return _e._emitter.addText(ce),_e}function Wi(ce,_e){_e=_e||ke.languages||Object.keys(Y);const Fe=Qr(ce),We=_e.filter(Qn).filter(Xl).map(dn=>fr(dn,ce,!1));We.unshift(Fe);const At=We.sort((dn,fn)=>{if(dn.relevance!==fn.relevance)return fn.relevance-dn.relevance;if(dn.language&&fn.language){if(Qn(dn.language).supersetOf===fn.language)return 1;if(Qn(fn.language).supersetOf===dn.language)return-1}return 0}),[Et,pr]=At,Is=Et;return Is.secondBest=pr,Is}function qu(ce,_e,Fe){const We=_e&&pe[_e]||Fe;ce.classList.add("hljs"),ce.classList.add(`language-${We}`)}function So(ce){let _e=null;const Fe=It(ce);if(Oe(Fe))return;if(Vi("before:highlightElement",{el:ce,language:Fe}),ce.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",ce);return}if(ce.children.length>0&&(ke.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(ce)),ke.throwUnescapedHTML))throw new xo("One of your code blocks includes unescaped HTML.",ce.innerHTML);_e=ce;const We=_e.textContent,At=Fe?lt(We,{language:Fe,ignoreIllegals:!0}):Wi(We);ce.innerHTML=At.value,ce.dataset.highlighted="yes",qu(ce,Fe,At.language),ce.result={language:At.language,re:At.relevance,relevance:At.relevance},At.secondBest&&(ce.secondBest={language:At.secondBest.language,relevance:At.secondBest.relevance}),Vi("after:highlightElement",{el:ce,result:At,text:We})}function Gu(ce){ke=Ms(ke,ce)}const Or=()=>{Os(),vt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ql(){Os(),vt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Co=!1;function Os(){function ce(){Os()}if(document.readyState==="loading"){Co||window.addEventListener("DOMContentLoaded",ce,!1),Co=!0;return}document.querySelectorAll(ke.cssSelector).forEach(So)}function Gl(ce,_e){let Fe=null;try{Fe=_e(L)}catch(We){if(de("Language definition for '{}' could not be registered.".replace("{}",ce)),dt)de(We);else throw We;Fe=Ee}Fe.name||(Fe.name=ce),Y[ce]=Fe,Fe.rawDefinition=_e.bind(null,L),Fe.aliases&&Ql(Fe.aliases,{languageName:ce})}function Yl(ce){delete Y[ce];for(const _e of Object.keys(pe))pe[_e]===ce&&delete pe[_e]}function Jl(){return Object.keys(Y)}function Qn(ce){return ce=(ce||"").toLowerCase(),Y[ce]||Y[pe[ce]]}function Ql(ce,{languageName:_e}){typeof ce=="string"&&(ce=[ce]),ce.forEach(Fe=>{pe[Fe.toLowerCase()]=_e})}function Xl(ce){const _e=Qn(ce);return _e&&!_e.disableAutodetect}function kt(ce){ce["before:highlightBlock"]&&!ce["before:highlightElement"]&&(ce["before:highlightElement"]=_e=>{ce["before:highlightBlock"](Object.assign({block:_e.el},_e))}),ce["after:highlightBlock"]&&!ce["after:highlightElement"]&&(ce["after:highlightElement"]=_e=>{ce["after:highlightBlock"](Object.assign({block:_e.el},_e))})}function Yu(ce){kt(ce),Pe.push(ce)}function No(ce){const _e=Pe.indexOf(ce);_e!==-1&&Pe.splice(_e,1)}function Vi(ce,_e){const Fe=ce;Pe.forEach(function(We){We[Fe]&&We[Fe](_e)})}function Rs(ce){return vt("10.7.0","highlightBlock will be removed entirely in v12.0"),vt("10.7.0","Please use highlightElement now."),So(ce)}Object.assign(L,{highlight:lt,highlightAuto:Wi,highlightAll:Os,highlightElement:So,highlightBlock:Rs,configure:Gu,initHighlighting:Or,initHighlightingOnLoad:ql,registerLanguage:Gl,unregisterLanguage:Yl,listLanguages:Jl,getLanguage:Qn,registerAliases:Ql,autoDetection:Xl,inherit:Ms,addPlugin:Yu,removePlugin:No}),L.debugMode=function(){dt=!1},L.safeMode=function(){dt=!0},L.versionString=wo,L.regex={concat:w,lookahead:g,either:C,optional:k,anyNumberOfTimes:y};for(const ce in Ze)typeof Ze[ce]=="object"&&t(Ze[ce]);return Object.assign(L,Ze),L},Ar=Mr({});return Ar.newInstance=()=>Mr({}),fp=Ar,Ar.HighlightJS=Ar,Ar.default=Ar,fp}var aI=lI();const JE=_u(aI);function QE(t,e=[]){return t.flatMap(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?QE(n.children,r):{text:n.value,classes:r}})}function m0(t){return t.value||t.children||[]}function cI(t){return!!JE.getLanguage(t)}function g0({doc:t,name:e,lowlight:n,defaultLanguage:r}){const i=[];return Kc(t,s=>s.type.name===e).forEach(s=>{var l;let c=s.pos+1;const u=s.node.attrs.language||r,f=n.listLanguages(),p=u&&(f.includes(u)||cI(u)||(l=n.registered)!=null&&l.call(n,u))?m0(n.highlight(u,s.node.textContent)):m0(n.highlightAuto(s.node.textContent));QE(p).forEach(h=>{const g=c+h.text.length;if(h.classes.length){const y=yt.inline(c,g,{class:h.classes.join(" ")});i.push(y)}c=g})}),rt.create(t,i)}function uI(t){return typeof t=="function"}function dI({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>uI(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new it({key:new ut("lowlight"),state:{init:(i,{doc:s})=>g0({doc:s,name:t,lowlight:e,defaultLanguage:n}),apply:(i,s,l,c)=>{const u=l.selection.$head.parent.type.name,f=c.selection.$head.parent.type.name,p=Kc(l.doc,g=>g.type.name===t),h=Kc(c.doc,g=>g.type.name===t);return i.docChanged&&([u,f].includes(t)||h.length!==p.length||i.steps.some(g=>g.from!==void 0&&g.to!==void 0&&p.some(y=>y.pos>=g.from&&y.pos+y.node.nodeSize<=g.to)))?g0({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var fI=HR.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],dI({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),pI=fI;function hI(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",c={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},p={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},g={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},y=e.optional(i)+t.IDENT_RE+"\\s*\\(",k=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],w=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],C=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],P={type:w,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},O={className:"function.dispatch",relevance:0,keywords:{_hint:C},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},R=[O,h,c,n,t.C_BLOCK_COMMENT_MODE,p,f],$={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:P,contains:R.concat([{begin:/\(/,end:/\)/,keywords:P,contains:R.concat(["self"]),relevance:0}]),relevance:0},te={className:"function",begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:P,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:P,relevance:0},{begin:y,returnBegin:!0,contains:[g],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:P,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,f,p,c,{begin:/\(/,end:/\)/,keywords:P,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,f,p,c]}]},c,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:P,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat($,te,O,R,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:P,contains:["self",c]},{begin:t.IDENT_RE+"::",keywords:P},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function mI(t){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=hI(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function gI(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(c);const u={match:/\\"/},f={className:"string",begin:/'/,end:/'/},p={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},g=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],y=t.SHEBANG({binary:`(${g.join("|")})`,relevance:10}),k={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},w=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],x=["true","false"],C={match:/(\/[a-z._-]+)+/},N=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],I=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],P=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],O=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:w,literal:x,built_in:[...N,...I,"set","shopt",...P,...O]},contains:[y,t.SHEBANG(),k,h,s,l,C,c,u,f,p,n]}}function yI(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",c={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},p={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},g={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},y=e.optional(i)+t.IDENT_RE+"\\s*\\(",x={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},C=[h,c,n,t.C_BLOCK_COMMENT_MODE,p,f],N={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:C.concat([{begin:/\(/,end:/\)/,keywords:x,contains:C.concat(["self"]),relevance:0}]),relevance:0},I={begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:y,returnBegin:!0,contains:[t.inherit(g,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,f,p,c,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,f,p,c]}]},c,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C",aliases:["h"],keywords:x,disableAutodetect:!0,illegal:"</",contains:[].concat(N,I,C,[h,{begin:t.IDENT_RE+"::",keywords:x},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:h,strings:f,keywords:x}}}function bI(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",c={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},p={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},g={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},y=e.optional(i)+t.IDENT_RE+"\\s*\\(",k=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],w=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],C=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],P={type:w,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},O={className:"function.dispatch",relevance:0,keywords:{_hint:C},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},R=[O,h,c,n,t.C_BLOCK_COMMENT_MODE,p,f],$={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:P,contains:R.concat([{begin:/\(/,end:/\)/,keywords:P,contains:R.concat(["self"]),relevance:0}]),relevance:0},te={className:"function",begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:P,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:P,relevance:0},{begin:y,returnBegin:!0,contains:[g],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:P,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,f,p,c,{begin:/\(/,end:/\)/,keywords:P,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,f,p,c]}]},c,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:P,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat($,te,O,R,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:P,contains:["self",c]},{begin:t.IDENT_RE+"::",keywords:P},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function vI(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],l={keyword:i.concat(s),built_in:e,literal:r},c=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),u={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},f={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},p={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},h=t.inherit(p,{illegal:/\n/}),g={className:"subst",begin:/\{/,end:/\}/,keywords:l},y=t.inherit(g,{illegal:/\n/}),k={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,y]},w={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},g]},x=t.inherit(w,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]});g.contains=[w,k,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,u,t.C_BLOCK_COMMENT_MODE],y.contains=[x,k,h,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,u,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const C={variants:[f,w,k,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},N={begin:"<",end:">",contains:[{beginKeywords:"in out"},c]},I=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",P={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:l,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},C,u,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},c,N,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[c,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[c,N,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+I+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:l,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,N],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,relevance:0,contains:[C,u,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},P]}}const kI=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),EI=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],wI=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],xI=[...EI,...wI],SI=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),CI=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),NI=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_I=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function TI(t){const e=t.regex,n=kI(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",c=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+CI.join("|")+")"},{begin:":(:)?("+NI.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_I.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:SI.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+xI.join("|")+")\\b"}]}}function MI(t){const e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function AI(t){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function OI(t){const e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function RI(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},c={begin:/\[/,end:/\]/,contains:[r,s,i,l,n,"self"],relevance:0},u=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,p=/'[^']*'/,h=e.either(u,f,p),g=e.concat(h,"(\\s*\\.\\s*",h,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:g,className:"attr",starts:{end:/$/,contains:[r,c,s,i,l,n]}}]}}var lo="[0-9](_*[0-9])*",vc=`\\.(${lo})`,kc="[0-9a-fA-F](_*[0-9a-fA-F])*",y0={className:"number",variants:[{begin:`(\\b(${lo})((${vc})|\\.)?|(${vc}))[eE][+-]?(${lo})[fFdD]?\\b`},{begin:`\\b(${lo})((${vc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${vc})[fFdD]?\\b`},{begin:`\\b(${lo})[fFdD]\\b`},{begin:`\\b0[xX]((${kc})\\.?|(${kc})?\\.(${kc}))[pP][+-]?(${lo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${kc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function XE(t,e,n){return n===-1?"":t.replace(e,r=>XE(t,e,n-1))}function II(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+XE("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),u={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},f={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},p={className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:u,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[p,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:u,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[f,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,y0,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},y0,f]}}const b0="[A-Za-z$_][0-9A-Za-z$_]*",LI=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],DI=["true","false","null","undefined","NaN","Infinity"],ZE=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ew=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],tw=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],PI=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],BI=[].concat(tw,ZE,ew);function jI(t){const e=t.regex,n=(V,{after:j})=>{const q="</"+V[0].slice(1);return V.input.indexOf(q,j)!==-1},r=b0,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(V,j)=>{const q=V[0].length+V.index,M=V.input[q];if(M==="<"||M===","){j.ignoreMatch();return}M===">"&&(n(V,{after:q})||j.ignoreMatch());let A;const X=V.input.substring(q);if(A=X.match(/^\s*=/)){j.ignoreMatch();return}if((A=X.match(/^\s+extends\s+/))&&A.index===0){j.ignoreMatch();return}}},c={$pattern:b0,keyword:LI,literal:DI,built_in:BI,"variable.language":PI},u="[0-9](_?[0-9])*",f=`\\.(${u})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${p})((${f})|\\.)?|(${f}))[eE][+-]?(${u})\\b`},{begin:`\\b(${p})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},k={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,g]},N={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},I=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,y,k,w,x,{match:/\$\d+/},h];g.contains=I.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(I)});const P=[].concat(N,g.contains),O=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(P)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:O},$={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},te={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...ZE,...ew]}},le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ee={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(V){return e.concat("(?!",V.join("|"),")")}const K={match:e.concat(/\b/,H([...tw,"super","import"].map(V=>`${V}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",me={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:te},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),le,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,y,k,w,x,N,{match:/\$\d+/},h,te,{scope:"attr",match:r+e.lookahead(":"),relevance:0},me,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[N,t.REGEXP_MODE,{className:"function",begin:ie,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},ee,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},K,Q,$,G,{match:/\$[(.]/}]}}function zI(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var ao="[0-9](_*[0-9])*",Ec=`\\.(${ao})`,wc="[0-9a-fA-F](_*[0-9a-fA-F])*",FI={className:"number",variants:[{begin:`(\\b(${ao})((${Ec})|\\.)?|(${Ec}))[eE][+-]?(${ao})[fFdD]?\\b`},{begin:`\\b(${ao})((${Ec})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ec})[fFdD]?\\b`},{begin:`\\b(${ao})[fFdD]\\b`},{begin:`\\b0[xX]((${wc})\\.?|(${wc})?\\.(${wc}))[pP][+-]?(${ao})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${wc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function $I(t){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},l={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(l);const c={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},u={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(l,{className:"string"}),"self"]}]},f=FI,p=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},g=h;return g.variants[1].contains=[h],h.variants[1].contains=[g],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,p,n,r,c,u,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[h,t.C_LINE_COMMENT_MODE,p],relevance:0},t.C_LINE_COMMENT_MODE,p,c,u,l,t.C_NUMBER_MODE]},p]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},c,u]},l,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
202
+ `},f]}}const UI=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),HI=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],WI=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],VI=[...HI,...WI],KI=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),nw=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),rw=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),qI=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),GI=nw.concat(rw).sort().reverse();function YI(t){const e=UI(t),n=GI,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",l=[],c=[],u=function(I){return{className:"string",begin:"~?"+I+".*?"+I}},f=function(I,P,O){return{className:I,begin:P,relevance:O}},p={$pattern:/[a-z-]+/,keyword:r,attribute:KI.join(" ")},h={begin:"\\(",end:"\\)",contains:c,keywords:p,relevance:0};c.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,u("'"),u('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,h,f("variable","@@?"+i,10),f("variable","@\\{"+i+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const g=c.concat({begin:/\{/,end:/\}/,contains:l}),y={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(c)},k={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+qI.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:c}}]},w={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:p,returnEnd:!0,contains:c,relevance:0}},x={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:g}},C={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,y,f("keyword","all\\b"),f("variable","@\\{"+i+"\\}"),{begin:"\\b("+VI.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,f("selector-tag",s,0),f("selector-id","#"+s),f("selector-class","\\."+s,0),f("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+nw.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+rw.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:g},{begin:"!important"},e.FUNCTION_DISPATCH]},N={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[C]};return l.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,w,x,N,k,C,y,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function JI(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function QI(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},l={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,s,l]}}function XI(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,u={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},p={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=t.inherit(f,{contains:[]}),g=t.inherit(p,{contains:[]});f.contains.push(g),p.contains.push(h);let y=[n,u];return[f,p,h,g].forEach(C=>{C.contains=C.contains.concat(y)}),y=y.concat(f,p),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:y},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:y}]}]},n,s,f,p,{className:"quote",begin:"^>\\s+",contains:y,end:"$"},i,r,u,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function ZI(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,c={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},u={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:c,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+u.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:u,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function eL(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},l={begin:/->\{/,end:/\}/},c={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},u={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[c]},f={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},p=[t.BACKSLASH_ESCAPE,s,u],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],g=(w,x,C="\\1")=>{const N=C==="\\1"?C:e.concat(C,x);return e.concat(e.concat("(?:",w,")"),x,/(?:\\.|[^\\\/])*?/,N,/(?:\\.|[^\\\/])*?/,C,r)},y=(w,x,C)=>e.concat(e.concat("(?:",w,")"),x,/(?:\\.|[^\\\/])*?/,C,r),k=[u,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),l,{className:"string",contains:p,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},f,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:g("s|tr|y",e.either(...h,{capture:!0}))},{begin:g("s|tr|y","\\(","\\)")},{begin:g("s|tr|y","\\[","\\]")},{begin:g("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:y("(?:m|qr)?",/\//,/\//)},{begin:y("m|qr",e.either(...h,{capture:!0}),/\1/)},{begin:y("m|qr",/\(/,/\)/)},{begin:y("m|qr",/\[/,/\]/)},{begin:y("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,c]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,c,f]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=k,l.contains=k,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:k}}function tL(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=e.concat(/[A-Z]+/,n),l={scope:"variable",match:"\\$+"+r},c={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},u={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},f=t.inherit(t.APOS_STRING_MODE,{illegal:null}),p=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(u)}),h={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(u),"on:begin":(U,G)=>{G.data._beginMatch=U[1]||U[2]},"on:end":(U,G)=>{G.data._beginMatch!==U[1]&&G.ignoreMatch()}},g=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),y=`[
203
+ ]`,k={scope:"string",variants:[p,f,h,g]},w={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},x=["false","null","true"],C=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],N=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],P={keyword:C,literal:(U=>{const G=[];return U.forEach(ie=>{G.push(ie),ie.toLowerCase()===ie?G.push(ie.toUpperCase()):G.push(ie.toLowerCase())}),G})(x),built_in:N},O=U=>U.map(G=>G.replace(/\|\d+$/,"")),R={variants:[{match:[/new/,e.concat(y,"+"),e.concat("(?!",O(N).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},$=e.concat(r,"\\b(?!\\()"),te={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),$],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),$],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},le={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},ee={relevance:0,begin:/\(/,end:/\)/,keywords:P,contains:[le,l,te,t.C_BLOCK_COMMENT_MODE,k,w,R]},Q={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",O(C).join("\\b|"),"|",O(N).join("\\b|"),"\\b)"),r,e.concat(y,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[ee]};ee.contains.push(Q);const H=[le,te,t.C_BLOCK_COMMENT_MODE,k,w,R],K={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:x,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:x,keyword:["new","array"]},contains:["self",...H]},...H,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:P,contains:[K,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},c,{scope:"variable.language",match:/\$this\b/},l,Q,te,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},R,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:P,contains:["self",K,l,te,t.C_BLOCK_COMMENT_MODE,k,w]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},k,w]}}function nL(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function rL(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function iL(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},p={begin:/\{\{/,relevance:0},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u,p,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u,p,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,p,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,p,f]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},g="[0-9](_?[0-9])*",y=`(\\b(${g}))?\\.(${g})|\\b(${g})\\.`,k=`\\b|${r.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${g})|(${y}))[eE][+-]?(${g})[jJ]?(?=${k})`},{begin:`(${y})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${k})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${k})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${k})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${k})`},{begin:`\\b(${g})[jJ](?=${k})`}]},x={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},C={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",u,w,h,t.HASH_COMMENT_MODE]}]};return f.contains=[h,w,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[u,w,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,x,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[C]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[w,C,h]}]}}function sL(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function oL(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function lL(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),l={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},c={className:"doctag",begin:"@[A-Za-z]+"},u={begin:"#<",end:">"},f=[t.COMMENT("#","$",{contains:[c]}),t.COMMENT("^=begin","^=end",{contains:[c],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],p={className:"subst",begin:/#\{/,end:/\}/,keywords:l},h={className:"string",contains:[t.BACKSLASH_ESCAPE,p],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,p]})]}]},g="[1-9](_?[0-9])*|0",y="[0-9](_?[0-9])*",k={className:"number",relevance:0,variants:[{begin:`\\b(${g})(\\.(${y}))?([eE][+-]?(${y})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},w={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:l}]},R=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:l},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[w]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:n}],relevance:0},k,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:l},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,p],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(u,f),relevance:0}].concat(u,f);p.contains=R,w.contains=R;const ee=[{begin:/^\s*=>/,starts:{end:"$",contains:R}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:R}}];return f.unshift(u),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(ee).concat(f).concat(R)}}function aL(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},l="([ui](8|16|32|64|128|size)|f(32|64))?",c=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],u=["true","false","Some","None","Ok","Err"],f=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],p=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:p,keyword:c,literal:u,built_in:f},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+l},{begin:"\\b0o([0-7_]+)"+l},{begin:"\\b0x([A-Fa-f0-9_]+)"+l},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+l}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:f,type:p}},{className:"punctuation",begin:"->"},s]}}const cL=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),uL=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],dL=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],fL=[...uL,...dL],pL=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),hL=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),mL=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),gL=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function yL(t){const e=cL(t),n=mL,r=hL,i="@[a-z-]+",s="and or not only",c={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+fL.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},c,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+gL.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,c,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:pL.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},c,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function bL(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function vL(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],c=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],u=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],p=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],g=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],y=p,k=[...f,...u].filter(O=>!p.includes(O)),w={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},x={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},C={match:e.concat(/\b/,e.either(...y),/\s*\(/),relevance:0,keywords:{built_in:y}};function N(O){return e.concat(/\b/,e.either(...O.map(R=>R.replace(/\s+/,"\\s+"))),/\b/)}const I={scope:"keyword",match:N(g),relevance:0};function P(O,{exceptions:R,when:$}={}){const te=$;return R=R||[],O.map(le=>le.match(/\|\d+$/)||R.includes(le)?le:te(le)?`${le}|0`:le)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:P(k,{when:O=>O.length<3}),literal:s,type:c,built_in:h},contains:[{scope:"type",match:N(l)},I,C,w,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,x]}}function iw(t){return t?typeof t=="string"?t:t.source:null}function cl(t){return st("(?=",t,")")}function st(...t){return t.map(n=>iw(n)).join("")}function kL(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function mn(...t){return"("+(kL(t).capture?"":"?:")+t.map(r=>iw(r)).join("|")+")"}const Kh=t=>st(/\b/,t,/\w$/.test(t)?/\b/:/\B/),EL=["Protocol","Type"].map(Kh),v0=["init","self"].map(Kh),wL=["Any","Self"],pp=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],k0=["false","nil","true"],xL=["assignment","associativity","higherThan","left","lowerThan","none","right"],SL=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],E0=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],sw=mn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ow=mn(sw,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),hp=st(sw,ow,"*"),lw=mn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Su=mn(lw,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),kr=st(lw,Su,"*"),xc=st(/[A-Z]/,Su,"*"),CL=["attached","autoclosure",st(/convention\(/,mn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",st(/objc\(/,kr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],NL=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function _L(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,mn(...EL,...v0)],className:{2:"keyword"}},s={match:st(/\./,mn(...pp)),relevance:0},l=pp.filter(Ke=>typeof Ke=="string").concat(["_|0"]),c=pp.filter(Ke=>typeof Ke!="string").concat(wL).map(Kh),u={variants:[{className:"keyword",match:mn(...c,...v0)}]},f={$pattern:mn(/\b\w+/,/#\w+/),keyword:l.concat(SL),literal:k0},p=[i,s,u],h={match:st(/\./,mn(...E0)),relevance:0},g={className:"built_in",match:st(/\b/,mn(...E0),/(?=\()/)},y=[h,g],k={match:/->/,relevance:0},w={className:"operator",relevance:0,variants:[{match:hp},{match:`\\.(\\.|${ow})+`}]},x=[k,w],C="([0-9]_*)+",N="([0-9a-fA-F]_*)+",I={className:"number",relevance:0,variants:[{match:`\\b(${C})(\\.(${C}))?([eE][+-]?(${C}))?\\b`},{match:`\\b0x(${N})(\\.(${N}))?([pP][+-]?(${C}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},P=(Ke="")=>({className:"subst",variants:[{match:st(/\\/,Ke,/[0\\tnr"']/)},{match:st(/\\/,Ke,/u\{[0-9a-fA-F]{1,8}\}/)}]}),O=(Ke="")=>({className:"subst",match:st(/\\/,Ke,/[\t ]*(?:[\r\n]|\r\n)/)}),R=(Ke="")=>({className:"subst",label:"interpol",begin:st(/\\/,Ke,/\(/),end:/\)/}),$=(Ke="")=>({begin:st(Ke,/"""/),end:st(/"""/,Ke),contains:[P(Ke),O(Ke),R(Ke)]}),te=(Ke="")=>({begin:st(Ke,/"/),end:st(/"/,Ke),contains:[P(Ke),R(Ke)]}),le={className:"string",variants:[$(),$("#"),$("##"),$("###"),te(),te("#"),te("##"),te("###")]},ee=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],Q={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:ee},H=Ke=>{const bn=st(Ke,/\//),vn=st(/\//,Ke);return{begin:bn,end:vn,contains:[...ee,{scope:"comment",begin:`#(?!.*${vn})`,end:/$/}]}},K={scope:"regexp",variants:[H("###"),H("##"),H("#"),Q]},U={match:st(/`/,kr,/`/)},G={className:"variable",match:/\$\d+/},ie={className:"variable",match:`\\$${Su}+`},me=[U,G,ie],V={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:NL,contains:[...x,I,le]}]}},j={scope:"keyword",match:st(/@/,mn(...CL),cl(mn(/\(/,/\s+/)))},q={scope:"meta",match:st(/@/,kr)},M=[V,j,q],A={match:cl(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:st(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Su,"+")},{className:"type",match:xc,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:st(/\s+&\s+/,cl(xc)),relevance:0}]},X={begin:/</,end:/>/,keywords:f,contains:[...r,...p,...M,k,A]};A.contains.push(X);const Z={match:st(kr,/\s*:/),keywords:"_|0",relevance:0},ye={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",Z,...r,K,...p,...y,...x,I,le,...me,...M,A]},ge={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,A]},ne={begin:mn(cl(st(kr,/\s*:/)),cl(st(kr,/\s+/,kr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:kr}]},be={begin:/\(/,end:/\)/,keywords:f,contains:[ne,...r,...p,...x,I,le,...M,A,ye],endsParent:!0,illegal:/["']/},Ue={match:[/(func|macro)/,/\s+/,mn(U.match,kr,hp)],className:{1:"keyword",3:"title.function"},contains:[ge,be,e],illegal:[/\[/,/%/]},Ze={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ge,be,e],illegal:/\[|%/},un={match:[/operator/,/\s+/,hp],className:{1:"keyword",3:"title"}},Ve={begin:[/precedencegroup/,/\s+/,xc],className:{1:"keyword",3:"title"},contains:[A],keywords:[...xL,...k0],end:/}/},Je={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},bt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Dn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,kr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[ge,...p,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:xc},...p],relevance:0}]};for(const Ke of le.variants){const bn=Ke.contains.find(_r=>_r.label==="interpol");bn.keywords=f;const vn=[...p,...y,...x,I,le,...me];bn.contains=[...vn,{begin:/\(/,end:/\)/,contains:["self",...vn]}]}return{name:"Swift",keywords:f,contains:[...r,Ue,Ze,Je,bt,Dn,un,Ve,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},K,...p,...y,...x,I,le,...me,...M,A,ye]}}const Cu="[A-Za-z$_][0-9A-Za-z$_]*",aw=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],cw=["true","false","null","undefined","NaN","Infinity"],uw=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],dw=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fw=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],pw=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],hw=[].concat(fw,uw,dw);function TL(t){const e=t.regex,n=(V,{after:j})=>{const q="</"+V[0].slice(1);return V.input.indexOf(q,j)!==-1},r=Cu,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(V,j)=>{const q=V[0].length+V.index,M=V.input[q];if(M==="<"||M===","){j.ignoreMatch();return}M===">"&&(n(V,{after:q})||j.ignoreMatch());let A;const X=V.input.substring(q);if(A=X.match(/^\s*=/)){j.ignoreMatch();return}if((A=X.match(/^\s+extends\s+/))&&A.index===0){j.ignoreMatch();return}}},c={$pattern:Cu,keyword:aw,literal:cw,built_in:hw,"variable.language":pw},u="[0-9](_?[0-9])*",f=`\\.(${u})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${p})((${f})|\\.)?|(${f}))[eE][+-]?(${u})\\b`},{begin:`\\b(${p})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},k={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,g]},N={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},I=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,y,k,w,x,{match:/\$\d+/},h];g.contains=I.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(I)});const P=[].concat(N,g.contains),O=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(P)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:O},$={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},te={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...uw,...dw]}},le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ee={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(V){return e.concat("(?!",V.join("|"),")")}const K={match:e.concat(/\b/,H([...fw,"super","import"].map(V=>`${V}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",me={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:te},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),le,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,y,k,w,x,N,{match:/\$\d+/},h,te,{scope:"attr",match:r+e.lookahead(":"),relevance:0},me,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[N,t.REGEXP_MODE,{className:"function",begin:ie,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},ee,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},K,Q,$,G,{match:/\$[(.]/}]}}function ML(t){const e=t.regex,n=TL(t),r=Cu,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:Cu,keyword:aw.concat(u),literal:cw,built_in:hw.concat(i),"variable.language":pw},p={className:"meta",begin:"@"+r},h=(w,x,C)=>{const N=w.contains.findIndex(I=>I.label===x);if(N===-1)throw new Error("can not find mode to replace");w.contains.splice(N,1,C)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(p);const g=n.contains.find(w=>w.scope==="attr"),y=Object.assign({},g,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,g,y]),n.contains=n.contains.concat([p,s,l,y]),h(n,"shebang",t.SHEBANG()),h(n,"use_strict",c);const k=n.contains.find(w=>w.label==="func.def");return k.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function AL(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,l=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,c=/\d{1,2}(:\d{1,2}){1,2}/,u={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,c,/ *#/)},{begin:e.concat(/# */,l,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(l,c),/ *#/)}]},f={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},p={className:"label",begin:/^\w+:/},h=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),g=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,u,f,p,h,g,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[g]}]}}function OL(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},l={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},c={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},u={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},f={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,l,i,t.QUOTE_STRING_MODE,u,f,c]}}function RL(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=t.inherit(s,{begin:/\(/,end:/\)/}),c=t.inherit(t.APOS_STRING_MODE,{className:"string"}),u=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,u,c,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,l,u,c]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:f}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function IL(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},c=t.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),g={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},y={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},k={begin:/\{/,end:/\}/,contains:[y],illegal:"\\n",relevance:0},w={begin:"\\[",end:"\\]",contains:[y],illegal:"\\n",relevance:0},x=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},g,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},k,w,s,l],C=[...x];return C.pop(),C.push(c),y.contains=C,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:x}}const LL={arduino:mI,bash:gI,c:yI,cpp:bI,csharp:vI,css:TI,diff:MI,go:AI,graphql:OI,ini:RI,java:II,javascript:jI,json:zI,kotlin:$I,less:YI,lua:JI,makefile:QI,markdown:XI,objectivec:ZI,perl:eL,php:tL,"php-template":nL,plaintext:rL,python:iL,"python-repl":sL,r:oL,ruby:lL,rust:aL,scss:yL,shell:bL,sql:vL,swift:_L,typescript:ML,vbnet:AL,wasm:OL,xml:RL,yaml:IL},w0={},DL="hljs-";function PL(t){const e=JE.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:l,registered:c};function n(u,f,p){const h=p||w0,g=typeof h.prefix=="string"?h.prefix:DL;if(!e.getLanguage(u))throw new Error("Unknown language: `"+u+"` is not registered");e.configure({__emitter:BL,classPrefix:g});const y=e.highlight(f,{ignoreIllegals:!0,language:u});if(y.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:y.errorRaised});const k=y._emitter.root,w=k.data;return w.language=y.language,w.relevance=y.relevance,k}function r(u,f){const h=(f||w0).subset||i();let g=-1,y=0,k;for(;++g<h.length;){const w=h[g];if(!e.getLanguage(w))continue;const x=n(w,u,f);x.data&&x.data.relevance!==void 0&&x.data.relevance>y&&(y=x.data.relevance,k=x)}return k||{type:"root",children:[],data:{language:void 0,relevance:y}}}function i(){return e.listLanguages()}function s(u,f){if(typeof u=="string")e.registerLanguage(u,f);else{let p;for(p in u)Object.hasOwn(u,p)&&e.registerLanguage(p,u[p])}}function l(u,f){if(typeof u=="string")e.registerAliases(typeof f=="string"?f:[...f],{languageName:u});else{let p;for(p in u)if(Object.hasOwn(u,p)){const h=u[p];e.registerAliases(typeof h=="string"?h:[...h],{languageName:p})}}}function c(u){return!!e.getLanguage(u)}}class BL{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(l,c){return c?l+"_".repeat(c):n.options.classPrefix+l}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const jL=new ut("blurredLoadingNode"),zL=Xe.create({name:"blurredLoadingNode",addStorage(){return{loadingNodes:{}}},addCommands(){return{applyLoadingEffect:(t,e,n,r="paragraph")=>({editor:i})=>{const s={...this.storage.loadingNodes};return s[t]={from:e,to:n,id:t,active:!0,type:r},this.storage.loadingNodes=s,i.view.dispatch(i.view.state.tr),setTimeout(()=>{i.isFocused&&i.commands.setTextSelection({from:e,to:e})},0),!0},removeLoadingEffect:t=>({editor:e})=>{const n={...this.storage.loadingNodes};return n[t]&&(delete n[t],this.storage.loadingNodes=n,e.view.dispatch(e.view.state.tr),e.isFocused||setTimeout(()=>{e.commands.focus()},0)),!0}}},addProseMirrorPlugins(){return[new it({key:jL,props:{decorations:t=>{const e=this.storage.loadingNodes,n=[];return Object.entries(e).forEach(([,r])=>{const i=r;if(!i.active)return;const{from:s,to:l,type:c}=i;c==="selection"?n.push(yt.inline(s,l,{class:"node-blur-selection"})):t.doc.nodesBetween(s,l,(u,f)=>["paragraph","heading","blockquote","listItem","codeBlock"].includes(u.type.name)?(n.push(yt.node(f,f+u.nodeSize,{class:"node-blur-effect"})),!1):!0)}),rt.create(t.doc,n)}}})]}}),FL=["paragraph","heading","bulletList","orderedList","listItem","blockquote","codeBlock","horizontalRule","table","taskList","taskItem","image"],$L=Xe.create({name:"pendingAttributes",addGlobalAttributes(){return[{types:FL,attributes:{pendingStatus:{default:null,parseHTML:t=>t.getAttribute("data-pending-status")||null,renderHTML:t=>t.pendingStatus?{"data-pending-status":t.pendingStatus}:{}},pendingOriginalContent:{default:null,rendered:!1},pendingTextEdits:{default:null,rendered:!1}}}]}}),UL=PL(LL),HL=QM.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),target:{default:null}}},renderHTML({HTMLAttributes:t}){var r;const{target:e,...n}=t;if((r=n.href)!=null&&r.startsWith("doc:")){const{href:i,...s}=n;return["span",{...s,"data-doc":i.slice(4),class:"doc-link"},0]}return["a",tt(this.options.HTMLAttributes,n),0]}}),WL=[oI.configure({codeBlock:!1}),pI.configure({lowlight:UL}),HL.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer nofollow"}}),qE,wR,xM,SA,NA,WO,HO.configure({nested:!0}),NM,ER,IE.configure({resizable:!1}),RE,OE,AE,zL,$L,wA.configure({placeholder:"Start writing..."}),AR.configure({types:["paragraph","heading","bulletList","orderedList","listItem","blockquote","codeBlock","horizontalRule","table","tableRow","tableHeader","tableCell","taskList","taskItem","image"],attributeName:"id",generateID:()=>crypto.randomUUID().replace(/-/g,"").slice(0,8)})];function vr({onClick:t,active:e,disabled:n,title:r,children:i}){return v.jsx("button",{className:`floating-toolbar__btn${e?" active":""}${n?" disabled":""}`,onMouseDown:s=>{s.preventDefault(),t()},disabled:n,title:r,children:i})}function x0(){return v.jsx("div",{className:"floating-toolbar__divider"})}function VL({editor:t}){const[e,n]=_.useState(!1),[r,i]=_.useState({top:0,left:0}),[,s]=_.useState(0),l=_.useRef(-1),c=_.useRef(-1),u=_.useRef(!1);return _.useEffect(()=>{const f=t.view.dom,p=()=>{u.current=!0},h=()=>{if(!u.current)return;u.current=!1;const{from:g,to:y}=t.state.selection;if(g!==y){const k=t.isActive("codeBlock"),w=!!document.querySelector(".context-menu");if(!k&&!w){l.current=g,c.current=y;const x=t.view.coordsAtPos(g),C=t.view.coordsAtPos(y,1),N=(x.left+C.right)/2;i({top:x.top,left:N}),n(!0)}}};return f.addEventListener("mousedown",p),document.addEventListener("mouseup",h),()=>{f.removeEventListener("mousedown",p),document.removeEventListener("mouseup",h)}},[t]),_.useEffect(()=>{const f=()=>{const{from:p,to:h}=t.state.selection,g=p===h,y=t.isActive("codeBlock"),k=!!document.querySelector(".context-menu");if(g||y||k)n(!1),l.current=-1,c.current=-1;else if(!u.current&&(n(!0),p!==l.current||h!==c.current)){l.current=p,c.current=h;const w=t.view.coordsAtPos(p),x=t.view.coordsAtPos(h,1),C=(w.left+x.right)/2;i({top:w.top,left:C})}s(w=>w+1)};return t.on("transaction",f),()=>{t.off("transaction",f)}},[t]),e?v.jsxs("div",{className:"floating-toolbar",style:{position:"fixed",top:r.top,left:r.left,transform:"translate(-50%, -100%) translateY(-8px)",zIndex:1500},children:[v.jsx(vr,{onClick:()=>t.chain().focus().toggleBold().run(),active:t.isActive("bold"),title:"Bold (Ctrl+B)",children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"})})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"Italic (Ctrl+I)",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"19",x2:"10",y1:"4",y2:"4"}),v.jsx("line",{x1:"14",x2:"5",y1:"20",y2:"20"}),v.jsx("line",{x1:"15",x2:"9",y1:"4",y2:"20"})]})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"Underline (Ctrl+U)",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),v.jsx("line",{x1:"4",x2:"20",y1:"20",y2:"20"})]})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"Strikethrough",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),v.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),v.jsx("line",{x1:"4",x2:"20",y1:"12",y2:"12"})]})}),v.jsx(x0,{}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),active:t.isActive("heading",{level:1}),title:"Heading 1",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 12h8"}),v.jsx("path",{d:"M4 18V6"}),v.jsx("path",{d:"M12 18V6"}),v.jsx("path",{d:"m17 12 3-2v8"})]})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),active:t.isActive("heading",{level:2}),title:"Heading 2",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 12h8"}),v.jsx("path",{d:"M4 18V6"}),v.jsx("path",{d:"M12 18V6"}),v.jsx("path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"})]})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),active:t.isActive("heading",{level:3}),title:"Heading 3",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 12h8"}),v.jsx("path",{d:"M4 18V6"}),v.jsx("path",{d:"M12 18V6"}),v.jsx("path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2"}),v.jsx("path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"})]})}),v.jsx(x0,{}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleBulletList().run(),active:t.isActive("bulletList"),title:"Bullet List",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M3 12h.01"}),v.jsx("path",{d:"M3 18h.01"}),v.jsx("path",{d:"M3 6h.01"}),v.jsx("path",{d:"M8 12h13"}),v.jsx("path",{d:"M8 18h13"}),v.jsx("path",{d:"M8 6h13"})]})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"Ordered List",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M11 12h9"}),v.jsx("path",{d:"M11 18h9"}),v.jsx("path",{d:"M11 6h9"}),v.jsx("path",{d:"M4 10V4h1"}),v.jsx("path",{d:"M4 10h2"}),v.jsx("path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"})]})}),v.jsx(vr,{onClick:()=>t.chain().focus().toggleBlockquote().run(),active:t.isActive("blockquote"),title:"Blockquote",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M17 6H3"}),v.jsx("path",{d:"M21 12H8"}),v.jsx("path",{d:"M21 18H8"}),v.jsx("path",{d:"M3 12v6"})]})})]}):null}const KL=new ut("pendingDecoration");function qL(t){switch(t){case"insert":return"pending-insert";case"rewrite":return"pending-rewrite";case"delete":return"pending-delete";default:return""}}function S0(t,e,n){let r=0,i=e+1;for(let s=0;s<t.childCount;s++){const l=t.child(s);if(l.isText){if(r+l.text.length>=n)return i+(n-r);r+=l.text.length,i+=l.nodeSize}else i+=l.nodeSize}return n===r?i:null}function C0(t){const e=[];return t.descendants((n,r)=>{var l,c;const i=(l=n.attrs)==null?void 0:l.pendingStatus;if(!i)return!0;const s=(c=n.attrs)==null?void 0:c.pendingTextEdits;if(i&&s&&Array.isArray(s)&&s.length>0){for(const u of s){const f=S0(n,r,u.from),p=S0(n,r,u.to);f!==null&&p!==null&&f<p&&e.push(yt.inline(f,p,{class:`pending-inline-${u.type||"rewrite"}`}))}e.push(yt.node(r,r+n.nodeSize,{class:"pending-inline-parent"}))}else if(i){const u=qL(i);u&&e.push(yt.node(r,r+n.nodeSize,{class:u}))}return!0}),rt.create(t,e)}function GL(){return new it({key:KL,state:{init(t,e){return C0(e.doc)},apply(t,e,n,r){return t.docChanged||t.getMeta("forceDecorationUpdate")?C0(r.doc):e.map(t.mapping,t.doc)}},props:{decorations(t){return this.getState(t)}}})}function mw(t){const{state:e,dispatch:n}=t,r=e.tr.setMeta("forceDecorationUpdate",!0);n(r)}async function N0(t,e){const n=new FormData;n.append("image",t);try{const r=await fetch("/api/upload-image",{method:"POST",body:n});if(!r.ok)return;const{src:i}=await r.json(),{state:s}=e,l=s.schema.nodes.image.create({src:i,alt:t.name}),c=s.tr.replaceSelectionWith(l);e.dispatch(c)}catch{}}function YL({initialContent:t,onUpdate:e,onReady:n,onLinkClick:r}){const i=_.useRef(r);i.current=r;const s=gM({extensions:WL,content:t||"<p></p>",onUpdate:({editor:l})=>{e==null||e(l.getJSON())},editorProps:{attributes:{class:"tiptap"},handlePaste:(l,c)=>{var f;const u=(f=c.clipboardData)==null?void 0:f.items;if(!u)return!1;for(const p of u)if(p.type.startsWith("image/")){c.preventDefault();const h=p.getAsFile();return h&&N0(h,l),!0}return!1},handleDrop:(l,c)=>{var f;const u=(f=c.dataTransfer)==null?void 0:f.files;if(!(u!=null&&u.length))return!1;for(const p of u)if(p.type.startsWith("image/"))return c.preventDefault(),N0(p,l),!0;return!1}}},[t]);return _.useEffect(()=>{if(!s)return;const l=s.view.dom,c=u=>{var g;const p=u.target.closest("span.doc-link[data-doc]");if(!p)return;const h=p.getAttribute("data-doc");(g=i.current)==null||g.call(i,h)};return l.addEventListener("click",c,!0),()=>l.removeEventListener("click",c,!0)},[s]),_.useEffect(()=>{if(!s)return;const{state:l}=s.view;if(l.plugins.some(f=>f.key==="pendingDecoration$"))return;const c=GL(),u=l.reconfigure({plugins:[...l.plugins,c]});s.view.updateState(u)},[s]),_.useEffect(()=>{s&&(n==null||n(s))},[s,n]),s?v.jsxs(v.Fragment,{children:[v.jsx(tE,{editor:s}),v.jsx(VL,{editor:s})]}):null}function Dt({onClick:t,active:e,disabled:n,title:r,children:i}){return v.jsx("button",{className:`format-toolbar__btn${e?" active":""}${n?" disabled":""}`,onMouseDown:s=>{s.preventDefault(),t()},disabled:n,title:r,children:i})}function ul(){return v.jsx("div",{className:"format-toolbar__divider"})}async function JL(t,e){const n=new FormData;n.append("image",t);try{const r=await fetch("/api/upload-image",{method:"POST",body:n});if(!r.ok)return;const{src:i}=await r.json();e.chain().focus().setImage({src:i,alt:t.name}).run()}catch{}}function QL({editor:t}){const[,e]=_.useState(0),n=_.useRef(null);_.useEffect(()=>{const i=()=>e(s=>s+1);return t.on("transaction",i),()=>{t.off("transaction",i)}},[t]);const r=i=>{var l;const s=(l=i.target.files)==null?void 0:l[0];s&&JL(s,t),i.target.value=""};return v.jsxs("div",{className:"format-toolbar",children:[v.jsxs("div",{className:"format-toolbar__group",children:[v.jsx(Dt,{onClick:()=>t.chain().focus().toggleBold().run(),active:t.isActive("bold"),title:"Bold (Ctrl+B)",children:v.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"})})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"Italic (Ctrl+I)",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"19",x2:"10",y1:"4",y2:"4"}),v.jsx("line",{x1:"14",x2:"5",y1:"20",y2:"20"}),v.jsx("line",{x1:"15",x2:"9",y1:"4",y2:"20"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"Underline (Ctrl+U)",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),v.jsx("line",{x1:"4",x2:"20",y1:"20",y2:"20"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"Strikethrough",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),v.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),v.jsx("line",{x1:"4",x2:"20",y1:"12",y2:"12"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleCode().run(),active:t.isActive("code"),title:"Inline Code",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"m16 18 6-6-6-6"}),v.jsx("path",{d:"m8 6-6 6 6 6"})]})})]}),v.jsx(ul,{}),v.jsxs("div",{className:"format-toolbar__group",children:[v.jsx(Dt,{onClick:()=>t.chain().focus().toggleHighlight().run(),active:t.isActive("highlight"),title:"Highlight",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"m9 11-6 6v3h9l3-3"}),v.jsx("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleSubscript().run(),active:t.isActive("subscript"),title:"Subscript",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"m4 5 8 8"}),v.jsx("path",{d:"m12 5-8 8"}),v.jsx("path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleSuperscript().run(),active:t.isActive("superscript"),title:"Superscript",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"m4 19 8-8"}),v.jsx("path",{d:"m12 19-8-8"}),v.jsx("path",{d:"M20 12h-4c0-1.5.44-2 1.5-2.5S20 8.33 20 7c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"})]})})]}),v.jsx(ul,{}),v.jsxs("div",{className:"format-toolbar__group",children:[v.jsx(Dt,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),active:t.isActive("heading",{level:1}),title:"Heading 1",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 12h8"}),v.jsx("path",{d:"M4 18V6"}),v.jsx("path",{d:"M12 18V6"}),v.jsx("path",{d:"m17 12 3-2v8"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),active:t.isActive("heading",{level:2}),title:"Heading 2",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 12h8"}),v.jsx("path",{d:"M4 18V6"}),v.jsx("path",{d:"M12 18V6"}),v.jsx("path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),active:t.isActive("heading",{level:3}),title:"Heading 3",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 12h8"}),v.jsx("path",{d:"M4 18V6"}),v.jsx("path",{d:"M12 18V6"}),v.jsx("path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2"}),v.jsx("path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().setParagraph().run(),active:t.isActive("paragraph")&&!t.isActive("heading"),title:"Paragraph",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M13 4v16"}),v.jsx("path",{d:"M17 4v16"}),v.jsx("path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13"})]})})]}),v.jsx(ul,{}),v.jsxs("div",{className:"format-toolbar__group",children:[v.jsx(Dt,{onClick:()=>t.chain().focus().toggleBulletList().run(),active:t.isActive("bulletList"),title:"Bullet List",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M3 12h.01"}),v.jsx("path",{d:"M3 18h.01"}),v.jsx("path",{d:"M3 6h.01"}),v.jsx("path",{d:"M8 12h13"}),v.jsx("path",{d:"M8 18h13"}),v.jsx("path",{d:"M8 6h13"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"Ordered List",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M11 12h9"}),v.jsx("path",{d:"M11 18h9"}),v.jsx("path",{d:"M11 6h9"}),v.jsx("path",{d:"M4 10V4h1"}),v.jsx("path",{d:"M4 10h2"}),v.jsx("path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleTaskList().run(),active:t.isActive("taskList"),title:"Task List",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"m3 17 2 2 4-4"}),v.jsx("path",{d:"m3 7 2 2 4-4"}),v.jsx("path",{d:"M13 6h8"}),v.jsx("path",{d:"M13 12h8"}),v.jsx("path",{d:"M13 18h8"})]})})]}),v.jsx(ul,{}),v.jsxs("div",{className:"format-toolbar__group",children:[v.jsx(Dt,{onClick:()=>t.chain().focus().toggleBlockquote().run(),active:t.isActive("blockquote"),title:"Blockquote",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M17 6H3"}),v.jsx("path",{d:"M21 12H8"}),v.jsx("path",{d:"M21 18H8"}),v.jsx("path",{d:"M3 12v6"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().toggleCodeBlock().run(),active:t.isActive("codeBlock"),title:"Code Block",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),v.jsx("path",{d:"m10 9-3 3 3 3"}),v.jsx("path",{d:"m14 15 3-3-3-3"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().setHorizontalRule().run(),title:"Horizontal Rule",children:v.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M5 12h14"})})})]}),v.jsx(ul,{}),v.jsxs("div",{className:"format-toolbar__group",children:[v.jsx(Dt,{onClick:()=>{var i;return(i=n.current)==null?void 0:i.click()},title:"Insert Image",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),v.jsx("circle",{cx:"9",cy:"9",r:"2"}),v.jsx("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),v.jsx(Dt,{onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:"Insert Table",children:v.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),v.jsx("path",{d:"M12 3v18"}),v.jsx("path",{d:"M3 9h18"}),v.jsx("path",{d:"M3 15h18"})]})})]}),v.jsx("input",{ref:n,type:"file",accept:"image/*",className:"format-toolbar__file-input",onChange:r})]})}const XL={tree:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M3 3h7v7H3zM14 3h7v4h-7zM14 10h7v4h-7zM3 13h7v8H3z"})}),timeline:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22"}),v.jsx("circle",{cx:"12",cy:"6",r:"2"}),v.jsx("circle",{cx:"12",cy:"12",r:"2"}),v.jsx("circle",{cx:"12",cy:"18",r:"2"}),v.jsx("line",{x1:"14",y1:"6",x2:"20",y2:"6"}),v.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"}),v.jsx("line",{x1:"14",y1:"18",x2:"20",y2:"18"})]}),board:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{x:"3",y:"3",width:"5",height:"18",rx:"1"}),v.jsx("rect",{x:"10",y:"3",width:"5",height:"12",rx:"1"}),v.jsx("rect",{x:"17",y:"3",width:"5",height:"15",rx:"1"})]}),shelf:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 19V5"}),v.jsx("path",{d:"M8 19V7"}),v.jsx("path",{d:"M12 19V4"}),v.jsx("path",{d:"M16 19V8"}),v.jsx("path",{d:"M20 19V6"}),v.jsx("line",{x1:"2",y1:"20",x2:"22",y2:"20"})]})};function ZL(){const[t,e]=_.useState(!1),[n,r]=_.useState(z0),[i,s]=_.useState(F0),[l,c]=_.useState(Tu),[u,f]=_.useState($0),[p,h]=_.useState(U0),[g,y]=_.useState(H0),k=_.useRef(null),w=(R,$,te,le,ee=p,Q=g)=>{W0(R,$,te,le,ee,Q)},x=R=>{r(R),w(R,i,l,u)},C=()=>{const R=i==="light"?"dark":"light";s(R),w(n,R,l,u)},N=R=>{c(R),w(n,i,R,u),window.dispatchEvent(new CustomEvent("ow-sidebar-mode-change",{detail:R}))},I=R=>{f(R),w(n,i,l,R)},P=R=>{h(R),w(n,i,l,u,R)},O=R=>{y(R),w(n,i,l,u,p,R)};return _.useEffect(()=>{if(!t)return;const R=$=>{k.current&&!k.current.contains($.target)&&e(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[t]),v.jsxs("div",{className:"appearance-wrapper",ref:k,children:[v.jsx("button",{className:`titlebar-nav-btn${t?" titlebar-nav-btn--active":""}`,onClick:()=>e(!t),title:"Appearance",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}),v.jsx("circle",{cx:"13.5",cy:"6.5",r:"1",fill:"currentColor",stroke:"none"}),v.jsx("circle",{cx:"17.5",cy:"10.5",r:"1",fill:"currentColor",stroke:"none"}),v.jsx("circle",{cx:"6.5",cy:"12.5",r:"1",fill:"currentColor",stroke:"none"}),v.jsx("circle",{cx:"8.5",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"})]})}),t&&v.jsxs("div",{className:"appearance-dropdown",children:[v.jsxs("div",{className:"appearance-section",children:[v.jsxs("div",{className:"appearance-section-header",children:[v.jsx("span",{className:"appearance-section-title",children:"Theme"}),v.jsxs("button",{className:"appearance-mode-btn",onClick:C,title:i==="light"?"Switch to dark":"Switch to light",children:[i==="light"?v.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("circle",{cx:"12",cy:"12",r:"5"}),v.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),v.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),v.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),v.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),v.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),v.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),v.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),v.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):v.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),v.jsx("span",{children:i==="light"?"Light":"Dark"})]})]}),v.jsx("div",{className:"appearance-theme-grid",children:L0.map(R=>v.jsxs("button",{className:`appearance-swatch ${n===R.id?"active":""}`,onClick:()=>x(R.id),title:R.description,children:[v.jsx("span",{className:"appearance-swatch-color",style:{background:R.swatch[i]}}),v.jsx("span",{className:"appearance-swatch-label",children:R.label})]},R.id))})]}),v.jsxs("div",{className:"appearance-section",children:[v.jsx("div",{className:"appearance-section-header",children:v.jsx("span",{className:"appearance-section-title",children:"Typography"})}),v.jsx("div",{className:"appearance-typography-grid",children:j0.map(R=>v.jsx("button",{className:`appearance-style-option ${p===R.id?"active":""}`,onClick:()=>P(R.id),children:R.label},R.id))})]}),v.jsxs("div",{className:"appearance-section",children:[v.jsx("div",{className:"appearance-section-header",children:v.jsx("span",{className:"appearance-section-title",children:"Canvas"})}),v.jsx("div",{className:"appearance-style-grid",children:B0.map(R=>v.jsx("button",{className:`appearance-style-option ${g===R.id?"active":""}`,onClick:()=>O(R.id),children:R.label},R.id))})]}),v.jsxs("div",{className:"appearance-section",children:[v.jsx("div",{className:"appearance-section-header",children:v.jsx("span",{className:"appearance-section-title",children:"Layout"})}),v.jsx("div",{className:"appearance-mode-grid",children:D0.map(R=>v.jsxs("button",{className:`appearance-mode-option ${l===R.id?"active":""}`,onClick:()=>N(R.id),children:[XL[R.icon],v.jsx("span",{children:R.label})]},R.id))})]}),v.jsxs("div",{className:"appearance-section",children:[v.jsx("div",{className:"appearance-section-header",children:v.jsx("span",{className:"appearance-section-title",children:"Style"})}),v.jsx("div",{className:"appearance-style-grid",children:P0.map(R=>v.jsx("button",{className:`appearance-style-option ${u===R.id?"active":""}`,onClick:()=>I(R.id),children:R.label},R.id))})]})]})]})}function eD(t){return t.replace(/^@openwriter\/plugin-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function tD(){const[t,e]=_.useState(!1),[n,r]=_.useState([]),[i,s]=_.useState(null),l=_.useRef(null),c=_.useCallback(()=>{fetch("/api/available-plugins").then(p=>p.json()).then(p=>r(p.plugins||[])).catch(()=>{})},[]);_.useEffect(()=>{t&&c()},[t,c]),_.useEffect(()=>{const p=()=>c();return window.addEventListener("ow-plugins-changed",p),()=>window.removeEventListener("ow-plugins-changed",p)},[c]),_.useEffect(()=>{if(!t)return;const p=h=>{l.current&&!l.current.contains(h.target)&&e(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);const u=_.useCallback(async(p,h)=>{s(p);try{(await fetch(h?"/api/plugins/disable":"/api/plugins/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p})})).ok&&c()}catch{}finally{s(null)}},[c]),f=_.useCallback((p,h,g)=>{fetch("/api/plugins/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p,config:{[h]:g}})}).catch(()=>{})},[]);return v.jsxs("div",{className:"plugin-wrapper",ref:l,children:[v.jsx("button",{className:`titlebar-nav-btn${t?" titlebar-nav-btn--active":""}`,onClick:()=>e(!t),title:"Plugins",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M12 2v6"}),v.jsx("path",{d:"M6 8h12l-1.5 10a2 2 0 0 1-2 1.7H9.5a2 2 0 0 1-2-1.7L6 8z"}),v.jsx("path",{d:"M9 2v3"}),v.jsx("path",{d:"M15 2v3"})]})}),t&&v.jsxs("div",{className:"plugin-dropdown",children:[v.jsx("div",{className:"plugin-dropdown-header",children:"Plugins"}),n.length===0?v.jsx("div",{className:"plugin-empty",children:"No plugins found"}):n.map(p=>v.jsxs("div",{className:"plugin-item",children:[v.jsxs("div",{className:"plugin-item-header",children:[v.jsxs("div",{className:"plugin-item-info",children:[v.jsxs("div",{className:"plugin-item-name",children:[eD(p.name),v.jsxs("span",{className:"plugin-item-version",children:["v",p.version]})]}),p.description&&v.jsx("div",{className:"plugin-item-desc",children:p.description})]}),v.jsxs("label",{className:`plugin-toggle${i===p.name?" loading":""}`,children:[v.jsx("input",{type:"checkbox",checked:p.enabled,disabled:i===p.name,onChange:()=>u(p.name,p.enabled)}),v.jsx("span",{className:"plugin-toggle-track"}),v.jsx("span",{className:"plugin-toggle-thumb"})]})]}),p.enabled&&Object.keys(p.configSchema).length>0&&v.jsx("div",{className:"plugin-config",children:Object.entries(p.configSchema).map(([h,g])=>v.jsxs("div",{className:"plugin-config-field",children:[v.jsx("label",{className:"plugin-config-label",children:g.description||h}),v.jsx("input",{className:"plugin-config-input",type:h.toLowerCase().includes("key")||h.toLowerCase().includes("secret")?"password":"text",defaultValue:p.config[h]||"",placeholder:g.env?`$${g.env}`:"",onBlur:y=>f(p.name,h,y.target.value)})]},h))})]},p.name))]})]})}function nD(t){const e=Date.now()-t,n=Math.floor(e/1e3);if(n<60)return"Just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);return s<7?`${s}d ago`:new Date(t).toLocaleDateString()}function rD(t){return t<1024?`${t} B`:`${(t/1024).toFixed(1)} KB`}function iD(){const[t,e]=_.useState(!1),[n,r]=_.useState([]),[i,s]=_.useState(null),[l,c]=_.useState(!1),u=_.useRef(null),f=_.useCallback(()=>{fetch("/api/versions").then(h=>h.json()).then(h=>{r(Array.isArray(h)?h:[]),s(null)}).catch(()=>r([]))},[]);_.useEffect(()=>{t&&f()},[t,f]),_.useEffect(()=>{if(!t)return;const h=g=>{u.current&&!u.current.contains(g.target)&&e(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[t]);const p=_.useCallback(async h=>{if(i!==null){c(!0);try{(await fetch(`/api/versions/${i}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:h})})).ok&&f()}catch{}c(!1)}},[i,f]);return v.jsxs("div",{className:"version-wrapper",ref:u,children:[v.jsx("button",{className:`titlebar-nav-btn${t?" titlebar-nav-btn--active":""}`,onClick:()=>e(!t),title:"Version history",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2"}),v.jsx("path",{d:"M12 7v5l3 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),t&&v.jsxs("div",{className:"version-dropdown",children:[v.jsx("div",{className:"version-dropdown__header",children:"Version History"}),v.jsx("div",{className:"version-dropdown__list",children:n.length===0?v.jsx("div",{className:"version-dropdown__empty",children:"No versions yet. Versions are created automatically when you save."}):n.map(h=>v.jsxs("div",{className:`version-dropdown__item${i===h.timestamp?" version-dropdown__item--selected":""}`,onClick:()=>s(h.timestamp===i?null:h.timestamp),children:[v.jsx("span",{className:"version-dropdown__item-time",children:nD(h.timestamp)}),v.jsxs("span",{className:"version-dropdown__item-meta",children:[h.wordCount.toLocaleString()," words · ",rD(h.size)]})]},h.timestamp))}),n.length>0&&v.jsxs("div",{className:"version-dropdown__footer",children:[v.jsx("button",{className:"version-dropdown__review-btn",disabled:i===null||l,onClick:()=>p("review"),children:"Review"}),v.jsx("button",{className:"version-dropdown__restore-btn",disabled:i===null||l,onClick:()=>p("full"),children:"Restore"})]})]})]})}const sD=[{key:"md",label:"Markdown",desc:"Plain .md file",icon:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),v.jsx("path",{d:"M14 2v6h6"})]})},{key:"html",label:"HTML",desc:"Styled web page",icon:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("polyline",{points:"16 18 22 12 16 6"}),v.jsx("polyline",{points:"8 6 2 12 8 18"})]})},{key:"docx",label:"Word",desc:"Microsoft Word .docx",icon:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),v.jsx("path",{d:"M14 2v6h6"}),v.jsx("path",{d:"M16 13H8"}),v.jsx("path",{d:"M16 17H8"}),v.jsx("path",{d:"M10 9H8"})]})},{key:"txt",label:"Plain Text",desc:"Unformatted .txt file",icon:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M17 6.1H3"}),v.jsx("path",{d:"M21 12.1H3"}),v.jsx("path",{d:"M15.1 18H3"})]})},{key:"pdf",label:"PDF",desc:"Print preview for save as PDF",icon:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),v.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),v.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}];function oD(){const[t,e]=_.useState(!1),n=_.useRef(null);_.useEffect(()=>{if(!t)return;const i=s=>{n.current&&!n.current.contains(s.target)&&e(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t]);const r=i=>{if(e(!1),i==="pdf"){window.open("/api/export?format=pdf","_blank");return}const s=document.createElement("a");s.href=`/api/export?format=${i}`,s.download="",document.body.appendChild(s),s.click(),document.body.removeChild(s)};return v.jsxs("div",{className:"export-wrapper",ref:n,children:[v.jsx("button",{className:`titlebar-nav-btn${t?" titlebar-nav-btn--active":""}`,onClick:()=>e(!t),title:"Export document",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),v.jsx("polyline",{points:"7 10 12 15 17 10"}),v.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),t&&v.jsxs("div",{className:"export-dropdown",children:[v.jsx("div",{className:"export-dropdown__header",children:"Export"}),v.jsx("div",{className:"export-dropdown__list",children:sD.map(i=>v.jsxs("div",{className:"export-dropdown__item",onClick:()=>r(i.key),children:[v.jsx("span",{className:"export-dropdown__item-icon",children:i.icon}),v.jsxs("span",{className:"export-dropdown__item-text",children:[v.jsx("span",{className:"export-dropdown__item-label",children:i.label}),v.jsx("span",{className:"export-dropdown__item-desc",children:i.desc})]})]},i.key))})]})]})}const lD=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:v.jsx("path",{d:"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),aD=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("path",{d:"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),v.jsx("path",{d:"M9 14l2 2 4-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),cD=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("path",{d:"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),v.jsx("path",{d:"M12 16v-5M9.5 13.5L12 11l2.5 2.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),uD=()=>v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("path",{d:"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),v.jsx("path",{d:"M14 14l-4 4M10 14l4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function dD({title:t,onTitleChange:e,syncStatus:n,onSync:r,onToggleSidebar:i,canGoBack:s,canGoForward:l,onGoBack:c,onGoForward:u,editor:f,onToggleToolbar:p,toolbarOpen:h}){const[g,y]=_.useState(!1),[,k]=_.useState(0),w=_.useRef(null),[x,C]=_.useState(!1),[N,I]=_.useState([]),[P,O]=_.useState(!1),R=_.useRef(null),$=_.useCallback(()=>{y(!0),setTimeout(()=>{var Q;return(Q=w.current)==null?void 0:Q.select()},0)},[]),te=_.useCallback(()=>{y(!1)},[]),le=_.useCallback(Q=>{Q.key==="Enter"&&y(!1),Q.key==="Escape"&&y(!1)},[]),ee=_.useCallback(()=>{if(x){C(!1);return}C(!0),O(!0),fetch("/api/sync/pending").then(Q=>Q.json()).then(Q=>I(Q)).catch(()=>I([])).finally(()=>O(!1))},[x]);return _.useEffect(()=>{n.state!=="pending"&&C(!1)},[n.state]),_.useEffect(()=>{if(!x)return;const Q=H=>{R.current&&!R.current.contains(H.target)&&C(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[x]),_.useEffect(()=>{if(!f)return;const Q=()=>k(H=>H+1);return f.on("transaction",Q),()=>{f.off("transaction",Q)}},[f]),v.jsxs("div",{className:"titlebar",children:[v.jsxs("div",{className:"titlebar-left",children:[i&&v.jsx("button",{className:"titlebar-menu-btn",onClick:i,title:"Open sidebar",children:v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),v.jsx("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"1.5"}),v.jsx("path",{d:"M14 10l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),c&&v.jsx("button",{className:"titlebar-nav-btn",onClick:c,disabled:!s,title:"Go back (Alt+Left)",children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M10 3L5 8l5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),u&&v.jsx("button",{className:"titlebar-nav-btn",onClick:u,disabled:!l,title:"Go forward (Alt+Right)",children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),f&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"titlebar-divider"}),v.jsx("button",{className:"titlebar-nav-btn",onClick:()=>f.chain().focus().undo().run(),disabled:!f.can().undo(),title:"Undo (Ctrl+Z)",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("path",{d:"M3 10h10a5 5 0 0 1 0 10H9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),v.jsx("path",{d:"M7 6L3 10l4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),v.jsx("button",{className:"titlebar-nav-btn",onClick:()=>f.chain().focus().redo().run(),disabled:!f.can().redo(),title:"Redo (Ctrl+Y)",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("path",{d:"M21 10H11a5 5 0 0 0 0 10h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),v.jsx("path",{d:"M17 6l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),v.jsx("div",{className:"titlebar-center",children:g?v.jsx("input",{ref:w,className:"titlebar-input",value:t,onChange:Q=>e(Q.target.value),onBlur:te,onKeyDown:le,autoFocus:!0}):v.jsx("span",{className:"titlebar-title",onDoubleClick:$,children:t})}),v.jsxs("div",{className:"titlebar-right",children:[p&&v.jsx("button",{className:`titlebar-nav-btn${h?" titlebar-nav-btn--active":""}`,onClick:p,title:"Toggle format toolbar",children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("path",{d:"M4 20h16"}),v.jsx("path",{d:"m6 16 6-12 6 12"}),v.jsx("path",{d:"M8 12h8"})]})}),v.jsx(tD,{}),v.jsx(ZL,{}),v.jsx(iD,{}),v.jsx(oD,{}),v.jsxs("div",{className:"sync-btn-group",ref:R,children:[v.jsxs("button",{className:`titlebar-btn sync-btn-state sync-${n.state}`,onClick:r,disabled:n.state==="syncing",title:n.lastSyncTime?`Last synced: ${new Date(n.lastSyncTime).toLocaleString()}`:"Sync to GitHub",children:[n.state==="unconfigured"&&v.jsxs(v.Fragment,{children:[v.jsx(lD,{})," Sync"]}),n.state==="synced"&&v.jsxs(v.Fragment,{children:[v.jsx(aD,{})," Synced"]}),n.state==="pending"&&v.jsxs(v.Fragment,{children:[v.jsx(cD,{})," Sync",n.pendingFiles?` (${n.pendingFiles})`:""]}),n.state==="syncing"&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"sync-btn-spinner"})," Syncing..."]}),n.state==="error"&&v.jsxs(v.Fragment,{children:[v.jsx(uD,{})," Retry"]})]}),n.state==="pending"&&n.pendingFiles&&n.pendingFiles>0&&v.jsx("button",{className:"sync-details-btn",onClick:ee,title:"View pending changes",children:v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:x?"M3 7.5L6 4.5L9 7.5":"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),x&&v.jsxs("div",{className:"sync-pending-dropdown",children:[v.jsx("div",{className:"sync-pending-header",children:"Changes to push"}),P?v.jsx("div",{className:"sync-pending-loading",children:"Loading..."}):N.length===0?v.jsx("div",{className:"sync-pending-loading",children:"No changes"}):v.jsx("div",{className:"sync-pending-list",children:N.map((Q,H)=>v.jsxs("div",{className:`sync-pending-item sync-file-${Q.status}`,children:[v.jsx("span",{className:"sync-file-badge",children:Q.status[0].toUpperCase()}),v.jsx("span",{className:"sync-file-name",children:Q.file})]},H))})]})]})]})]})}function Jn(t,e){let n=null;return t.state.doc.descendants((r,i)=>{var s;return((s=r.attrs)==null?void 0:s.id)===e?(n={node:r,pos:i},!1):!0}),n}function Qp(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID().replace(/-/g,"").slice(0,8):Math.random().toString(16).slice(2,10)}function Xp(t){return t?Array.isArray(t)?t.map(Xp).join(""):t.text?t.text:t.content&&Array.isArray(t.content)?t.content.map(e=>Xp(e)).join(""):"":""}const fD=new Set(["paragraph","heading","codeBlock","horizontalRule","table","image"]);function Nu(t,e){for(const n of t)n.type&&fD.has(n.type)?n.attrs={...n.attrs,pendingStatus:e}:n.content&&Nu(n.content,e)}function Zp(t,e,n){const r=Array.isArray(n)?n:[n];if(e.nodeId&&!e.afterNodeId&&!e.beforeNodeId){const y=Jn(t,e.nodeId);if(!y)return{success:!1,error:`Node ${e.nodeId} not found`};const k=r.map((w,x)=>{var C;return{...w,attrs:{...w.attrs,id:((C=w.attrs)==null?void 0:C.id)||(x===0?e.nodeId:Qp())}}});Nu(k,"insert");try{return t.chain().deleteRange({from:y.pos,to:y.pos+y.node.nodeSize}).insertContentAt(y.pos,k).run(),{success:!0,nodeId:e.nodeId}}catch(w){return{success:!1,error:`Failed to replace empty node: ${w}`}}}if(!e.afterNodeId&&!e.beforeNodeId)return{success:!1,error:"Insert requires afterNodeId, beforeNodeId, or nodeId"};const i=e.afterNodeId||e.beforeNodeId,s=!!e.afterNodeId,l=Jn(t,i);if(!l)return{success:!1,error:`Anchor node ${i} not found`};const c=Xp(n),u=s?l.pos+l.node.nodeSize:0,f=s?l.pos+l.node.nodeSize+5e3:l.pos;let p=null;if(t.state.doc.nodesBetween(u,Math.min(f,t.state.doc.content.size),y=>{var k,w;return((k=y.attrs)==null?void 0:k.pendingStatus)==="insert"&&((w=y.attrs)!=null&&w.id)&&(y.textContent||"")===c?(p=y.attrs.id,!1):!0}),p)return{success:!0,nodeId:p};const h=r.map(y=>{var k;return{...y,attrs:{...y.attrs,id:((k=y.attrs)==null?void 0:k.id)||Qp()}}});Nu(h,"insert");const g=s?l.pos+l.node.nodeSize:l.pos;try{return t.chain().insertContentAt(g,h).run(),{success:!0,nodeId:h[0].attrs.id}}catch(y){return{success:!1,error:`Failed to insert content: ${y}`}}}function gw(t,e,n){var g;const r=Jn(t,e);if(!r)return{success:!1,error:`Node ${e} not found`};const{node:i,pos:s}=r,l=Array.isArray(n)?n:[n],u=!((g=i.attrs)!=null&&g.pendingOriginalContent)?i.toJSON():i.attrs.pendingOriginalContent,f={...l[0],attrs:{...l[0].attrs,id:e,pendingStatus:"rewrite",pendingOriginalContent:u}},p=l.slice(1).map(y=>{var k;return{...y,attrs:{...y.attrs,id:((k=y.attrs)==null?void 0:k.id)||Qp()}}});Nu(p,"insert");const h=[f,...p];try{return t.chain().deleteRange({from:s,to:s+i.nodeSize}).insertContentAt(s,h.length===1?h[0]:h).run(),{success:!0,nodeId:e}}catch(y){return{success:!1,error:`Failed to rewrite: ${y}`}}}function yw(t,e){var s;const n=Jn(t,e);if(!n)return{success:!1,error:`Node ${e} not found`};const{node:r,pos:i}=n;if(((s=r.attrs)==null?void 0:s.pendingStatus)==="delete")return{success:!0,nodeId:e};try{return t.chain().command(({tr:l})=>(l.setNodeMarkup(i,void 0,{...r.attrs,pendingStatus:"delete"}),!0)).run(),{success:!0,nodeId:e}}catch(l){return{success:!1,error:`Failed to mark for deletion: ${l}`}}}function pD(t,e){if(e.operation==="rewrite"&&e.nodeId&&e.content){const n=gw(t,e.nodeId,e.content);return{success:n.success,error:n.error}}if(e.operation==="insert"&&e.content){let n=null;if(e.nodeId&&!e.afterNodeId?n={nodeId:e.nodeId}:e.afterNodeId&&(n={afterNodeId:e.afterNodeId}),!n)return{success:!1,error:"Insert requires afterNodeId or nodeId"};const r=Zp(t,n,e.content);return{success:r.success,error:r.error}}if(e.operation==="delete"&&e.nodeId){const n=yw(t,e.nodeId);return{success:n.success,error:n.error}}return{success:!1,error:`Invalid operation: ${e.operation}`}}function _0(t,e,n,r){const i=[];if(r==="delete"){for(const s of n)i.push(yw(t,s));return i}if(r==="insert"){const s=n[n.length-1];return s&&e.length>0&&i.push(Zp(t,{afterNodeId:s},e)),i}console.log("[Bridge] Rewrite loop:",{responseCount:e.length,idCount:n.length,ids:n});for(let s=0;s<Math.min(e.length,n.length);s++){const l=gw(t,n[s],e[s]);console.log(`[Bridge] applyRewrite(${n[s]}):`,l),i.push(l)}if(e.length>n.length){const s=n[n.length-1],l=e.slice(n.length);i.push(Zp(t,{afterNodeId:s},l))}return i}const hD=[{action:"delete",label:"Delete",shortcut:"D"}];function mD({editorRef:t}){const[e,n]=_.useState(!1),[r,i]=_.useState({x:0,y:0}),[s,l]=_.useState(!1),[c,u]=_.useState(""),[f,p]=_.useState(!1),[h,g]=_.useState(""),[y,k]=_.useState(!1),[w,x]=_.useState([]),[C,N]=_.useState([]),[I,P]=_.useState(!1),[O,R]=_.useState(""),[$,te]=_.useState([]),le=_.useRef(null),ee=_.useCallback(()=>{fetch("/api/plugins").then(j=>j.json()).then(j=>{const q=[];for(const M of j.plugins||[])q.push(...M.contextMenuItems||[]);te(q)}).catch(()=>{})},[]);_.useEffect(()=>{ee()},[ee]),_.useEffect(()=>{const j=()=>ee();return window.addEventListener("ow-plugins-changed",j),()=>window.removeEventListener("ow-plugins-changed",j)},[ee]),_.useEffect(()=>{const j=q=>{le.current&&!le.current.contains(q.target)&&(n(!1),p(!1),k(!1))};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[]);const Q=_.useCallback(()=>{const j=t.current;return j?j.isActive("link"):!1},[t]),H=_.useCallback(()=>{const j=t.current,{from:q,to:M}=(j==null?void 0:j.state.selection)||{from:0,to:0},A=q!==M,X=[];for(const Z of $)Z.condition==="has-selection"&&!A||X.push({action:Z.action,label:Z.label,shortcut:Z.shortcut,isPlugin:!0,promptForInput:Z.promptForInput});for(const Z of hD)X.push(Z);return A&&X.push({action:"link",label:"Link to doc",shortcut:"L"}),Q()&&X.push({action:"unlink",label:"Unlink"}),X},[t,Q,$]);_.useEffect(()=>{const j=q=>{const M=t.current;!M||!M.view.dom.contains(q.target)||(q.preventDefault(),i({x:q.clientX,y:q.clientY}),n(!0),p(!1),k(!1))};return document.addEventListener("contextmenu",j),()=>document.removeEventListener("contextmenu",j)},[t]);const K=_.useCallback(()=>{const j=t.current;if(!j)return{nodes:[],nodeIds:[]};const{from:q,to:M}=j.state.selection,A=[],X=[];return j.state.doc.nodesBetween(q,M,Z=>{if(Z.isBlock&&Z.type.name!=="doc"){const ye=Z.toJSON();A.push(ye),Z.attrs.id&&X.push(Z.attrs.id)}}),{nodes:A,nodeIds:X}},[t]),U=_.useCallback(async(j,q)=>{const M=t.current;if(!M)return;const{nodes:A,nodeIds:X}=K();if(A.length===0)return;l(!0),n(!1),p(!1);const{from:Z,to:ye}=M.state.selection,ge=`ctx-${Date.now()}`;M.commands.applyLoadingEffect(ge,Z,ye,"paragraph");try{const ne=[],be=[];let Ue=!1;M.state.doc.descendants((bt,Dn)=>{bt.isBlock&&bt.type.name!=="doc"&&(Dn>=Z&&Dn<ye?Ue=!0:Ue?be.push(bt.textContent):ne.push(bt.textContent))});const Ze=j.includes(":")?j.split(":").slice(1).join(":"):j,un={nodes:A,action:Ze,nodeIds:X,contextBefore:ne.slice(-3).join(`
204
+ `),contextAfter:be.slice(0,3).join(`
205
+ `)};q&&(un.instruction=q);const Ve=await fetch(`${window.location.origin}/api/voice/apply-editor`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(un)});if(!Ve.ok)return;const Je=await Ve.json();Je.success&&Je.nodes&&_0(M,Je.nodes,X,j)}catch(ne){console.error("[ContextMenu] Plugin action failed:",ne)}finally{M.commands.removeLoadingEffect(ge),l(!1)}},[t,K]),G=_.useCallback(j=>{const{action:q,isPlugin:M,promptForInput:A}=j;if(M&&A){g(q),p(!0);return}if(M){U(q);return}if(q==="delete"){const X=t.current;if(X){const{from:Z,to:ye}=X.state.selection;X.state.doc.nodesBetween(Z,ye,ge=>{ge.isBlock&&ge.type.name!=="doc"&&ge.attrs.id&&_0(X,[],[ge.attrs.id],"delete")})}n(!1);return}if(q==="link"){const X=t.current;if(X){const Z=[];X.state.doc.descendants(ye=>{var ge;(ge=ye.marks)==null||ge.forEach(ne=>{var be,Ue;if(ne.type.name==="link"&&((Ue=(be=ne.attrs)==null?void 0:be.href)!=null&&Ue.startsWith("doc:"))){const Ze=ne.attrs.href.slice(4);Z.includes(Ze)||Z.push(Ze)}})}),N(Z)}fetch("/api/documents").then(Z=>Z.json()).then(Z=>{Array.isArray(Z)&&x(Z.map(ye=>({filename:ye.filename,title:ye.title}))),P(!1),R(""),k(!0)}).catch(()=>{});return}if(q==="unlink"){const X=t.current;X&&X.chain().focus().unsetLink().run(),n(!1);return}},[U,t]),ie=_.useCallback(()=>{c.trim()&&(U(h,c.trim()),u(""),g(""))},[U,h,c]),me=_.useCallback(j=>{const q=t.current;q&&q.chain().focus().setLink({href:`doc:${j}`}).run(),fetch("/api/auto-tag-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetFile:j})}).catch(()=>{}),n(!1),k(!1)},[t]),V=_.useCallback(()=>{const j=O.trim();if(!j)return;const q=t.current;q&&(fetch("/api/create-link-doc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:j})}).then(M=>M.json()).then(M=>{M.filename&&q.chain().focus().setLink({href:`doc:${M.filename}`}).run()}).catch(()=>{}),n(!1),k(!1),P(!1),R(""))},[t,O]);return e?v.jsx("div",{ref:le,className:"context-menu",style:{left:r.x,top:r.y},children:s?v.jsx("div",{className:"context-menu-loading",children:"Applying..."}):f?v.jsxs("div",{className:"context-menu-custom",children:[v.jsx("input",{autoFocus:!0,value:c,onChange:j=>u(j.target.value),onKeyDown:j=>{j.key==="Enter"&&ie(),j.key==="Escape"&&n(!1)},placeholder:"Custom instruction..."}),v.jsx("button",{onClick:ie,children:"Apply"})]}):y?v.jsxs("div",{className:"context-menu-link-picker",children:[v.jsx("div",{className:"context-menu-link-header",children:"Link to document"}),I?v.jsxs("div",{className:"context-menu-custom",children:[v.jsx("input",{autoFocus:!0,value:O,onChange:j=>R(j.target.value),onKeyDown:j=>{j.key==="Enter"&&V(),j.key==="Escape"&&P(!1)},placeholder:"New document title..."}),v.jsx("button",{onClick:V,children:"Create"})]}):v.jsx("button",{className:"context-menu-item context-menu-new-link",onClick:()=>P(!0),children:v.jsx("span",{children:"+ New link doc"})}),v.jsxs("div",{className:"context-menu-link-list",children:[C.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"context-menu-section-header",children:"Linked in this doc"}),w.filter(j=>C.includes(j.filename)).map(({filename:j,title:q})=>v.jsx("button",{className:"context-menu-item",onClick:()=>me(j),children:v.jsx("span",{children:q})},`linked-${j}`))]}),v.jsx("div",{className:"context-menu-section-header",children:"All documents"}),w.filter(j=>!C.includes(j.filename)).map(({filename:j,title:q})=>v.jsx("button",{className:"context-menu-item",onClick:()=>me(j),children:v.jsx("span",{children:q})},j)),w.length===0&&v.jsx("div",{className:"context-menu-loading",children:"No documents"})]})]}):H().map(j=>v.jsxs("button",{className:"context-menu-item",onClick:()=>G(j),children:[v.jsx("span",{children:j.label}),j.shortcut&&v.jsx("span",{className:"context-menu-shortcut",children:j.shortcut})]},j.action))}):null}function qh(t,e,n){let r=t.resolve(e);for(;r.depth>0;){const i=r.node(r.depth),s=r.before(r.depth),l=s+i.nodeSize;if(i.childCount===1)e=s,n=l,r=t.resolve(e);else break}return{from:e,to:n}}function gD(t,e){const n=Jn(t,e);if(!n)return!1;const{node:r,pos:i}=n;return t.chain().command(({tr:s})=>(s.setNodeMarkup(i,void 0,{...r.attrs,pendingStatus:null}),!0)).run(),!0}function yD(t,e){const n=Jn(t,e);if(!n)return!1;const{node:r,pos:i}=n;return t.chain().command(({tr:s})=>(s.setNodeMarkup(i,void 0,{...r.attrs,pendingStatus:null,pendingOriginalContent:null,pendingTextEdits:null}),!0)).run(),!0}function bD(t,e){var l;const n=Jn(t,e);if(!n)return!1;const{node:r,pos:i}=n;if(((l=r.attrs)==null?void 0:l.pendingStatus)!=="delete")return!0;const s=qh(t.state.doc,i,i+r.nodeSize);return t.chain().deleteRange(s).run(),!0}function vD(t,e){var l;const n=Jn(t,e);if(!n)return!0;const{node:r,pos:i}=n;if(((l=r.attrs)==null?void 0:l.pendingStatus)!=="insert")return!0;const s=qh(t.state.doc,i,i+r.nodeSize);return t.chain().deleteRange(s).run(),!0}function kD(t,e){var l,c;const n=Jn(t,e);if(!n)return!1;const{node:r,pos:i}=n;if(((l=r.attrs)==null?void 0:l.pendingStatus)!=="rewrite")return!0;const s=(c=r.attrs)==null?void 0:c.pendingOriginalContent;if(s)t.chain().deleteRange({from:i,to:i+r.nodeSize}).insertContentAt(i,s).run();else{const u=qh(t.state.doc,i,i+r.nodeSize);t.chain().deleteRange(u).run()}return!0}function ED(t,e){var s;const n=Jn(t,e);if(!n)return!1;const{node:r,pos:i}=n;return((s=r.attrs)==null?void 0:s.pendingStatus)!=="delete"||t.chain().command(({tr:l})=>(l.setNodeMarkup(i,void 0,{...r.attrs,pendingStatus:null}),!0)).run(),!0}function bw(t,e){var i;const n=Jn(t,e);if(!n)return!1;switch((i=n.node.attrs)==null?void 0:i.pendingStatus){case"insert":return gD(t,e);case"rewrite":return yD(t,e);case"delete":return bD(t,e);default:return!1}}function vw(t,e){var i;const n=Jn(t,e);if(!n)return!1;switch((i=n.node.attrs)==null?void 0:i.pendingStatus){case"insert":return vD(t,e);case"rewrite":return kD(t,e);case"delete":return ED(t,e);default:return!1}}function wD(t){const e=kw(t).reverse();for(const n of e)bw(t,n);t.view&&mw(t.view)}function xD(t){const e=kw(t).reverse();for(const n of e)vw(t,n);t.view&&mw(t.view)}function Nl(t){const e=[];return t.state.doc.descendants((n,r)=>{var s,l;const i=(s=n.attrs)==null?void 0:s.pendingStatus;return i&&((l=n.attrs)!=null&&l.id)&&e.push({nodeId:n.attrs.id,pos:r,pendingStatus:i}),!0}),e}function kw(t){return Nl(t).map(e=>e.nodeId)}function SD(t){let e=0,n=0,r=0;for(const i of t)i.pendingStatus==="insert"?e++:i.pendingStatus==="rewrite"?n++:i.pendingStatus==="delete"&&r++;return{insert:e,rewrite:n,delete:r,total:t.length}}function Sc(t,e){let n=-1;if(t.state.doc.descendants((i,s)=>{var l;return((l=i.attrs)==null?void 0:l.id)===e?(n=s,!1):!0}),n===-1)return;const r=t.view.nodeDOM(n);r&&r instanceof HTMLElement&&r.scrollIntoView({behavior:"smooth",block:"center"})}function CD(t){const[e,n]=_.useState([]),[r,i]=_.useState(0),s=_.useRef(),l=_.useCallback(()=>{if(!t||t.isDestroyed){n([]);return}const x=Nl(t);n(x),x.length===0?i(0):i(C=>Math.min(C,x.length-1))},[t]);_.useEffect(()=>{if(!t)return;const x=()=>{clearTimeout(s.current),s.current=setTimeout(l,50)};t.on("transaction",x),l();const C=setTimeout(()=>{if(t.isDestroyed)return;const N=Nl(t);N.length>0&&Sc(t,N[0].nodeId)},150);return()=>{t.off("transaction",x),clearTimeout(s.current),clearTimeout(C)}},[t,l]);const c=SD(e),u=e[r]??null,f=_.useCallback(()=>{if(e.length===0)return;const x=(r+1)%e.length;i(x),t&&e[x]&&Sc(t,e[x].nodeId)},[t,e,r]),p=_.useCallback(()=>{if(e.length===0)return;const x=(r-1+e.length)%e.length;i(x),t&&e[x]&&Sc(t,e[x].nodeId)},[t,e,r]),h=_.useCallback(()=>{if(!t||t.isDestroyed)return;const x=Nl(t);if(x.length===0)return;const C=Math.min(r,x.length-1);Sc(t,x[C].nodeId)},[t,r]),g=_.useCallback(()=>{!t||!u||(bw(t,u.nodeId),l(),h())},[t,u,l,h]),y=_.useCallback(()=>{!t||!u||(vw(t,u.nodeId),l(),h())},[t,u,l,h]),k=_.useCallback(()=>{t&&(wD(t),l())},[t,l]),w=_.useCallback(()=>{t&&(xD(t),l())},[t,l]);return{pendingNodes:e,counts:c,currentNode:u,currentIndex:r,hasPending:c.total>0,goToNext:f,goToPrevious:p,acceptCurrent:g,rejectCurrent:y,acceptAll:k,rejectAll:w,refresh:l}}const ko={strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"},ND=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M10 3L5 8l5 5",stroke:"currentColor",...ko})}),T0=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",...ko})}),_D=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M3 10l5-5 5 5",stroke:"currentColor",...ko})}),TD=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M3 6l5 5 5-5",stroke:"currentColor",...ko})}),M0=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M3 8.5l3.5 3.5L13 5",stroke:"currentColor",...ko})}),A0=()=>v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",...ko})});function MD({editor:t,pendingDocs:e,currentFilename:n,onSwitchDocument:r,sendMessage:i}){const{counts:s,currentNode:l,currentIndex:c,hasPending:u,goToNext:f,goToPrevious:p,acceptCurrent:h,rejectCurrent:g,acceptAll:y,rejectAll:k}=CD(t),w=e.filenames.length,x=O0(e.filenames,n)>=0?w-1:w,C=u||w>0,N=O0(e.filenames,n),I=_.useCallback(Q=>{if(!t||!n)return;Nl(t).length===0&&(i({type:"doc-update",document:t.getJSON(),filename:n}),i({type:"pending-resolved",filename:n,action:Q}))},[t,n,i]),P=_.useCallback(()=>{h(),I("accept")},[h,I]),O=_.useCallback(()=>{g(),I("reject")},[g,I]),R=_.useCallback(()=>{y(),I("accept")},[y,I]),$=_.useCallback(()=>{k(),I("reject")},[k,I]),te=_.useCallback(()=>{if(w===0||w===1&&N===0)return;const Q=N<=0?w-1:N-1;r(e.filenames[Q])},[w,N,e.filenames,r]),le=_.useCallback(()=>{if(w===0||w===1&&N===0)return;const Q=N>=w-1?0:N+1;r(e.filenames[Q])},[w,N,e.filenames,r]);if(_.useEffect(()=>{if(!C)return;const Q=H=>{if(!(H.target instanceof HTMLInputElement||H.target instanceof HTMLTextAreaElement)&&!(H.target instanceof HTMLElement&&H.target.closest("[contenteditable]")))switch(H.key){case"j":case"ArrowDown":!H.metaKey&&!H.ctrlKey&&(H.preventDefault(),f());break;case"k":case"ArrowUp":!H.metaKey&&!H.ctrlKey&&(H.preventDefault(),p());break;case"h":case"ArrowLeft":!H.metaKey&&!H.ctrlKey&&!H.altKey&&(H.preventDefault(),te());break;case"l":case"ArrowRight":!H.metaKey&&!H.ctrlKey&&!H.altKey&&(H.preventDefault(),le());break;case"a":!H.metaKey&&!H.ctrlKey&&!H.shiftKey&&(H.preventDefault(),P());break;case"r":!H.metaKey&&!H.ctrlKey&&(H.preventDefault(),O());break;case"A":H.shiftKey&&!H.metaKey&&!H.ctrlKey&&(H.preventDefault(),R());break;case"R":H.shiftKey&&!H.metaKey&&!H.ctrlKey&&(H.preventDefault(),$());break}};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[C,f,p,te,le,P,O,R,$]),!C)return null;if(l!=null&&l.pendingStatus,!u&&x>0)return v.jsxs("div",{className:"review-panel",children:[v.jsxs("div",{className:"review-panel__status",children:["No changes here — ",x," other doc",x>1?"s have":" has"," changes"]}),v.jsx("div",{className:"review-panel__divider"}),v.jsx("div",{className:"review-panel__nav",children:v.jsx("button",{className:"review-panel__btn",onClick:le,title:"Next doc (l)",children:v.jsx(T0,{})})})]});const ee=N>=0?N+1:"?";return v.jsxs("div",{className:"review-panel",children:[w>1&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"review-panel__nav",children:[v.jsx("button",{className:"review-panel__btn",onClick:te,title:"Previous doc (h)",children:v.jsx(ND,{})}),v.jsx("button",{className:"review-panel__btn",onClick:le,title:"Next doc (l)",children:v.jsx(T0,{})}),v.jsxs("span",{className:"review-panel__counter",children:[ee,"/",w]})]}),v.jsx("div",{className:"review-panel__divider"})]}),v.jsxs("div",{className:"review-panel__nav",children:[v.jsx("button",{className:"review-panel__btn",onClick:p,disabled:s.total<=1,title:"Previous (k)",children:v.jsx(_D,{})}),v.jsx("button",{className:"review-panel__btn",onClick:f,disabled:s.total<=1,title:"Next (j)",children:v.jsx(TD,{})}),v.jsxs("span",{className:"review-panel__counter",children:[c+1,"/",s.total]})]}),v.jsx("div",{className:"review-panel__divider"}),v.jsxs("div",{className:"review-panel__actions",children:[v.jsx("button",{className:"review-panel__accept",onClick:P,title:"Accept (a)",children:v.jsx(M0,{})}),v.jsx("button",{className:"review-panel__reject",onClick:O,title:"Reject (r)",children:v.jsx(A0,{})}),v.jsxs("button",{className:"review-panel__accept-all",onClick:R,title:"Accept all (Shift+A)",children:[v.jsx(M0,{}),v.jsx("span",{children:"All"})]}),v.jsxs("button",{className:"review-panel__reject-all",onClick:$,title:"Reject all (Shift+R)",children:[v.jsx(A0,{}),v.jsx("span",{children:"All"})]})]})]})}function O0(t,e){return t.indexOf(e)}function Cc(t){return t.type==="doc"?t.file:t.id}function Ew(t,e){for(const n of t)n.type==="doc"?e.add(n.file):n.type==="container"&&Ew(n.items,e)}function Wu(t){const e=new Date(t),n=Date.now()-e.getTime();return n<6e4?"just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:n<6048e5?`${Math.floor(n/864e5)}d ago`:e.toLocaleDateString()}function eh(t){return/^[A-Z]:[/\\]|^\//.test(t)}function ww(t){const e=t.replace(/\\/g,"/").split("/");return e.length>=2?e[e.length-2]:""}function AD(t){const e=new Date(t),n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-864e5),s=new Date(e.getFullYear(),e.getMonth(),e.getDate());return s.getTime()===r.getTime()?"Today":s.getTime()===i.getTime()?"Yesterday":n.getTime()-s.getTime()<6048e5?e.toLocaleDateString(void 0,{weekday:"long"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function OD(t,e){const[n,r]=_.useState([]),[i,s]=_.useState([]),[l,c]=_.useState(new Set),u=_.useRef(null),f=_.useCallback(()=>{fetch("/api/documents").then(h=>h.json()).then(h=>{Array.isArray(h)&&r(h)}).catch(()=>{})},[]),p=_.useCallback(()=>{fetch("/api/workspaces").then(h=>h.json()).then(async h=>{if(!Array.isArray(h))return;const g=await Promise.all(h.map(async k=>{try{const x=await(await fetch(`/api/workspaces/${encodeURIComponent(k.filename)}`)).json();return{...k,workspace:x}}catch{return k}}));s(g);const y=new Set;for(const k of g)k.workspace&&Ew(k.workspace.root,y);c(y)}).catch(()=>{})},[]);return _.useEffect(()=>{f()},[f,t]),_.useEffect(()=>{p()},[p,e,t]),_.useEffect(()=>{const h=requestAnimationFrame(()=>{var y;const g=(y=u.current)==null?void 0:y.querySelector(".sidebar-item.active");g==null||g.scrollIntoView({block:"nearest",behavior:"instant"})});return()=>cancelAnimationFrame(h)},[n]),{docs:n,workspaces:i,assignedFiles:l,fetchDocs:f,scrollRef:u}}function RD(t,e,n){const r=_.useCallback(N=>{fetch(`/api/documents/${encodeURIComponent(N)}`,{method:"DELETE"}).catch(()=>{})},[]),i=_.useCallback((N,I,P)=>{!P.trim()||P.trim()===I||fetch(`/api/documents/${encodeURIComponent(N)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:P.trim()})}).then(()=>e()).catch(()=>{})},[e]),s=_.useCallback(()=>{fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"Untitled Workspace"})}).catch(()=>{})},[]),l=_.useCallback(N=>{fetch(`/api/workspaces/${encodeURIComponent(N)}`,{method:"DELETE"}).catch(()=>{})},[]),c=_.useCallback((N,I)=>{fetch("/api/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}).then(P=>P.json()).then(P=>{if(P.filename)return fetch(`/api/workspaces/${encodeURIComponent(N)}/docs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:P.filename,title:P.title||"Untitled",containerId:I})})}).catch(()=>{})},[]),u=_.useCallback((N,I)=>{fetch(`/api/workspaces/${encodeURIComponent(N)}/docs/${encodeURIComponent(I)}`,{method:"DELETE"}).catch(()=>{})},[]),f=_.useCallback((N,I)=>{fetch(`/api/workspaces/${encodeURIComponent(N)}/containers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"Untitled",parentContainerId:I})}).catch(()=>{})},[]),p=_.useCallback((N,I)=>{fetch(`/api/workspaces/${encodeURIComponent(N)}/containers/${encodeURIComponent(I)}`,{method:"DELETE"}).catch(()=>{})},[]),h=_.useCallback((N,I,P)=>{P.trim()&&fetch(`/api/workspaces/${encodeURIComponent(N)}/containers/${encodeURIComponent(I)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.trim()})}).catch(()=>{})},[]),[g,y]=_.useState({}),k=_.useRef(-1);_.useEffect(()=>{n!==k.current&&(k.current=n??0,fetch("/api/documents").then(N=>N.json()).then(N=>{const I={};return Promise.all(N.map(P=>fetch(`/api/doc-tags/${encodeURIComponent(P.filename)}`).then(O=>O.json()).then(O=>{var R;(R=O.tags)!=null&&R.length&&(I[P.filename]=O.tags)}).catch(()=>{}))).then(()=>y(I))}).catch(()=>{}))},[n]);const w=_.useCallback(N=>g[N]||[],[g]),x=_.useCallback((N,I)=>{I.trim()&&(y(P=>{const O=P[N]||[];return O.includes(I.trim())?P:{...P,[N]:[...O,I.trim()]}}),fetch(`/api/doc-tags/${encodeURIComponent(N)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:I.trim()})}).catch(()=>{}))},[]),C=_.useCallback((N,I)=>{y(P=>{const R=(P[N]||[]).filter($=>$!==I);if(R.length===0){const $={...P};return delete $[N],$}return{...P,[N]:R}}),fetch(`/api/doc-tags/${encodeURIComponent(N)}/${encodeURIComponent(I)}`,{method:"DELETE"}).catch(()=>{})},[]);return{fetchDocs:e,handleDelete:r,handleRename:i,handleCreateWorkspace:s,handleDeleteWorkspace:l,handleCreateInWorkspace:c,handleRemoveFromWorkspace:u,handleCreateContainer:f,handleDeleteContainer:p,handleRenameContainer:h,getDocTags:w,handleAddTag:x,handleRemoveTag:C}}function ID({docs:t,workspaces:e,assignedFiles:n,scrollRef:r,setCollapsedSections:i}){const[s,l]=_.useState(null),[c,u]=_.useState(null),f=_.useRef(null),p=_.useRef(null),h=_.useRef(null),g=_.useRef(null),y=_.useRef(null),k=5,w=(ee,Q,H)=>H==="before"?Q>0?Cc(ee[Q-1]):null:Cc(ee[Q]),x=_.useCallback((ee,Q)=>{if(Q===null){const U=t.filter(ie=>!n.has(ie.filename)).map(ie=>({type:"doc",file:ie.filename,title:ie.title})),G=U.findIndex(ie=>Cc(ie)===ee);return G>=0?{siblings:U,index:G,containerId:null}:null}const H=e.find(U=>U.filename===Q);if(!(H!=null&&H.workspace))return null;const K=(U,G)=>{for(let ie=0;ie<U.length;ie++){if(Cc(U[ie])===ee)return{siblings:U,index:ie,containerId:G};if(U[ie].type==="container"){const me=K(U[ie].items,U[ie].id);if(me)return me}}return null};return K(H.workspace.root,null)},[t,n,e]),C=_.useCallback(()=>{l(null),u(null),y.current=null,g.current=null,h.current&&(h.current.remove(),h.current=null),f.current&&(clearTimeout(f.current),f.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),document.body.style.userSelect=""},[]),N=_.useCallback((ee,Q)=>{if(!ee||!Q)return;if(ee.type==="workspace"){const V=Q.itemId;if(V===ee.filename)return;const j=e.map(A=>A.filename),q=j.indexOf(ee.filename);if(q<0)return;j.splice(q,1);let M=j.indexOf(V);if(M<0)return;Q.position==="after"&&(M+=1),j.splice(M,0,ee.filename),fetch("/api/workspaces/reorder",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:j})}).catch(()=>{});return}const{wsFilename:H,containerId:K,afterId:U}=Q,G=ee.type==="doc"?ee.file:ee.id,ie=ee.sourceWs;if(Q.itemId===G)return;if(ee.type==="container"){if(ie!==H||!H)return;fetch(`/api/workspaces/${encodeURIComponent(H)}/docs/${encodeURIComponent(G)}/move`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetContainerId:K??null,afterFile:U})}).catch(()=>{});return}const me=ee.file;if(!(ie===null&&H===null)){if(ie===null&&H!==null){fetch(`/api/workspaces/${encodeURIComponent(H)}/docs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:me,title:me.replace(/\.md$/,""),containerId:K??null,afterFile:U})}).catch(()=>{});return}if(ie!==null&&H===null){fetch(`/api/workspaces/${encodeURIComponent(ie)}/docs/${encodeURIComponent(me)}`,{method:"DELETE"}).catch(()=>{});return}if(ie===H&&H!==null){fetch(`/api/workspaces/${encodeURIComponent(H)}/docs/${encodeURIComponent(me)}/move`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetContainerId:K??null,afterFile:U})}).catch(()=>{});return}ie!==null&&H!==null&&fetch(`/api/workspaces/${encodeURIComponent(H)}/docs/${encodeURIComponent(me)}/cross-move`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceWorkspace:ie,containerId:K??null,afterFile:U,title:me.replace(/\.md$/,"")})}).catch(()=>{})}},[e]),I=_.useCallback((ee,Q)=>{const H=h.current;H&&(H.style.display="none");const K=document.elementFromPoint(ee,Q);if(H&&(H.style.display=""),!K)return null;if((s==null?void 0:s.type)==="workspace"){const X=K.closest("[data-ws-drag]");if(X){const Z=X.dataset.wsDrag,ye=X.getBoundingClientRect(),ge=(Q-ye.top)/ye.height;return{itemId:Z,position:ge<.5?"before":"after",wsFilename:null,containerId:null,afterId:null}}return null}const U=K.closest("[data-drag-id]");if(!U){const X=K.closest("[data-drop-ws]");return X?{itemId:"__section__",position:"inside",wsFilename:X.dataset.dropWs==="__docs__"?null:X.dataset.dropWs,containerId:X.dataset.dropContainer||null,afterId:null}:null}const G=U.dataset.dragId,ie=U.dataset.dragType,me=U.dataset.dragWs==="__docs__"?null:U.dataset.dragWs,V=U.getBoundingClientRect(),j=(Q-V.top)/V.height;if(ie==="container-header"){const X=G,Z=U.dataset.dragParent||null,ye=x(X,me);return ye?j<.25?{itemId:X,position:"before",wsFilename:me,containerId:Z,afterId:w(ye.siblings,ye.index,"before")}:j>.75?{itemId:X,position:"after",wsFilename:me,containerId:Z,afterId:w(ye.siblings,ye.index,"after")}:{itemId:X,position:"inside",wsFilename:me,containerId:X,afterId:null}:null}const q=U.dataset.dragContainer||null,M=x(G,me);if(!M)return null;const A=j<.5?"before":"after";return{itemId:G,position:A,wsFilename:me,containerId:q,afterId:w(M.siblings,M.index,A)}},[x,s]),P=_.useCallback(ee=>{const Q=r.current;if(!Q)return;const H=Q.getBoundingClientRect(),K=80,U=18;let G=0;if(ee<H.top+K?G=-U*Math.max(0,1-(ee-H.top)/K):ee>H.bottom-K&&(G=U*Math.max(0,1-(H.bottom-ee)/K)),p.current&&(cancelAnimationFrame(p.current),p.current=null),G!==0){const ie=()=>{Q.scrollTop+=G,p.current=requestAnimationFrame(ie)};p.current=requestAnimationFrame(ie)}},[r]),O=_.useCallback((ee,Q)=>{const H=h.current;H&&(H.style.display="none");const K=document.elementFromPoint(ee,Q);H&&(H.style.display="");const U=K==null?void 0:K.closest("[data-section-key]");if(!U){f.current&&(clearTimeout(f.current),f.current=null);return}const G=U.dataset.sectionKey;f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{i(ie=>{if(!ie.has(G))return ie;const me=new Set(ie);return me.delete(G),me})},500)},[i]);_.useEffect(()=>{if(!s)return;const ee=H=>{h.current&&(h.current.style.left=`${H.clientX+12}px`,h.current.style.top=`${H.clientY-8}px`),u(I(H.clientX,H.clientY)),P(H.clientY),O(H.clientX,H.clientY)},Q=H=>{N(s,I(H.clientX,H.clientY)),C()};return window.addEventListener("pointermove",ee),window.addEventListener("pointerup",Q),()=>{window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",Q)}},[s,I,N,C,P,O]);const R=_.useCallback((ee,Q,H)=>{if(ee.button!==0||ee.target.closest("input, button, .sidebar-tag-remove, .sidebar-tag-add, .sidebar-container-actions, .sidebar-delete-btn, .sidebar-confirm-delete, .sidebar-inline-confirm"))return;g.current={x:ee.clientX,y:ee.clientY},y.current=Q;const U=ie=>{if(!g.current||!y.current)return;const me=ie.clientX-g.current.x,V=ie.clientY-g.current.y;if(Math.abs(me)+Math.abs(V)>=k){document.body.style.userSelect="none",window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",G),l(y.current),y.current=null;const j=document.createElement("div");j.style.cssText="position:fixed;pointer-events:none;z-index:9999;padding:4px 10px;background:var(--bg-surface, white);border:1px solid var(--border, #cbd5e1);border-radius:6px;font-size:12px;box-shadow:0 2px 8px rgba(0,0,0,0.12);max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink-dark, #334155);",j.textContent=H,document.body.appendChild(j),h.current=j,j.style.left=`${ie.clientX+12}px`,j.style.top=`${ie.clientY-8}px`}},G=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",G),g.current=null,y.current=null,document.body.style.userSelect=""};window.addEventListener("pointermove",U),window.addEventListener("pointerup",G)},[]);return{draggedItem:s,dropIndicator:c,handlePointerDown:R,dropClass:ee=>!c||c.itemId!==ee?"":c.position==="before"?"drop-before":c.position==="after"?"drop-after":c.position==="inside"?"drop-inside":"",isDragging:ee=>s?s.type==="doc"?s.file===ee:s.type==="workspace"?s.filename===ee:s.id===ee:!1,isContainerDropTarget:ee=>!c||!s?!1:c.containerId===ee}}function xw(t,e){if(!e)return!0;for(const n of t)if(n.type==="container"&&(n.id===e||xw(n.items,e)))return!0;return!1}function LD({docs:t,workspaces:e,assignedFiles:n,pendingDocs:r,onSwitchDocument:i,onCreateDocument:s,actions:l,scrollRef:c,writingTitle:u,writingTarget:f}){const[p,h]=_.useState(null),[g,y]=_.useState(""),[k,w]=_.useState(null),[x,C]=_.useState(()=>{try{const A=localStorage.getItem("ow-collapsed-sections");return A?new Set(JSON.parse(A)):new Set}catch{return new Set}}),[N,I]=_.useState(null),[P,O]=_.useState(null),[R,$]=_.useState(""),[te,le]=_.useState(null),[ee,Q]=_.useState(""),{draggedItem:H,dropIndicator:K,handlePointerDown:U,dropClass:G,isDragging:ie,isContainerDropTarget:me}=ID({docs:t,workspaces:e,assignedFiles:n,scrollRef:c,setCollapsedSections:C}),V=A=>{C(X=>{const Z=new Set(X);return Z.has(A)?Z.delete(A):Z.add(A),localStorage.setItem("ow-collapsed-sections",JSON.stringify([...Z])),Z})},j=t.filter(A=>!n.has(A.filename)),q=(A,X,Z,ye,ge)=>v.jsxs("div",{className:`sidebar-item ${A.isActive?"active":""} ${ie(A.filename)?"dragging":""} ${G(A.filename)}`,"data-drag-id":A.filename,"data-drag-type":"doc","data-drag-ws":X||"__docs__","data-drag-container":Z||"",onPointerDown:ne=>U(ne,{type:"doc",file:A.filename,sourceWs:X||null},A.title),onClick:()=>!A.isActive&&!H&&i(A.filename),onDoubleClick:()=>{h(A.filename),y(A.title)},children:[p===A.filename?v.jsx("input",{className:"sidebar-rename-input",value:g,onChange:ne=>y(ne.target.value),onBlur:()=>{l.handleRename(A.filename,A.title,g),h(null)},onKeyDown:ne=>{ne.key==="Enter"&&(l.handleRename(A.filename,A.title,g),h(null)),ne.key==="Escape"&&h(null)},autoFocus:!0,onClick:ne=>ne.stopPropagation()}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"sidebar-item-title",children:[v.jsx("span",{className:"sidebar-item-title-text",children:A.title}),r.filenames.includes(A.filename)&&v.jsx("span",{className:"sidebar-pending-dot"})]}),eh(A.filename)&&v.jsx("div",{className:"sidebar-item-context",children:ww(A.filename)}),v.jsxs("div",{className:"sidebar-item-meta",children:[A.wordCount.toLocaleString()," words · ",Wu(A.lastModified)]}),v.jsxs("div",{className:"sidebar-tags",children:[l.getDocTags(A.filename).map(ne=>v.jsxs("span",{className:"sidebar-tag",onClick:be=>be.stopPropagation(),children:[ne,v.jsx("span",{className:"sidebar-tag-remove",onClick:be=>{be.stopPropagation(),l.handleRemoveTag(A.filename,ne)},children:"×"})]},ne)),te===A.filename?v.jsx("input",{className:"sidebar-tag-input",value:ee,onChange:ne=>Q(ne.target.value),onBlur:()=>{ee.trim()&&l.handleAddTag(A.filename,ee),le(null)},onKeyDown:ne=>{ne.key==="Enter"&&(l.handleAddTag(A.filename,ee),le(null),Q("")),ne.key==="Escape"&&(le(null),Q(""))},autoFocus:!0,onClick:ne=>ne.stopPropagation(),placeholder:"tag..."}):v.jsx("button",{className:"sidebar-tag-add",onClick:ne=>{ne.stopPropagation(),le(A.filename),Q("")},children:"+"})]})]}),X?v.jsx("button",{className:"sidebar-delete-btn",onClick:ne=>{ne.stopPropagation(),l.handleRemoveFromWorkspace(X,A.filename)},title:"Remove from workspace",children:"×"}):k===A.filename?v.jsxs("div",{className:"sidebar-confirm-delete",onClick:ne=>ne.stopPropagation(),children:[v.jsx("span",{children:"Delete?"}),v.jsx("button",{onClick:()=>{l.handleDelete(A.filename),w(null)},children:"Yes"}),v.jsx("button",{onClick:()=>w(null),children:"No"})]}):v.jsx("button",{className:"sidebar-delete-btn",onClick:ne=>{ne.stopPropagation(),w(A.filename)},title:"Delete document",children:"×"})]},A.filename),M=(A,X,Z,ye,ge,ne)=>{if(A.type==="doc"){const Ve=t.find(Je=>Je.filename===A.file);return Ve?q(Ve,Z,ye):eh(A.file)?v.jsx("div",{className:"sidebar-item sidebar-unavailable",children:v.jsxs("div",{className:"sidebar-item-title",children:[A.title||A.file," (unavailable)"]})},A.file):v.jsxs("div",{className:"sidebar-item sidebar-missing",children:[v.jsxs("div",{className:"sidebar-item-title",children:[A.title||A.file," (missing)"]}),v.jsx("button",{className:"sidebar-delete-btn",onClick:()=>l.handleRemoveFromWorkspace(Z,A.file),title:"Remove",children:"×"})]},A.file)}const be=A,Ue=`container-${be.id}`,Ze=x.has(Ue),un=X<=2?`depth-${X}`:"depth-2";return v.jsxs("div",{className:`sidebar-container ${un} ${Ze?"collapsed":""} ${G(be.id)} ${me(be.id)?"drop-inside":""}`,children:[v.jsxs("div",{className:`sidebar-container-header ${(K==null?void 0:K.itemId)===be.id&&K.position==="inside"?"drop-inside":""}`,"data-drag-id":be.id,"data-drag-type":"container-header","data-drag-ws":Z,"data-drag-parent":ye||"","data-section-key":Ue,onPointerDown:Ve=>U(Ve,{type:"container",id:be.id,sourceWs:Z},be.name),onClick:()=>!H&&V(Ue),children:[v.jsx("span",{className:`sidebar-chevron ${Ze?"collapsed":""}`,children:"▾"}),P===be.id?v.jsx("input",{className:"sidebar-rename-input",value:R,onChange:Ve=>$(Ve.target.value),onBlur:()=>{l.handleRenameContainer(Z,be.id,R),O(null)},onKeyDown:Ve=>{Ve.key==="Enter"&&(l.handleRenameContainer(Z,be.id,R),O(null)),Ve.key==="Escape"&&O(null)},autoFocus:!0,onClick:Ve=>Ve.stopPropagation()}):v.jsx("span",{className:"sidebar-container-name",onDoubleClick:Ve=>{Ve.stopPropagation(),O(be.id),$(be.name)},children:be.name}),v.jsxs("div",{className:"sidebar-container-actions",children:[v.jsx("button",{className:"sidebar-new-btn",onClick:Ve=>{Ve.stopPropagation(),l.handleCreateInWorkspace(Z,be.id)},title:"New doc",children:"+"}),X<2&&v.jsx("button",{className:"sidebar-new-btn",onClick:Ve=>{Ve.stopPropagation(),l.handleCreateContainer(Z,be.id)},title:"New sub-container",children:"☐"}),v.jsx("button",{className:"sidebar-new-btn sidebar-container-delete",onClick:Ve=>{Ve.stopPropagation(),l.handleDeleteContainer(Z,be.id)},title:"Delete container",children:"×"})]})]}),!Ze&&v.jsxs("div",{className:"sidebar-container-list","data-drop-ws":Z,"data-drop-container":be.id,children:[u&&(f==null?void 0:f.wsFilename)===Z&&f.containerId===be.id&&v.jsxs("div",{className:"sidebar-item sidebar-writing-placeholder",children:[v.jsxs("div",{className:"sidebar-item-title",children:[v.jsx("span",{className:"sidebar-writing-spinner"}),v.jsx("span",{className:"sidebar-item-title-text",children:u})]}),v.jsx("div",{className:"sidebar-item-meta",children:"Writing..."})]}),(u&&(f==null?void 0:f.wsFilename)===Z&&f.containerId===be.id?be.items.filter(Ve=>Ve.type!=="doc"||Ve.title!==u):be.items).map((Ve,Je)=>M(Ve,X+1,Z,be.id,be.items)),be.items.length===0&&!u&&v.jsx("div",{className:"sidebar-empty",children:H?"Drop here":"Empty"})]})]},be.id)};return v.jsxs("div",{className:"sidebar-scroll",ref:c,children:[v.jsxs("div",{className:`sidebar-section sidebar-docs-section ${x.has("docs")?"docs-collapsed":""}`,children:[v.jsxs("div",{className:"sidebar-section-header","data-section-key":"docs",onClick:()=>V("docs"),children:[v.jsx("span",{className:`sidebar-chevron ${x.has("docs")?"collapsed":""}`,children:"▾"}),v.jsx("span",{className:"sidebar-label",children:"Documents"}),v.jsx("button",{className:"sidebar-new-btn",onClick:A=>{A.stopPropagation(),s()},title:"New document",children:"+"})]}),!x.has("docs")&&v.jsxs("div",{className:"sidebar-section-list","data-drop-ws":"__docs__",children:[u&&(!f||!e.some(A=>A.filename===(f==null?void 0:f.wsFilename)))&&v.jsxs("div",{className:"sidebar-item sidebar-writing-placeholder",children:[v.jsxs("div",{className:"sidebar-item-title",children:[v.jsx("span",{className:"sidebar-writing-spinner"}),v.jsx("span",{className:"sidebar-item-title-text",children:u})]}),v.jsx("div",{className:"sidebar-item-meta",children:"Writing..."})]}),(u?j.filter(A=>A.title!==u):j).map((A,X)=>(j.map(Z=>({type:"doc",file:Z.filename,title:Z.title})),q(A,void 0,null))),j.length===0&&v.jsx("div",{className:"sidebar-empty",children:H?"Drop here to unassign":"No unassigned documents"})]})]}),e.map(A=>{var ye;const X=((ye=A.workspace)==null?void 0:ye.root)||[],Z=x.has(A.filename);return v.jsxs("div",{className:`sidebar-section sidebar-workspace-section ${Z?"ws-collapsed":""} ${ie(A.filename)?"dragging":""} ${(K==null?void 0:K.itemId)===A.filename?K.position==="before"?"drop-before":"drop-after":""}`,children:[v.jsxs("div",{className:"sidebar-section-header","data-section-key":A.filename,"data-ws-drag":A.filename,onPointerDown:ge=>U(ge,{type:"workspace",filename:A.filename},A.title),onClick:()=>!H&&V(A.filename),children:[v.jsx("span",{className:`sidebar-chevron ${Z?"collapsed":""}`,children:"▾"}),v.jsx("span",{className:"sidebar-label sidebar-workspace-label",children:A.title}),v.jsxs("div",{className:"sidebar-workspace-actions",children:[v.jsx("button",{className:"sidebar-new-btn",onClick:ge=>{ge.stopPropagation(),l.handleCreateInWorkspace(A.filename,null)},title:"New document",children:"+"}),v.jsx("button",{className:"sidebar-new-btn",onClick:ge=>{ge.stopPropagation(),l.handleCreateContainer(A.filename,null)},title:"New container",children:"☐"}),N===A.filename?v.jsxs("span",{className:"sidebar-inline-confirm",onClick:ge=>ge.stopPropagation(),children:[v.jsx("button",{onClick:()=>{l.handleDeleteWorkspace(A.filename),I(null)},children:"Yes"}),v.jsx("button",{onClick:()=>I(null),children:"No"})]}):v.jsx("button",{className:"sidebar-new-btn sidebar-workspace-delete",onClick:ge=>{ge.stopPropagation(),I(A.filename)},title:"Delete workspace",children:"×"})]})]}),!Z&&v.jsxs("div",{className:"sidebar-section-list","data-drop-ws":A.filename,children:[u&&(f==null?void 0:f.wsFilename)===A.filename&&(f.containerId===null||!xw(X,f.containerId))&&v.jsxs("div",{className:"sidebar-item sidebar-writing-placeholder",children:[v.jsxs("div",{className:"sidebar-item-title",children:[v.jsx("span",{className:"sidebar-writing-spinner"}),v.jsx("span",{className:"sidebar-item-title-text",children:u})]}),v.jsx("div",{className:"sidebar-item-meta",children:"Writing..."})]}),(u&&(f==null?void 0:f.wsFilename)===A.filename&&f.containerId===null?X.filter(ge=>ge.type!=="doc"||ge.title!==u):X).map((ge,ne)=>M(ge,0,A.filename,null)),X.length===0&&!u&&v.jsx("div",{className:"sidebar-empty",children:H?"Drop here to add":"Empty workspace"})]})]},A.filename)}),v.jsx("div",{className:"sidebar-new-workspace",children:v.jsx("button",{onClick:l.handleCreateWorkspace,children:"+ New Workspace"})})]})}function DD({docs:t,workspaces:e,assignedFiles:n,pendingDocs:r,onSwitchDocument:i,onCreateDocument:s,actions:l,scrollRef:c}){const[u,f]=_.useState(null),p=[...t].sort((k,w)=>new Date(w.lastModified).getTime()-new Date(k.lastModified).getTime()),h=[];let g="";for(const k of p){const w=AD(k.lastModified);w!==g&&(h.push({label:w,docs:[]}),g=w),h[h.length-1].docs.push(k)}const y=k=>{for(const w of e){if(!w.workspace)continue;const x=C=>{for(const N of C)if(N.type==="doc"&&N.file===k||N.type==="container"&&x(N.items))return!0;return!1};if(x(w.workspace.root))return w.title}return null};return v.jsxs("div",{className:"sidebar-scroll tl-scroll",ref:c,children:[v.jsxs("div",{className:"tl-header",children:[v.jsx("span",{className:"tl-title",children:"Timeline"}),v.jsx("button",{className:"sidebar-new-btn",onClick:s,title:"New document",children:"+"})]}),h.map(k=>v.jsxs("div",{className:"tl-group",children:[v.jsx("div",{className:"tl-date",children:k.label}),k.docs.map(w=>{const x=y(w.filename);return v.jsxs("div",{className:`tl-item ${w.isActive?"active":""}`,onClick:()=>!w.isActive&&i(w.filename),children:[v.jsx("div",{className:"tl-dot"}),v.jsxs("div",{className:"tl-content",children:[v.jsxs("div",{className:"tl-item-title",children:[v.jsx("span",{children:w.title}),r.filenames.includes(w.filename)&&v.jsx("span",{className:"sidebar-pending-dot"})]}),eh(w.filename)&&v.jsx("div",{className:"tl-item-context",children:ww(w.filename)}),v.jsxs("div",{className:"tl-item-meta",children:[w.wordCount.toLocaleString()," words · ",Wu(w.lastModified)]}),x&&v.jsx("div",{className:"tl-badge",children:x})]}),u===w.filename?v.jsxs("div",{className:"sidebar-confirm-delete",onClick:C=>C.stopPropagation(),children:[v.jsx("span",{children:"Delete?"}),v.jsx("button",{onClick:()=>{l.handleDelete(w.filename),f(null)},children:"Yes"}),v.jsx("button",{onClick:()=>f(null),children:"No"})]}):v.jsx("button",{className:"sidebar-delete-btn",onClick:C=>{C.stopPropagation(),f(w.filename)},title:"Delete",children:"×"})]},w.filename)})]},k.label)),t.length===0&&v.jsx("div",{className:"sidebar-empty",children:"No documents yet"})]})}function PD({docs:t,workspaces:e,assignedFiles:n,pendingDocs:r,onSwitchDocument:i,actions:s,scrollRef:l}){const[c,u]=_.useState([]),[f,p]=_.useState(null),[h,g]=_.useState(null),y=_.useRef(null);_.useEffect(()=>{if(!f)return;const K=U=>{y.current&&!y.current.contains(U.target)&&p(null)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[f]);const k=(K,U)=>{for(const G of K)if(G.type==="container"){if(G.id===U)return G;const ie=k(G.items,U);if(ie)return ie}return null},w=K=>{let U=0;for(const G of K)G.type==="doc"?U++:G.type==="container"&&(U+=w(G.items));return U},x=K=>{const U=[];for(const G of K)G.type==="doc"?U.push(G.file):G.type==="container"&&U.push(...x(G.items));return U},C=_.useMemo(()=>{if(c.length===0)return[];const K=c[c.length-1],U=e.find(ie=>ie.filename===K.wsFilename);if(!(U!=null&&U.workspace))return[];if(K.type==="workspace")return U.workspace.root;const G=k(U.workspace.root,K.key);return G?G.items:[]},[c,e]),N=C.filter(K=>K.type==="container"),I=_.useMemo(()=>{const K=C.filter(U=>U.type==="doc").map(U=>U.file);return t.filter(U=>K.includes(U.filename))},[C,t]),P=K=>{const U=x(K.items);return t.filter(G=>U.includes(G.filename))},O=K=>{const U=e.find(ie=>ie.filename===K);if(!(U!=null&&U.workspace))return[];const G=x(U.workspace.root);return t.filter(ie=>G.includes(ie.filename))},R=_.useMemo(()=>t.filter(K=>!n.has(K.filename)),[t,n]),$=K=>{u(U=>[...U,K]),p(null)},te=()=>{u(K=>K.slice(0,-1)),p(null)},le=(K,U)=>{if(f===K){p(null);return}const ie=U.currentTarget.getBoundingClientRect();g({top:ie.bottom+4,left:ie.left}),p(K)},ee=K=>{i(K),p(null)},Q=c.length>1?c[c.length-2].title:"All",H=()=>{if(!f)return[];if(f==="__unassigned__")return R;if(f==="__level-docs__")return I;const K=e.find(U=>U.filename===f);if(K)return O(K.filename);for(const U of e){if(!U.workspace)continue;const G=k(U.workspace.root,f);if(G)return P(G)}return[]};return v.jsxs("div",{className:"board-scroll",ref:l,children:[c.length===0?v.jsx("button",{className:"board-back board-back--static",tabIndex:-1,children:"All"}):v.jsxs("button",{className:"board-back",onClick:te,title:`Back to ${Q}`,children:["← ",Q]}),c.length===0&&v.jsxs(v.Fragment,{children:[R.length>0&&v.jsxs("button",{className:`board-chip ${f==="__unassigned__"?"open":""}`,onClick:K=>le("__unassigned__",K),children:["Documents ",v.jsx("span",{className:"board-chip-count",children:R.length})]}),e.map(K=>{var G;const U=(G=K.workspace)==null?void 0:G.root.some(ie=>ie.type==="container");return v.jsxs("button",{className:`board-chip ${f===K.filename?"open":""}`,onClick:ie=>U?$({type:"workspace",key:K.filename,title:K.title,wsFilename:K.filename}):le(K.filename,ie),children:[K.title," ",v.jsx("span",{className:"board-chip-count",children:K.docCount}),U&&v.jsx("span",{className:"board-chip-arrow",children:"›"})]},K.filename)}),v.jsx("button",{className:"board-chip board-chip-add",onClick:s.handleCreateWorkspace,title:"New workspace",children:"+"})]}),c.length>0&&v.jsxs(v.Fragment,{children:[I.length>0&&v.jsxs("button",{className:`board-chip board-chip-docs ${f==="__level-docs__"?"open":""}`,onClick:K=>le("__level-docs__",K),children:["Docs ",v.jsx("span",{className:"board-chip-count",children:I.length})]}),N.map(K=>{const U=K.items.some(G=>G.type==="container");return v.jsxs("button",{className:`board-chip ${f===K.id?"open":""}`,onClick:G=>U?$({type:"container",key:K.id,title:K.name,wsFilename:c[c.length-1].wsFilename}):le(K.id,G),children:[K.name," ",v.jsx("span",{className:"board-chip-count",children:w(K.items)}),U&&v.jsx("span",{className:"board-chip-arrow",children:"›"})]},K.id)})]}),f&&h&&(()=>{const K=H();return v.jsxs("div",{className:"board-dropdown",ref:y,style:{position:"fixed",top:h.top,left:h.left},children:[K.map(U=>v.jsxs("div",{className:`board-dropdown-item ${U.isActive?"active":""}`,onClick:()=>ee(U.filename),children:[v.jsxs("span",{className:"board-dropdown-title",children:[U.title,r.filenames.includes(U.filename)&&v.jsx("span",{className:"board-pending-dot"})]}),v.jsxs("span",{className:"board-dropdown-meta",children:[U.wordCount.toLocaleString()," words · ",Wu(U.lastModified)]})]},U.filename)),K.length===0&&v.jsx("div",{className:"board-dropdown-empty",children:"No documents"})]})})()]})}function BD({docs:t,workspaces:e,assignedFiles:n,pendingDocs:r,onSwitchDocument:i,actions:s,scrollRef:l}){const[c,u]=_.useState([]),f=(N,I)=>{for(const P of N)if(P.type==="container"){if(P.id===I)return P;const O=f(P.items,I);if(O)return O}return null},p=N=>{let I=0;for(const P of N)P.type==="doc"?I++:P.type==="container"&&(I+=p(P.items));return I},h=_.useMemo(()=>{if(c.length===0)return[];const N=c[c.length-1],I=e.find(O=>O.filename===N.wsFilename);if(!(I!=null&&I.workspace))return[];if(N.type==="workspace")return I.workspace.root;const P=f(I.workspace.root,N.key);return P?P.items:[]},[c,e]),g=h.filter(N=>N.type==="container"),y=_.useMemo(()=>{if(c.length===0)return t.filter(I=>!n.has(I.filename));const N=h.filter(I=>I.type==="doc").map(I=>I.file);return t.filter(I=>N.includes(I.filename))},[c,h,t,n]),k=N=>u(I=>[...I,N]),w=()=>u(N=>N.slice(0,-1)),x=c.length>1?c[c.length-2].title:"Shelf",C=c.length>0?c[c.length-1].title:"Documents";return v.jsxs("div",{className:"shelf-wrapper",children:[v.jsxs("div",{className:"shelf-spines",ref:l,children:[c.length>0&&v.jsxs("button",{className:"shelf-back",onClick:w,title:`Back to ${x}`,children:[v.jsx("span",{className:"shelf-back-arrow",children:"←"}),v.jsx("span",{className:"shelf-back-label",children:x})]}),c.length===0&&v.jsxs(v.Fragment,{children:[e.map(N=>v.jsxs("div",{className:"shelf-section-spine",onClick:()=>k({type:"workspace",key:N.filename,title:N.title,wsFilename:N.filename}),title:N.title,children:[v.jsx("span",{className:"shelf-section-title",children:N.title}),v.jsx("span",{className:"shelf-section-count",children:N.docCount})]},N.filename)),v.jsx("button",{className:"shelf-add",onClick:s.handleCreateWorkspace,title:"New workspace",children:"+"})]}),c.length>0&&g.map(N=>v.jsxs("div",{className:"shelf-section-spine shelf-section-container",onClick:()=>k({type:"container",key:N.id,title:N.name,wsFilename:c[c.length-1].wsFilename}),title:N.name,children:[v.jsx("span",{className:"shelf-section-title",children:N.name}),v.jsx("span",{className:"shelf-section-count",children:p(N.items)})]},N.id))]}),v.jsxs("div",{className:"shelf-docs",children:[v.jsx("div",{className:"shelf-docs-header",children:C}),v.jsxs("div",{className:"shelf-docs-list",children:[y.map(N=>v.jsxs("div",{className:`shelf-doc-item ${N.isActive?"active":""}`,onClick:()=>i(N.filename),children:[v.jsxs("div",{className:"shelf-doc-title",children:[v.jsx("span",{children:N.title}),r.filenames.includes(N.filename)&&v.jsx("span",{className:"shelf-pending-dot"})]}),v.jsxs("div",{className:"shelf-doc-meta",children:[N.wordCount.toLocaleString()," words · ",Wu(N.lastModified)]})]},N.filename)),y.length===0&&v.jsx("div",{className:"shelf-docs-empty",children:"No documents"})]})]})]})}function R0({open:t,onSwitchDocument:e,onCreateDocument:n,refreshKey:r,workspacesRefreshKey:i,pendingDocs:s,writingTitle:l,writingTarget:c,onClose:u}){const{docs:f,workspaces:p,assignedFiles:h,fetchDocs:g,scrollRef:y}=OD(r,i),k=RD(p,g,r),w=Tu(),x={docs:f,workspaces:p,assignedFiles:h,pendingDocs:s,writingTitle:l,writingTarget:c,onSwitchDocument:e,onCreateDocument:n,actions:k,scrollRef:y},C=()=>{switch(w){case"timeline":return v.jsx(DD,{...x});case"board":return v.jsx(PD,{...x});case"shelf":return v.jsx(BD,{...x});default:return v.jsx(LD,{...x})}};return w==="board"?v.jsx("div",{className:`sidebar sidebar-board-mode ${t?"open":""}`,children:C()}):v.jsxs("div",{className:`sidebar ${t?"open":""}`,children:[v.jsxs("div",{className:"sidebar-topbar",children:[v.jsxs("div",{className:"sidebar-logo",children:[v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("path",{d:"M17 3a2.83 2.83 0 0 1 4 4L7.5 20.5 2 22l1.5-5.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),v.jsx("path",{d:"M15 5l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),v.jsx("span",{className:"sidebar-logo-text",children:"OpenWriter"})]}),u&&v.jsx("button",{className:"sidebar-collapse-btn",onClick:u,title:"Close sidebar",children:v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[v.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),v.jsx("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"1.5"}),v.jsx("path",{d:"M15 10l-2 2 2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}),C()]})}function jD({onClose:t,onSetupComplete:e}){const[n,r]=_.useState("detecting"),[i,s]=_.useState(null),[l,c]=_.useState("gh"),[u,f]=_.useState("openwriter-docs"),[p,h]=_.useState(!0),[g,y]=_.useState(""),[k,w]=_.useState(""),[x,C]=_.useState(""),[N,I]=_.useState("");_.useEffect(()=>{fetch("/api/sync/capabilities").then(O=>O.json()).then(O=>{s(O),O.ghAuthenticated?c("gh"):(O.gitInstalled,c("pat")),r("setup")}).catch(()=>{C("Failed to detect git capabilities"),r("error")})},[]);const P=_.useCallback(async()=>{r("progress"),I(l==="connect"?"Connecting to repository...":"Creating repository and syncing...");try{const O={method:l,repoName:u,isPrivate:p};l==="pat"&&(O.pat=g),l==="connect"&&(O.remoteUrl=k,O.pat=g||void 0);const R=await fetch("/api/sync/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)});if(!R.ok){const $=await R.json().catch(()=>({}));throw new Error($.error||`Setup failed (${R.status})`)}r("done"),e()}catch(O){C(O.message),r("error")}},[l,u,p,g,k,e]);return v.jsx("div",{className:"sync-modal-overlay",onClick:t,children:v.jsxs("div",{className:"sync-modal",onClick:O=>O.stopPropagation(),children:[v.jsxs("div",{className:"sync-modal-header",children:[v.jsx("h2",{children:"Sync to GitHub"}),v.jsx("button",{className:"sync-modal-close",onClick:t,children:"×"})]}),n==="detecting"&&v.jsxs("div",{className:"sync-modal-body",children:[v.jsx("div",{className:"sync-spinner"}),v.jsx("p",{children:"Detecting git configuration..."})]}),n==="setup"&&i&&v.jsxs("div",{className:"sync-modal-body",children:[!i.gitInstalled&&v.jsxs("div",{className:"sync-warning",children:["Git is not installed. Please ",v.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noreferrer",children:"install git"})," first."]}),i.gitInstalled&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"sync-tabs",children:[i.ghAuthenticated&&v.jsx("button",{className:`sync-tab${l==="gh"?" active":""}`,onClick:()=>c("gh"),children:"GitHub CLI"}),v.jsx("button",{className:`sync-tab${l==="pat"?" active":""}`,onClick:()=>c("pat"),children:"Personal Access Token"}),v.jsx("button",{className:`sync-tab${l==="connect"?" active":""}`,onClick:()=>c("connect"),children:"Connect Existing"})]}),l==="gh"&&v.jsxs("div",{className:"sync-form",children:[v.jsxs("label",{children:["Repository name",v.jsx("input",{type:"text",value:u,onChange:O=>f(O.target.value),placeholder:"openwriter-docs"})]}),v.jsxs("label",{className:"sync-checkbox",children:[v.jsx("input",{type:"checkbox",checked:p,onChange:O=>h(O.target.checked)}),"Private repository"]})]}),l==="pat"&&v.jsxs("div",{className:"sync-form",children:[!i.ghAuthenticated&&!i.ghInstalled&&v.jsxs("p",{className:"sync-hint",children:["Create a ",v.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=OpenWriter",target:"_blank",rel:"noreferrer",children:"Personal Access Token"})," with ",v.jsx("code",{children:"repo"})," scope."]}),v.jsxs("label",{children:["Personal Access Token",v.jsx("input",{type:"password",value:g,onChange:O=>y(O.target.value),placeholder:"ghp_..."})]}),v.jsxs("label",{children:["Repository name",v.jsx("input",{type:"text",value:u,onChange:O=>f(O.target.value),placeholder:"openwriter-docs"})]}),v.jsxs("label",{className:"sync-checkbox",children:[v.jsx("input",{type:"checkbox",checked:p,onChange:O=>h(O.target.checked)}),"Private repository"]})]}),l==="connect"&&v.jsxs("div",{className:"sync-form",children:[v.jsxs("label",{children:["Remote URL",v.jsx("input",{type:"text",value:k,onChange:O=>w(O.target.value),placeholder:"https://github.com/user/repo.git"})]}),v.jsxs("label",{children:["PAT (optional, for private repos)",v.jsx("input",{type:"password",value:g,onChange:O=>y(O.target.value),placeholder:"ghp_..."})]})]}),v.jsxs("div",{className:"sync-modal-actions",children:[v.jsx("button",{className:"sync-btn secondary",onClick:t,children:"Cancel"}),v.jsx("button",{className:"sync-btn primary",onClick:P,disabled:l==="pat"&&!g||l==="connect"&&!k||l!=="connect"&&!u,children:l==="connect"?"Connect & Sync":"Create & Sync"})]})]})]}),n==="progress"&&v.jsxs("div",{className:"sync-modal-body",children:[v.jsx("div",{className:"sync-spinner"}),v.jsx("p",{children:N})]}),n==="done"&&v.jsxs("div",{className:"sync-modal-body",children:[v.jsx("div",{className:"sync-success-icon",children:"✓"}),v.jsx("p",{children:"Successfully synced to GitHub!"}),v.jsx("div",{className:"sync-modal-actions",children:v.jsx("button",{className:"sync-btn primary",onClick:t,children:"Done"})})]}),n==="error"&&v.jsxs("div",{className:"sync-modal-body",children:[v.jsx("div",{className:"sync-error-msg",children:x}),v.jsxs("div",{className:"sync-modal-actions",children:[v.jsx("button",{className:"sync-btn secondary",onClick:()=>r("setup"),children:"Back"}),v.jsx("button",{className:"sync-btn secondary",onClick:t,children:"Close"})]})]})]})})}function zD({onNodeChanges:t,onAgentStatus:e,onDocumentSwitched:n,onDocumentsChanged:r,onWorkspacesChanged:i,onTitleChanged:s,onPendingDocsChanged:l,onSyncStatus:c,onWritingStarted:u,onWritingFinished:f,getEditorState:p}){const h=_.useRef(null),[g,y]=_.useState(!1),k=_.useRef(t),w=_.useRef(e),x=_.useRef(n),C=_.useRef(r),N=_.useRef(i),I=_.useRef(s),P=_.useRef(l),O=_.useRef(c),R=_.useRef(u),$=_.useRef(f),te=_.useRef(p);k.current=t,w.current=e,x.current=n,C.current=r,N.current=i,I.current=s,P.current=l,O.current=c,R.current=u,$.current=f,te.current=p,_.useEffect(()=>{const Q=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;let H,K=!1;function U(){const G=new WebSocket(Q);h.current=G,G.onopen=()=>{y(!0),K&&G.send(JSON.stringify({type:"request-document"})),K=!0},G.onmessage=ie=>{var me,V,j,q,M,A,X,Z,ye,ge;try{const ne=JSON.parse(ie.data);ne.type==="node-changes"&&ne.changes&&((me=k.current)==null||me.call(k,ne.changes)),ne.type==="agent-status"&&((V=w.current)==null||V.call(w,!!ne.agentConnected)),ne.type==="document-switched"&&((j=x.current)==null||j.call(x,{document:ne.document,title:ne.title,filename:ne.filename,docId:ne.docId})),ne.type==="documents-changed"&&((q=C.current)==null||q.call(C)),ne.type==="workspaces-changed"&&((M=N.current)==null||M.call(N)),ne.type==="title-changed"&&ne.title&&((A=I.current)==null||A.call(I,ne.title)),ne.type==="pending-docs-changed"&&ne.pendingDocs&&((X=P.current)==null||X.call(P,ne.pendingDocs)),ne.type==="sync-status"&&((Z=O.current)==null||Z.call(O,{state:ne.state,lastSyncTime:ne.lastSyncTime,pendingFiles:ne.pendingFiles,error:ne.error})),ne.type==="writing-started"&&ne.title&&((ye=R.current)==null||ye.call(R,ne.title,ne.target||null)),ne.type==="writing-finished"&&((ge=$.current)==null||ge.call($)),ne.type==="plugins-changed"&&window.dispatchEvent(new CustomEvent("ow-plugins-changed"))}catch{}},G.onclose=()=>{y(!1),H=setTimeout(U,2e3)},G.onerror=()=>{G.close()}}return U(),()=>{var G;clearTimeout(H),(G=h.current)==null||G.close()}},[]);const le=_.useCallback(ee=>{var Q;((Q=h.current)==null?void 0:Q.readyState)===WebSocket.OPEN&&h.current.send(JSON.stringify(ee))},[]);return{connected:g,sendMessage:le}}function FD(){const t=_.useRef(null),[e,n]=_.useState(null),[r,i]=_.useState("Untitled"),[s,l]=_.useState(void 0),[c,u]=_.useState(0),[f,p]=_.useState(!0),[h,g]=_.useState(0),[y,k]=_.useState(0),[w,x]=_.useState({filenames:[],counts:{}}),[C,N]=_.useState({state:"unconfigured"}),[I,P]=_.useState(!1),[O,R]=_.useState(()=>localStorage.getItem("ow-toolbar")!=="hidden"),[$,te]=_.useState(null),[le,ee]=_.useState(null),Q=_.useRef(0),H=_.useRef(null),K=1500,U=_.useCallback((de,ze)=>{H.current&&(clearTimeout(H.current),H.current=null),Q.current=Date.now(),te(de),ee(ze)},[]),G=_.useCallback(()=>{if(H.current)return;const de=Date.now()-Q.current,ze=K-de;ze<=0?(te(null),ee(null)):H.current=setTimeout(()=>{H.current=null,te(null),ee(null)},ze)},[]),[,ie]=_.useState(0),me=_.useRef(null),V=_.useRef([]),j=_.useRef(-1),q=_.useRef(!1),M=_.useRef(""),[A,X]=_.useState(""),[Z,ye]=_.useState(!1),[ge,ne]=_.useState(!1);_.useEffect(()=>{const de=()=>ie(ze=>ze+1);return window.addEventListener("ow-sidebar-mode-change",de),()=>window.removeEventListener("ow-sidebar-mode-change",de)},[]),_.useEffect(()=>{fetch("/api/document").then(de=>de.json()).then(de=>{de.document&&l(de.document),de.title&&i(de.title)}).catch(()=>{l(void 0)}),fetch("/api/pending-docs").then(de=>de.json()).then(de=>x(de)).catch(()=>{}),fetch("/api/sync/status").then(de=>de.json()).then(de=>N(de)).catch(()=>{})},[]);const be=_.useCallback(de=>{t.current=de,n(de)},[]),Ue=_.useCallback(de=>{if(M.current=de.filename,X(de.filename),l(de.document),i(de.title),u(ze=>ze+1),g(ze=>ze+1),q.current){const ze=V.current[j.current];ze&&setTimeout(()=>{const vt=document.querySelector(".editor-container");vt&&(vt.scrollTop=ze.scrollTop)},50),q.current=!1}ye(j.current>0),ne(j.current<V.current.length-1)},[]),Ze=_.useCallback(()=>{g(de=>de+1)},[]),un=_.useCallback(()=>{k(de=>de+1)},[]),Ve=_.useCallback(de=>{x(de)},[]),{sendMessage:Je}=zD({onNodeChanges:de=>{const ze=t.current;if(ze)for(const vt of de)pD(ze,vt)},onDocumentSwitched:Ue,onDocumentsChanged:Ze,onWorkspacesChanged:un,onPendingDocsChanged:Ve,onWritingStarted:(de,ze)=>U(de,ze),onWritingFinished:()=>G(),onSyncStatus:de=>N(de),onTitleChanged:de=>i(de),getEditorState:()=>{const de=t.current;return de?{document:de.getJSON()}:null}}),bt=_.useCallback(()=>{const de=t.current;de&&(me.current&&(clearTimeout(me.current),me.current=null),Je({type:"doc-update",document:de.getJSON(),filename:M.current}),Je({type:"save"}))},[Je]);_.useEffect(()=>{const de=()=>{const vt=t.current;if(!vt)return;me.current&&(clearTimeout(me.current),me.current=null);const dr=JSON.stringify({type:"flush",document:vt.getJSON()});navigator.sendBeacon("/api/flush",dr)},ze=()=>{document.visibilityState==="hidden"&&de()};return window.addEventListener("beforeunload",de),document.addEventListener("visibilitychange",ze),()=>{window.removeEventListener("beforeunload",de),document.removeEventListener("visibilitychange",ze)}},[]);const Dn=_.useCallback(()=>{bt(),Je({type:"create-document"})},[bt,Je]),Ke=_.useCallback(de=>{const ze=document.querySelector(".editor-container"),vt=(ze==null?void 0:ze.scrollTop)||0;!q.current&&M.current&&(V.current=V.current.slice(0,j.current+1),V.current.push({filename:M.current,scrollTop:vt}),j.current=V.current.length-1),bt(),Je({type:"switch-document",filename:de})},[bt,Je]),bn=_.useCallback(()=>{if(j.current<=0)return;const de=document.querySelector(".editor-container"),ze=(de==null?void 0:de.scrollTop)||0;j.current===V.current.length-1&&M.current?(V.current=V.current.slice(0,j.current+1),V.current.push({filename:M.current,scrollTop:ze})):M.current&&(V.current[j.current+1]={filename:M.current,scrollTop:ze});const vt=V.current[j.current];j.current--,q.current=!0,ye(j.current>0),ne(!0),bt(),Je({type:"switch-document",filename:vt.filename})},[bt,Je]),vn=_.useCallback(()=>{if(j.current>=V.current.length-2)return;const de=document.querySelector(".editor-container"),ze=(de==null?void 0:de.scrollTop)||0;M.current&&(V.current[j.current+1]={filename:M.current,scrollTop:ze}),j.current++;const vt=V.current[j.current+1];q.current=!0,ye(!0),ne(j.current<V.current.length-2),bt(),Je({type:"switch-document",filename:vt.filename})},[bt,Je]);_.useEffect(()=>{const de=ze=>{ze.altKey&&ze.key==="ArrowLeft"&&(ze.preventDefault(),bn()),ze.altKey&&ze.key==="ArrowRight"&&(ze.preventDefault(),vn())};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[bn,vn]);const _r=_.useCallback(de=>{me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{Je({type:"doc-update",document:de,filename:M.current})},1e3)},[Je]),cr=_.useCallback(de=>{i(de),Je({type:"title-update",title:de})},[Je]),ur=_.useCallback(()=>{R(de=>(localStorage.setItem("ow-toolbar",de?"hidden":"visible"),!de))},[]),zi=_.useCallback(()=>{if(C.state==="unconfigured"){P(!0);return}bt(),fetch("/api/sync/push",{method:"POST"}).catch(()=>{})},[C.state,bt]),Tr=Tu()==="board";return v.jsxs("div",{className:"app",children:[!Tr&&v.jsx(R0,{open:f,onSwitchDocument:Ke,onCreateDocument:Dn,refreshKey:h,workspacesRefreshKey:y,pendingDocs:w,writingTitle:$,writingTarget:le,onClose:()=>p(!1)}),v.jsxs("div",{className:"app-main",children:[v.jsx(dD,{title:r,onTitleChange:cr,syncStatus:C,onSync:zi,onToggleSidebar:!Tr&&!f?()=>p(!0):void 0,canGoBack:Z,canGoForward:ge,onGoBack:bn,onGoForward:vn,editor:e,onToggleToolbar:ur,toolbarOpen:O}),O&&e&&v.jsx(QL,{editor:e}),Tr&&v.jsx(R0,{open:!0,onSwitchDocument:Ke,onCreateDocument:Dn,refreshKey:h,workspacesRefreshKey:y,pendingDocs:w,writingTitle:$,writingTarget:le}),v.jsx("div",{className:"editor-container",children:v.jsx(YL,{initialContent:s,onUpdate:_r,onReady:be,onLinkClick:Ke},c)}),v.jsx(MD,{editor:e,pendingDocs:w,currentFilename:A,onSwitchDocument:Ke,sendMessage:Je})]}),v.jsx(mD,{editorRef:t}),I&&v.jsx(jD,{onClose:()=>P(!1),onSetupComplete:()=>{fetch("/api/sync/status").then(de=>de.json()).then(N).catch(()=>{})}})]})}uS();cS.createRoot(document.getElementById("root")).render(v.jsx(Ri.StrictMode,{children:v.jsx(FD,{})}));