tandem-editor 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,345 @@
1
+ var az=Object.defineProperty;var cz=(t,e,n)=>e in t?az(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Bd=(t,e,n)=>cz(t,typeof e!="symbol"?e+"":e,n);(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 Wp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hy={exports:{}},Wc={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var tC;function uz(){if(tC)return Wc;tC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var l=null;if(s!==void 0&&(l=""+s),i.key!==void 0&&(l=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:l,ref:i!==void 0?i:null,props:s}}return Wc.Fragment=e,Wc.jsx=n,Wc.jsxs=n,Wc}var nC;function fz(){return nC||(nC=1,Hy.exports=uz()),Hy.exports}var k=fz(),Vy={exports:{}},je={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var rC;function dz(){if(rC)return je;rC=1;var t=Symbol.for("react.transitional.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.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function b(_){return _===null||typeof _!="object"?null:(_=g&&_[g]||_["@@iterator"],typeof _=="function"?_:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,C={};function T(_,B,E){this.props=_,this.context=B,this.refs=C,this.updater=E||S}T.prototype.isReactComponent={},T.prototype.setState=function(_,B){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,B,"setState")},T.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function H(){}H.prototype=T.prototype;function j(_,B,E){this.props=_,this.context=B,this.refs=C,this.updater=E||S}var ne=j.prototype=new H;ne.constructor=j,v(ne,T.prototype),ne.isPureReactComponent=!0;var $=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function ae(_,B,E){var X=E.ref;return{$$typeof:t,type:_,key:B,ref:X!==void 0?X:null,props:E}}function xe(_,B){return ae(_.type,B,_.props)}function fe(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function le(_){var B={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(E){return B[E]})}var Q=/\/+/g;function ie(_,B){return typeof _=="object"&&_!==null&&_.key!=null?le(""+_.key):B.toString(36)}function G(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(N,N):(_.status="pending",_.then(function(B){_.status==="pending"&&(_.status="fulfilled",_.value=B)},function(B){_.status==="pending"&&(_.status="rejected",_.reason=B)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function I(_,B,E,X,he){var ge=typeof _;(ge==="undefined"||ge==="boolean")&&(_=null);var Re=!1;if(_===null)Re=!0;else switch(ge){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(_.$$typeof){case t:case e:Re=!0;break;case p:return Re=_._init,I(Re(_._payload),B,E,X,he)}}if(Re)return he=he(_),Re=X===""?"."+ie(_,0):X,$(he)?(E="",Re!=null&&(E=Re.replace(Q,"$&/")+"/"),I(he,B,E,"",function(kt){return kt})):he!=null&&(fe(he)&&(he=xe(he,E+(he.key==null||_&&_.key===he.key?"":(""+he.key).replace(Q,"$&/")+"/")+Re)),B.push(he)),1;Re=0;var De=X===""?".":X+":";if($(_))for(var Ue=0;Ue<_.length;Ue++)X=_[Ue],ge=De+ie(X,Ue),Re+=I(X,B,E,ge,he);else if(Ue=b(_),typeof Ue=="function")for(_=Ue.call(_),Ue=0;!(X=_.next()).done;)X=X.value,ge=De+ie(X,Ue++),Re+=I(X,B,E,ge,he);else if(ge==="object"){if(typeof _.then=="function")return I(G(_),B,E,X,he);throw B=String(_),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return Re}function Z(_,B,E){if(_==null)return _;var X=[],he=0;return I(_,X,"","",function(ge){return B.call(E,ge,he++)}),X}function me(_){if(_._status===-1){var B=_._result;B=B(),B.then(function(E){(_._status===0||_._status===-1)&&(_._status=1,_._result=E)},function(E){(_._status===0||_._status===-1)&&(_._status=2,_._result=E)}),_._status===-1&&(_._status=0,_._result=B)}if(_._status===1)return _._result.default;throw _._result}var Ae=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},M={map:Z,forEach:function(_,B,E){Z(_,function(){B.apply(this,arguments)},E)},count:function(_){var B=0;return Z(_,function(){B++}),B},toArray:function(_){return Z(_,function(B){return B})||[]},only:function(_){if(!fe(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return je.Activity=m,je.Children=M,je.Component=T,je.Fragment=n,je.Profiler=i,je.PureComponent=j,je.StrictMode=r,je.Suspense=f,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,je.__COMPILER_RUNTIME={__proto__:null,c:function(_){return D.H.useMemoCache(_)}},je.cache=function(_){return function(){return _.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(_,B,E){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var X=v({},_.props),he=_.key;if(B!=null)for(ge in B.key!==void 0&&(he=""+B.key),B)!K.call(B,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&B.ref===void 0||(X[ge]=B[ge]);var ge=arguments.length-2;if(ge===1)X.children=E;else if(1<ge){for(var Re=Array(ge),De=0;De<ge;De++)Re[De]=arguments[De+2];X.children=Re}return ae(_.type,he,X)},je.createContext=function(_){return _={$$typeof:l,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:s,_context:_},_},je.createElement=function(_,B,E){var X,he={},ge=null;if(B!=null)for(X in B.key!==void 0&&(ge=""+B.key),B)K.call(B,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(he[X]=B[X]);var Re=arguments.length-2;if(Re===1)he.children=E;else if(1<Re){for(var De=Array(Re),Ue=0;Ue<Re;Ue++)De[Ue]=arguments[Ue+2];he.children=De}if(_&&_.defaultProps)for(X in Re=_.defaultProps,Re)he[X]===void 0&&(he[X]=Re[X]);return ae(_,ge,he)},je.createRef=function(){return{current:null}},je.forwardRef=function(_){return{$$typeof:c,render:_}},je.isValidElement=fe,je.lazy=function(_){return{$$typeof:p,_payload:{_status:-1,_result:_},_init:me}},je.memo=function(_,B){return{$$typeof:d,type:_,compare:B===void 0?null:B}},je.startTransition=function(_){var B=D.T,E={};D.T=E;try{var X=_(),he=D.S;he!==null&&he(E,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(N,Ae)}catch(ge){Ae(ge)}finally{B!==null&&E.types!==null&&(B.types=E.types),D.T=B}},je.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},je.use=function(_){return D.H.use(_)},je.useActionState=function(_,B,E){return D.H.useActionState(_,B,E)},je.useCallback=function(_,B){return D.H.useCallback(_,B)},je.useContext=function(_){return D.H.useContext(_)},je.useDebugValue=function(){},je.useDeferredValue=function(_,B){return D.H.useDeferredValue(_,B)},je.useEffect=function(_,B){return D.H.useEffect(_,B)},je.useEffectEvent=function(_){return D.H.useEffectEvent(_)},je.useId=function(){return D.H.useId()},je.useImperativeHandle=function(_,B,E){return D.H.useImperativeHandle(_,B,E)},je.useInsertionEffect=function(_,B){return D.H.useInsertionEffect(_,B)},je.useLayoutEffect=function(_,B){return D.H.useLayoutEffect(_,B)},je.useMemo=function(_,B){return D.H.useMemo(_,B)},je.useOptimistic=function(_,B){return D.H.useOptimistic(_,B)},je.useReducer=function(_,B,E){return D.H.useReducer(_,B,E)},je.useRef=function(_){return D.H.useRef(_)},je.useState=function(_){return D.H.useState(_)},je.useSyncExternalStore=function(_,B,E){return D.H.useSyncExternalStore(_,B,E)},je.useTransition=function(){return D.H.useTransition()},je.version="19.2.4",je}var iC;function Ex(){return iC||(iC=1,Vy.exports=dz()),Vy.exports}var O=Ex();const un=Wp(O);var Py={exports:{}},Gc={},$y={exports:{}},Fy={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var sC;function hz(){return sC||(sC=1,(function(t){function e(I,Z){var me=I.length;I.push(Z);e:for(;0<me;){var Ae=me-1>>>1,M=I[Ae];if(0<i(M,Z))I[Ae]=Z,I[me]=M,me=Ae;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var Z=I[0],me=I.pop();if(me!==Z){I[0]=me;e:for(var Ae=0,M=I.length,_=M>>>1;Ae<_;){var B=2*(Ae+1)-1,E=I[B],X=B+1,he=I[X];if(0>i(E,me))X<M&&0>i(he,E)?(I[Ae]=he,I[X]=me,Ae=X):(I[Ae]=E,I[B]=me,Ae=B);else if(X<M&&0>i(he,me))I[Ae]=he,I[X]=me,Ae=X;else break e}}return Z}function i(I,Z){var me=I.sortIndex-Z.sortIndex;return me!==0?me:I.id-Z.id}if(t.unstable_now=void 0,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 f=[],d=[],p=1,m=null,g=3,b=!1,S=!1,v=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function ne(I){for(var Z=n(d);Z!==null;){if(Z.callback===null)r(d);else if(Z.startTime<=I)r(d),Z.sortIndex=Z.expirationTime,e(f,Z);else break;Z=n(d)}}function $(I){if(v=!1,ne(I),!S)if(n(f)!==null)S=!0,N||(N=!0,le());else{var Z=n(d);Z!==null&&G($,Z.startTime-I)}}var N=!1,D=-1,K=5,ae=-1;function xe(){return C?!0:!(t.unstable_now()-ae<K)}function fe(){if(C=!1,N){var I=t.unstable_now();ae=I;var Z=!0;try{e:{S=!1,v&&(v=!1,H(D),D=-1),b=!0;var me=g;try{t:{for(ne(I),m=n(f);m!==null&&!(m.expirationTime>I&&xe());){var Ae=m.callback;if(typeof Ae=="function"){m.callback=null,g=m.priorityLevel;var M=Ae(m.expirationTime<=I);if(I=t.unstable_now(),typeof M=="function"){m.callback=M,ne(I),Z=!0;break t}m===n(f)&&r(f),ne(I)}else r(f);m=n(f)}if(m!==null)Z=!0;else{var _=n(d);_!==null&&G($,_.startTime-I),Z=!1}}break e}finally{m=null,g=me,b=!1}Z=void 0}}finally{Z?le():N=!1}}}var le;if(typeof j=="function")le=function(){j(fe)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,ie=Q.port2;Q.port1.onmessage=fe,le=function(){ie.postMessage(null)}}else le=function(){T(fe,0)};function G(I,Z){D=T(function(){I(t.unstable_now())},Z)}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(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(I){switch(g){case 1:case 2:case 3:var Z=3;break;default:Z=g}var me=g;g=Z;try{return I()}finally{g=me}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var me=g;g=I;try{return Z()}finally{g=me}},t.unstable_scheduleCallback=function(I,Z,me){var Ae=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Ae+me:Ae):me=Ae,I){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=me+M,I={id:p++,callback:Z,priorityLevel:I,startTime:me,expirationTime:M,sortIndex:-1},me>Ae?(I.sortIndex=me,e(d,I),n(f)===null&&I===n(d)&&(v?(H(D),D=-1):v=!0,G($,me-Ae))):(I.sortIndex=M,e(f,I),S||b||(S=!0,N||(N=!0,le()))),I},t.unstable_shouldYield=xe,t.unstable_wrapCallback=function(I){var Z=g;return function(){var me=g;g=Z;try{return I.apply(this,arguments)}finally{g=me}}}})(Fy)),Fy}var oC;function pz(){return oC||(oC=1,$y.exports=hz()),$y.exports}var qy={exports:{}},Dn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var lC;function mz(){if(lC)return Dn;lC=1;var t=Ex();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:f,containerInfo:d,implementation:p}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Dn.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return s(f,d,null,p)},Dn.flushSync=function(f){var d=l.T,p=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=d,r.p=p,r.d.f()}},Dn.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},Dn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Dn.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,m=c(p,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:b}):p==="script"&&r.d.X(f,{crossOrigin:m,integrity:g,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Dn.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},Dn.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,m=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Dn.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=c(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},Dn.requestFormReset=function(f){r.d.r(f)},Dn.unstable_batchedUpdates=function(f,d){return f(d)},Dn.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},Dn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Dn.version="19.2.4",Dn}var aC;function eM(){if(aC)return qy.exports;aC=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(),qy.exports=mz(),qy.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var cC;function gz(){if(cC)return Gc;cC=1;var t=pz(),e=Ex(),n=eM();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}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."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,u=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(u=a.return),o=a.return;while(o)}return a.tag===3?u:null}function l(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 c(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function f(o){if(s(o)!==o)throw Error(r(188))}function d(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var u=o,h=a;;){var y=u.return;if(y===null)break;var x=y.alternate;if(x===null){if(h=y.return,h!==null){u=h;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===u)return f(y),o;if(x===h)return f(y),a;x=x.sibling}throw Error(r(188))}if(u.return!==h.return)u=y,h=x;else{for(var w=!1,A=y.child;A;){if(A===u){w=!0,u=y,h=x;break}if(A===h){w=!0,h=y,u=x;break}A=A.sibling}if(!w){for(A=x.child;A;){if(A===u){w=!0,u=x,h=y;break}if(A===h){w=!0,h=x,u=y;break}A=A.sibling}if(!w)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?o:a}function p(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=p(o),a!==null)return a;o=o.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),j=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),xe=Symbol.for("react.memo_cache_sentinel"),fe=Symbol.iterator;function le(o){return o===null||typeof o!="object"?null:(o=fe&&o[fe]||o["@@iterator"],typeof o=="function"?o:null)}var Q=Symbol.for("react.client.reference");function ie(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Q?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case v:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case $:return"Suspense";case N:return"SuspenseList";case ae:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case S:return"Portal";case j:return o.displayName||"Context";case H:return(o._context.displayName||"Context")+".Consumer";case ne:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case D:return a=o.displayName||null,a!==null?a:ie(o.type)||"Memo";case K:a=o._payload,o=o._init;try{return ie(o(a))}catch{}}return null}var G=Array.isArray,I=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},Ae=[],M=-1;function _(o){return{current:o}}function B(o){0>M||(o.current=Ae[M],Ae[M]=null,M--)}function E(o,a){M++,Ae[M]=o.current,o.current=a}var X=_(null),he=_(null),ge=_(null),Re=_(null);function De(o,a){switch(E(ge,a),E(he,o),E(X,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Ck(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Ck(a),o=Ek(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}B(X),E(X,o)}function Ue(){B(X),B(he),B(ge)}function kt(o){o.memoizedState!==null&&E(Re,o);var a=X.current,u=Ek(a,o.type);a!==u&&(E(he,o),E(X,u))}function Ee(o){he.current===o&&(B(X),B(he)),Re.current===o&&(B(Re),Fc._currentValue=me)}var Fe,Ct;function Nt(o){if(Fe===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Fe=a&&a[1]||"",Ct=-1<u.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Fe+o+Ct}var _n=!1;function bn(o,a){if(!o||_n)return"";_n=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(q){var F=q}Reflect.construct(o,[],ee)}else{try{ee.call()}catch(q){F=q}o.call(ee.prototype)}}else{try{throw Error()}catch(q){F=q}(ee=o())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(q){if(q&&F&&typeof q.stack=="string")return[q.stack,F.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=h.DetermineComponentFrameRoot(),w=x[0],A=x[1];if(w&&A){var R=w.split(`
44
+ `),P=A.split(`
45
+ `);for(y=h=0;h<R.length&&!R[h].includes("DetermineComponentFrameRoot");)h++;for(;y<P.length&&!P[y].includes("DetermineComponentFrameRoot");)y++;if(h===R.length||y===P.length)for(h=R.length-1,y=P.length-1;1<=h&&0<=y&&R[h]!==P[y];)y--;for(;1<=h&&0<=y;h--,y--)if(R[h]!==P[y]){if(h!==1||y!==1)do if(h--,y--,0>y||R[h]!==P[y]){var W=`
46
+ `+R[h].replace(" at new "," at ");return o.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",o.displayName)),W}while(1<=h&&0<=y);break}}}finally{_n=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Nt(u):""}function $t(o,a){switch(o.tag){case 26:case 27:case 5:return Nt(o.type);case 16:return Nt("Lazy");case 13:return o.child!==a&&a!==null?Nt("Suspense Fallback"):Nt("Suspense");case 19:return Nt("SuspenseList");case 0:case 15:return bn(o.type,!1);case 11:return bn(o.type.render,!1);case 1:return bn(o.type,!0);case 31:return Nt("Activity");default:return""}}function Kn(o){try{var a="",u=null;do a+=$t(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
47
+ Error generating stack: `+h.message+`
48
+ `+h.stack}}var kr=Object.prototype.hasOwnProperty,Cr=t.unstable_scheduleCallback,Wn=t.unstable_cancelCallback,Ni=t.unstable_shouldYield,zi=t.unstable_requestPaint,Ft=t.unstable_now,Li=t.unstable_getCurrentPriorityLevel,Y=t.unstable_ImmediatePriority,L=t.unstable_UserBlockingPriority,se=t.unstable_NormalPriority,ye=t.unstable_LowPriority,Te=t.unstable_IdlePriority,re=t.log,Ke=t.unstable_setDisableYieldValue,Ze=null,at=null;function pt(o){if(typeof re=="function"&&Ke(o),at&&typeof at.setStrictMode=="function")try{at.setStrictMode(Ze,o)}catch{}}var oe=Math.clz32?Math.clz32:Zr,ct=Math.log,mt=Math.LN2;function Zr(o){return o>>>=0,o===0?32:31-(ct(o)/mt|0)|0}var Er=256,wo=262144,ci=4194304;function Jr(o){var a=o&42;if(a!==0)return a;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function bs(o,a,u){var h=o.pendingLanes;if(h===0)return 0;var y=0,x=o.suspendedLanes,w=o.pingedLanes;o=o.warmLanes;var A=h&134217727;return A!==0?(h=A&~x,h!==0?y=Jr(h):(w&=A,w!==0?y=Jr(w):u||(u=A&~o,u!==0&&(y=Jr(u))))):(A=h&~x,A!==0?y=Jr(A):w!==0?y=Jr(w):u||(u=h&~o,u!==0&&(y=Jr(u)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:y}function ji(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function Cf(o,a){switch(o){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ef(){var o=ci;return ci<<=1,(ci&62914560)===0&&(ci=4194304),o}function Ii(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function ic(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function ZD(o,a,u,h,y,x){var w=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var A=o.entanglements,R=o.expirationTimes,P=o.hiddenUpdates;for(u=w&~u;0<u;){var W=31-oe(u),ee=1<<W;A[W]=0,R[W]=-1;var F=P[W];if(F!==null)for(P[W]=null,W=0;W<F.length;W++){var q=F[W];q!==null&&(q.lane&=-536870913)}u&=~ee}h!==0&&oS(o,h,0),x!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=x&~(w&~a))}function oS(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-oe(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function lS(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-oe(u),y=1<<h;y&a|o[h]&a&&(o[h]|=a),u&=~y}}function aS(o,a){var u=a&-a;return u=(u&42)!==0?1:Om(u),(u&(o.suspendedLanes|a))!==0?0:u}function Om(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function _m(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function cS(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:Wk(o.type))}function uS(o,a){var u=Z.p;try{return Z.p=o,a()}finally{Z.p=u}}var xs=Math.random().toString(36).slice(2),xn="__reactFiber$"+xs,Gn="__reactProps$"+xs,xl="__reactContainer$"+xs,Dm="__reactEvents$"+xs,JD="__reactListeners$"+xs,XD="__reactHandles$"+xs,fS="__reactResources$"+xs,sc="__reactMarker$"+xs;function Rm(o){delete o[xn],delete o[Gn],delete o[Dm],delete o[JD],delete o[XD]}function Sl(o){var a=o[xn];if(a)return a;for(var u=o.parentNode;u;){if(a=u[xl]||u[xn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=Rk(o);o!==null;){if(u=o[xn])return u;o=Rk(o)}return a}o=u,u=o.parentNode}return null}function wl(o){if(o=o[xn]||o[xl]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function oc(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function vl(o){var a=o[fS];return a||(a=o[fS]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function on(o){o[sc]=!0}var dS=new Set,hS={};function vo(o,a){kl(o,a),kl(o+"Capture",a)}function kl(o,a){for(hS[o]=a,o=0;o<a.length;o++)dS.add(a[o])}var QD=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pS={},mS={};function eR(o){return kr.call(mS,o)?!0:kr.call(pS,o)?!1:QD.test(o)?mS[o]=!0:(pS[o]=!0,!1)}function Tf(o,a,u){if(eR(a))if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+u)}}function Af(o,a,u){if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+u)}}function Bi(o,a,u,h){if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(a,u,""+h)}}function Tr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function gS(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function tR(o,a,u){var h=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var y=h.get,x=h.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return y.call(this)},set:function(w){u=""+w,x.call(this,w)}}),Object.defineProperty(o,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Nm(o){if(!o._valueTracker){var a=gS(o)?"checked":"value";o._valueTracker=tR(o,a,""+o[a])}}function yS(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=gS(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function Mf(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}}var nR=/[\n"\\]/g;function Ar(o){return o.replace(nR,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function zm(o,a,u,h,y,x,w,A){o.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?o.type=w:o.removeAttribute("type"),a!=null?w==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+Tr(a)):o.value!==""+Tr(a)&&(o.value=""+Tr(a)):w!=="submit"&&w!=="reset"||o.removeAttribute("value"),a!=null?Lm(o,w,Tr(a)):u!=null?Lm(o,w,Tr(u)):h!=null&&o.removeAttribute("value"),y==null&&x!=null&&(o.defaultChecked=!!x),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.name=""+Tr(A):o.removeAttribute("name")}function bS(o,a,u,h,y,x,w,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),a!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Nm(o);return}u=u!=null?""+Tr(u):"",a=a!=null?""+Tr(a):u,A||a===o.value||(o.value=a),o.defaultValue=a}h=h??y,h=typeof h!="function"&&typeof h!="symbol"&&!!h,o.checked=A?o.checked:!!h,o.defaultChecked=!!h,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.name=w),Nm(o)}function Lm(o,a,u){a==="number"&&Mf(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function Cl(o,a,u,h){if(o=o.options,a){a={};for(var y=0;y<u.length;y++)a["$"+u[y]]=!0;for(u=0;u<o.length;u++)y=a.hasOwnProperty("$"+o[u].value),o[u].selected!==y&&(o[u].selected=y),y&&h&&(o[u].defaultSelected=!0)}else{for(u=""+Tr(u),a=null,y=0;y<o.length;y++){if(o[y].value===u){o[y].selected=!0,h&&(o[y].defaultSelected=!0);return}a!==null||o[y].disabled||(a=o[y])}a!==null&&(a.selected=!0)}}function xS(o,a,u){if(a!=null&&(a=""+Tr(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+Tr(u):""}function SS(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(G(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Tr(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),Nm(o)}function El(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var rR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function wS(o,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":h?o.setProperty(a,u):typeof u!="number"||u===0||rR.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function vS(o,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?o.setProperty(h,""):h==="float"?o.cssFloat="":o[h]="");for(var y in a)h=a[y],a.hasOwnProperty(y)&&u[y]!==h&&wS(o,y,h)}else for(var x in a)a.hasOwnProperty(x)&&wS(o,x,a[x])}function jm(o){if(o.indexOf("-")===-1)return!1;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 iR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),sR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Of(o){return sR.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Ui(){}var Im=null;function Bm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Tl=null,Al=null;function kS(o){var a=wl(o);if(a&&(o=a.stateNode)){var u=o[Gn]||null;e:switch(o=a.stateNode,a.type){case"input":if(zm(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ar(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var y=h[Gn]||null;if(!y)throw Error(r(90));zm(h,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===o.form&&yS(h)}break e;case"textarea":xS(o,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Cl(o,!!u.multiple,a,!1)}}}var Um=!1;function CS(o,a,u){if(Um)return o(a,u);Um=!0;try{var h=o(a);return h}finally{if(Um=!1,(Tl!==null||Al!==null)&&(gd(),Tl&&(a=Tl,o=Al,Al=Tl=null,kS(a),o)))for(a=0;a<o.length;a++)kS(o[a])}}function lc(o,a){var u=o.stateNode;if(u===null)return null;var h=u[Gn]||null;if(h===null)return null;u=h[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":(h=!h.disabled)||(o=o.type,h=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!h;break e;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Hi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hm=!1;if(Hi)try{var ac={};Object.defineProperty(ac,"passive",{get:function(){Hm=!0}}),window.addEventListener("test",ac,ac),window.removeEventListener("test",ac,ac)}catch{Hm=!1}var Ss=null,Vm=null,_f=null;function ES(){if(_f)return _f;var o,a=Vm,u=a.length,h,y="value"in Ss?Ss.value:Ss.textContent,x=y.length;for(o=0;o<u&&a[o]===y[o];o++);var w=u-o;for(h=1;h<=w&&a[u-h]===y[x-h];h++);return _f=y.slice(o,1<h?1-h:void 0)}function Df(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 Rf(){return!0}function TS(){return!1}function Zn(o){function a(u,h,y,x,w){this._reactName=u,this._targetInst=y,this.type=h,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var A in o)o.hasOwnProperty(A)&&(u=o[A],this[A]=u?u(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Rf:TS,this.isPropagationStopped=TS,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Rf)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Rf)},persist:function(){},isPersistent:Rf}),a}var ko={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nf=Zn(ko),cc=m({},ko,{view:0,detail:0}),oR=Zn(cc),Pm,$m,uc,zf=m({},cc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qm,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!==uc&&(uc&&o.type==="mousemove"?(Pm=o.screenX-uc.screenX,$m=o.screenY-uc.screenY):$m=Pm=0,uc=o),Pm)},movementY:function(o){return"movementY"in o?o.movementY:$m}}),AS=Zn(zf),lR=m({},zf,{dataTransfer:0}),aR=Zn(lR),cR=m({},cc,{relatedTarget:0}),Fm=Zn(cR),uR=m({},ko,{animationName:0,elapsedTime:0,pseudoElement:0}),fR=Zn(uR),dR=m({},ko,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),hR=Zn(dR),pR=m({},ko,{data:0}),MS=Zn(pR),mR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gR={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"},yR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bR(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=yR[o])?!!a[o]:!1}function qm(){return bR}var xR=m({},cc,{key:function(o){if(o.key){var a=mR[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=Df(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?gR[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qm,charCode:function(o){return o.type==="keypress"?Df(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Df(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),SR=Zn(xR),wR=m({},zf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),OS=Zn(wR),vR=m({},cc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qm}),kR=Zn(vR),CR=m({},ko,{propertyName:0,elapsedTime:0,pseudoElement:0}),ER=Zn(CR),TR=m({},zf,{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}),AR=Zn(TR),MR=m({},ko,{newState:0,oldState:0}),OR=Zn(MR),_R=[9,13,27,32],Ym=Hi&&"CompositionEvent"in window,fc=null;Hi&&"documentMode"in document&&(fc=document.documentMode);var DR=Hi&&"TextEvent"in window&&!fc,_S=Hi&&(!Ym||fc&&8<fc&&11>=fc),DS=" ",RS=!1;function NS(o,a){switch(o){case"keyup":return _R.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zS(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ml=!1;function RR(o,a){switch(o){case"compositionend":return zS(a);case"keypress":return a.which!==32?null:(RS=!0,DS);case"textInput":return o=a.data,o===DS&&RS?null:o;default:return null}}function NR(o,a){if(Ml)return o==="compositionend"||!Ym&&NS(o,a)?(o=ES(),_f=Vm=Ss=null,Ml=!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 _S&&a.locale!=="ko"?null:a.data;default:return null}}var zR={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 LS(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!zR[o.type]:a==="textarea"}function jS(o,a,u,h){Tl?Al?Al.push(h):Al=[h]:Tl=h,a=kd(a,"onChange"),0<a.length&&(u=new Nf("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var dc=null,hc=null;function LR(o){bk(o,0)}function Lf(o){var a=oc(o);if(yS(a))return o}function IS(o,a){if(o==="change")return a}var BS=!1;if(Hi){var Km;if(Hi){var Wm="oninput"in document;if(!Wm){var US=document.createElement("div");US.setAttribute("oninput","return;"),Wm=typeof US.oninput=="function"}Km=Wm}else Km=!1;BS=Km&&(!document.documentMode||9<document.documentMode)}function HS(){dc&&(dc.detachEvent("onpropertychange",VS),hc=dc=null)}function VS(o){if(o.propertyName==="value"&&Lf(hc)){var a=[];jS(a,hc,o,Bm(o)),CS(LR,a)}}function jR(o,a,u){o==="focusin"?(HS(),dc=a,hc=u,dc.attachEvent("onpropertychange",VS)):o==="focusout"&&HS()}function IR(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Lf(hc)}function BR(o,a){if(o==="click")return Lf(a)}function UR(o,a){if(o==="input"||o==="change")return Lf(a)}function HR(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var cr=typeof Object.is=="function"?Object.is:HR;function pc(o,a){if(cr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var u=Object.keys(o),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var y=u[h];if(!kr.call(a,y)||!cr(o[y],a[y]))return!1}return!0}function PS(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function $S(o,a){var u=PS(o);o=0;for(var h;u;){if(u.nodeType===3){if(h=o+u.textContent.length,o<=a&&h>=a)return{node:u,offset:a-o};o=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=PS(u)}}function FS(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?FS(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function qS(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Mf(o.document);a instanceof o.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)o=a.contentWindow;else break;a=Mf(o.document)}return a}function Gm(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")}var VR=Hi&&"documentMode"in document&&11>=document.documentMode,Ol=null,Zm=null,mc=null,Jm=!1;function YS(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Jm||Ol==null||Ol!==Mf(h)||(h=Ol,"selectionStart"in h&&Gm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),mc&&pc(mc,h)||(mc=h,h=kd(Zm,"onSelect"),0<h.length&&(a=new Nf("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=Ol)))}function Co(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var _l={animationend:Co("Animation","AnimationEnd"),animationiteration:Co("Animation","AnimationIteration"),animationstart:Co("Animation","AnimationStart"),transitionrun:Co("Transition","TransitionRun"),transitionstart:Co("Transition","TransitionStart"),transitioncancel:Co("Transition","TransitionCancel"),transitionend:Co("Transition","TransitionEnd")},Xm={},KS={};Hi&&(KS=document.createElement("div").style,"AnimationEvent"in window||(delete _l.animationend.animation,delete _l.animationiteration.animation,delete _l.animationstart.animation),"TransitionEvent"in window||delete _l.transitionend.transition);function Eo(o){if(Xm[o])return Xm[o];if(!_l[o])return o;var a=_l[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in KS)return Xm[o]=a[u];return o}var WS=Eo("animationend"),GS=Eo("animationiteration"),ZS=Eo("animationstart"),PR=Eo("transitionrun"),$R=Eo("transitionstart"),FR=Eo("transitioncancel"),JS=Eo("transitionend"),XS=new Map,Qm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Qm.push("scrollEnd");function Xr(o,a){XS.set(o,a),vo(a,[o])}var jf=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Mr=[],Dl=0,eg=0;function If(){for(var o=Dl,a=eg=Dl=0;a<o;){var u=Mr[a];Mr[a++]=null;var h=Mr[a];Mr[a++]=null;var y=Mr[a];Mr[a++]=null;var x=Mr[a];if(Mr[a++]=null,h!==null&&y!==null){var w=h.pending;w===null?y.next=y:(y.next=w.next,w.next=y),h.pending=y}x!==0&&QS(u,y,x)}}function Bf(o,a,u,h){Mr[Dl++]=o,Mr[Dl++]=a,Mr[Dl++]=u,Mr[Dl++]=h,eg|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function tg(o,a,u,h){return Bf(o,a,u,h),Uf(o)}function To(o,a){return Bf(o,null,null,a),Uf(o)}function QS(o,a,u){o.lanes|=u;var h=o.alternate;h!==null&&(h.lanes|=u);for(var y=!1,x=o.return;x!==null;)x.childLanes|=u,h=x.alternate,h!==null&&(h.childLanes|=u),x.tag===22&&(o=x.stateNode,o===null||o._visibility&1||(y=!0)),o=x,x=x.return;return o.tag===3?(x=o.stateNode,y&&a!==null&&(y=31-oe(u),o=x.hiddenUpdates,h=o[y],h===null?o[y]=[a]:h.push(a),a.lane=u|536870912),x):null}function Uf(o){if(50<Ic)throw Ic=0,uy=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Rl={};function qR(o,a,u,h){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ur(o,a,u,h){return new qR(o,a,u,h)}function ng(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Vi(o,a){var u=o.alternate;return u===null?(u=ur(o.tag,a,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=a,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,a=o.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function ew(o,a){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,a=u.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function Hf(o,a,u,h,y,x){var w=0;if(h=o,typeof o=="function")ng(o)&&(w=1);else if(typeof o=="string")w=ZN(o,u,X.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case ae:return o=ur(31,u,a,y),o.elementType=ae,o.lanes=x,o;case v:return Ao(u.children,y,x,a);case C:w=8,y|=24;break;case T:return o=ur(12,u,a,y|2),o.elementType=T,o.lanes=x,o;case $:return o=ur(13,u,a,y),o.elementType=$,o.lanes=x,o;case N:return o=ur(19,u,a,y),o.elementType=N,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case j:w=10;break e;case H:w=9;break e;case ne:w=11;break e;case D:w=14;break e;case K:w=16,h=null;break e}w=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=ur(w,u,a,y),a.elementType=o,a.type=h,a.lanes=x,a}function Ao(o,a,u,h){return o=ur(7,o,h,a),o.lanes=u,o}function rg(o,a,u){return o=ur(6,o,null,a),o.lanes=u,o}function tw(o){var a=ur(18,null,null,0);return a.stateNode=o,a}function ig(o,a,u){return a=ur(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var nw=new WeakMap;function Or(o,a){if(typeof o=="object"&&o!==null){var u=nw.get(o);return u!==void 0?u:(a={value:o,source:a,stack:Kn(a)},nw.set(o,a),a)}return{value:o,source:a,stack:Kn(a)}}var Nl=[],zl=0,Vf=null,gc=0,_r=[],Dr=0,ws=null,ui=1,fi="";function Pi(o,a){Nl[zl++]=gc,Nl[zl++]=Vf,Vf=o,gc=a}function rw(o,a,u){_r[Dr++]=ui,_r[Dr++]=fi,_r[Dr++]=ws,ws=o;var h=ui;o=fi;var y=32-oe(h)-1;h&=~(1<<y),u+=1;var x=32-oe(a)+y;if(30<x){var w=y-y%5;x=(h&(1<<w)-1).toString(32),h>>=w,y-=w,ui=1<<32-oe(a)+y|u<<y|h,fi=x+o}else ui=1<<x|u<<y|h,fi=o}function sg(o){o.return!==null&&(Pi(o,1),rw(o,1,0))}function og(o){for(;o===Vf;)Vf=Nl[--zl],Nl[zl]=null,gc=Nl[--zl],Nl[zl]=null;for(;o===ws;)ws=_r[--Dr],_r[Dr]=null,fi=_r[--Dr],_r[Dr]=null,ui=_r[--Dr],_r[Dr]=null}function iw(o,a){_r[Dr++]=ui,_r[Dr++]=fi,_r[Dr++]=ws,ui=a.id,fi=a.overflow,ws=o}var Sn=null,Ot=null,nt=!1,vs=null,Rr=!1,lg=Error(r(519));function ks(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yc(Or(a,o)),lg}function sw(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[xn]=o,a[Gn]=h,u){case"dialog":Xe("cancel",a),Xe("close",a);break;case"iframe":case"object":case"embed":Xe("load",a);break;case"video":case"audio":for(u=0;u<Uc.length;u++)Xe(Uc[u],a);break;case"source":Xe("error",a);break;case"img":case"image":case"link":Xe("error",a),Xe("load",a);break;case"details":Xe("toggle",a);break;case"input":Xe("invalid",a),bS(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Xe("invalid",a);break;case"textarea":Xe("invalid",a),SS(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||vk(a.textContent,u)?(h.popover!=null&&(Xe("beforetoggle",a),Xe("toggle",a)),h.onScroll!=null&&Xe("scroll",a),h.onScrollEnd!=null&&Xe("scrollend",a),h.onClick!=null&&(a.onclick=Ui),a=!0):a=!1,a||ks(o,!0)}function ow(o){for(Sn=o.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:Rr=!1;return;case 27:case 3:Rr=!0;return;default:Sn=Sn.return}}function Ll(o){if(o!==Sn)return!1;if(!nt)return ow(o),nt=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||Ey(o.type,o.memoizedProps)),u=!u),u&&Ot&&ks(o),ow(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Ot=Dk(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Ot=Dk(o)}else a===27?(a=Ot,Is(o.type)?(o=_y,_y=null,Ot=o):Ot=a):Ot=Sn?zr(o.stateNode.nextSibling):null;return!0}function Mo(){Ot=Sn=null,nt=!1}function ag(){var o=vs;return o!==null&&(er===null?er=o:er.push.apply(er,o),vs=null),o}function yc(o){vs===null?vs=[o]:vs.push(o)}var cg=_(null),Oo=null,$i=null;function Cs(o,a,u){E(cg,a._currentValue),a._currentValue=u}function Fi(o){o._currentValue=cg.current,B(cg)}function ug(o,a,u){for(;o!==null;){var h=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),o===u)break;o=o.return}}function fg(o,a,u,h){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var x=y.dependencies;if(x!==null){var w=y.child;x=x.firstContext;e:for(;x!==null;){var A=x;x=y;for(var R=0;R<a.length;R++)if(A.context===a[R]){x.lanes|=u,A=x.alternate,A!==null&&(A.lanes|=u),ug(x.return,u,o),h||(w=null);break e}x=A.next}}else if(y.tag===18){if(w=y.return,w===null)throw Error(r(341));w.lanes|=u,x=w.alternate,x!==null&&(x.lanes|=u),ug(w,u,o),w=null}else w=y.child;if(w!==null)w.return=y;else for(w=y;w!==null;){if(w===o){w=null;break}if(y=w.sibling,y!==null){y.return=w.return,w=y;break}w=w.return}y=w}}function jl(o,a,u,h){o=null;for(var y=a,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var w=y.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var A=y.type;cr(y.pendingProps.value,w.value)||(o!==null?o.push(A):o=[A])}}else if(y===Re.current){if(w=y.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Fc):o=[Fc])}y=y.return}o!==null&&fg(a,o,u,h),a.flags|=262144}function Pf(o){for(o=o.firstContext;o!==null;){if(!cr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function _o(o){Oo=o,$i=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function wn(o){return lw(Oo,o)}function $f(o,a){return Oo===null&&_o(o),lw(o,a)}function lw(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},$i===null){if(o===null)throw Error(r(308));$i=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else $i=$i.next=a;return u}var YR=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(u,h){o.push(h)}};this.abort=function(){a.aborted=!0,o.forEach(function(u){return u()})}},KR=t.unstable_scheduleCallback,WR=t.unstable_NormalPriority,Gt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dg(){return{controller:new YR,data:new Map,refCount:0}}function bc(o){o.refCount--,o.refCount===0&&KR(WR,function(){o.controller.abort()})}var xc=null,hg=0,Il=0,Bl=null;function GR(o,a){if(xc===null){var u=xc=[];hg=0,Il=gy(),Bl={status:"pending",value:void 0,then:function(h){u.push(h)}}}return hg++,a.then(aw,aw),a}function aw(){if(--hg===0&&xc!==null){Bl!==null&&(Bl.status="fulfilled");var o=xc;xc=null,Il=0,Bl=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function ZR(o,a){var u=[],h={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return o.then(function(){h.status="fulfilled",h.value=a;for(var y=0;y<u.length;y++)(0,u[y])(a)},function(y){for(h.status="rejected",h.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),h}var cw=I.S;I.S=function(o,a){Yv=Ft(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&GR(o,a),cw!==null&&cw(o,a)};var Do=_(null);function pg(){var o=Do.current;return o!==null?o:St.pooledCache}function Ff(o,a){a===null?E(Do,Do.current):E(Do,a.pool)}function uw(){var o=pg();return o===null?null:{parent:Gt._currentValue,pool:o}}var Ul=Error(r(460)),mg=Error(r(474)),qf=Error(r(542)),Yf={then:function(){}};function fw(o){return o=o.status,o==="fulfilled"||o==="rejected"}function dw(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(Ui,Ui),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,pw(o),o;default:if(typeof a.status=="string")a.then(Ui,Ui);else{if(o=St,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(h){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=h}},function(h){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,pw(o),o}throw No=a,Ul}}function Ro(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(No=u,Ul):u}}var No=null;function hw(){if(No===null)throw Error(r(459));var o=No;return No=null,o}function pw(o){if(o===Ul||o===qf)throw Error(r(483))}var Hl=null,Sc=0;function Kf(o){var a=Sc;return Sc+=1,Hl===null&&(Hl=[]),dw(Hl,o,a)}function wc(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Wf(o,a){throw a.$$typeof===g?Error(r(525)):(o=Object.prototype.toString.call(a),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function mw(o){function a(U,z){if(o){var V=U.deletions;V===null?(U.deletions=[z],U.flags|=16):V.push(z)}}function u(U,z){if(!o)return null;for(;z!==null;)a(U,z),z=z.sibling;return null}function h(U){for(var z=new Map;U!==null;)U.key!==null?z.set(U.key,U):z.set(U.index,U),U=U.sibling;return z}function y(U,z){return U=Vi(U,z),U.index=0,U.sibling=null,U}function x(U,z,V){return U.index=V,o?(V=U.alternate,V!==null?(V=V.index,V<z?(U.flags|=67108866,z):V):(U.flags|=67108866,z)):(U.flags|=1048576,z)}function w(U){return o&&U.alternate===null&&(U.flags|=67108866),U}function A(U,z,V,J){return z===null||z.tag!==6?(z=rg(V,U.mode,J),z.return=U,z):(z=y(z,V),z.return=U,z)}function R(U,z,V,J){var Oe=V.type;return Oe===v?W(U,z,V.props.children,J,V.key):z!==null&&(z.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===K&&Ro(Oe)===z.type)?(z=y(z,V.props),wc(z,V),z.return=U,z):(z=Hf(V.type,V.key,V.props,null,U.mode,J),wc(z,V),z.return=U,z)}function P(U,z,V,J){return z===null||z.tag!==4||z.stateNode.containerInfo!==V.containerInfo||z.stateNode.implementation!==V.implementation?(z=ig(V,U.mode,J),z.return=U,z):(z=y(z,V.children||[]),z.return=U,z)}function W(U,z,V,J,Oe){return z===null||z.tag!==7?(z=Ao(V,U.mode,J,Oe),z.return=U,z):(z=y(z,V),z.return=U,z)}function ee(U,z,V){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=rg(""+z,U.mode,V),z.return=U,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case b:return V=Hf(z.type,z.key,z.props,null,U.mode,V),wc(V,z),V.return=U,V;case S:return z=ig(z,U.mode,V),z.return=U,z;case K:return z=Ro(z),ee(U,z,V)}if(G(z)||le(z))return z=Ao(z,U.mode,V,null),z.return=U,z;if(typeof z.then=="function")return ee(U,Kf(z),V);if(z.$$typeof===j)return ee(U,$f(U,z),V);Wf(U,z)}return null}function F(U,z,V,J){var Oe=z!==null?z.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Oe!==null?null:A(U,z,""+V,J);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return V.key===Oe?R(U,z,V,J):null;case S:return V.key===Oe?P(U,z,V,J):null;case K:return V=Ro(V),F(U,z,V,J)}if(G(V)||le(V))return Oe!==null?null:W(U,z,V,J,null);if(typeof V.then=="function")return F(U,z,Kf(V),J);if(V.$$typeof===j)return F(U,z,$f(U,V),J);Wf(U,V)}return null}function q(U,z,V,J,Oe){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return U=U.get(V)||null,A(z,U,""+J,Oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return U=U.get(J.key===null?V:J.key)||null,R(z,U,J,Oe);case S:return U=U.get(J.key===null?V:J.key)||null,P(z,U,J,Oe);case K:return J=Ro(J),q(U,z,V,J,Oe)}if(G(J)||le(J))return U=U.get(V)||null,W(z,U,J,Oe,null);if(typeof J.then=="function")return q(U,z,V,Kf(J),Oe);if(J.$$typeof===j)return q(U,z,V,$f(z,J),Oe);Wf(z,J)}return null}function Se(U,z,V,J){for(var Oe=null,it=null,ke=z,Pe=z=0,et=null;ke!==null&&Pe<V.length;Pe++){ke.index>Pe?(et=ke,ke=null):et=ke.sibling;var st=F(U,ke,V[Pe],J);if(st===null){ke===null&&(ke=et);break}o&&ke&&st.alternate===null&&a(U,ke),z=x(st,z,Pe),it===null?Oe=st:it.sibling=st,it=st,ke=et}if(Pe===V.length)return u(U,ke),nt&&Pi(U,Pe),Oe;if(ke===null){for(;Pe<V.length;Pe++)ke=ee(U,V[Pe],J),ke!==null&&(z=x(ke,z,Pe),it===null?Oe=ke:it.sibling=ke,it=ke);return nt&&Pi(U,Pe),Oe}for(ke=h(ke);Pe<V.length;Pe++)et=q(ke,U,Pe,V[Pe],J),et!==null&&(o&&et.alternate!==null&&ke.delete(et.key===null?Pe:et.key),z=x(et,z,Pe),it===null?Oe=et:it.sibling=et,it=et);return o&&ke.forEach(function(Ps){return a(U,Ps)}),nt&&Pi(U,Pe),Oe}function Ne(U,z,V,J){if(V==null)throw Error(r(151));for(var Oe=null,it=null,ke=z,Pe=z=0,et=null,st=V.next();ke!==null&&!st.done;Pe++,st=V.next()){ke.index>Pe?(et=ke,ke=null):et=ke.sibling;var Ps=F(U,ke,st.value,J);if(Ps===null){ke===null&&(ke=et);break}o&&ke&&Ps.alternate===null&&a(U,ke),z=x(Ps,z,Pe),it===null?Oe=Ps:it.sibling=Ps,it=Ps,ke=et}if(st.done)return u(U,ke),nt&&Pi(U,Pe),Oe;if(ke===null){for(;!st.done;Pe++,st=V.next())st=ee(U,st.value,J),st!==null&&(z=x(st,z,Pe),it===null?Oe=st:it.sibling=st,it=st);return nt&&Pi(U,Pe),Oe}for(ke=h(ke);!st.done;Pe++,st=V.next())st=q(ke,U,Pe,st.value,J),st!==null&&(o&&st.alternate!==null&&ke.delete(st.key===null?Pe:st.key),z=x(st,z,Pe),it===null?Oe=st:it.sibling=st,it=st);return o&&ke.forEach(function(lz){return a(U,lz)}),nt&&Pi(U,Pe),Oe}function bt(U,z,V,J){if(typeof V=="object"&&V!==null&&V.type===v&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case b:e:{for(var Oe=V.key;z!==null;){if(z.key===Oe){if(Oe=V.type,Oe===v){if(z.tag===7){u(U,z.sibling),J=y(z,V.props.children),J.return=U,U=J;break e}}else if(z.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===K&&Ro(Oe)===z.type){u(U,z.sibling),J=y(z,V.props),wc(J,V),J.return=U,U=J;break e}u(U,z);break}else a(U,z);z=z.sibling}V.type===v?(J=Ao(V.props.children,U.mode,J,V.key),J.return=U,U=J):(J=Hf(V.type,V.key,V.props,null,U.mode,J),wc(J,V),J.return=U,U=J)}return w(U);case S:e:{for(Oe=V.key;z!==null;){if(z.key===Oe)if(z.tag===4&&z.stateNode.containerInfo===V.containerInfo&&z.stateNode.implementation===V.implementation){u(U,z.sibling),J=y(z,V.children||[]),J.return=U,U=J;break e}else{u(U,z);break}else a(U,z);z=z.sibling}J=ig(V,U.mode,J),J.return=U,U=J}return w(U);case K:return V=Ro(V),bt(U,z,V,J)}if(G(V))return Se(U,z,V,J);if(le(V)){if(Oe=le(V),typeof Oe!="function")throw Error(r(150));return V=Oe.call(V),Ne(U,z,V,J)}if(typeof V.then=="function")return bt(U,z,Kf(V),J);if(V.$$typeof===j)return bt(U,z,$f(U,V),J);Wf(U,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,z!==null&&z.tag===6?(u(U,z.sibling),J=y(z,V),J.return=U,U=J):(u(U,z),J=rg(V,U.mode,J),J.return=U,U=J),w(U)):u(U,z)}return function(U,z,V,J){try{Sc=0;var Oe=bt(U,z,V,J);return Hl=null,Oe}catch(ke){if(ke===Ul||ke===qf)throw ke;var it=ur(29,ke,null,U.mode);return it.lanes=J,it.return=U,it}finally{}}}var zo=mw(!0),gw=mw(!1),Es=!1;function gg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yg(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Ts(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function As(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(ut&2)!==0){var y=h.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),h.pending=a,a=Uf(o),QS(o,null,u),a}return Bf(o,h,a,u),Uf(o)}function vc(o,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,lS(o,u)}}function bg(o,a){var u=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var y=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var w={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?y=x=w:x=x.next=w,u=u.next}while(u!==null);x===null?y=x=a:x=x.next=a}else y=x=a;u={baseState:h.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=a:o.next=a,u.lastBaseUpdate=a}var xg=!1;function kc(){if(xg){var o=Bl;if(o!==null)throw o}}function Cc(o,a,u,h){xg=!1;var y=o.updateQueue;Es=!1;var x=y.firstBaseUpdate,w=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var R=A,P=R.next;R.next=null,w===null?x=P:w.next=P,w=R;var W=o.alternate;W!==null&&(W=W.updateQueue,A=W.lastBaseUpdate,A!==w&&(A===null?W.firstBaseUpdate=P:A.next=P,W.lastBaseUpdate=R))}if(x!==null){var ee=y.baseState;w=0,W=P=R=null,A=x;do{var F=A.lane&-536870913,q=F!==A.lane;if(q?(Qe&F)===F:(h&F)===F){F!==0&&F===Il&&(xg=!0),W!==null&&(W=W.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Se=o,Ne=A;F=a;var bt=u;switch(Ne.tag){case 1:if(Se=Ne.payload,typeof Se=="function"){ee=Se.call(bt,ee,F);break e}ee=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ne.payload,F=typeof Se=="function"?Se.call(bt,ee,F):Se,F==null)break e;ee=m({},ee,F);break e;case 2:Es=!0}}F=A.callback,F!==null&&(o.flags|=64,q&&(o.flags|=8192),q=y.callbacks,q===null?y.callbacks=[F]:q.push(F))}else q={lane:F,tag:A.tag,payload:A.payload,callback:A.callback,next:null},W===null?(P=W=q,R=ee):W=W.next=q,w|=F;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;q=A,A=q.next,q.next=null,y.lastBaseUpdate=q,y.shared.pending=null}}while(!0);W===null&&(R=ee),y.baseState=R,y.firstBaseUpdate=P,y.lastBaseUpdate=W,x===null&&(y.shared.lanes=0),Rs|=w,o.lanes=w,o.memoizedState=ee}}function yw(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function bw(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)yw(u[o],a)}var Vl=_(null),Gf=_(0);function xw(o,a){o=Qi,E(Gf,o),E(Vl,a),Qi=o|a.baseLanes}function Sg(){E(Gf,Qi),E(Vl,Vl.current)}function wg(){Qi=Gf.current,B(Vl),B(Gf)}var fr=_(null),Nr=null;function Ms(o){var a=o.alternate;E(qt,qt.current&1),E(fr,o),Nr===null&&(a===null||Vl.current!==null||a.memoizedState!==null)&&(Nr=o)}function vg(o){E(qt,qt.current),E(fr,o),Nr===null&&(Nr=o)}function Sw(o){o.tag===22?(E(qt,qt.current),E(fr,o),Nr===null&&(Nr=o)):Os()}function Os(){E(qt,qt.current),E(fr,fr.current)}function dr(o){B(fr),Nr===o&&(Nr=null),B(qt)}var qt=_(0);function Zf(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||My(u)||Oy(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){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 qi=0,Ve=null,gt=null,Zt=null,Jf=!1,Pl=!1,Lo=!1,Xf=0,Ec=0,$l=null,JR=0;function jt(){throw Error(r(321))}function kg(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!cr(o[u],a[u]))return!1;return!0}function Cg(o,a,u,h,y,x){return qi=x,Ve=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=o===null||o.memoizedState===null?rv:Ug,Lo=!1,x=u(h,y),Lo=!1,Pl&&(x=vw(a,u,h,y)),ww(o),x}function ww(o){I.H=Mc;var a=gt!==null&&gt.next!==null;if(qi=0,Zt=gt=Ve=null,Jf=!1,Ec=0,$l=null,a)throw Error(r(300));o===null||Jt||(o=o.dependencies,o!==null&&Pf(o)&&(Jt=!0))}function vw(o,a,u,h){Ve=o;var y=0;do{if(Pl&&($l=null),Ec=0,Pl=!1,25<=y)throw Error(r(301));if(y+=1,Zt=gt=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}I.H=iv,x=a(u,h)}while(Pl);return x}function XR(){var o=I.H,a=o.useState()[0];return a=typeof a.then=="function"?Tc(a):a,o=o.useState()[0],(gt!==null?gt.memoizedState:null)!==o&&(Ve.flags|=1024),a}function Eg(){var o=Xf!==0;return Xf=0,o}function Tg(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function Ag(o){if(Jf){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}Jf=!1}qi=0,Zt=gt=Ve=null,Pl=!1,Ec=Xf=0,$l=null}function Hn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Ve.memoizedState=Zt=o:Zt=Zt.next=o,Zt}function Yt(){if(gt===null){var o=Ve.alternate;o=o!==null?o.memoizedState:null}else o=gt.next;var a=Zt===null?Ve.memoizedState:Zt.next;if(a!==null)Zt=a,gt=o;else{if(o===null)throw Ve.alternate===null?Error(r(467)):Error(r(310));gt=o,o={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Zt===null?Ve.memoizedState=Zt=o:Zt=Zt.next=o}return Zt}function Qf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tc(o){var a=Ec;return Ec+=1,$l===null&&($l=[]),o=dw($l,o,a),a=Ve,(Zt===null?a.memoizedState:Zt.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?rv:Ug),o}function ed(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Tc(o);if(o.$$typeof===j)return wn(o)}throw Error(r(438,String(o)))}function Mg(o){var a=null,u=Ve.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=Ve.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=Qf(),Ve.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(o),h=0;h<o;h++)u[h]=xe;return a.index++,u}function Yi(o,a){return typeof a=="function"?a(o):a}function td(o){var a=Yt();return Og(a,gt,o)}function Og(o,a,u){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var y=o.baseQueue,x=h.pending;if(x!==null){if(y!==null){var w=y.next;y.next=x.next,x.next=w}a.baseQueue=y=x,h.pending=null}if(x=o.baseState,y===null)o.memoizedState=x;else{a=y.next;var A=w=null,R=null,P=a,W=!1;do{var ee=P.lane&-536870913;if(ee!==P.lane?(Qe&ee)===ee:(qi&ee)===ee){var F=P.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),ee===Il&&(W=!0);else if((qi&F)===F){P=P.next,F===Il&&(W=!0);continue}else ee={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},R===null?(A=R=ee,w=x):R=R.next=ee,Ve.lanes|=F,Rs|=F;ee=P.action,Lo&&u(x,ee),x=P.hasEagerState?P.eagerState:u(x,ee)}else F={lane:ee,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},R===null?(A=R=F,w=x):R=R.next=F,Ve.lanes|=ee,Rs|=ee;P=P.next}while(P!==null&&P!==a);if(R===null?w=x:R.next=A,!cr(x,o.memoizedState)&&(Jt=!0,W&&(u=Bl,u!==null)))throw u;o.memoizedState=x,o.baseState=w,o.baseQueue=R,h.lastRenderedState=x}return y===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function _g(o){var a=Yt(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var h=u.dispatch,y=u.pending,x=a.memoizedState;if(y!==null){u.pending=null;var w=y=y.next;do x=o(x,w.action),w=w.next;while(w!==y);cr(x,a.memoizedState)||(Jt=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,h]}function kw(o,a,u){var h=Ve,y=Yt(),x=nt;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var w=!cr((gt||y).memoizedState,u);if(w&&(y.memoizedState=u,Jt=!0),y=y.queue,Ng(Tw.bind(null,h,y,o),[o]),y.getSnapshot!==a||w||Zt!==null&&Zt.memoizedState.tag&1){if(h.flags|=2048,Fl(9,{destroy:void 0},Ew.bind(null,h,y,u,a),null),St===null)throw Error(r(349));x||(qi&127)!==0||Cw(h,a,u)}return u}function Cw(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=Ve.updateQueue,a===null?(a=Qf(),Ve.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function Ew(o,a,u,h){a.value=u,a.getSnapshot=h,Aw(a)&&Mw(o)}function Tw(o,a,u){return u(function(){Aw(a)&&Mw(o)})}function Aw(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!cr(o,u)}catch{return!0}}function Mw(o){var a=To(o,2);a!==null&&tr(a,o,2)}function Dg(o){var a=Hn();if(typeof o=="function"){var u=o;if(o=u(),Lo){pt(!0);try{u()}finally{pt(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:o},a}function Ow(o,a,u,h){return o.baseState=u,Og(o,gt,typeof h=="function"?h:Yi)}function QR(o,a,u,h,y){if(id(o))throw Error(r(485));if(o=a.action,o!==null){var x={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};I.T!==null?u(!0):x.isTransition=!1,h(x),u=a.pending,u===null?(x.next=a.pending=x,_w(a,x)):(x.next=u.next,a.pending=u.next=x)}}function _w(o,a){var u=a.action,h=a.payload,y=o.state;if(a.isTransition){var x=I.T,w={};I.T=w;try{var A=u(y,h),R=I.S;R!==null&&R(w,A),Dw(o,a,A)}catch(P){Rg(o,a,P)}finally{x!==null&&w.types!==null&&(x.types=w.types),I.T=x}}else try{x=u(y,h),Dw(o,a,x)}catch(P){Rg(o,a,P)}}function Dw(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){Rw(o,a,h)},function(h){return Rg(o,a,h)}):Rw(o,a,u)}function Rw(o,a,u){a.status="fulfilled",a.value=u,Nw(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,_w(o,u)))}function Rg(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,Nw(a),a=a.next;while(a!==h)}o.action=null}function Nw(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function zw(o,a){return a}function Lw(o,a){if(nt){var u=St.formState;if(u!==null){e:{var h=Ve;if(nt){if(Ot){t:{for(var y=Ot,x=Rr;y.nodeType!==8;){if(!x){y=null;break t}if(y=zr(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){Ot=zr(y.nextSibling),h=y.data==="F!";break e}}ks(h)}h=!1}h&&(a=u[0])}}return u=Hn(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zw,lastRenderedState:a},u.queue=h,u=ev.bind(null,Ve,h),h.dispatch=u,h=Dg(!1),x=Bg.bind(null,Ve,!1,h.queue),h=Hn(),y={state:a,dispatch:null,action:o,pending:null},h.queue=y,u=QR.bind(null,Ve,y,x,u),y.dispatch=u,h.memoizedState=o,[a,u,!1]}function jw(o){var a=Yt();return Iw(a,gt,o)}function Iw(o,a,u){if(a=Og(o,a,zw)[0],o=td(Yi)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Tc(a)}catch(w){throw w===Ul?qf:w}else h=a;a=Yt();var y=a.queue,x=y.dispatch;return u!==a.memoizedState&&(Ve.flags|=2048,Fl(9,{destroy:void 0},eN.bind(null,y,u),null)),[h,x,o]}function eN(o,a){o.action=a}function Bw(o){var a=Yt(),u=gt;if(u!==null)return Iw(a,u,o);Yt(),a=a.memoizedState,u=Yt();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function Fl(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=Ve.updateQueue,a===null&&(a=Qf(),Ve.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=o.next=o:(h=u.next,u.next=o,o.next=h,a.lastEffect=o),o}function Uw(){return Yt().memoizedState}function nd(o,a,u,h){var y=Hn();Ve.flags|=o,y.memoizedState=Fl(1|a,{destroy:void 0},u,h===void 0?null:h)}function rd(o,a,u,h){var y=Yt();h=h===void 0?null:h;var x=y.memoizedState.inst;gt!==null&&h!==null&&kg(h,gt.memoizedState.deps)?y.memoizedState=Fl(a,x,u,h):(Ve.flags|=o,y.memoizedState=Fl(1|a,x,u,h))}function Hw(o,a){nd(8390656,8,o,a)}function Ng(o,a){rd(2048,8,o,a)}function tN(o){Ve.flags|=4;var a=Ve.updateQueue;if(a===null)a=Qf(),Ve.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function Vw(o){var a=Yt().memoizedState;return tN({ref:a,nextImpl:o}),function(){if((ut&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Pw(o,a){return rd(4,2,o,a)}function $w(o,a){return rd(4,4,o,a)}function Fw(o,a){if(typeof a=="function"){o=o();var u=a(o);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function qw(o,a,u){u=u!=null?u.concat([o]):null,rd(4,4,Fw.bind(null,a,o),u)}function zg(){}function Yw(o,a){var u=Yt();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&kg(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function Kw(o,a){var u=Yt();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&kg(a,h[1]))return h[0];if(h=o(),Lo){pt(!0);try{o()}finally{pt(!1)}}return u.memoizedState=[h,a],h}function Lg(o,a,u){return u===void 0||(qi&1073741824)!==0&&(Qe&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=Wv(),Ve.lanes|=o,Rs|=o,u)}function Ww(o,a,u,h){return cr(u,a)?u:Vl.current!==null?(o=Lg(o,u,h),cr(o,a)||(Jt=!0),o):(qi&42)===0||(qi&1073741824)!==0&&(Qe&261930)===0?(Jt=!0,o.memoizedState=u):(o=Wv(),Ve.lanes|=o,Rs|=o,a)}function Gw(o,a,u,h,y){var x=Z.p;Z.p=x!==0&&8>x?x:8;var w=I.T,A={};I.T=A,Bg(o,!1,a,u);try{var R=y(),P=I.S;if(P!==null&&P(A,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var W=ZR(R,h);Ac(o,a,W,mr(o))}else Ac(o,a,h,mr(o))}catch(ee){Ac(o,a,{then:function(){},status:"rejected",reason:ee},mr())}finally{Z.p=x,w!==null&&A.types!==null&&(w.types=A.types),I.T=w}}function nN(){}function jg(o,a,u,h){if(o.tag!==5)throw Error(r(476));var y=Zw(o).queue;Gw(o,y,a,me,u===null?nN:function(){return Jw(o),u(h)})}function Zw(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:me},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function Jw(o){var a=Zw(o);a.next===null&&(a=o.alternate.memoizedState),Ac(o,a.next.queue,{},mr())}function Ig(){return wn(Fc)}function Xw(){return Yt().memoizedState}function Qw(){return Yt().memoizedState}function rN(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=mr();o=Ts(u);var h=As(a,o,u);h!==null&&(tr(h,a,u),vc(h,a,u)),a={cache:dg()},o.payload=a;return}a=a.return}}function iN(o,a,u){var h=mr();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},id(o)?tv(a,u):(u=tg(o,a,u,h),u!==null&&(tr(u,o,h),nv(u,a,h)))}function ev(o,a,u){var h=mr();Ac(o,a,u,h)}function Ac(o,a,u,h){var y={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(id(o))tv(a,y);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,A=x(w,u);if(y.hasEagerState=!0,y.eagerState=A,cr(A,w))return Bf(o,a,y,0),St===null&&If(),!1}catch{}finally{}if(u=tg(o,a,y,h),u!==null)return tr(u,o,h),nv(u,a,h),!0}return!1}function Bg(o,a,u,h){if(h={lane:2,revertLane:gy(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},id(o)){if(a)throw Error(r(479))}else a=tg(o,u,h,2),a!==null&&tr(a,o,2)}function id(o){var a=o.alternate;return o===Ve||a!==null&&a===Ve}function tv(o,a){Pl=Jf=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function nv(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,lS(o,u)}}var Mc={readContext:wn,use:ed,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};Mc.useEffectEvent=jt;var rv={readContext:wn,use:ed,useCallback:function(o,a){return Hn().memoizedState=[o,a===void 0?null:a],o},useContext:wn,useEffect:Hw,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,nd(4194308,4,Fw.bind(null,a,o),u)},useLayoutEffect:function(o,a){return nd(4194308,4,o,a)},useInsertionEffect:function(o,a){nd(4,2,o,a)},useMemo:function(o,a){var u=Hn();a=a===void 0?null:a;var h=o();if(Lo){pt(!0);try{o()}finally{pt(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=Hn();if(u!==void 0){var y=u(a);if(Lo){pt(!0);try{u(a)}finally{pt(!1)}}}else y=a;return h.memoizedState=h.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},h.queue=o,o=o.dispatch=iN.bind(null,Ve,o),[h.memoizedState,o]},useRef:function(o){var a=Hn();return o={current:o},a.memoizedState=o},useState:function(o){o=Dg(o);var a=o.queue,u=ev.bind(null,Ve,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:zg,useDeferredValue:function(o,a){var u=Hn();return Lg(u,o,a)},useTransition:function(){var o=Dg(!1);return o=Gw.bind(null,Ve,o.queue,!0,!1),Hn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=Ve,y=Hn();if(nt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),St===null)throw Error(r(349));(Qe&127)!==0||Cw(h,a,u)}y.memoizedState=u;var x={value:u,getSnapshot:a};return y.queue=x,Hw(Tw.bind(null,h,x,o),[o]),h.flags|=2048,Fl(9,{destroy:void 0},Ew.bind(null,h,x,u,a),null),u},useId:function(){var o=Hn(),a=St.identifierPrefix;if(nt){var u=fi,h=ui;u=(h&~(1<<32-oe(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Xf++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=JR++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:Ig,useFormState:Lw,useActionState:Lw,useOptimistic:function(o){var a=Hn();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Bg.bind(null,Ve,!0,u),u.dispatch=a,[o,a]},useMemoCache:Mg,useCacheRefresh:function(){return Hn().memoizedState=rN.bind(null,Ve)},useEffectEvent:function(o){var a=Hn(),u={impl:o};return a.memoizedState=u,function(){if((ut&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},Ug={readContext:wn,use:ed,useCallback:Yw,useContext:wn,useEffect:Ng,useImperativeHandle:qw,useInsertionEffect:Pw,useLayoutEffect:$w,useMemo:Kw,useReducer:td,useRef:Uw,useState:function(){return td(Yi)},useDebugValue:zg,useDeferredValue:function(o,a){var u=Yt();return Ww(u,gt.memoizedState,o,a)},useTransition:function(){var o=td(Yi)[0],a=Yt().memoizedState;return[typeof o=="boolean"?o:Tc(o),a]},useSyncExternalStore:kw,useId:Xw,useHostTransitionStatus:Ig,useFormState:jw,useActionState:jw,useOptimistic:function(o,a){var u=Yt();return Ow(u,gt,o,a)},useMemoCache:Mg,useCacheRefresh:Qw};Ug.useEffectEvent=Vw;var iv={readContext:wn,use:ed,useCallback:Yw,useContext:wn,useEffect:Ng,useImperativeHandle:qw,useInsertionEffect:Pw,useLayoutEffect:$w,useMemo:Kw,useReducer:_g,useRef:Uw,useState:function(){return _g(Yi)},useDebugValue:zg,useDeferredValue:function(o,a){var u=Yt();return gt===null?Lg(u,o,a):Ww(u,gt.memoizedState,o,a)},useTransition:function(){var o=_g(Yi)[0],a=Yt().memoizedState;return[typeof o=="boolean"?o:Tc(o),a]},useSyncExternalStore:kw,useId:Xw,useHostTransitionStatus:Ig,useFormState:Bw,useActionState:Bw,useOptimistic:function(o,a){var u=Yt();return gt!==null?Ow(u,gt,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:Mg,useCacheRefresh:Qw};iv.useEffectEvent=Vw;function Hg(o,a,u,h){a=o.memoizedState,u=u(h,a),u=u==null?a:m({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var Vg={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=mr(),y=Ts(h);y.payload=a,u!=null&&(y.callback=u),a=As(o,y,h),a!==null&&(tr(a,o,h),vc(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=mr(),y=Ts(h);y.tag=1,y.payload=a,u!=null&&(y.callback=u),a=As(o,y,h),a!==null&&(tr(a,o,h),vc(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=mr(),h=Ts(u);h.tag=2,a!=null&&(h.callback=a),a=As(o,h,u),a!==null&&(tr(a,o,u),vc(a,o,u))}};function sv(o,a,u,h,y,x,w){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,x,w):a.prototype&&a.prototype.isPureReactComponent?!pc(u,h)||!pc(y,x):!0}function ov(o,a,u,h){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==o&&Vg.enqueueReplaceState(a,a.state,null)}function jo(o,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(o=o.defaultProps){u===a&&(u=m({},u));for(var y in o)u[y]===void 0&&(u[y]=o[y])}return u}function lv(o){jf(o)}function av(o){console.error(o)}function cv(o){jf(o)}function sd(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function uv(o,a,u){try{var h=o.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Pg(o,a,u){return u=Ts(u),u.tag=3,u.payload={element:null},u.callback=function(){sd(o,a)},u}function fv(o){return o=Ts(o),o.tag=3,o}function dv(o,a,u,h){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var x=h.value;o.payload=function(){return y(x)},o.callback=function(){uv(a,u,h)}}var w=u.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(o.callback=function(){uv(a,u,h),typeof y!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var A=h.stack;this.componentDidCatch(h.value,{componentStack:A!==null?A:""})})}function sN(o,a,u,h,y){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&jl(a,u,y,!0),u=fr.current,u!==null){switch(u.tag){case 31:case 13:return Nr===null?yd():u.alternate===null&&It===0&&(It=3),u.flags&=-257,u.flags|=65536,u.lanes=y,h===Yf?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),hy(o,h,y)),!1;case 22:return u.flags|=65536,h===Yf?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),hy(o,h,y)),!1}throw Error(r(435,u.tag))}return hy(o,h,y),yd(),!1}if(nt)return a=fr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,h!==lg&&(o=Error(r(422),{cause:h}),yc(Or(o,u)))):(h!==lg&&(a=Error(r(423),{cause:h}),yc(Or(a,u))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,h=Or(h,u),y=Pg(o.stateNode,h,y),bg(o,y),It!==4&&(It=2)),!1;var x=Error(r(520),{cause:h});if(x=Or(x,u),jc===null?jc=[x]:jc.push(x),It!==4&&(It=2),a===null)return!0;h=Or(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=y&-y,u.lanes|=o,o=Pg(u.stateNode,h,o),bg(u,o),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ns===null||!Ns.has(x))))return u.flags|=65536,y&=-y,u.lanes|=y,y=fv(y),dv(y,o,u,h),bg(u,y),!1}u=u.return}while(u!==null);return!1}var $g=Error(r(461)),Jt=!1;function vn(o,a,u,h){a.child=o===null?gw(a,null,u,h):zo(a,o.child,u,h)}function hv(o,a,u,h,y){u=u.render;var x=a.ref;if("ref"in h){var w={};for(var A in h)A!=="ref"&&(w[A]=h[A])}else w=h;return _o(a),h=Cg(o,a,u,w,x,y),A=Eg(),o!==null&&!Jt?(Tg(o,a,y),Ki(o,a,y)):(nt&&A&&sg(a),a.flags|=1,vn(o,a,h,y),a.child)}function pv(o,a,u,h,y){if(o===null){var x=u.type;return typeof x=="function"&&!ng(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,mv(o,a,x,h,y)):(o=Hf(u.type,null,h,a,a.mode,y),o.ref=a.ref,o.return=a,a.child=o)}if(x=o.child,!Jg(o,y)){var w=x.memoizedProps;if(u=u.compare,u=u!==null?u:pc,u(w,h)&&o.ref===a.ref)return Ki(o,a,y)}return a.flags|=1,o=Vi(x,h),o.ref=a.ref,o.return=a,a.child=o}function mv(o,a,u,h,y){if(o!==null){var x=o.memoizedProps;if(pc(x,h)&&o.ref===a.ref)if(Jt=!1,a.pendingProps=h=x,Jg(o,y))(o.flags&131072)!==0&&(Jt=!0);else return a.lanes=o.lanes,Ki(o,a,y)}return Fg(o,a,u,h,y)}function gv(o,a,u,h){var y=h.children,x=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,o!==null){for(h=a.child=o.child,y=0;h!==null;)y=y|h.lanes|h.childLanes,h=h.sibling;h=y&~x}else h=0,a.child=null;return yv(o,a,x,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&Ff(a,x!==null?x.cachePool:null),x!==null?xw(a,x):Sg(),Sw(a);else return h=a.lanes=536870912,yv(o,a,x!==null?x.baseLanes|u:u,u,h)}else x!==null?(Ff(a,x.cachePool),xw(a,x),Os(),a.memoizedState=null):(o!==null&&Ff(a,null),Sg(),Os());return vn(o,a,y,u),a.child}function Oc(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function yv(o,a,u,h,y){var x=pg();return x=x===null?null:{parent:Gt._currentValue,pool:x},a.memoizedState={baseLanes:u,cachePool:x},o!==null&&Ff(a,null),Sg(),Sw(a),o!==null&&jl(o,a,h,!0),a.childLanes=y,null}function od(o,a){return a=ad({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function bv(o,a,u){return zo(a,o.child,null,u),o=od(a,a.pendingProps),o.flags|=2,dr(a),a.memoizedState=null,o}function oN(o,a,u){var h=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(nt){if(h.mode==="hidden")return o=od(a,h),a.lanes=536870912,Oc(null,o);if(vg(a),(o=Ot)?(o=_k(o,Rr),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:ws!==null?{id:ui,overflow:fi}:null,retryLane:536870912,hydrationErrors:null},u=tw(o),u.return=a,a.child=u,Sn=a,Ot=null)):o=null,o===null)throw ks(a);return a.lanes=536870912,null}return od(a,h)}var x=o.memoizedState;if(x!==null){var w=x.dehydrated;if(vg(a),y)if(a.flags&256)a.flags&=-257,a=bv(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Jt||jl(o,a,u,!1),y=(u&o.childLanes)!==0,Jt||y){if(h=St,h!==null&&(w=aS(h,u),w!==0&&w!==x.retryLane))throw x.retryLane=w,To(o,w),tr(h,o,w),$g;yd(),a=bv(o,a,u)}else o=x.treeContext,Ot=zr(w.nextSibling),Sn=a,nt=!0,vs=null,Rr=!1,o!==null&&iw(a,o),a=od(a,h),a.flags|=4096;return a}return o=Vi(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function ld(o,a){var u=a.ref;if(u===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(o===null||o.ref!==u)&&(a.flags|=4194816)}}function Fg(o,a,u,h,y){return _o(a),u=Cg(o,a,u,h,void 0,y),h=Eg(),o!==null&&!Jt?(Tg(o,a,y),Ki(o,a,y)):(nt&&h&&sg(a),a.flags|=1,vn(o,a,u,y),a.child)}function xv(o,a,u,h,y,x){return _o(a),a.updateQueue=null,u=vw(a,h,u,y),ww(o),h=Eg(),o!==null&&!Jt?(Tg(o,a,x),Ki(o,a,x)):(nt&&h&&sg(a),a.flags|=1,vn(o,a,u,x),a.child)}function Sv(o,a,u,h,y){if(_o(a),a.stateNode===null){var x=Rl,w=u.contextType;typeof w=="object"&&w!==null&&(x=wn(w)),x=new u(h,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Vg,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=h,x.state=a.memoizedState,x.refs={},gg(a),w=u.contextType,x.context=typeof w=="object"&&w!==null?wn(w):Rl,x.state=a.memoizedState,w=u.getDerivedStateFromProps,typeof w=="function"&&(Hg(a,u,w,h),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Vg.enqueueReplaceState(x,x.state,null),Cc(a,h,x,y),kc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){x=a.stateNode;var A=a.memoizedProps,R=jo(u,A);x.props=R;var P=x.context,W=u.contextType;w=Rl,typeof W=="object"&&W!==null&&(w=wn(W));var ee=u.getDerivedStateFromProps;W=typeof ee=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=a.pendingProps!==A,W||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||P!==w)&&ov(a,x,h,w),Es=!1;var F=a.memoizedState;x.state=F,Cc(a,h,x,y),kc(),P=a.memoizedState,A||F!==P||Es?(typeof ee=="function"&&(Hg(a,u,ee,h),P=a.memoizedState),(R=Es||sv(a,u,R,h,F,P,w))?(W||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=P),x.props=h,x.state=P,x.context=w,h=R):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{x=a.stateNode,yg(o,a),w=a.memoizedProps,W=jo(u,w),x.props=W,ee=a.pendingProps,F=x.context,P=u.contextType,R=Rl,typeof P=="object"&&P!==null&&(R=wn(P)),A=u.getDerivedStateFromProps,(P=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ee||F!==R)&&ov(a,x,h,R),Es=!1,F=a.memoizedState,x.state=F,Cc(a,h,x,y),kc();var q=a.memoizedState;w!==ee||F!==q||Es||o!==null&&o.dependencies!==null&&Pf(o.dependencies)?(typeof A=="function"&&(Hg(a,u,A,h),q=a.memoizedState),(W=Es||sv(a,u,W,h,F,q,R)||o!==null&&o.dependencies!==null&&Pf(o.dependencies))?(P||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(h,q,R),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(h,q,R)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=q),x.props=h,x.state=q,x.context=R,h=W):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&F===o.memoizedState||(a.flags|=1024),h=!1)}return x=h,ld(o,a),h=(a.flags&128)!==0,x||h?(x=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,o!==null&&h?(a.child=zo(a,o.child,null,y),a.child=zo(a,null,u,y)):vn(o,a,u,y),a.memoizedState=x.state,o=a.child):o=Ki(o,a,y),o}function wv(o,a,u,h){return Mo(),a.flags|=256,vn(o,a,u,h),a.child}var qg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yg(o){return{baseLanes:o,cachePool:uw()}}function Kg(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=pr),o}function vv(o,a,u){var h=a.pendingProps,y=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=o!==null&&o.memoizedState===null?!1:(qt.current&2)!==0),w&&(y=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,o===null){if(nt){if(y?Ms(a):Os(),(o=Ot)?(o=_k(o,Rr),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:ws!==null?{id:ui,overflow:fi}:null,retryLane:536870912,hydrationErrors:null},u=tw(o),u.return=a,a.child=u,Sn=a,Ot=null)):o=null,o===null)throw ks(a);return Oy(o)?a.lanes=32:a.lanes=536870912,null}var A=h.children;return h=h.fallback,y?(Os(),y=a.mode,A=ad({mode:"hidden",children:A},y),h=Ao(h,y,u,null),A.return=a,h.return=a,A.sibling=h,a.child=A,h=a.child,h.memoizedState=Yg(u),h.childLanes=Kg(o,w,u),a.memoizedState=qg,Oc(null,h)):(Ms(a),Wg(a,A))}var R=o.memoizedState;if(R!==null&&(A=R.dehydrated,A!==null)){if(x)a.flags&256?(Ms(a),a.flags&=-257,a=Gg(o,a,u)):a.memoizedState!==null?(Os(),a.child=o.child,a.flags|=128,a=null):(Os(),A=h.fallback,y=a.mode,h=ad({mode:"visible",children:h.children},y),A=Ao(A,y,u,null),A.flags|=2,h.return=a,A.return=a,h.sibling=A,a.child=h,zo(a,o.child,null,u),h=a.child,h.memoizedState=Yg(u),h.childLanes=Kg(o,w,u),a.memoizedState=qg,a=Oc(null,h));else if(Ms(a),Oy(A)){if(w=A.nextSibling&&A.nextSibling.dataset,w)var P=w.dgst;w=P,h=Error(r(419)),h.stack="",h.digest=w,yc({value:h,source:null,stack:null}),a=Gg(o,a,u)}else if(Jt||jl(o,a,u,!1),w=(u&o.childLanes)!==0,Jt||w){if(w=St,w!==null&&(h=aS(w,u),h!==0&&h!==R.retryLane))throw R.retryLane=h,To(o,h),tr(w,o,h),$g;My(A)||yd(),a=Gg(o,a,u)}else My(A)?(a.flags|=192,a.child=o.child,a=null):(o=R.treeContext,Ot=zr(A.nextSibling),Sn=a,nt=!0,vs=null,Rr=!1,o!==null&&iw(a,o),a=Wg(a,h.children),a.flags|=4096);return a}return y?(Os(),A=h.fallback,y=a.mode,R=o.child,P=R.sibling,h=Vi(R,{mode:"hidden",children:h.children}),h.subtreeFlags=R.subtreeFlags&65011712,P!==null?A=Vi(P,A):(A=Ao(A,y,u,null),A.flags|=2),A.return=a,h.return=a,h.sibling=A,a.child=h,Oc(null,h),h=a.child,A=o.child.memoizedState,A===null?A=Yg(u):(y=A.cachePool,y!==null?(R=Gt._currentValue,y=y.parent!==R?{parent:R,pool:R}:y):y=uw(),A={baseLanes:A.baseLanes|u,cachePool:y}),h.memoizedState=A,h.childLanes=Kg(o,w,u),a.memoizedState=qg,Oc(o.child,h)):(Ms(a),u=o.child,o=u.sibling,u=Vi(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,o!==null&&(w=a.deletions,w===null?(a.deletions=[o],a.flags|=16):w.push(o)),a.child=u,a.memoizedState=null,u)}function Wg(o,a){return a=ad({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function ad(o,a){return o=ur(22,o,null,a),o.lanes=0,o}function Gg(o,a,u){return zo(a,o.child,null,u),o=Wg(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function kv(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),ug(o.return,a,u)}function Zg(o,a,u,h,y,x){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:y,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=h,w.tail=u,w.tailMode=y,w.treeForkCount=x)}function Cv(o,a,u){var h=a.pendingProps,y=h.revealOrder,x=h.tail;h=h.children;var w=qt.current,A=(w&2)!==0;if(A?(w=w&1|2,a.flags|=128):w&=1,E(qt,w),vn(o,a,h,u),h=nt?gc:0,!A&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&kv(o,u,a);else if(o.tag===19)kv(o,u,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}switch(y){case"forwards":for(u=a.child,y=null;u!==null;)o=u.alternate,o!==null&&Zf(o)===null&&(y=u),u=u.sibling;u=y,u===null?(y=a.child,a.child=null):(y=u.sibling,u.sibling=null),Zg(a,!1,y,u,x,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=a.child,a.child=null;y!==null;){if(o=y.alternate,o!==null&&Zf(o)===null){a.child=y;break}o=y.sibling,y.sibling=u,u=y,y=o}Zg(a,!0,u,null,x,h);break;case"together":Zg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Ki(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Rs|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(jl(o,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,u=Vi(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=Vi(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function Jg(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&Pf(o)))}function lN(o,a,u){switch(a.tag){case 3:De(a,a.stateNode.containerInfo),Cs(a,Gt,o.memoizedState.cache),Mo();break;case 27:case 5:kt(a);break;case 4:De(a,a.stateNode.containerInfo);break;case 10:Cs(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,vg(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Ms(a),a.flags|=128,null):(u&a.child.childLanes)!==0?vv(o,a,u):(Ms(a),o=Ki(o,a,u),o!==null?o.sibling:null);Ms(a);break;case 19:var y=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(jl(o,a,u,!1),h=(u&a.childLanes)!==0),y){if(h)return Cv(o,a,u);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),E(qt,qt.current),h)break;return null;case 22:return a.lanes=0,gv(o,a,u,a.pendingProps);case 24:Cs(a,Gt,o.memoizedState.cache)}return Ki(o,a,u)}function Ev(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)Jt=!0;else{if(!Jg(o,u)&&(a.flags&128)===0)return Jt=!1,lN(o,a,u);Jt=(o.flags&131072)!==0}else Jt=!1,nt&&(a.flags&1048576)!==0&&rw(a,gc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(o=Ro(a.elementType),a.type=o,typeof o=="function")ng(o)?(h=jo(o,h),a.tag=1,a=Sv(null,a,o,h,u)):(a.tag=0,a=Fg(null,a,o,h,u));else{if(o!=null){var y=o.$$typeof;if(y===ne){a.tag=11,a=hv(null,a,o,h,u);break e}else if(y===D){a.tag=14,a=pv(null,a,o,h,u);break e}}throw a=ie(o)||o,Error(r(306,a,""))}}return a;case 0:return Fg(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,y=jo(h,a.pendingProps),Sv(o,a,h,y,u);case 3:e:{if(De(a,a.stateNode.containerInfo),o===null)throw Error(r(387));h=a.pendingProps;var x=a.memoizedState;y=x.element,yg(o,a),Cc(a,h,null,u);var w=a.memoizedState;if(h=w.cache,Cs(a,Gt,h),h!==x.cache&&fg(a,[Gt],u,!0),kc(),h=w.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=wv(o,a,h,u);break e}else if(h!==y){y=Or(Error(r(424)),a),yc(y),a=wv(o,a,h,u);break e}else{switch(o=a.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(Ot=zr(o.firstChild),Sn=a,nt=!0,vs=null,Rr=!0,u=gw(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Mo(),h===y){a=Ki(o,a,u);break e}vn(o,a,h,u)}a=a.child}return a;case 26:return ld(o,a),o===null?(u=jk(a.type,null,a.pendingProps,null))?a.memoizedState=u:nt||(u=a.type,o=a.pendingProps,h=Cd(ge.current).createElement(u),h[xn]=a,h[Gn]=o,kn(h,u,o),on(h),a.stateNode=h):a.memoizedState=jk(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return kt(a),o===null&&nt&&(h=a.stateNode=Nk(a.type,a.pendingProps,ge.current),Sn=a,Rr=!0,y=Ot,Is(a.type)?(_y=y,Ot=zr(h.firstChild)):Ot=y),vn(o,a,a.pendingProps.children,u),ld(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&nt&&((y=h=Ot)&&(h=IN(h,a.type,a.pendingProps,Rr),h!==null?(a.stateNode=h,Sn=a,Ot=zr(h.firstChild),Rr=!1,y=!0):y=!1),y||ks(a)),kt(a),y=a.type,x=a.pendingProps,w=o!==null?o.memoizedProps:null,h=x.children,Ey(y,x)?h=null:w!==null&&Ey(y,w)&&(a.flags|=32),a.memoizedState!==null&&(y=Cg(o,a,XR,null,null,u),Fc._currentValue=y),ld(o,a),vn(o,a,h,u),a.child;case 6:return o===null&&nt&&((o=u=Ot)&&(u=BN(u,a.pendingProps,Rr),u!==null?(a.stateNode=u,Sn=a,Ot=null,o=!0):o=!1),o||ks(a)),null;case 13:return vv(o,a,u);case 4:return De(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=zo(a,null,h,u):vn(o,a,h,u),a.child;case 11:return hv(o,a,a.type,a.pendingProps,u);case 7:return vn(o,a,a.pendingProps,u),a.child;case 8:return vn(o,a,a.pendingProps.children,u),a.child;case 12:return vn(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,Cs(a,a.type,h.value),vn(o,a,h.children,u),a.child;case 9:return y=a.type._context,h=a.pendingProps.children,_o(a),y=wn(y),h=h(y),a.flags|=1,vn(o,a,h,u),a.child;case 14:return pv(o,a,a.type,a.pendingProps,u);case 15:return mv(o,a,a.type,a.pendingProps,u);case 19:return Cv(o,a,u);case 31:return oN(o,a,u);case 22:return gv(o,a,u,a.pendingProps);case 24:return _o(a),h=wn(Gt),o===null?(y=pg(),y===null&&(y=St,x=dg(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=u),y=x),a.memoizedState={parent:h,cache:y},gg(a),Cs(a,Gt,y)):((o.lanes&u)!==0&&(yg(o,a),Cc(a,null,null,u),kc()),y=o.memoizedState,x=a.memoizedState,y.parent!==h?(y={parent:h,cache:h},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),Cs(a,Gt,h)):(h=x.cache,Cs(a,Gt,h),h!==y.cache&&fg(a,[Gt],u,!0))),vn(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Wi(o){o.flags|=4}function Xg(o,a,u,h,y){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(Xv())o.flags|=8192;else throw No=Yf,mg}else o.flags&=-16777217}function Tv(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Vk(a))if(Xv())o.flags|=8192;else throw No=Yf,mg}function cd(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Ef():536870912,o.lanes|=a,Wl|=a)}function _c(o,a){if(!nt)switch(o.tailMode){case"hidden":a=o.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function _t(o){var a=o.alternate!==null&&o.alternate.child===o.child,u=0,h=0;if(a)for(var y=o.child;y!==null;)u|=y.lanes|y.childLanes,h|=y.subtreeFlags&65011712,h|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)u|=y.lanes|y.childLanes,h|=y.subtreeFlags,h|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=h,o.childLanes=u,a}function aN(o,a,u){var h=a.pendingProps;switch(og(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(a),null;case 1:return _t(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Fi(Gt),Ue(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(Ll(a)?Wi(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,ag())),_t(a),null;case 26:var y=a.type,x=a.memoizedState;return o===null?(Wi(a),x!==null?(_t(a),Tv(a,x)):(_t(a),Xg(a,y,null,h,u))):x?x!==o.memoizedState?(Wi(a),_t(a),Tv(a,x)):(_t(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&Wi(a),_t(a),Xg(a,y,o,h,u)),null;case 27:if(Ee(a),u=ge.current,y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&Wi(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return _t(a),null}o=X.current,Ll(a)?sw(a):(o=Nk(y,h,u),a.stateNode=o,Wi(a))}return _t(a),null;case 5:if(Ee(a),y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&Wi(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return _t(a),null}if(x=X.current,Ll(a))sw(a);else{var w=Cd(ge.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?w.createElement("select",{is:h.is}):w.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?w.createElement(y,{is:h.is}):w.createElement(y)}}x[xn]=a,x[Gn]=h;e:for(w=a.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=x;e:switch(kn(x,y,h),y){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Wi(a)}}return _t(a),Xg(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&Wi(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=ge.current,Ll(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,y=Sn,y!==null)switch(y.tag){case 27:case 5:h=y.memoizedProps}o[xn]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||vk(o.nodeValue,u)),o||ks(a,!0)}else o=Cd(o).createTextNode(h),o[xn]=a,a.stateNode=o}return _t(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=Ll(a),u!==null){if(o===null){if(!h)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[xn]=a}else Mo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),o=!1}else u=ag(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(dr(a),a):(dr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return _t(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=Ll(a),h!==null&&h.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[xn]=a}else Mo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),y=!1}else y=ag(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(dr(a),a):(dr(a),null)}return dr(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,o=o!==null&&o.memoizedState!==null,u&&(h=a.child,y=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(y=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==y&&(h.flags|=2048)),u!==o&&u&&(a.child.flags|=8192),cd(a,a.updateQueue),_t(a),null);case 4:return Ue(),o===null&&Sy(a.stateNode.containerInfo),_t(a),null;case 10:return Fi(a.type),_t(a),null;case 19:if(B(qt),h=a.memoizedState,h===null)return _t(a),null;if(y=(a.flags&128)!==0,x=h.rendering,x===null)if(y)_c(h,!1);else{if(It!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(x=Zf(o),x!==null){for(a.flags|=128,_c(h,!1),o=x.updateQueue,a.updateQueue=o,cd(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)ew(u,o),u=u.sibling;return E(qt,qt.current&1|2),nt&&Pi(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&Ft()>pd&&(a.flags|=128,y=!0,_c(h,!1),a.lanes=4194304)}else{if(!y)if(o=Zf(x),o!==null){if(a.flags|=128,y=!0,o=o.updateQueue,a.updateQueue=o,cd(a,o),_c(h,!0),h.tail===null&&h.tailMode==="hidden"&&!x.alternate&&!nt)return _t(a),null}else 2*Ft()-h.renderingStartTime>pd&&u!==536870912&&(a.flags|=128,y=!0,_c(h,!1),a.lanes=4194304);h.isBackwards?(x.sibling=a.child,a.child=x):(o=h.last,o!==null?o.sibling=x:a.child=x,h.last=x)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=Ft(),o.sibling=null,u=qt.current,E(qt,y?u&1|2:u&1),nt&&Pi(a,h.treeForkCount),o):(_t(a),null);case 22:case 23:return dr(a),wg(),h=a.memoizedState!==null,o!==null?o.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(_t(a),a.subtreeFlags&6&&(a.flags|=8192)):_t(a),u=a.updateQueue,u!==null&&cd(a,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),o!==null&&B(Do),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Fi(Gt),_t(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function cN(o,a){switch(og(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Fi(Gt),Ue(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return Ee(a),null;case 31:if(a.memoizedState!==null){if(dr(a),a.alternate===null)throw Error(r(340));Mo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(dr(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Mo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return B(qt),null;case 4:return Ue(),null;case 10:return Fi(a.type),null;case 22:case 23:return dr(a),wg(),o!==null&&B(Do),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Fi(Gt),null;case 25:return null;default:return null}}function Av(o,a){switch(og(a),a.tag){case 3:Fi(Gt),Ue();break;case 26:case 27:case 5:Ee(a);break;case 4:Ue();break;case 31:a.memoizedState!==null&&dr(a);break;case 13:dr(a);break;case 19:B(qt);break;case 10:Fi(a.type);break;case 22:case 23:dr(a),wg(),o!==null&&B(Do);break;case 24:Fi(Gt)}}function Dc(o,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var y=h.next;u=y;do{if((u.tag&o)===o){h=void 0;var x=u.create,w=u.inst;h=x(),w.destroy=h}u=u.next}while(u!==y)}}catch(A){ht(a,a.return,A)}}function _s(o,a,u){try{var h=a.updateQueue,y=h!==null?h.lastEffect:null;if(y!==null){var x=y.next;h=x;do{if((h.tag&o)===o){var w=h.inst,A=w.destroy;if(A!==void 0){w.destroy=void 0,y=a;var R=u,P=A;try{P()}catch(W){ht(y,R,W)}}}h=h.next}while(h!==x)}}catch(W){ht(a,a.return,W)}}function Mv(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{bw(a,u)}catch(h){ht(o,o.return,h)}}}function Ov(o,a,u){u.props=jo(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){ht(o,a,h)}}function Rc(o,a){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var h=o.stateNode;break;case 30:h=o.stateNode;break;default:h=o.stateNode}typeof u=="function"?o.refCleanup=u(h):u.current=h}}catch(y){ht(o,a,y)}}function di(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(y){ht(o,a,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){ht(o,a,y)}else u.current=null}function _v(o){var a=o.type,u=o.memoizedProps,h=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(y){ht(o,o.return,y)}}function Qg(o,a,u){try{var h=o.stateNode;DN(h,o.type,u,a),h[Gn]=a}catch(y){ht(o,o.return,y)}}function Dv(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Is(o.type)||o.tag===4}function ey(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Dv(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.tag===27&&Is(o.type)||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 ty(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(o),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Ui));else if(h!==4&&(h===27&&Is(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(ty(o,a,u),o=o.sibling;o!==null;)ty(o,a,u),o=o.sibling}function ud(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?u.insertBefore(o,a):u.appendChild(o);else if(h!==4&&(h===27&&Is(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(ud(o,a,u),o=o.sibling;o!==null;)ud(o,a,u),o=o.sibling}function Rv(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);kn(a,h,u),a[xn]=o,a[Gn]=u}catch(x){ht(o,o.return,x)}}var Gi=!1,Xt=!1,ny=!1,Nv=typeof WeakSet=="function"?WeakSet:Set,ln=null;function uN(o,a){if(o=o.containerInfo,ky=Dd,o=qS(o),Gm(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var y=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var w=0,A=-1,R=-1,P=0,W=0,ee=o,F=null;t:for(;;){for(var q;ee!==u||y!==0&&ee.nodeType!==3||(A=w+y),ee!==x||h!==0&&ee.nodeType!==3||(R=w+h),ee.nodeType===3&&(w+=ee.nodeValue.length),(q=ee.firstChild)!==null;)F=ee,ee=q;for(;;){if(ee===o)break t;if(F===u&&++P===y&&(A=w),F===x&&++W===h&&(R=w),(q=ee.nextSibling)!==null)break;ee=F,F=ee.parentNode}ee=q}u=A===-1||R===-1?null:{start:A,end:R}}else u=null}u=u||{start:0,end:0}}else u=null;for(Cy={focusedElem:o,selectionRange:u},Dd=!1,ln=a;ln!==null;)if(a=ln,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,ln=o;else for(;ln!==null;){switch(a=ln,x=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)y=o[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&x!==null){o=void 0,u=a,y=x.memoizedProps,x=x.memoizedState,h=u.stateNode;try{var Se=jo(u.type,y);o=h.getSnapshotBeforeUpdate(Se,x),h.__reactInternalSnapshotBeforeUpdate=o}catch(Ne){ht(u,u.return,Ne)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)Ay(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Ay(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=a.sibling,o!==null){o.return=a.return,ln=o;break}ln=a.return}}function zv(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:Ji(o,u),h&4&&Dc(5,u);break;case 1:if(Ji(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(w){ht(u,u.return,w)}else{var y=jo(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(y,a,o.__reactInternalSnapshotBeforeUpdate)}catch(w){ht(u,u.return,w)}}h&64&&Mv(u),h&512&&Rc(u,u.return);break;case 3:if(Ji(o,u),h&64&&(o=u.updateQueue,o!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{bw(o,a)}catch(w){ht(u,u.return,w)}}break;case 27:a===null&&h&4&&Rv(u);case 26:case 5:Ji(o,u),a===null&&h&4&&_v(u),h&512&&Rc(u,u.return);break;case 12:Ji(o,u);break;case 31:Ji(o,u),h&4&&Iv(o,u);break;case 13:Ji(o,u),h&4&&Bv(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=xN.bind(null,u),UN(o,u))));break;case 22:if(h=u.memoizedState!==null||Gi,!h){a=a!==null&&a.memoizedState!==null||Xt,y=Gi;var x=Xt;Gi=h,(Xt=a)&&!x?Xi(o,u,(u.subtreeFlags&8772)!==0):Ji(o,u),Gi=y,Xt=x}break;case 30:break;default:Ji(o,u)}}function Lv(o){var a=o.alternate;a!==null&&(o.alternate=null,Lv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Rm(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var zt=null,Jn=!1;function Zi(o,a,u){for(u=u.child;u!==null;)jv(o,a,u),u=u.sibling}function jv(o,a,u){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(Ze,u)}catch{}switch(u.tag){case 26:Xt||di(u,a),Zi(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Xt||di(u,a);var h=zt,y=Jn;Is(u.type)&&(zt=u.stateNode,Jn=!1),Zi(o,a,u),Vc(u.stateNode),zt=h,Jn=y;break;case 5:Xt||di(u,a);case 6:if(h=zt,y=Jn,zt=null,Zi(o,a,u),zt=h,Jn=y,zt!==null)if(Jn)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(u.stateNode)}catch(x){ht(u,a,x)}else try{zt.removeChild(u.stateNode)}catch(x){ht(u,a,x)}break;case 18:zt!==null&&(Jn?(o=zt,Mk(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),na(o)):Mk(zt,u.stateNode));break;case 4:h=zt,y=Jn,zt=u.stateNode.containerInfo,Jn=!0,Zi(o,a,u),zt=h,Jn=y;break;case 0:case 11:case 14:case 15:_s(2,u,a),Xt||_s(4,u,a),Zi(o,a,u);break;case 1:Xt||(di(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&Ov(u,a,h)),Zi(o,a,u);break;case 21:Zi(o,a,u);break;case 22:Xt=(h=Xt)||u.memoizedState!==null,Zi(o,a,u),Xt=h;break;default:Zi(o,a,u)}}function Iv(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{na(o)}catch(u){ht(a,a.return,u)}}}function Bv(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{na(o)}catch(u){ht(a,a.return,u)}}function fN(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Nv),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Nv),a;default:throw Error(r(435,o.tag))}}function fd(o,a){var u=fN(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var y=SN.bind(null,o,h);h.then(y,y)}})}function Xn(o,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var y=u[h],x=o,w=a,A=w;e:for(;A!==null;){switch(A.tag){case 27:if(Is(A.type)){zt=A.stateNode,Jn=!1;break e}break;case 5:zt=A.stateNode,Jn=!1;break e;case 3:case 4:zt=A.stateNode.containerInfo,Jn=!0;break e}A=A.return}if(zt===null)throw Error(r(160));jv(x,w,y),zt=null,Jn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Uv(a,o),a=a.sibling}var Qr=null;function Uv(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Xn(a,o),Qn(o),h&4&&(_s(3,o,o.return),Dc(3,o),_s(5,o,o.return));break;case 1:Xn(a,o),Qn(o),h&512&&(Xt||u===null||di(u,u.return)),h&64&&Gi&&(o=o.updateQueue,o!==null&&(h=o.callbacks,h!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var y=Qr;if(Xn(a,o),Qn(o),h&512&&(Xt||u===null||di(u,u.return)),h&4){var x=u!==null?u.memoizedState:null;if(h=o.memoizedState,u===null)if(h===null)if(o.stateNode===null){e:{h=o.type,u=o.memoizedProps,y=y.ownerDocument||y;t:switch(h){case"title":x=y.getElementsByTagName("title")[0],(!x||x[sc]||x[xn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(h),y.head.insertBefore(x,y.querySelector("head > title"))),kn(x,h,u),x[xn]=o,on(x),h=x;break e;case"link":var w=Uk("link","href",y).get(h+(u.href||""));if(w){for(var A=0;A<w.length;A++)if(x=w[A],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){w.splice(A,1);break t}}x=y.createElement(h),kn(x,h,u),y.head.appendChild(x);break;case"meta":if(w=Uk("meta","content",y).get(h+(u.content||""))){for(A=0;A<w.length;A++)if(x=w[A],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){w.splice(A,1);break t}}x=y.createElement(h),kn(x,h,u),y.head.appendChild(x);break;default:throw Error(r(468,h))}x[xn]=o,on(x),h=x}o.stateNode=h}else Hk(y,o.type,o.stateNode);else o.stateNode=Bk(y,h,o.memoizedProps);else x!==h?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,h===null?Hk(y,o.type,o.stateNode):Bk(y,h,o.memoizedProps)):h===null&&o.stateNode!==null&&Qg(o,o.memoizedProps,u.memoizedProps)}break;case 27:Xn(a,o),Qn(o),h&512&&(Xt||u===null||di(u,u.return)),u!==null&&h&4&&Qg(o,o.memoizedProps,u.memoizedProps);break;case 5:if(Xn(a,o),Qn(o),h&512&&(Xt||u===null||di(u,u.return)),o.flags&32){y=o.stateNode;try{El(y,"")}catch(Se){ht(o,o.return,Se)}}h&4&&o.stateNode!=null&&(y=o.memoizedProps,Qg(o,y,u!==null?u.memoizedProps:y)),h&1024&&(ny=!0);break;case 6:if(Xn(a,o),Qn(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(Se){ht(o,o.return,Se)}}break;case 3:if(Ad=null,y=Qr,Qr=Ed(a.containerInfo),Xn(a,o),Qr=y,Qn(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{na(a.containerInfo)}catch(Se){ht(o,o.return,Se)}ny&&(ny=!1,Hv(o));break;case 4:h=Qr,Qr=Ed(o.stateNode.containerInfo),Xn(a,o),Qn(o),Qr=h;break;case 12:Xn(a,o),Qn(o);break;case 31:Xn(a,o),Qn(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,fd(o,h)));break;case 13:Xn(a,o),Qn(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(hd=Ft()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,fd(o,h)));break;case 22:y=o.memoizedState!==null;var R=u!==null&&u.memoizedState!==null,P=Gi,W=Xt;if(Gi=P||y,Xt=W||R,Xn(a,o),Xt=W,Gi=P,Qn(o),h&8192)e:for(a=o.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(u===null||R||Gi||Xt||Io(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){R=u=a;try{if(x=R.stateNode,y)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{A=R.stateNode;var ee=R.memoizedProps.style,F=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;A.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(Se){ht(R,R.return,Se)}}}else if(a.tag===6){if(u===null){R=a;try{R.stateNode.nodeValue=y?"":R.memoizedProps}catch(Se){ht(R,R.return,Se)}}}else if(a.tag===18){if(u===null){R=a;try{var q=R.stateNode;y?Ok(q,!0):Ok(R.stateNode,!1)}catch(Se){ht(R,R.return,Se)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=o.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,fd(o,u))));break;case 19:Xn(a,o),Qn(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,fd(o,h)));break;case 30:break;case 21:break;default:Xn(a,o),Qn(o)}}function Qn(o){var a=o.flags;if(a&2){try{for(var u,h=o.return;h!==null;){if(Dv(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var y=u.stateNode,x=ey(o);ud(o,x,y);break;case 5:var w=u.stateNode;u.flags&32&&(El(w,""),u.flags&=-33);var A=ey(o);ud(o,A,w);break;case 3:case 4:var R=u.stateNode.containerInfo,P=ey(o);ty(o,P,R);break;default:throw Error(r(161))}}catch(W){ht(o,o.return,W)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function Hv(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;Hv(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function Ji(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)zv(o,a.alternate,a),a=a.sibling}function Io(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:_s(4,a,a.return),Io(a);break;case 1:di(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Ov(a,a.return,u),Io(a);break;case 27:Vc(a.stateNode);case 26:case 5:di(a,a.return),Io(a);break;case 22:a.memoizedState===null&&Io(a);break;case 30:Io(a);break;default:Io(a)}o=o.sibling}}function Xi(o,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,y=o,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:Xi(y,x,u),Dc(4,x);break;case 1:if(Xi(y,x,u),h=x,y=h.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(P){ht(h,h.return,P)}if(h=x,y=h.updateQueue,y!==null){var A=h.stateNode;try{var R=y.shared.hiddenCallbacks;if(R!==null)for(y.shared.hiddenCallbacks=null,y=0;y<R.length;y++)yw(R[y],A)}catch(P){ht(h,h.return,P)}}u&&w&64&&Mv(x),Rc(x,x.return);break;case 27:Rv(x);case 26:case 5:Xi(y,x,u),u&&h===null&&w&4&&_v(x),Rc(x,x.return);break;case 12:Xi(y,x,u);break;case 31:Xi(y,x,u),u&&w&4&&Iv(y,x);break;case 13:Xi(y,x,u),u&&w&4&&Bv(y,x);break;case 22:x.memoizedState===null&&Xi(y,x,u),Rc(x,x.return);break;case 30:break;default:Xi(y,x,u)}a=a.sibling}}function ry(o,a){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&bc(u))}function iy(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&bc(o))}function ei(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Vv(o,a,u,h),a=a.sibling}function Vv(o,a,u,h){var y=a.flags;switch(a.tag){case 0:case 11:case 15:ei(o,a,u,h),y&2048&&Dc(9,a);break;case 1:ei(o,a,u,h);break;case 3:ei(o,a,u,h),y&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&bc(o)));break;case 12:if(y&2048){ei(o,a,u,h),o=a.stateNode;try{var x=a.memoizedProps,w=x.id,A=x.onPostCommit;typeof A=="function"&&A(w,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(R){ht(a,a.return,R)}}else ei(o,a,u,h);break;case 31:ei(o,a,u,h);break;case 13:ei(o,a,u,h);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?ei(o,a,u,h):Nc(o,a):x._visibility&2?ei(o,a,u,h):(x._visibility|=2,ql(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),y&2048&&ry(w,a);break;case 24:ei(o,a,u,h),y&2048&&iy(a.alternate,a);break;default:ei(o,a,u,h)}}function ql(o,a,u,h,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=o,w=a,A=u,R=h,P=w.flags;switch(w.tag){case 0:case 11:case 15:ql(x,w,A,R,y),Dc(8,w);break;case 23:break;case 22:var W=w.stateNode;w.memoizedState!==null?W._visibility&2?ql(x,w,A,R,y):Nc(x,w):(W._visibility|=2,ql(x,w,A,R,y)),y&&P&2048&&ry(w.alternate,w);break;case 24:ql(x,w,A,R,y),y&&P&2048&&iy(w.alternate,w);break;default:ql(x,w,A,R,y)}a=a.sibling}}function Nc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=o,h=a,y=h.flags;switch(h.tag){case 22:Nc(u,h),y&2048&&ry(h.alternate,h);break;case 24:Nc(u,h),y&2048&&iy(h.alternate,h);break;default:Nc(u,h)}a=a.sibling}}var zc=8192;function Yl(o,a,u){if(o.subtreeFlags&zc)for(o=o.child;o!==null;)Pv(o,a,u),o=o.sibling}function Pv(o,a,u){switch(o.tag){case 26:Yl(o,a,u),o.flags&zc&&o.memoizedState!==null&&JN(u,Qr,o.memoizedState,o.memoizedProps);break;case 5:Yl(o,a,u);break;case 3:case 4:var h=Qr;Qr=Ed(o.stateNode.containerInfo),Yl(o,a,u),Qr=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=zc,zc=16777216,Yl(o,a,u),zc=h):Yl(o,a,u));break;default:Yl(o,a,u)}}function $v(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}function Lc(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];ln=h,qv(h,o)}$v(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Fv(o),o=o.sibling}function Fv(o){switch(o.tag){case 0:case 11:case 15:Lc(o),o.flags&2048&&_s(9,o,o.return);break;case 3:Lc(o);break;case 12:Lc(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,dd(o)):Lc(o);break;default:Lc(o)}}function dd(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];ln=h,qv(h,o)}$v(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:_s(8,a,a.return),dd(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,dd(a));break;default:dd(a)}o=o.sibling}}function qv(o,a){for(;ln!==null;){var u=ln;switch(u.tag){case 0:case 11:case 15:_s(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:bc(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,ln=h;else e:for(u=o;ln!==null;){h=ln;var y=h.sibling,x=h.return;if(Lv(h),h===u){ln=null;break e}if(y!==null){y.return=x,ln=y;break e}ln=x}}}var dN={getCacheForType:function(o){var a=wn(Gt),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return wn(Gt).controller.signal}},hN=typeof WeakMap=="function"?WeakMap:Map,ut=0,St=null,Je=null,Qe=0,dt=0,hr=null,Ds=!1,Kl=!1,sy=!1,Qi=0,It=0,Rs=0,Bo=0,oy=0,pr=0,Wl=0,jc=null,er=null,ly=!1,hd=0,Yv=0,pd=1/0,md=null,Ns=null,rn=0,zs=null,Gl=null,es=0,ay=0,cy=null,Kv=null,Ic=0,uy=null;function mr(){return(ut&2)!==0&&Qe!==0?Qe&-Qe:I.T!==null?gy():cS()}function Wv(){if(pr===0)if((Qe&536870912)===0||nt){var o=wo;wo<<=1,(wo&3932160)===0&&(wo=262144),pr=o}else pr=536870912;return o=fr.current,o!==null&&(o.flags|=32),pr}function tr(o,a,u){(o===St&&(dt===2||dt===9)||o.cancelPendingCommit!==null)&&(Zl(o,0),Ls(o,Qe,pr,!1)),ic(o,u),((ut&2)===0||o!==St)&&(o===St&&((ut&2)===0&&(Bo|=u),It===4&&Ls(o,Qe,pr,!1)),hi(o))}function Gv(o,a,u){if((ut&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||ji(o,a),y=h?gN(o,a):dy(o,a,!0),x=h;do{if(y===0){Kl&&!h&&Ls(o,a,0,!1);break}else{if(u=o.current.alternate,x&&!pN(u)){y=dy(o,a,!1),x=!1;continue}if(y===2){if(x=a,o.errorRecoveryDisabledLanes&x)var w=0;else w=o.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var A=o;y=jc;var R=A.current.memoizedState.isDehydrated;if(R&&(Zl(A,w).flags|=256),w=dy(A,w,!1),w!==2){if(sy&&!R){A.errorRecoveryDisabledLanes|=x,Bo|=x,y=4;break e}x=er,er=y,x!==null&&(er===null?er=x:er.push.apply(er,x))}y=w}if(x=!1,y!==2)continue}}if(y===1){Zl(o,0),Ls(o,a,0,!0);break}e:{switch(h=o,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ls(h,a,pr,!Ds);break e;case 2:er=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=hd+300-Ft(),10<y)){if(Ls(h,a,pr,!Ds),bs(h,0,!0)!==0)break e;es=a,h.timeoutHandle=Tk(Zv.bind(null,h,u,er,md,ly,a,pr,Bo,Wl,Ds,x,"Throttled",-0,0),y);break e}Zv(h,u,er,md,ly,a,pr,Bo,Wl,Ds,x,null,-0,0)}}break}while(!0);hi(o)}function Zv(o,a,u,h,y,x,w,A,R,P,W,ee,F,q){if(o.timeoutHandle=-1,ee=a.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ui},Pv(a,x,ee);var Se=(x&62914560)===x?hd-Ft():(x&4194048)===x?Yv-Ft():0;if(Se=XN(ee,Se),Se!==null){es=x,o.cancelPendingCommit=Se(ik.bind(null,o,a,x,u,h,y,w,A,R,W,ee,null,F,q)),Ls(o,x,w,!P);return}}ik(o,a,x,u,h,y,w,A,R)}function pN(o){for(var a=o;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var y=u[h],x=y.getSnapshot;y=y.value;try{if(!cr(x(),y))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;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 Ls(o,a,u,h){a&=~oy,a&=~Bo,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var y=a;0<y;){var x=31-oe(y),w=1<<x;h[x]=-1,y&=~w}u!==0&&oS(o,u,a)}function gd(){return(ut&6)===0?(Bc(0),!1):!0}function fy(){if(Je!==null){if(dt===0)var o=Je.return;else o=Je,$i=Oo=null,Ag(o),Hl=null,Sc=0,o=Je;for(;o!==null;)Av(o.alternate,o),o=o.return;Je=null}}function Zl(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,zN(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),es=0,fy(),St=o,Je=u=Vi(o.current,null),Qe=a,dt=0,hr=null,Ds=!1,Kl=ji(o,a),sy=!1,Wl=pr=oy=Bo=Rs=It=0,er=jc=null,ly=!1,(a&8)!==0&&(a|=a&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=a;0<h;){var y=31-oe(h),x=1<<y;a|=o[y],h&=~x}return Qi=a,If(),u}function Jv(o,a){Ve=null,I.H=Mc,a===Ul||a===qf?(a=hw(),dt=3):a===mg?(a=hw(),dt=4):dt=a===$g?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,hr=a,Je===null&&(It=1,sd(o,Or(a,o.current)))}function Xv(){var o=fr.current;return o===null?!0:(Qe&4194048)===Qe?Nr===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?o===Nr:!1}function Qv(){var o=I.H;return I.H=Mc,o===null?Mc:o}function ek(){var o=I.A;return I.A=dN,o}function yd(){It=4,Ds||(Qe&4194048)!==Qe&&fr.current!==null||(Kl=!0),(Rs&134217727)===0&&(Bo&134217727)===0||St===null||Ls(St,Qe,pr,!1)}function dy(o,a,u){var h=ut;ut|=2;var y=Qv(),x=ek();(St!==o||Qe!==a)&&(md=null,Zl(o,a)),a=!1;var w=It;e:do try{if(dt!==0&&Je!==null){var A=Je,R=hr;switch(dt){case 8:fy(),w=6;break e;case 3:case 2:case 9:case 6:fr.current===null&&(a=!0);var P=dt;if(dt=0,hr=null,Jl(o,A,R,P),u&&Kl){w=0;break e}break;default:P=dt,dt=0,hr=null,Jl(o,A,R,P)}}mN(),w=It;break}catch(W){Jv(o,W)}while(!0);return a&&o.shellSuspendCounter++,$i=Oo=null,ut=h,I.H=y,I.A=x,Je===null&&(St=null,Qe=0,If()),w}function mN(){for(;Je!==null;)tk(Je)}function gN(o,a){var u=ut;ut|=2;var h=Qv(),y=ek();St!==o||Qe!==a?(md=null,pd=Ft()+500,Zl(o,a)):Kl=ji(o,a);e:do try{if(dt!==0&&Je!==null){a=Je;var x=hr;t:switch(dt){case 1:dt=0,hr=null,Jl(o,a,x,1);break;case 2:case 9:if(fw(x)){dt=0,hr=null,nk(a);break}a=function(){dt!==2&&dt!==9||St!==o||(dt=7),hi(o)},x.then(a,a);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:fw(x)?(dt=0,hr=null,nk(a)):(dt=0,hr=null,Jl(o,a,x,7));break;case 5:var w=null;switch(Je.tag){case 26:w=Je.memoizedState;case 5:case 27:var A=Je;if(w?Vk(w):A.stateNode.complete){dt=0,hr=null;var R=A.sibling;if(R!==null)Je=R;else{var P=A.return;P!==null?(Je=P,bd(P)):Je=null}break t}}dt=0,hr=null,Jl(o,a,x,5);break;case 6:dt=0,hr=null,Jl(o,a,x,6);break;case 8:fy(),It=6;break e;default:throw Error(r(462))}}yN();break}catch(W){Jv(o,W)}while(!0);return $i=Oo=null,I.H=h,I.A=y,ut=u,Je!==null?0:(St=null,Qe=0,If(),It)}function yN(){for(;Je!==null&&!Ni();)tk(Je)}function tk(o){var a=Ev(o.alternate,o,Qi);o.memoizedProps=o.pendingProps,a===null?bd(o):Je=a}function nk(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=xv(u,a,a.pendingProps,a.type,void 0,Qe);break;case 11:a=xv(u,a,a.pendingProps,a.type.render,a.ref,Qe);break;case 5:Ag(a);default:Av(u,a),a=Je=ew(a,Qi),a=Ev(u,a,Qi)}o.memoizedProps=o.pendingProps,a===null?bd(o):Je=a}function Jl(o,a,u,h){$i=Oo=null,Ag(a),Hl=null,Sc=0;var y=a.return;try{if(sN(o,y,a,u,Qe)){It=1,sd(o,Or(u,o.current)),Je=null;return}}catch(x){if(y!==null)throw Je=y,x;It=1,sd(o,Or(u,o.current)),Je=null;return}a.flags&32768?(nt||h===1?o=!0:Kl||(Qe&536870912)!==0?o=!1:(Ds=o=!0,(h===2||h===9||h===3||h===6)&&(h=fr.current,h!==null&&h.tag===13&&(h.flags|=16384))),rk(a,o)):bd(a)}function bd(o){var a=o;do{if((a.flags&32768)!==0){rk(a,Ds);return}o=a.return;var u=aN(a.alternate,a,Qi);if(u!==null){Je=u;return}if(a=a.sibling,a!==null){Je=a;return}Je=a=o}while(a!==null);It===0&&(It=5)}function rk(o,a){do{var u=cN(o.alternate,o);if(u!==null){u.flags&=32767,Je=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){Je=o;return}Je=o=u}while(o!==null);It=6,Je=null}function ik(o,a,u,h,y,x,w,A,R){o.cancelPendingCommit=null;do xd();while(rn!==0);if((ut&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=eg,ZD(o,u,x,w,A,R),o===St&&(Je=St=null,Qe=0),Gl=a,zs=o,es=u,ay=x,cy=y,Kv=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,wN(se,function(){return ck(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=I.T,I.T=null,y=Z.p,Z.p=2,w=ut,ut|=4;try{uN(o,a,u)}finally{ut=w,Z.p=y,I.T=h}}rn=1,sk(),ok(),lk()}}function sk(){if(rn===1){rn=0;var o=zs,a=Gl,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=I.T,I.T=null;var h=Z.p;Z.p=2;var y=ut;ut|=4;try{Uv(a,o);var x=Cy,w=qS(o.containerInfo),A=x.focusedElem,R=x.selectionRange;if(w!==A&&A&&A.ownerDocument&&FS(A.ownerDocument.documentElement,A)){if(R!==null&&Gm(A)){var P=R.start,W=R.end;if(W===void 0&&(W=P),"selectionStart"in A)A.selectionStart=P,A.selectionEnd=Math.min(W,A.value.length);else{var ee=A.ownerDocument||document,F=ee&&ee.defaultView||window;if(F.getSelection){var q=F.getSelection(),Se=A.textContent.length,Ne=Math.min(R.start,Se),bt=R.end===void 0?Ne:Math.min(R.end,Se);!q.extend&&Ne>bt&&(w=bt,bt=Ne,Ne=w);var U=$S(A,Ne),z=$S(A,bt);if(U&&z&&(q.rangeCount!==1||q.anchorNode!==U.node||q.anchorOffset!==U.offset||q.focusNode!==z.node||q.focusOffset!==z.offset)){var V=ee.createRange();V.setStart(U.node,U.offset),q.removeAllRanges(),Ne>bt?(q.addRange(V),q.extend(z.node,z.offset)):(V.setEnd(z.node,z.offset),q.addRange(V))}}}}for(ee=[],q=A;q=q.parentNode;)q.nodeType===1&&ee.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ee.length;A++){var J=ee[A];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}Dd=!!ky,Cy=ky=null}finally{ut=y,Z.p=h,I.T=u}}o.current=a,rn=2}}function ok(){if(rn===2){rn=0;var o=zs,a=Gl,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=I.T,I.T=null;var h=Z.p;Z.p=2;var y=ut;ut|=4;try{zv(o,a.alternate,a)}finally{ut=y,Z.p=h,I.T=u}}rn=3}}function lk(){if(rn===4||rn===3){rn=0,zi();var o=zs,a=Gl,u=es,h=Kv;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?rn=5:(rn=0,Gl=zs=null,ak(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(Ns=null),_m(u),a=a.stateNode,at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(Ze,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=I.T,y=Z.p,Z.p=2,I.T=null;try{for(var x=o.onRecoverableError,w=0;w<h.length;w++){var A=h[w];x(A.value,{componentStack:A.stack})}}finally{I.T=a,Z.p=y}}(es&3)!==0&&xd(),hi(o),y=o.pendingLanes,(u&261930)!==0&&(y&42)!==0?o===uy?Ic++:(Ic=0,uy=o):Ic=0,Bc(0)}}function ak(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,bc(a)))}function xd(){return sk(),ok(),lk(),ck()}function ck(){if(rn!==5)return!1;var o=zs,a=ay;ay=0;var u=_m(es),h=I.T,y=Z.p;try{Z.p=32>u?32:u,I.T=null,u=cy,cy=null;var x=zs,w=es;if(rn=0,Gl=zs=null,es=0,(ut&6)!==0)throw Error(r(331));var A=ut;if(ut|=4,Fv(x.current),Vv(x,x.current,w,u),ut=A,Bc(0,!1),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(Ze,x)}catch{}return!0}finally{Z.p=y,I.T=h,ak(o,a)}}function uk(o,a,u){a=Or(u,a),a=Pg(o.stateNode,a,2),o=As(o,a,2),o!==null&&(ic(o,2),hi(o))}function ht(o,a,u){if(o.tag===3)uk(o,o,u);else for(;a!==null;){if(a.tag===3){uk(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ns===null||!Ns.has(h))){o=Or(u,o),u=fv(2),h=As(a,u,2),h!==null&&(dv(u,h,a,o),ic(h,2),hi(h));break}}a=a.return}}function hy(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new hN;var y=new Set;h.set(a,y)}else y=h.get(a),y===void 0&&(y=new Set,h.set(a,y));y.has(u)||(sy=!0,y.add(u),o=bN.bind(null,o,a,u),a.then(o,o))}function bN(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,St===o&&(Qe&u)===u&&(It===4||It===3&&(Qe&62914560)===Qe&&300>Ft()-hd?(ut&2)===0&&Zl(o,0):oy|=u,Wl===Qe&&(Wl=0)),hi(o)}function fk(o,a){a===0&&(a=Ef()),o=To(o,a),o!==null&&(ic(o,a),hi(o))}function xN(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),fk(o,u)}function SN(o,a){var u=0;switch(o.tag){case 31:case 13:var h=o.stateNode,y=o.memoizedState;y!==null&&(u=y.retryLane);break;case 19:h=o.stateNode;break;case 22:h=o.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),fk(o,u)}function wN(o,a){return Cr(o,a)}var Sd=null,Xl=null,py=!1,wd=!1,my=!1,js=0;function hi(o){o!==Xl&&o.next===null&&(Xl===null?Sd=Xl=o:Xl=Xl.next=o),wd=!0,py||(py=!0,kN())}function Bc(o,a){if(!my&&wd){my=!0;do for(var u=!1,h=Sd;h!==null;){if(o!==0){var y=h.pendingLanes;if(y===0)var x=0;else{var w=h.suspendedLanes,A=h.pingedLanes;x=(1<<31-oe(42|o)+1)-1,x&=y&~(w&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,mk(h,x))}else x=Qe,x=bs(h,h===St?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||ji(h,x)||(u=!0,mk(h,x));h=h.next}while(u);my=!1}}function vN(){dk()}function dk(){wd=py=!1;var o=0;js!==0&&NN()&&(o=js);for(var a=Ft(),u=null,h=Sd;h!==null;){var y=h.next,x=hk(h,a);x===0?(h.next=null,u===null?Sd=y:u.next=y,y===null&&(Xl=u)):(u=h,(o!==0||(x&3)!==0)&&(wd=!0)),h=y}rn!==0&&rn!==5||Bc(o),js!==0&&(js=0)}function hk(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,y=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var w=31-oe(x),A=1<<w,R=y[w];R===-1?((A&u)===0||(A&h)!==0)&&(y[w]=Cf(A,a)):R<=a&&(o.expiredLanes|=A),x&=~A}if(a=St,u=Qe,u=bs(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(dt===2||dt===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Wn(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||ji(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Wn(h),_m(u)){case 2:case 8:u=L;break;case 32:u=se;break;case 268435456:u=Te;break;default:u=se}return h=pk.bind(null,o),u=Cr(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Wn(h),o.callbackPriority=2,o.callbackNode=null,2}function pk(o,a){if(rn!==0&&rn!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(xd()&&o.callbackNode!==u)return null;var h=Qe;return h=bs(o,o===St?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(Gv(o,h,a),hk(o,Ft()),o.callbackNode!=null&&o.callbackNode===u?pk.bind(null,o):null)}function mk(o,a){if(xd())return null;Gv(o,a,!0)}function kN(){LN(function(){(ut&6)!==0?Cr(Y,vN):dk()})}function gy(){if(js===0){var o=Il;o===0&&(o=Er,Er<<=1,(Er&261888)===0&&(Er=256)),js=o}return js}function gk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Of(""+o)}function yk(o,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,o.id&&u.setAttribute("form",o.id),a.parentNode.insertBefore(u,a),o=new FormData(o),u.parentNode.removeChild(u),o}function CN(o,a,u,h,y){if(a==="submit"&&u&&u.stateNode===y){var x=gk((y[Gn]||null).action),w=h.submitter;w&&(a=(a=w[Gn]||null)?gk(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var A=new Nf("action","action",null,h,y);o.push({event:A,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(js!==0){var R=w?yk(y,w):new FormData(y);jg(u,{pending:!0,data:R,method:y.method,action:x},null,R)}}else typeof x=="function"&&(A.preventDefault(),R=w?yk(y,w):new FormData(y),jg(u,{pending:!0,data:R,method:y.method,action:x},x,R))},currentTarget:y}]})}}for(var yy=0;yy<Qm.length;yy++){var by=Qm[yy],EN=by.toLowerCase(),TN=by[0].toUpperCase()+by.slice(1);Xr(EN,"on"+TN)}Xr(WS,"onAnimationEnd"),Xr(GS,"onAnimationIteration"),Xr(ZS,"onAnimationStart"),Xr("dblclick","onDoubleClick"),Xr("focusin","onFocus"),Xr("focusout","onBlur"),Xr(PR,"onTransitionRun"),Xr($R,"onTransitionStart"),Xr(FR,"onTransitionCancel"),Xr(JS,"onTransitionEnd"),kl("onMouseEnter",["mouseout","mouseover"]),kl("onMouseLeave",["mouseout","mouseover"]),kl("onPointerEnter",["pointerout","pointerover"]),kl("onPointerLeave",["pointerout","pointerover"]),vo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vo("onBeforeInput",["compositionend","keypress","textInput","paste"]),vo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uc="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(" "),AN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uc));function bk(o,a){a=(a&4)!==0;for(var u=0;u<o.length;u++){var h=o[u],y=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var w=h.length-1;0<=w;w--){var A=h[w],R=A.instance,P=A.currentTarget;if(A=A.listener,R!==x&&y.isPropagationStopped())break e;x=A,y.currentTarget=P;try{x(y)}catch(W){jf(W)}y.currentTarget=null,x=R}else for(w=0;w<h.length;w++){if(A=h[w],R=A.instance,P=A.currentTarget,A=A.listener,R!==x&&y.isPropagationStopped())break e;x=A,y.currentTarget=P;try{x(y)}catch(W){jf(W)}y.currentTarget=null,x=R}}}}function Xe(o,a){var u=a[Dm];u===void 0&&(u=a[Dm]=new Set);var h=o+"__bubble";u.has(h)||(xk(a,o,2,!1),u.add(h))}function xy(o,a,u){var h=0;a&&(h|=4),xk(u,o,h,a)}var vd="_reactListening"+Math.random().toString(36).slice(2);function Sy(o){if(!o[vd]){o[vd]=!0,dS.forEach(function(u){u!=="selectionchange"&&(AN.has(u)||xy(u,!1,o),xy(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[vd]||(a[vd]=!0,xy("selectionchange",!1,a))}}function xk(o,a,u,h){switch(Wk(a)){case 2:var y=tz;break;case 8:y=nz;break;default:y=Ly}u=y.bind(null,a,u,o),y=void 0,!Hm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),h?y!==void 0?o.addEventListener(a,u,{capture:!0,passive:y}):o.addEventListener(a,u,!0):y!==void 0?o.addEventListener(a,u,{passive:y}):o.addEventListener(a,u,!1)}function wy(o,a,u,h,y){var x=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var w=h.tag;if(w===3||w===4){var A=h.stateNode.containerInfo;if(A===y)break;if(w===4)for(w=h.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===y)return;w=w.return}for(;A!==null;){if(w=Sl(A),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){h=x=w;continue e}A=A.parentNode}}h=h.return}CS(function(){var P=x,W=Bm(u),ee=[];e:{var F=XS.get(o);if(F!==void 0){var q=Nf,Se=o;switch(o){case"keypress":if(Df(u)===0)break e;case"keydown":case"keyup":q=SR;break;case"focusin":Se="focus",q=Fm;break;case"focusout":Se="blur",q=Fm;break;case"beforeblur":case"afterblur":q=Fm;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=AS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=aR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=kR;break;case WS:case GS:case ZS:q=fR;break;case JS:q=ER;break;case"scroll":case"scrollend":q=oR;break;case"wheel":q=AR;break;case"copy":case"cut":case"paste":q=hR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=OS;break;case"toggle":case"beforetoggle":q=OR}var Ne=(a&4)!==0,bt=!Ne&&(o==="scroll"||o==="scrollend"),U=Ne?F!==null?F+"Capture":null:F;Ne=[];for(var z=P,V;z!==null;){var J=z;if(V=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||V===null||U===null||(J=lc(z,U),J!=null&&Ne.push(Hc(z,J,V))),bt)break;z=z.return}0<Ne.length&&(F=new q(F,Se,null,u,W),ee.push({event:F,listeners:Ne}))}}if((a&7)===0){e:{if(F=o==="mouseover"||o==="pointerover",q=o==="mouseout"||o==="pointerout",F&&u!==Im&&(Se=u.relatedTarget||u.fromElement)&&(Sl(Se)||Se[xl]))break e;if((q||F)&&(F=W.window===W?W:(F=W.ownerDocument)?F.defaultView||F.parentWindow:window,q?(Se=u.relatedTarget||u.toElement,q=P,Se=Se?Sl(Se):null,Se!==null&&(bt=s(Se),Ne=Se.tag,Se!==bt||Ne!==5&&Ne!==27&&Ne!==6)&&(Se=null)):(q=null,Se=P),q!==Se)){if(Ne=AS,J="onMouseLeave",U="onMouseEnter",z="mouse",(o==="pointerout"||o==="pointerover")&&(Ne=OS,J="onPointerLeave",U="onPointerEnter",z="pointer"),bt=q==null?F:oc(q),V=Se==null?F:oc(Se),F=new Ne(J,z+"leave",q,u,W),F.target=bt,F.relatedTarget=V,J=null,Sl(W)===P&&(Ne=new Ne(U,z+"enter",Se,u,W),Ne.target=V,Ne.relatedTarget=bt,J=Ne),bt=J,q&&Se)t:{for(Ne=MN,U=q,z=Se,V=0,J=U;J;J=Ne(J))V++;J=0;for(var Oe=z;Oe;Oe=Ne(Oe))J++;for(;0<V-J;)U=Ne(U),V--;for(;0<J-V;)z=Ne(z),J--;for(;V--;){if(U===z||z!==null&&U===z.alternate){Ne=U;break t}U=Ne(U),z=Ne(z)}Ne=null}else Ne=null;q!==null&&Sk(ee,F,q,Ne,!1),Se!==null&&bt!==null&&Sk(ee,bt,Se,Ne,!0)}}e:{if(F=P?oc(P):window,q=F.nodeName&&F.nodeName.toLowerCase(),q==="select"||q==="input"&&F.type==="file")var it=IS;else if(LS(F))if(BS)it=UR;else{it=IR;var ke=jR}else q=F.nodeName,!q||q.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?P&&jm(P.elementType)&&(it=IS):it=BR;if(it&&(it=it(o,P))){jS(ee,it,u,W);break e}ke&&ke(o,F,P),o==="focusout"&&P&&F.type==="number"&&P.memoizedProps.value!=null&&Lm(F,"number",F.value)}switch(ke=P?oc(P):window,o){case"focusin":(LS(ke)||ke.contentEditable==="true")&&(Ol=ke,Zm=P,mc=null);break;case"focusout":mc=Zm=Ol=null;break;case"mousedown":Jm=!0;break;case"contextmenu":case"mouseup":case"dragend":Jm=!1,YS(ee,u,W);break;case"selectionchange":if(VR)break;case"keydown":case"keyup":YS(ee,u,W)}var Pe;if(Ym)e:{switch(o){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else Ml?NS(o,u)&&(et="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(et="onCompositionStart");et&&(_S&&u.locale!=="ko"&&(Ml||et!=="onCompositionStart"?et==="onCompositionEnd"&&Ml&&(Pe=ES()):(Ss=W,Vm="value"in Ss?Ss.value:Ss.textContent,Ml=!0)),ke=kd(P,et),0<ke.length&&(et=new MS(et,o,null,u,W),ee.push({event:et,listeners:ke}),Pe?et.data=Pe:(Pe=zS(u),Pe!==null&&(et.data=Pe)))),(Pe=DR?RR(o,u):NR(o,u))&&(et=kd(P,"onBeforeInput"),0<et.length&&(ke=new MS("onBeforeInput","beforeinput",null,u,W),ee.push({event:ke,listeners:et}),ke.data=Pe)),CN(ee,o,P,u,W)}bk(ee,a)})}function Hc(o,a,u){return{instance:o,listener:a,currentTarget:u}}function kd(o,a){for(var u=a+"Capture",h=[];o!==null;){var y=o,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=lc(o,u),y!=null&&h.unshift(Hc(o,y,x)),y=lc(o,a),y!=null&&h.push(Hc(o,y,x))),o.tag===3)return h;o=o.return}return[]}function MN(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Sk(o,a,u,h,y){for(var x=a._reactName,w=[];u!==null&&u!==h;){var A=u,R=A.alternate,P=A.stateNode;if(A=A.tag,R!==null&&R===h)break;A!==5&&A!==26&&A!==27||P===null||(R=P,y?(P=lc(u,x),P!=null&&w.unshift(Hc(u,P,R))):y||(P=lc(u,x),P!=null&&w.push(Hc(u,P,R)))),u=u.return}w.length!==0&&o.push({event:a,listeners:w})}var ON=/\r\n?/g,_N=/\u0000|\uFFFD/g;function wk(o){return(typeof o=="string"?o:""+o).replace(ON,`
49
+ `).replace(_N,"")}function vk(o,a){return a=wk(a),wk(o)===a}function yt(o,a,u,h,y,x){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||El(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&El(o,""+h);break;case"className":Af(o,"class",h);break;case"tabIndex":Af(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Af(o,u,h);break;case"style":vS(o,h,x);break;case"data":if(a!=="object"){Af(o,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){o.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=Of(""+h),o.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){o.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(u==="formAction"?(a!=="input"&&yt(o,a,"name",y.name,y,null),yt(o,a,"formEncType",y.formEncType,y,null),yt(o,a,"formMethod",y.formMethod,y,null),yt(o,a,"formTarget",y.formTarget,y,null)):(yt(o,a,"encType",y.encType,y,null),yt(o,a,"method",y.method,y,null),yt(o,a,"target",y.target,y,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=Of(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=Ui);break;case"onScroll":h!=null&&Xe("scroll",o);break;case"onScrollEnd":h!=null&&Xe("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}u=Of(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""+h):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":h===!0?o.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,h):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(u,h):o.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(u):o.setAttribute(u,h);break;case"popover":Xe("beforetoggle",o),Xe("toggle",o),Tf(o,"popover",h);break;case"xlinkActuate":Bi(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Bi(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Bi(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Bi(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Bi(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Bi(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Bi(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Bi(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Bi(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Tf(o,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=iR.get(u)||u,Tf(o,u,h))}}function vy(o,a,u,h,y,x){switch(u){case"style":vS(o,h,x);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"children":typeof h=="string"?El(o,h):(typeof h=="number"||typeof h=="bigint")&&El(o,""+h);break;case"onScroll":h!=null&&Xe("scroll",o);break;case"onScrollEnd":h!=null&&Xe("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Ui);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hS.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),a=u.slice(2,y?u.length-7:void 0),x=o[Gn]||null,x=x!=null?x[u]:null,typeof x=="function"&&o.removeEventListener(a,x,y),typeof h=="function")){typeof x!="function"&&x!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(a,h,y);break e}u in o?o[u]=h:h===!0?o.setAttribute(u,""):Tf(o,u,h)}}}function kn(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xe("error",o),Xe("load",o);var h=!1,y=!1,x;for(x in u)if(u.hasOwnProperty(x)){var w=u[x];if(w!=null)switch(x){case"src":h=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(o,a,x,w,u,null)}}y&&yt(o,a,"srcSet",u.srcSet,u,null),h&&yt(o,a,"src",u.src,u,null);return;case"input":Xe("invalid",o);var A=x=w=y=null,R=null,P=null;for(h in u)if(u.hasOwnProperty(h)){var W=u[h];if(W!=null)switch(h){case"name":y=W;break;case"type":w=W;break;case"checked":R=W;break;case"defaultChecked":P=W;break;case"value":x=W;break;case"defaultValue":A=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,a));break;default:yt(o,a,h,W,u,null)}}bS(o,x,A,R,P,w,y,!1);return;case"select":Xe("invalid",o),h=w=x=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":x=A;break;case"defaultValue":w=A;break;case"multiple":h=A;default:yt(o,a,y,A,u,null)}a=x,u=w,o.multiple=!!h,a!=null?Cl(o,!!h,a,!1):u!=null&&Cl(o,!!h,u,!0);return;case"textarea":Xe("invalid",o),x=y=h=null;for(w in u)if(u.hasOwnProperty(w)&&(A=u[w],A!=null))switch(w){case"value":h=A;break;case"defaultValue":y=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:yt(o,a,w,A,u,null)}SS(o,h,y,x);return;case"option":for(R in u)if(u.hasOwnProperty(R)&&(h=u[R],h!=null))switch(R){case"selected":o.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:yt(o,a,R,h,u,null)}return;case"dialog":Xe("beforetoggle",o),Xe("toggle",o),Xe("cancel",o),Xe("close",o);break;case"iframe":case"object":Xe("load",o);break;case"video":case"audio":for(h=0;h<Uc.length;h++)Xe(Uc[h],o);break;case"image":Xe("error",o),Xe("load",o);break;case"details":Xe("toggle",o);break;case"embed":case"source":case"link":Xe("error",o),Xe("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in u)if(u.hasOwnProperty(P)&&(h=u[P],h!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(o,a,P,h,u,null)}return;default:if(jm(a)){for(W in u)u.hasOwnProperty(W)&&(h=u[W],h!==void 0&&vy(o,a,W,h,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(h=u[A],h!=null&&yt(o,a,A,h,u,null))}function DN(o,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,w=null,A=null,R=null,P=null,W=null;for(q in u){var ee=u[q];if(u.hasOwnProperty(q)&&ee!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":R=ee;default:h.hasOwnProperty(q)||yt(o,a,q,null,h,ee)}}for(var F in h){var q=h[F];if(ee=u[F],h.hasOwnProperty(F)&&(q!=null||ee!=null))switch(F){case"type":x=q;break;case"name":y=q;break;case"checked":P=q;break;case"defaultChecked":W=q;break;case"value":w=q;break;case"defaultValue":A=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,a));break;default:q!==ee&&yt(o,a,F,q,h,ee)}}zm(o,w,A,R,P,W,x,y);return;case"select":q=w=A=F=null;for(x in u)if(R=u[x],u.hasOwnProperty(x)&&R!=null)switch(x){case"value":break;case"multiple":q=R;default:h.hasOwnProperty(x)||yt(o,a,x,null,h,R)}for(y in h)if(x=h[y],R=u[y],h.hasOwnProperty(y)&&(x!=null||R!=null))switch(y){case"value":F=x;break;case"defaultValue":A=x;break;case"multiple":w=x;default:x!==R&&yt(o,a,y,x,h,R)}a=A,u=w,h=q,F!=null?Cl(o,!!u,F,!1):!!h!=!!u&&(a!=null?Cl(o,!!u,a,!0):Cl(o,!!u,u?[]:"",!1));return;case"textarea":q=F=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!h.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:yt(o,a,A,null,h,y)}for(w in h)if(y=h[w],x=u[w],h.hasOwnProperty(w)&&(y!=null||x!=null))switch(w){case"value":F=y;break;case"defaultValue":q=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&yt(o,a,w,y,h,x)}xS(o,F,q);return;case"option":for(var Se in u)if(F=u[Se],u.hasOwnProperty(Se)&&F!=null&&!h.hasOwnProperty(Se))switch(Se){case"selected":o.selected=!1;break;default:yt(o,a,Se,null,h,F)}for(R in h)if(F=h[R],q=u[R],h.hasOwnProperty(R)&&F!==q&&(F!=null||q!=null))switch(R){case"selected":o.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:yt(o,a,R,F,h,q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in u)F=u[Ne],u.hasOwnProperty(Ne)&&F!=null&&!h.hasOwnProperty(Ne)&&yt(o,a,Ne,null,h,F);for(P in h)if(F=h[P],q=u[P],h.hasOwnProperty(P)&&F!==q&&(F!=null||q!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,a));break;default:yt(o,a,P,F,h,q)}return;default:if(jm(a)){for(var bt in u)F=u[bt],u.hasOwnProperty(bt)&&F!==void 0&&!h.hasOwnProperty(bt)&&vy(o,a,bt,void 0,h,F);for(W in h)F=h[W],q=u[W],!h.hasOwnProperty(W)||F===q||F===void 0&&q===void 0||vy(o,a,W,F,h,q);return}}for(var U in u)F=u[U],u.hasOwnProperty(U)&&F!=null&&!h.hasOwnProperty(U)&&yt(o,a,U,null,h,F);for(ee in h)F=h[ee],q=u[ee],!h.hasOwnProperty(ee)||F===q||F==null&&q==null||yt(o,a,ee,F,h,q)}function kk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function RN(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var y=u[h],x=y.transferSize,w=y.initiatorType,A=y.duration;if(x&&A&&kk(w)){for(w=0,A=y.responseEnd,h+=1;h<u.length;h++){var R=u[h],P=R.startTime;if(P>A)break;var W=R.transferSize,ee=R.initiatorType;W&&kk(ee)&&(R=R.responseEnd,w+=W*(R<A?1:(A-P)/(R-P)))}if(--h,a+=8*(x+w)/(y.duration/1e3),o++,10<o)break}}if(0<o)return a/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var ky=null,Cy=null;function Cd(o){return o.nodeType===9?o:o.ownerDocument}function Ck(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ek(o,a){if(o===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&a==="foreignObject"?0:o}function Ey(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Ty=null;function NN(){var o=window.event;return o&&o.type==="popstate"?o===Ty?!1:(Ty=o,!0):(Ty=null,!1)}var Tk=typeof setTimeout=="function"?setTimeout:void 0,zN=typeof clearTimeout=="function"?clearTimeout:void 0,Ak=typeof Promise=="function"?Promise:void 0,LN=typeof queueMicrotask=="function"?queueMicrotask:typeof Ak<"u"?function(o){return Ak.resolve(null).then(o).catch(jN)}:Tk;function jN(o){setTimeout(function(){throw o})}function Is(o){return o==="head"}function Mk(o,a){var u=a,h=0;do{var y=u.nextSibling;if(o.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(h===0){o.removeChild(y),na(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Vc(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,Vc(u);for(var x=u.firstChild;x;){var w=x.nextSibling,A=x.nodeName;x[sc]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=w}}else u==="body"&&Vc(o.ownerDocument.body);u=y}while(u);na(a)}function Ok(o,a){var u=o;o=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=h}while(u)}function Ay(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Ay(u),Rm(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function IN(o,a,u,h){for(;o.nodeType===1;){var y=u;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[sc])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(x=o.getAttribute("rel"),x==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(x!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(x=o.getAttribute("src"),(x!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===x)return o}else return o;if(o=zr(o.nextSibling),o===null)break}return null}function BN(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=zr(o.nextSibling),o===null))return null;return o}function _k(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=zr(o.nextSibling),o===null))return null;return o}function My(o){return o.data==="$?"||o.data==="$~"}function Oy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function UN(o,a){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),o._reactRetry=h}}function zr(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==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return o}var _y=null;function Dk(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return zr(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function Rk(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return o;a--}else u!=="/$"&&u!=="/&"||a++}o=o.previousSibling}return null}function Nk(o,a,u){switch(a=Cd(u),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Vc(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);Rm(o)}var Lr=new Map,zk=new Set;function Ed(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ts=Z.d;Z.d={f:HN,r:VN,D:PN,C:$N,L:FN,m:qN,X:KN,S:YN,M:WN};function HN(){var o=ts.f(),a=gd();return o||a}function VN(o){var a=wl(o);a!==null&&a.tag===5&&a.type==="form"?Jw(a):ts.r(o)}var Ql=typeof document>"u"?null:document;function Lk(o,a,u){var h=Ql;if(h&&typeof a=="string"&&a){var y=Ar(a);y='link[rel="'+o+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),zk.has(y)||(zk.add(y),o={rel:o,crossOrigin:u,href:a},h.querySelector(y)===null&&(a=h.createElement("link"),kn(a,"link",o),on(a),h.head.appendChild(a)))}}function PN(o){ts.D(o),Lk("dns-prefetch",o,null)}function $N(o,a){ts.C(o,a),Lk("preconnect",o,a)}function FN(o,a,u){ts.L(o,a,u);var h=Ql;if(h&&o&&a){var y='link[rel="preload"][as="'+Ar(a)+'"]';a==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Ar(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Ar(u.imageSizes)+'"]')):y+='[href="'+Ar(o)+'"]';var x=y;switch(a){case"style":x=ea(o);break;case"script":x=ta(o)}Lr.has(x)||(o=m({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),Lr.set(x,o),h.querySelector(y)!==null||a==="style"&&h.querySelector(Pc(x))||a==="script"&&h.querySelector($c(x))||(a=h.createElement("link"),kn(a,"link",o),on(a),h.head.appendChild(a)))}}function qN(o,a){ts.m(o,a);var u=Ql;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Ar(h)+'"][href="'+Ar(o)+'"]',x=y;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ta(o)}if(!Lr.has(x)&&(o=m({rel:"modulepreload",href:o},a),Lr.set(x,o),u.querySelector(y)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector($c(x)))return}h=u.createElement("link"),kn(h,"link",o),on(h),u.head.appendChild(h)}}}function YN(o,a,u){ts.S(o,a,u);var h=Ql;if(h&&o){var y=vl(h).hoistableStyles,x=ea(o);a=a||"default";var w=y.get(x);if(!w){var A={loading:0,preload:null};if(w=h.querySelector(Pc(x)))A.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":a},u),(u=Lr.get(x))&&Dy(o,u);var R=w=h.createElement("link");on(R),kn(R,"link",o),R._p=new Promise(function(P,W){R.onload=P,R.onerror=W}),R.addEventListener("load",function(){A.loading|=1}),R.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Td(w,a,h)}w={type:"stylesheet",instance:w,count:1,state:A},y.set(x,w)}}}function KN(o,a){ts.X(o,a);var u=Ql;if(u&&o){var h=vl(u).hoistableScripts,y=ta(o),x=h.get(y);x||(x=u.querySelector($c(y)),x||(o=m({src:o,async:!0},a),(a=Lr.get(y))&&Ry(o,a),x=u.createElement("script"),on(x),kn(x,"link",o),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(y,x))}}function WN(o,a){ts.M(o,a);var u=Ql;if(u&&o){var h=vl(u).hoistableScripts,y=ta(o),x=h.get(y);x||(x=u.querySelector($c(y)),x||(o=m({src:o,async:!0,type:"module"},a),(a=Lr.get(y))&&Ry(o,a),x=u.createElement("script"),on(x),kn(x,"link",o),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(y,x))}}function jk(o,a,u,h){var y=(y=ge.current)?Ed(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=ea(u.href),u=vl(y).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=ea(u.href);var x=vl(y).hoistableStyles,w=x.get(o);if(w||(y=y.ownerDocument||y,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(o,w),(x=y.querySelector(Pc(o)))&&!x._p&&(w.instance=x,w.state.loading=5),Lr.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Lr.set(o,u),x||GN(y,o,u,w.state))),a&&h===null)throw Error(r(528,""));return w}if(a&&h!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ta(u),u=vl(y).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function ea(o){return'href="'+Ar(o)+'"'}function Pc(o){return'link[rel="stylesheet"]['+o+"]"}function Ik(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function GN(o,a,u,h){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=o.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),kn(a,"link",u),on(a),o.head.appendChild(a))}function ta(o){return'[src="'+Ar(o)+'"]'}function $c(o){return"script[async]"+o}function Bk(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+Ar(u.href)+'"]');if(h)return a.instance=h,on(h),h;var y=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),on(h),kn(h,"style",y),Td(h,u.precedence,o),a.instance=h;case"stylesheet":y=ea(u.href);var x=o.querySelector(Pc(y));if(x)return a.state.loading|=4,a.instance=x,on(x),x;h=Ik(u),(y=Lr.get(y))&&Dy(h,y),x=(o.ownerDocument||o).createElement("link"),on(x);var w=x;return w._p=new Promise(function(A,R){w.onload=A,w.onerror=R}),kn(x,"link",h),a.state.loading|=4,Td(x,u.precedence,o),a.instance=x;case"script":return x=ta(u.src),(y=o.querySelector($c(x)))?(a.instance=y,on(y),y):(h=u,(y=Lr.get(x))&&(h=m({},u),Ry(h,y)),o=o.ownerDocument||o,y=o.createElement("script"),on(y),kn(y,"link",h),o.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Td(h,u.precedence,o));return a.instance}function Td(o,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=h.length?h[h.length-1]:null,x=y,w=0;w<h.length;w++){var A=h[w];if(A.dataset.precedence===a)x=A;else if(x!==y)break}x?x.parentNode.insertBefore(o,x.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(o,a.firstChild))}function Dy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function Ry(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Ad=null;function Uk(o,a,u){if(Ad===null){var h=new Map,y=Ad=new Map;y.set(u,h)}else y=Ad,h=y.get(u),h||(h=new Map,y.set(u,h));if(h.has(o))return h;for(h.set(o,null),u=u.getElementsByTagName(o),y=0;y<u.length;y++){var x=u[y];if(!(x[sc]||x[xn]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=o+w;var A=h.get(w);A?A.push(x):h.set(w,[x])}}return h}function Hk(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function ZN(o,a,u){if(u===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return o=a.disabled,typeof a.precedence=="string"&&o==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Vk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function JN(o,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=ea(h.href),x=a.querySelector(Pc(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=Md.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=x,on(x);return}x=a.ownerDocument||a,h=Ik(h),(y=Lr.get(y))&&Dy(h,y),x=x.createElement("link"),on(x);var w=x;w._p=new Promise(function(A,R){w.onload=A,w.onerror=R}),kn(x,"link",h),u.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=Md.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var Ny=0;function XN(o,a){return o.stylesheets&&o.count===0&&_d(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&_d(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+a);0<o.imgBytes&&Ny===0&&(Ny=62500*RN());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&_d(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>Ny?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(y)}}:null}function Md(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_d(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Od=null;function _d(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Od=new Map,a.forEach(QN,o),Od=null,Md.call(o))}function QN(o,a){if(!(a.state.loading&4)){var u=Od.get(o);if(u)var h=u.get(null);else{u=new Map,Od.set(o,u);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var w=y[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(u.set(w.dataset.precedence,w),h=w)}h&&u.set(null,h)}y=a.instance,w=y.getAttribute("data-precedence"),x=u.get(w)||h,x===h&&u.set(null,y),u.set(w,y),this.count++,h=Md.bind(this),y.addEventListener("load",h),y.addEventListener("error",h),x?x.parentNode.insertBefore(y,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),a.state.loading|=4}}var Fc={$$typeof:j,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function ez(o,a,u,h,y,x,w,A,R){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ii(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ii(0),this.hiddenUpdates=Ii(null),this.identifierPrefix=h,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Pk(o,a,u,h,y,x,w,A,R,P,W,ee){return o=new ez(o,a,u,w,R,P,W,ee,A),a=1,x===!0&&(a|=24),x=ur(3,null,null,a),o.current=x,x.stateNode=o,a=dg(),a.refCount++,o.pooledCache=a,a.refCount++,x.memoizedState={element:h,isDehydrated:u,cache:a},gg(x),o}function $k(o){return o?(o=Rl,o):Rl}function Fk(o,a,u,h,y,x){y=$k(y),h.context===null?h.context=y:h.pendingContext=y,h=Ts(a),h.payload={element:u},x=x===void 0?null:x,x!==null&&(h.callback=x),u=As(o,h,a),u!==null&&(tr(u,o,a),vc(u,o,a))}function qk(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function zy(o,a){qk(o,a),(o=o.alternate)&&qk(o,a)}function Yk(o){if(o.tag===13||o.tag===31){var a=To(o,67108864);a!==null&&tr(a,o,67108864),zy(o,67108864)}}function Kk(o){if(o.tag===13||o.tag===31){var a=mr();a=Om(a);var u=To(o,a);u!==null&&tr(u,o,a),zy(o,a)}}var Dd=!0;function tz(o,a,u,h){var y=I.T;I.T=null;var x=Z.p;try{Z.p=2,Ly(o,a,u,h)}finally{Z.p=x,I.T=y}}function nz(o,a,u,h){var y=I.T;I.T=null;var x=Z.p;try{Z.p=8,Ly(o,a,u,h)}finally{Z.p=x,I.T=y}}function Ly(o,a,u,h){if(Dd){var y=jy(h);if(y===null)wy(o,a,h,Rd,u),Gk(o,h);else if(iz(y,o,a,u,h))h.stopPropagation();else if(Gk(o,h),a&4&&-1<rz.indexOf(o)){for(;y!==null;){var x=wl(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=Jr(x.pendingLanes);if(w!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;w;){var R=1<<31-oe(w);A.entanglements[1]|=R,w&=~R}hi(x),(ut&6)===0&&(pd=Ft()+500,Bc(0))}}break;case 31:case 13:A=To(x,2),A!==null&&tr(A,x,2),gd(),zy(x,2)}if(x=jy(h),x===null&&wy(o,a,h,Rd,u),x===y)break;y=x}y!==null&&h.stopPropagation()}else wy(o,a,h,null,u)}}function jy(o){return o=Bm(o),Iy(o)}var Rd=null;function Iy(o){if(Rd=null,o=Sl(o),o!==null){var a=s(o);if(a===null)o=null;else{var u=a.tag;if(u===13){if(o=l(a),o!==null)return o;o=null}else if(u===31){if(o=c(a),o!==null)return o;o=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return Rd=o,null}function Wk(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Li()){case Y:return 2;case L:return 8;case se:case ye:return 32;case Te:return 268435456;default:return 32}default:return 32}}var By=!1,Bs=null,Us=null,Hs=null,qc=new Map,Yc=new Map,Vs=[],rz="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Gk(o,a){switch(o){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Us=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":qc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yc.delete(a.pointerId)}}function Kc(o,a,u,h,y,x){return o===null||o.nativeEvent!==x?(o={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:x,targetContainers:[y]},a!==null&&(a=wl(a),a!==null&&Yk(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),o)}function iz(o,a,u,h,y){switch(a){case"focusin":return Bs=Kc(Bs,o,a,u,h,y),!0;case"dragenter":return Us=Kc(Us,o,a,u,h,y),!0;case"mouseover":return Hs=Kc(Hs,o,a,u,h,y),!0;case"pointerover":var x=y.pointerId;return qc.set(x,Kc(qc.get(x)||null,o,a,u,h,y)),!0;case"gotpointercapture":return x=y.pointerId,Yc.set(x,Kc(Yc.get(x)||null,o,a,u,h,y)),!0}return!1}function Zk(o){var a=Sl(o.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){o.blockedOn=a,uS(o.priority,function(){Kk(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,uS(o.priority,function(){Kk(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Nd(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=jy(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);Im=h,u.target.dispatchEvent(h),Im=null}else return a=wl(u),a!==null&&Yk(a),o.blockedOn=u,!1;a.shift()}return!0}function Jk(o,a,u){Nd(o)&&u.delete(a)}function sz(){By=!1,Bs!==null&&Nd(Bs)&&(Bs=null),Us!==null&&Nd(Us)&&(Us=null),Hs!==null&&Nd(Hs)&&(Hs=null),qc.forEach(Jk),Yc.forEach(Jk)}function zd(o,a){o.blockedOn===a&&(o.blockedOn=null,By||(By=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,sz)))}var Ld=null;function Xk(o){Ld!==o&&(Ld=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ld===o&&(Ld=null);for(var a=0;a<o.length;a+=3){var u=o[a],h=o[a+1],y=o[a+2];if(typeof h!="function"){if(Iy(h||u)===null)continue;break}var x=wl(u);x!==null&&(o.splice(a,3),a-=3,jg(x,{pending:!0,data:y,method:u.method,action:h},h,y))}}))}function na(o){function a(R){return zd(R,o)}Bs!==null&&zd(Bs,o),Us!==null&&zd(Us,o),Hs!==null&&zd(Hs,o),qc.forEach(a),Yc.forEach(a);for(var u=0;u<Vs.length;u++){var h=Vs[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Vs.length&&(u=Vs[0],u.blockedOn===null);)Zk(u),u.blockedOn===null&&Vs.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var y=u[h],x=u[h+1],w=y[Gn]||null;if(typeof x=="function")w||Xk(u);else if(w){var A=null;if(x&&x.hasAttribute("formAction")){if(y=x,w=x[Gn]||null)A=w.formAction;else if(Iy(y)!==null)continue}else A=w.action;typeof A=="function"?u[h+1]=A:(u.splice(h,3),h-=3),Xk(u)}}}function Qk(){function o(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return y=w})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function Uy(o){this._internalRoot=o}jd.prototype.render=Uy.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=mr();Fk(u,h,o,a,null,null)},jd.prototype.unmount=Uy.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Fk(o.current,2,null,o,null,null),gd(),a[xl]=null}};function jd(o){this._internalRoot=o}jd.prototype.unstable_scheduleHydration=function(o){if(o){var a=cS();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Vs.length&&a!==0&&a<Vs[u].priority;u++);Vs.splice(u,0,o),u===0&&Zk(o)}};var eC=e.version;if(eC!=="19.2.4")throw Error(r(527,eC,"19.2.4"));Z.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=d(a),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var oz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Id=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Id.isDisabled&&Id.supportsFiber)try{Ze=Id.inject(oz),at=Id}catch{}}return Gc.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",y=lv,x=av,w=cv;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=Pk(o,1,!1,null,null,u,h,null,y,x,w,Qk),o[xl]=a.current,Sy(o),new Uy(a)},Gc.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,y="",x=lv,w=av,A=cv,R=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(w=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(R=u.formState)),a=Pk(o,1,!0,a,u??null,h,y,R,x,w,A,Qk),a.context=$k(null),u=a.current,h=mr(),h=Om(h),y=Ts(h),y.callback=null,As(u,y,h),u=h,a.current.lanes=u,ic(a,u),hi(a),o[xl]=a.current,Sy(o),new jd(a)},Gc.version="19.2.4",Gc}var uC;function yz(){if(uC)return Py.exports;uC=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(),Py.exports=gz(),Py.exports}var bz=yz();const fC=3478,Ya=3479,xz=3e3,Sz=3e3,wz=3e4,_u={yellow:"rgba(255, 235, 59, 0.3)",red:"rgba(244, 67, 54, 0.3)",green:"rgba(76, 175, 80, 0.3)",blue:"rgba(33, 150, 243, 0.3)",purple:"rgba(156, 39, 176, 0.3)"},dC="tandem",Ud="tandem:mode",tM="tandem:settings",vz="tandem-panel-width",kz="tandem-left-panel-width",nM={left:kz,right:vz},rM=1e3,Dh=500,Rh=3e3,Tx="#6366f1",Cz="__tandem_ctrl__",ga="annotations",iM="awareness",rb="userAwareness",Ez="mode",Tz="selectionDwellMs",hC="chat",hh="documentMeta",Az="annotationReplies",pC="savedAtVersion",mC="authorship",sM="tandem:showAuthorship",Ax="tandem:recentFiles",Mz=20,ib="tandem:userName",au="You",gC={error:8e3,warning:6e3,info:4e3},Oz=5,oM="tandem:tutorialCompleted",_z="tutorial-",yC="tandem:zoomLevel",bC=.5,xC=2,Zc=1,ph=t=>t,Fr=t=>t;var lt;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const l of i)s[l]=l;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),l={};for(const c of s)l[c]=i[c];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&s.push(l);return s},t.find=(i,s)=>{for(const l of i)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(lt||(lt={}));var SC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(SC||(SC={}));const ve=lt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ys=t=>{switch(typeof t){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(t)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(t)?ve.array:t===null?ve.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ve.promise:typeof Map<"u"&&t instanceof Map?ve.map:typeof Set<"u"&&t instanceof Set?ve.set:typeof Date<"u"&&t instanceof Date?ve.date:ve.object;default:return ve.unknown}},de=lt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ms extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,f=0;for(;f<l.path.length;){const d=l.path[f];f===l.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(l))):c[d]=c[d]||{_errors:[]},c=c[d],f++}}};return i(this),r}static assert(e){if(!(e instanceof ms))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,lt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ms.create=t=>new ms(t);const sb=(t,e)=>{let n;switch(t.code){case de.invalid_type:t.received===ve.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case de.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,lt.jsonStringifyReplacer)}`;break;case de.unrecognized_keys:n=`Unrecognized key(s) in object: ${lt.joinValues(t.keys,", ")}`;break;case de.invalid_union:n="Invalid input";break;case de.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${lt.joinValues(t.options)}`;break;case de.invalid_enum_value:n=`Invalid enum value. Expected ${lt.joinValues(t.options)}, received '${t.received}'`;break;case de.invalid_arguments:n="Invalid function arguments";break;case de.invalid_return_type:n="Invalid function return type";break;case de.invalid_date:n="Invalid date";break;case de.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:lt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case de.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case de.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case de.custom:n="Invalid input";break;case de.invalid_intersection_types:n="Intersection results could not be merged";break;case de.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case de.not_finite:n="Number must be finite";break;default:n=e.defaultError,lt.assertNever(t)}return{message:n}};let Dz=sb;function Rz(){return Dz}const Nz=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],l={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const f=r.filter(d=>!!d).slice().reverse();for(const d of f)c=d(l,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function be(t,e){const n=Rz(),r=Nz({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===sb?void 0:sb].filter(i=>!!i)});t.common.issues.push(r)}class vr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Ie;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,l=await i.value;r.push({key:s,value:l})}return vr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:l}=i;if(s.status==="aborted"||l.status==="aborted")return Ie;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[s.value]=l.value)}return{status:e.value,value:r}}}const Ie=Object.freeze({status:"aborted"}),ru=t=>({status:"dirty",value:t}),Gr=t=>({status:"valid",value:t}),wC=t=>t.status==="aborted",vC=t=>t.status==="dirty",Oa=t=>t.status==="valid",Nh=t=>typeof Promise<"u"&&t instanceof Promise;var Ce;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ce||(Ce={}));class co{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kC=(t,e)=>{if(Oa(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ms(t.common.issues);return this._error=n,this._error}}};function Ge(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,c)=>{const{message:f}=t;return l.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:f??n??c.defaultError}},description:i}}class rt{get description(){return this._def.description}_getType(e){return Ys(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ys(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vr,ctx:{common:e.parent.common,data:e.data,parsedType:Ys(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Nh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ys(e)},i=this._parseSync({data:e,path:r.path,parent:r});return kC(r,i)}"~validate"(e){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ys(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Oa(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(s=>Oa(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ys(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Nh(i)?i:Promise.resolve(i));return kC(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const l=e(i),c=()=>s.addIssue({code:de.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(f=>f?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Da({schema:this,typeName:Be.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return io.create(this,this._def)}nullable(){return Ra.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wi.create(this)}promise(){return Ih.create(this,this._def)}or(e){return Lh.create([this,e],this._def)}and(e){return jh.create(this,e,this._def)}transform(e){return new Da({...Ge(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new lb({...Ge(this._def),innerType:this,defaultValue:n,typeName:Be.ZodDefault})}brand(){return new n3({typeName:Be.ZodBranded,type:this,...Ge(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ab({...Ge(this._def),innerType:this,catchValue:n,typeName:Be.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Mx.create(this,e)}readonly(){return cb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zz=/^c[^\s-]{8,}$/i,Lz=/^[0-9a-z]+$/,jz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Iz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Bz=/^[a-z0-9_-]{21}$/i,Uz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hz=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Yy;const $z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qz=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Yz=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lM="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Gz=new RegExp(`^${lM}$`);function aM(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Zz(t){return new RegExp(`^${aM(t)}$`)}function Jz(t){let e=`${lM}T${aM(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Xz(t,e){return!!((e==="v4"||!e)&&$z.test(t)||(e==="v6"||!e)&&qz.test(t))}function Qz(t,e){if(!Uz.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function e3(t,e){return!!((e==="v4"||!e)&&Fz.test(t)||(e==="v6"||!e)&&Yz.test(t))}class $o extends rt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ve.string){const s=this._getOrReturnCtx(e);return be(s,{code:de.invalid_type,expected:ve.string,received:s.parsedType}),Ie}const r=new vr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),be(i,{code:de.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),be(i,{code:de.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(i=this._getOrReturnCtx(e,i),l?be(i,{code:de.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&be(i,{code:de.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Vz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"email",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Yy||(Yy=new RegExp(Pz,"u")),Yy.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"emoji",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Iz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"uuid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Bz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"nanoid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")zz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"cuid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Lz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"cuid2",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")jz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"ulid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),be(i,{validation:"url",code:de.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"regex",code:de.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),be(i,{code:de.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),be(i,{code:de.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),be(i,{code:de.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Jz(s).test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:de.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Gz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:de.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Zz(s).test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:de.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Hz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"duration",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Xz(e.data,s.version)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"ip",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Qz(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"jwt",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?e3(e.data,s.version)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"cidr",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Kz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"base64",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Wz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"base64url",code:de.invalid_string,message:s.message}),r.dirty()):lt.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:de.invalid_string,...Ce.errToObj(r)})}_addCheck(e){return new $o({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ce.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ce.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ce.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ce.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ce.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ce.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ce.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ce.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ce.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ce.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ce.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ce.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ce.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ce.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ce.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ce.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ce.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ce.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ce.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ce.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ce.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ce.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ce.errToObj(n)})}nonempty(e){return this.min(1,Ce.errToObj(e))}trim(){return new $o({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $o({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $o({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}$o.create=t=>new $o({checks:[],typeName:Be.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ge(t)});function t3(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),l=Number.parseInt(e.toFixed(i).replace(".",""));return s%l/10**i}class Du extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ve.number){const s=this._getOrReturnCtx(e);return be(s,{code:de.invalid_type,expected:ve.number,received:s.parsedType}),Ie}let r;const i=new vr;for(const s of this._def.checks)s.kind==="int"?lt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),be(r,{code:de.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),be(r,{code:de.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),be(r,{code:de.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?t3(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),be(r,{code:de.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),be(r,{code:de.not_finite,message:s.message}),i.dirty()):lt.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ce.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ce.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ce.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ce.toString(n))}setLimit(e,n,r,i){return new Du({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new Du({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ce.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ce.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&lt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Du.create=t=>new Du({checks:[],typeName:Be.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ge(t)});class Ru extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ve.bigint)return this._getInvalidInput(e);let r;const i=new vr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),be(r,{code:de.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),be(r,{code:de.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),be(r,{code:de.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):lt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return be(n,{code:de.invalid_type,expected:ve.bigint,received:n.parsedType}),Ie}gte(e,n){return this.setLimit("min",e,!0,Ce.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ce.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ce.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ce.toString(n))}setLimit(e,n,r,i){return new Ru({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new Ru({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ru.create=t=>new Ru({checks:[],typeName:Be.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ge(t)});class CC extends rt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ve.boolean){const r=this._getOrReturnCtx(e);return be(r,{code:de.invalid_type,expected:ve.boolean,received:r.parsedType}),Ie}return Gr(e.data)}}CC.create=t=>new CC({typeName:Be.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ge(t)});class zh extends rt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ve.date){const s=this._getOrReturnCtx(e);return be(s,{code:de.invalid_type,expected:ve.date,received:s.parsedType}),Ie}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return be(s,{code:de.invalid_date}),Ie}const r=new vr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),be(i,{code:de.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),be(i,{code:de.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):lt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new zh({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ce.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ce.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}zh.create=t=>new zh({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Be.ZodDate,...Ge(t)});class EC extends rt{_parse(e){if(this._getType(e)!==ve.symbol){const r=this._getOrReturnCtx(e);return be(r,{code:de.invalid_type,expected:ve.symbol,received:r.parsedType}),Ie}return Gr(e.data)}}EC.create=t=>new EC({typeName:Be.ZodSymbol,...Ge(t)});class TC extends rt{_parse(e){if(this._getType(e)!==ve.undefined){const r=this._getOrReturnCtx(e);return be(r,{code:de.invalid_type,expected:ve.undefined,received:r.parsedType}),Ie}return Gr(e.data)}}TC.create=t=>new TC({typeName:Be.ZodUndefined,...Ge(t)});class AC extends rt{_parse(e){if(this._getType(e)!==ve.null){const r=this._getOrReturnCtx(e);return be(r,{code:de.invalid_type,expected:ve.null,received:r.parsedType}),Ie}return Gr(e.data)}}AC.create=t=>new AC({typeName:Be.ZodNull,...Ge(t)});class MC extends rt{constructor(){super(...arguments),this._any=!0}_parse(e){return Gr(e.data)}}MC.create=t=>new MC({typeName:Be.ZodAny,...Ge(t)});class OC extends rt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Gr(e.data)}}OC.create=t=>new OC({typeName:Be.ZodUnknown,...Ge(t)});class uo extends rt{_parse(e){const n=this._getOrReturnCtx(e);return be(n,{code:de.invalid_type,expected:ve.never,received:n.parsedType}),Ie}}uo.create=t=>new uo({typeName:Be.ZodNever,...Ge(t)});class _C extends rt{_parse(e){if(this._getType(e)!==ve.undefined){const r=this._getOrReturnCtx(e);return be(r,{code:de.invalid_type,expected:ve.void,received:r.parsedType}),Ie}return Gr(e.data)}}_C.create=t=>new _C({typeName:Be.ZodVoid,...Ge(t)});class wi extends rt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ve.array)return be(n,{code:de.invalid_type,expected:ve.array,received:n.parsedType}),Ie;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(be(n,{code:l?de.too_big:de.too_small,minimum:c?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(be(n,{code:de.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(be(n,{code:de.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,c)=>i.type._parseAsync(new co(n,l,n.path,c)))).then(l=>vr.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new co(n,l,n.path,c)));return vr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new wi({...this._def,minLength:{value:e,message:Ce.toString(n)}})}max(e,n){return new wi({...this._def,maxLength:{value:e,message:Ce.toString(n)}})}length(e,n){return new wi({...this._def,exactLength:{value:e,message:Ce.toString(n)}})}nonempty(e){return this.min(1,e)}}wi.create=(t,e)=>new wi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Be.ZodArray,...Ge(e)});function aa(t){if(t instanceof sn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=io.create(aa(r))}return new sn({...t._def,shape:()=>e})}else return t instanceof wi?new wi({...t._def,type:aa(t.element)}):t instanceof io?io.create(aa(t.unwrap())):t instanceof Ra?Ra.create(aa(t.unwrap())):t instanceof nl?nl.create(t.items.map(e=>aa(e))):t}class sn extends rt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=lt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ve.object){const d=this._getOrReturnCtx(e);return be(d,{code:de.invalid_type,expected:ve.object,received:d.parsedType}),Ie}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof uo&&this._def.unknownKeys==="strip"))for(const d in i.data)l.includes(d)||c.push(d);const f=[];for(const d of l){const p=s[d],m=i.data[d];f.push({key:{status:"valid",value:d},value:p._parse(new co(i,m,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof uo){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of c)f.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(d==="strict")c.length>0&&(be(i,{code:de.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of c){const m=i.data[p];f.push({key:{status:"valid",value:p},value:d._parse(new co(i,m,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of f){const m=await p.key,g=await p.value;d.push({key:m,value:g,alwaysSet:p.alwaysSet})}return d}).then(d=>vr.mergeObjectSync(r,d)):vr.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return Ce.errToObj,new sn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,l;const i=((l=(s=this._def).errorMap)==null?void 0:l.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ce.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new sn({...this._def,unknownKeys:"strip"})}passthrough(){return new sn({...this._def,unknownKeys:"passthrough"})}extend(e){return new sn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new sn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Be.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new sn({...this._def,catchall:e})}pick(e){const n={};for(const r of lt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new sn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of lt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new sn({...this._def,shape:()=>n})}deepPartial(){return aa(this)}partial(e){const n={};for(const r of lt.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new sn({...this._def,shape:()=>n})}required(e){const n={};for(const r of lt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof io;)s=s._def.innerType;n[r]=s}return new sn({...this._def,shape:()=>n})}keyof(){return cM(lt.objectKeys(this.shape))}}sn.create=(t,e)=>new sn({shape:()=>t,unknownKeys:"strip",catchall:uo.create(),typeName:Be.ZodObject,...Ge(e)});sn.strictCreate=(t,e)=>new sn({shape:()=>t,unknownKeys:"strict",catchall:uo.create(),typeName:Be.ZodObject,...Ge(e)});sn.lazycreate=(t,e)=>new sn({shape:t,unknownKeys:"strip",catchall:uo.create(),typeName:Be.ZodObject,...Ge(e)});class Lh extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new ms(c.ctx.common.issues));return be(n,{code:de.invalid_union,unionErrors:l}),Ie}if(n.common.async)return Promise.all(r.map(async s=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let s;const l=[];for(const f of r){const d={...n,common:{...n.common,issues:[]},parent:null},p=f._parseSync({data:n.data,path:n.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:d}),d.common.issues.length&&l.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(f=>new ms(f));return be(n,{code:de.invalid_union,unionErrors:c}),Ie}}get options(){return this._def.options}}Lh.create=(t,e)=>new Lh({options:t,typeName:Be.ZodUnion,...Ge(e)});function ob(t,e){const n=Ys(t),r=Ys(e);if(t===e)return{valid:!0,data:t};if(n===ve.object&&r===ve.object){const i=lt.objectKeys(e),s=lt.objectKeys(t).filter(c=>i.indexOf(c)!==-1),l={...t,...e};for(const c of s){const f=ob(t[c],e[c]);if(!f.valid)return{valid:!1};l[c]=f.data}return{valid:!0,data:l}}else if(n===ve.array&&r===ve.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],f=ob(l,c);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return n===ve.date&&r===ve.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class jh extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,l)=>{if(wC(s)||wC(l))return Ie;const c=ob(s.value,l.value);return c.valid?((vC(s)||vC(l))&&n.dirty(),{status:n.value,value:c.data}):(be(r,{code:de.invalid_intersection_types}),Ie)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,l])=>i(s,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}jh.create=(t,e,n)=>new jh({left:t,right:e,typeName:Be.ZodIntersection,...Ge(n)});class nl extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.array)return be(r,{code:de.invalid_type,expected:ve.array,received:r.parsedType}),Ie;if(r.data.length<this._def.items.length)return be(r,{code:de.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ie;!this._def.rest&&r.data.length>this._def.items.length&&(be(r,{code:de.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const f=this._def.items[c]||this._def.rest;return f?f._parse(new co(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>vr.mergeArray(n,l)):vr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new nl({...this._def,rest:e})}}nl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nl({items:t,typeName:Be.ZodTuple,rest:null,...Ge(e)})};class DC extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.map)return be(r,{code:de.invalid_type,expected:ve.map,received:r.parsedType}),Ie;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,f],d)=>({key:i._parse(new co(r,c,r.path,[d,"key"])),value:s._parse(new co(r,f,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const f of l){const d=await f.key,p=await f.value;if(d.status==="aborted"||p.status==="aborted")return Ie;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(d.value,p.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const f of l){const d=f.key,p=f.value;if(d.status==="aborted"||p.status==="aborted")return Ie;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(d.value,p.value)}return{status:n.value,value:c}}}}DC.create=(t,e,n)=>new DC({valueType:e,keyType:t,typeName:Be.ZodMap,...Ge(n)});class Nu extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.set)return be(r,{code:de.invalid_type,expected:ve.set,received:r.parsedType}),Ie;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(be(r,{code:de.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(be(r,{code:de.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function l(f){const d=new Set;for(const p of f){if(p.status==="aborted")return Ie;p.status==="dirty"&&n.dirty(),d.add(p.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((f,d)=>s._parse(new co(r,f,r.path,d)));return r.common.async?Promise.all(c).then(f=>l(f)):l(c)}min(e,n){return new Nu({...this._def,minSize:{value:e,message:Ce.toString(n)}})}max(e,n){return new Nu({...this._def,maxSize:{value:e,message:Ce.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Nu.create=(t,e)=>new Nu({valueType:t,minSize:null,maxSize:null,typeName:Be.ZodSet,...Ge(e)});class RC extends rt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}RC.create=(t,e)=>new RC({getter:t,typeName:Be.ZodLazy,...Ge(e)});class NC extends rt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return be(n,{received:n.data,code:de.invalid_literal,expected:this._def.value}),Ie}return{status:"valid",value:e.data}}get value(){return this._def.value}}NC.create=(t,e)=>new NC({value:t,typeName:Be.ZodLiteral,...Ge(e)});function cM(t,e){return new _a({values:t,typeName:Be.ZodEnum,...Ge(e)})}class _a extends rt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return be(n,{expected:lt.joinValues(r),received:n.parsedType,code:de.invalid_type}),Ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return be(n,{received:n.data,code:de.invalid_enum_value,options:r}),Ie}return Gr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return _a.create(e,{...this._def,...n})}exclude(e,n=this._def){return _a.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}_a.create=cM;class zC extends rt{_parse(e){const n=lt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ve.string&&r.parsedType!==ve.number){const i=lt.objectValues(n);return be(r,{expected:lt.joinValues(i),received:r.parsedType,code:de.invalid_type}),Ie}if(this._cache||(this._cache=new Set(lt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=lt.objectValues(n);return be(r,{received:r.data,code:de.invalid_enum_value,options:i}),Ie}return Gr(e.data)}get enum(){return this._def.values}}zC.create=(t,e)=>new zC({values:t,typeName:Be.ZodNativeEnum,...Ge(e)});class Ih extends rt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.promise&&n.common.async===!1)return be(n,{code:de.invalid_type,expected:ve.promise,received:n.parsedType}),Ie;const r=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return Gr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Ih.create=(t,e)=>new Ih({type:t,typeName:Be.ZodPromise,...Ge(e)});class Da extends rt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:l=>{be(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const l=i.transform(r.data,s);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return Ie;const f=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return f.status==="aborted"?Ie:f.status==="dirty"||n.value==="dirty"?ru(f.value):f});{if(n.value==="aborted")return Ie;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?Ie:c.status==="dirty"||n.value==="dirty"?ru(c.value):c}}if(i.type==="refinement"){const l=c=>{const f=i.refinement(c,s);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ie:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Ie:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Oa(l))return Ie;const c=i.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>Oa(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):Ie);lt.assertNever(i)}}Da.create=(t,e,n)=>new Da({schema:t,typeName:Be.ZodEffects,effect:e,...Ge(n)});Da.createWithPreprocess=(t,e,n)=>new Da({schema:e,effect:{type:"preprocess",transform:t},typeName:Be.ZodEffects,...Ge(n)});class io extends rt{_parse(e){return this._getType(e)===ve.undefined?Gr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}io.create=(t,e)=>new io({innerType:t,typeName:Be.ZodOptional,...Ge(e)});class Ra extends rt{_parse(e){return this._getType(e)===ve.null?Gr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ra.create=(t,e)=>new Ra({innerType:t,typeName:Be.ZodNullable,...Ge(e)});class lb extends rt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}lb.create=(t,e)=>new lb({innerType:t,typeName:Be.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ge(e)});class ab extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Nh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ms(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ms(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ab.create=(t,e)=>new ab({innerType:t,typeName:Be.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ge(e)});class LC extends rt{_parse(e){if(this._getType(e)!==ve.nan){const r=this._getOrReturnCtx(e);return be(r,{code:de.invalid_type,expected:ve.nan,received:r.parsedType}),Ie}return{status:"valid",value:e.data}}}LC.create=t=>new LC({typeName:Be.ZodNaN,...Ge(t)});class n3 extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Mx extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ie:s.status==="dirty"?(n.dirty(),ru(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ie:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Mx({in:e,out:n,typeName:Be.ZodPipeline})}}class cb extends rt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Oa(i)&&(i.value=Object.freeze(i.value)),i);return Nh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}cb.create=(t,e)=>new cb({innerType:t,typeName:Be.ZodReadonly,...Ge(e)});var Be;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Be||(Be={}));uo.create;wi.create;Lh.create;jh.create;nl.create;const _i=_a.create;Ih.create;io.create;Ra.create;_i(["highlight","comment","flag"]);_i(["pending","accepted","dismissed"]);_i(["yellow","red","green","blue","purple"]);_i(["info","warning","error","success"]);const r3=_i(["solo","tandem"]);_i(["user","claude","import"]);_i(["accept","dismiss"]);_i(["markdown","json"]);_i(["md","txt","html","docx"]);_i(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);const i3=[{title:"Editor",rows:[{keys:["Ctrl","B"],description:"Bold"},{keys:["Ctrl","I"],description:"Italic"},{keys:["Ctrl","Z"],description:"Undo"},{keys:["Ctrl","Y"],description:"Redo"},{keys:["Ctrl","S"],description:"Save document"}]},{title:"Review Mode",rows:[{keys:["Tab"],description:"Next annotation"},{keys:["Shift","Tab"],description:"Previous annotation"},{keys:["Y"],description:"Accept annotation"},{keys:["N"],description:"Reject annotation"},{keys:["Z"],description:"Undo last accept/reject"},{keys:["E"],description:"Examine (scroll & exit)"},{keys:["Escape"],description:"Exit review mode"}]},{title:"Chat",rows:[{keys:["Enter"],description:"Send message"}]},{title:"Tabs",rows:[{keys:["Ctrl","Tab"],description:"Next tab"},{keys:["Ctrl","Shift","Tab"],description:"Previous tab"},{keys:["Alt","←"],description:"Move tab left"},{keys:["Alt","→"],description:"Move tab right"}]},{title:"General",rows:[{keys:["?"],description:"Show / hide this help"}]}];function s3({open:t,onClose:e}){return O.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?k.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:e,"data-testid":"help-modal",children:k.jsxs("div",{style:{backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:"8px",boxShadow:"0 8px 32px rgba(0,0,0,0.18)",padding:"24px 28px 20px",width:"480px",maxWidth:"90vw",maxHeight:"80vh",overflowY:"auto",position:"relative"},onClick:n=>n.stopPropagation(),children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[k.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"#1a1a1a"},children:"Keyboard Shortcuts"}),k.jsx("button",{type:"button",onClick:e,"aria-label":"Close help","data-testid":"help-modal-close",style:{background:"none",border:"none",cursor:"pointer",fontSize:"18px",color:"#666",lineHeight:1,padding:"2px 6px",borderRadius:"4px"},children:"✕"})]}),i3.map(n=>k.jsxs("div",{style:{marginBottom:"18px"},children:[k.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"#888",marginBottom:"6px"},children:n.title}),k.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:k.jsx("tbody",{children:n.rows.map(r=>k.jsxs("tr",{children:[k.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:k.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>k.jsxs("span",{children:[k.jsx("kbd",{style:{display:"inline-block",padding:"1px 6px",fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"#f5f5f5",border:"1px solid #d4d4d4",borderBottom:"2px solid #bbb",borderRadius:"4px",color:"#333",lineHeight:"1.5"},children:i}),s<r.keys.length-1&&k.jsx("span",{style:{color:"#aaa",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),k.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"#444",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),k.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid #f0f0f0",fontSize:"11px",color:"#aaa",textAlign:"center"},children:["Press"," ",k.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"#f5f5f5",border:"1px solid #ddd",borderRadius:"3px"},children:"?"})," ","or"," ",k.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"#f5f5f5",border:"1px solid #ddd",borderRadius:"3px"},children:"Esc"})," ","to close"]})]})}):null}const o3=[{title:"Review an annotation",text:"Open the side panel and accept or dismiss one of the highlighted annotations. Try Review Mode (Ctrl+Shift+R) for keyboard shortcuts."},{title:"Ask a question",text:"Select text, click Comment, and check the @Claude toggle to direct it to Claude — or type in the Chat panel."},{title:"Make an edit",text:"Click in the document and type something. All changes sync in real-time."},{title:"You're ready!",text:"You've learned the basics. Press ? anytime to see keyboard shortcuts."}],Hd=3;function l3({currentStep:t,onNext:e,onDismiss:n}){const r=o3[t];if(!r)return null;const i=t>=Hd;return k.jsxs("div",{"data-testid":"onboarding-tutorial",style:{position:"fixed",bottom:48,left:24,zIndex:900,maxWidth:340,background:"white",borderLeft:"4px solid #6366f1",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08)",padding:"16px 20px",fontFamily:"inherit"},children:[!i&&k.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:Hd},(s,l)=>k.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:l<=t?"#6366f1":"#e5e7eb",transition:"background 0.2s"}},l))}),k.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#1f2937",marginBottom:6},children:r.title}),k.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"#4b5563",marginBottom:i?0:14},children:r.text}),!i&&k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{style:{fontSize:11,color:"#9ca3af"},children:["Step ",t+1," of ",Hd]}),k.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[k.jsx("button",{"data-testid":"tutorial-dismiss-btn",onClick:n,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"#9ca3af",padding:0,textDecoration:"underline"},children:"Dismiss tutorial"}),k.jsx("button",{"data-testid":"tutorial-next-btn",onClick:e,style:{padding:"4px 12px",fontSize:12,border:"1px solid #d1d5db",borderRadius:4,background:"white",color:"#374151",cursor:"pointer",fontWeight:500},children:t===Hd-1?"Done":"Next"})]})]})]})}const zu=`http://localhost:${Ya}/api`;function a3(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function c3(t){return t.toLowerCase().endsWith(".docx")}async function uM(t){if(c3(t.name)){const e=await t.arrayBuffer();return a3(e)}return t.text()}const jC="tandem:reviewOnlyBannerDismissed";function IC({visible:t,documentId:e}){const[n,r]=O.useState(()=>{try{return localStorage.getItem(jC)==="true"}catch{return!1}}),[i,s]=O.useState(!1),[l,c]=O.useState(null);if(!t||n)return null;async function f(){if(!(!e||i)){s(!0),c(null);try{const d=await fetch(`${zu}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!d.ok){const p=await d.json().catch(()=>null);c((p==null?void 0:p.message)??`Conversion failed (HTTP ${d.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return k.jsxs("div",{"data-testid":"review-only-banner",style:{padding:"8px 16px",backgroundColor:"#eff6ff",borderBottom:"1px solid #bfdbfe",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"13px",color:"#1e40af",gap:"12px"},children:[k.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l&&k.jsx("span",{style:{color:"#dc2626",fontSize:"12px",maxWidth:"200px"},children:l}),e&&k.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:f,disabled:i,style:{background:"#2563eb",border:"none",color:"white",cursor:i?"default":"pointer",fontWeight:500,fontSize:"12px",padding:"4px 10px",borderRadius:"4px",whiteSpace:"nowrap",opacity:i?.6:1},children:i?"Converting…":"Convert to Markdown"}),k.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(jC,"true")}catch{}r(!0)},style:{background:"none",border:"none",color:"#1e40af",cursor:"pointer",fontWeight:500,fontSize:"13px",padding:"2px 8px",whiteSpace:"nowrap"},children:"Dismiss"})]})]})}const Ky=320;function u3({open:t,onClose:e,anchorRect:n,settings:r,onUpdate:i}){const s=O.useRef(null),[l,c]=O.useState(window.innerWidth);if(O.useEffect(()=>{if(!t)return;c(window.innerWidth);const b=()=>c(window.innerWidth);return window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[t]),O.useEffect(()=>{if(!t)return;const b=v=>{s.current&&!s.current.contains(v.target)&&e()},S=setTimeout(()=>document.addEventListener("mousedown",b),0);return()=>{clearTimeout(S),document.removeEventListener("mousedown",b)}},[t,e]),O.useEffect(()=>{if(!t)return;const b=S=>{S.key==="Escape"&&e()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t,e]),!t||!n)return null;const f=l<768,d=Math.max(8,Math.min(n.left+n.width/2-Ky/2,window.innerWidth-Ky-8)),p=n.bottom+6,m={fontSize:"11px",fontWeight:600,color:"#374151",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},g=(b,S)=>({flex:1,padding:"8px",border:b?"2px solid #6366f1":"2px solid #e5e7eb",borderRadius:"6px",background:S?"#f3f4f6":b?"#eef2ff":"#fff",cursor:S?"not-allowed":"pointer",textAlign:"center",fontSize:"11px",color:S?"#9ca3af":b?"#4338ca":"#6b7280",fontWeight:b?600:400,opacity:S?.6:1,transition:"border-color 0.15s, background 0.15s"});return k.jsxs("div",{ref:s,"data-testid":"settings-popover",style:{position:"fixed",left:`${d}px`,top:`${p}px`,width:`${Ky}px`,background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 24px rgba(0,0,0,0.12)",padding:"16px",zIndex:9999,display:"flex",flexDirection:"column",gap:"14px"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"#111827"},children:"Layout Settings"}),k.jsx("button",{onClick:e,style:{background:"none",border:"none",cursor:"pointer",color:"#9ca3af",fontSize:"16px",lineHeight:1,padding:"0 2px"},"aria-label":"Close settings",children:"×"})]}),k.jsxs("div",{children:[k.jsx("div",{style:m,children:"Layout"}),k.jsxs("div",{style:{display:"flex",gap:"8px"},children:[k.jsxs("button",{"data-testid":"layout-tabbed-btn",onClick:()=>i({layout:"tabbed"}),style:g(r.layout==="tabbed"),"aria-pressed":r.layout==="tabbed",children:[k.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[=|]"}),"Tabbed"]}),k.jsxs("button",{"data-testid":"layout-three-panel-btn",onClick:()=>{f||i({layout:"three-panel"})},style:g(r.layout==="three-panel",f),"aria-pressed":r.layout==="three-panel",title:f?"Requires viewport wider than 768px":void 0,children:[k.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[|||]"}),"Three-Panel"]})]}),f&&k.jsx("div",{style:{fontSize:"10px",color:"#9ca3af",marginTop:"4px"},children:"Three-panel requires a wider viewport"})]}),r.layout==="tabbed"&&k.jsxs("div",{children:[k.jsx("div",{style:m,children:"Default Tab"}),k.jsxs("div",{style:{display:"flex",gap:"8px"},children:[k.jsx("button",{"data-testid":"default-tab-chat-btn",onClick:()=>i({primaryTab:"chat"}),style:g(r.primaryTab==="chat"),"aria-pressed":r.primaryTab==="chat",children:"Chat"}),k.jsx("button",{"data-testid":"default-tab-annotations-btn",onClick:()=>i({primaryTab:"annotations"}),style:g(r.primaryTab==="annotations"),"aria-pressed":r.primaryTab==="annotations",children:"Annotations"})]})]}),r.layout==="three-panel"&&k.jsxs("div",{children:[k.jsx("div",{style:m,children:"Panel Order"}),k.jsxs("div",{style:{display:"flex",gap:"8px"},children:[k.jsx("button",{"data-testid":"panel-order-cea-btn",onClick:()=>i({panelOrder:"chat-editor-annotations"}),style:g(r.panelOrder==="chat-editor-annotations"),"aria-pressed":r.panelOrder==="chat-editor-annotations",children:"Chat | Editor | Ann."}),k.jsx("button",{"data-testid":"panel-order-aec-btn",onClick:()=>i({panelOrder:"annotations-editor-chat"}),style:g(r.panelOrder==="annotations-editor-chat"),"aria-pressed":r.panelOrder==="annotations-editor-chat",children:"Ann. | Editor | Chat"})]})]}),k.jsxs("div",{children:[k.jsxs("div",{style:m,children:["Editor Width:"," ",k.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[r.editorWidthPercent,"%"]})]}),k.jsx("div",{style:{fontSize:"10px",color:"#9ca3af",marginBottom:"6px"},children:"How much of the available space the editor text fills"}),k.jsx("input",{"data-testid":"editor-width-slider",type:"range",min:50,max:100,step:5,value:r.editorWidthPercent,onChange:b=>i({editorWidthPercent:Number(b.target.value)}),style:{width:"100%",accentColor:"#6366f1"},"aria-label":"Editor width"}),k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"#9ca3af"},children:[k.jsx("span",{children:"50%"}),k.jsx("span",{children:"100%"})]})]}),k.jsxs("div",{children:[k.jsx("div",{style:m,children:"Authorship"}),k.jsxs("label",{"data-testid":"authorship-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"#374151"},children:[k.jsx("input",{type:"checkbox",checked:r.showAuthorship,onChange:b=>i({showAuthorship:b.target.checked}),style:{accentColor:"#6366f1"}}),k.jsx("span",{children:"Show who wrote what"})]}),k.jsxs("div",{style:{fontSize:"10px",color:"#9ca3af",marginTop:"4px"},children:["Highlights text by author: ",k.jsx("span",{style:{color:"#3b82f6"},children:"you"})," /"," ",k.jsx("span",{style:{color:"#ea8a1e"},children:"Claude"})]})]}),k.jsxs("div",{children:[k.jsxs("div",{style:m,children:["Selection Sensitivity:"," ",k.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[(r.selectionDwellMs/1e3).toFixed(1),"s"]})]}),k.jsx("div",{style:{fontSize:"10px",color:"#9ca3af",marginBottom:"6px"},children:"How long you must hold a selection before Claude notices it"}),k.jsx("input",{"data-testid":"dwell-time-slider",type:"range",min:Dh,max:Rh,step:100,value:r.selectionDwellMs,onChange:b=>i({selectionDwellMs:Number(b.target.value)}),style:{width:"100%",accentColor:"#6366f1"},"aria-label":"Selection dwell time"}),k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"#9ca3af"},children:[k.jsxs("span",{children:[(Dh/1e3).toFixed(1),"s"]}),k.jsxs("span",{children:[(Rh/1e3).toFixed(1),"s"]})]})]})]})}const f3={error:"#ef4444",warning:"#f59e0b",info:"#6366f1"};function d3({toasts:t,onDismiss:e}){return t.length===0?null:k.jsxs(k.Fragment,{children:[k.jsx("style",{children:`
50
+ @keyframes tandem-toast-slide-in {
51
+ from {
52
+ opacity: 0;
53
+ transform: translateX(40px);
54
+ }
55
+ to {
56
+ opacity: 1;
57
+ transform: translateX(0);
58
+ }
59
+ }
60
+ `}),k.jsx("div",{"data-testid":"toast-container",style:{position:"fixed",bottom:40,right:16,zIndex:1e3,display:"flex",flexDirection:"column",gap:8,maxWidth:360,pointerEvents:"none"},children:t.map(n=>k.jsx(h3,{toast:n,onDismiss:e},n.id))})]})}function h3({toast:t,onDismiss:e}){const n=f3[t.severity],r=t.severity==="info"?"status":"alert";return k.jsxs("div",{role:r,"data-testid":`toast-${t.id}`,style:{pointerEvents:"auto",background:"white",borderRadius:6,borderLeft:`4px solid ${n}`,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)",padding:"10px 32px 10px 12px",position:"relative",animation:"tandem-toast-slide-in 0.2s ease-out",fontSize:13,lineHeight:1.4,color:"#1f2937"},children:[k.jsx("span",{children:t.message}),t.count>1&&k.jsxs("span",{"data-testid":`toast-count-${t.id}`,style:{marginLeft:6,fontSize:11,fontWeight:600,color:n,background:`${n}18`,padding:"1px 5px",borderRadius:8},children:["×",t.count]}),k.jsx("button",{"data-testid":`toast-dismiss-${t.id}`,onClick:()=>e(t.id),style:{position:"absolute",top:6,right:6,border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#9ca3af",lineHeight:1,padding:"2px 4px"},"aria-label":"Dismiss notification",children:"×"})]})}function Cn(t){this.content=t}Cn.prototype={constructor:Cn,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 Cn(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 Cn(n)},addToStart:function(t,e){return new Cn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Cn(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 Cn(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=Cn.from(t),t.size?new Cn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Cn.from(t),t.size?new Cn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Cn.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}};Cn.from=function(t){if(t instanceof Cn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Cn(e)};function fM(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=fM(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function dM(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),f=l.nodeSize;if(l==c){n-=f,r-=f;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let d=0,p=Math.min(l.text.length,c.text.length);for(;d<p&&l.text[l.text.length-d-1]==c.text[c.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let d=dM(l.content,c.content,n-1,r-1);if(d)return d}n-=f,r-=f}}class te{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 f=this.content[l],d=c+f.nodeSize;if(d>e&&r(f,i+c,s||null,l)!==!1&&f.content.size){let p=c+1;f.nodesBetween(Math.max(0,e-p),Math.min(f.content.size,n-p),r,i+p)}c=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,f)=>{let d=c.isText?c.text.slice(Math.max(e,f)-f,n-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&d||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},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 te(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],f=l+c.nodeSize;f>e&&((l<e||f>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=f}return new te(r,i)}cutByIndex(e,n){return e==n?te.empty:e==0&&n==this.content.length?this:new te(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 te(i,s)}addToStart(e){return new te([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new te(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 fM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return dM(this,e,n,r)}findIndex(e){if(e==0)return Vd(0,e);if(e==this.size)return Vd(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?Vd(n+1,s):Vd(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 te.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new te(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return te.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 te(n||e,r)}static from(e){if(!e)return te.empty;if(e instanceof te)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new te([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}te.empty=new te([],0);const Wy={index:0,offset:0};function Vd(t,e){return Wy.index=t,Wy.offset=e,Wy}function Bh(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(!Bh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Bh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let vt=class ub{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&&Bh(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 ub.none;if(e instanceof ub)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};vt.none=[];class Uh extends Error{}class pe{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=pM(this.content,e+this.openStart,n);return r&&new pe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new pe(hM(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 pe.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 pe(te.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 pe(e,r,i)}}pe.empty=new pe(te.empty,0,0);function hM(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(hM(s.content,e-i-1,n-i-1)))}function pM(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=pM(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function p3(t,e,n){if(n.openStart>t.depth)throw new Uh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Uh("Inconsistent open depths");return mM(t,e,n,0)}function mM(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=mM(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 Go(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=m3(n,t);return Go(s,yM(t,l,c,e,r))}else return Go(s,Hh(t,e,r))}function gM(t,e){if(!e.type.compatibleContent(t.type))throw new Uh("Cannot join "+e.type.name+" onto "+t.type.name)}function fb(t,e,n){let r=t.node(n);return gM(r,e.node(n)),r}function Wo(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 cu(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&&(Wo(t.nodeAfter,r),s++));for(let c=s;c<l;c++)Wo(i.child(c),r);e&&e.depth==n&&e.textOffset&&Wo(e.nodeBefore,r)}function Go(t,e){return t.type.checkContent(e),t.copy(e)}function yM(t,e,n,r,i){let s=t.depth>i&&fb(t,e,i+1),l=r.depth>i&&fb(n,r,i+1),c=[];return cu(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(gM(s,l),Wo(Go(s,yM(t,e,n,r,i+1)),c)):(s&&Wo(Go(s,Hh(t,e,i+1)),c),cu(e,n,i,c),l&&Wo(Go(l,Hh(n,r,i+1)),c)),cu(r,null,i,c),new te(c)}function Hh(t,e,n){let r=[];if(cu(null,t,n,r),t.depth>n){let i=fb(t,e,n+1);Wo(Go(i,Hh(t,e,n+1)),r)}return cu(e,null,n,r),new te(r)}function m3(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(te.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Lu{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 vt.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 Vh(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:f}=l.content.findIndex(s),d=s-f;if(r.push(l,c,i+f),!d||(l=l.child(c),l.isText))break;s=d-1,i+=f+1}return new Lu(n,r,s)}static resolveCached(e,n){let r=BC.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 BC.set(e,r=new g3);let i=r.elts[r.i]=Lu.resolve(e,n);return r.i=(r.i+1)%y3,i}}class g3{constructor(){this.elts=[],this.i=0}}const y3=12,BC=new WeakMap;class Vh{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 b3=Object.create(null);let so=class db{constructor(e,n,r,i=vt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||te.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&&Bh(this.attrs,n||e.defaultAttrs||b3)&&vt.sameSet(this.marks,r||vt.none)}copy(e=null){return e==this.content?this:new db(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new db(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 pe.empty;let i=this.resolve(e),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),d=i.node(l).content.cut(i.pos-c,s.pos-c);return new pe(d,i.depth-l,s.depth-l)}replace(e,n,r){return p3(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 Lu.resolveCached(this,e)}resolveNoCache(e){return Lu.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()+")"),bM(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=te.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 f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).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=vt.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(!vt.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=te.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};so.prototype.text=void 0;class Ph extends so{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):bM(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 Ph(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ph(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 bM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class rl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new x3(e,n);if(r.next==null)return rl.empty;let i=xM(r);r.next&&r.err("Unexpected trailing text");let s=T3(E3(i));return A3(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 f=l.matchFragment(e,r);if(f&&(!n||f.validEnd))return te.from(c.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:p,next:m}=l.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,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:f}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||f.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(`
61
+ `)}}rl.empty=new rl(!0);class x3{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 xM(t){let e=[];do e.push(S3(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function S3(t){let e=[];do e.push(w3(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function w3(t){let e=C3(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=v3(t,e);else break;return e}function UC(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function v3(t,e){let n=UC(t),r=n;return t.eat(",")&&(t.next!="}"?r=UC(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function k3(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 C3(t){if(t.eat("(")){let e=xM(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=k3(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 E3(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,f){let d={term:f,to:c};return e[l].push(d),d}function i(l,c){l.forEach(f=>f.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((f,d)=>f.concat(s(d,c)),[]);if(l.type=="seq")for(let f=0;;f++){let d=s(l.exprs[f],c);if(f==l.exprs.length-1)return d;i(d,c=n())}else if(l.type=="star"){let f=n();return r(c,f),i(s(l.expr,f),f),[r(f)]}else if(l.type=="plus"){let f=n();return i(s(l.expr,c),f),i(s(l.expr,f),f),[r(f)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let f=c;for(let d=0;d<l.min;d++){let p=n();i(s(l.expr,f),p),f=p}if(l.max==-1)i(s(l.expr,f),f);else for(let d=l.min;d<l.max;d++){let p=n();r(f,p),i(s(l.expr,f),p),f=p}return[r(f)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function SM(t,e){return e-t}function HC(t,e){let n=[];return r(e),n.sort(SM);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:f}=s[l];!c&&n.indexOf(f)==-1&&r(f)}}}function T3(t){let e=Object.create(null);return n(HC(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:f})=>{if(!c)return;let d;for(let p=0;p<i.length;p++)i[p][0]==c&&(d=i[p][1]);HC(t,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=e[r.join(",")]=new rl(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(SM);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function A3(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:f,next:d}=i.next[c];l.push(f.name),s&&!(f.isText||f.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function wM(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 vM(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 kM(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 CM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new O3(t,r,e[r]);return n}let VC=class EM{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=CM(e,r.attrs),this.defaultAttrs=wM(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==rl.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:vM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new so(this,this.computeAttrs(e),te.from(n),vt.setFrom(r))}createChecked(e=null,n,r){return n=te.from(n),this.checkContent(n),new so(this,this.computeAttrs(e),n,vt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=te.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(te.empty,!0);return s?new so(this,e,n.append(s),vt.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){kM(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:vt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new EM(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 M3(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 O3{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?M3(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Gp{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=CM(e,i.attrs),this.excluded=null;let s=wM(this.attrs);this.instance=s?new vt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new vt(this,vM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new Gp(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){kM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let TM=class{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=Cn.from(e.nodes),n.marks=Cn.from(e.marks||{}),this.nodes=VC.compile(this.spec.nodes,this),this.marks=Gp.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]=rl.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?PC(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==""?[]:PC(this,l.split(" "))}this.nodeFromJSON=i=>so.fromJSON(this,i),this.markFromJSON=i=>vt.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 VC){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 Ph(r,r.defaultAttrs,e,vt.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 PC(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 f=t.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=f)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function _3(t){return t.tag!=null}function D3(t){return t.style!=null}let uu=class hb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(_3(i))this.tags.push(i);else if(D3(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 FC(this,n,!1);return r.addAll(e,vt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new FC(this,n,!0);return r.addAll(e,vt.none,n.from,n.to),pe.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(z3(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 f=l.getAttrs(n);if(f===!1)continue;l.attrs=f||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=qC(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=qC(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new hb(e,hb.schemaRules(e)))}};const AM={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},R3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},MM={ol:!0,ul:!0},ju=1,pb=2,fu=4;function $C(t,e,n){return e!=null?(e?ju:0)|(e==="full"?pb:0):t&&t.whitespace=="pre"?ju|pb:n&~fu}class Pd{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=vt.none,this.match=s||(l&fu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(te.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&ju)){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=te.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(te.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&&!AM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class FC{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=$C(null,n.preserveWhitespace,0)|(r?fu:0);i?s=new Pd(i.type,i.attrs,vt.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new Pd(null,null,vt.none,!0,null,l):s=new Pd(e.schema.topNodeType,null,vt.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&pb?"full":this.localPreserveWS||(i.options&ju)>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,`
62
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let f=0;f<c.length;f++)f&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[f]&&this.insertNode(l.text(c[f]),n,!/\S/.test(c[f]));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],f=e.previousSibling;(!c||f&&f.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;MM.hasOwnProperty(l)&&this.parser.normalizeLists&&N3(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(f?f.ignore:R3.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let d,p=this.needsBlock;if(AM.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=f&&f.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,f,d,f.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(`
63
+ `),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 f=this.parser.matchStyle(s,l,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(d=>!f.clearMark(d)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;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 f=this.enter(l,n.attrs||null,r,n.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.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(f=>this.insertNode(f,r,!1));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!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 f=this.nodes[l],d=f.findWrapping(e);if(d&&(!i||i.length>d.length+c)&&(i=d,s=f,!d.length))break;if(f.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=vt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):YC(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=$C(e,s,l.options);l.options&fu&&l.content.length==0&&(c|=fu);let f=vt.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):YC(d.type,e))?(f=d.addToSet(f),!1):!0),this.nodes.push(new Pd(e,n,f,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|=ju)}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,f)=>{for(;c>=0;c--){let d=n[c];if(d==""){if(c==n.length-1||c==0)continue;for(;f>=s;f--)if(l(c-1,f))return!0;return!1}else{let p=f>0||f==0&&i?this.nodes[f].type:r&&f>=s?r.node(f-s).type:null;if(!p||p.name!=d&&!p.isInGroup(d))return!1;f--}}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 N3(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&MM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function z3(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function qC(t){let e={};for(let n in t)e[n]=t[n];return e}function YC(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 f=0;f<c.edgeCount;f++){let{type:d,next:p}=c.edge(f);if(d==e||s.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class ml{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Gy(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,f=0;for(;c<s.length&&f<l.marks.length;){let d=l.marks[f];if(!this.marks[d.type.name]){f++;continue}if(!d.eq(s[c][0])||d.type.spec.spanning===!1)break;c++,f++}for(;c<s.length;)i=s.pop()[1];for(;f<l.marks.length;){let d=l.marks[f++],p=this.serializeMark(d,l.isInline,n);p&&(s.push([d,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}=mh(Gy(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&&mh(Gy(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return mh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ml(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=KC(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return KC(e.marks)}}function KC(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Gy(t){return t.document||window.document}const WC=new WeakMap;function L3(t){let e=WC.get(t);return e===void 0&&WC.set(t,e=j3(t)),e}function j3(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 mh(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=L3(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,f=n?t.createElementNS(n,i):t.createElement(i),d=e[1],p=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){p=2;for(let m in d)if(d[m]!=null){let g=m.indexOf(" ");g>0?f.setAttributeNS(m.slice(0,g),m.slice(g+1),d[m]):m=="style"&&f.style?f.style.cssText=d[m]:f.setAttribute(m,d[m])}}for(let m=p;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:S}=mh(t,g,n,r);if(f.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:f,contentDOM:c}}const OM=65535,_M=Math.pow(2,16);function I3(t,e){return t+e*_M}function GC(t){return t&OM}function B3(t){return(t-(t&OM))/_M}const DM=1,RM=2,gh=4,NM=8;class mb{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&NM)>0}get deletedBefore(){return(this.delInfo&(DM|gh))>0}get deletedAfter(){return(this.delInfo&(RM|gh))>0}get deletedAcross(){return(this.delInfo&gh)>0}}class xr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xr.empty)return xr.empty}recover(e){let n=0,r=GC(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+B3(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 f=this.ranges[c]-(this.inverted?i:0);if(f>e)break;let d=this.ranges[c+s],p=this.ranges[c+l],m=f+d;if(e<=m){let g=d?e==f?-1:e==m?1:n:n,b=f+i+(g<0?0:p);if(r)return b;let S=e==(n<0?f:m)?null:I3(c/3,e-f),v=e==f?RM:e==m?DM:gh;return(n<0?e!=f:e!=m)&&(v|=NM),new mb(b,v,S)}i+=p-d}return r?e+i:new mb(e+i,0,null)}touches(e,n){let r=0,i=GC(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>e)break;let d=this.ranges[c+s],p=f+d;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+l]-d}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),f=l+(this.inverted?0:s),d=this.ranges[i+n],p=this.ranges[i+r];e(c,c+d,f,f+p),s+=p-d}}invert(){return new xr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xr.empty:new xr(e<0?[0,-e,0]:[0,0,e])}}xr.empty=new xr([]);class Iu{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 Iu(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 Iu;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 f=this.getMirror(s);if(f!=null&&f>s&&f<this.to){s=f,e=this._maps[f].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new mb(e,i,null)}}const Zy=Object.create(null);class Bn{getMap(){return xr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Zy[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 Zy)throw new RangeError("Duplicate use of step JSON ID "+e);return Zy[e]=n,n.prototype.jsonID=e,n}}class en{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new en(e,null)}static fail(e){return new en(null,e)}static fromReplace(e,n,r,i){try{return en.ok(e.replace(n,r,i))}catch(s){if(s instanceof Uh)return en.fail(s.message);throw s}}}function Ox(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Ox(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return te.fromArray(r)}class eo extends Bn{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 pe(Ox(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 en.fromReplace(e,this.from,this.to,s)}invert(){return new Si(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 eo(n.pos,r.pos,this.mark)}merge(e){return e instanceof eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eo(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 eo(n.from,n.to,e.markFromJSON(n.mark))}}Bn.jsonID("addMark",eo);class Si extends Bn{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 pe(Ox(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return en.fromReplace(e,this.from,this.to,r)}invert(){return new eo(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 Si(n.pos,r.pos,this.mark)}merge(e){return e instanceof Si&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Si(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 Si(n.from,n.to,e.markFromJSON(n.mark))}}Bn.jsonID("removeMark",Si);class to extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return en.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return en.fromReplace(e,this.pos,this.pos+1,new pe(te.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 to(this.pos,n.marks[i]);return new to(this.pos,this.mark)}}return new il(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new to(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 to(n.pos,e.markFromJSON(n.mark))}}Bn.jsonID("addNodeMark",to);class il extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return en.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return en.fromReplace(e,this.pos,this.pos+1,new pe(te.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new to(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new il(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 il(n.pos,e.markFromJSON(n.mark))}}Bn.jsonID("removeNodeMark",il);class fn extends Bn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&gb(e,this.from,this.to)?en.fail("Structure replace would overwrite content"):en.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new xr([this.from,this.to-this.from,this.slice.size])}invert(e){return new fn(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 fn(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof fn)||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?pe.empty:new pe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new fn(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?pe.empty:new pe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new fn(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 fn(n.from,n.to,pe.fromJSON(e,n.slice),!!n.structure)}}Bn.jsonID("replace",fn);class dn extends Bn{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&&(gb(e,this.from,this.gapFrom)||gb(e,this.gapTo,this.to)))return en.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return en.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?en.fromReplace(e,this.from,this.to,r):en.fail("Content does not fit in gap")}getMap(){return new xr([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 dn(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 dn(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 dn(n.from,n.to,n.gapFrom,n.gapTo,pe.fromJSON(e,n.slice),n.insert,!!n.structure)}}Bn.jsonID("replaceAround",dn);function gb(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 U3(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(f,d,p)=>{if(!f.isInline)return;let m=f.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let g=Math.max(d,e),b=Math.min(d+f.nodeSize,n),S=r.addToSet(m);for(let v=0;v<m.length;v++)m[v].isInSet(S)||(l&&l.to==g&&l.mark.eq(m[v])?l.to=b:i.push(l=new Si(g,b,m[v])));c&&c.to==g?c.to=b:s.push(c=new eo(g,b,r))}}),i.forEach(f=>t.step(f)),s.forEach(f=>t.step(f))}function H3(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let f=null;if(r instanceof Gp){let d=l.marks,p;for(;p=r.isInSet(d);)(f||(f=[])).push(p),d=p.removeFromSet(d)}else r?r.isInSet(l.marks)&&(f=[r]):f=l.marks;if(f&&f.length){let d=Math.min(c+l.nodeSize,n);for(let p=0;p<f.length;p++){let m=f[p],g;for(let b=0;b<i.length;b++){let S=i[b];S.step==s-1&&m.eq(i[b].style)&&(g=S)}g?(g.to=d,g.step=s):i.push({style:m,from:Math.max(c,e),to:d,step:s})}}}),i.forEach(l=>t.step(new Si(l.from,l.to,l.style)))}function _x(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let f=0;f<s.childCount;f++){let d=s.child(f),p=c+d.nodeSize,m=r.matchType(d.type);if(!m)l.push(new fn(c,p,pe.empty));else{r=m;for(let g=0;g<d.marks.length;g++)n.allowsMarkType(d.marks[g].type)||t.step(new Si(c,p,d.marks[g]));if(i&&d.isText&&n.whitespace!="pre"){let g,b=/\r?\n|\r/g,S;for(;g=b.exec(d.text);)S||(S=new pe(te.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),l.push(new fn(c+g.index,c+g.index+g[0].length,S))}}c=p}if(!r.validEnd){let f=r.fillBefore(te.empty,!0);t.replace(c,c,new pe(f,0,0))}for(let f=l.length-1;f>=0;f--)t.step(l[f])}function V3(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ka(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,f=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,f,n))return r;if(r==0||l.type.spec.isolating||!V3(l,c,f))break;c&&(i=1),f<l.childCount&&(s=1)}return null}function P3(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),f=l,d=c,p=te.empty,m=0;for(let S=s,v=!1;S>n;S--)v||r.index(S)>0?(v=!0,p=te.from(r.node(S).copy(p)),m++):f--;let g=te.empty,b=0;for(let S=s,v=!1;S>n;S--)v||i.after(S+1)<i.end(S)?(v=!0,g=te.from(i.node(S).copy(g)),b++):d++;t.step(new dn(f,d,l,c,new pe(p.append(g),m,b),p.size-m,!0))}function Dx(t,e,n=null,r=t){let i=$3(t,e),s=i&&F3(r,e);return s?i.map(ZC).concat({type:e,attrs:n}).concat(s.map(ZC)):null}function ZC(t){return{type:t,attrs:null}}function $3(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 F3(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 f=(l.length?l[l.length-1]:e).contentMatch;for(let d=r;f&&d<i;d++)f=f.matchType(n.child(d).type);return!f||!f.validEnd?null:l}function q3(t,e,n){let r=te.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=te.from(n[l].type.create(n[l].attrs,r))}let i=e.start,s=e.end;t.step(new dn(i,s,i,s,new pe(r,0,0),n.length,!0))}function Y3(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 f=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,f)&&K3(t.doc,t.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?d=!1:!b&&S&&(d=!0)}d===!1&&LM(t,l,c,s),_x(t,t.mapping.slice(s).map(c,1),r,void 0,d===null);let p=t.mapping.slice(s),m=p.map(c,1),g=p.map(c+l.nodeSize,1);return t.step(new dn(m,g,m+1,g-1,new pe(te.from(r.create(f,null,l.marks)),0,0),1,!0)),d===!0&&zM(t,l,c,s),!1}})}function zM(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 f=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function LM(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(`
64
+ `))}})}function K3(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function W3(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 dn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new pe(te.from(l),0,0),1,!0))}function fs(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 d=i.depth-1,p=n-2;d>s;d--,p--){let m=i.node(d),g=i.index(d);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),S=r&&r[p+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let v=r&&r[p]||m;if(!m.canReplace(g+1,m.childCount)||!v.type.validContent(b))return!1}let c=i.indexAfter(s),f=r&&r[0];return i.node(s).canReplaceWith(c,c,f?f.type:i.node(s+1).type)}function G3(t,e,n=1,r){let i=t.doc.resolve(e),s=te.empty,l=te.empty;for(let c=i.depth,f=i.depth-n,d=n-1;c>f;c--,d--){s=te.from(i.node(c).copy(s));let p=r&&r[d];l=te.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}t.step(new fn(e,e,new pe(s.append(l),n,n),!0))}function yo(t,e){let n=t.resolve(e),r=n.index();return jM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Z3(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 jM(t,e){return!!(t&&e&&!t.isLeaf&&Z3(t,e))}function Zp(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&&jM(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 J3(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",m=!!l.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);LM(t,p.node(),p.before(),c)}l.inlineContent&&_x(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let f=t.mapping.slice(c),d=f.map(e-n);if(t.step(new fn(d,f.map(e+n,-1),pe.empty,!0)),r===!0){let p=t.doc.resolve(d);zM(t,p.node(),p.before(),t.steps.length)}return t}function X3(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 IM(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,f=r.index(l)+(c>0?1:0),d=r.node(l),p=!1;if(s==1)p=d.canReplace(f,f,i);else{let m=d.contentMatchAt(f).findWrapping(i.firstChild.type);p=m&&d.canReplaceWith(f,f,m[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function Jp(t,e,n=e,r=pe.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return BM(i,s,r)?new fn(e,n,r):new Q3(i,s,r).fit()}function BM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Q3{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=te.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=te.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):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 f=new pe(s,l,c);return e>-1?new dn(r.pos,e,this.$to.pos,this.$to.end(),f,n):f.size||r.pos!=this.$to.pos?new fn(r.pos,i.pos,f):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=Jy(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:f,match:d}=this.frontier[c],p,m=null;if(n==1&&(l?d.matchType(l.type)||(m=d.fillBefore(te.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(p=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Jy(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new pe(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=Jy(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new pe(iu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new pe(iu(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 v=0;v<s.length;v++)this.openFrontierNode(s[v]);let l=this.unplaced,c=r?r.content:l.content,f=l.openStart-e,d=0,p=[],{match:m,type:g}=this.frontier[n];if(i){for(let v=0;v<i.childCount;v++)p.push(i.child(v));m=m.matchFragment(i)}let b=c.size+e-(l.content.size-l.openEnd);for(;d<c.childCount;){let v=c.child(d),C=m.matchType(v.type);if(!C)break;d++,(d>1||f==0||v.content.size)&&(m=C,p.push(UM(v.mark(g.allowedMarks(v.marks)),d==1?f:0,d==c.childCount?b:-1)))}let S=d==c.childCount;S||(b=-1),this.placed=su(this.placed,n,te.from(p)),this.frontier[n].match=m,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,C=c;v<b;v++){let T=C.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),C=T.content}this.unplaced=S?e==0?pe.empty:new pe(iu(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new pe(iu(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Xy(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=Xy(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=Xy(e,c,d,f,!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=su(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=su(this.placed,this.depth,te.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(te.empty,!0);n.childCount&&(this.placed=su(this.placed,this.frontier.length,n))}}function iu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(iu(t.firstChild.content,e-1,n)))}function su(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(su(t.lastChild.content,e-1,n)))}function Jy(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function UM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,UM(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(te.empty,!0)))),t.copy(r)}function Xy(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&&!e4(n,s.content,l)?c:null}function e4(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function t4(t){return t.spec.defining||t.spec.definingForContent}function n4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(BM(i,s,r))return t.step(new fn(e,n,r));let l=VM(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let S=i.node(g).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==b&&l.splice(1,0,-g)}let f=l.indexOf(c),d=[],p=r.openStart;for(let g=r.content,b=0;;b++){let S=g.firstChild;if(d.push(S),b==r.openStart)break;g=S.content}for(let g=p-1;g>=0;g--){let b=d[g],S=t4(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))p=g;else if(S||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+p+1)%(r.openStart+1),S=d[b];if(S)for(let v=0;v<l.length;v++){let C=l[(v+f)%l.length],T=!0;C<0&&(T=!1,C=-C);let H=i.node(C-1),j=i.index(C-1);if(H.canReplaceWith(j,j,S.type,S.marks))return t.replace(i.before(C),T?s.after(C):n,new pe(HM(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let g=l.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=l[g];b<0||(e=i.before(b),n=s.after(b))}}function HM(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(HM(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(te.empty,!0))}return t}function r4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=X3(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new pe(te.from(r),0,0))}function i4(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=VM(r,i);for(let l=0;l<s.length;l++){let c=s[l],f=l==s.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(f||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 VM(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 ya extends Bn{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 en.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 en.fromReplace(e,this.pos,this.pos+1,new pe(te.from(i),0,n.isLeaf?0:1))}getMap(){return xr.empty}invert(e){return new ya(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 ya(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 ya(n.pos,n.attr,n.value)}}Bn.jsonID("attr",ya);class Bu extends Bn{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 en.ok(r)}getMap(){return xr.empty}invert(e){return new Bu(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 Bu(n.attr,n.value)}}Bn.jsonID("docAttr",Bu);let Na=class extends Error{};Na=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Na.prototype=Object.create(Error.prototype);Na.prototype.constructor=Na;Na.prototype.name="TransformError";class Rx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Iu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Na(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,f)=>{e=Math.min(e,c),n=Math.max(n,f)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=pe.empty){let i=Jp(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new pe(te.from(r),0,0))}delete(e,n){return this.replace(e,n,pe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return n4(this,e,n,r),this}replaceRangeWith(e,n,r){return r4(this,e,n,r),this}deleteRange(e,n){return i4(this,e,n),this}lift(e,n){return P3(this,e,n),this}join(e,n=1){return J3(this,e,n),this}wrap(e,n){return q3(this,e,n),this}setBlockType(e,n=e,r,i=null){return Y3(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return W3(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ya(e,n,r)),this}setDocAttribute(e,n){return this.step(new Bu(e,n)),this}addNodeMark(e,n){return this.step(new to(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 vt)n.isInSet(r.marks)&&this.step(new il(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new il(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 G3(this,e,n,r),this}addMark(e,n,r){return U3(this,e,n,r),this}removeMark(e,n,r){return H3(this,e,n,r),this}clearIncompatible(e,n,r){return _x(this,e,n,r),this}}const Qy=Object.create(null);class ze{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new PM(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=pe.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:f,$to:d}=l[c],p=e.mapping.slice(s);e.replaceRange(p.map(f.pos),p.map(d.pos),c?pe.empty:n),c==0&&QC(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],f=e.mapping.slice(r),d=f.map(l.pos),p=f.map(c.pos);s?e.deleteRange(d,p):(e.replaceRangeWith(d,p,n),QC(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new _e(e):ca(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?ca(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):ca(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 sr(e.node(0))}static atStart(e){return ca(e,e,0,0,1)||new sr(e)}static atEnd(e){return ca(e,e,e.content.size,e.childCount,-1)||new sr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qy[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 Qy)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qy[e]=n,n.prototype.jsonID=e,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}ze.prototype.visible=!0;class PM{constructor(e,n){this.$from=e,this.$to=n}}let JC=!1;function XC(t){!JC&&!t.parent.inlineContent&&(JC=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class _e extends ze{constructor(e,n=e){XC(e),XC(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 ze.near(r);let i=e.resolve(n.map(this.anchor));return new _e(i.parent.inlineContent?i:r,r)}replace(e,n=pe.empty){if(super.replace(e,n),n==pe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Xp(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 _e(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=ze.findFrom(n,r,!0)||ze.findFrom(n,-r,!0);if(s)n=s.$head;else return ze.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ze.findFrom(e,-r,!0)||ze.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new _e(e,n)}}ze.jsonID("text",_e);class Xp{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Xp(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class Me extends ze{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?ze.near(s):new Me(s)}content(){return new pe(te.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 Nx(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;ze.jsonID("node",Me);class Nx{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Xp(r,r):new Nx(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Me.isSelectable(r)?new Me(n):ze.near(n)}}class sr extends ze{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=pe.empty){if(n==pe.empty){e.delete(0,e.doc.content.size);let r=ze.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new sr(e)}map(e){return new sr(e)}eq(e){return e instanceof sr}getBookmark(){return s4}}ze.jsonID("all",sr);const s4={map(){return this},resolve(t){return new sr(t)}};function ca(t,e,n,r,i,s=!1){if(e.inlineContent)return _e.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 f=ca(t,c,n+i,i<0?c.childCount:0,i,s);if(f)return f}n+=c.nodeSize*i}return null}function QC(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof fn||i instanceof dn))return;let s=t.mapping.maps[r],l;s.forEach((c,f,d,p)=>{l==null&&(l=p)}),t.setSelection(ze.near(t.doc.resolve(l),n))}const eE=1,$d=2,tE=4;let o4=class extends Rx{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|eE)&~$d,this.storedMarks=null,this}get selectionSet(){return(this.updated&eE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=$d,this}ensureMarks(e){return vt.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&$d)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~$d,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)||vt.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(ze.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|=tE,this}get scrolledIntoView(){return(this.updated&tE)>0}};function nE(t,e){return!e||!t?t:t.bind(e)}class ou{constructor(e,n,r){this.name=e,this.init=nE(n.init,r),this.apply=nE(n.apply,r)}}const l4=[new ou("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ou("selection",{init(t,e){return t.selection||ze.atStart(e.doc)},apply(t){return t.selection}}),new ou("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ou("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class e0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=l4.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 ou(r.key,r.spec.state,r))})}}class ha{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 f=i?i[l].n:0,d=i?i[l].state:this,p=f<n.length&&c.spec.appendTransaction.call(c,f?n.slice(f):n,d,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<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 ha(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 o4(this)}static create(e){let n=new e0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ha(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 e0(this.schema,e.plugins),r=n.fields,i=new ha(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 e0(e.schema,e.plugins),s=new ha(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=so.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=ze.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 f=r[c],d=f.spec.state;if(f.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=d.fromJSON.call(f,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function $M(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=$M(i,e,{})),n[r]=i}return n}class xt{constructor(e){this.spec=e,this.props={},e.props&&$M(e.props,this,this.props),this.key=e.key?e.key.key:FM("plugin")}getState(e){return e[this.key]}}const t0=Object.create(null);function FM(t){return t in t0?t+"$"+ ++t0[t]:(t0[t]=0,t+"$")}class Rt{constructor(e="key"){this.key=FM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Tn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},za=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let yb=null;const cs=function(t,e,n){let r=yb||(yb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},a4=function(){yb=null},sl=function(t,e,n,r){return n&&(rE(t,e,n,r,-1)||rE(t,e,n,r,1))},c4=/^(img|br|input|textarea|hr)$/i;function rE(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Vr(t))){let l=t.parentNode;if(!l||l.nodeType!=1||df(t)||c4.test(t.nodeName)||t.contentEditable=="false")return!1;e=Tn(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?Vr(t):0}else return!1}}function Vr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function u4(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=Vr(t)}else if(t.parentNode&&!df(t))e=Tn(t),t=t.parentNode;else return null}}function f4(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&&!df(t))e=Tn(t)+1,t=t.parentNode;else return null}}function d4(t,e,n){for(let r=e==0,i=e==Vr(t);r||i;){if(t==n)return!0;let s=Tn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Vr(t)}}function df(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 Qp=function(t){return t.focusNode&&sl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ho(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function h4(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function p4(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Vr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Vr(r.startContainer),r.startOffset)}}}const Ci=typeof navigator<"u"?navigator:null,iE=typeof document<"u"?document:null,bo=Ci&&Ci.userAgent||"",bb=/Edge\/(\d+)/.exec(bo),qM=/MSIE \d/.exec(bo),xb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bo),or=!!(qM||xb||bb),oo=qM?document.documentMode:xb?+xb[1]:bb?+bb[1]:0,qr=!or&&/gecko\/(\d+)/i.test(bo);qr&&+(/Firefox\/(\d+)/.exec(bo)||[0,0])[1];const Sb=!or&&/Chrome\/(\d+)/.exec(bo),Mn=!!Sb,YM=Sb?+Sb[1]:0,Ln=!or&&!!Ci&&/Apple Computer/.test(Ci.vendor),La=Ln&&(/Mobile\/\w+/.test(bo)||!!Ci&&Ci.maxTouchPoints>2),Ur=La||(Ci?/Mac/.test(Ci.platform):!1),KM=Ci?/Win/.test(Ci.platform):!1,us=/Android \d/.test(bo),hf=!!iE&&"webkitFontSmoothing"in iE.documentElement.style,m4=hf?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function g4(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 ns(t,e){return typeof t=="number"?t:t[e]}function y4(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 sE(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=za(l);continue}let c=l,f=c==s.body,d=f?g4(s):y4(c),p=0,m=0;if(e.top<d.top+ns(r,"top")?m=-(d.top-e.top+ns(i,"top")):e.bottom>d.bottom-ns(r,"bottom")&&(m=e.bottom-e.top>d.bottom-d.top?e.top+ns(i,"top")-d.top:e.bottom-d.bottom+ns(i,"bottom")),e.left<d.left+ns(r,"left")?p=-(d.left-e.left+ns(i,"left")):e.right>d.right-ns(r,"right")&&(p=e.right-d.right+ns(i,"right")),p||m)if(f)s.defaultView.scrollBy(p,m);else{let b=c.scrollLeft,S=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let v=c.scrollLeft-b,C=c.scrollTop-S;e={left:e.left-v,top:e.top-C,right:e.right-v,bottom:e.bottom-C}}let g=f?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:za(l)}}function b4(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 f=c.getBoundingClientRect();if(f.top>=n-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:WM(t.dom)}}function WM(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=za(r));return e}function x4({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;GM(n,r==0?0:r-e)}function GM(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 ra=null;function S4(t){if(t.setActive)return t.setActive();if(ra)return t.focus(ra);let e=WM(t);t.focus(ra==null?{get preventScroll(){return ra={preventScroll:!0},!0}}:void 0),ra||(ra=!1,GM(e,0))}function ZM(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,f,d;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let g;if(p.nodeType==1)g=p.getClientRects();else if(p.nodeType==3)g=cs(p).getClientRects();else continue;for(let b=0;b<g.length;b++){let S=g[b];if(S.top<=l&&S.bottom>=c){l=Math.max(S.bottom,l),c=Math.min(S.top,c);let v=S.left>e.left?S.left-e.left:S.right<e.left?e.left-S.right:0;if(v<r){n=p,r=v,i=v&&n.nodeType==3?{left:S.right<e.left?S.right:S.left,top:e.top}:e,p.nodeType==1&&v&&(s=m+(e.left>=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!f&&S.left<=e.left&&S.right>=e.left&&(f=p,d={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(s=m+1)}}return!n&&f&&(n=f,i=d,r=0),n&&n.nodeType==3?w4(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:ZM(n,i)}function w4(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=qs(r,1);if(l.top!=l.bottom&&zx(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 zx(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function v4(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function k4(t,e,n){let{node:r,offset:i}=ZM(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 C4(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),f;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((f=c.dom.getBoundingClientRect()).width||f.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&f.left>r.left||f.top>r.top?i=c.posBefore:(!l&&f.right<r.left||f.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(f.top+f.bottom)/2:r.left<(f.left+f.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function JM(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 f=0;f<c.length;f++){let d=c[f];if(zx(e,d))return JM(l,e,d)}}if((s=(s+1)%r)==i)break}return t}function E4(t,e){let n=t.dom.ownerDocument,r,i=0,s=p4(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 d=t.dom.getBoundingClientRect();if(!zx(e,d)||(l=JM(t.dom,e,d),!l))return null}if(Ln)for(let d=l;r&&d;d=za(d))d.draggable&&(r=void 0);if(l=v4(l,e),r){if(qr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],m;p.nodeName=="IMG"&&(m=p.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let d;hf&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.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=C4(t,r,i,e))}c==null&&(c=k4(t,l,e));let f=t.docView.nearestDesc(l,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function oE(t){return t.top<t.bottom||t.left<t.right}function qs(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(oE(r))return r}return Array.prototype.find.call(n,oE)||t.getBoundingClientRect()}const T4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function XM(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=hf||qr;if(r.nodeType==3)if(l&&(T4.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let f=qs(cs(r,i,i),n);if(qr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=qs(cs(r,i-1,i-1),-1);if(d.top==f.top){let p=qs(cs(r,i,i+1),-1);if(p.top!=f.top)return Jc(p,p.left<d.left)}}return f}else{let f=i,d=i,p=n<0?1:-1;return n<0&&!i?(d++,p=-1):n>=0&&i==r.nodeValue.length?(f--,p=1):n<0?f--:d++,Jc(qs(cs(r,f,d),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Vr(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return n0(f.getBoundingClientRect(),!1)}if(s==null&&i<Vr(r)){let f=r.childNodes[i];if(f.nodeType==1)return n0(f.getBoundingClientRect(),!0)}return n0(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Vr(r))){let f=r.childNodes[i-1],d=f.nodeType==3?cs(f,Vr(f)-(l?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return Jc(qs(d,1),!1)}if(s==null&&i<Vr(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?cs(f,0,l?0:1):f.nodeType==1?f:null:null;if(d)return Jc(qs(d,-1),!0)}return Jc(qs(r.nodeType==3?cs(r):r,-n),n>=0)}function Jc(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 n0(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 QM(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 A4(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return QM(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=XM(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=cs(c,0,c.nodeValue.length).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];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 M4=/[\u0590-\u08ac]/;function O4(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?!M4.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:QM(t,e,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:S,focusOffset:v}=t.domSelectionRange(),C=S&&!b.contains(S.nodeType==1?S:S.parentNode)||f==S&&d==v;try{c.collapse(p,m),f&&(f!=p||d!=m)&&c.extend&&c.extend(f,d)}catch{}return g!=null&&(c.caretBidiLevel=g),C}):r.pos==r.start()||r.pos==r.end()}let lE=null,aE=null,cE=!1;function _4(t,e,n){return lE==e&&aE==n?cE:(lE=e,aE=n,cE=n=="up"||n=="down"?A4(t,e,n):O4(t,e,n))}const Yr=0,uE=1,Fo=2,Ei=3;class pf{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Yr,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>Tn(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 tO){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 eO&&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?Tn(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?Tn(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 f=this.children[c],d=l+f.size;if(i==-1&&e<=d){let p=l+f.border;if(e>=p&&n<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(e,n,p);e=l;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Tn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(d>n||c==this.children.length-1)){n=d;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Tn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}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 b=0,S=0;b<this.children.length;b++){let v=this.children[b],C=S+v.size;if(s>S&&l<C)return v.setSelection(e-S-v.border,n-S-v.border,r,i);S=C}let c=this.domFromPos(e,e?-1:1),f=n==e?c:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((qr||Ln)&&e==n){let{node:b,offset:S}=c;if(b.nodeType==3){if(m=!!(S&&b.nodeValue[S-1]==`
65
+ `),m&&S==b.nodeValue.length)for(let v=b,C;v;v=v.parentNode){if(C=v.nextSibling){C.nodeName=="BR"&&(c=f={node:C.parentNode,offset:Tn(C)+1});break}let T=v.pmViewDesc;if(T&&T.node&&T.node.isBlock)break}}else{let v=b.childNodes[S-1];m=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(qr&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let b=p.focusNode.childNodes[p.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&Ln)&&sl(c.node,c.offset,p.anchorNode,p.anchorOffset)&&sl(f.node,f.offset,p.focusNode,p.focusOffset))return;let g=!1;if((d.extend||e==n)&&!(m&&qr)){d.collapse(c.node,c.offset);try{e!=n&&d.extend(f.node,f.offset),g=!0}catch{}}if(!g){if(e>n){let S=c;c=f,f=S}let b=document.createRange();b.setEnd(f.node,f.offset),b.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(b)}}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,f=l-s.border;if(e>=c&&n<=f){this.dirty=e==r||n==l?Fo:uE,e==c&&n==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ei:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Fo:Ei}r=l}this.dirty=Fo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Fo:uE;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class eO extends pf{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==Yr&&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 D4 extends pf{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 ol extends pf{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=ml.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ol(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Ei||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ei&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Yr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Yr}}slice(e,n,r){let i=ol.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=vb(s,n,l,r)),e>0&&(s=vb(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 lo extends pf{constructor(e,n,r,i,s,l,c,f,d){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],f,d=c&&c(n,s,()=>{if(!f)return l;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,m=d&&d.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:m}=ml.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let g=p;return p=iO(p,r,n),d?f=new R4(e,n,r,i,p,m||null,g,d,s,l+1):n.isText?new em(e,n,r,i,p,g,s):new lo(e,n,r,i,p,m||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=()=>te.empty)}return e}matchesNode(e,n,r){return this.dirty==Yr&&e.eq(this.node)&&$h(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,f=new z4(this,l&&l.node,e);I4(this.node,this.innerDeco,(d,p,m)=>{d.spec.marks?f.syncToMarks(d.spec.marks,r,e,p):d.type.side>=0&&!m&&f.syncToMarks(p==this.node.childCount?vt.none:this.node.child(p).marks,r,e,p),f.placeWidget(d,e,i)},(d,p,m,g)=>{f.syncToMarks(d.marks,r,e,g);let b;f.findNodeMatch(d,p,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(b=f.findIndexWithChild(s.node))>-1&&f.updateNodeAt(d,p,m,b,e)||f.updateNextNode(d,p,m,e,g,i)||f.addNode(d,p,m,e,i),i+=d.nodeSize}),f.syncToMarks([],r,e,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==Fo)&&(l&&this.protectLocalComposition(e,l),nO(this.contentDOM,this.children,e),La&&B4(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof _e)||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=U4(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 D4(this,s,n,i);e.input.compositionNodes.push(l),this.children=vb(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Ei||!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=Yr}updateOuterDeco(e){if($h(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=rO(this.dom,this.nodeDOM,wb(this.outerDeco,this.node,n),wb(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 fE(t,e,n,r,i){iO(r,e,t);let s=new lo(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class em extends lo{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==Ei||this.dirty!=Yr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Yr||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=Yr,!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 em(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=Ei)}get domAtom(){return!1}isText(e){return this.node.text==e}}class tO extends pf{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Yr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class R4 extends lo{constructor(e,n,r,i,s,l,c,f,d,p){super(e,n,r,i,s,l,c,d,p),this.spec=f}update(e,n,r,i){if(this.dirty==Ei)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 nO(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=dE(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof ol){let f=r?r.previousSibling:t.lastChild;nO(l.contentDOM,l.children,n),r=f?f.nextSibling:t.firstChild}}for(;r;)r=dE(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const du=function(t){t&&(this.nodeName=t)};du.prototype=Object.create(null);const qo=[new du];function wb(t,e,n){if(t.length==0)return qo;let r=n?qo[0]:new du,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new du(l.nodeName));for(let c in l){let f=l[c];f!=null&&(n&&i.length==1&&i.push(r=new du(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+f:c=="style"?r.style=(r.style?r.style+";":"")+f:c!="nodeName"&&(r[c]=f))}}}return i}function rO(t,e,n,r){if(n==qo&&r==qo)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let f;c&&c.nodeName==l.nodeName&&i!=t&&(f=i.parentNode)&&f.nodeName.toLowerCase()==l.nodeName||(f=document.createElement(l.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=qo[0]),i=f}N4(i,c||qo[0],l)}return i}function N4(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 iO(t,e,n){return rO(t,t,qo,wb(e,n,t.nodeType!=1))}function $h(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 dE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class z4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=L4(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=Yr,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let f=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let p=this.index;p<d;p++){let m=this.top.children[p];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){f=p;break}}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=ol.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,f=Math.min(this.top.children.length,c+5);c<f;c++){let d=this.top.children[c];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){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==Ei&&l.dom==l.contentDOM&&(l.dirty=Fo),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 f=this.top.children[c];if(f instanceof lo){let d=this.preMatch.matched.get(f);if(d!=null&&d!=s)return!1;let p=f.dom,m,g=this.isLocked(p)&&!(e.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==e.text&&f.dirty!=Ei&&$h(n,f.outerDeco));if(!g&&f.update(e,n,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(f,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Fo,m.updateChildren(i,l+1),m.dirty=Yr),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)||!$h(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=lo.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let f of c.children)f.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=lo.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 eO(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 ol;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof em)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ln||Mn)&&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 tO(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 L4(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 d=n.children[r-1];if(d instanceof ol)n=d,r=d.children.length;else{c=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let f=c.node;if(f){if(f!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function j4(t,e){return t.type.side-e.type.side}function I4(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let d=0;d<t.childCount;d++){let p=t.child(d);r(p,i,e.forChild(s,p),d),s+=p.nodeSize}return}let l=0,c=[],f=null;for(let d=0;;){let p,m;for(;l<i.length&&i[l].to==s;){let C=i[l++];C.widget&&(p?(m||(m=[p])).push(C):p=C)}if(p)if(m){m.sort(j4);for(let C=0;C<m.length;C++)n(m[C],d,!!f)}else n(p,d,!!f);let g,b;if(f)b=-1,g=f,f=null;else if(d<t.childCount)b=d,g=t.child(d++);else break;for(let C=0;C<c.length;C++)c[C].to<=s&&c.splice(C--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let S=s+g.nodeSize;if(g.isText){let C=S;l<i.length&&i[l].from<C&&(C=i[l].from);for(let T=0;T<c.length;T++)c[T].to<C&&(C=c[T].to);C<S&&(f=g.cut(C-s),g=g.cut(0,C-s),S=C,b=-1)}else for(;l<i.length&&i[l].to<S;)l++;let v=g.isInline&&!g.isLeaf?c.filter(C=>!C.inline):c.slice();r(g,v,e.forChild(s,g),b),s=S}}function B4(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 U4(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 f=l.text;for(;i<t.childCount;){let d=t.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=n){if(s>=r&&f.slice(r-e.length-c,r-c)==e)return r-e.length;let d=c<r?f.lastIndexOf(e,r-c-1):-1;if(d>=0&&d+e.length+c>=n)return c+d;if(n==r&&f.length>=r+e.length-c&&f.slice(r-c,r-c+e.length)==e)return r}}return-1}function vb(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let f=t[l],d=c,p=c+=f.size;d>=n||p<=e?s.push(f):(d<e&&s.push(f.slice(0,e-d,r)),i&&(s.push(i),i=void 0),p>n&&s.push(f.slice(n-d,f.size,r)))}return s}function Lx(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),f,d;if(Qp(n)){for(f=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Me.isSelectable(m)&&i.parent&&!(m.isInline&&d4(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;d=new Me(l==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=l,g=l;for(let b=0;b<n.rangeCount;b++){let S=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(S.startContainer,S.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[f,l]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(l)}else f=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;d=jx(t,p,c,m)}return d}function sO(t){return t.editable?t.hasFocus():lO(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ds(t,e=!1){let n=t.state.selection;if(oO(t,n),!!sO(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Mn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&sl(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)V4(t);else{let{anchor:r,head:i}=n,s,l;hE&&!(n instanceof _e)&&(n.$from.parent.inlineContent||(s=pE(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=pE(t,n.to))),t.docView.setSelection(r,i,t,e),hE&&(s&&mE(s),l&&mE(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&H4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const hE=Ln||Mn&&YM<63;function pE(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 r0(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return r0(i);if(s)return r0(s)}}function r0(t){return t.contentEditable="true",Ln&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function mE(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function H4(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(()=>{(!sO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function V4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Tn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&or&&oo<=11&&(n.disabled=!0,n.disabled=!1)}function oO(t,e){if(e instanceof Me){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(gE(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else gE(t)}function gE(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function jx(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||_e.between(e,n,r)}function yE(t){return t.editable&&!t.hasFocus()?!1:lO(t)}function lO(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 P4(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return sl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function kb(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&&ze.findFrom(s,e)}function Ks(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function bE(t,e,n){let r=t.state.selection;if(r instanceof _e)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 Ks(t,new _e(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=kb(t.state,e);return i&&i instanceof Me?Ks(t,i):!1}else if(!(Ur&&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)?Ks(t,new Me(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):hf?Ks(t,new _e(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Me&&r.node.isInline)return Ks(t,new _e(e>0?r.$to:r.$from));{let i=kb(t.state,e);return i?Ks(t,i):!1}}}function Fh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function hu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ia(t,e){return e<0?$4(t):F4(t)}function $4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,l=!1;for(qr&&n.nodeType==1&&r<Fh(n)&&hu(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(hu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(aO(n))break;{let c=n.previousSibling;for(;c&&hu(c,-1);)i=n.parentNode,s=Tn(c),c=c.previousSibling;if(c)n=c,r=Fh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?Cb(t,n,r):i&&Cb(t,i,s)}function F4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Fh(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(hu(c,1))s=n,l=++r;else break}else{if(aO(n))break;{let c=n.nextSibling;for(;c&&hu(c,1);)s=c.parentNode,l=Tn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Fh(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Cb(t,s,l)}function aO(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function q4(t,e){for(;t&&e==t.childNodes.length&&!df(t);)e=Tn(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 Y4(t,e){for(;t&&!e&&!df(t);)e=Tn(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 Cb(t,e,n){if(e.nodeType!=3){let s,l;(l=q4(e,n))?(e=l,n=0):(s=Y4(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Qp(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&&ds(t)},50)}function xE(t,e){let n=t.state.doc.resolve(e);if(!(Mn||KM)&&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 SE(t,e,n){let r=t.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||Ur&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=kb(t.state,e);if(l&&l instanceof Me)return Ks(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof sr?ze.near(l,e):ze.findFrom(l,e);return c?Ks(t,c):!1}return!1}function wE(t,e){if(!(t.state.selection instanceof _e))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 vE(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function K4(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;vE(t,r,"true"),setTimeout(()=>vE(t,r,"false"),20)}return!1}function W4(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function G4(t,e){let n=e.keyCode,r=W4(e);if(n==8||Ur&&n==72&&r=="c")return wE(t,-1)||ia(t,-1);if(n==46&&!e.shiftKey||Ur&&n==68&&r=="c")return wE(t,1)||ia(t,1);if(n==13||n==27)return!0;if(n==37||Ur&&n==66&&r=="c"){let i=n==37?xE(t,t.state.selection.from)=="ltr"?-1:1:-1;return bE(t,i,r)||ia(t,i)}else if(n==39||Ur&&n==70&&r=="c"){let i=n==39?xE(t,t.state.selection.from)=="ltr"?1:-1:1;return bE(t,i,r)||ia(t,i)}else{if(n==38||Ur&&n==80&&r=="c")return SE(t,-1,r)||ia(t,-1);if(n==40||Ur&&n==78&&r=="c")return K4(t)||SE(t,1,r)||ia(t,1);if(r==(Ur?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ix(t,e){t.someProp("transformCopied",b=>{e=b(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 b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let l=t.someProp("clipboardSerializer")||ml.fromSchema(t.state.schema),c=pO(),f=c.createElement("div");f.appendChild(l.serializeFragment(r,{document:c}));let d=f.firstChild,p,m=0;for(;d&&d.nodeType==1&&(p=hO[d.nodeName.toLowerCase()]);){for(let b=p.length-1;b>=0;b--){let S=c.createElement(p[b]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),m++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
66
+
67
+ `);return{dom:f,text:g,slice:e}}function cO(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let f=!!e&&(r||s||!n);if(f){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new pe(te.from(t.state.schema.text(e.replace(/\r\n?/g,`
68
+ `))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:b}=t.state,S=ml.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let C=l.appendChild(document.createElement("p"));v&&C.appendChild(S.serializeNode(b.text(v,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=Q4(n),hf&&eL(l);let d=l&&l.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){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")||uu.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!Z4.test(g.parentNode.nodeName)?{ignore:!0}:null}})),p)c=tL(kE(c,+p[1],+p[2]),p[4]);else if(c=pe.maxOpen(J4(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m<c.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=c.content.lastChild;g<c.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);c=kE(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,f)}),c}const Z4=/^(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 J4(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 f=i.findWrapping(c.type),d;if(!f)return l=null;if(d=l.length&&s.length&&fO(f,s,c,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=dO(l[l.length-1],s.length));let p=uO(c,f);l.push(p),i=i.matchType(p.type),s=f}}),l)return te.from(l)}return t}function uO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,te.from(t));return t}function fO(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=fO(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(te.from(uO(n,t,i+1))))}}function dO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,dO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(te.empty,!0);return t.copy(n.append(r))}function Eb(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=Eb(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(te.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function kE(t,e,n){return e<t.openStart&&(t=new pe(Eb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new pe(Eb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const hO={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 CE=null;function pO(){return CE||(CE=document.implementation.createHTMLDocument("title"))}let i0=null;function X4(t){let e=window.trustedTypes;return e?(i0||(i0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),i0.createHTML(t)):t}function Q4(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=pO().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&hO[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=X4(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function eL(t){let e=t.querySelectorAll(Mn?"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 tL(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 f=n.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=te.from(f.create(r[c+1],i)),s++,l++}return new pe(i,s,l)}const Fn={},qn={},nL={touchstart:!0,touchmove:!0};class rL{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 iL(t){for(let e in Fn){let n=Fn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{oL(t,r)&&!Bx(t,r)&&(t.editable||!(r.type in qn))&&n(t,r)},nL[e]?{passive:!0}:void 0)}Ln&&t.dom.addEventListener("input",()=>null),Tb(t)}function no(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function sL(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 Tb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Bx(t,r))})}function Bx(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function oL(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 lL(t,e){!Bx(t,e)&&Fn[e.type]&&(t.editable||!(e.type in qn))&&Fn[e.type](t,e)}qn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!gO(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(us&&Mn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),La&&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,Ho(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||G4(t,n)?n.preventDefault():no(t,"key")};qn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};qn.keypress=(t,e)=>{let n=e;if(gO(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ur&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof _e)||!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 tm(t){return{left:t.clientX,top:t.clientY}}function aL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ux(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 ba(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 cL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Me.isSelectable(r)?(ba(t,new Me(n)),!0):!1}function uL(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?(ba(t,Me.create(t.state.doc,i)),!0):!1}function fL(t,e,n,r,i){return Ux(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?uL(t,n):cL(t,n))}function dL(t,e,n,r){return Ux(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function hL(t,e,n,r){return Ux(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||pL(t,n,r)}function pL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ba(t,_e.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)ba(t,_e.create(r,c+1,c+1+l.content.size));else if(Me.isSelectable(l))ba(t,Me.create(r,c));else continue;return!0}}function Hx(t){return qh(t)}const mO=Ur?"metaKey":"ctrlKey";Fn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Hx(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&aL(n,t.input.lastClick)&&!n[mO]&&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(tm(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new mL(t,l,n,!!r)):(s=="doubleClick"?dL:hL)(t,l.pos,l.inside,n)?n.preventDefault():no(t,"pointer"))};class mL{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[mO],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,f=c?e.docView.nearestDesc(c,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof Me&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qr&&!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)),no(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(()=>ds(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(tm(e))),this.updateAllowDefault(e),this.allowDefault||!n?no(this.view,"pointer"):fL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ln&&this.mightDrag&&!this.mightDrag.node.isAtom||Mn&&!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)?(ba(this.view,ze.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):no(this.view,"pointer")}move(e){this.updateAllowDefault(e),no(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)}}Fn.touchstart=t=>{t.input.lastTouch=Date.now(),Hx(t),no(t,"pointer")};Fn.touchmove=t=>{t.input.lastTouch=Date.now(),no(t,"pointer")};Fn.contextmenu=t=>Hx(t);function gO(t,e){return t.composing?!0:Ln&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const gL=us?5e3:-1;qn.compositionstart=qn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof _e&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Mn&&KM&&yL(t)))t.markCursor=t.state.storedMarks||n.marks(),qh(t,!0),t.markCursor=null;else if(qh(t,!e.selection.empty),qr&&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}yO(t,gL)};function yL(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"}qn.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++,yO(t,20))};function yO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qh(t),e))}function bO(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=xL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function bL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=u4(e.focusNode,e.focusOffset),r=f4(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 xL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qh(t,e=!1){if(!(us&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),bO(t),e||t.docView&&t.docView.dirty){let n=Lx(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 SL(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 Uu=or&&oo<15||La&&m4<604;Fn.copy=qn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Uu?null:n.clipboardData,l=r.content(),{dom:c,text:f}=Ix(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):SL(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function wL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function vL(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?Hu(t,r.value,null,i,e):Hu(t,r.textContent,r.innerHTML,i,e)},50)}function Hu(t,e,n,r,i){let s=cO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",f=>f(t,i,s||pe.empty)))return!0;if(!s)return!1;let l=wL(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 xO(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," "):""}qn.paste=(t,e)=>{let n=e;if(t.composing&&!us)return;let r=Uu?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Hu(t,xO(r),r.getData("text/html"),i,n)?n.preventDefault():vL(t,n)};class SO{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const kL=Ur?"altKey":"ctrlKey";function wO(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[kL]}Fn.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(tm(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 m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(l=Me.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:f,text:d,slice:p}=Ix(t,c);(!n.dataTransfer.files.length||!Mn||YM>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Uu?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",Uu||n.dataTransfer.setData("text/plain",d),t.dragging=new SO(p,wO(t,n),l)};Fn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};qn.dragover=qn.dragenter=(t,e)=>e.preventDefault();qn.drop=(t,e)=>{try{CL(t,e,t.dragging)}finally{t.dragging=null}};function CL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(tm(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=cO(t,xO(e.dataTransfer),Uu?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&wO(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||pe.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?IM(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=t.state.tr;if(l){let{node:b}=n;b?b.replace(f):f.deleteSelection()}let d=f.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=f.doc;if(p?f.replaceRangeWith(d,d,s.content.firstChild):f.replaceRange(d,d,s),f.doc.eq(m))return;let g=f.doc.resolve(d);if(p&&Me.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new Me(g));else{let b=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((S,v,C,T)=>b=T),f.setSelection(jx(t,g,f.doc.resolve(b)))}t.focus(),t.dispatch(f.setMeta("uiEvent","drop"))}Fn.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())&&ds(t)},20))};Fn.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)};Fn.beforeinput=(t,e)=>{if(Mn&&us&&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,Ho(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 qn)Fn[t]=qn[t];function Vu(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 Yh{constructor(e,n){this.toDOM=e,this.spec=n||Zo,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 Vt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Yh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ao{constructor(e,n){this.attrs=e,this.spec=n||Zo}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 Vt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ao&&Vu(this.attrs,e.attrs)&&Vu(this.spec,e.spec)}static is(e){return e.type instanceof ao}destroy(){}}class Vx{constructor(e,n){this.attrs=e,this.spec=n||Zo}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 Vt(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 Vx&&Vu(this.attrs,e.attrs)&&Vu(this.spec,e.spec)}destroy(){}}class Vt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Vt(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 Vt(e,e,new Yh(n,r))}static inline(e,n,r,i){return new Vt(e,n,new ao(r,i))}static node(e,n,r,i){return new Vt(e,n,new Vx(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ao}get widget(){return this.type instanceof Yh}}const ua=[],Zo={};class ot{constructor(e,n){this.local=e.length?e:ua,this.children=n.length?n:ua}static create(e,n){return n.length?Kh(n,e,0,Zo):Rn}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==Rn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Zo)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(e,r,i);f&&f.type.valid(n,f)?(l||(l=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?EL(this.children,l||[],e,n,r,i,s):l?new ot(l.sort(Jo),ua):Rn}add(e,n){return n.length?this==Rn?ot.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,f)=>{let d=f+r,p;if(p=kO(n,c,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<f;)s+=3;i[s]==f?i[s+2]=i[s+2].addInner(c,p,d+1):i.splice(s,0,f,f+c.nodeSize,Kh(p,c,d+1,Zo)),s+=3}});let l=vO(s?CO(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new ot(l.length?this.local.concat(l).sort(Jo):this.local,i||this.children)}remove(e){return e.length==0||this==Rn?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,f=r[s+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<f&&(e[p]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,c+1);d!=Rn?r[s+2]=d:(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 ot(i,r):Rn}forChild(e,n){if(this==Rn)return this;if(n.isLeaf)return ot.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 f=this.local[c];if(f.from<l&&f.to>s&&f.type instanceof ao){let d=Math.max(s,f.from)-s,p=Math.min(l,f.to)-s;d<p&&(i||(i=[])).push(f.copy(d,p))}}if(i){let c=new ot(i.sort(Jo),ua);return r?new Zs([c,r]):c}return r||Rn}eq(e){if(this==e)return!0;if(!(e instanceof ot)||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 Px(this.localsInner(e))}localsInner(e){if(this==Rn)return ua;if(e.inlineContent||!this.local.some(ao.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ao||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ot.empty=new ot([],[]);ot.removeOverlap=Px;const Rn=ot.empty;class Zs{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Zo));return Zs.from(r)}forChild(e,n){if(n.isLeaf)return ot.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Rn&&(s instanceof Zs?r=r.concat(s.members):r.push(s))}return Zs.from(r)}eq(e){if(!(e instanceof Zs)||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?Px(r?n:n.sort(Jo)):ua}static from(e){switch(e.length){case 0:return Rn;case 1:return e[0];default:return new Zs(e.every(n=>n instanceof ot)?e:e.reduce((n,r)=>n.concat(r instanceof ot?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function EL(t,e,n,r,i,s,l){let c=t.slice();for(let d=0,p=s;d<n.maps.length;d++){let m=0;n.maps[d].forEach((g,b,S,v)=>{let C=v-S-(b-g);for(let T=0;T<c.length;T+=3){let H=c[T+1];if(H<0||g>H+p-m)continue;let j=c[T]+p-m;b>=j?c[T+1]=g<=j?-2:-1:g>=p&&C&&(c[T]+=C,c[T+1]+=C)}m+=C}),p=n.maps[d].map(p,-1)}let f=!1;for(let d=0;d<c.length;d+=3)if(c[d+1]<0){if(c[d+1]==-2){f=!0,c[d+1]=-1;continue}let p=n.map(t[d]+s),m=p-i;if(m<0||m>=r.content.size){f=!0;continue}let g=n.map(t[d+1]+s,-1),b=g-i,{index:S,offset:v}=r.content.findIndex(m),C=r.maybeChild(S);if(C&&v==m&&v+C.nodeSize==b){let T=c[d+2].mapInner(n,C,p+1,t[d]+s+1,l);T!=Rn?(c[d]=m,c[d+1]=b,c[d+2]=T):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=TL(c,t,e,n,i,s,l),p=Kh(d,r,0,l);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,g=0;m<p.children.length;m+=3){let b=p.children[m];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,p.children[m],p.children[m+1],p.children[m+2])}}return new ot(e.sort(Jo),c)}function vO(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 Vt(i.from+e,i.to+e,i.type))}return n}function TL(t,e,n,r,i,s,l){function c(f,d){for(let p=0;p<f.local.length;p++){let m=f.local[p].map(r,i,d);m?n.push(m):l.onRemove&&l.onRemove(f.local[p].spec)}for(let p=0;p<f.children.length;p+=3)c(f.children[p+2],f.children[p]+d+1)}for(let f=0;f<t.length;f+=3)t[f+1]==-1&&c(t[f+2],e[f]+s+1);return n}function kO(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 CO(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Kh(t,e,n,r){let i=[],s=!1;e.forEach((c,f)=>{let d=kO(t,c,f+n);if(d){s=!0;let p=Kh(d,c,n+f+1,r);p!=Rn&&i.push(f,f+c.nodeSize,p)}});let l=vO(s?CO(t):t,-n).sort(Jo);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 ot(l,i):Rn}function Jo(t,e){return t.from-e.from||t.to-e.to}function Px(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),EE(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),EE(e,i,r.copy(s.from,r.to)));break}}}return e}function EE(t,e,n){for(;e<t.length&&Jo(n,t[e])>0;)e++;t.splice(e,0,n)}function s0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Rn&&e.push(r)}),t.cursorWrapper&&e.push(ot.create(t.state.doc,[t.cursorWrapper.deco])),Zs.from(e)}const AL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ML=or&&oo<=11;class OL{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 _L{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new OL,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]);or&&oo<=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()}),ML&&(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,AL)),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(yE(this.view)){if(this.suppressingSelectionUpdates)return ds(this.view);if(or&&oo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&sl(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=za(s))n.add(s);for(let s=e.anchorNode;s;s=za(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)&&yE(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,f=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],f);m&&(s=s<0?m.from:Math.min(m.from,s),l=l<0?m.to:Math.max(m.to,l),m.typeOver&&(c=!0))}if(f.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let m=p.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){p.parentNode.removeChild(p);break}m=m.firstChild}}}else if(qr&&f.length){let p=f.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,g]=p;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of p){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||NL(e,m)!=b)&&g.remove()}}}let d=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Qp(r)&&(d=Lx(e))&&d.eq(ze.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ds(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),DL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,zL(e,f)),this.handleDOMChange(s,l,c,f),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ds(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 m=e.addedNodes[p];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}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(or&&oo<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:g}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let l=i&&i.parentNode==e.target?Tn(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),f=s&&s.parentNode==e.target?Tn(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,f,1);return{from:c,to:d}}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 TE=new WeakMap,AE=!1;function DL(t){if(!TE.has(t)&&(TE.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=qr,AE)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."),AE=!0}}function ME(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return sl(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function RL(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ME(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?ME(t,n):null}function NL(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 zL(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 f=c.firstChild;if(!f||f.nodeType!=1||f.contentEditable=="false"||/^(BR|IMG)$/.test(f.nodeName))break;c=f}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function LL(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),f=t.domSelectionRange(),d,p=f.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(d=[{node:p,offset:f.anchorOffset}],Qp(f)||d.push({node:f.focusNode,offset:f.focusOffset})),Mn&&t.input.lastKeyCode===8)for(let C=s;C>i;C--){let T=r.childNodes[C-1],H=T.pmViewDesc;if(T.nodeName=="BR"&&!H){s=C;break}if(!H||H.size)break}let m=t.state.doc,g=t.someProp("domParser")||uu.fromSchema(t.state.schema),b=m.resolve(l),S=null,v=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:jL,context:b});if(d&&d[0].pos!=null){let C=d[0].pos,T=d[1]&&d[1].pos;T==null&&(T=C),S={anchor:C+l,head:T+l}}return{doc:v,sel:S,from:l,to:c}}function jL(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 IL=/^(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 BL(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,K=Lx(t,D);if(K&&!t.state.selection.eq(K)){if(Mn&&us&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",xe=>xe(t,Ho(13,"Enter"))))return;let ae=t.state.tr.setSelection(K);D=="pointer"?ae.setMeta("pointer",!0):D=="key"&&ae.scrollIntoView(),s&&ae.setMeta("composition",s),t.dispatch(ae)}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 f=t.state.selection,d=LL(t,e,n),p=t.state.doc,m=p.slice(d.from,d.to),g,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,b="end"):(g=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let S=VL(m.content,d.doc.content,d.from,g,b);if(S&&t.input.domChangeCount++,(La&&t.input.lastIOSEnter>Date.now()-225||us)&&i.some(D=>D.nodeType==1&&!IL.test(D.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",D=>D(t,Ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(r&&f instanceof _e&&!f.empty&&f.$head.sameParent(f.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))S={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let D=OE(t,t.state.doc,d.sel);if(D&&!D.eq(t.state.selection)){let K=t.state.tr.setSelection(D);s&&K.setMeta("composition",s),t.dispatch(K)}}return}t.state.selection.from<t.state.selection.to&&S.start==S.endB&&t.state.selection instanceof _e&&(S.start>t.state.selection.from&&S.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?S.start=t.state.selection.from:S.endA<t.state.selection.to&&S.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),or&&oo<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>d.from&&d.doc.textBetween(S.start-d.from-1,S.start-d.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let v=d.doc.resolveNoCache(S.start-d.from),C=d.doc.resolveNoCache(S.endB-d.from),T=p.resolve(S.start),H=v.sameParent(C)&&v.parent.inlineContent&&T.end()>=S.endA;if((La&&t.input.lastIOSEnter>Date.now()-225&&(!H||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!H&&v.pos<d.doc.content.size&&(!v.sameParent(C)||!v.parent.inlineContent)&&v.pos<C.pos&&!/\S/.test(d.doc.textBetween(v.pos,C.pos,"","")))&&t.someProp("handleKeyDown",D=>D(t,Ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&HL(p,S.start,S.endA,v,C)&&t.someProp("handleKeyDown",D=>D(t,Ho(8,"Backspace")))){us&&Mn&&t.domObserver.suppressSelectionUpdates();return}Mn&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),us&&!H&&v.start()!=C.start()&&C.parentOffset==0&&v.depth==C.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==S.endA&&(S.endB-=2,C=d.doc.resolveNoCache(S.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,Ho(13,"Enter"))})},20));let j=S.start,ne=S.endA,$=D=>{let K=D||t.state.tr.replace(j,ne,d.doc.slice(S.start-d.from,S.endB-d.from));if(d.sel){let ae=OE(t,K.doc,d.sel);ae&&!(Mn&&t.composing&&ae.empty&&(S.start!=S.endB||t.input.lastChromeDelete<Date.now()-100)&&(ae.head==j||ae.head==K.mapping.map(ne)-1)||or&&ae.empty&&ae.head==j)&&K.setSelection(ae)}return s&&K.setMeta("composition",s),K.scrollIntoView()},N;if(H)if(v.pos==C.pos){or&&oo<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ds(t),20));let D=$(t.state.tr.delete(j,ne)),K=p.resolve(S.start).marksAcross(p.resolve(S.endA));K&&D.ensureMarks(K),t.dispatch(D)}else if(S.endA==S.endB&&(N=UL(v.parent.content.cut(v.parentOffset,C.parentOffset),T.parent.content.cut(T.parentOffset,S.endA-T.start())))){let D=$(t.state.tr);N.type=="add"?D.addMark(j,ne,N.mark):D.removeMark(j,ne,N.mark),t.dispatch(D)}else if(v.parent.child(v.index()).isText&&v.index()==C.index()-(C.textOffset?0:1)){let D=v.parent.textBetween(v.parentOffset,C.parentOffset),K=()=>$(t.state.tr.insertText(D,j,ne));t.someProp("handleTextInput",ae=>ae(t,j,ne,D,K))||t.dispatch(K())}else t.dispatch($());else t.dispatch($())}function OE(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:jx(t,e.resolve(n.anchor),e.resolve(n.head))}function UL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,f;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",f=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",f=p=>p.mark(c.removeFromSet(p.marks));else return null;let d=[];for(let p=0;p<e.childCount;p++)d.push(f(e.child(p)));if(te.from(d).eq(t))return{mark:c,type:l}}function HL(t,e,n,r,i){if(n-e<=i.pos-r.pos||o0(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(o0(s,!0,!0));return!l.parent.isTextblock||l.pos>n||o0(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function o0(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 VL(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 f=Math.max(0,s-Math.min(l,c));r-=l+f-s}if(l<s&&t.size<e.size){let f=r<=s&&r>=l?s-r:0;s-=f,s&&s<e.size&&_E(e.textBetween(s-1,s+1))&&(s+=f?1:-1),c=s+(c-l),l=s}else if(c<s){let f=r<=s&&r>=c?s-r:0;s-=f,s&&s<t.size&&_E(t.textBetween(s-1,s+1))&&(s+=f?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function _E(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 EO{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 rL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(LE),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=NE(this),RE(this),this.nodeViews=zE(this),this.docView=fE(this.state.doc,DE(this),s0(this),this.dom,this),this.domObserver=new _L(this,(r,i,s,l)=>BL(this,r,i,s,l)),this.domObserver.start(),iL(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&&Tb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(LE),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&&(bO(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 b=zE(this);$L(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Tb(this),this.editable=NE(this),RE(this);let f=s0(this),d=DE(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,d,f);(m||!e.selection.eq(i.selection))&&(l=!0);let g=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&b4(this);if(l){this.domObserver.stop();let b=m&&(or||Mn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&PL(i.selection,e.selection);if(m){let S=Mn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=bL(this)),(s||!this.docView.update(e.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=fE(e.doc,d,f,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&P4(this))?ds(this,b):(oO(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&&x4(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&&sE(this,n.getBoundingClientRect(),e)}else sE(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(r.from<this.state.doc.content.size&&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&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new SO(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(or){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&&S4(this.dom),ds(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 E4(this,e)}coordsAtPos(e,n=1){return XM(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 _4(this,n||this.state,e)}pasteHTML(e,n){return Hu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Hu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ix(this,e)}destroy(){this.docView&&(sL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],s0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,a4())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return lL(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ln&&this.root.nodeType===11&&h4(this.dom.ownerDocument)==this.dom&&RL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}EO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function DE(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"),[Vt.node(0,t.state.doc.content.size,e)]}function RE(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:Vt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function NE(t){return!t.someProp("editable",e=>e(t.state)===!1)}function PL(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 zE(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 $L(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 LE(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 fo={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:"'"},Wh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},FL=typeof navigator<"u"&&/Mac/.test(navigator.platform),qL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var An=0;An<10;An++)fo[48+An]=fo[96+An]=String(An);for(var An=1;An<=24;An++)fo[An+111]="F"+An;for(var An=65;An<=90;An++)fo[An]=String.fromCharCode(An+32),Wh[An]=String.fromCharCode(An);for(var l0 in fo)Wh.hasOwnProperty(l0)||(Wh[l0]=fo[l0]);function YL(t){var e=FL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wh:fo)[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 KL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),WL=typeof navigator<"u"&&/Win/.test(navigator.platform);function GL(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 f=e[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))KL?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function ZL(t){let e=Object.create(null);for(let n in t)e[GL(n)]=t[n];return e}function a0(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 JL(t){return new xt({props:{handleKeyDown:$x(t)}})}function $x(t){let e=ZL(t);return function(n,r){let i=YL(r),s,l=e[a0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[a0(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(WL&&r.ctrlKey&&r.altKey)&&(s=fo[r.keyCode])&&s!=i){let c=e[a0(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const Fx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function TO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const AO=(t,e,n)=>{let r=TO(t,n);if(!r)return!1;let i=qx(r);if(!i){let l=r.blockRange(),c=l&&Ka(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(jO(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ja(s,"end")||Me.isSelectable(s)))for(let l=r.depth;;l--){let c=Jp(t.doc,r.before(l),r.after(l),pe.empty);if(c&&c.slice.size<c.to-c.from){if(e){let f=t.tr.step(c);f.setSelection(ja(s,"end")?ze.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Me.create(f.doc,i.pos-s.nodeSize)),e(f.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},XL=(t,e,n)=>{let r=TO(t,n);if(!r)return!1;let i=qx(r);return i?MO(t,i,e):!1},QL=(t,e,n)=>{let r=_O(t,n);if(!r)return!1;let i=Yx(r);return i?MO(t,i,e):!1};function MO(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,f=e.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let d=Jp(t.doc,s,f,pe.empty);if(!d||d.from!=s||d instanceof fn&&d.slice.size>=f-s)return!1;if(n){let p=t.tr.step(d);p.setSelection(_e.create(p.doc,s)),n(p.scrollIntoView())}return!0}function ja(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 OO=(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=qx(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 qx(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 _O(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const DO=(t,e,n)=>{let r=_O(t,n);if(!r)return!1;let i=Yx(r);if(!i)return!1;let s=i.nodeAfter;if(jO(t,i,e,1))return!0;if(r.parent.content.size==0&&(ja(s,"start")||Me.isSelectable(s))){let l=Jp(t.doc,r.before(),r.after(),pe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(ja(s,"start")?ze.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},RO=(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=Yx(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 Yx(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 e6=(t,e)=>{let n=t.selection,r=n instanceof Me,i;if(r){if(n.node.isTextblock||!yo(t.doc,n.from))return!1;i=n.from}else if(i=Zp(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},t6=(t,e)=>{let n=t.selection,r;if(n instanceof Me){if(n.node.isTextblock||!yo(t.doc,n.to))return!1;r=n.to}else if(r=Zp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},n6=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ka(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},NO=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
69
+ `).scrollIntoView()),!0)};function Kx(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 r6=(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=Kx(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),f=t.tr.replaceWith(c,c,l.createAndFill());f.setSelection(ze.near(f.doc.resolve(c),1)),e(f.scrollIntoView())}return!0},zO=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof sr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Kx(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(_e.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},LO=(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(fs(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ka(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function i6(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Me&&e.selection.node.isBlock)return!r.parentOffset||!fs(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,f=!1,d=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),d=r.start(b)==r.pos-(r.depth-b),c=Kx(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(f&&c?{type:c}:null),l=b;break}else{if(b==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof _e||e.selection instanceof sr)&&p.deleteSelection();let m=p.mapping.map(r.pos),g=fs(p.doc,m,s.length,s);if(g||(s[0]=c?{type:c}:null,g=fs(p.doc,m,s.length,s)),!g)return!1;if(p.split(m,s.length,s),!f&&d&&r.node(l).type!=c){let b=p.mapping.map(r.before(l)),S=p.doc.resolve(b);c&&r.node(l-1).canReplaceWith(S.index(),S.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const s6=i6(),o6=(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 l6(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||yo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jO(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&l6(t,e,n))return!0;let d=!f&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,S=te.empty;for(let T=l.length-1;T>=0;T--)S=te.from(l[T].create(null,S));S=te.from(i.copy(S));let v=t.tr.step(new dn(e.pos-1,b,e.pos,b,new pe(S,1,0),l.length,!0)),C=v.doc.resolve(b+2*l.length);C.nodeAfter&&C.nodeAfter.type==i.type&&yo(v.doc,C.pos)&&v.join(C.pos),n(v.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:ze.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),g=m&&Ka(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(d&&ja(s,"start",!0)&&ja(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let v=s,C=1;for(;!v.isTextblock;v=v.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,v.content)){if(n){let T=te.empty;for(let j=S.length-1;j>=0;j--)T=te.from(S[j].copy(T));let H=t.tr.step(new dn(e.pos-S.length,e.pos+s.nodeSize,e.pos+C,e.pos+s.nodeSize-C,new pe(T,S.length,0),0,!0));n(H.scrollIntoView())}return!0}}return!1}function IO(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(_e.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const a6=IO(-1),c6=IO(1);function u6(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&Dx(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function jE(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,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(t,e)))if(f.type==t)i=!0;else{let p=n.doc.resolve(d),m=p.index();i=p.parent.canReplaceWith(m,m+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:f}}=n.selection.ranges[l];s.setBlockType(c,f,t,e)}r(s.scrollIntoView())}return!0}}function Wx(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Wx(Fx,AO,OO);Wx(Fx,DO,RO);Wx(NO,zO,LO,s6);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function f6(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 d6(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function d6(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 f=l.resolve(e.start-2);s=new Vh(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new Vh(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Dx(s,n,r,e);return c?(t&&h6(t,e,c,i,n),!0):!1}function h6(t,e,n,r,i){let s=te.empty;for(let p=n.length-1;p>=0;p--)s=te.from(n[p].type.create(n[p].attrs,s));t.step(new dn(e.start-(r?2:0),e.end,e.start,e.end,new pe(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,f=e.start+n.length-(r?2:0),d=e.parent;for(let p=e.startIndex,m=e.endIndex,g=!0;p<m;p++,g=!1)!g&&fs(t.doc,f,c)&&(t.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return t}function p6(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?m6(e,n,t,s):g6(e,n,s):!0:!1}}function m6(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new dn(s-1,l,s,l,new pe(te.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Vh(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=Ka(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return yo(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),e(i.scrollIntoView()),!0}function g6(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,S=n.endIndex-1,v=n.startIndex;S>v;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+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,f=n.endIndex==i.childCount,d=s.node(-1),p=s.index(-1);if(!d.canReplace(p+(c?0:1),p+1,l.content.append(f?te.empty:te.from(i))))return!1;let m=s.pos,g=m+l.nodeSize;return r.step(new dn(m-(c?1:0),g+(f?1:0),m+1,g-1,new pe((c?te.empty:te.from(i.copy(te.empty))).append(f?te.empty:te.from(i.copy(te.empty))),c?0:1,f?0:1),c?0:1)),e(r.scrollIntoView()),!0}function y6(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,f=c.child(l-1);if(f.type!=t)return!1;if(n){let d=f.lastChild&&f.lastChild.type==c.type,p=te.from(d?t.create():null),m=new pe(te.from(t.create(null,te.from(c.type.create(null,p)))),d?3:1,0),g=s.start,b=s.end;n(e.tr.step(new dn(g-(d?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}function nm(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}}}class rm{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,l=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...p)=>{const m=f(...p)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],f=!!e,d=e||s.tr,p=()=>(!f&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(d),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...v)=>{const C=this.buildProps(d,n),T=b(...v)(C);return c.push(T),m}])),run:p};return m}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([f,d])=>[f,(...p)=>d(...p)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:e,editor:i,view:l,state:nm({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,d])=>[f,(...p)=>d(...p)(c)]))}};return c}}let b6=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function we(t,e,n){return t.config[e]===void 0&&t.parent?we(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?we(t.parent,e,n):null}):t.config[e]}function im(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 BO(t){const e=[],{nodeExtensions:n,markExtensions:r}=im(t),i=[...n,...r],s={default:null,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},f=we(l,"addGlobalAttributes",c);if(!f)return;f().forEach(p=>{p.types.forEach(m=>{Object.entries(p.attributes).forEach(([g,b])=>{e.push({type:m,name:g,attribute:{...s,...b}})})})})}),i.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage},f=we(l,"addAttributes",c);if(!f)return;const d=f();Object.entries(d).forEach(([p,m])=>{const g={...s,...m};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 mn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Pt(...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(" "):[],f=r[i]?r[i].split(" "):[],d=c.filter(p=>!f.includes(p));r[i]=[...f,...d].join(" ")}else if(i==="style"){const c=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],d=new Map;f.forEach(p=>{const[m,g]=p.split(":").map(b=>b.trim());d.set(m,g)}),c.forEach(p=>{const[m,g]=p.split(":").map(b=>b.trim());d.set(m,g)}),r[i]=Array.from(d.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=s}),r},{})}function Ab(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)=>Pt(n,r),{})}function UO(t){return typeof t=="function"}function Ye(t,e=void 0,...n){return UO(t)?e?t.bind(e)(...n):t(...n):t}function x6(t={}){return Object.keys(t).length===0&&t.constructor===Object}function S6(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function IE(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):S6(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function BE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&x6(n)?!1:n!=null))}function w6(t,e){var n;const r=BO(t),{nodeExtensions:i,markExtensions:s}=im(t),l=(n=i.find(d=>we(d,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(T=>T.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},g=t.reduce((T,H)=>{const j=we(H,"extendNodeSchema",m);return{...T,...j?j(d):{}}},{}),b=BE({...g,content:Ye(we(d,"content",m)),marks:Ye(we(d,"marks",m)),group:Ye(we(d,"group",m)),inline:Ye(we(d,"inline",m)),atom:Ye(we(d,"atom",m)),selectable:Ye(we(d,"selectable",m)),draggable:Ye(we(d,"draggable",m)),code:Ye(we(d,"code",m)),whitespace:Ye(we(d,"whitespace",m)),linebreakReplacement:Ye(we(d,"linebreakReplacement",m)),defining:Ye(we(d,"defining",m)),isolating:Ye(we(d,"isolating",m)),attrs:Object.fromEntries(p.map(T=>{var H;return[T.name,{default:(H=T==null?void 0:T.attribute)===null||H===void 0?void 0:H.default}]}))}),S=Ye(we(d,"parseHTML",m));S&&(b.parseDOM=S.map(T=>IE(T,p)));const v=we(d,"renderHTML",m);v&&(b.toDOM=T=>v({node:T,HTMLAttributes:Ab(T,p)}));const C=we(d,"renderText",m);return C&&(b.toText=C),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(C=>C.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},g=t.reduce((C,T)=>{const H=we(T,"extendMarkSchema",m);return{...C,...H?H(d):{}}},{}),b=BE({...g,inclusive:Ye(we(d,"inclusive",m)),excludes:Ye(we(d,"excludes",m)),group:Ye(we(d,"group",m)),spanning:Ye(we(d,"spanning",m)),code:Ye(we(d,"code",m)),attrs:Object.fromEntries(p.map(C=>{var T;return[C.name,{default:(T=C==null?void 0:C.attribute)===null||T===void 0?void 0:T.default}]}))}),S=Ye(we(d,"parseHTML",m));S&&(b.parseDOM=S.map(C=>IE(C,p)));const v=we(d,"renderHTML",m);return v&&(b.toDOM=C=>v({mark:C,HTMLAttributes:Ab(C,p)})),[d.name,b]}));return new TM({topNode:l,nodes:c,marks:f})}function c0(t,e){return e.nodes[t]||e.marks[t]||null}function UE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Gx(t,e){const n=ml.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const v6=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var f,d;const p=((d=(f=i.type.spec).toText)===null||d===void 0?void 0:d.call(f,{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 Zx(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class sm{constructor(e){this.find=e.find,this.handler=e.handler}}const k6=(t,e)=>{if(Zx(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 Fd(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:f}=n;if(f.composing)return!1;const d=f.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let p=!1;const m=v6(d)+s;return l.forEach(g=>{if(p)return;const b=k6(m,g.find);if(!b)return;const S=f.state.tr,v=nm({state:f.state,transaction:S}),C={from:r-(b[0].length-s.length),to:i},{commands:T,chain:H,can:j}=new rm({editor:n,state:v});g.handler({state:v,range:C,match:b,commands:T,chain:H,can:j})===null||!S.steps.length||(S.setMeta(c,{transform:S,from:r,to:i,text:s}),f.dispatch(S),p=!0)}),p}function C6(t){const{editor:e,rules:n}=t,r=new xt({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:p}=f;typeof p=="string"?p=p:p=Gx(te.from(p),l.schema);const{from:m}=f,g=m+p.length;Fd({editor:e,from:m,to:g,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return Fd({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Fd({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?Fd({editor:e,from:l.pos,to:l.pos,text:`
70
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function E6(t){return Object.prototype.toString.call(t).slice(8,-1)}function qd(t){return E6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function om(t,e){const n={...t};return qd(t)&&qd(e)&&Object.keys(e).forEach(r=>{qd(e[r])&&qd(t[r])?n[r]=om(t[r],e[r]):n[r]=e[r]}),n}class Ti{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ye(we(this,"addOptions",{name:this.name}))),this.storage=Ye(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ti(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>om(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ti(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ye(we(n,"addOptions",{name:n.name})),n.storage=Ye(we(n,"addStorage",{name:n.name,options:n.options})),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(d=>(d==null?void 0:d.type.name)===n.name))return!1;const f=l.find(d=>(d==null?void 0:d.type.name)===n.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function T6(t){return typeof t=="number"}class A6{constructor(e){this.find=e.find,this.handler=e.handler}}const M6=(t,e,n)=>{if(Zx(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 O6(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:f,chain:d,can:p}=new rm({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const v=Math.max(r,S),C=Math.min(i,S+b.content.size),T=b.textBetween(v-S,C-S,void 0,"");M6(T,s.find,l).forEach(j=>{if(j.index===void 0)return;const ne=v+j.index+1,$=ne+j[0].length,N={from:n.tr.mapping.map(ne),to:n.tr.mapping.map($)},D=s.handler({state:n,range:N,match:j,commands:f,chain:d,can:p,pasteEvent:l,dropEvent:c});m.push(D)})}),m.every(b=>b!==null)}let Yd=null;const _6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function D6(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 f=({state:p,from:m,to:g,rule:b,pasteEvt:S})=>{const v=p.tr,C=nm({state:p,transaction:v});if(!(!O6({editor:e,state:C,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:S,dropEvent:c})||!v.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return n.map(p=>new xt({view(m){const g=S=>{var v;r=!((v=m.dom.parentElement)===null||v===void 0)&&v.contains(S.target)?m.dom.parentElement:null,r&&(Yd=e)},b=()=>{Yd&&(Yd=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,c=g,!s){const b=Yd;b!=null&&b.isEditable&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,g)=>{var b;const S=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const S=m[0],v=S.getMeta("uiEvent")==="paste"&&!i,C=S.getMeta("uiEvent")==="drop"&&!s,T=S.getMeta("applyPasteRules"),H=!!T;if(!v&&!C&&!H)return;if(H){let{text:$}=T;typeof $=="string"?$=$:$=Gx(te.from($),b.schema);const{from:N}=T,D=N+$.length,K=_6($);return f({rule:p,state:b,from:N,to:{b:D},pasteEvt:K})}const j=g.doc.content.findDiffStart(b.doc.content),ne=g.doc.content.findDiffEnd(b.doc.content);if(!(!T6(j)||!ne||j===ne.b))return f({rule:p,state:b,from:j,to:ne,pasteEvt:l})}}))}function R6(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class pa{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=pa.resolve(e),this.schema=w6(this.extensions,n),this.setupExtensions()}static resolve(e){const n=pa.sort(pa.flatten(e)),r=R6(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=we(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=we(r,"priority")||100,l=we(i,"priority")||100;return s>l?-1:s<l?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:c0(n.name,this.schema)},i=we(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=pa.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(l=>{const c={name:l.name,options:l.options,storage:l.storage,editor:e,type:c0(l.name,this.schema)},f=[],d=we(l,"addKeyboardShortcuts",c);let p={};if(l.type==="mark"&&we(l,"exitable",c)&&(p.ArrowRight=()=>Ti.handleExit({editor:e,mark:l})),d){const v=Object.fromEntries(Object.entries(d()).map(([C,T])=>[C,()=>T({editor:e})]));p={...p,...v}}const m=JL(p);f.push(m);const g=we(l,"addInputRules",c);UE(l,e.options.enableInputRules)&&g&&r.push(...g());const b=we(l,"addPasteRules",c);UE(l,e.options.enablePasteRules)&&b&&i.push(...b());const S=we(l,"addProseMirrorPlugins",c);if(S){const v=S();f.push(...v)}return f}).flat();return[C6({editor:e,rules:r}),...D6({editor:e,rules:i}),...s]}get attributes(){return BO(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=im(this.extensions);return Object.fromEntries(n.filter(r=>!!we(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:mn(r.name,this.schema)},l=we(r,"addNodeView",s);if(!l)return[];const c=(f,d,p,m,g)=>{const b=Ab(f,i);return l()({node:f,view:d,getPos:p,decorations:m,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,c]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:c0(e.name,this.schema)};e.type==="mark"&&(!((n=Ye(we(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=we(e,"onBeforeCreate",r),s=we(e,"onCreate",r),l=we(e,"onUpdate",r),c=we(e,"onSelectionUpdate",r),f=we(e,"onTransaction",r),d=we(e,"onFocus",r),p=we(e,"onBlur",r),m=we(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),f&&this.editor.on("transaction",f),d&&this.editor.on("focus",d),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}}class Wt{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ye(we(this,"addOptions",{name:this.name}))),this.storage=Ye(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Wt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>om(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Wt({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ye(we(n,"addOptions",{name:n.name})),n.storage=Ye(we(n,"addStorage",{name:n.name,options:n.options})),n}}function HO(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
71
+
72
+ `,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(f,d,p,m)=>{var g;f.isBlock&&d>r&&(c+=s);const b=l==null?void 0:l[f.type.name];if(b)return p&&(c+=b({node:f,pos:d,parent:p,index:m,range:e})),!1;f.isText&&(c+=(g=f==null?void 0:f.text)===null||g===void 0?void 0:g.slice(Math.max(r,d)-d,i-d))}),c}function VO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const N6=Wt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xt({key:new Rt("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)),f=VO(n);return HO(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}}),z6=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),L6=(t=!1)=>({commands:e})=>e.setContent("",t),j6=()=>({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,f)=>{if(c.type.isText)return;const{doc:d,mapping:p}=e,m=d.resolve(p.map(f)),g=d.resolve(p.map(f+c.nodeSize)),b=m.blockRange(g);if(!b)return;const S=Ka(b);if(c.type.isTextblock){const{defaultType:v}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,v)}(S||S===0)&&e.lift(b,S)})}),!0},I6=t=>e=>t(e),B6=()=>({state:t,dispatch:e})=>zO(t,e),U6=(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 _e(r.doc.resolve(Math.max(l-1,0)))),!0},H6=()=>({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),f=i.after(s);t.delete(c,f).scrollIntoView()}return!0}return!1},V6=t=>({tr:e,state:n,dispatch:r})=>{const i=mn(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 f=s.before(l),d=s.after(l);e.delete(f,d).scrollIntoView()}return!0}return!1},P6=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},$6=()=>({state:t,dispatch:e})=>Fx(t,e),F6=()=>({commands:t})=>t.keyboardShortcut("Enter"),q6=()=>({state:t,dispatch:e})=>r6(t,e);function Gh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Zx(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function PO(t,e,n={}){return t.find(r=>r.type===e&&Gh(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function HE(t,e,n={}){return!!PO(t,e,n)}function Jx(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||r===void 0?void 0:r.attrs),!PO([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,f=l+1,d=c+i.node.nodeSize;for(;l>0&&HE([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;f<t.parent.childCount&&HE([...t.parent.child(f).marks],e,n);)d+=t.parent.child(f).nodeSize,f+=1;return{from:c,to:d}}function xo(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Y6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=xo(t,r.schema),{doc:l,selection:c}=n,{$from:f,from:d,to:p}=c;if(i){const m=Jx(f,s,e);if(m&&m.from<=d&&m.to>=p){const g=_e.create(l,m.from,m.to);n.setSelection(g)}}return!0},K6=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 $O(t){return t instanceof _e}function Yo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function FO(t,e=null){if(!e)return null;const n=ze.atStart(t),r=ze.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?_e.create(t,Yo(0,i,s),Yo(t.content.size,i,s)):_e.create(t,Yo(e,i,s),Yo(e,i,s))}function VE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Zh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function W6(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const G6=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Zh()||VE())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),W6()&&!Zh()&&!VE()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!$O(n.state.selection))return l(),!0;const c=FO(i.doc,t)||n.state.selection,f=n.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},Z6=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),J6=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),qO=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&&qO(r)}return t};function Kd(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return qO(n)}function Pu(t,e,n){if(t instanceof so||t instanceof te)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 te.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),Pu("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const f=new TM({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:d=>(l=!0,c=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?uu.fromSchema(f).parseSlice(Kd(t),n.parseOptions):uu.fromSchema(f).parse(Kd(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=uu.fromSchema(e);return n.slice?s.parseSlice(Kd(t),n.parseOptions).content:s.parse(Kd(t),n.parseOptions)}return Pu("",e,n)}function X6(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof fn||i instanceof dn))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,f,d,p)=>{l===0&&(l=p)}),t.setSelection(ze.near(t.doc.resolve(l),n))}const Q6=t=>!("type"in t),ej=(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 f=C=>{s.emit("contentError",{editor:s,error:C,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Pu(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(C){f(C)}try{c=Pu(e,s.schema,{parseOptions:d,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(C){return f(C),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((Q6(c)?c:[c]).forEach(C=>{C.check(),g=g?C.isText&&C.marks.length===0:!1,b=b?C.isBlock:!1}),p===m&&b){const{parent:C}=r.doc.resolve(p);C.isTextblock&&!C.type.spec.code&&!C.childCount&&(p-=1,m+=1)}let v;if(g){if(Array.isArray(e))v=e.map(C=>C.text||"").join("");else if(e instanceof te){let C="";e.forEach(T=>{T.text&&(C+=T.text)}),v=C}else typeof e=="object"&&e&&e.text?v=e.text:v=e;r.insertText(v,p,m)}else v=c,r.replaceWith(p,m,v);n.updateSelection&&X6(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:v}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:v})}return!0},tj=()=>({state:t,dispatch:e})=>e6(t,e),nj=()=>({state:t,dispatch:e})=>t6(t,e),rj=()=>({state:t,dispatch:e})=>AO(t,e),ij=()=>({state:t,dispatch:e})=>DO(t,e),sj=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},oj=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},lj=()=>({state:t,dispatch:e})=>XL(t,e),aj=()=>({state:t,dispatch:e})=>QL(t,e);function YO(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function cj(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 f=e[c];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))Zh()||YO()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const uj=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=cj(t).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),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}),f=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,c))});return f==null||f.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function $u(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?mn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),S=Math.min(i,g+m.nodeSize);c.push({node:m,from:b,to:S})});const f=i-r,d=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>Gh(m.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((m,g)=>m+g.to-g.from,0)>=f}const fj=(t,e={})=>({state:n,dispatch:r})=>{const i=mn(t,n.schema);return $u(n,i,e)?n6(n,r):!1},dj=()=>({state:t,dispatch:e})=>LO(t,e),hj=t=>({state:e,dispatch:n})=>{const r=mn(t,e.schema);return p6(r)(e,n)},pj=()=>({state:t,dispatch:e})=>NO(t,e);function lm(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function PE(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const mj=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=lm(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=mn(t,r.schema)),c==="mark"&&(l=xo(t,r.schema)),i&&n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(d,p)=>{s&&s===d.type&&n.setNodeMarkup(p,void 0,PE(d.attrs,e)),l&&d.marks.length&&d.marks.forEach(m=>{l===m.type&&n.addMark(p,p+d.nodeSize,l.create(PE(m.attrs,e)))})})}),!0):!1},gj=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),yj=()=>({tr:t,dispatch:e})=>{if(e){const n=new sr(t.doc);t.setSelection(n)}return!0},bj=()=>({state:t,dispatch:e})=>OO(t,e),xj=()=>({state:t,dispatch:e})=>RO(t,e),Sj=()=>({state:t,dispatch:e})=>o6(t,e),wj=()=>({state:t,dispatch:e})=>c6(t,e),vj=()=>({state:t,dispatch:e})=>a6(t,e);function Mb(t,e,n={},r={}){return Pu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const kj=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var f,d;const{doc:p}=s;if(n.preserveWhitespace!=="full"){const m=Mb(t,i.schema,n,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return l&&s.replaceWith(0,p.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:p.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck})};function KO(t,e){const n=xo(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,f=>{l.push(...f.marks)});const c=l.find(f=>f.type.name===n.name);return c?{...c.attrs}:{}}function Cj(t,e){const n=new Rx(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Ej(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 Tj(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function WO(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 Xx(t){return e=>WO(e.$from,t)}function Aj(t,e){const n={from:0,to:t.content.size};return HO(t,n,e)}function Mj(t,e){const n=mn(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 GO(t,e){const n=lm(typeof e=="string"?e:e.name,t.schema);return n==="node"?Mj(t,e):n==="mark"?KO(t,e):{}}function Oj(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 _j(t){const e=Oj(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 Dj(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,f)=>{l.push({from:c,to:f})});else{const{from:c,to:f}=n[s];if(c===void 0||f===void 0)return;l.push({from:c,to:f})}l.forEach(({from:c,to:f})=>{const d=e.slice(s).map(c,-1),p=e.slice(s).map(f),m=e.invert().map(d,-1),g=e.invert().map(p);r.push({oldRange:{from:m,to:g},newRange:{from:d,to:p}})})}),_j(r)}function Qx(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=Jx(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}function yh(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}))}function Ob(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?xo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Gh(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const b=m.pos,S=g.pos;t.doc.nodesBetween(b,S,(v,C)=>{if(!v.isText&&!v.marks.length)return;const T=Math.max(b,C),H=Math.min(S,C+v.nodeSize),j=H-T;l+=j,c.push(...v.marks.map(ne=>({mark:ne,from:T,to:H})))})}),l===0)return!1;const f=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Gh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),d=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(f>0?f+d:f)>=l}function Rj(t,e,n={}){if(!e)return $u(t,null,n)||Ob(t,null,n);const r=lm(e,t.schema);return r==="node"?$u(t,e,n):r==="mark"?Ob(t,e,n):!1}function $E(t,e){const{nodeExtensions:n}=im(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Ye(we(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function am(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!==void 0?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&&(am(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Nj(t){return t instanceof Me}function zj(t,e,n){var r;const{selection:i}=e;let s=null;if($O(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(f=>f.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:f})=>{let d=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,f.pos,(p,m,g)=>{if(d)return!1;if(p.isInline){const b=!g||g.type.allowsMarkType(n),S=!!n.isInSet(p.marks)||!p.marks.some(v=>v.type.excludes(n));d=b&&S}return!d}),d})}const Lj=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,f=xo(t,r.schema);if(i)if(l){const d=KO(r,f);n.addStoredMark(f.create({...d,...e}))}else c.forEach(d=>{const p=d.$from.pos,m=d.$to.pos;r.doc.nodesBetween(p,m,(g,b)=>{const S=Math.max(b,p),v=Math.min(b+g.nodeSize,m);g.marks.find(T=>T.type===f)?g.marks.forEach(T=>{f===T.type&&n.addMark(S,v,f.create({...T.attrs,...e}))}):n.addMark(S,v,f.create(e))})});return zj(r,n,f)},jj=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Ij=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=mn(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})=>jE(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>jE(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Bj=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Yo(t,0,r.content.size),s=Me.create(r,i);e.setSelection(s)}return!0},Uj=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=_e.atStart(r).from,c=_e.atEnd(r).to,f=Yo(i,l,c),d=Yo(s,l,c),p=_e.create(r,f,d);e.setSelection(p)}return!0},Hj=t=>({state:e,dispatch:n})=>{const r=mn(t,e.schema);return y6(r)(e,n)};function FE(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)}}const Vj=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=yh(d,c.node().type.name,c.node().attrs);if(s instanceof Me&&s.node.isBlock)return!c.parentOffset||!fs(l,c.pos)?!1:(r&&(t&&FE(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=f.parentOffset===f.parent.content.size,g=c.depth===0?void 0:Ej(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:p}]:void 0,S=fs(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&fs(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(S=!0,b=g?[{type:g,attrs:p}]:void 0),r){if(S&&(s instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const v=e.mapping.map(c.before()),C=e.doc.resolve(v);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&FE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},Pj=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=mn(t,r.schema),{$from:f,$to:d}=r.selection,p=r.selection.node;if(p&&p.isBlock||f.depth<2||!f.sameParent(d))return!1;const m=f.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let T=te.empty;const H=f.index(-1)?1:f.index(-2)?2:3;for(let K=f.depth-H;K>=f.depth-3;K-=1)T=te.from(f.node(K).copy(T));const j=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,ne={...yh(g,f.node().type.name,f.node().attrs),...e},$=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(ne))||void 0;T=T.append(te.from(c.createAndFill(null,$)||void 0));const N=f.before(f.depth-(H-1));n.replace(N,f.after(-j),new pe(T,4-H,0));let D=-1;n.doc.nodesBetween(N,n.doc.content.size,(K,ae)=>{if(D>-1)return!1;K.isTextblock&&K.content.size===0&&(D=ae+1)}),D>-1&&n.setSelection(_e.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const b=d.pos===f.end()?m.contentMatchAt(0).defaultType:null,S={...yh(g,m.type.name,m.attrs),...e},v={...yh(g,f.node().type.name,f.node().attrs),...e};n.delete(f.pos,d.pos);const C=b?[{type:c,attrs:S},{type:b,attrs:v}]:[{type:c,attrs:S}];if(!fs(n.doc,f.pos,2))return!1;if(i){const{selection:T,storedMarks:H}=r,{splittableMarks:j}=s.extensionManager,ne=H||T.$to.parentOffset&&T.$from.marks();if(n.split(f.pos,2,C).scrollIntoView(),!ne||!i)return!0;const $=ne.filter(N=>j.includes(N.type.name));n.ensureMarks($)}return!0},u0=(t,e)=>{const n=Xx(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)&&yo(t.doc,n.pos)&&t.join(n.pos),!0},f0=(t,e)=>{const n=Xx(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)&&yo(t.doc,r)&&t.join(r),!0},$j=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,b=mn(t,l.schema),S=mn(e,l.schema),{selection:v,storedMarks:C}=l,{$from:T,$to:H}=v,j=T.blockRange(H),ne=C||v.$to.parentOffset&&v.$from.marks();if(!j)return!1;const $=Xx(N=>$E(N.type.name,m))(v);if(j.depth>=1&&$&&j.depth-$.depth<=1){if($.node.type===b)return d.liftListItem(S);if($E($.node.type.name,m)&&b.validContent($.node.content)&&c)return f().command(()=>(s.setNodeMarkup($.pos,b),!0)).command(()=>u0(s,b)).command(()=>f0(s,b)).run()}return!n||!ne||!c?f().command(()=>p().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>u0(s,b)).command(()=>f0(s,b)).run():f().command(()=>{const N=p().wrapInList(b,r),D=ne.filter(K=>g.includes(K.type.name));return s.ensureMarks(D),N?!0:d.clearNodes()}).wrapInList(b,r).command(()=>u0(s,b)).command(()=>f0(s,b)).run()},Fj=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=xo(t,r.schema);return Ob(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},qj=(t,e,n={})=>({state:r,commands:i})=>{const s=mn(t,r.schema),l=mn(e,r.schema),c=$u(r,s,n);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(l,f):i.setNode(s,{...f,...n})},Yj=(t,e={})=>({state:n,commands:r})=>{const i=mn(t,n.schema);return $u(n,i,e)?r.lift(i):r.wrapIn(i,e)},Kj=()=>({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 f=c.steps.length-1;f>=0;f-=1)l.step(c.steps[f].invert(c.docs[f]));if(s.text){const f=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,f))}else l.delete(s.from,s.to)}return!0}}return!1},Wj=()=>({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},Gj=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,f=xo(t,r.schema),{$from:d,empty:p,ranges:m}=c;if(!i)return!0;if(p&&l){let{from:g,to:b}=c;const S=(s=d.marks().find(C=>C.type===f))===null||s===void 0?void 0:s.attrs,v=Jx(d,f,S);v&&(g=v.from,b=v.to),n.removeMark(g,b,f)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,f)});return n.removeStoredMark(f),!0},Zj=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=lm(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=mn(t,r.schema)),c==="mark"&&(l=xo(t,r.schema)),i&&n.selection.ranges.forEach(f=>{const d=f.$from.pos,p=f.$to.pos;let m,g,b,S;n.selection.empty?r.doc.nodesBetween(d,p,(v,C)=>{s&&s===v.type&&(b=Math.max(C,d),S=Math.min(C+v.nodeSize,p),m=C,g=v)}):r.doc.nodesBetween(d,p,(v,C)=>{C<d&&s&&s===v.type&&(b=Math.max(C,d),S=Math.min(C+v.nodeSize,p),m=C,g=v),C>=d&&C<=p&&(s&&s===v.type&&n.setNodeMarkup(C,void 0,{...v.attrs,...e}),l&&v.marks.length&&v.marks.forEach(T=>{if(l===T.type){const H=Math.max(C,d),j=Math.min(C+v.nodeSize,p);n.addMark(H,j,l.create({...T.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(v=>{l===v.type&&n.addMark(b,S,l.create({...v.attrs,...e}))}))}),!0):!1},Jj=(t,e={})=>({state:n,dispatch:r})=>{const i=mn(t,n.schema);return u6(i,e)(n,r)},Xj=(t,e={})=>({state:n,dispatch:r})=>{const i=mn(t,n.schema);return f6(i,e)(n,r)};var Qj=Object.freeze({__proto__:null,blur:z6,clearContent:L6,clearNodes:j6,command:I6,createParagraphNear:B6,cut:U6,deleteCurrentNode:H6,deleteNode:V6,deleteRange:P6,deleteSelection:$6,enter:F6,exitCode:q6,extendMarkRange:Y6,first:K6,focus:G6,forEach:Z6,insertContent:J6,insertContentAt:ej,joinBackward:rj,joinDown:nj,joinForward:ij,joinItemBackward:sj,joinItemForward:oj,joinTextblockBackward:lj,joinTextblockForward:aj,joinUp:tj,keyboardShortcut:uj,lift:fj,liftEmptyBlock:dj,liftListItem:hj,newlineInCode:pj,resetAttributes:mj,scrollIntoView:gj,selectAll:yj,selectNodeBackward:bj,selectNodeForward:xj,selectParentNode:Sj,selectTextblockEnd:wj,selectTextblockStart:vj,setContent:kj,setMark:Lj,setMeta:jj,setNode:Ij,setNodeSelection:Bj,setTextSelection:Uj,sinkListItem:Hj,splitBlock:Vj,splitListItem:Pj,toggleList:$j,toggleMark:Fj,toggleNode:qj,toggleWrap:Yj,undoInputRule:Kj,unsetAllMarks:Wj,unsetMark:Gj,updateAttributes:Zj,wrapIn:Jj,wrapInList:Xj});const eI=Wt.create({name:"commands",addCommands(){return{...Qj}}}),tI=Wt.create({name:"drop",addProseMirrorPlugins(){return[new xt({key:new Rt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),nI=Wt.create({name:"editable",addProseMirrorPlugins(){return[new xt({key:new Rt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rI=new Rt("focusEvents"),iI=Wt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new xt({key:rI,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}}}})]}}),sI=Wt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:f,doc:d}=c,{empty:p,$anchor:m}=f,{pos:g,parent:b}=m,S=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,v=S.parent.type.spec.isolating,C=m.pos-m.parentOffset,T=v&&S.parent.childCount===1?C===m.pos:ze.atStart(d).from===g;return!p||!b.type.isTextblock||b.textContent.length||!T||T&&m.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 Zh()||YO()?s:i},addProseMirrorPlugins(){return[new xt({key:new Rt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(v=>v.getMeta("composition")))return;const r=t.some(v=>v.docChanged)&&!e.doc.eq(n.doc),i=t.some(v=>v.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,f=ze.atStart(e.doc).from,d=ze.atEnd(e.doc).to;if(s||!(l===f&&c===d)||!am(n.doc))return;const g=n.tr,b=nm({state:n,transaction:g}),{commands:S}=new rm({editor:this.editor,state:b});if(S.clearNodes(),!!g.steps.length)return g}})]}}),oI=Wt.create({name:"paste",addProseMirrorPlugins(){return[new xt({key:new Rt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),lI=Wt.create({name:"tabindex",addProseMirrorPlugins(){return[new xt({key:new Rt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Vo{get name(){return this.node.type.name}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 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!==void 0?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 Vo(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 Vo(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 Vo(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=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(l);if(!i&&c.depth<=this.depth)return;const f=new Vo(c,this.editor,i,i?n:null);i&&(f.actualDepth=this.depth+1),e.push(new Vo(c,this.editor,i,i?n:null))}),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 f=l[c];if(s[f]!==n[f])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(f=>n[f]===l.node.attrs[f])&&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)}}const aI=`.ProseMirror {
73
+ position: relative;
74
+ }
75
+
76
+ .ProseMirror {
77
+ word-wrap: break-word;
78
+ white-space: pre-wrap;
79
+ white-space: break-spaces;
80
+ -webkit-font-variant-ligatures: none;
81
+ font-variant-ligatures: none;
82
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
83
+ }
84
+
85
+ .ProseMirror [contenteditable="false"] {
86
+ white-space: normal;
87
+ }
88
+
89
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
90
+ white-space: pre-wrap;
91
+ }
92
+
93
+ .ProseMirror pre {
94
+ white-space: pre-wrap;
95
+ }
96
+
97
+ img.ProseMirror-separator {
98
+ display: inline !important;
99
+ border: none !important;
100
+ margin: 0 !important;
101
+ width: 0 !important;
102
+ height: 0 !important;
103
+ }
104
+
105
+ .ProseMirror-gapcursor {
106
+ display: none;
107
+ pointer-events: none;
108
+ position: absolute;
109
+ margin: 0;
110
+ }
111
+
112
+ .ProseMirror-gapcursor:after {
113
+ content: "";
114
+ display: block;
115
+ position: absolute;
116
+ top: -2px;
117
+ width: 20px;
118
+ border-top: 1px solid black;
119
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
120
+ }
121
+
122
+ @keyframes ProseMirror-cursor-blink {
123
+ to {
124
+ visibility: hidden;
125
+ }
126
+ }
127
+
128
+ .ProseMirror-hideselection *::selection {
129
+ background: transparent;
130
+ }
131
+
132
+ .ProseMirror-hideselection *::-moz-selection {
133
+ background: transparent;
134
+ }
135
+
136
+ .ProseMirror-hideselection * {
137
+ caret-color: transparent;
138
+ }
139
+
140
+ .ProseMirror-focused .ProseMirror-gapcursor {
141
+ display: block;
142
+ }
143
+
144
+ .tippy-box[data-animation=fade][data-state=hidden] {
145
+ opacity: 0
146
+ }`;function cI(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}let uI=class extends b6{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=cI(aI,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=UO(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;r=r.filter(c=>!c.key.startsWith(l))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[nI,N6.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),eI,iI,sI,lI,tI,oI].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new pa(i,this)}createCommandManager(){this.commandManager=new rm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Mb(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(c=>c.name!=="collaboration"),this.createExtensionManager()}}),n=Mb(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=FO(n,this.options.autofocus);this.view=new EO(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:ha.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(l=>{var c;return(c=this.capturedTransaction)===null||c===void 0?void 0:c.step(l)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return GO(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return Rj(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Gx(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
147
+
148
+ `,textSerializers:r={}}=e||{};return Aj(this.state.doc,{blockSeparator:n,textSerializers:{...VO(this.schema),...r}})}get isEmpty(){return am(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Vo(n,this)}get $doc(){return this.$pos(0)}};function ll(t){return new sm({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ye(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 f=c.search(/\S/),d=n.from+c.indexOf(l),p=d+l.length;if(Qx(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(v=>v===t.type&&v!==b.mark.type)).filter(b=>b.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+f,d);const g=n.from+f+l.length;s.addMark(n.from+f,g,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function fI(t){return new sm({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ye(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const f=t.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let p=l+d;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(p,c,f)}else if(r[0]){const d=t.type.isInline?l:l-1;s.insert(d,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()}})}function _b(t){return new sm({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Ye(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)}})}function Fu(t){return new sm({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Ye(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),f=l.doc.resolve(n.from).blockRange(),d=f&&Dx(f,t.type,s);if(!d)return null;if(l.wrap(f,d),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,S=g||m.$to.parentOffset&&m.$from.marks();if(S){const v=S.filter(C=>b.includes(C.type.name));l.ensureMarks(v)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&yo(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(n.from-1)}})}class gn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ye(we(this,"addOptions",{name:this.name}))),this.storage=Ye(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new gn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>om(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new gn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ye(we(n,"addOptions",{name:n.name})),n.storage=Ye(we(n,"addStorage",{name:n.name,options:n.options})),n}}function ho(t){return new A6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Ye(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],f=r[0];let d=n.to;if(c){const p=f.search(/\S/),m=n.from+f.indexOf(c),g=m+c.length;if(Qx(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(C=>C===t.type&&C!==S.mark.type)).filter(S=>S.to>m).length)return null;g<n.to&&l.delete(g,n.to),m>n.from&&l.delete(n.from+p,m),d=n.from+p+c.length,l.addMark(n.from+p,d,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}function dI(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}const Kr=()=>new Map,Db=t=>{const e=Kr();return t.forEach((n,r)=>{e.set(r,n)}),e},Di=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},hI=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},pI=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},al=()=>new Set,d0=t=>t[t.length-1],mI=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},po=Array.from,e1=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},t1=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},gI=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ia=Array.isArray;class ZO{constructor(){this._observers=Kr()}on(e,n){return Di(this._observers,e,al).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return po((this._observers.get(e)||Kr()).values()).forEach(r=>r(...n))}destroy(){this._observers=Kr()}}const ri=Math.floor,bh=Math.abs,hs=(t,e)=>t<e?t:e,ii=(t,e)=>t>e?t:e,JO=t=>t!==0?t<0:1/t<0,qE=1,YE=2,h0=4,p0=8,qu=32,ps=64,Pn=128,yI=1<<29,cm=31,Rb=63,Xo=127,bI=2147483647,Jh=Number.MAX_SAFE_INTEGER,KE=Number.MIN_SAFE_INTEGER,xI=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ri(t)===t),XO=String.fromCharCode,SI=t=>t.toLowerCase(),wI=/^\s*/g,vI=t=>t.replace(wI,""),kI=/([A-Z])/g,WE=(t,e)=>vI(t.replace(kI,n=>`${e}${SI(n)}`)),CI=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},Yu=typeof TextEncoder<"u"?new TextEncoder:null,EI=t=>Yu.encode(t),TI=Yu?EI:CI;let pu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});pu&&pu.decode(new Uint8Array).length===1&&(pu=null);const AI=(t,e)=>gI(e,()=>t).join("");let mf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const gf=()=>new mf,MI=t=>{const e=gf();return t(e),ni(e)},OI=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},ni=t=>{const e=new Uint8Array(OI(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},_I=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(ii(n,e)*2),t.cpos=0)},cn=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Nb=cn,tt=(t,e)=>{for(;e>Xo;)cn(t,Pn|Xo&e),e=ri(e/128);cn(t,Xo&e)},n1=(t,e)=>{const n=JO(e);for(n&&(e=-e),cn(t,(e>Rb?Pn:0)|(n?ps:0)|Rb&e),e=ri(e/64);e>0;)cn(t,(e>Xo?Pn:0)|Xo&e),e=ri(e/128)},zb=new Uint8Array(3e4),DI=zb.length/3,RI=(t,e)=>{if(e.length<DI){const n=Yu.encodeInto(e,zb).written||0;tt(t,n);for(let r=0;r<n;r++)cn(t,zb[r])}else yr(t,TI(e))},NI=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;tt(t,r);for(let i=0;i<r;i++)cn(t,n.codePointAt(i))},xa=Yu&&Yu.encodeInto?RI:NI,um=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=hs(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(ii(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},yr=(t,e)=>{tt(t,e.byteLength),um(t,e)},r1=(t,e)=>{_I(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},zI=(t,e)=>r1(t,4).setFloat32(0,e,!1),LI=(t,e)=>r1(t,8).setFloat64(0,e,!1),jI=(t,e)=>r1(t,8).setBigInt64(0,e,!1),GE=new DataView(new ArrayBuffer(4)),II=t=>(GE.setFloat32(0,t),GE.getFloat32(0)===t),Ba=(t,e)=>{switch(typeof e){case"string":cn(t,119),xa(t,e);break;case"number":xI(e)&&bh(e)<=bI?(cn(t,125),n1(t,e)):II(e)?(cn(t,124),zI(t,e)):(cn(t,123),LI(t,e));break;case"bigint":cn(t,122),jI(t,e);break;case"object":if(e===null)cn(t,126);else if(Ia(e)){cn(t,117),tt(t,e.length);for(let n=0;n<e.length;n++)Ba(t,e[n])}else if(e instanceof Uint8Array)cn(t,116),yr(t,e);else{cn(t,118);const n=Object.keys(e);tt(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];xa(t,i),Ba(t,e[i])}}break;case"boolean":cn(t,e?120:121);break;default:cn(t,127)}};class ZE extends mf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&tt(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const JE=t=>{t.count>0&&(n1(t.encoder,t.count===1?t.s:-t.s),t.count>1&&tt(t.encoder,t.count-2))};class xh{constructor(){this.encoder=new mf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(JE(this),this.count=1,this.s=e)}toUint8Array(){return JE(this),ni(this.encoder)}}const XE=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);n1(t.encoder,e),t.count>1&&tt(t.encoder,t.count-2)}};class m0{constructor(){this.encoder=new mf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(XE(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return XE(this),ni(this.encoder)}}class BI{constructor(){this.sarr=[],this.s="",this.lensE=new xh}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new mf;return this.sarr.push(this.s),this.s="",xa(e,this.sarr.join("")),um(e,this.lensE.toUint8Array()),ni(e)}}const Ai=t=>new Error(t),Wr=()=>{throw Ai("Method unimplemented")},jn=()=>{throw Ai("Unexpected case")},QO=Ai("Unexpected end of array"),e_=Ai("Integer out of Range");let fm=class{constructor(e){this.arr=e,this.pos=0}};const Wa=t=>new fm(t),UI=t=>t.pos!==t.arr.length,HI=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},br=t=>HI(t,We(t)),Ua=t=>t.arr[t.pos++],We=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Xo)*n,n*=128,i<Pn)return e;if(e>Jh)throw e_}throw QO},i1=t=>{let e=t.arr[t.pos++],n=e&Rb,r=64;const i=(e&ps)>0?-1:1;if((e&Pn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Xo)*r,r*=128,e<Pn)return i*n;if(n>Jh)throw e_}throw QO},VI=t=>{let e=We(t);if(e===0)return"";{let n=String.fromCodePoint(Ua(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Ua(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},PI=t=>pu.decode(br(t)),Sa=pu?PI:VI,s1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},$I=t=>s1(t,4).getFloat32(0,!1),FI=t=>s1(t,8).getFloat64(0,!1),qI=t=>s1(t,8).getBigInt64(0,!1),YI=[t=>{},t=>null,i1,$I,FI,qI,t=>!1,t=>!0,Sa,t=>{const e=We(t),n={};for(let r=0;r<e;r++){const i=Sa(t);n[i]=Ku(t)}return n},t=>{const e=We(t),n=[];for(let r=0;r<e;r++)n.push(Ku(t));return n},br],Ku=t=>YI[127-Ua(t)](t);class QE extends fm{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),UI(this)?this.count=We(this)+1:this.count=-1),this.count--,this.s}}class Sh extends fm{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=i1(this);const e=JO(this.s);this.count=1,e&&(this.s=-this.s,this.count=We(this)+2)}return this.count--,this.s}}class g0 extends fm{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=i1(this),n=e&1;this.diff=ri(e/2),this.count=1,n&&(this.count=We(this)+2)}return this.s+=this.diff,this.count--,this.s}}class KI{constructor(e){this.decoder=new Sh(e),this.str=Sa(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const WI=crypto.getRandomValues.bind(crypto),GI=Math.random,t_=()=>WI(new Uint32Array(1))[0],ZI=t=>t[ri(GI()*t.length)],JI="10000000-1000-4000-8000"+-1e11,XI=()=>JI.replace(/[018]/g,t=>(t^t_()&15>>t/4).toString(16)),QI=Date.now,eT=t=>new Promise(t);Promise.all.bind(Promise);const tT=t=>t===void 0?null:t;class e5{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let n_=new e5,t5=!0;try{typeof localStorage<"u"&&localStorage&&(n_=localStorage,t5=!1)}catch{}const n5=n_,Wu=Symbol("Equality"),r_=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[Wu])!=null&&n.call(t,e))||!1},r5=t=>typeof t=="object",i5=Object.assign,i_=Object.keys,s5=(t,e)=>{for(const n in t)e(t[n],n)},Xh=t=>i_(t).length,o5=t=>{for(const e in t)return!1;return!0},Ga=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},o1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),l5=(t,e)=>t===e||Xh(t)===Xh(e)&&Ga(t,(n,r)=>(n!==void 0||o1(e,r))&&r_(e[r],n)),a5=Object.freeze,s_=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&s_(t[e])}return a5(t)},l1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&l1(t,e,n+1)}},c5=t=>t,wh=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Wu]!=null)return t[Wu](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!wh(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Xh(t)!==Xh(e))return!1;for(const n in t)if(!o1(t,n)||!wh(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!wh(t[n],e[n]))return!1;break;default:return!1}return!0},u5=(t,e)=>e.includes(t);var o_={};const Ha=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",l_=typeof window<"u"&&typeof document<"u"&&!Ha;let pi;const f5=()=>{if(pi===void 0)if(Ha){pi=Kr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&pi.set(e,""),e=r):e!==null&&(pi.set(e,r),e=null)}e!==null&&pi.set(e,"")}else typeof location=="object"?(pi=Kr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");pi.set(`--${WE(e,"-")}`,n),pi.set(`-${WE(e,"-")}`,n)}})):pi=Kr();return pi},Lb=t=>f5().has(t),Qh=t=>tT(Ha?o_[t.toUpperCase().replaceAll("-","_")]:n5.getItem(t)),a_=t=>Lb("--"+t)||Qh(t)!==null,d5=a_("production"),h5=Ha&&u5(o_.FORCE_COLOR,["true","1","2"]),p5=h5||!Lb("--no-colors")&&!a_("no-color")&&(!Ha||process.stdout.isTTY)&&(!Ha||Lb("--color")||Qh("COLORTERM")!==null||(Qh("TERM")||"").includes("color")),m5=t=>new Uint8Array(t),g5=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=XO(t[n]);return btoa(e)},y5=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),b5=l_?g5:y5,x5=t=>{const e=m5(t.byteLength);return e.set(t),e},S5=t=>MI(e=>Ba(e,t));class w5{constructor(e,n){this.left=e,this.right=n}}const rs=(t,e)=>new w5(t,e),nT=t=>t.next()>=.5,y0=(t,e,n)=>ri(t.next()*(n+1-e)+e),c_=(t,e,n)=>ri(t.next()*(n+1-e)+e),a1=(t,e,n)=>c_(t,e,n),v5=t=>XO(a1(t,97,122)),k5=(t,e=0,n=20)=>{const r=a1(t,e,n);let i="";for(let s=0;s<r;s++)i+=v5(t);return i},b0=(t,e)=>e[a1(t,0,e.length-1)],C5=Symbol("0schema");class E5{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(AI(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
149
+ `)}}const jb=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Wu]?r_(t,e):Ia(t)?e1(t,n=>t1(e,r=>jb(n,r))):r5(t)?Ga(t,(n,r)=>jb(n,e[r])):!1;var nb;let Yn=(nb=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),jb(n,r)}equals(e){return this.constructor===e.constructor&&wh(this.shape,e.shape)}[C5](){return!0}[Wu](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Wr()}get nullable(){return Za(this,gm)}get optional(){return new d_(this)}cast(e){return rT(e,this),e}expect(e){return rT(e,this),e}},Bd(nb,"_dilutes",!1),nb);class c1 extends Yn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),r}}const nn=(t,e=null)=>new c1(t,e);nn(c1);class u1 extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&(n==null||n.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),r}}const yn=t=>new u1(t);nn(u1);class dm extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&(n==null||n.extend(null,this.shape.join(" | "),e.toString())),r}}const hm=(...t)=>new dm(t),u_=nn(dm),T5=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),f_=t=>{if(Va.check(t))return[T5(t)];if(u_.check(t))return t.shape.map(e=>e+"");if(w_.check(t))return["[+-]?\\d+.?\\d*"];if(v_.check(t))return[".*"];if(tp.check(t))return t.shape.map(f_).flat(1);jn()};class A5 extends Yn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(f_).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&(n==null||n.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),r}}nn(A5);const M5=Symbol("optional");class d_ extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&(n==null||n.extend(null,"undefined (optional)","()")),r}get[M5](){return!0}}const O5=nn(d_);class _5 extends Yn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}nn(_5);const Kp=class Kp extends Yn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new Kp(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):Ga(this.shape,(r,i)=>{const s=this._isPartial&&!o1(e,i)||r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match")),s})}};Bd(Kp,"_dilutes",!0);let ep=Kp;const D5=t=>new ep(t),R5=nn(ep),N5=yn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class h_ extends Yn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Ga(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&(n==null||n.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value")),s&&this.shape.values.check(r,n)})}}const p_=(t,e)=>new h_(t,e),z5=nn(h_);class m_ extends Yn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Ga(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const L5=(...t)=>new m_(t);nn(m_);class g_ extends Yn{constructor(e){super(),this.shape=e.length===1?e[0]:new pm(e)}check(e,n){const r=Ia(e)&&e1(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const y_=(...t)=>new g_(t),j5=nn(g_),I5=yn(t=>Ia(t));class b_ extends Yn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),r}}const B5=(t,e=null)=>new b_(t,e);nn(b_);const U5=B5(Yn);class H5 extends Yn{constructor(e){super(),this.len=e.length-1,this.args=L5(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&(n==null||n.extend(null,"function",typeof e)),r}}const V5=nn(H5),P5=yn(t=>typeof t=="function");class $5 extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=e1(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}nn($5,t=>t.shape.length>0);class pm extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=t1(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Bd(pm,"_dilutes",!0);const Za=(...t)=>t.findIndex(e=>tp.check(e))>=0?Za(...t.map(e=>Gu(e)).map(e=>tp.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new pm(t),tp=nn(pm),x_=()=>!0,np=yn(x_),F5=nn(u1,t=>t.shape===x_),f1=yn(t=>typeof t=="bigint"),q5=yn(t=>t===f1),S_=yn(t=>typeof t=="symbol");yn(t=>t===S_);const wa=yn(t=>typeof t=="number"),w_=yn(t=>t===wa),Va=yn(t=>typeof t=="string"),v_=yn(t=>t===Va),mm=yn(t=>typeof t=="boolean"),Y5=yn(t=>t===mm),k_=hm(void 0);nn(dm,t=>t.shape.length===1&&t.shape[0]===void 0);hm(void 0);const gm=hm(null),K5=nn(dm,t=>t.shape.length===1&&t.shape[0]===null);nn(Uint8Array);nn(c1,t=>t.shape===Uint8Array);const W5=Za(wa,Va,gm,k_,f1,mm,S_);(()=>{const t=y_(np),e=p_(Va,np),n=Za(wa,Va,gm,mm,t,e);return t.shape=n,e.shape.values=n,n})();const Gu=t=>{if(U5.check(t))return t;if(N5.check(t)){const e={};for(const n in t)e[n]=Gu(t[n]);return D5(e)}else{if(I5.check(t))return Za(...t.map(Gu));if(W5.check(t))return hm(t);if(P5.check(t))return nn(t)}jn()},rT=d5?()=>{}:(t,e)=>{const n=new E5;if(!e.check(t,n))throw Ai(`Expected value to be of type ${e.constructor.name}.
150
+ ${n.toString()}`)};class G5{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Gu(e),h:n}),this}else(e){return this.if(np,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw Ai("Unhandled pattern")}}}const Z5=t=>new G5(t),C_=Z5(np).if(w_,(t,e)=>y0(e,KE,Jh)).if(v_,(t,e)=>k5(e)).if(Y5,(t,e)=>nT(e)).if(q5,(t,e)=>BigInt(y0(e,KE,Jh))).if(tp,(t,e)=>sa(e,b0(e,t.shape))).if(R5,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(O5.check(i)){if(nT(e))continue;i=i.shape}n[r]=C_(i,e)}return n}).if(j5,(t,e)=>{const n=[],r=c_(e,0,42);for(let i=0;i<r;i++)n.push(sa(e,t.shape));return n}).if(u_,(t,e)=>b0(e,t.shape)).if(K5,(t,e)=>null).if(V5,(t,e)=>{const n=sa(e,t.res);return()=>n}).if(F5,(t,e)=>sa(e,b0(e,[wa,Va,gm,k_,f1,mm,y_(wa),p_(Za("a","b","c"),wa)]))).if(z5,(t,e)=>{const n={},r=y0(e,0,3);for(let i=0;i<r;i++){const s=sa(e,t.shape.keys),l=sa(e,t.shape.values);n[s]=l}return n}).done(),sa=(t,e)=>C_(Gu(e),t),yf=typeof document<"u"?document:{};yn(t=>t.nodeType===tB);typeof DOMParser<"u"&&new DOMParser;yn(t=>t.nodeType===X5);yn(t=>t.nodeType===Q5);const J5=t=>hI(t,(e,n)=>`${n}:${e};`).join(""),X5=yf.ELEMENT_NODE,Q5=yf.TEXT_NODE,eB=yf.DOCUMENT_NODE,tB=yf.DOCUMENT_FRAGMENT_NODE;yn(t=>t.nodeType===eB);const nB=t=>class{constructor(n){this._=n}destroy(){t(this._)}},rB=nB(clearTimeout),d1=(t,e)=>new rB(setTimeout(e,t)),ys=Symbol,E_=ys(),T_=ys(),iB=ys(),sB=ys(),oB=ys(),A_=ys(),lB=ys(),h1=ys(),aB=ys(),cB=t=>{var i;t.length===1&&((i=t[0])==null?void 0:i.constructor)===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const s=t[r];s instanceof Symbol||n.push(s)}return n},uB={[E_]:rs("font-weight","bold"),[T_]:rs("font-weight","normal"),[iB]:rs("color","blue"),[oB]:rs("color","green"),[sB]:rs("color","grey"),[A_]:rs("color","red"),[lB]:rs("color","purple"),[h1]:rs("color","orange"),[aB]:rs("color","black")},fB=t=>{var l;t.length===1&&((l=t[0])==null?void 0:l.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Kr();let i=[],s=0;for(;s<t.length;s++){const c=t[s],f=uB[c];if(f!==void 0)r.set(f.left,f.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const d=J5(r);s>0||d.length>0?(e.push("%c"+c),n.push(d)):e.push(c)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const c=t[s];c instanceof Symbol||i.push(c)}return i},M_=p5?fB:cB,dB=(...t)=>{console.log(...M_(t)),__.forEach(e=>e.print(t))},O_=(...t)=>{console.warn(...M_(t)),t.unshift(h1),__.forEach(e=>e.print(t))},__=al(),D_=t=>({[Symbol.iterator](){return this},next:t}),hB=(t,e)=>D_(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),x0=(t,e)=>D_(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class ym{constructor(e,n){this.clock=e,this.len=n}}class Ja{constructor(){this.clients=new Map}}const mo=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const l=s[s.length-1],c=l.id.clock+l.length;for(let f=0,d=r[f];f<r.length&&d.clock<c;d=r[++f])q_(t,s,d.clock,d.len,n)}}),pB=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=ri((n+r)/2),s=t[i],l=s.clock;if(l<=e){if(e<l+s.len)return i;n=i+1}else r=i-1}return null},Xa=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&pB(n,e.clock)!==null},p1=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?e[r-1]=new ym(i.clock,ii(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Ib=t=>{const e=new Ja;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let l=n+1;l<t.length;l++)mI(s,t[l].clients.get(i)||[]);e.clients.set(i,s)}});return p1(e),e},Zu=(t,e,n,r)=>{Di(t.clients,e,()=>[]).push(new ym(n,r))},R_=()=>new Ja,N_=t=>{const e=R_();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const l=n[s];if(l.deleted){const c=l.id.clock;let f=l.length;if(s+1<n.length)for(let d=n[s+1];s+1<n.length&&d.deleted;d=n[++s+1])f+=d.length;i.push(new ym(c,f))}}i.length>0&&e.clients.set(r,i)}),e},Qa=(t,e)=>{tt(t.restEncoder,e.clients.size),po(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),tt(t.restEncoder,n);const i=r.length;tt(t.restEncoder,i);for(let s=0;s<i;s++){const l=r[s];t.writeDsClock(l.clock),t.writeDsLen(l.len)}})},m1=t=>{const e=new Ja,n=We(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=We(t.restDecoder),s=We(t.restDecoder);if(s>0){const l=Di(e.clients,i,()=>[]);for(let c=0;c<s;c++)l.push(new ym(t.readDsClock(),t.readDsLen()))}}return e},iT=(t,e,n)=>{const r=new Ja,i=We(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const l=We(t.restDecoder),c=We(t.restDecoder),f=n.clients.get(l)||[],d=Kt(n,l);for(let p=0;p<c;p++){const m=t.readDsClock(),g=m+t.readDsLen();if(m<d){d<g&&Zu(r,l,d,g-d);let b=si(f,m),S=f[b];for(!S.deleted&&S.id.clock<m&&(f.splice(b+1,0,cp(e,S,m-S.id.clock)),b++);b<f.length&&(S=f[b++],S.id.clock<g);)S.deleted||(g<S.id.clock+S.length&&f.splice(b,0,cp(e,S,g-S.id.clock)),S.delete(e))}else Zu(r,l,m,g-m)}}if(r.clients.size>0){const s=new cl;return tt(s.restEncoder,0),Qa(s,r),s.toUint8Array()}return null},z_=t_;class Mi extends ZO{constructor({guid:e=XI(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:l=!1,shouldLoad:c=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=z_(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new $_,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=l,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=eT(d=>{this.on("load",()=>{this.isLoaded=!0,d(this)})});const f=()=>eT(d=>{const p=m=>{(m===void 0||m===!0)&&(this.off("sync",p),d())};this.on("sync",p)});this.on("sync",d=>{d===!1&&this.isSynced&&(this.whenSynced=f()),this.isSynced=d===void 0||d===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=f()}load(){const e=this._item;e!==null&&!this.shouldLoad&&wt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(po(this.subdocs).map(e=>e.guid))}transact(e,n=null){return wt(this,e,n)}get(e,n=hn){const r=Di(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==hn&&i!==n)if(i===hn){const s=new n;s._map=r._map,r._map.forEach(l=>{for(;l!==null;l=l.left)l.parent=s}),s._start=r._start;for(let l=s._start;l!==null;l=l.right)l.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Ca)}getText(e=""){return this.get(e,go)}getMap(e=""){return this.get(e,$a)}getXmlElement(e=""){return this.get(e,On)}getXmlFragment(e=""){return this.get(e,ul)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,po(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Mi({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,wt(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class L_{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return We(this.restDecoder)}readDsLen(){return We(this.restDecoder)}}class j_ extends L_{readLeftID(){return He(We(this.restDecoder),We(this.restDecoder))}readRightID(){return He(We(this.restDecoder),We(this.restDecoder))}readClient(){return We(this.restDecoder)}readInfo(){return Ua(this.restDecoder)}readString(){return Sa(this.restDecoder)}readParentInfo(){return We(this.restDecoder)===1}readTypeRef(){return We(this.restDecoder)}readLen(){return We(this.restDecoder)}readAny(){return Ku(this.restDecoder)}readBuf(){return x5(br(this.restDecoder))}readJSON(){return JSON.parse(Sa(this.restDecoder))}readKey(){return Sa(this.restDecoder)}}class mB{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=We(this.restDecoder),this.dsCurrVal}readDsLen(){const e=We(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Pa extends mB{constructor(e){super(e),this.keys=[],We(e),this.keyClockDecoder=new g0(br(e)),this.clientDecoder=new Sh(br(e)),this.leftClockDecoder=new g0(br(e)),this.rightClockDecoder=new g0(br(e)),this.infoDecoder=new QE(br(e),Ua),this.stringDecoder=new KI(br(e)),this.parentInfoDecoder=new QE(br(e),Ua),this.typeRefDecoder=new Sh(br(e)),this.lenDecoder=new Sh(br(e))}readLeftID(){return new va(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new va(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Ku(this.restDecoder)}readBuf(){return br(this.restDecoder)}readJSON(){return Ku(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class I_{constructor(){this.restEncoder=gf()}toUint8Array(){return ni(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){tt(this.restEncoder,e)}writeDsLen(e){tt(this.restEncoder,e)}}class bf extends I_{writeLeftID(e){tt(this.restEncoder,e.client),tt(this.restEncoder,e.clock)}writeRightID(e){tt(this.restEncoder,e.client),tt(this.restEncoder,e.clock)}writeClient(e){tt(this.restEncoder,e)}writeInfo(e){Nb(this.restEncoder,e)}writeString(e){xa(this.restEncoder,e)}writeParentInfo(e){tt(this.restEncoder,e?1:0)}writeTypeRef(e){tt(this.restEncoder,e)}writeLen(e){tt(this.restEncoder,e)}writeAny(e){Ba(this.restEncoder,e)}writeBuf(e){yr(this.restEncoder,e)}writeJSON(e){xa(this.restEncoder,JSON.stringify(e))}writeKey(e){xa(this.restEncoder,e)}}class B_{constructor(){this.restEncoder=gf(),this.dsCurrVal=0}toUint8Array(){return ni(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,tt(this.restEncoder,n)}writeDsLen(e){e===0&&jn(),tt(this.restEncoder,e-1),this.dsCurrVal+=e}}class cl extends B_{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new m0,this.clientEncoder=new xh,this.leftClockEncoder=new m0,this.rightClockEncoder=new m0,this.infoEncoder=new ZE(Nb),this.stringEncoder=new BI,this.parentInfoEncoder=new ZE(Nb),this.typeRefEncoder=new xh,this.lenEncoder=new xh}toUint8Array(){const e=gf();return tt(e,0),yr(e,this.keyClockEncoder.toUint8Array()),yr(e,this.clientEncoder.toUint8Array()),yr(e,this.leftClockEncoder.toUint8Array()),yr(e,this.rightClockEncoder.toUint8Array()),yr(e,ni(this.infoEncoder)),yr(e,this.stringEncoder.toUint8Array()),yr(e,ni(this.parentInfoEncoder)),yr(e,this.typeRefEncoder.toUint8Array()),yr(e,this.lenEncoder.toUint8Array()),um(e,ni(this.restEncoder)),ni(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Ba(this.restEncoder,e)}writeBuf(e){yr(this.restEncoder,e)}writeJSON(e){Ba(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const gB=(t,e,n,r)=>{r=ii(r,e[0].id.clock);const i=si(e,r);tt(t.restEncoder,e.length-i),t.writeClient(n),tt(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let l=i+1;l<e.length;l++)e[l].write(t,0)},g1=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Kt(e,s)>i&&r.set(s,i)}),xf(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),tt(t.restEncoder,r.size),po(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{gB(t,e.clients.get(i),i,s)})},yB=(t,e)=>{const n=Kr(),r=We(t.restDecoder);for(let i=0;i<r;i++){const s=We(t.restDecoder),l=new Array(s),c=t.readClient();let f=We(t.restDecoder);n.set(c,{i:0,refs:l});for(let d=0;d<s;d++){const p=t.readInfo();switch(cm&p){case 0:{const m=t.readLen();l[d]=new Pr(He(c,f),m),f+=m;break}case 10:{const m=We(t.restDecoder);l[d]=new $r(He(c,f),m),f+=m;break}default:{const m=(p&(ps|Pn))===0,g=new At(He(c,f),null,(p&Pn)===Pn?t.readLeftID():null,null,(p&ps)===ps?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(p&qu)===qu?t.readString():null,h2(t,p));l[d]=g,f+=g.length}}}}return n},bB=(t,e,n)=>{const r=[];let i=po(n.keys()).sort((b,S)=>b-S);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let b=n.get(i[i.length-1]);for(;b.refs.length===b.i;)if(i.pop(),i.length>0)b=n.get(i[i.length-1]);else return null;return b};let l=s();if(l===null)return null;const c=new $_,f=new Map,d=(b,S)=>{const v=f.get(b);(v==null||v>S)&&f.set(b,S)};let p=l.refs[l.i++];const m=new Map,g=()=>{for(const b of r){const S=b.id.client,v=n.get(S);v?(v.i--,c.clients.set(S,v.refs.slice(v.i)),n.delete(S),v.i=0,v.refs=[]):c.clients.set(S,[b]),i=i.filter(C=>C!==S)}r.length=0};for(;;){if(p.constructor!==$r){const S=Di(m,p.id.client,()=>Kt(e,p.id.client))-p.id.clock;if(S<0)r.push(p),d(p.id.client,p.id.clock-1),g();else{const v=p.getMissing(t,e);if(v!==null){r.push(p);const C=n.get(v)||{refs:[],i:0};if(C.refs.length===C.i)d(v,Kt(e,v)),g();else{p=C.refs[C.i++];continue}}else(S===0||S<p.length)&&(p.integrate(t,S),m.set(p.id.client,p.id.clock+p.length))}}if(r.length>0)p=r.pop();else if(l!==null&&l.i<l.refs.length)p=l.refs[l.i++];else{if(l=s(),l===null)break;p=l.refs[l.i++]}}if(c.clients.size>0){const b=new cl;return g1(b,c,new Map),tt(b.restEncoder,0),{missing:f,update:b.toUint8Array()}}return null},xB=(t,e)=>g1(t,e.doc.store,e.beforeState),SB=(t,e,n,r=new Pa(t))=>wt(e,i=>{i.local=!1;let s=!1;const l=i.doc,c=l.store,f=yB(r,l),d=bB(i,c,f),p=c.pendingStructs;if(p){for(const[g,b]of p.missing)if(b<Kt(c,g)){s=!0;break}if(d){for(const[g,b]of d.missing){const S=p.missing.get(g);(S==null||S>b)&&p.missing.set(g,b)}p.update=ip([p.update,d.update])}}else c.pendingStructs=d;const m=iT(r,i,c);if(c.pendingDs){const g=new Pa(Wa(c.pendingDs));We(g.restDecoder);const b=iT(g,i,c);m&&b?c.pendingDs=ip([m,b]):c.pendingDs=m||b}else c.pendingDs=m;if(s){const g=c.pendingStructs.update;c.pendingStructs=null,rp(i.doc,g)}},n,!1),rp=(t,e,n,r=Pa)=>{const i=Wa(e);SB(i,t,n,new r(i))},wB=(t,e,n)=>rp(t,e,n,j_),vB=(t,e,n=new Map)=>{g1(t,e.store,n),Qa(t,N_(e.store))},kB=(t,e=new Uint8Array([0]),n=new cl)=>{const r=U_(e);vB(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(PB(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===bf)return HB(i.map((s,l)=>l===0?s:FB(s)));if(n.constructor===cl)return ip(i)}return i[0]},CB=(t,e)=>kB(t,e,new bf),EB=t=>{const e=new Map,n=We(t.restDecoder);for(let r=0;r<n;r++){const i=We(t.restDecoder),s=We(t.restDecoder);e.set(i,s)}return e},U_=t=>EB(new L_(Wa(t))),H_=(t,e)=>(tt(t.restEncoder,e.size),po(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{tt(t.restEncoder,n),tt(t.restEncoder,r)}),t),TB=(t,e)=>H_(t,xf(e.store)),AB=(t,e=new B_)=>(t instanceof Map?H_(e,t):TB(e,t),e.toUint8Array()),MB=t=>AB(t,new I_);class OB{constructor(){this.l=[]}}const sT=()=>new OB,oT=(t,e)=>t.l.push(e),lT=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},V_=(t,e,n)=>l1(t.l,[e,n]);class va{constructor(e,n){this.client=e,this.clock=n}}const ma=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,He=(t,e)=>new va(t,e),Ju=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw jn()},Xu=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Qu{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const Qo=t=>new Qu(t.type==null?null:He(t.type.client,t.type.clock),t.tname??null,t.item==null?null:He(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class _B{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const DB=(t,e,n=0)=>new _B(t,e,n),Wd=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Ju(t):r=He(t._item.id.client,t._item.id.clock),new Qu(r,i,e,n)},S0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Wd(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Wd(t,He(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Wd(t,r.lastId,n);r=r.right}return Wd(t,null,n)},RB=(t,e)=>{const n=ka(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},Bb=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,l=t.tname,c=t.assoc;let f=null,d=0;if(i!==null){if(Kt(r,i.client)<=i.clock)return null;const p=n?Pb(r,i):RB(r,i),m=p.item;if(!(m instanceof At))return null;if(f=m.parent,f._item===null||!f._item.deleted){d=m.deleted||!m.countable?0:p.diff+(c>=0?0:1);let g=m.left;for(;g!==null;)!g.deleted&&g.countable&&(d+=g.length),g=g.left}}else{if(l!==null)f=e.get(l);else if(s!==null){if(Kt(r,s.client)<=s.clock)return null;const{item:p}=n?Pb(r,s):{item:ka(r,s)};if(p instanceof At&&p.content instanceof li)f=p.content.type;else return null}else throw jn();c>=0?d=f._length:d=0}return DB(f,d,t.assoc)},aT=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&ma(t.item,e.item)&&ma(t.type,e.type)&&t.assoc===e.assoc;class y1{constructor(e,n){this.ds=e,this.sv=n}}const P_=(t,e)=>new y1(t,e),w0=t=>P_(N_(t.store),xf(t.store)),Po=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Xa(e.ds,t.id),Ub=(t,e)=>{const n=Di(t.meta,Ub,al),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Kt(r,s)&&ir(t,He(s,i))}),mo(t,e.ds,i=>{}),n.add(e))};class $_{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const xf=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},Kt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},F_=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw jn()}n.push(e)},si=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let l=ri(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[l],s=i.id.clock,s<=e){if(e<s+i.length)return l;n=l+1}else r=l-1;l=ri((n+r)/2)}throw jn()},NB=(t,e)=>{const n=t.clients.get(e.client);return n[si(n,e.clock)]},ka=NB,Hb=(t,e,n)=>{const r=si(e,n),i=e[r];return i.id.clock<n&&i instanceof At?(e.splice(r+1,0,cp(t,i,n-i.id.clock)),r+1):r},ir=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Hb(t,n,e.clock)]},cT=(t,e,n)=>{const r=e.clients.get(n.client),i=si(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Pr&&r.splice(i+1,0,cp(t,s,n.clock-s.id.clock+1)),s},zB=(t,e,n)=>{const r=t.clients.get(e.id.client);r[si(r,e.id.clock)]=n},q_=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let l=Hb(t,e,n),c;do c=e[l++],s<c.id.clock+c.length&&Hb(t,e,s),i(c);while(l<e.length&&e[l].id.clock<s)};class LB{constructor(e,n,r){this.doc=e,this.deleteSet=new Ja,this.beforeState=xf(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const uT=(t,e)=>e.deleteSet.clients.size===0&&!pI(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(p1(e.deleteSet),xB(t,e),Qa(t,e.deleteSet),!0),fT=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Di(t.changed,e,al).add(n)},vh=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof At&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},jB=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let l=i.length-1;l>=0;l--){const c=i[l],f=c.clock+c.len;for(let d=si(s,c.clock),p=s[d];d<s.length&&p.id.clock<f;p=s[++d]){const m=s[d];if(c.clock+c.len<=m.id.clock)break;m instanceof At&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},IB=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const l=n[s],c=hs(i.length-1,1+si(i,l.clock+l.len-1));for(let f=c,d=i[f];f>0&&d.id.clock>=l.clock;d=i[f])f-=1+vh(i,f)}})},Y_=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,l=n._mergeStructs;try{p1(s),n.afterState=xf(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((f,d)=>c.push(()=>{(d._item===null||!d._item.deleted)&&d._callObserver(n,f)})),c.push(()=>{n.changedParentTypes.forEach((f,d)=>{d._dEH.l.length>0&&(d._item===null||!d._item.deleted)&&(f=f.filter(p=>p.target._item===null||!p.target._item.deleted),f.forEach(p=>{p.currentTarget=d,p._path=null}),f.sort((p,m)=>p.path.length-m.path.length),c.push(()=>{V_(d._dEH,f,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&i8(n)})}),l1(c,[])}finally{r.gc&&jB(s,i,r.gcFilter),IB(s,i),n.afterState.forEach((p,m)=>{const g=n.beforeState.get(m)||0;if(g!==p){const b=i.clients.get(m),S=ii(si(b,g),1);for(let v=b.length-1;v>=S;)v-=1+vh(b,v)}});for(let p=l.length-1;p>=0;p--){const{client:m,clock:g}=l[p].id,b=i.clients.get(m),S=si(b,g);S+1<b.length&&vh(b,S+1)>1||S>0&&vh(b,S)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(dB(h1,E_,"[yjs] ",T_,A_,"Changed the client-id because another client seems to be using it."),r.clientID=z_()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const p=new bf;uT(p,n)&&r.emit("update",[p.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const p=new cl;uT(p,n)&&r.emit("updateV2",[p.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:f,subdocsRemoved:d}=n;(c.size>0||d.size>0||f.size>0)&&(c.forEach(p=>{p.clientID=r.clientID,p.collectionid==null&&(p.collectionid=r.collectionid),r.subdocs.add(p)}),d.forEach(p=>r.subdocs.delete(p)),r.emit("subdocs",[{loaded:f,added:c,removed:d},r,n]),d.forEach(p=>p.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Y_(t,e+1)}}},wt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,l=null;t._transaction===null&&(s=!0,t._transaction=new LB(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{l=e(t._transaction)}finally{if(s){const c=t._transaction===i[0];t._transaction=null,c&&Y_(i,0)}}return l};class BB{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const dT=(t,e,n)=>{mo(t,n.deletions,r=>{r instanceof At&&e.scope.some(i=>i===t.doc||Xu(i,r))&&E1(r,!1)})},hT=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;wt(i,c=>{for(;e.length>0&&t.currStackItem===null;){const f=i.store,d=e.pop(),p=new Set,m=[];let g=!1;mo(c,d.insertions,b=>{if(b instanceof At){if(b.redone!==null){let{item:S,diff:v}=Pb(f,b.id);v>0&&(S=ir(c,He(S.id.client,S.id.clock+v))),b=S}!b.deleted&&s.some(S=>S===c.doc||Xu(S,b))&&m.push(b)}}),mo(c,d.deletions,b=>{b instanceof At&&s.some(S=>S===c.doc||Xu(S,b))&&!Xa(d.insertions,b.id)&&p.add(b)}),p.forEach(b=>{g=d2(c,b,p,d.insertions,t.ignoreRemoteMapChanges,t)!==null||g});for(let b=m.length-1;b>=0;b--){const S=m[b];t.deleteFilter(S)&&(S.delete(c),g=!0)}t.currStackItem=g?d:null}c.changed.forEach((f,d)=>{f.has(null)&&d._searchMarker&&(d._searchMarker.length=0)}),r=c},t);const l=t.currStackItem;if(l!=null){const c=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:l,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return l};class K_ extends ZO{constructor(e,{captureTimeout:n=500,captureTransaction:r=f=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:c=Ia(e)?e[0].doc:e instanceof Mi?e:e.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=l,this.captureTimeout=n,this.afterTransactionHandler=f=>{if(!this.captureTransaction(f)||!this.scope.some(C=>f.changedParentTypes.has(C)||C===this.doc)||!this.trackedOrigins.has(f.origin)&&(!f.origin||!this.trackedOrigins.has(f.origin.constructor)))return;const d=this.undoing,p=this.redoing,m=d?this.redoStack:this.undoStack;d?this.stopCapturing():p||this.clear(!1,!0);const g=new Ja;f.afterState.forEach((C,T)=>{const H=f.beforeState.get(T)||0,j=C-H;j>0&&Zu(g,T,H,j)});const b=QI();let S=!1;if(this.lastChange>0&&b-this.lastChange<this.captureTimeout&&m.length>0&&!d&&!p){const C=m[m.length-1];C.deletions=Ib([C.deletions,f.deleteSet]),C.insertions=Ib([C.insertions,g])}else m.push(new BB(f.deleteSet,g)),S=!0;!d&&!p&&(this.lastChange=b),mo(f,f.deleteSet,C=>{C instanceof At&&this.scope.some(T=>T===f.doc||Xu(T,C))&&E1(C,!0)});const v=[{stackItem:m[m.length-1],origin:f.origin,type:d?"redo":"undo",changedParentTypes:f.changedParentTypes},this];S?this.emit("stack-item-added",v):this.emit("stack-item-updated",v)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ia(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof hn?r.doc!==this.doc:r!==this.doc)&&O_("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>dT(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>dT(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=hT(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=hT(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*UB(t){const e=We(t.restDecoder);for(let n=0;n<e;n++){const r=We(t.restDecoder),i=t.readClient();let s=We(t.restDecoder);for(let l=0;l<r;l++){const c=t.readInfo();if(c===10){const f=We(t.restDecoder);yield new $r(He(i,s),f),s+=f}else if((cm&c)!==0){const f=(c&(ps|Pn))===0,d=new At(He(i,s),null,(c&Pn)===Pn?t.readLeftID():null,null,(c&ps)===ps?t.readRightID():null,f?t.readParentInfo()?t.readString():t.readLeftID():null,f&&(c&qu)===qu?t.readString():null,h2(t,c));yield d,s+=d.length}else{const f=t.readLen();yield new Pr(He(i,s),f),s+=f}}}}class b1{constructor(e,n){this.gen=UB(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===$r);return this.curr}}class x1{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const HB=t=>ip(t,j_,bf),VB=(t,e)=>{if(t.constructor===Pr){const{client:n,clock:r}=t.id;return new Pr(He(n,r+e),t.length-e)}else if(t.constructor===$r){const{client:n,clock:r}=t.id;return new $r(He(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new At(He(r,i+e),null,He(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},ip=(t,e=Pa,n=cl)=>{if(t.length===1)return t[0];const r=t.map(p=>new e(Wa(p)));let i=r.map(p=>new b1(p,!0)),s=null;const l=new n,c=new x1(l);for(;i=i.filter(g=>g.curr!==null),i.sort((g,b)=>{if(g.curr.id.client===b.curr.id.client){const S=g.curr.id.clock-b.curr.id.clock;return S===0?g.curr.constructor===b.curr.constructor?0:g.curr.constructor===$r?1:-1:S}else return b.curr.id.client-g.curr.id.client}),i.length!==0;){const p=i[0],m=p.curr.id.client;if(s!==null){let g=p.curr,b=!1;for(;g!==null&&g.id.clock+g.length<=s.struct.id.clock+s.struct.length&&g.id.client>=s.struct.id.client;)g=p.next(),b=!0;if(g===null||g.id.client!==m||b&&g.id.clock>s.struct.id.clock+s.struct.length)continue;if(m!==s.struct.id.client)Js(c,s.struct,s.offset),s={struct:g,offset:0},p.next();else if(s.struct.id.clock+s.struct.length<g.id.clock)if(s.struct.constructor===$r)s.struct.length=g.id.clock+g.length-s.struct.id.clock;else{Js(c,s.struct,s.offset);const S=g.id.clock-s.struct.id.clock-s.struct.length;s={struct:new $r(He(m,s.struct.id.clock+s.struct.length),S),offset:0}}else{const S=s.struct.id.clock+s.struct.length-g.id.clock;S>0&&(s.struct.constructor===$r?s.struct.length-=S:g=VB(g,S)),s.struct.mergeWith(g)||(Js(c,s.struct,s.offset),s={struct:g,offset:0},p.next())}}else s={struct:p.curr,offset:0},p.next();for(let g=p.curr;g!==null&&g.id.client===m&&g.id.clock===s.struct.id.clock+s.struct.length&&g.constructor!==$r;g=p.next())Js(c,s.struct,s.offset),s={struct:g,offset:0}}s!==null&&(Js(c,s.struct,s.offset),s=null),S1(c);const f=r.map(p=>m1(p)),d=Ib(f);return Qa(l,d),l.toUint8Array()},PB=(t,e,n=Pa,r=cl)=>{const i=U_(e),s=new r,l=new x1(s),c=new n(Wa(t)),f=new b1(c,!1);for(;f.curr;){const p=f.curr,m=p.id.client,g=i.get(m)||0;if(f.curr.constructor===$r){f.next();continue}if(p.id.clock+p.length>g)for(Js(l,p,ii(g-p.id.clock,0)),f.next();f.curr&&f.curr.id.client===m;)Js(l,f.curr,0),f.next();else for(;f.curr&&f.curr.id.client===m&&f.curr.id.clock+f.curr.length<=g;)f.next()}S1(l);const d=m1(c);return Qa(s,d),s.toUint8Array()},W_=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:ni(t.encoder.restEncoder)}),t.encoder.restEncoder=gf(),t.written=0)},Js=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&W_(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),tt(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},S1=t=>{W_(t);const e=t.encoder.restEncoder;tt(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];tt(e,r.written),um(e,r.restEncoder)}},$B=(t,e,n,r)=>{const i=new n(Wa(t)),s=new b1(i,!1),l=new r,c=new x1(l);for(let d=s.curr;d!==null;d=s.next())Js(c,e(d),0);S1(c);const f=m1(i);return Qa(l,f),l.toUint8Array()},FB=t=>$B(t,c5,Pa,bf),pT="You must not compute changes after the event-handler fired.";class bm{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=qB(this.currentTarget,this.target))}deletes(e){return Xa(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ai(pT);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let l,c;if(this.adds(s)){let f=s.left;for(;f!==null&&this.adds(f);)f=f.left;if(this.deletes(s))if(f!==null&&this.deletes(f))l="delete",c=d0(f.content.getContent());else return;else f!==null&&this.deletes(f)?(l="update",c=d0(f.content.getContent())):(l="add",c=void 0)}else if(this.deletes(s))l="delete",c=d0(s.content.getContent());else return;e.set(i,{action:l,oldValue:c})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ai(pT);const n=this.target,r=al(),i=al(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const f=()=>{c&&s.push(c)};for(let d=n._start;d!==null;d=d.right)d.deleted?this.deletes(d)&&!this.adds(d)&&((c===null||c.delete===void 0)&&(f(),c={delete:0}),c.delete+=d.length,i.add(d)):this.adds(d)?((c===null||c.insert===void 0)&&(f(),c={insert:[]}),c.insert=c.insert.concat(d.content.getContent()),r.add(d)):((c===null||c.retain===void 0)&&(f(),c={retain:0}),c.retain+=d.length);c!==null&&c.retain===void 0&&f()}this._changes=e}return e}}const qB=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},Nn=()=>{O_("Invalid access: Add Yjs type to a document before reading data.")},G_=80;let w1=0;class YB{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=w1++}}const KB=t=>{t.timestamp=w1++},Z_=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=w1++},WB=(t,e,n)=>{if(t.length>=G_){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return Z_(r,e,n),r}else{const r=new YB(e,n);return t.push(r),r}},xm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,l)=>bh(e-s.index)<bh(e-l.index)?s:l);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,KB(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&bh(n.index-i)<r.parent.length/G_?(Z_(n,r,i),n):WB(t._searchMarker,r,i)},ef=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=ii(e,i.index+n))}},Sm=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Di(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;V_(r._eH,n,e)};class hn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=sT(),this._dEH=sT(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Wr()}clone(){throw Wr()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){oT(this._eH,e)}observeDeep(e){oT(this._dEH,e)}unobserve(e){lT(this._eH,e)}unobserveDeep(e){lT(this._dEH,e)}toJSON(){}}const J_=(t,e,n)=>{t.doc??Nn(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const l=s.content.getContent();if(l.length<=e)e-=l.length;else{for(let c=e;c<l.length&&r>0;c++)i.push(l[c]),r--;e=0}}s=s.right}return i},X_=t=>{t.doc??Nn();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},Q_=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Po(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},tf=(t,e)=>{let n=0,r=t._start;for(t.doc??Nn();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},e2=(t,e)=>{const n=[];return tf(t,(r,i)=>{n.push(e(r,i,t))}),n},GB=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},t2=(t,e)=>{t.doc??Nn();const n=xm(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},sp=(t,e,n,r)=>{let i=n;const s=t.doc,l=s.clientID,c=s.store,f=n===null?e._start:n.right;let d=[];const p=()=>{d.length>0&&(i=new At(He(l,Kt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new fl(d)),i.integrate(t,0),d=[])};r.forEach(m=>{if(m===null)d.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:d.push(m);break;default:switch(p(),m.constructor){case Uint8Array:case ArrayBuffer:i=new At(He(l,Kt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new Sf(new Uint8Array(m))),i.integrate(t,0);break;case Mi:i=new At(He(l,Kt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new wf(m)),i.integrate(t,0);break;default:if(m instanceof hn)i=new At(He(l,Kt(c,l)),i,i&&i.lastId,f,f&&f.id,e,null,new li(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),p()},n2=()=>Ai("Length exceeded!"),r2=(t,e,n,r)=>{if(n>e._length)throw n2();if(n===0)return e._searchMarker&&ef(e._searchMarker,n,r.length),sp(t,e,null,r);const i=n,s=xm(e,n);let l=e._start;for(s!==null&&(l=s.p,n-=s.index,n===0&&(l=l.prev,n+=l&&l.countable&&!l.deleted?l.length:0));l!==null;l=l.right)if(!l.deleted&&l.countable){if(n<=l.length){n<l.length&&ir(t,He(l.id.client,l.id.clock+n));break}n-=l.length}return e._searchMarker&&ef(e._searchMarker,i,r.length),sp(t,e,l,r)},ZB=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,l)=>l.index>s.index?l:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return sp(t,e,i,n)},i2=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,l=xm(e,n);let c=e._start;for(l!==null&&(c=l.p,n-=l.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&ir(t,He(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&ir(t,He(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw n2();e._searchMarker&&ef(e._searchMarker,i,-s+r)},op=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},v1=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,l=s.clientID;let c;if(r==null)c=new fl([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new fl([r]);break;case Uint8Array:c=new Sf(r);break;case Mi:c=new wf(r);break;default:if(r instanceof hn)c=new li(r);else throw new Error("Unexpected content type")}new At(He(l,Kt(s.store,l)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},k1=(t,e)=>{t.doc??Nn();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},s2=t=>{const e={};return t.doc??Nn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},o2=(t,e)=>{t.doc??Nn();const n=t._map.get(e);return n!==void 0&&!n.deleted},JB=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Po(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Gd=t=>(t.doc??Nn(),hB(t._map.entries(),e=>!e[1].deleted));class XB extends bm{}class Ca extends hn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Ca;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ca}clone(){const e=new Ca;return e.insert(0,this.toArray().map(n=>n instanceof hn?n.clone():n)),e}get length(){return this.doc??Nn(),this._length}_callObserver(e,n){super._callObserver(e,n),Sm(this,e,new XB(this,e))}insert(e,n){this.doc!==null?wt(this.doc,r=>{r2(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?wt(this.doc,n=>{ZB(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?wt(this.doc,r=>{i2(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return t2(this,e)}toArray(){return X_(this)}slice(e=0,n=this.length){return J_(this,e,n)}toJSON(){return this.map(e=>e instanceof hn?e.toJSON():e)}map(e){return e2(this,e)}forEach(e){tf(this,e)}[Symbol.iterator](){return GB(this)}_write(e){e.writeTypeRef(k8)}}const QB=t=>new Ca;class e8 extends bm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class $a extends hn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new $a}clone(){const e=new $a;return this.forEach((n,r)=>{e.set(r,n instanceof hn?n.clone():n)}),e}_callObserver(e,n){Sm(this,e,new e8(this,e,n))}toJSON(){this.doc??Nn();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof hn?i.toJSON():i}}),e}get size(){return[...Gd(this)].length}keys(){return x0(Gd(this),e=>e[0])}values(){return x0(Gd(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return x0(Gd(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Nn(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?wt(this.doc,n=>{op(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?wt(this.doc,r=>{v1(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return k1(this,e)}has(e){return o2(this,e)}clear(){this.doc!==null?wt(this.doc,e=>{this.forEach(function(n,r,i){op(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(C8)}}const t8=t=>new $a,ro=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&l5(t,e);class Vb{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&jn(),this.right.content.constructor){case tn:this.right.deleted||ec(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const mT=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case tn:e.right.deleted||ec(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&ir(t,He(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Zd=(t,e,n,r)=>{const i=new Map,s=r?xm(e,n):null;if(s){const l=new Vb(s.p.left,s.p,s.index,i);return mT(t,l,n-s.index)}else{const l=new Vb(null,e._start,0,i);return mT(t,l,n)}},l2=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===tn&&ro(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((l,c)=>{const f=n.left,d=n.right,p=new At(He(s,Kt(i.store,s)),f,f&&f.lastId,d,d&&d.id,e,null,new tn(c,l));p.integrate(t,0),n.right=p,n.forward()})},ec=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},a2=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===tn&&ro(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},c2=(t,e,n,r)=>{const i=t.doc,s=i.clientID,l=new Map;for(const c in r){const f=r[c],d=n.currentAttributes.get(c)??null;if(!ro(d,f)){l.set(c,d);const{left:p,right:m}=n;n.right=new At(He(s,Kt(i.store,s)),p,p&&p.lastId,m,m&&m.id,e,null,new tn(c,f)),n.right.integrate(t,0),n.forward()}}return l},v0=(t,e,n,r,i)=>{n.currentAttributes.forEach((g,b)=>{i[b]===void 0&&(i[b]=null)});const s=t.doc,l=s.clientID;a2(n,i);const c=c2(t,e,n,i),f=r.constructor===String?new oi(r):r instanceof hn?new li(r):new gl(r);let{left:d,right:p,index:m}=n;e._searchMarker&&ef(e._searchMarker,n.index,f.getLength()),p=new At(He(l,Kt(s.store,l)),d,d&&d.lastId,p,p&&p.id,e,null,f),p.integrate(t,0),n.right=p,n.index=m,n.forward(),l2(t,e,n,c)},gT=(t,e,n,r,i)=>{const s=t.doc,l=s.clientID;a2(n,i);const c=c2(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===tn));){if(!n.right.deleted)switch(n.right.content.constructor){case tn:{const{key:f,value:d}=n.right.content,p=i[f];if(p!==void 0){if(ro(p,d))c.delete(f);else{if(r===0)break e;c.set(f,d)}n.right.delete(t)}else n.currentAttributes.set(f,d);break}default:r<n.right.length&&ir(t,He(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let f="";for(;r>0;r--)f+=`
151
+ `;n.right=new At(He(l,Kt(s.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new oi(f)),n.right.integrate(t,0),n.forward()}l2(t,e,n,c)},u2=(t,e,n,r,i)=>{let s=e;const l=Kr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===tn){const d=s.content;l.set(d.key,d)}s=s.right}let c=0,f=!1;for(;e!==s;){if(n===e&&(f=!0),!e.deleted){const d=e.content;switch(d.constructor){case tn:{const{key:p,value:m}=d,g=r.get(p)??null;(l.get(p)!==d||g===m)&&(e.delete(t),c++,!f&&(i.get(p)??null)===m&&g!==m&&(g===null?i.delete(p):i.set(p,g))),!f&&!e.deleted&&ec(i,d);break}}}e=e.right}return c},n8=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===tn){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},r8=t=>{let e=0;return wt(t.doc,n=>{let r=t._start,i=t._start,s=Kr();const l=Db(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case tn:ec(l,i.content);break;default:e+=u2(n,r,i,s,l),s=Db(l),r=i;break}i=i.right}}),e},i8=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&q_(t,n.store.clients.get(r),s,i,l=>{!l.deleted&&l.content.constructor===tn&&l.constructor!==Pr&&e.add(l.parent)})}wt(n,r=>{mo(t,t.deleteSet,i=>{if(i instanceof Pr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===tn?e.add(s):n8(r,i)});for(const i of e)r8(i)})},yT=(t,e,n)=>{const r=n,i=Db(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case li:case gl:case oi:n<e.right.length&&ir(t,He(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&u2(t,s,e.right,i,e.currentAttributes);const l=(e.left||e.right).parent;return l._searchMarker&&ef(l._searchMarker,e.index,-r+n),e};class s8 extends bm{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];wt(e,r=>{const i=new Map,s=new Map;let l=this.target._start,c=null;const f={};let d="",p=0,m=0;const g=()=>{if(c!==null){let b=null;switch(c){case"delete":m>0&&(b={delete:m}),m=0;break;case"insert":(typeof d=="object"||d.length>0)&&(b={insert:d},i.size>0&&(b.attributes={},i.forEach((S,v)=>{S!==null&&(b.attributes[v]=S)}))),d="";break;case"retain":p>0&&(b={retain:p},o5(f)||(b.attributes=i5({},f))),p=0;break}b&&n.push(b),c=null}};for(;l!==null;){switch(l.content.constructor){case li:case gl:this.adds(l)?this.deletes(l)||(g(),c="insert",d=l.content.getContent()[0],g()):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=1):l.deleted||(c!=="retain"&&(g(),c="retain"),p+=1);break;case oi:this.adds(l)?this.deletes(l)||(c!=="insert"&&(g(),c="insert"),d+=l.content.str):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=l.length):l.deleted||(c!=="retain"&&(g(),c="retain"),p+=l.length);break;case tn:{const{key:b,value:S}=l.content;if(this.adds(l)){if(!this.deletes(l)){const v=i.get(b)??null;ro(v,S)?S!==null&&l.delete(r):(c==="retain"&&g(),ro(S,s.get(b)??null)?delete f[b]:f[b]=S)}}else if(this.deletes(l)){s.set(b,S);const v=i.get(b)??null;ro(v,S)||(c==="retain"&&g(),f[b]=v)}else if(!l.deleted){s.set(b,S);const v=f[b];v!==void 0&&(ro(v,S)?v!==null&&l.delete(r):(c==="retain"&&g(),S===null?delete f[b]:f[b]=S))}l.deleted||(c==="insert"&&g(),ec(i,l.content));break}}l=l.right}for(g();n.length>0;){const b=n[n.length-1];if(b.retain!==void 0&&b.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class go extends hn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Nn(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new go}clone(){const e=new go;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new s8(this,e,n);Sm(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Nn();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===oi&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?wt(this.doc,r=>{const i=new Vb(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const l=e[s];if(l.insert!==void 0){const c=!n&&typeof l.insert=="string"&&s===e.length-1&&i.right===null&&l.insert.slice(-1)===`
152
+ `?l.insert.slice(0,-1):l.insert;(typeof c!="string"||c.length>0)&&v0(r,this,i,c,l.attributes||{})}else l.retain!==void 0?gT(r,this,i,l.retain,l.attributes||{}):l.delete!==void 0&&yT(r,i,l.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Nn();const i=[],s=new Map,l=this.doc;let c="",f=this._start;function d(){if(c.length>0){const m={};let g=!1;s.forEach((S,v)=>{g=!0,m[v]=S});const b={insert:c};g&&(b.attributes=m),i.push(b),c=""}}const p=()=>{for(;f!==null;){if(Po(f,e)||n!==void 0&&Po(f,n))switch(f.content.constructor){case oi:{const m=s.get("ychange");e!==void 0&&!Po(f,e)?(m===void 0||m.user!==f.id.client||m.type!=="removed")&&(d(),s.set("ychange",r?r("removed",f.id):{type:"removed"})):n!==void 0&&!Po(f,n)?(m===void 0||m.user!==f.id.client||m.type!=="added")&&(d(),s.set("ychange",r?r("added",f.id):{type:"added"})):m!==void 0&&(d(),s.delete("ychange")),c+=f.content.str;break}case li:case gl:{d();const m={insert:f.content.getContent()[0]};if(s.size>0){const g={};m.attributes=g,s.forEach((b,S)=>{g[S]=b})}i.push(m);break}case tn:Po(f,e)&&(d(),ec(s,f.content));break}f=f.right}d()};return e||n?wt(l,m=>{e&&Ub(m,e),n&&Ub(m,n),p()},"cleanup"):p(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?wt(i,s=>{const l=Zd(s,this,e,!r);r||(r={},l.currentAttributes.forEach((c,f)=>{r[f]=c})),v0(s,this,l,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?wt(i,s=>{const l=Zd(s,this,e,!r);v0(s,this,l,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?wt(r,i=>{yT(i,Zd(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?wt(i,s=>{const l=Zd(s,this,e,!1);l.right!==null&&gT(s,this,l,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?wt(this.doc,n=>{op(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?wt(this.doc,r=>{v1(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return k1(this,e)}getAttributes(){return s2(this)}_write(e){e.writeTypeRef(E8)}}const o8=t=>new go;class k0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Nn()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===On||n.constructor===ul)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class ul extends hn{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ul}clone(){const e=new ul;return e.insert(0,this.toArray().map(n=>n instanceof hn?n.clone():n)),e}get length(){return this.doc??Nn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new k0(this,e)}querySelector(e){e=e.toUpperCase();const r=new k0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),po(new k0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Sm(this,e,new c8(this,n,e))}toString(){return e2(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),tf(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?wt(this.doc,r=>{r2(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)wt(this.doc,r=>{const i=e&&e instanceof hn?e._item:e;sp(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Ai("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?wt(this.doc,r=>{i2(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return X_(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return t2(this,e)}slice(e=0,n=this.length){return J_(this,e,n)}forEach(e){tf(this,e)}_write(e){e.writeTypeRef(A8)}}const l8=t=>new ul;class On extends ul{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new On(this.nodeName)}clone(){const e=new On(this.nodeName),n=this.getAttributes();return s5(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof hn?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const c in e)r.push(c);r.sort();const i=r.length;for(let c=0;c<i;c++){const f=r[c];n.push(f+'="'+e[f]+'"')}const s=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${s}${l}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?wt(this.doc,n=>{op(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?wt(this.doc,r=>{v1(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return k1(this,e)}hasAttribute(e){return o2(this,e)}getAttributes(e){return e?JB(this,e):s2(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const l in s){const c=s[l];typeof c=="string"&&i.setAttribute(l,c)}return tf(this,l=>{i.appendChild(l.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(T8),e.writeKey(this.nodeName)}}const a8=t=>new On(t.readKey());class c8 extends bm{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class lp extends $a{constructor(e){super(),this.hookName=e}_copy(){return new lp(this.hookName)}clone(){const e=new lp(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(M8),e.writeKey(this.hookName)}}const u8=t=>new lp(t.readKey());class $n extends go{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new $n}clone(){const e=new $n;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const l in e.attributes[i])s.push({key:l,value:e.attributes[i][l]});s.sort((l,c)=>l.key<c.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let l=0;l<s.attrs.length;l++){const c=s.attrs[l];r+=` ${c.key}="${c.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(O8)}}const f8=t=>new $n;class C1{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Wr()}mergeWith(e){return!1}write(e,n,r){throw Wr()}integrate(e,n){throw Wr()}}const d8=0;class Pr extends C1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),F_(e.doc.store,this)}write(e,n){e.writeInfo(d8),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Sf{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Sf(this.content)}splice(e){throw Wr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const h8=t=>new Sf(t.readBuf());class nf{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new nf(this.len)}splice(e){const n=new nf(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Zu(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const p8=t=>new nf(t.readLen()),f2=(t,e)=>new Mi({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class wf{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new wf(f2(this.doc.guid,this.opts))}splice(e){throw Wr()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const m8=t=>new wf(f2(t.readString(),t.readAny()));class gl{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new gl(this.embed)}splice(e){throw Wr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const g8=t=>new gl(t.readJSON());class tn{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new tn(this.key,this.value)}splice(e){throw Wr()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const y8=t=>new tn(t.readKey(),t.readJSON());class ap{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ap(this.arr)}splice(e){const n=new ap(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const b8=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new ap(n)},x8=Qh("node_env")==="development";class fl{constructor(e){this.arr=e,x8&&s_(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new fl(this.arr)}splice(e){const n=new fl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const S8=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new fl(n)};class oi{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new oi(this.str)}splice(e){const n=new oi(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const w8=t=>new oi(t.readString()),v8=[QB,t8,o8,a8,l8,u8,f8],k8=0,C8=1,E8=2,T8=3,A8=4,M8=5,O8=6;class li{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new li(this.type._copy())}splice(e){throw Wr()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const _8=t=>new li(v8[t.readTypeRef()](t)),Pb=(t,e)=>{let n=e,r=0,i;do r>0&&(n=He(n.client,n.clock+r)),i=ka(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof At);return{item:i,diff:r}},E1=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},cp=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new At(He(r,i+n),e,He(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=He(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},bT=(t,e)=>t1(t,n=>Xa(n.deletions,e)),d2=(t,e,n,r,i,s)=>{const l=t.doc,c=l.store,f=l.clientID,d=e.redone;if(d!==null)return ir(t,d);let p=e.parent._item,m=null,g;if(p!==null&&p.deleted===!0){if(p.redone===null&&(!n.has(p)||d2(t,p,n,r,i,s)===null))return null;for(;p.redone!==null;)p=ir(t,p.redone)}const b=p===null?e.parent:p.content.type;if(e.parentSub===null){for(m=e.left,g=e;m!==null;){let T=m;for(;T!==null&&T.parent._item!==p;)T=T.redone===null?null:ir(t,T.redone);if(T!==null&&T.parent._item===p){m=T;break}m=m.left}for(;g!==null;){let T=g;for(;T!==null&&T.parent._item!==p;)T=T.redone===null?null:ir(t,T.redone);if(T!==null&&T.parent._item===p){g=T;break}g=g.right}}else if(g=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||Xa(r,m.right.id)||bT(s.undoStack,m.right.id)||bT(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=ir(t,m.redone);if(m&&m.right!==null)return null}else m=b._map.get(e.parentSub)||null;const S=Kt(c,f),v=He(f,S),C=new At(v,m,m&&m.lastId,g,g&&g.id,b,e.parentSub,e.content.copy());return e.redone=v,E1(C,!0),C.integrate(t,0),C};let At=class $b extends C1{constructor(e,n,r,i,s,l,c,f){super(e,f.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=l,this.parentSub=c,this.redone=null,this.content=f,this.info=this.content.isCountable()?YE:0}set marker(e){(this.info&p0)>0!==e&&(this.info^=p0)}get marker(){return(this.info&p0)>0}get keep(){return(this.info&qE)>0}set keep(e){this.keep!==e&&(this.info^=qE)}get countable(){return(this.info&YE)>0}get deleted(){return(this.info&h0)>0}set deleted(e){this.deleted!==e&&(this.info^=h0)}markDeleted(){this.info|=h0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Kt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Kt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===va&&this.id.client!==this.parent.client&&this.parent.clock>=Kt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=cT(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=ir(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Pr||this.right&&this.right.constructor===Pr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===$b?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===$b&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===va){const r=ka(n,this.parent);r.constructor===Pr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=cT(e,e.doc.store,He(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,l=new Set;for(;i!==null&&i!==this.right;){if(l.add(i),s.add(i),ma(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(ma(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&l.has(ka(e.doc.store,i.origin)))s.has(ka(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),F_(e.doc.store,this),this.content.integrate(e,this),fT(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Pr(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:He(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ma(e.origin,this.lastId)&&this.right===e&&ma(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Zu(e.deleteSet,this.id.client,this.id.clock,this.length),fT(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw jn();this.content.gc(e),n?zB(e,this,new Pr(this.id,this.length)):this.content=new nf(this.length)}write(e,n){const r=n>0?He(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,l=this.content.getRef()&cm|(r===null?0:Pn)|(i===null?0:ps)|(s===null?0:qu);if(e.writeInfo(l),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const c=this.parent;if(c._item!==void 0){const f=c._item;if(f===null){const d=Ju(c);e.writeParentInfo(!0),e.writeString(d)}else e.writeParentInfo(!1),e.writeLeftID(f.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===va?(e.writeParentInfo(!1),e.writeLeftID(c)):jn();s!==null&&e.writeString(s)}this.content.write(e,n)}};const h2=(t,e)=>D8[e&cm](t),D8=[()=>{jn()},p8,b8,h8,w8,g8,y8,_8,S8,m8,()=>{jn()}],R8=10;class $r extends C1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){jn()}write(e,n){e.writeInfo(R8),tt(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const p2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},m2="__ $YJS$ __";p2[m2]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");p2[m2]=!0;const N8=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},z8=/[\uD800-\uDBFF]/,L8=/[\uDC00-\uDFFF]/,j8=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&z8.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&L8.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},I8=j8,Lt=new Rt("y-sync"),vi=new Rt("y-undo"),Jd=new Rt("yjs-cursor"),ki=(t,e)=>t>>>e|t<<32-e,B8=t=>ki(t,2)^ki(t,13)^ki(t,22),U8=t=>ki(t,6)^ki(t,11)^ki(t,25),H8=t=>ki(t,7)^ki(t,18)^t>>>3,V8=t=>ki(t,17)^ki(t,19)^t>>>10,P8=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$8=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class F8{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set($8),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=V8(n[m-2])+n[m-7]+H8(n[m-15])+n[m-16];let r=e[0],i=e[1],s=e[2],l=e[3],c=e[4],f=e[5],d=e[6],p=e[7];for(let m=0,g,b;m<64;m++)g=p+U8(c)+(c&f^~c&d)+P8[m]+n[m]>>>0,b=B8(r)+(r&i^r&s^i&s)>>>0,p=d,d=f,f=c,c=l+g>>>0,l=s,s=i,i=r,r=g+b>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=l,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=p}digest(e){let n=0;for(;n+56<=e.length;){let l=0;for(;l<16&&n+3<e.length;l++)this._W[l]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,l,16);n<e.length;)this._W[l]|=e[n]<<(3-n%4)*8,n++;this._W[l]|=Pn<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let l=3;l>=0&&n<e.length;l--)this._W[i]|=e[n++]<<l*8;r||(this._W[i-(n%4===0?0:1)]|=Pn<<(3-n%4)*8),this._W[14]=e.byteLength/yI,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let l=0;l<this._H.length;l++)for(let c=0;c<4;c++)s[l*4+c]=this._H[l]>>>(3-c)*8;return s}}const q8=t=>new F8().digest(t),Y8=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},K8=t=>b5(Y8(q8(S5(t)))),up=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Xa(e.ds,t.id),W8=[{light:"#ecd44433",dark:"#ecd444"}],G8=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=al();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,ZI(e))}return t.get(n)},Z8=(t,{colors:e=W8,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let l=!1;const c=new X8(t,s),f=new xt({props:{editable:d=>{const p=Lt.getState(d);return p.snapshot==null&&p.prevSnapshot==null}},key:Lt,state:{init:(d,p)=>({type:t,doc:t.doc,binding:c,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(d,p)=>{const m=d.getMeta(Lt);if(m!==void 0){p=Object.assign({},p);for(const g in m)p[g]=m[g]}return p.addToHistory=d.getMeta("addToHistory")!==!1,p.isChangeOrigin=m!==void 0&&!!m.isChangeOrigin,p.isUndoRedoOperation=m!==void 0&&!!m.isChangeOrigin&&!!m.isUndoRedoOperation,c.prosemirrorView!==null&&m!==void 0&&(m.snapshot!=null||m.prevSnapshot!=null)&&d1(0,()=>{c.prosemirrorView!=null&&(m.restore==null?c._renderSnapshot(m.snapshot,m.prevSnapshot,p):(c._renderSnapshot(m.snapshot,m.snapshot,p),delete p.restore,delete p.snapshot,delete p.prevSnapshot,c.mux(()=>{c._prosemirrorChanged(c.prosemirrorView.state.doc)})))}),p}},view:d=>(c.initView(d),s==null&&c._forceRerender(),i(),{update:()=>{const p=f.getState(d.state);if(p.snapshot==null&&p.prevSnapshot==null&&(l||d.state.doc.content.findDiffStart(d.state.doc.type.createAndFill().content)!==null)){if(l=!0,p.addToHistory===!1&&!p.isChangeOrigin){const m=vi.getState(d.state),g=m&&m.undoManager;g&&g.stopCapturing()}c.mux(()=>{p.doc.transact(m=>{m.meta.set("addToHistory",p.addToHistory),c._prosemirrorChanged(d.state.doc)},Lt)})}},destroy:()=>{c.destroy()}})});return f},J8=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new sr(t.doc));else if(e.type==="node"){const r=Ea(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Me.create(t.doc,r))}else{const r=Ea(n.doc,n.type,e.anchor,n.mapping),i=Ea(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=_e.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},Fb=(t,e)=>({type:e.selection.jsonID,anchor:dp(e.selection.anchor,t.type,t.mapping),head:dp(e.selection.head,t.type,t.mapping)});class X8{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=N8(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Fb(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(l_&&this._domSelectionInView===null&&(d1(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=yf.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=P_(R_(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Lt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>kh(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new pe(te.from(e),0,0));n.setMeta(Lt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>kh(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new pe(te.from(n),0,0));if(e){const i=hs(ii(e.anchor,0),r.doc.content.size),s=hs(ii(e.head,0),r.doc.content.size);r.setSelection(_e.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Lt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=w0(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&jn(),i=new Mi({gc:!1}),rp(i,n),n=w0(i),rp(i,e),e=w0(i),s._item===null){const l=Array.from(this.doc.share.keys()).find(c=>this.doc.share.get(c)===this.type);s=i.getXmlFragment(l)}else{const l=i.store.clients.get(s._item.id.client)??[],c=si(l,s._item.id.clock);s=l[c].content.type}this.mapping.clear(),this.mux(()=>{i.transact(l=>{const c=r.permanentUserData;c&&c.dss.forEach(m=>{mo(l,m,g=>{})});const f=(m,g)=>{const b=m==="added"?c.getUserByClientId(g.client):c.getUserByDeletedId(g);return{user:b,type:m,color:G8(r.colorMapping,r.colors,b)}},d=Q_(s,new y1(n.ds,e.sv)).map(m=>!m._item.deleted||up(m._item,e)||up(m._item,n)?kh(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,f):null).filter(m=>m!==null),p=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new pe(te.from(d),0,0));this.prosemirrorView.dispatch(p.setMeta(Lt,{isChangeOrigin:!0}))},Lt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Lt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(c,f)=>this.mapping.delete(f);mo(n,n.deleteSet,c=>{if(c.constructor===At){const f=c.content.type;f&&this.mapping.delete(f)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>g2(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let l=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new pe(te.from(s),0,0));J8(l,this.beforeTransactionSelection,this),l=l.setMeta(Lt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof K_}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&l.scrollIntoView(),this.prosemirrorView.dispatch(l)})}_prosemirrorChanged(e){this.doc.transact(()=>{Yb(this.doc,this.type,e,this),this.beforeTransactionSelection=Fb(this,this.prosemirrorView.state)},Lt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const g2=(t,e,n,r,i,s)=>{const l=n.mapping.get(t);if(l===void 0){if(t instanceof On)return kh(t,e,n,r,i,s);throw Wr()}return l},kh=(t,e,n,r,i,s)=>{const l=[],c=f=>{var d,p;if(f instanceof On){const m=g2(f,e,n,r,i,s);m!==null&&l.push(m)}else{const m=(p=(d=f._item.right)==null?void 0:d.content)==null?void 0:p.type;m instanceof go&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(f.applyDelta([{retain:f.length},...m.toDelta()]),m.doc.transact(b=>{m._item.delete(b)}));const g=Q8(f,e,n,r,i,s);g!==null&&g.forEach(b=>{b!==null&&l.push(b)})}};r===void 0||i===void 0?t.toArray().forEach(c):Q_(t,new y1(i.ds,r.sv)).forEach(c);try{const f=t.getAttributes(r);r!==void 0&&(up(t._item,r)?up(t._item,i)||(f.ychange=s?s("added",t._item.id):{type:"added"}):f.ychange=s?s("removed",t._item.id):{type:"removed"});const d=e.node(t.nodeName,f,l);return n.mapping.set(t,d),d}catch{return t.doc.transact(d=>{t._item.delete(d)},Lt),n.mapping.delete(t),null}},Q8=(t,e,n,r,i,s)=>{const l=[],c=t.toDelta(r,i,s);try{for(let f=0;f<c.length;f++){const d=c[f];l.push(e.text(d.insert,sU(d.attributes,e)))}}catch{return t.doc.transact(d=>{t._item.delete(d)},Lt),null}return l},eU=(t,e)=>{const n=new $n,r=t.map(i=>({insert:i.text,attributes:b2(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},tU=(t,e)=>{const n=new On(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,wm(t).map(r=>qb(r,e))),e.mapping.set(n,t),n},qb=(t,e)=>t instanceof Array?eU(t,e):tU(t,e),xT=t=>typeof t=="object"&&t!==null,T1=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],l=t[s],c=e[s];r=s==="ychange"||l===c||xT(l)&&xT(c)&&T1(l,c)}return r},wm=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let l=e[r];r<e.length&&l.isText;l=e[++r])s.push(l);r--,n.push(s)}else n.push(i)}return n},y2=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&i_(r.attributes||{}).length===e[i].marks.length&&Ga(r.attributes,(s,l)=>{var d;const c=A1(l),f=e[i].marks;return T1(s,(d=f.find(p=>p.type.name===c))==null?void 0:d.attrs)}))},rf=(t,e)=>{if(t instanceof On&&!(e instanceof Array)&&Kb(t,e)){const n=wm(e);return t._length===n.length&&T1(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>rf(r,n[i]))}return t instanceof $n&&e instanceof Array&&y2(t,e)},fp=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),ST=(t,e,n)=>{const r=t.toArray(),i=wm(e),s=i.length,l=r.length,c=hs(l,s);let f=0,d=0,p=!1;for(;f<c;f++){const m=r[f],g=i[f];if(fp(n.mapping.get(m),g))p=!0;else if(!rf(m,g))break}for(;f+d<c;d++){const m=r[l-d-1],g=i[s-d-1];if(fp(n.mapping.get(m),g))p=!0;else if(!rf(m,g))break}return{equalityFactor:f+d,foundMappedChild:p}},nU=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof oi?e+=n.content.str:n.content instanceof tn&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},rU=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=nU(t),s=e.map(d=>({insert:d.text,attributes:Object.assign({},r,b2(d.marks,n))})),{insert:l,remove:c,index:f}=I8(i,s.map(d=>d.insert).join(""));t.delete(f,c),t.insert(f,l),t.applyDelta(s.map(d=>({retain:d.insert.length,attributes:d.attributes})))},iU=/(.*)(--[a-zA-Z0-9+/=]{8})$/,A1=t=>{var e;return((e=iU.exec(t))==null?void 0:e[1])??t},sU=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(A1(r),t[r]));return n},b2=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Di(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${K8(r.toJSON())}`:r.type.name]=r.attrs}}),n},Yb=(t,e,n,r)=>{if(e instanceof On&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof On){const m=e.getAttributes(),g=n.attrs;for(const b in g)g[b]!==null?m[b]!==g[b]&&b!=="ychange"&&e.setAttribute(b,g[b]):e.removeAttribute(b);for(const b in m)g[b]===void 0&&e.removeAttribute(b)}const i=wm(n),s=i.length,l=e.toArray(),c=l.length,f=hs(s,c);let d=0,p=0;for(;d<f;d++){const m=l[d],g=i[d];if(!fp(r.mapping.get(m),g))if(rf(m,g))r.mapping.set(m,g);else break}for(;p+d<f;p++){const m=l[c-p-1],g=i[s-p-1];if(!fp(r.mapping.get(m),g))if(rf(m,g))r.mapping.set(m,g);else break}t.transact(()=>{for(;c-d-p>0&&s-d-p>0;){const g=l[d],b=i[d],S=l[c-p-1],v=i[s-p-1];if(g instanceof $n&&b instanceof Array)y2(g,b)||rU(g,b,r),d+=1;else{let C=g instanceof On&&Kb(g,b),T=S instanceof On&&Kb(S,v);if(C&&T){const H=ST(g,b,r),j=ST(S,v,r);H.foundMappedChild&&!j.foundMappedChild?T=!1:!H.foundMappedChild&&j.foundMappedChild||H.equalityFactor<j.equalityFactor?C=!1:T=!1}C?(Yb(t,g,b,r),d+=1):T?(Yb(t,S,v,r),p+=1):(r.mapping.delete(e.get(d)),e.delete(d,1),e.insert(d,[qb(b,r)]),d+=1)}}const m=c-d-p;if(c===1&&s===0&&l[0]instanceof $n?(r.mapping.delete(l[0]),l[0].delete(0,l[0].length)):m>0&&(e.slice(d,d+m).forEach(g=>r.mapping.delete(g)),e.delete(d,m)),d+p<s){const g=[];for(let b=d;b<s-p;b++)g.push(qb(i[b],r));e.insert(d,g)}},Lt)},Kb=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let mu=null;const oU=()=>{const t=mu;mu=null,t.forEach((e,n)=>{const r=n.state.tr,i=Lt.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,l)=>{r.setMeta(l,s)}),n.dispatch(r))})},lU=(t,e,n)=>{mu||(mu=new Map,d1(0,oU)),Di(mu,t,Kr).set(e,n)},dp=(t,e,n)=>{if(t===0)return S0(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof $n){if(r._length>=t)return S0(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Qu(r._item===null?null:r._item.id,r._item===null?Ju(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Qu(r._item===null?null:r._item.id,r._item===null?Ju(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw jn();if(t===0&&r.constructor!==$n&&r!==e)return aU(r._item.parent,r._item)}return S0(e,e._length,e.length===0?-1:0)},aU=(t,e)=>{let n=null,r=null;return t._item===null?r=Ju(t):n=He(t._item.id.client,t._item.id.clock),new Qu(n,r,e.id)},Ea=(t,e,n,r)=>{const i=Bb(n,t);if(i===null||i.type!==e&&!Xu(e,i.type._item))return null;let s=i.type,l=0;if(s.constructor===$n)l=i.index;else if(s._item===null||!s._item.deleted){let c=s._first,f=0;for(;f<s._length&&f<i.index&&c!==null;){if(!c.deleted){const d=c.content.type;f++,d instanceof $n?l+=d._length:l+=r.get(d).nodeSize}c=c.right}l+=1}for(;s!==e&&s._item!==null;){const c=s._item.parent;if(c._item===null||!c._item.deleted){l+=1;let f=c._first;for(;f!==null;){const d=f.content.type;if(d===s)break;f.deleted||(d instanceof $n?l+=d._length:l+=r.get(d).nodeSize),f=f.right}}s=c}return l-1};function cU(t){const e=t.toArray(),n=r=>{let i;if(r instanceof $n)i=r.toDelta().map(l=>{const c={type:"text",text:l.insert};return l.attributes&&(c.marks=Object.keys(l.attributes).map(f=>{const d=l.attributes[f],m={type:A1(f)};return Object.keys(d)&&(m.attrs=d),m})),c});else if(r instanceof On){i={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(i.attrs=s);const l=r.toArray();l.length&&(i.content=l.map(n).flat())}else jn();return i};return{type:"doc",content:e.map(n)}}const uU=(t,e,n)=>t!==e,fU=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),i=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},x2=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),dU=/^#[0-9a-fA-F]{6}$/,wT=(t,e,n,r,i)=>{const s=Lt.getState(t),l=s.doc,c=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?ot.create(t.doc,[]):(e.getStates().forEach((f,d)=>{if(n(l.clientID,d,f)&&f.cursor!=null){const p=f.user||{};p.color==null?p.color="#ffa500":dU.test(p.color)||console.warn("A user uses an unsupported color format",p),p.name==null&&(p.name=`User: ${d}`);let m=Ea(l,s.type,Qo(f.cursor.anchor),s.binding.mapping),g=Ea(l,s.type,Qo(f.cursor.head),s.binding.mapping);if(m!==null&&g!==null){const b=ii(t.doc.content.size-1,0);m=hs(m,b),g=hs(g,b),c.push(Vt.widget(g,()=>r(p,d),{key:d+"",side:10}));const S=hs(m,g),v=ii(m,g);c.push(Vt.inline(S,v,i(p,d),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ot.create(t.doc,c))},hU=(t,{awarenessStateFilter:e=uU,cursorBuilder:n=fU,selectionBuilder:r=x2,getSelection:i=l=>l.selection}={},s="cursor")=>new xt({key:Jd,state:{init(l,c){return wT(c,t,e,n,r)},apply(l,c,f,d){const p=Lt.getState(d),m=l.getMeta(Jd);return p&&p.isChangeOrigin||m&&m.awarenessUpdated?wT(d,t,e,n,r):c.map(l.mapping,l.doc)}},props:{decorations:l=>Jd.getState(l)},view:l=>{const c=()=>{l.docView&&lU(l,Jd,{awarenessUpdated:!0})},f=()=>{const d=Lt.getState(l.state),p=t.getLocalState()||{};if(l.hasFocus()){const m=i(l.state),g=dp(m.anchor,d.type,d.binding.mapping),b=dp(m.head,d.type,d.binding.mapping);(p.cursor==null||!aT(Qo(p.cursor.anchor),g)||!aT(Qo(p.cursor.head),b))&&t.setLocalStateField(s,{anchor:g,head:b})}else p.cursor!=null&&Ea(d.doc,d.type,Qo(p.cursor.anchor),d.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),l.dom.addEventListener("focusin",f),l.dom.addEventListener("focusout",f),{update:f,destroy:()=>{l.dom.removeEventListener("focusin",f),l.dom.removeEventListener("focusout",f),t.off("change",c),t.setLocalStateField(s,null)}}}}),pU=t=>{var e,n;return((n=(e=vi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},mU=t=>{var e,n;return((n=(e=vi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},gU=new Set(["paragraph"]),yU=(t,e)=>!(t instanceof At)||!(t.content instanceof li)||!(t.content.type instanceof go||t.content.type instanceof On&&e.has(t.content.type.nodeName))||t.content.type._length===0,bU=({protectedNodes:t=gU,trackedOrigins:e=[],undoManager:n=null}={})=>new xt({key:vi,state:{init:(r,i)=>{const s=Lt.getState(i),l=n||new K_(s.type,{trackedOrigins:new Set([Lt].concat(e)),deleteFilter:c=>yU(c,t),captureTransaction:c=>c.meta.get("addToHistory")!==!1});return{undoManager:l,prevSel:null,hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}},apply:(r,i,s,l)=>{const c=Lt.getState(l).binding,f=i.undoManager,d=f.undoStack.length>0,p=f.redoStack.length>0;return c?{undoManager:f,prevSel:Fb(c,s),hasUndoOps:d,hasRedoOps:p}:d!==i.hasUndoOps||p!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:f.undoStack.length>0,hasRedoOps:f.redoStack.length>0}):i}},view:r=>{const i=Lt.getState(r.state),s=vi.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:l})=>{const c=i.binding;c&&l.meta.set(c,vi.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:l})=>{const c=i.binding;c&&(c.beforeTransactionSelection=l.meta.get(c)||c.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),xU=Wt.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),vi.getState(e).undoManager.undoStack.length===0?!1:n?pU(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),vi.getState(e).undoManager.redoStack.length===0?!1:n?mU(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=bU(this.options.yUndoOptions),r=n.spec.view;n.spec.view=l=>{const{undoManager:c}=vi.getState(l.state);c.restore&&(c.restore(),c.restore=()=>{});const f=r?r(l):void 0;return{destroy:()=>{const d=c.trackedOrigins.has(c),p=c._observers;c.restore=()=>{d&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=p},f!=null&&f.destroy&&f.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=Z8(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const l=cU(e);if(l.content.length===0)return;this.editor.schema.nodeFromJSON(l).check()}catch(l){return this.editor.emit("contentError",{error:l,editor:this.editor,disableCollaboration:()=>{var c;(c=e.doc)===null||c===void 0||c.destroy(),this.storage.isDisabled=!0}}),!1}})),[s,n,this.editor.options.enableContentCheck&&new xt({key:new Rt("filterInvalidContent"),filterTransaction:()=>{var l;return this.storage.isDisabled&&((l=e.doc)===null||l===void 0||l.destroy()),!0}})].filter(Boolean)}}),vT=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),kT=()=>null,SU=Wt.create({name:"collaborationCursor",priority:999,addOptions(){return{provider:null,user:{name:null,color:null},render:t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},selectionRender:x2,onUpdate:kT}},onCreate(){if(this.options.onUpdate!==kT&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCursor.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor'),!this.options.provider)throw new Error('The "provider" option is required for the CollaborationCursor extension')},addStorage(){return{users:[]}},addCommands(){return{updateUser:t=>()=>(this.options.user=t,this.options.provider.awareness.setLocalStateField("user",this.options.user),!0),user:t=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor'),e.commands.updateUser(t))}},addProseMirrorPlugins(){return[hU((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=vT(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=vT(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),wU=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,vU=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,kU=Ti.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",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ll({find:wU,type:this.type})]},addPasteRules(){return[ho({find:vU,type:this.type})]}}),CU="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",EU="ελ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",Wb="numeric",Gb="ascii",Zb="alpha",gu="asciinumeric",lu="alphanumeric",Jb="domain",S2="emoji",TU="scheme",AU="slashscheme",C0="whitespace";function MU(t,e){return t in e||(e[t]=[]),e[t]}function Ko(t,e,n){e[Wb]&&(e[gu]=!0,e[lu]=!0),e[Gb]&&(e[gu]=!0,e[Zb]=!0),e[gu]&&(e[lu]=!0),e[Zb]&&(e[lu]=!0),e[lu]&&(e[Jb]=!0),e[S2]&&(e[Jb]=!0);for(const r in e){const i=MU(r,n);i.indexOf(t)<0&&i.push(t)}}function OU(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function rr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}rr.groups={};rr.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||rr.groups;let i;return e&&e.j?i=e:(i=new rr(e),n&&r&&Ko(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||rr.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 rr,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new rr,s){if(r)if(l.t&&typeof l.t=="string"){const f=Object.assign(OU(l.t,r),n);Ko(s,f,r)}else n&&Ko(s,n,r);l.t=s}return i.j[t]=l,l}};const qe=(t,e,n,r,i)=>t.ta(e,n,r,i),Bt=(t,e,n,r,i)=>t.tr(e,n,r,i),CT=(t,e,n,r,i)=>t.ts(e,n,r,i),ce=(t,e,n,r,i)=>t.tt(e,n,r,i),ls="WORD",Xb="UWORD",w2="ASCIINUMERICAL",v2="ALPHANUMERICAL",sf="LOCALHOST",Qb="TLD",ex="UTLD",Ch="SCHEME",fa="SLASH_SCHEME",M1="NUM",tx="WS",O1="NL",yu="OPENBRACE",bu="CLOSEBRACE",hp="OPENBRACKET",pp="CLOSEBRACKET",mp="OPENPAREN",gp="CLOSEPAREN",yp="OPENANGLEBRACKET",bp="CLOSEANGLEBRACKET",xp="FULLWIDTHLEFTPAREN",Sp="FULLWIDTHRIGHTPAREN",wp="LEFTCORNERBRACKET",vp="RIGHTCORNERBRACKET",kp="LEFTWHITECORNERBRACKET",Cp="RIGHTWHITECORNERBRACKET",Ep="FULLWIDTHLESSTHAN",Tp="FULLWIDTHGREATERTHAN",Ap="AMPERSAND",Mp="APOSTROPHE",Op="ASTERISK",Ws="AT",_p="BACKSLASH",Dp="BACKTICK",Rp="CARET",Xs="COLON",_1="COMMA",Np="DOLLAR",mi="DOT",zp="EQUALS",D1="EXCLAMATION",Br="HYPHEN",xu="PERCENT",Lp="PIPE",jp="PLUS",Ip="POUND",Su="QUERY",R1="QUOTE",k2="FULLWIDTHMIDDLEDOT",N1="SEMI",gi="SLASH",wu="TILDE",Bp="UNDERSCORE",C2="EMOJI",Up="SYM";var E2=Object.freeze({__proto__:null,ALPHANUMERICAL:v2,AMPERSAND:Ap,APOSTROPHE:Mp,ASCIINUMERICAL:w2,ASTERISK:Op,AT:Ws,BACKSLASH:_p,BACKTICK:Dp,CARET:Rp,CLOSEANGLEBRACKET:bp,CLOSEBRACE:bu,CLOSEBRACKET:pp,CLOSEPAREN:gp,COLON:Xs,COMMA:_1,DOLLAR:Np,DOT:mi,EMOJI:C2,EQUALS:zp,EXCLAMATION:D1,FULLWIDTHGREATERTHAN:Tp,FULLWIDTHLEFTPAREN:xp,FULLWIDTHLESSTHAN:Ep,FULLWIDTHMIDDLEDOT:k2,FULLWIDTHRIGHTPAREN:Sp,HYPHEN:Br,LEFTCORNERBRACKET:wp,LEFTWHITECORNERBRACKET:kp,LOCALHOST:sf,NL:O1,NUM:M1,OPENANGLEBRACKET:yp,OPENBRACE:yu,OPENBRACKET:hp,OPENPAREN:mp,PERCENT:xu,PIPE:Lp,PLUS:jp,POUND:Ip,QUERY:Su,QUOTE:R1,RIGHTCORNERBRACKET:vp,RIGHTWHITECORNERBRACKET:Cp,SCHEME:Ch,SEMI:N1,SLASH:gi,SLASH_SCHEME:fa,SYM:Up,TILDE:wu,TLD:Qb,UNDERSCORE:Bp,UTLD:ex,UWORD:Xb,WORD:ls,WS:tx});const is=/[a-z]/,Xc=new RegExp("\\p{L}","u"),E0=new RegExp("\\p{Emoji}","u"),ss=/\d/,T0=/\s/,ET="\r",A0=`
153
+ `,_U="️",DU="‍",M0="";let Xd=null,Qd=null;function RU(t=[]){const e={};rr.groups=e;const n=new rr;Xd==null&&(Xd=TT(CU)),Qd==null&&(Qd=TT(EU)),ce(n,"'",Mp),ce(n,"{",yu),ce(n,"}",bu),ce(n,"[",hp),ce(n,"]",pp),ce(n,"(",mp),ce(n,")",gp),ce(n,"<",yp),ce(n,">",bp),ce(n,"(",xp),ce(n,")",Sp),ce(n,"「",wp),ce(n,"」",vp),ce(n,"『",kp),ce(n,"』",Cp),ce(n,"<",Ep),ce(n,">",Tp),ce(n,"&",Ap),ce(n,"*",Op),ce(n,"@",Ws),ce(n,"`",Dp),ce(n,"^",Rp),ce(n,":",Xs),ce(n,",",_1),ce(n,"$",Np),ce(n,".",mi),ce(n,"=",zp),ce(n,"!",D1),ce(n,"-",Br),ce(n,"%",xu),ce(n,"|",Lp),ce(n,"+",jp),ce(n,"#",Ip),ce(n,"?",Su),ce(n,'"',R1),ce(n,"/",gi),ce(n,";",N1),ce(n,"~",wu),ce(n,"_",Bp),ce(n,"\\",_p),ce(n,"・",k2);const r=Bt(n,ss,M1,{[Wb]:!0});Bt(r,ss,r);const i=Bt(r,is,w2,{[gu]:!0}),s=Bt(r,Xc,v2,{[lu]:!0}),l=Bt(n,is,ls,{[Gb]:!0});Bt(l,ss,i),Bt(l,is,l),Bt(i,ss,i),Bt(i,is,i);const c=Bt(n,Xc,Xb,{[Zb]:!0});Bt(c,is),Bt(c,ss,s),Bt(c,Xc,c),Bt(s,ss,s),Bt(s,is),Bt(s,Xc,s);const f=ce(n,A0,O1,{[C0]:!0}),d=ce(n,ET,tx,{[C0]:!0}),p=Bt(n,T0,tx,{[C0]:!0});ce(n,M0,p),ce(d,A0,f),ce(d,M0,p),Bt(d,T0,p),ce(p,ET),ce(p,A0),Bt(p,T0,p),ce(p,M0,p);const m=Bt(n,E0,C2,{[S2]:!0});ce(m,"#"),Bt(m,E0,m),ce(m,_U,m);const g=ce(m,DU);ce(g,"#"),Bt(g,E0,m);const b=[[is,l],[ss,i]],S=[[is,null],[Xc,c],[ss,s]];for(let v=0;v<Xd.length;v++)$s(n,Xd[v],Qb,ls,b);for(let v=0;v<Qd.length;v++)$s(n,Qd[v],ex,Xb,S);Ko(Qb,{tld:!0,ascii:!0},e),Ko(ex,{utld:!0,alpha:!0},e),$s(n,"file",Ch,ls,b),$s(n,"mailto",Ch,ls,b),$s(n,"http",fa,ls,b),$s(n,"https",fa,ls,b),$s(n,"ftp",fa,ls,b),$s(n,"ftps",fa,ls,b),Ko(Ch,{scheme:!0,ascii:!0},e),Ko(fa,{slashscheme:!0,ascii:!0},e),t=t.sort((v,C)=>v[0]>C[0]?1:-1);for(let v=0;v<t.length;v++){const C=t[v][0],H=t[v][1]?{[TU]:!0}:{[AU]:!0};C.indexOf("-")>=0?H[Jb]=!0:is.test(C)?ss.test(C)?H[gu]=!0:H[Gb]=!0:H[Wb]=!0,CT(n,C,C,H)}return CT(n,"localhost",sf,{ascii:!0}),n.jd=new rr(Up),{start:n,tokens:Object.assign({groups:e},E2)}}function T2(t,e){const n=NU(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,f=null,d=0,p=null,m=-1,g=-1;for(;l<r&&(f=c.go(n[l]));)c=f,c.accepts()?(m=0,g=0,p=c):m>=0&&(m+=n[l].length,g++),d+=n[l].length,s+=n[l].length,l++;s-=m,l-=g,d-=m,i.push({t:p.t,v:e.slice(s-d,s),s:s-d,e:s})}return i}function NU(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 $s(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const f=e[c];t.j[f]?s=t.j[f]:(s=new rr(r),s.jr=i.slice(),t.j[f]=s),t=s}return s=new rr(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function TT(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 of={defaultProtocol:"http",events:null,format:AT,formatHref:AT,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function z1(t,e=null){let n=Object.assign({},of);t&&(n=Object.assign(n,t instanceof z1?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}z1.prototype={o:of,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]:of[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 AT(t){return t}function A2(t,e){this.t="token",this.v=t,this.tk=e}A2.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=of.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),f=t.get("target",n,e),d=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),f&&(l.target=f),d&&(l.rel=d),p&&Object.assign(l,p),{tagName:i,attributes:l,content:s,eventListeners:m}}};function vm(t,e){class n extends A2{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 MT=vm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),OT=vm("text"),zU=vm("nl"),eh=vm("url",{isLink:!0,toHref(t=of.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==sf&&t[1].t===Xs}}),jr=t=>new rr(t);function LU({groups:t}){const e=t.domain.concat([Ap,Op,Ws,_p,Dp,Rp,Np,zp,Br,M1,xu,Lp,jp,Ip,gi,Up,wu,Bp]),n=[Mp,Xs,_1,mi,D1,xu,Su,R1,N1,yp,bp,yu,bu,pp,hp,mp,gp,xp,Sp,wp,vp,kp,Cp,Ep,Tp],r=[Ap,Mp,Op,_p,Dp,Rp,Np,zp,Br,yu,bu,xu,Lp,jp,Ip,Su,gi,Up,wu,Bp],i=jr(),s=ce(i,wu);qe(s,r,s),qe(s,t.domain,s);const l=jr(),c=jr(),f=jr();qe(i,t.domain,l),qe(i,t.scheme,c),qe(i,t.slashscheme,f),qe(l,r,s),qe(l,t.domain,l);const d=ce(l,Ws);ce(s,Ws,d),ce(c,Ws,d),ce(f,Ws,d);const p=ce(s,mi);qe(p,r,s),qe(p,t.domain,s);const m=jr();qe(d,t.domain,m),qe(m,t.domain,m);const g=ce(m,mi);qe(g,t.domain,m);const b=jr(MT);qe(g,t.tld,b),qe(g,t.utld,b),ce(d,sf,b);const S=ce(m,Br);ce(S,Br,S),qe(S,t.domain,m),qe(b,t.domain,m),ce(b,mi,g),ce(b,Br,S);const v=ce(b,Xs);qe(v,t.numeric,MT);const C=ce(l,Br),T=ce(l,mi);ce(C,Br,C),qe(C,t.domain,l),qe(T,r,s),qe(T,t.domain,l);const H=jr(eh);qe(T,t.tld,H),qe(T,t.utld,H),qe(H,t.domain,l),qe(H,r,s),ce(H,mi,T),ce(H,Br,C),ce(H,Ws,d);const j=ce(H,Xs),ne=jr(eh);qe(j,t.numeric,ne);const $=jr(eh),N=jr();qe($,e,$),qe($,n,N),qe(N,e,$),qe(N,n,N),ce(H,gi,$),ce(ne,gi,$);const D=ce(c,Xs),K=ce(f,Xs),ae=ce(K,gi),xe=ce(ae,gi);qe(c,t.domain,l),ce(c,mi,T),ce(c,Br,C),qe(f,t.domain,l),ce(f,mi,T),ce(f,Br,C),qe(D,t.domain,$),ce(D,gi,$),ce(D,Su,$),qe(xe,t.domain,$),qe(xe,e,$),ce(xe,gi,$);const fe=[[yu,bu],[hp,pp],[mp,gp],[yp,bp],[xp,Sp],[wp,vp],[kp,Cp],[Ep,Tp]];for(let le=0;le<fe.length;le++){const[Q,ie]=fe[le],G=ce($,Q);ce(N,Q,G),ce(G,ie,$);const I=jr(eh);qe(G,e,I);const Z=jr();qe(G,n),qe(I,e,I),qe(I,n,Z),qe(Z,e,I),qe(Z,n,Z),ce(I,ie,$),ce(Z,ie,$)}return ce(i,sf,H),ce(i,O1,zU),{start:i,tokens:E2}}function jU(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,f=null,d=null,p=0,m=null,g=-1;for(;i<r&&!(f=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(d=f||c.go(n[i].t));)f=null,c=d,c.accepts()?(g=0,m=c):g>=0&&g++,i++,p++;if(g<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(O0(OT,e,l)),l=[]),i-=g,p-=g;const b=m.t,S=n.slice(i-p,i);s.push(O0(b,e,S))}}return l.length>0&&s.push(O0(OT,e,l)),s}function O0(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 IU=typeof console<"u"&&console&&console.warn||(()=>{}),BU="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Dt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function UU(){return rr.groups={},Dt.scanner=null,Dt.parser=null,Dt.tokenQueue=[],Dt.pluginQueue=[],Dt.customSchemes=[],Dt.initialized=!1,Dt}function _T(t,e=!1){if(Dt.initialized&&IU(`linkifyjs: already initialized - will not register custom scheme "${t}" ${BU}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
154
+ 1. Must only contain digits, lowercase ASCII letters or "-"
155
+ 2. Cannot start or end with "-"
156
+ 3. "-" cannot repeat`);Dt.customSchemes.push([t,e])}function HU(){Dt.scanner=RU(Dt.customSchemes);for(let t=0;t<Dt.tokenQueue.length;t++)Dt.tokenQueue[t][1]({scanner:Dt.scanner});Dt.parser=LU(Dt.scanner.tokens);for(let t=0;t<Dt.pluginQueue.length;t++)Dt.pluginQueue[t][1]({scanner:Dt.scanner,parser:Dt.parser});return Dt.initialized=!0,Dt}function L1(t){return Dt.initialized||HU(),jU(Dt.parser.start,t,T2(Dt.scanner.start,t))}L1.scan=T2;function M2(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 z1(n),i=L1(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}const j1="[\0-   ᠎ -\u2029  ]",VU=new RegExp(j1),PU=new RegExp(`${j1}$`),$U=new RegExp(j1,"g");function FU(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function qU(t){return new xt({key:new Rt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=Cj(n.doc,[...e]);if(Dj(c).forEach(({newRange:d})=>{const p=Tj(r.doc,d,b=>b.isTextblock);let m,g;if(p.length>1)m=p[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(d.from,d.to," "," ");if(!PU.test(b))return;m=p[0],g=r.doc.textBetween(m.pos,d.to,void 0," ")}if(m&&g){const b=g.split(VU).filter(Boolean);if(b.length<=0)return!1;const S=b[b.length-1],v=m.pos+g.lastIndexOf(S);if(!S)return!1;const C=L1(S).map(T=>T.toObject(t.defaultProtocol));if(!FU(C))return!1;C.filter(T=>T.isLink).map(T=>({...T,from:v+T.start+1,to:v+T.end+1})).filter(T=>r.schema.marks.code?!r.doc.rangeHasMark(T.from,T.to,r.schema.marks.code):!0).filter(T=>t.validate(T.value)).filter(T=>t.shouldAutoLink(T.value)).forEach(T=>{Qx(T.from,T.to,r.doc).some(H=>H.mark.type===t.type)||l.addMark(T.from,T.to,t.type.create({href:T.href}))})}}),!!l.steps.length)return l}})}function YU(t){return new xt({key:new Rt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let l=r.target;const c=[];for(;l.nodeName!=="DIV";)c.push(l),l=l.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const f=GO(e.state,t.type.name),d=r.target,p=(i=d==null?void 0:d.href)!==null&&i!==void 0?i:f.href,m=(s=d==null?void 0:d.target)!==null&&s!==void 0?s:f.target;return d&&p?(window.open(p,m),!0):!1}}})}function KU(t){return new xt({key:new Rt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const f=M2(c,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!f?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function Uo(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($U,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const WU=Ti.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"){_T(t);return}_T(t.scheme,t.optionalSlashes)})},onDestroy(){UU()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Uo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Uo(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=>!!Uo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Pt(this.options.HTMLAttributes,t),0]:["a",Pt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Uo(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 this.options.isAllowedUri(n,{defaultValidate:r=>!!Uo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ho({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=M2(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Uo(l,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>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||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(qU({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Uo(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(YU({type:this.type})),this.options.linkOnPaste&&t.push(KU({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),GU=Wt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new xt({key:new Rt("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((l,c)=>{const f=r>=c&&r<=c+l.nodeSize,d=!l.isLeaf&&am(l);if((f||!this.options.showOnlyCurrent)&&d){const p=[this.options.emptyNodeClass];s&&p.push(this.options.emptyEditorClass);const m=Vt.node(c,c+l.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:f}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),ot.create(t,i)}}})]}});let nx,rx;if(typeof WeakMap<"u"){let t=new WeakMap;nx=e=>t.get(e),rx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;nx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},rx=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ht=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:f,bottom:d}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,f),right:Math.max(r,c),bottom:Math.max(s,d)}}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 nx(t)||rx(t,ZU(t))}};function ZU(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=JU(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let d=0,p=e*n;d<p;d++)r[d]=0;for(let d=0,p=0;d<n;d++){const m=t.child(d);p++;for(let S=0;;S++){for(;i<r.length&&r[i]!=0;)i++;if(S==m.childCount)break;const v=m.child(S),{colspan:C,rowspan:T,colwidth:H}=v.attrs;for(let j=0;j<T;j++){if(j+d>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:p,n:T-j});break}const ne=i+j*e;for(let $=0;$<C;$++){r[ne+$]==0?r[ne+$]=p:(s||(s=[])).push({type:"collision",row:d,pos:p,n:C-$});const N=H&&H[$];if(N){const D=(ne+$)%e*2,K=l[D];K==null||K!=N&&l[D+1]==1?(l[D]=N,l[D+1]=1):K==N&&l[D+1]++}}}i+=C,p+=v.nodeSize}const g=(d+1)*e;let b=0;for(;i<g;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:d,n:b}),p++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Ht(e,n,r,s);let f=!1;for(let d=0;!f&&d<l.length;d+=2)l[d]!=null&&l[d+1]<n&&(f=!0);return f&&XU(c,l,t),c}function JU(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 f=0;f<c.childCount;f++){const d=c.child(f);l+d.attrs.rowspan>r&&(s+=d.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 XU(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 f=l.attrs;for(let d=0;d<f.colspan;d++){const p=e[(i+d)%t.width*2];p!=null&&(!f.colwidth||f.colwidth[d]!=p)&&((c||(c=QU(f)))[d]=p)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function QU(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function In(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 Qs=new Rt("selectingCells");function dl(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 eH(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 ai(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 km(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=dl(e.$head)||tH(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function tH(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 ix(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function nH(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function I1(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function O2(t,e,n){const r=t.node(-1),i=Ht.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 hl(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 _2(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 rH(t,e,n){const r=In(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 Mt=class as extends ze{constructor(e,n=e){const r=e.node(-1),i=Ht.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),f=i.cellsInRect(l).filter(p=>p!=n.pos-s);f.unshift(n.pos-s);const d=f.map(p=>{const m=r.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=s+p+1;return new PM(c.resolve(g),c.resolve(g+m.content.size))});super(d[0].$from,d[0].$to,d),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(ix(r)&&ix(i)&&I1(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?as.rowSelection(r,i):s&&this.isColSelection()?as.colSelection(r,i):new as(r,i)}return _e.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ht.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let f=i.top;f<i.bottom;f++){const d=[];for(let p=f*n.width+i.left,m=i.left;m<i.right;m++,p++){const g=n.map[p];if(s[g])continue;s[g]=!0;const b=n.findCell(g);let S=e.nodeAt(g);if(!S)throw new RangeError(`No cell with offset ${g} found`);const v=i.left-b.left,C=b.right-i.right;if(v>0||C>0){let T=S.attrs;if(v>0&&(T=hl(T,0,v)),C>0&&(T=hl(T,T.colspan-C,C)),b.left<i.left){if(S=S.type.createAndFill(T),!S)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(T)}`)}else S=S.type.create(T,S.content)}if(b.top<i.top||b.bottom>i.bottom){const T={...S.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?S=S.type.createAndFill(T):S=S.type.create(T,S.content)}d.push(S)}l.push(e.child(f).copy(te.from(d)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new pe(te.from(c),1,1)}replace(e,n=pe.empty){const r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:c,$to:f}=i[l],d=e.mapping.slice(r);e.replace(d.map(c.pos),d.map(f.pos),l?pe.empty:n)}const s=ze.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new pe(te.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ht.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=Ht.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),f=e.node(0);return l.top<=c.top?(l.top>0&&(e=f.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=f.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=f.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=f.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new as(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ht.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 as&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ht.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),f=e.node(0);return l.left<=c.left?(l.left>0&&(e=f.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=f.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=f.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=f.resolve(s+i.map[i.width*(l.top+1)-1]))),new as(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new as(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new as(e.resolve(n),e.resolve(r))}getBookmark(){return new iH(this.$anchorCell.pos,this.$headCell.pos)}};Mt.prototype.visible=!1;ze.jsonID("cell",Mt);var iH=class D2{constructor(e,n){this.anchor=e,this.head=n}map(e){return new D2(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&&I1(n,r)?new Mt(n,r):ze.near(r,1)}};function sH(t){if(!(t.selection instanceof Mt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Vt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ot.create(t.doc,e)}function oH({$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 lH({$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 aH(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=Mt.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=Mt.rowSelection(c,c)}else if(!n){const c=Ht.get(r.node),f=r.from+1,d=f+c.map[c.width*c.height-1];s=Mt.create(i,f+1,d)}}else r instanceof _e&&oH(r)?s=_e.create(i,r.from):r instanceof _e&&lH(r)&&(s=_e.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const cH=new Rt("fix-tables");function R2(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const f=e.child(l);for(let d=c,p=Math.min(i,l+3);d<p;d++)if(t.child(d)==f){c=d+1,n+=f.nodeSize;continue e}r(f,n),c<i&&t.child(c).sameMarkup(f)?R2(t.child(c),f,n+1,r):f.nodesBetween(0,f.content.size,r,n+1),n+=f.nodeSize}}function N2(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=uH(t,i,s,n))};return e?e.doc!=t.doc&&R2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function uH(t,e,n,r){const i=Ht.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let f=0;f<i.height;f++)s.push(0);for(let f=0;f<i.problems.length;f++){const d=i.problems[f];if(d.type=="collision"){const p=e.nodeAt(d.pos);if(!p)continue;const m=p.attrs;for(let g=0;g<m.rowspan;g++)s[d.row+g]+=d.n;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,hl(m,m.colspan-d.n,d.n))}else if(d.type=="missing")s[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const p=e.nodeAt(d.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const p=e.nodeAt(d.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...p.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const p=r.mapping.map(n);r.delete(p,p+e.nodeSize)}}let l,c;for(let f=0;f<s.length;f++)s[f]&&(l==null&&(l=f),c=f);for(let f=0,d=n+1;f<i.height;f++){const p=e.child(f),m=d+p.nodeSize,g=s[f];if(g>0){let b="cell";p.firstChild&&(b=p.firstChild.type.spec.tableRole);const S=[];for(let C=0;C<g;C++){const T=In(t.schema)[b].createAndFill();T&&S.push(T)}const v=(f==0||l==f-1)&&c==f?d+1:m-1;r.insert(r.mapping.map(v),S)}d=m}return r.setMeta(cH,{fixTables:!0})}function Ri(t){const e=t.selection,n=km(t),r=n.node(-1),i=n.start(-1),s=Ht.get(r);return{...e instanceof Mt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function z2(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;rH(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 f=e.map[c],d=r.nodeAt(f);t.setNodeMarkup(t.mapping.map(n+f),null,_2(d.attrs,i-e.colCount(f))),l+=d.attrs.rowspan-1}else{const f=s==null?In(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,d=e.positionAt(l,i,r);t.insert(t.mapping.map(n+d),f.createAndFill())}}return t}function fH(t,e){if(!ai(t))return!1;if(e){const n=Ri(t);e(z2(t.tr,n,n.left))}return!0}function dH(t,e){if(!ai(t))return!1;if(e){const n=Ri(t);e(z2(t.tr,n,n.right))}return!0}function hH(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,f=e.map[c],d=n.nodeAt(f),p=d.attrs;if(i>0&&e.map[c-1]==f||i<e.width-1&&e.map[c+1]==f)t.setNodeMarkup(t.mapping.slice(s).map(r+f),null,hl(p,i-e.colCount(f)));else{const m=t.mapping.slice(s).map(r+f);t.delete(m,m+d.nodeSize)}l+=p.rowspan}}function pH(t,e){if(!ai(t))return!1;if(e){const n=Ri(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;hH(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=Ht.get(s)}e(r)}return!0}function mH(t,e,n){var r;const i=In(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 L2(t,{map:e,tableStart:n,table:r},i){let s=n;for(let d=0;d<i;d++)s+=r.child(d).nodeSize;const l=[];let c=i>0?-1:0;mH(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let d=0,p=e.width*i;d<e.width;d++,p++)if(i>0&&i<e.height&&e.map[p]==e.map[p-e.width]){const m=e.map[p],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),d+=g.colspan-1}else{var f;const m=c==null?In(r.type.schema).cell:(f=r.nodeAt(e.map[p+c*e.width]))===null||f===void 0?void 0:f.type,g=m==null?void 0:m.createAndFill();g&&l.push(g)}return t.insert(s,In(r.type.schema).row.create(null,l)),t}function gH(t,e){if(!ai(t))return!1;if(e){const n=Ri(t);e(L2(t.tr,n,n.top))}return!0}function yH(t,e){if(!ai(t))return!1;if(e){const n=Ri(t);e(L2(t.tr,n,n.bottom))}return!0}function bH(t,{map:e,table:n,tableStart:r},i){let s=0;for(let d=0;d<i;d++)s+=n.child(d).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const f=new Set;for(let d=0,p=i*e.width;d<e.width;d++,p++){const m=e.map[p];if(!f.has(m)){if(f.add(m),i>0&&m==e.map[p-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),d+=g.colspan-1}else if(i<e.height&&m==e.map[p+e.width]){const g=n.nodeAt(m),b=g.attrs,S=g.type.create({...b,rowspan:g.attrs.rowspan-1},g.content),v=e.positionAt(i+1,d,n);t.insert(t.mapping.slice(c).map(r+v),S),d+=b.colspan-1}}}}function xH(t,e){if(!ai(t))return!1;if(e){const n=Ri(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;bH(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=Ht.get(n.table)}e(r)}return!0}function DT(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function SH({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 f=r.top;f<r.bottom;f++){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 f=r.left;f<r.right;f++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function RT(t,e){const n=t.selection;if(!(n instanceof Mt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ri(t),{map:i}=r;if(SH(i,r))return!1;if(e){const s=t.tr,l={};let c=te.empty,f,d;for(let p=r.top;p<r.bottom;p++)for(let m=r.left;m<r.right;m++){const g=i.map[p*i.width+m],b=r.table.nodeAt(g);if(!(l[g]||!b))if(l[g]=!0,f==null)f=g,d=b;else{DT(b)||(c=c.append(b.content));const S=s.mapping.map(g+r.tableStart);s.delete(S,S+b.nodeSize)}}if(f==null||d==null)return!0;if(s.setNodeMarkup(f+r.tableStart,null,{..._2(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const p=f+1+d.content.size,m=DT(d)?f+1:p;s.replaceWith(m+r.tableStart,p+r.tableStart,c)}s.setSelection(new Mt(s.doc.resolve(f+r.tableStart))),e(s)}return!0}function NT(t,e){const n=In(t.schema);return wH(({node:r})=>n[r.type.spec.tableRole])(t,e)}function wH(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Mt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=eH(r.$from),!i)return!1;s=(l=dl(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 f=[],d=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const p=Ri(e),m=e.tr;for(let b=0;b<p.right-p.left;b++)f.push(d?{...c,colwidth:d&&d[b]?[d[b]]:null}:c);let g;for(let b=p.top;b<p.bottom;b++){let S=p.map.positionAt(b,p.left,p.table);b==p.top&&(S+=i.nodeSize);for(let v=p.left,C=0;v<p.right;v++,C++)v==p.left&&b==p.top||m.insert(g=m.mapping.map(S+p.tableStart,1),t({node:i,row:b,col:v}).createAndFill(f[C]))}m.setNodeMarkup(s,t({node:i,row:p.top,col:p.left}),f[0]),r instanceof Mt&&m.setSelection(new Mt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function vH(t,e){return function(n,r){if(!ai(n))return!1;const i=km(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Mt?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 kH(t){return function(e,n){if(!ai(e))return!1;if(n){const r=In(e.schema),i=Ri(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(f=>i.table.nodeAt(f));for(let f=0;f<l.length;f++)c[f].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[f],r.cell,c[f].attrs);if(s.steps.length===0)for(let f=0;f<l.length;f++)s.setNodeMarkup(i.tableStart+l[f],r.header_cell,c[f].attrs);n(s)}return!0}}function zT(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 lf(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?kH(t):function(n,r){if(!ai(n))return!1;if(r){const i=In(n.schema),s=Ri(n),l=n.tr,c=zT("row",s,i),f=zT("column",s,i),d=(t==="column"?c:t==="row"&&f)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:s.map.height}:t=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?f?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,S=l.doc.nodeAt(b);S&&l.setNodeMarkup(b,m,S.attrs)}),r(l)}return!0}}lf("row",{useDeprecatedLogic:!0});lf("column",{useDeprecatedLogic:!0});const CH=lf("cell",{useDeprecatedLogic:!0});function EH(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 LT(t){return function(e,n){if(!ai(e))return!1;const r=EH(km(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(_e.between(i,nH(i))).scrollIntoView())}return!0}}function TH(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 th(t,e){const n=t.selection;if(!(n instanceof Mt))return!1;if(e){const r=t.tr,i=In(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 pe(i,0,0))}),r.docChanged&&e(r)}return!0}function AH(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 f=0;f<e.childCount;f++){let d=e.child(f).content;const p=f?0:Math.max(0,n-1),m=f<e.childCount-1?0:Math.max(0,r-1);(p||m)&&(d=sx(In(l).row,new pe(d,p,m)).content),c.push(d)}else if(s=="cell"||s=="header_cell")c.push(n||r?sx(In(l).row,new pe(e,n,r)).content:e);else return null;return MH(l,c)}function MH(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:f}=s.child(l).attrs;for(let d=i;d<i+c;d++)n[d]=(n[d]||0)+f}}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(te.empty),n[i]<r){const s=In(t).cell.createAndFill(),l=[];for(let c=n[i];c<r;c++)l.push(s);e[i]=e[i].append(te.from(l))}return{height:e.length,width:r,rows:e}}function sx(t,e){const n=t.createAndFill();return new Rx(n).replace(0,n.content.size,e).doc}function OH({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const f=n[c],d=[];for(let p=s[c]||0,m=0;p<r;m++){let g=f.child(m%f.childCount);p+g.attrs.colspan>r&&(g=g.type.createChecked(hl(g.attrs,g.attrs.colspan,p+g.attrs.colspan-r),g.content)),d.push(g),p+=g.attrs.colspan;for(let b=1;b<g.attrs.rowspan;b++)s[c+b]=(s[c+b]||0)+g.attrs.colspan}l.push(te.from(d))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const f=[],d=n[c%e];for(let p=0;p<d.childCount;p++){let m=d.child(p);l+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),f.push(m)}s.push(te.from(f))}n=s,e=i}return{width:t,height:e,rows:n}}function _H(t,e,n,r,i,s,l){const c=t.doc.type.schema,f=In(c);let d,p;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const b=n.child(m);g+=b.nodeSize;const S=[];let v;b.lastChild==null||b.lastChild.type==f.cell?v=d||(d=f.cell.createAndFill()):v=p||(p=f.header_cell.createAndFill());for(let C=e.width;C<i;C++)S.push(v);t.insert(t.mapping.slice(l).map(g-1+r),S)}if(s>e.height){const m=[];for(let S=0,v=(e.height-1)*e.width;S<Math.max(e.width,i);S++){const C=S>=e.width?!1:n.nodeAt(e.map[v+S]).type==f.header_cell;m.push(C?p||(p=f.header_cell.createAndFill()):d||(d=f.cell.createAndFill()))}const g=f.row.create(null,te.from(m)),b=[];for(let S=e.height;S<s;S++)b.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),b)}return!!(d||p)}function jT(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let f=!1;for(let d=i;d<s;d++){const p=l*e.width+d,m=e.map[p];if(e.map[p-e.width]==m){f=!0;const g=n.nodeAt(m),{top:b,left:S}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g.attrs,rowspan:l-b}),t.insert(t.mapping.slice(c).map(e.positionAt(l,S,n)),g.type.createAndFill({...g.attrs,rowspan:b+g.attrs.rowspan-l})),d+=g.attrs.colspan-1}}return f}function IT(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let f=!1;for(let d=i;d<s;d++){const p=d*e.width+l,m=e.map[p];if(e.map[p-1]==m){f=!0;const g=n.nodeAt(m),b=e.colCount(m),S=t.mapping.slice(c).map(m+r);t.setNodeMarkup(S,null,hl(g.attrs,l-b,g.attrs.colspan-(l-b))),t.insert(S+g.nodeSize,g.type.createAndFill(hl(g.attrs,0,l-b))),d+=g.attrs.rowspan-1}}return f}function BT(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=Ht.get(s);const{top:c,left:f}=r,d=f+i.width,p=c+i.height,m=t.tr;let g=0;function b(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");l=Ht.get(s),g=m.mapping.maps.length}_H(m,l,s,n,d,p,g)&&b(),jT(m,l,s,n,f,d,c,g)&&b(),jT(m,l,s,n,f,d,p,g)&&b(),IT(m,l,s,n,c,p,f,g)&&b(),IT(m,l,s,n,c,p,d,g)&&b();for(let S=c;S<p;S++){const v=l.positionAt(S,f,s),C=l.positionAt(S,d,s);m.replace(m.mapping.slice(g).map(v+n),m.mapping.slice(g).map(C+n),new pe(i.rows[S-c],0,0))}b(),m.setSelection(new Mt(m.doc.resolve(n+l.positionAt(c,f,s)),m.doc.resolve(n+l.positionAt(p-1,d-1,s)))),e(m)}const DH=$x({ArrowLeft:nh("horiz",-1),ArrowRight:nh("horiz",1),ArrowUp:nh("vert",-1),ArrowDown:nh("vert",1),"Shift-ArrowLeft":rh("horiz",-1),"Shift-ArrowRight":rh("horiz",1),"Shift-ArrowUp":rh("vert",-1),"Shift-ArrowDown":rh("vert",1),Backspace:th,"Mod-Backspace":th,Delete:th,"Mod-Delete":th});function Eh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function nh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Mt)return Eh(n,r,ze.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=j2(i,t,e);if(l==null)return!1;if(t=="horiz")return Eh(n,r,ze.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),f=O2(c,t,e);let d;return f?d=ze.near(f,1):e<0?d=ze.near(n.doc.resolve(c.before(-1)),-1):d=ze.near(n.doc.resolve(c.after(-1)),1),Eh(n,r,d)}}}function rh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof Mt)l=s;else{const f=j2(i,t,e);if(f==null)return!1;l=new Mt(n.doc.resolve(f))}const c=O2(l.$headCell,t,e);return c?Eh(n,r,new Mt(l.$anchorCell,c)):!1}}function RH(t,e){const n=t.state.doc,r=dl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Mt(r))),!0):!1}function NH(t,e,n){if(!ai(t.state))return!1;let r=AH(n);const i=t.state.selection;if(i instanceof Mt){r||(r={width:1,height:1,rows:[te.from(sx(In(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=Ht.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=OH(r,c.right-c.left,c.bottom-c.top),BT(t.state,t.dispatch,l,c,r),!0}else if(r){const s=km(t.state),l=s.start(-1);return BT(t.state,t.dispatch,l,Ht.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function zH(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=UT(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Mt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=dl(t.state.selection.$anchor))!=null&&((n=_0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(f,d){let p=_0(t,d);const m=Qs.getState(t.state)==null;if(!p||!I1(f,p))if(m)p=f;else return;const g=new Mt(f,p);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(Qs,f.pos),t.dispatch(b)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),Qs.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Qs,-1))}function c(f){const d=f,p=Qs.getState(t.state);let m;if(p!=null)m=t.state.doc.resolve(p);else if(UT(t,d.target)!=r&&(m=_0(t,e),!m))return l();m&&s(m,d)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",c)}function j2(t,e,n){if(!(t.state.selection instanceof _e))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 UT(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function _0(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&&dl(t.state.doc.resolve(r))||dl(t.state.doc.resolve(i))}var LH=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")),ox(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,ox(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ox(t,e,n,r,i,s){let l=0,c=!0,f=e.firstChild;const d=t.firstChild;if(d){for(let m=0,g=0;m<d.childCount;m++){const{colspan:b,colwidth:S}=d.child(m).attrs;for(let v=0;v<b;v++,g++){const C=i==g?s:S&&S[v],T=C?C+"px":"";if(l+=C||r,C||(c=!1),f)f.style.width!=T&&(f.style.width=T),f=f.nextSibling;else{const H=document.createElement("col");H.style.width=T,e.appendChild(H)}}}for(;f;){var p;const m=f.nextSibling;(p=f.parentNode)===null||p===void 0||p.removeChild(f),f=m}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const Sr=new Rt("tableColumnResizing");function jH({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=LH,lastColumnResizable:i=!0}={}){const s=new xt({key:Sr,state:{init(l,c){var f;const d=(f=s.spec)===null||f===void 0||(f=f.props)===null||f===void 0?void 0:f.nodeViews,p=In(c.schema).table.name;return r&&d&&(d[p]=(m,g)=>new r(m,n,g)),new IH(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=Sr.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{BH(l,c,t,i)},mouseleave:l=>{UH(l)},mousedown:(l,c)=>{HH(l,c,e,n)}},decorations:l=>{const c=Sr.getState(l);if(c&&c.activeHandle>-1)return qH(l,c.activeHandle)},nodeViews:{}}});return s}var IH=class Th{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Sr);if(r&&r.setHandle!=null)return new Th(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Th(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return ix(e.doc.resolve(i))||(i=-1),new Th(i,n.dragging)}return n}};function BH(t,e,n,r){if(!t.editable)return;const i=Sr.getState(t.state);if(i&&!i.dragging){const s=PH(e.target);let l=-1;if(s){const{left:c,right:f}=s.getBoundingClientRect();e.clientX-c<=n?l=HT(t,e,"left",n):f-e.clientX<=n&&(l=HT(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),f=c.node(-1),d=Ht.get(f),p=c.start(-1);if(d.colCount(c.pos-p)+c.nodeAfter.attrs.colspan-1==d.width-1)return}I2(t,l)}}}function UH(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&I2(t,-1)}function HH(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=Sr.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),f=VH(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Sr,{setDragging:{startX:e.clientX,startWidth:f}}));function d(m){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",p);const g=Sr.getState(t.state);g!=null&&g.dragging&&($H(t,g.activeHandle,VT(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function p(m){if(!m.which)return d(m);const g=Sr.getState(t.state);if(g&&g.dragging){const b=VT(g.dragging,m,n);PT(t,g.activeHandle,b,r)}}return PT(t,l.activeHandle,f,r),s.addEventListener("mouseup",d),s.addEventListener("mousemove",p),e.preventDefault(),!0}function VH(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 f=0;f<n;f++)r[f]&&(l-=r[f],c--);return l/c}function PH(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function HT(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=dl(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const f=Ht.get(c.node(-1)),d=c.start(-1),p=f.map.indexOf(c.pos-d);return p%f.width==0?-1:d+f.map[p-1]}function VT(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function I2(t,e){t.dispatch(t.state.tr.setMeta(Sr,{setHandle:e}))}function $H(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Ht.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,f=t.state.tr;for(let d=0;d<s.height;d++){const p=d*s.width+c;if(d&&s.map[p]==s.map[p-s.width])continue;const m=s.map[p],g=i.nodeAt(m).attrs,b=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[b]==n)continue;const S=g.colwidth?g.colwidth.slice():FH(g.colspan);S[b]=n,f.setNodeMarkup(l+m,null,{...g,colwidth:S})}f.docChanged&&t.dispatch(f)}function PT(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=Ht.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let f=t.domAtPos(i.start(-1)).node;for(;f&&f.nodeName!="TABLE";)f=f.parentNode;f&&ox(s,f.firstChild,f,r,c,n)}function FH(t){return Array(t).fill(0)}function qH(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ot.empty;const s=Ht.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let d=0;d<s.height;d++){const p=c+d*s.width;if((c==s.width-1||s.map[p]!=s.map[p+1])&&(d==0||s.map[p]!=s.map[p-s.width])){var f;const m=s.map[p],g=l+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((f=Sr.getState(t))===null||f===void 0)&&f.dragging&&n.push(Vt.node(l+m,l+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(Vt.widget(g,b))}}return ot.create(t.doc,n)}function YH({allowTableNodeSelection:t=!1}={}){return new xt({key:Qs,state:{init(){return null},apply(e,n){const r=e.getMeta(Qs);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:sH,handleDOMEvents:{mousedown:zH},createSelectionBetween(e){return Qs.getState(e.state)!=null?e.state.selection:null},handleTripleClick:RH,handleKeyDown:DH,handlePaste:NH},appendTransaction(e,n,r){return aH(r,N2(r,n),t)}})}function lx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function $T(t,e,n,r,i,s){var l;let c=0,f=!0,d=e.firstChild;const p=t.firstChild;if(p!==null)for(let m=0,g=0;m<p.childCount;m+=1){const{colspan:b,colwidth:S}=p.child(m).attrs;for(let v=0;v<b;v+=1,g+=1){const C=i===g?s:S&&S[v],T=C?`${C}px`:"";if(c+=C||r,C||(f=!1),d){if(d.style.width!==T){const[H,j]=lx(r,C);d.style.setProperty(H,j)}d=d.nextSibling}else{const H=document.createElement("col"),[j,ne]=lx(r,C);H.style.setProperty(j,ne),e.appendChild(H)}}}for(;d;){const m=d.nextSibling;(l=d.parentNode)===null||l===void 0||l.removeChild(d),d=m}f?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class KH{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),$T(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,$T(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function WH(t,e,n,r){let i=0,s=!0;const l=[],c=t.firstChild;if(!c)return{};for(let m=0,g=0;m<c.childCount;m+=1){const{colspan:b,colwidth:S}=c.child(m).attrs;for(let v=0;v<b;v+=1,g+=1){const C=n===g?r:S&&S[v];i+=C||e,C||(s=!1);const[T,H]=lx(e,C);l.push(["col",{style:`${T}: ${H}`}])}}const f=s?`${i}px`:"",d=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:f,tableMinWidth:d}}function FT(t,e){return t.createAndFill()}function GH(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 ZH(t,e,n,r,i){const s=GH(t),l=[],c=[];for(let d=0;d<n;d+=1){const p=FT(s.cell);if(p&&c.push(p),r){const m=FT(s.header_cell);m&&l.push(m)}}const f=[];for(let d=0;d<e;d+=1)f.push(s.row.createChecked(null,r&&d===0?l:c));return s.table.createChecked(null,f)}function JH(t){return t instanceof Mt}const ih=({editor:t})=>{const{selection:e}=t.state;if(!JH(e))return!1;let n=0;const r=WO(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},XH=gn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:KH,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}=WH(t,this.options.cellMinWidth),s=["table",Pt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const l=ZH(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(_e.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>fH(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>dH(t,e),deleteColumn:()=>({state:t,dispatch:e})=>pH(t,e),addRowBefore:()=>({state:t,dispatch:e})=>gH(t,e),addRowAfter:()=>({state:t,dispatch:e})=>yH(t,e),deleteRow:()=>({state:t,dispatch:e})=>xH(t,e),deleteTable:()=>({state:t,dispatch:e})=>TH(t,e),mergeCells:()=>({state:t,dispatch:e})=>RT(t,e),splitCell:()=>({state:t,dispatch:e})=>NT(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>lf("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>lf("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>CH(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>RT(t,e)?!0:NT(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>vH(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>LT(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>LT(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&N2(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Mt.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:ih,"Mod-Backspace":ih,Delete:ih,"Mod-Delete":ih}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[jH({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],YH({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Ye(we(t,"tableRole",e))}}}),QH=gn.create({name:"tableCell",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:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Pt(this.options.HTMLAttributes,t),0]}}),e9=gn.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",Pt(this.options.HTMLAttributes,t),0]}}),t9=gn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Pt(this.options.HTMLAttributes,t),0]}});var n9=eM();const r9=Wp(n9);function i9(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var B2={exports:{}},D0={};/**
157
+ * @license React
158
+ * use-sync-external-store-shim.production.min.js
159
+ *
160
+ * Copyright (c) Facebook, Inc. and its affiliates.
161
+ *
162
+ * This source code is licensed under the MIT license found in the
163
+ * LICENSE file in the root directory of this source tree.
164
+ */var qT;function s9(){if(qT)return D0;qT=1;var t=un;function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&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(m,g){var b=g(),S=r({inst:{value:b,getSnapshot:g}}),v=S[0].inst,C=S[1];return s(function(){v.value=b,v.getSnapshot=g,f(v)&&C({inst:v})},[m,b,g]),i(function(){return f(v)&&C({inst:v}),m(function(){f(v)&&C({inst:v})})},[m]),l(b),b}function f(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function d(m,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return D0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,D0}B2.exports=s9();var B1=B2.exports;const o9=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},l9=({contentComponent:t})=>{const e=B1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return un.createElement(un.Fragment,null,Object.values(e))};function a9(){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]:r9.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}class c9 extends un.Component{constructor(e){var n;super(e),this.editorContentRef=un.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=a9(),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(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return un.createElement(un.Fragment,null,un.createElement("div",{ref:o9(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&un.createElement(l9,{contentComponent:e.contentComponent}))}}const u9=O.forwardRef((t,e)=>{const n=un.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return un.createElement(c9,{key:n,innerRef:e,...t})}),f9=un.memo(u9);var d9=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var l=s[i];if(!(l==="_owner"&&e.$$typeof)&&!t(e[l],n[l]))return!1}return!0}return e!==e&&n!==n},h9=i9(d9),U2={exports:{}},R0={};/**
165
+ * @license React
166
+ * use-sync-external-store-shim/with-selector.production.min.js
167
+ *
168
+ * Copyright (c) Facebook, Inc. and its affiliates.
169
+ *
170
+ * This source code is licensed under the MIT license found in the
171
+ * LICENSE file in the root directory of this source tree.
172
+ */var YT;function p9(){if(YT)return R0;YT=1;var t=un,e=B1;function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,f=t.useDebugValue;return R0.useSyncExternalStoreWithSelector=function(d,p,m,g,b){var S=s(null);if(S.current===null){var v={hasValue:!1,value:null};S.current=v}else v=S.current;S=c(function(){function T(N){if(!H){if(H=!0,j=N,N=g(N),b!==void 0&&v.hasValue){var D=v.value;if(b(D,N))return ne=D}return ne=N}if(D=ne,r(j,N))return D;var K=g(N);return b!==void 0&&b(D,K)?D:(j=N,ne=K)}var H=!1,j,ne,$=m===void 0?null:m;return[function(){return T(p())},$===null?void 0:function(){return T($())}]},[p,m,g,b]);var C=i(d,S[0],S[1]);return l(function(){v.hasValue=!0,v.value=C},[C]),f(C),C},R0}U2.exports=p9();var m9=U2.exports;const g9=typeof window<"u"?O.useLayoutEffect:O.useEffect;class y9{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function b9(t){var e;const[n]=O.useState(()=>new y9(t.editor)),r=m9.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:h9);return g9(()=>n.watch(t.editor),[t.editor,n]),O.useDebugValue(r),r}const x9=!1,ax=typeof window>"u",S9=ax||!!(typeof window<"u"&&window.next);class U1{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?ax||S9?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||s===void 0?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)===null||s===void 0?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)===null||s===void 0?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)===null||s===void 0?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)===null||s===void 0?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)===null||s===void 0?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)===null||s===void 0?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)===null||s===void 0?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)===null||s===void 0?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)===null||s===void 0?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)===null||s===void 0?void 0:s.call(i,...r)}};return new uI(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||l===void 0?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?U1.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 w9(t={},e=[]){const n=O.useRef(t);n.current=t;const[r]=O.useState(()=>new U1(n)),i=B1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return O.useDebugValue(i),O.useEffect(r.onRender(e)),b9({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const v9=O.createContext({editor:null});v9.Consumer;const k9=O.createContext({onDragStart:void 0}),C9=()=>O.useContext(k9);un.forwardRef((t,e)=>{const{onDragStart:n}=C9(),r=t.as||"div";return un.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const E9=/^\s*>\s$/,T9=gn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Fu({find:E9,type:this.type})]}}),A9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,M9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,O9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,_9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,D9=Ti.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["strong",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ll({find:A9,type:this.type}),ll({find:O9,type:this.type})]},addPasteRules(){return[ho({find:M9,type:this.type}),ho({find:_9,type:this.type})]}}),R9="listItem",KT="textStyle",WT=/^\s*([-+*])\s$/,N9=gn.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",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(R9,this.editor.getAttributes(KT)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Fu({find:WT,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fu({find:WT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(KT),editor:this.editor})),[t]}}),z9=/(^|[^`])`([^`]+)`(?!`)/,L9=/(^|[^`])`([^`]+)`(?!`)/g,j9=Ti.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ll({find:z9,type:this.type})]},addPasteRules(){return[ho({find:L9,type:this.type})]}}),I9=/^```([a-z]+)?[\s\n]$/,B9=/^~~~([a-z]+)?[\s\n]$/,U9=gn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,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,s=[...((e=t.firstElementChild)===null||e===void 0?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",Pt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},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},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(`
173
+
174
+ `);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:d})=>(d.setSelection(ze.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[_b({find:I9,type:this.type,getAttributes:t=>({language:t[1]})}),_b({find:B9,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new xt({key:new Rt("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,f=c.text(n.replace(/\r\n?/g,`
175
+ `));return l.replaceSelectionWith(this.type.create({language:s},f)),l.selection.$from.parent.type!==this.type&&l.setSelection(_e.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),H9=gn.create({name:"doc",topNode:!0,content:"block+"});function V9(t={}){return new xt({view(e){return new P9(e,t)}})}class P9{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 m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let S=b.getBoundingClientRect(),v=m?S.bottom:S.top;m&&g&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*c;r={left:S.left,right:S.right,top:v-C,bottom:v+C}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*l;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let d,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")d=-pageXOffset,p=-pageYOffset;else{let m=f.getBoundingClientRect(),g=m.width/f.offsetWidth,b=m.height/f.offsetHeight;d=m.left-f.scrollLeft*g,p=m.top-f.scrollTop*b}this.element.style.left=(r.left-d)/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=IM(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)}}const $9=Wt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[V9(this.options)]}});class Ut extends ze{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ut.valid(r)?new Ut(r):ze.near(r)}content(){return pe.empty}eq(e){return e instanceof Ut&&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 Ut(e.resolve(n.pos))}getBookmark(){return new H1(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!F9(e)||!q9(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&&Ut.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 f=e.doc.resolve(i);if(Ut.valid(f))return f}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(Ut.valid(c))return c}return null}}}Ut.prototype.visible=!1;Ut.findFrom=Ut.findGapCursorFrom;ze.jsonID("gapcursor",Ut);class H1{constructor(e){this.pos=e}map(e){return new H1(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ut.valid(n)?new Ut(n):ze.near(n)}}function H2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function F9(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||H2(i.type))return!0;if(i.inlineContent)return!1}}return!0}function q9(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||H2(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y9(){return new xt({props:{decorations:Z9,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ut.valid(n)?new Ut(n):null},handleClick:W9,handleKeyDown:K9,handleDOMEvents:{beforeinput:G9}}})}const K9=$x({ArrowLeft:sh("horiz",-1),ArrowRight:sh("horiz",1),ArrowUp:sh("vert",-1),ArrowDown:sh("vert",1)});function sh(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,f=l.empty;if(l instanceof _e){if(!s.endOfTextblock(n)||c.depth==0)return!1;f=!1,c=r.doc.resolve(e>0?c.after():c.before())}let d=Ut.findGapCursorFrom(c,e,f);return d?(i&&i(r.tr.setSelection(new Ut(d))),!0):!1}}function W9(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ut.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 Ut(r))),!0)}function G9(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ut))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=te.empty;for(let l=r.length-1;l>=0;l--)i=te.from(r[l].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new pe(i,0,0));return s.setSelection(_e.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function Z9(t){if(!(t.selection instanceof Ut))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ot.create(t.doc,[Vt.widget(t.selection.head,e,{key:"gapcursor"})])}const J9=Wt.create({name:"gapCursor",addProseMirrorPlugins(){return[Y9()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ye(we(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),X9=gn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Pt(this.options.HTMLAttributes,t)]},renderText(){return`
176
+ `},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,f=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:p})=>{if(p&&f&&l){const m=f.filter(g=>c.includes(g.type.name));d.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Q9=gn.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]}`,Pt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>_b({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Hp=200,pn=function(){};pn.prototype.append=function(e){return e.length?(e=pn.from(e),!this.length&&e||e.length<Hp&&this.leafAppend(e)||this.length<Hp&&e.leafPrepend(this)||this.appendInner(e)):this};pn.prototype.prepend=function(e){return e.length?pn.from(e).append(this):this};pn.prototype.appendInner=function(e){return new eV(this,e)};pn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?pn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};pn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pn.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)};pn.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};pn.from=function(e){return e instanceof pn?e:e&&e.length?new V2(e):pn.empty};var V2=(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 f=s;f<l;f++)if(i(this.values[f],c+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var f=s-1;f>=l;f--)if(i(this.values[f],c+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Hp)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hp)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})(pn);pn.empty=new V2([]);var eV=(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})(pn);const tV=500;class ti{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,f,d=[],p=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new yi(m.map));let b=m.step.map(i.slice(s)),S;b&&l.maybeStep(b).doc&&(S=l.mapping.maps[l.mapping.maps.length-1],d.push(new yi(S,void 0,void 0,d.length+p.length))),s--,S&&i.appendMap(S,s)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,f=new ti(this.items.slice(0,r).append(p.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),g=new yi(e.mapping.maps[p],m,n),b;(b=f&&f.merge(g))&&(g=b,p?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(f=g)}let d=l-r.depth;return d>rV&&(c=nV(c,d),l-=d),new ti(c.append(s),l)}remapping(e,n){let r=new Iu;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 ti(this.items.append(e.map(n=>new yi(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 f=n;this.items.forEach(g=>{let b=s.getMirror(--f);if(b==null)return;l=Math.min(l,b);let S=s.maps[b];if(g.step){let v=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(s.slice(f+1,b));C&&c++,r.push(new yi(S,v,C))}else r.push(new yi(S))},i);let d=[];for(let g=n;g<l;g++)d.push(new yi(s.maps[g]));let p=this.items.slice(0,i).append(d).append(r),m=new ti(p,c);return m.emptyItemCount()>tV&&(m=m.compress(this.items.length-r.length)),m}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 f=l.step.map(n.slice(r)),d=f&&f.getMap();if(r--,d&&n.appendMap(d,r),f){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let m=new yi(d.invert(),f,p),g,b=i.length-1;(g=i.length&&i[b].merge(m))?i[b]=g:i.push(m)}}else l.map&&r--},this.items.length,0),new ti(pn.from(i.reverse()),s)}}ti.empty=new ti(pn.empty,0);function nV(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class yi{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 yi(n.getMap().invert(),n,this.selection)}}}class Gs{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const rV=20;function iV(t,e,n,r){let i=n.getMeta(el),s;if(i)return i.historyState;n.getMeta(lV)&&(t=new Gs(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(el))return l.getMeta(el).redo?new Gs(t.done.addTransform(n,void 0,r,Ah(e)),t.undone,GT(n.mapping.maps),t.prevTime,t.prevComposition):new Gs(t.done,t.undone.addTransform(n,void 0,r,Ah(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),f=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!sV(n,t.prevRanges)),d=l?N0(t.prevRanges,n.mapping):GT(n.mapping.maps);return new Gs(t.done.addTransform(n,f?e.selection.getBookmark():void 0,r,Ah(e)),ti.empty,d,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Gs(t.done.rebased(n,s),t.undone.rebased(n,s),N0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Gs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),N0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function sV(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 GT(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 N0(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 oV(t,e,n){let r=Ah(e),i=el.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),f=new Gs(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(el,{redo:n,historyState:f})}let z0=!1,ZT=null;function Ah(t){let e=t.plugins;if(ZT!=e){z0=!1,ZT=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){z0=!0;break}}return z0}const el=new Rt("history"),lV=new Rt("closeHistory");function aV(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new xt({key:el,state:{init(){return new Gs(ti.empty,ti.empty,null,0,-1)},apply(e,n,r){return iV(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?$2:r=="historyRedo"?F2:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function P2(t,e){return(n,r)=>{let i=el.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=oV(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const $2=P2(!1,!0),F2=P2(!0,!0),cV=Wt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>$2(t,e),redo:()=>({state:t,dispatch:e})=>F2(t,e)}},addProseMirrorPlugins(){return[aV(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()}}}),uV=gn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Pt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!dI(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):Nj(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:c})=>{var f;if(c){const{$to:d}=l.selection,p=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?l.setSelection(_e.create(l.doc,d.pos+1)):d.nodeAfter.isBlock?l.setSelection(Me.create(l.doc,d.pos)):l.setSelection(_e.create(l.doc,d.pos));else{const m=(f=d.parent.type.contentMatch.defaultType)===null||f===void 0?void 0:f.create();m&&(l.insert(p,m),l.setSelection(_e.create(l.doc,p+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[fI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),fV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,hV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,mV=Ti.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",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ll({find:fV,type:this.type}),ll({find:hV,type:this.type})]},addPasteRules(){return[ho({find:dV,type:this.type}),ho({find:pV,type:this.type})]}}),gV=gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Pt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),yV="listItem",JT="textStyle",XT=/^(\d+)\.\s$/,bV=gn.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",Pt(this.options.HTMLAttributes,n),0]:["ol",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(yV,this.editor.getAttributes(JT)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Fu({find:XT,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=Fu({find:XT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(JT)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),xV=gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),SV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vV=Ti.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",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ll({find:SV,type:this.type})]},addPasteRules(){return[ho({find:wV,type:this.type})]}}),kV=gn.create({name:"text",group:"inline"}),CV=Wt.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(D9.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(T9.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(N9.configure(this.options.bulletList)),this.options.code!==!1&&t.push(j9.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(U9.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(H9.configure(this.options.document)),this.options.dropcursor!==!1&&t.push($9.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(J9.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(X9.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Q9.configure(this.options.heading)),this.options.history!==!1&&t.push(cV.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(uV.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(mV.configure(this.options.italic)),this.options.listItem!==!1&&t.push(gV.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(bV.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(xV.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(vV.configure(this.options.strike)),this.options.text!==!1&&t.push(kV.configure(this.options.text)),t}});function vu(t){const e=t,n={id:e.id,author:e.author,range:e.range,content:e.content,status:e.status,timestamp:e.timestamp,...e.relRange!==void 0?{relRange:e.relRange}:{},...e.textSnapshot!==void 0?{textSnapshot:e.textSnapshot}:{},...e.editedAt!==void 0?{editedAt:e.editedAt}:{}};if(e.type==="suggestion"){let r,i;try{const s=JSON.parse(e.content);r=s.newText,i=s.reason??""}catch{console.warn(`[sanitizeAnnotation] Malformed JSON in legacy suggestion ${e.id}, treating as plain comment`),i=e.content}return{...n,type:"comment",content:i,suggestedText:r}}return e.type==="question"?{...n,type:"comment",directedAt:"claude"}:e.type==="highlight"?{...n,type:"highlight",color:e.color}:e.type==="flag"?{...n,type:"flag"}:e.type==="comment"?{...n,type:"comment",...e.suggestedText!==void 0?{suggestedText:e.suggestedText}:{},...e.directedAt!==void 0?{directedAt:e.directedAt}:{}}:(console.warn(`[sanitizeAnnotation] Unknown type "${e.type}" for ${e.id}, coercing to "comment"`),{...n,type:"comment"})}function q2(t){return t?t+1:0}function pl(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,f=l.type.name==="heading"?q2(l.attrs.level||1):0,d=l.textContent.length,p=f+d;if(n+p>e){const m=e-n,g=Math.max(0,m-f);return Fr(c+Math.min(g,d))}if(n+=p,r+=l.nodeSize,s<i-1&&(n+=1,n>e))return Fr(c+d)}return Fr(t.content.size)}function Fa(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,f=l.type.name==="heading"?q2(l.attrs.level||1):0,d=l.textContent.length,p=c+d;if(e<=p){if(e<=c)return ph(n+f);const m=e-c;return ph(n+f+Math.min(m,d))}n+=f+d,r+=l.nodeSize,s<i-1&&(n+=1)}return ph(n)}function QT(t,e,n){let r=0;const i=Math.min(t.childCount,e.length);for(let s=0;s<i;s++){const l=e.get(s),c=t.child(s),f=r+1;if(l instanceof On){let d=0;for(let p=0;p<l.length;p++){const m=l.get(p);if(m instanceof $n){if(m===n.type)return Fr(f+Math.min(d+n.index,c.textContent.length));d+=m.length}}}r+=c.nodeSize}return null}function Y2(t,e,n){let r,i;try{const f=Qo(n.fromRel),d=Qo(n.toRel);r=Bb(f,t),i=Bb(d,t)}catch(f){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",f),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),l=QT(e,s,r),c=QT(e,s,i);return l===null||c===null?null:{from:l,to:c}}function Vp(t,e,n){if(t.relRange&&n){const r=Y2(n,e,t.relRange);if(r&&r.from<=r.to)return{...r,method:"rel"};r&&console.warn(`[positions] annotationToPmRange: inverted rel range for ${t.id}, falling back to flat`)}return t.range?{from:pl(e,t.range.from),to:pl(e,t.range.to),method:"flat"}:null}function K2(t,e){return{from:Fa(t,e.from),to:Fa(t,e.to)}}const oh=new Rt("tandemAnnotations");function eA(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const l=vu(s);if(l.status!=="pending"||!l.range&&!l.relRange)return;const c=Vp(l,t,n);if(!c)return;l.relRange&&c.method==="flat"&&console.warn("[annotation] relRange-equipped annotation %s fell back to flat offsets",l.id);const{from:f,to:d}=c;if(f>=d||f<0||d>i)return;let p={};switch(l.type){case"highlight":{const m=l.color||"yellow",g=_u[m]||_u.yellow;p={class:`tandem-highlight tandem-highlight--${m}`,style:`background: ${g}; border-radius: 2px; padding: 1px 0;`,"data-annotation-id":l.id,"aria-label":`Highlight annotation (${m})`};break}case"comment":l.suggestedText!==void 0?p={class:"tandem-suggestion",style:"background: rgba(139, 92, 246, 0.15); text-decoration: underline wavy #8b5cf6; text-underline-offset: 3px;","data-annotation-id":l.id,"aria-label":"Replacement annotation"}:l.directedAt==="claude"?p={class:"tandem-question",style:"background: rgba(99, 102, 241, 0.12); border-bottom: 2px solid #6366f1; padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Question annotation"}:p={class:"tandem-comment",style:"border-bottom: 2px dashed #3b82f6; padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Comment annotation"};break;case"flag":p={class:"tandem-flag",style:"background: rgba(239, 68, 68, 0.12); border-bottom: 2px solid #ef4444; padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Flag annotation"};break;default:{console.warn("[annotation] Unhandled annotation type in buildDecorations, skipping");return}}try{r.push(Vt.inline(f,d,p))}catch(m){if(!(m instanceof RangeError))throw m;console.debug("[annotation] RangeError for %s (from=%d, to=%d), skipping",l.id,f,d)}}),ot.create(t,r)}const EV=Wt.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(ga);return[new xt({key:oh,state:{init(n,r){return eA(r.doc,e,t)},apply(n,r,i,s){return n.getMeta(oh)?eA(s.doc,e,t):n.docChanged?r.map(n.mapping,n.doc):r}},props:{decorations(n){return oh.getState(n)}},view(n){const r=()=>{const i=n.state.tr.setMeta(oh,!0);n.dispatch(i)};return e.observe(r),{destroy(){e.unobserve(r)}}}})]}});function V1(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function TV(){return V1("ann")}function AV(){return V1("msg")}function MV(t){return V1(t)}const da=new Rt("tandemAuthorship");function OV(t,e,n){if(t.relRange){const r=Y2(n,e,t.relRange);if(r&&r.from<r.to)return r}if(t.range){console.warn("[authorship] Falling back to flat offsets for range",t.id);const r=pl(e,t.range.from),i=pl(e,t.range.to);if(r<i)return{from:r,to:i}}return null}function L0(t,e,n,r){if(!r)return ot.empty;const i=[],s=t.content.size;return e.forEach(l=>{const c=l;if(!c.author||!c.range)return;const f=OV(c,t,n);if(!f)return;const{from:d,to:p}=f;if(d>=p||d<0||p>s)return;const m={class:`tandem-authorship tandem-authorship--${c.author}`};try{i.push(Vt.inline(d,p,m))}catch(g){if(!(g instanceof RangeError))throw g;console.warn("[authorship] Decoration RangeError for entry",c.id,g)}}),ot.create(t,i)}const _V=Wt.create({name:"tandemAuthorship",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(mC);let n=!1;try{n=localStorage.getItem(sM)==="true"}catch(r){console.warn("[authorship] localStorage unavailable",r)}return[new xt({key:da,state:{init(r,i){return{visible:n,decorations:L0(i.doc,e,t,n)}},apply(r,i,s,l){const c=r.getMeta(da);if((c==null?void 0:c.type)==="toggle"){const f=c.visible;return{visible:f,decorations:L0(l.doc,e,t,f)}}return(c==null?void 0:c.type)==="rebuild"?{visible:i.visible,decorations:L0(l.doc,e,t,i.visible)}:r.docChanged&&i.visible?{visible:i.visible,decorations:i.decorations.map(r.mapping,r.doc)}:i}},props:{decorations(r){var i;return((i=da.getState(r))==null?void 0:i.decorations)??ot.empty}},view(r){const i=()=>{const l=r.state.tr.setMeta(da,{type:"rebuild"});r.dispatch(l)};e.observe(i);const s=setTimeout(()=>{e.size>0&&i()},500);return{destroy(){clearTimeout(s),e.unobserve(i)}}}})]},onTransaction({transaction:t}){const e=this.options.ydoc;if(!e||t.getMeta("y-sync$")||t.getMeta(da)||!t.docChanged)return;const n=e.getMap(mC),r=t.doc;t.steps.forEach(i=>{i.getMap().forEach((l,c,f,d)=>{if(d-f-(c-l)>0)try{const m=Fa(r,Fr(f)),g=Fa(r,Fr(d));if(g<=m)return;const b=MV("user"),S={id:b,author:"user",range:{from:m,to:g},timestamp:Date.now()};n.set(b,S)}catch(m){console.warn("[authorship] Position conversion failed during user attribution",m)}})})}}),lh=new Rt("tandemAwareness");function tA(t,e){if(!e)return ot.empty;const n=[],{focusParagraph:r,focusOffset:i,active:s}=e;if(r!==null&&r>=0){let l=0;t.forEach((c,f)=>{l===r&&n.push(Vt.node(f,f+c.nodeSize,{class:"tandem-claude-focus",style:"background: rgba(99, 102, 241, 0.1); border-left: 3px solid rgba(99, 102, 241, 0.4); padding-left: 8px; transition: background 0.3s ease, border-color 0.3s ease;"})),l++})}if(i!==null&&i>=0)try{const l=pl(t,ph(i)),c=s===!1?" tandem-claude-cursor-idle":"";n.push(Vt.widget(l,()=>{const f=document.createElement("span");f.className=`tandem-claude-cursor${c}`,f.setAttribute("aria-hidden","true");const d=document.createElement("span");return d.className="tandem-claude-cursor-label",d.textContent="Claude",f.appendChild(d),f}))}catch(l){console.warn("[awareness] cursor decoration failed, falling back to gutter-only:",l)}return n.length===0?ot.empty:ot.create(t,n)}const DV=Wt.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(iM),n=t.getMap(rb);return[new xt({key:lh,state:{init(r,i){const s=e.get("claude");return tA(i.doc,s??null)},apply(r,i,s,l){if(r.getMeta(lh)){const c=e.get("claude");return tA(l.doc,c??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return lh.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(lh,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new xt({key:new Rt("tandemUserAwareness"),view(){let r=null,i=null,s=null,l=!1,c=-1;return{update(f,d){const{state:p}=f;if(!p.selection.eq(d.selection)){const m=K2(p.doc,{from:Fr(p.selection.from),to:Fr(p.selection.to)});if(p.selection.from===p.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const g=p.doc.textBetween(p.selection.from,p.selection.to,`
177
+ `),b=g.length>200?g.slice(0,197)+"...":g;s&&clearTimeout(s),s=setTimeout(()=>{s=null,n.set("selection",{...m,selectedText:b,timestamp:Date.now()})},150)}}p.doc!==d.doc&&(c=p.selection.from,l=!0,i||(i=setTimeout(()=>{i=null,l&&n.set("activity",{isTyping:!0,cursor:c,lastEdit:Date.now()})},200)),r&&clearTimeout(r),r=setTimeout(()=>{l=!1,n.set("activity",{isTyping:!1,cursor:f.state.selection.from,lastEdit:Date.now()})},xz))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function nA({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s,onAnnotationClick:l}){const c=w9({extensions:[CV.configure({history:!1}),kU.configure({multicolor:!0}),WU.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),GU.configure({placeholder:"Open a document with Claude to get started..."}),XH.configure({resizable:!0}),t9,QH,e9,xU.configure({document:t}),SU.configure({provider:e,user:{name:(()=>{var p;try{return((p=localStorage.getItem(ib))==null?void 0:p.trim())||au}catch{return au}})(),color:"#f59e0b"}}),EV.configure({ydoc:t}),_V.configure({ydoc:t}),DV.configure({ydoc:t})],editorProps:{attributes:{class:"tandem-editor",style:"outline: none; min-height: 500px; font-size: 16px; line-height: 1.6;"}}},[t,e]);O.useEffect(()=>{c&&c.setEditable(!n)},[c,n]),O.useEffect(()=>(s==null||s(c),()=>s==null?void 0:s(null)),[c,s]),O.useEffect(()=>{if(!c)return;const p=c.view.dom;p.querySelectorAll(".tandem-annotation-active").forEach(m=>{m.classList.remove("tandem-annotation-active")}),i&&r&&p.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(m=>{m.classList.add("tandem-annotation-active")})},[c,i,r]);const f=O.useCallback(p=>{const m=p.target.closest("[data-annotation-id]");if(!m)return;const g=m.getAttribute("data-annotation-id");g&&l&&l(g)},[l]),d=r?"tandem-review-dimmed":"";return k.jsxs("div",{className:d,onClick:f,children:[k.jsx(f9,{editor:c}),k.jsx("style",{children:`
178
+ .tandem-editor h1 { font-size: 2em; font-weight: 700; margin: 0.67em 0; }
179
+ .tandem-editor h2 { font-size: 1.5em; font-weight: 600; margin: 0.75em 0; }
180
+ .tandem-editor h3 { font-size: 1.17em; font-weight: 600; margin: 0.83em 0; }
181
+ .tandem-editor p { margin: 0.5em 0; }
182
+ .tandem-editor ul, .tandem-editor ol { padding-left: 1.5em; }
183
+ .tandem-editor table { border-collapse: collapse; width: 100%; margin: 1em 0; }
184
+ .tandem-editor td, .tandem-editor th { border: 1px solid #ddd; padding: 8px; }
185
+ .tandem-editor th { background: #f5f5f5; font-weight: 600; }
186
+ .tandem-editor blockquote {
187
+ border-left: 3px solid #e5e7eb;
188
+ margin: 0.5em 0;
189
+ padding-left: 1em;
190
+ color: #6b7280;
191
+ }
192
+ .collaboration-cursor__caret {
193
+ position: relative;
194
+ border-left: 2px solid;
195
+ border-right: none;
196
+ margin-left: -1px;
197
+ }
198
+ .collaboration-cursor__label {
199
+ position: absolute;
200
+ top: -1.4em;
201
+ left: -1px;
202
+ font-size: 12px;
203
+ white-space: nowrap;
204
+ padding: 0 4px;
205
+ border-radius: 3px 3px 3px 0;
206
+ color: white;
207
+ }
208
+ .ProseMirror-focused { outline: none; }
209
+ .ProseMirror p.is-empty::before {
210
+ content: attr(data-placeholder);
211
+ color: #adb5bd;
212
+ pointer-events: none;
213
+ float: left;
214
+ height: 0;
215
+ }
216
+
217
+ /* Annotation decorations */
218
+ .tandem-highlight { cursor: pointer; }
219
+ .tandem-highlight:hover { filter: brightness(0.95); }
220
+ .tandem-comment { cursor: pointer; }
221
+ .tandem-comment:hover { border-bottom-style: solid; }
222
+ .tandem-suggestion { cursor: pointer; }
223
+
224
+ /* Review mode dimming — grays out text, keeps annotated spans readable */
225
+ .tandem-review-dimmed .ProseMirror {
226
+ color: #9ca3af;
227
+ transition: color 0.2s;
228
+ }
229
+ .tandem-review-dimmed .tandem-highlight,
230
+ .tandem-review-dimmed .tandem-comment,
231
+ .tandem-review-dimmed .tandem-suggestion {
232
+ color: #1f2937;
233
+ }
234
+ .tandem-review-dimmed .tandem-annotation-active {
235
+ outline: 2px solid #6366f1;
236
+ outline-offset: 1px;
237
+ border-radius: 2px;
238
+ }
239
+
240
+ /* Authorship decorations — user=blue, claude=orange */
241
+ .tandem-authorship { transition: color 0.2s; }
242
+ .tandem-authorship--user { color: rgb(59, 130, 246); }
243
+ .tandem-authorship--claude { color: rgb(234, 138, 30); }
244
+
245
+ /* Claude focus paragraph */
246
+ .tandem-claude-focus {
247
+ position: relative;
248
+ }
249
+ .tandem-claude-focus::before {
250
+ content: '';
251
+ position: absolute;
252
+ left: -24px;
253
+ top: 0;
254
+ bottom: 0;
255
+ width: 3px;
256
+ background: rgba(99, 102, 241, 0.6);
257
+ border-radius: 2px;
258
+ animation: tandem-gutter-pulse 2s ease-in-out infinite;
259
+ }
260
+ @keyframes tandem-gutter-pulse {
261
+ 0%, 100% { opacity: 0.4; }
262
+ 50% { opacity: 1; }
263
+ }
264
+
265
+ /* Claude character-level cursor */
266
+ .tandem-claude-cursor {
267
+ position: relative;
268
+ display: inline;
269
+ border-left: 2px solid #8b5cf6;
270
+ margin-left: -1px;
271
+ z-index: 10;
272
+ animation: tandem-claude-blink 1.2s step-end infinite;
273
+ }
274
+ .tandem-claude-cursor-idle {
275
+ opacity: 0.3;
276
+ animation: none;
277
+ }
278
+ .tandem-claude-cursor-label {
279
+ position: absolute;
280
+ top: -1.4em;
281
+ left: -1px;
282
+ font-size: 11px;
283
+ font-weight: 500;
284
+ white-space: nowrap;
285
+ padding: 0 4px;
286
+ border-radius: 3px 3px 3px 0;
287
+ background: #8b5cf6;
288
+ color: white;
289
+ pointer-events: none;
290
+ z-index: 11;
291
+ }
292
+ @keyframes tandem-claude-blink {
293
+ 0%, 100% { opacity: 1; }
294
+ 50% { opacity: 0; }
295
+ }
296
+ `})]})}function an({label:t,ariaLabel:e,shortcut:n,disabled:r,disabledTitle:i,active:s,onMouseDown:l,onClick:c,style:f}){let d="1px solid #e5e7eb",p="#fff",m="#374151";r?(p="#f9fafb",m="#9ca3af"):s&&(d="1px solid #818cf8",p="#eef2ff",m="#4338ca");const g=e??(typeof t=="string"?t:void 0),b=g??"";return k.jsx("button",{type:"button",disabled:r,title:r&&i?i:n?`${b} (${n})`:b,"aria-label":g,onMouseDown:l,onClick:c,style:{padding:"4px 10px",fontSize:"13px",borderRadius:"4px",cursor:r?"not-allowed":"pointer",...f,border:d,background:p,color:m},children:t})}const RV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),k.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),k.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),NV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),k.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),k.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),zV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M6.5 8.5a3.5 3.5 0 0 0 5 0l2-2a3.5 3.5 0 0 0-5-5l-1 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M9.5 7.5a3.5 3.5 0 0 0-5 0l-2 2a3.5 3.5 0 0 0 5 5l1-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),LV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 4L1 8l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M11 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M9 2l-2 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),k.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),k.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),IV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),BV=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),W2=[1,2,3],UV={1:700,2:600,3:500};function HV(t){for(const e of W2)if(t.isActive("heading",{level:e}))return e;return null}function Ir(t){return e=>{e.preventDefault(),t()}}function VV({editor:t,disabled:e}){var S,v;const[,n]=O.useState(0),[r,i]=O.useState(!1),s=O.useRef(null);if(O.useEffect(()=>{if(!t)return;const C=()=>{t.isDestroyed||n(T=>T+1)};return t.on("transaction",C),()=>{t.off("transaction",C)}},[t]),O.useEffect(()=>{if(!r)return;function C(T){s.current&&!s.current.contains(T.target)&&i(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[r]),!t)return null;const c=!t.isEditable||!!e,f=vi.getState(t.state),d=!c&&(((S=f==null?void 0:f.undoManager)==null?void 0:S.undoStack.length)??0)>0,p=!c&&(((v=f==null?void 0:f.undoManager)==null?void 0:v.redoStack.length)??0)>0,m=HV(t);function g(C){return T=>{T.preventDefault(),!(!t||t.isDestroyed)&&(t.chain().focus().toggleHeading({level:C}).run(),i(!1))}}const b=m?`H${m}`:"H";return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[k.jsx(an,{label:IV,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!d,onMouseDown:Ir(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(an,{label:BV,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!p,onMouseDown:Ir(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),k.jsx(an,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Ir(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),k.jsx(an,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Ir(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),k.jsx(an,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Ir(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),k.jsx(an,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Ir(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),k.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:C=>{C.key==="Escape"&&i(!1)},children:[k.jsx(an,{label:b,disabled:c,active:m!==null,onMouseDown:C=>{C.preventDefault(),i(T=>!T)},style:{minWidth:"30px"}}),r&&k.jsx("div",{role:"menu","aria-label":"Heading level",style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"4px",display:"flex",flexDirection:"column",gap:"2px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:W2.map(C=>k.jsxs("button",{type:"button",role:"menuitem",onMouseDown:g(C),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===C?"#eef2ff":"transparent",color:m===C?"#4338ca":"#374151",cursor:"pointer",textAlign:"left",fontWeight:UV[C],whiteSpace:"nowrap"},children:["Heading ",C]},C))})]}),k.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),k.jsx(an,{label:RV,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Ir(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(an,{label:NV,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Ir(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(an,{label:jV,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Ir(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),k.jsx(an,{label:zV,ariaLabel:"Link",shortcut:"Ctrl+K",disabled:c||!t.isActive("link")&&t.state.selection.from===t.state.selection.to,active:t.isActive("link"),onMouseDown:Ir(()=>{if(t.isActive("link"))t.chain().focus().unsetLink().run();else{const C=window.prompt("Enter URL:");C&&t.chain().focus().setLink({href:C}).run()}}),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(an,{label:"—",ariaLabel:"Horizontal rule",disabled:c,onMouseDown:Ir(()=>t.chain().focus().setHorizontalRule().run()),style:{minWidth:"30px"}}),k.jsx(an,{label:LV,ariaLabel:"Code block",disabled:c,active:t.isActive("codeBlock"),onMouseDown:Ir(()=>t.chain().focus().toggleCodeBlock().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}function PV({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:l,submitLabel:c,borderColor:f,canSubmit:d,secondaryInput:p}){return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[k.jsx("input",{ref:t,type:"text",value:e,onChange:m=>n(m.target.value),onKeyDown:r,placeholder:l,style:{padding:"3px 8px",fontSize:"13px",border:`1px solid ${f}`,borderRadius:"4px",outline:"none",minWidth:"120px",flex:"1 1 200px"}}),p,k.jsx(an,{label:c,disabled:!d,onClick:i}),k.jsx(an,{label:"Cancel",disabled:!1,onClick:s})]})}const $V=[{value:"yellow",label:"Yellow"},{value:"red",label:"Red"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"purple",label:"Purple"}];function FV({editor:t,ydoc:e,onSettingsClick:n,tandemMode:r,onModeChange:i,heldCount:s}){const[l,c]=O.useState(!1),[f,d]=O.useState("yellow"),[p,m]=O.useState(!1),[g,b]=O.useState("idle"),[S,v]=O.useState(""),[C,T]=O.useState(!1),[H,j]=O.useState(""),[ne,$]=O.useState(!1),N=O.useRef(null),D=O.useRef(null),K=O.useRef(null);O.useEffect(()=>{if(!t)return;const E=t;function X(){const{from:he,to:ge}=E.state.selection,Re=he!==ge;c(De=>De===Re?De:Re)}return t.on("selectionUpdate",X),()=>{t.off("selectionUpdate",X)}},[t]),O.useEffect(()=>{g==="comment"&&D.current&&D.current.focus()},[g]),O.useEffect(()=>{if(!p)return;function E(X){K.current&&!K.current.contains(X.target)&&m(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);function ae(E,X,he){if(!t||!e)return;const ge=N.current??t.state.selection,{from:Re,to:De}=ge;if(Re===De)return;const Ue=Fa(t.state.doc,Fr(Re)),kt=Fa(t.state.doc,Fr(De)),Ee=TV(),Fe={id:Ee,author:"user",type:E,range:{from:Ue,to:kt},content:X,status:"pending",timestamp:Date.now(),...he!=null&&he.color?{color:he.color}:{},...(he==null?void 0:he.suggestedText)!==void 0?{suggestedText:he.suggestedText}:{},...(he==null?void 0:he.directedAt)!==void 0?{directedAt:he.directedAt}:{}};e.getMap(ga).set(Ee,Fe),N.current=null}function xe(){if(!t)return;const{from:E,to:X}=t.state.selection;N.current={from:E,to:X}}function fe(){N.current=null,t==null||t.chain().focus().run()}const le=g!=="idle";function Q(E){E.preventDefault(),ae("highlight","",{color:f})}function ie(E){E.preventDefault(),m(X=>!X)}function G(E){d(E),m(!1)}const I=O.useCallback(E=>X=>{X.preventDefault(),xe(),b(E),v(""),j(""),T(!1),$(!1)},[t]),Z=O.useMemo(()=>I("comment"),[I]);function me(){b("idle"),v(""),j(""),T(!1),$(!1),fe()}function Ae(){if(!S.trim()&&!H.trim()){me();return}const E={};C&&H.trim()&&(E.suggestedText=H.trim()),ne&&(E.directedAt="claude"),ae("comment",S.trim(),E),b("idle"),v(""),j(""),T(!1),$(!1),t==null||t.chain().focus().run()}function M(E){E.key==="Enter"?(E.preventDefault(),Ae()):E.key==="Escape"&&me()}function _(E){E.preventDefault(),ae("flag","")}const B=t&&e&&l;return k.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",minHeight:"42px",padding:"8px 16px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",userSelect:"none"},children:[k.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"#6366f1",letterSpacing:"-0.02em"},children:"Tandem"}),k.jsx("div",{style:{width:"1px",height:"20px",background:"#e5e7eb",margin:"0 8px"}}),k.jsx(VV,{editor:t,disabled:le}),k.jsx("div",{style:{width:"1px",height:"20px",background:"#e5e7eb",margin:"0 8px"}}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[k.jsx(an,{label:"Highlight",disabled:!B||le,disabledTitle:"Select text first",onMouseDown:Q,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),k.jsx("button",{disabled:!B||le,onMouseDown:ie,title:"Choose highlight color",style:{padding:"4px 6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"0 4px 4px 0",background:!B||le?"#f9fafb":"#fff",cursor:!B||le?"not-allowed":"pointer",display:"flex",alignItems:"center"},children:k.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:_u[f],border:"1px solid rgba(0,0,0,0.15)"}})}),p&&k.jsxs("div",{ref:K,style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"6px",display:"flex",gap:"4px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[$V.map(({value:E,label:X})=>k.jsx("button",{title:X,onClick:()=>G(E),style:{width:"24px",height:"24px",borderRadius:"4px",border:E===f?"2px solid #374151":"1px solid rgba(0,0,0,0.15)",background:_u[E],cursor:"pointer",padding:0}},E)),k.jsx("button",{"data-testid":"color-picker-close",title:"Close",onClick:()=>m(!1),style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid rgba(0,0,0,0.15)",background:"#f3f4f6",cursor:"pointer",padding:0,fontSize:"13px",color:"#6b7280",display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),k.jsx(an,{label:"Comment",disabled:!B||le,disabledTitle:"Select text first",onMouseDown:Z}),g==="comment"&&k.jsx(PV,{inputRef:D,value:S,onChange:v,onKeyDown:M,onSubmit:Ae,onCancel:me,placeholder:ne?"Ask about this text...":"Add a comment...",submitLabel:C?"Suggest":ne?"Ask":"Add",borderColor:C?"#8b5cf6":ne?"#6366f1":"#3b82f6",canSubmit:!!S.trim()||C&&!!H.trim(),secondaryInput:k.jsxs(k.Fragment,{children:[C&&k.jsx("input",{type:"text",value:H,onChange:E=>j(E.target.value),onKeyDown:M,placeholder:"Replacement text...",style:{padding:"3px 8px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",outline:"none",minWidth:"100px",flex:"1 1 140px"}}),k.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[k.jsxs("label",{style:{fontSize:"11px",color:C?"#8b5cf6":"#9ca3af",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[k.jsx("input",{type:"checkbox",checked:C,onChange:E=>{T(E.target.checked),E.target.checked||j("")},style:{margin:0}}),"Replace"]}),k.jsxs("label",{style:{fontSize:"11px",color:ne?"#6366f1":"#9ca3af",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[k.jsx("input",{type:"checkbox",checked:ne,onChange:E=>$(E.target.checked),style:{margin:0}}),"@Claude"]})]})]})}),k.jsx(an,{label:"Flag",disabled:!B||le,onMouseDown:_}),k.jsx("div",{style:{flex:1}}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(s??0)>0&&k.jsxs("span",{"data-testid":"held-badge",style:{padding:"1px 6px",fontSize:"10px",fontWeight:600,color:"#92400e",background:"#fef3c7",borderRadius:"9999px"},children:[s," held"]}),r&&i&&k.jsxs("div",{"data-testid":"mode-toggle",role:"group","aria-label":"Claude collaboration mode",style:{display:"flex",border:"1px solid #d1d5db",borderRadius:"4px",overflow:"hidden"},children:[k.jsxs("button",{"data-testid":"mode-solo-btn",title:"Write undisturbed — Claude only responds when you message","aria-pressed":r==="solo",onClick:()=>i("solo"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:r==="solo"?"#6366f1":"transparent",color:r==="solo"?"#fff":"#6b7280",fontWeight:r==="solo"?600:400,borderRight:"1px solid #d1d5db",display:"flex",alignItems:"center",gap:"5px"},children:[r==="solo"&&k.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#9ca3af",display:"inline-block"}}),"Solo"]}),k.jsxs("button",{"data-testid":"mode-tandem-btn",title:"Full collaboration — Claude reacts to selections and document changes","aria-pressed":r==="tandem",onClick:()=>i("tandem"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:r==="tandem"?"#6366f1":"transparent",color:r==="tandem"?"#fff":"#6b7280",fontWeight:r==="tandem"?600:400,display:"flex",alignItems:"center",gap:"5px"},children:[r==="tandem"&&k.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#22c55e",display:"inline-block"}}),"Tandem"]})]}),n&&k.jsx("button",{"data-testid":"settings-btn",onClick:E=>n(E.currentTarget.getBoundingClientRect()),title:"Layout settings","aria-label":"Layout settings",style:{background:"none",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",color:"#6b7280",fontSize:"13px",padding:"4px 12px"},children:"Settings"})]})]})}function qV(){const[t,e]=O.useState(!1),n=O.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=O.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=O.useCallback(async s=>{if(e(!1),!s.dataTransfer.files.length)return;s.preventDefault();const l=s.dataTransfer.files[0],c=await uM(l);try{const f=await fetch(`${zu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:l.name,content:c})});if(!f.ok){const d=await f.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",f.status,d.message??d.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function YV(t,e){return t.status!=="pending"||e==="tandem"?!0:t.author!=="claude"}function KV(t,e){return O.useMemo(()=>{const n=[];let r=0;for(const i of t)YV(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function WV(){const[t,e]=O.useState([]),n=O.useRef(new Map),r=O.useCallback((l,c)=>{const f=n.current.get(l);f&&clearTimeout(f);const d=gC[c]??gC.info,p=setTimeout(()=>{e(m=>m.filter(g=>g.id!==l)),n.current.delete(l)},d);n.current.set(l,p)},[]),i=O.useCallback(l=>{const c=n.current.get(l);c&&(clearTimeout(c),n.current.delete(l))},[]),s=O.useCallback(l=>{e(c=>c.filter(f=>f.id!==l)),i(l)},[i]);return O.useEffect(()=>{const l=`http://localhost:${Ya}/api/notify-stream`,c=new EventSource(l);return c.onmessage=f=>{let d;try{d=JSON.parse(f.data)}catch{console.warn("[useNotifications] Malformed SSE data:",f.data);return}e(p=>{if(d.dedupKey){const b=p.findIndex(S=>S.dedupKey===d.dedupKey);if(b!==-1){const S=p[b];i(S.id);const v={...d,count:S.count+1},C=[...p];return C[b]=v,r(v.id,v.severity),C}}const m={...d,count:1},g=[...p,m];for(;g.length>Oz;){const b=g.shift();i(b.id)}return r(m.id,m.severity),g})},c.onerror=()=>{c.readyState===EventSource.CLOSED&&console.warn("[useNotifications] EventSource permanently closed. Notifications will not be delivered. Is the server running?")},()=>{c.close();for(const f of n.current.values())clearTimeout(f);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function GV(t){const[e,n]=O.useState(!1),[r,i]=O.useState(null),s=O.useRef(0),{pendingCount:l,acceptedCount:c,dismissedCount:f}=O.useMemo(()=>{let p=0,m=0,g=0;for(const b of t)b.status==="pending"?p++:b.status==="accepted"?m++:b.status==="dismissed"&&g++;return{pendingCount:p,acceptedCount:m,dismissedCount:g}},[t]);O.useEffect(()=>{const p=c+f;s.current>0&&l===0&&p>0&&(i({accepted:c,dismissed:f,total:p}),n(!0)),s.current=l},[l,c,f]);const d=O.useCallback(()=>{n(!1)},[]);return{pendingCount:l,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:d}}function ZV(t){const[e,n]=O.useState(!1),r=O.useRef(!1),i=O.useCallback(async()=>{if(!(!t||r.current)){r.current=!0,n(!0);try{const s=await fetch(`http://localhost:${Ya}/api/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:t})});if(!s.ok){const l=await s.json().catch(()=>({}));console.warn("[Tandem] Save failed:",l.message??s.statusText)}}catch(s){console.warn("[Tandem] Save request failed:",s)}finally{r.current=!1,n(!1)}}},[t]);return O.useEffect(()=>{const s=l=>{l.key==="s"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),i())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i]),{saving:e,triggerSave:i}}function JV(t,e,n){if(t.length<2)return null;const s=(t.findIndex(l=>l.id===e)+(n?-1:1)+t.length)%t.length;return t[s].id}function XV(t,e,n){const r=O.useRef(t);r.current=t;const i=O.useRef(e);i.current=e,O.useEffect(()=>{const s=l=>{if(!l.ctrlKey&&!l.metaKey||l.key!=="Tab")return;const c=JV(r.current,i.current,l.shiftKey);c&&(l.preventDefault(),n(c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}function rA(t,e){const n=new Set(e),r=t.filter(l=>n.has(l)),i=new Set(r),s=e.filter(l=>!i.has(l));return[...r,...s]}function QV(t,e,n,r,i="left"){const s=t.filter(m=>r.has(m)),l=s.indexOf(e),c=s.indexOf(n);if(l===-1||c===-1)return s;const f=[...s];f.splice(l,1);const d=f.indexOf(n),p=i==="right"?d+1:d;return f.splice(p,0,e),f}function eP(t){const[e,n]=O.useState([]),r=O.useMemo(()=>{const l=new Map(t.map(d=>[d.id,d])),c=t.map(d=>d.id);return rA(e,c).map(d=>l.get(d)).filter(Boolean)},[t,e]),i=O.useMemo(()=>t.map(l=>l.id),[t]);O.useEffect(()=>{n(l=>{const c=rA(l,i);return l.length===c.length&&l.every((f,d)=>f===c[d])?l:c})},[i]);const s=O.useCallback(function(c,f,d="left"){if(c===f)return;const p=new Set(i);n(m=>QV(m,c,f,p,d))},[i]);return{orderedTabs:r,reorder:s}}const j0={layout:"three-panel",primaryTab:"chat",panelOrder:"chat-editor-annotations",editorWidthPercent:50,selectionDwellMs:rM,showAuthorship:!1};function tP(){try{const t=localStorage.getItem(tM);if(t){const e=JSON.parse(t);return{layout:e.layout==="three-panel"||e.layout==="tabbed"?e.layout:j0.layout,primaryTab:e.primaryTab==="annotations"?"annotations":"chat",panelOrder:e.panelOrder==="annotations-editor-chat"?"annotations-editor-chat":"chat-editor-annotations",editorWidthPercent:Math.max(50,Math.min(100,Number(e.editorWidthPercent)||j0.editorWidthPercent)),selectionDwellMs:Math.max(Dh,Math.min(Rh,Number(e.selectionDwellMs)||rM)),showAuthorship:e.showAuthorship===!0}}}catch{}return j0}function nP(){const[t,e]=O.useState(tP),n=O.useCallback(r=>{e(i=>{const s={...i,...r},l={...s,editorWidthPercent:Math.max(50,Math.min(100,s.editorWidthPercent)),selectionDwellMs:Math.max(Dh,Math.min(Rh,s.selectionDwellMs))};try{localStorage.setItem(tM,JSON.stringify(l)),localStorage.setItem(sM,String(l.showAuthorship))}catch{}return l})},[]);return{settings:t,updateSettings:n}}function rP(){try{return localStorage.getItem(oM)==="true"}catch{return!1}}function iA(){try{localStorage.setItem(oM,"true")}catch{}}function iP(t,e,n){const[r,i]=O.useState(rP),[s,l]=O.useState(0),c=O.useRef(0),d=!r&&n==="welcome.md";O.useEffect(()=>{if(!d||s!==0)return;const b=t.filter(v=>v.id.startsWith(_z));if(b.length===0)return;b.some(v=>v.status!=="pending")&&(c.current=Date.now(),l(1))},[d,s,t]),O.useEffect(()=>{if(!d||s!==1)return;t.some(S=>S.author==="user")&&(c.current=Date.now(),l(2))},[d,s,t]);const p=e.current;O.useEffect(()=>{if(!d||s!==2||!p)return;const b=()=>{Date.now()-c.current<2e3||p.isFocused&&(c.current=Date.now(),l(3))};return p.on("update",b),()=>{p.off("update",b)}},[d,s,p]),O.useEffect(()=>{if(!d||s!==3)return;const b=setTimeout(()=>{iA(),i(!0)},3e3);return()=>clearTimeout(b)},[d,s]);const m=O.useCallback(()=>{iA(),i(!0)},[]),g=O.useCallback(()=>{c.current=Date.now(),l(b=>Math.min(b+1,3))},[]);return{tutorialActive:d,currentStep:s,dismissTutorial:m,nextStep:g}}const sP="modulepreload",oP=function(t){return"/"+t},sA={},lP=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(d=>{if(d=oP(d),d in sA)return;sA[d]=!0;const p=d.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":sP,p||(g.as="script"),g.crossOrigin="",g.href=d,f&&g.setAttribute("nonce",f),document.head.appendChild(g),p)return new Promise((b,S)=>{g.addEventListener("load",b),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};function aP(){O.useEffect(()=>{let t=!1,e;return lP(async()=>{const{getCurrentWebview:n}=await import("./webview-0tvvWtyc.js");return{getCurrentWebview:n}},[]).then(({getCurrentWebview:n})=>{if(t)return;const r=n();let i=Zc;try{const d=localStorage.getItem(yC);if(d!==null){const p=Number(d);Number.isFinite(p)?i=Math.max(bC,Math.min(xC,p)):console.warn(`[tandem] ignoring invalid stored zoom: ${d}`)}}catch{}i!==Zc&&r.setZoom(i).catch(d=>{console.warn("[tandem] failed to restore zoom level:",d)});function s(d){try{localStorage.setItem(yC,String(d))}catch{}}const l=d=>{!(d.metaKey||d.ctrlKey)||d.key!=="0"||(d.preventDefault(),d.stopPropagation(),i=Zc,r.setZoom(Zc).catch(m=>{console.warn("[tandem] failed to reset zoom:",m)}),s(Zc))},c=.1,f=d=>{if(!(d.metaKey||d.ctrlKey))return;const m=d.key==="+"||d.key==="=",g=d.key==="-"||d.key==="_";if(!m&&!g)return;const b=m?i+c:i-c;i=Math.max(bC,Math.min(xC,Math.round(b*100)/100)),s(i)};window.addEventListener("keydown",l,{capture:!0}),window.addEventListener("keydown",f,{capture:!0}),e=()=>{window.removeEventListener("keydown",l,{capture:!0}),window.removeEventListener("keydown",f,{capture:!0})}}).catch(()=>{}),()=>{t=!0,e==null||e()}},[])}const cP=Math.floor,uP=(t,e)=>t<e?t:e,fP=(t,e)=>t>e?t:e,G2=128,Mh=127,dP=Number.MAX_SAFE_INTEGER,hP=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},af=typeof TextEncoder<"u"?new TextEncoder:null,pP=t=>af.encode(t),mP=af?pP:hP;let ku=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ku&&ku.decode(new Uint8Array).length===1&&(ku=null);const Pp=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Cm=(t,e)=>{for(;e>Mh;)Pp(t,G2|Mh&e),e=cP(e/128);Pp(t,Mh&e)},cx=new Uint8Array(3e4),gP=cx.length/3,yP=(t,e)=>{if(e.length<gP){const n=af.encodeInto(e,cx).written||0;Cm(t,n);for(let r=0;r<n;r++)Pp(t,cx[r])}else wP(t,mP(e))},bP=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Cm(t,r);for(let i=0;i<r;i++)Pp(t,n.codePointAt(i))},xP=af&&af.encodeInto?yP:bP,SP=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=uP(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(fP(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},wP=(t,e)=>{Cm(t,e.byteLength),SP(t,e)},Z2=t=>new Error(t),vP=Z2("Unexpected end of array"),kP=Z2("Integer out of Range"),CP=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},EP=t=>CP(t,P1(t)),oA=t=>t.arr[t.pos++],P1=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Mh)*n,n*=128,i<G2)return e;if(e>dP)throw kP}throw vP},TP=t=>{let e=P1(t);if(e===0)return"";{let n=String.fromCodePoint(oA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(oA(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},AP=t=>ku.decode(EP(t)),lA=ku?AP:TP;var Ta;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(Ta||(Ta={}));const MP=(t,e)=>{Cm(t,Ta.Token),xP(t,e)},OP=(t,e,n,r)=>{switch(P1(t)){case Ta.Token:{e();break}case Ta.PermissionDenied:{n(lA(t));break}case Ta.Authenticated:{r(lA(t));break}}},aA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var ux;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(ux||(ux={}));function _P(t){return t||(t={}),{delay:t.delay===void 0?200:t.delay,initialDelay:t.initialDelay===void 0?0:t.initialDelay,minDelay:t.minDelay===void 0?0:t.minDelay,maxDelay:t.maxDelay===void 0?0:t.maxDelay,factor:t.factor===void 0?0:t.factor,maxAttempts:t.maxAttempts===void 0?3:t.maxAttempts,timeout:t.timeout===void 0?0:t.timeout,jitter:t.jitter===!0,initialJitter:t.initialJitter===!0,handleError:t.handleError===void 0?null:t.handleError,handleTimeout:t.handleTimeout===void 0?null:t.handleTimeout,beforeAttempt:t.beforeAttempt===void 0?null:t.beforeAttempt,calculateDelay:t.calculateDelay===void 0?null:t.calculateDelay}}async function I0(t){return new Promise(e=>setTimeout(e,t))}function DP(t,e){let n=e.delay;if(n===0)return 0;if(e.factor&&(n*=Math.pow(e.factor,t.attemptNum-1),e.maxDelay!==0&&(n=Math.min(n,e.maxDelay))),e.jitter){const r=Math.ceil(e.minDelay),i=Math.floor(n);n=Math.floor(Math.random()*(i-r+1))+r}return Math.round(n)}async function RP(t,e){const n=_P(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const f=n[c];if(!Number.isInteger(f)||f<0)throw new Error(`Value for ${c} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(n.delay<n.minDelay)throw new Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);const r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||DP;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const f=new Error("Attempt aborted");throw f.code="ATTEMPT_ABORTED",f}const c=async f=>{if(n.handleError&&await n.handleError(f,r,n),r.aborted||r.attemptsRemaining===0)throw f;r.attemptNum++;const d=i(r,n);return d&&await I0(d),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((f,d)=>{const p=setTimeout(()=>{if(n.handleTimeout)try{f(n.handleTimeout(r,n))}catch(m){d(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",d(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(p),f(m)}).catch(m=>{clearTimeout(p),c(m).then(f).catch(d)})}):t(r,n).catch(c)}const l=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(l&&await I0(l),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await I0(c)}return s()}const J2=Math.floor,NP=(t,e)=>t<e?t:e,zP=(t,e)=>t>e?t:e,LP=64,$p=128,jP=63,Cu=127,X2=Number.MAX_SAFE_INTEGER,IP=()=>new Set,BP=Array.from,UP=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},cf=typeof TextEncoder<"u"?new TextEncoder:null,HP=t=>cf.encode(t),VP=cf?HP:UP;let Eu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Eu&&Eu.decode(new Uint8Array).length===1&&(Eu=null);class PP{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const $1=()=>new PP,Q2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},F1=t=>{const e=new Uint8Array(Q2(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},Fp=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},zn=(t,e)=>{for(;e>Cu;)Fp(t,$p|Cu&e),e=J2(e/128);Fp(t,Cu&e)},fx=new Uint8Array(3e4),$P=fx.length/3,FP=(t,e)=>{if(e.length<$P){const n=cf.encodeInto(e,fx).written||0;zn(t,n);for(let r=0;r<n;r++)Fp(t,fx[r])}else tc(t,VP(e))},qP=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;zn(t,r);for(let i=0;i<r;i++)Fp(t,n.codePointAt(i))},gs=cf&&cf.encodeInto?FP:qP,YP=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=NP(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(zP(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},tc=(t,e)=>{zn(t,e.byteLength),YP(t,e)},eD=t=>new Error(t),tD=eD("Unexpected end of array"),nD=eD("Integer out of Range");class KP{constructor(e){this.arr=e,this.pos=0}}const rD=t=>new KP(t),WP=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Em=t=>WP(t,tl(t)),cA=t=>t.arr[t.pos++],tl=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Cu)*n,n*=128,i<$p)return e;if(e>X2)throw nD}throw tD},GP=t=>{let e=t.arr[t.pos++],n=e&jP,r=64;const i=(e&LP)>0?-1:1;if((e&$p)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Cu)*r,r*=128,e<$p)return i*n;if(n>X2)throw nD}throw tD},ZP=t=>{let e=tl(t);if(e===0)return"";{let n=String.fromCodePoint(cA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(cA(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},JP=t=>Eu.decode(Em(t)),uf=Eu?JP:ZP,XP=t=>{const e=t.pos,n=uf(t);return t.pos=e,n},qa=Date.now,B0=()=>new Map,QP=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class e7{constructor(){this._observers=B0()}on(e,n){QP(this._observers,e,IP).add(n)}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return BP((this._observers.get(e)||B0()).values()).forEach(r=>r(...n))}destroy(){this._observers=B0()}}const t7=Object.keys,uA=t=>t7(t).length,n7=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r7=(t,e)=>t===e,Tu=(t,e)=>{if(t==null||e==null)return r7(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Tu(t.get(n),e.get(n)))return!1;break}case Object:if(uA(t)!==uA(e))return!1;for(const n in t)if(!n7(t,n)||!Tu(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Tu(t[n],e[n]))return!1;break;default:return!1}return!0},U0=3e4;class i7 extends e7{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=qa();this.getLocalState()!==null&&U0/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&U0<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Oh(this,r,"timeout")},J2(U0/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),i=r===void 0?0:r.clock+1,s=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:qa()});const l=[],c=[],f=[],d=[];e===null?d.push(n):s==null?e!=null&&l.push(n):(c.push(n),Tu(s,e)||f.push(n)),(l.length>0||f.length>0||d.length>0)&&this.emit("change",[{added:l,updated:f,removed:d},"local"]),this.emit("update",[{added:l,updated:c,removed:d},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const Oh=(t,e,n)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(t.states.has(s)){if(t.states.delete(s),s===t.clientID){const l=t.meta.get(s);t.meta.set(s,{clock:l.clock+1,lastUpdated:qa()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},dx=(t,e,n=t.states)=>{const r=e.length,i=$1();zn(i,r);for(let s=0;s<r;s++){const l=e[s],c=n.get(l)||null,f=t.meta.get(l).clock;zn(i,l),zn(i,f),gs(i,JSON.stringify(c))}return F1(i)},s7=(t,e,n)=>{const r=rD(e),i=qa(),s=[],l=[],c=[],f=[],d=tl(r);for(let p=0;p<d;p++){const m=tl(r);let g=tl(r);const b=JSON.parse(uf(r)),S=t.meta.get(m),v=t.states.get(m),C=S===void 0?0:S.clock;(C<g||C===g&&b===null&&t.states.has(m))&&(b===null?m===t.clientID&&t.getLocalState()!=null?g++:t.states.delete(m):t.states.set(m,b),t.meta.set(m,{clock:g,lastUpdated:i}),S===void 0&&b!==null?s.push(m):S!==void 0&&b===null?f.push(m):b!==null&&(Tu(b,v)||c.push(m),l.push(m)))}(s.length>0||c.length>0||f.length>0)&&t.emit("change",[{added:s,updated:c,removed:f},n]),(s.length>0||l.length>0||f.length>0)&&t.emit("update",[{added:s,updated:l,removed:f},n])};class iD{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}class hx{constructor(e){this.data=e,this.encoder=$1(),this.decoder=rD(new Uint8Array(this.data))}peekVarString(){return XP(this.decoder)}readVarUint(){return tl(this.decoder)}readVarString(){return uf(this.decoder)}readVarUint8Array(){return Em(this.decoder)}writeVarUint(e){return zn(this.encoder,e)}writeVarString(e){return gs(this.encoder,e)}writeVarUint8Array(e){return tc(this.encoder,e)}length(){return Q2(this.encoder)}}var En;(function(t){t[t.Sync=0]="Sync",t[t.Awareness=1]="Awareness",t[t.Auth=2]="Auth",t[t.QueryAwareness=3]="QueryAwareness",t[t.Stateless=5]="Stateless",t[t.CLOSE=7]="CLOSE",t[t.SyncStatus=8]="SyncStatus"})(En||(En={}));var Vn;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(Vn||(Vn={}));class yl{constructor(){this.encoder=$1()}get(e){return e.encoder}toUint8Array(){return F1(this.encoder)}}class o7 extends yl{constructor(){super(...arguments),this.type=En.CLOSE,this.description="Ask the server to close the connection"}get(e){return gs(this.encoder,e.documentName),zn(this.encoder,this.type),this.encoder}}class l7 extends iD{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=Vn.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=Vn.Connected,this.emit("status",{status:Vn.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===Vn.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===Vn.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(o7,{documentName:e.configuration.name}),this.configuration.providerMap.delete(e.configuration.name))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===Vn.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:RP(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:l=>{(!this.shouldConnect||i)&&l.abort()}}).catch(l=>{if(l&&l.code!=="ATTEMPT_ABORTED")throw l}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,n}attachWebSocketListeners(e,n){const{identifier:r}=e,i=d=>this.emit("message",d),s=d=>this.emit("close",{event:d}),l=d=>this.emit("open",d),c=d=>{n(d)};this.webSocketHandlers[r]={message:i,close:s,open:l,error:c};const f=this.webSocketHandlers[e.identifier];Object.keys(f).forEach(d=>{e.addEventListener(d,f[d])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,n[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,n),this.webSocket=r,this.status=Vn.Connecting,this.emit("status",{status:Vn.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=qa();const i=new hx(e.data).peekVarString();(n=this.configuration.providerMap.get(i))===null||n===void 0||n.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=Vn.Connected,this.emit("status",{status:Vn.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===Vn.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=qa()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]==="/";)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}send(e){var n;((n=this.webSocket)===null||n===void 0?void 0:n.readyState)===ux.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=Vn.Disconnected,this.emit("status",{status:Vn.Disconnected}),this.emit("disconnect",{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit("destroy"),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const sD=0,q1=1,oD=2,a7=(t,e)=>{zn(t,sD);const n=MB(e);tc(t,n)},c7=(t,e,n)=>{zn(t,q1),tc(t,CB(e,n))},u7=(t,e,n)=>c7(e,n,Em(t)),lD=(t,e,n)=>{try{wB(e,Em(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},f7=(t,e)=>{zn(t,oD),tc(t,e)},d7=lD,h7=(t,e,n,r)=>{const i=tl(t);switch(i){case sD:u7(t,e,n);break;case q1:lD(t,n,r);break;case oD:d7(t,n,r);break;default:throw new Error("Unknown message type")}return i};class p7{constructor(e){this.message=e}apply(e,n){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case En.Sync:this.applySyncMessage(e,n);break;case En.Awareness:this.applyAwarenessMessage(e);break;case En.Auth:this.applyAuthMessage(e);break;case En.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case En.Stateless:e.receiveStateless(uf(r.decoder));break;case En.SyncStatus:this.applySyncStatusMessage(e,GP(r.decoder)===1);break;case En.CLOSE:const l={code:1e3,reason:uf(r.decoder),target:e.configuration.websocketProvider.webSocket,type:"close"};e.onClose(),e.configuration.onClose({event:l}),e.forwardClose({event:l});break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}r.length()>s+1&&e.send(yl,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(En.Sync);const i=h7(r.decoder,r.encoder,e.document,e);n&&i===q1&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;s7(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;OP(n.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;n.writeVarUint(En.Awareness),n.writeVarUint8Array(dx(e.awareness,Array.from(e.awareness.getStates().keys())))}}class m7{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return F1(this.encoder)}send(e){e==null||e.send(this.create())}}class g7 extends yl{constructor(){super(...arguments),this.type=En.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return gs(this.encoder,e.documentName),zn(this.encoder,this.type),MP(this.encoder,e.token),this.encoder}}class fA extends yl{constructor(){super(...arguments),this.type=En.Awareness,this.description="Awareness states update"}get(e){if(typeof e.awareness>"u")throw new Error("The awareness message requires awareness as an argument");if(typeof e.clients>"u")throw new Error("The awareness message requires clients as an argument");gs(this.encoder,e.documentName),zn(this.encoder,this.type);let n;return e.states===void 0?n=dx(e.awareness,e.clients):n=dx(e.awareness,e.clients,e.states),tc(this.encoder,n),this.encoder}}class y7 extends yl{constructor(){super(...arguments),this.type=En.Stateless,this.description="A stateless message"}get(e){var n;return gs(this.encoder,e.documentName),zn(this.encoder,this.type),gs(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class dA extends yl{constructor(){super(...arguments),this.type=En.Sync,this.description="First sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step one message requires document as an argument");return gs(this.encoder,e.documentName),zn(this.encoder,this.type),a7(this.encoder,e.document),this.encoder}}class b7 extends yl{constructor(){super(...arguments),this.type=En.Sync,this.description="A document update"}get(e){return gs(this.encoder,e.documentName),zn(this.encoder,this.type),f7(this.encoder,e.update),this.encoder}}class x7 extends Error{constructor(){super(...arguments),this.code=1001}}class hA extends iD{constructor(e){var n,r,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit("connect"),this.forwardStatus=s=>this.emit("status",s),this.forwardClose=s=>this.emit("close",s),this.forwardDisconnect=s=>this.emit("disconnect",s),this.forwardDestroy=()=>this.emit("destroy"),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Mi,this.configuration.awareness=e.awareness!==void 0?e.awareness:new i7(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("unsyncedChanges",this.configuration.onUnsyncedChanges),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),(n=this.awareness)===null||n===void 0||n.on("update",()=>{this.emit("awarenessUpdate",{states:aA(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:aA(this.awareness.getStates())})}),this.document.on("update",this.boundDocumentUpdateHandler),(i=this.awareness)===null||i===void 0||i.on("update",this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval=="number"&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new l7(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&(this.unsyncedChanges-=1),this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(dA,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&Oh(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(y7,{documentName:this.configuration.name,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(n){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${n}`);return}this.send(g7,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(b7,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(fA,{awareness:this.awareness,clients:s,documentName:this.configuration.name})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit("synced",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn("HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn("HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}async onOpen(e){this.isAuthenticated=!1,this.emit("open",{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(dA,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(fA,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new m7(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new hx(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new hx(e.data)}),new p7(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Oh(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(Oh(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>"u"||!("removeEventListener"in window))&&window.removeEventListener("pagehide",this.boundPageHide)}detach(){this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("status",this.forwardStatus),this.configuration.websocketProvider.off("status",this.configuration.onStatus),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("close",this.boundOnClose),this.configuration.websocketProvider.off("close",this.configuration.onClose),this.configuration.websocketProvider.off("close",this.forwardClose),this.configuration.websocketProvider.off("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.off("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.off("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.off("destroy",this.forwardDestroy),this.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||(this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("status",this.configuration.onStatus),this.configuration.websocketProvider.on("status",this.forwardStatus),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("close",this.boundOnClose),this.configuration.websocketProvider.on("close",this.configuration.onClose),this.configuration.websocketProvider.on("close",this.forwardClose),this.configuration.websocketProvider.on("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.on("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.on("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.on("destroy",this.forwardDestroy),this.configuration.websocketProvider.attach(this),this._isAttached=!0)}permissionDeniedHandler(e){this.emit("authenticationFailed",{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit("authenticated",{scope:e})}setAwarenessField(e,n){if(!this.awareness)throw new x7(`Cannot set awareness field "${e}" to ${JSON.stringify(n)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,n)}}function S7(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function w7(){var M;const[t,e]=O.useState([]),[n,r]=O.useState(null),[i,s]=O.useState(!1),[l,c]=O.useState("connecting"),[f,d]=O.useState(0),[p,m]=O.useState(null),[g,b]=O.useState([]),[S,v]=O.useState(null),[C,T]=O.useState(!1),[H,j]=O.useState(!1),[ne,$]=O.useState(!1),[N,D]=O.useState(!1),K=O.useRef(null),ae=O.useRef(!1),xe=O.useRef(null),fe=O.useRef(null),le=O.useRef([]);le.current=t;const Q=O.useRef(new Set),ie=O.useRef(new Map);for(const _ of t)Q.current.delete(_.id),ie.current.delete(_.id);const G=O.useRef(new Map),I=O.useRef(new Map),Z=O.useRef(void 0),me=O.useCallback(_=>{const{ydoc:B}=_,E=B.getMap(ga),X=()=>{const Fe=[];E.forEach(Ct=>{Fe.push(vu(Ct))}),b(Fe)};E.observe(X),X();const he=B.getMap(iM);let ge=null,Re=!1;const De=()=>{const Fe=he.get("claude"),Ct=(Fe==null?void 0:Fe.status)??null,Nt=(Fe==null?void 0:Fe.active)??!1;Ct!==ge&&(ge=Ct,v(Ct)),Nt!==Re&&(Re=Nt,T(Nt))};he.observe(De),De();const Ue=B.getMap(hh);let kt=!1;const Ee=()=>{const Fe=Ue.get("readOnly")===!0;Fe!==kt&&(kt=Fe,j(Fe))};return Ue.observe(Ee),Ee(),()=>{E.unobserve(X),he.unobserve(De),Ue.unobserve(Ee)}},[]);Z.current=(_,B)=>{var Ue,kt;const E=le.current,X=new Set(E.map(Ee=>Ee.id)),he=new Set(_.map(Ee=>Ee.id));for(const[Ee,Fe]of ie.current)he.has(Ee)||((Ue=I.current.get(Ee))==null||Ue(),I.current.delete(Ee),Fe.provider.destroy(),Fe.ydoc.destroy(),ie.current.delete(Ee),Q.current.delete(Ee));const ge=S7(_,X,Q.current),Re=[];for(const Ee of ge){Q.current.add(Ee.id);const Fe=new Mi,Ct=new hA({url:`ws://localhost:${fC}`,name:Ee.id,document:Fe});ie.current.set(Ee.id,{ydoc:Fe,provider:Ct});const Nt=Fe.getMap(hh),_n=()=>{var Kn;const bn=Nt.get("openDocuments"),$t=Nt.get("activeDocumentId");bn&&((Kn=Z.current)==null||Kn.call(Z,bn,$t??null))};Nt.observe(_n),I.current.set(Ee.id,()=>Nt.unobserve(_n)),Re.push({...Ee,ydoc:Fe,provider:Ct})}const De=E.filter(Ee=>!he.has(Ee.id));for(const Ee of De){const Fe=G.current.get(Ee.id);Fe&&(Fe.cleanup(),G.current.delete(Ee.id)),(kt=I.current.get(Ee.id))==null||kt(),I.current.delete(Ee.id),Q.current.delete(Ee.id),ie.current.delete(Ee.id),Ee.provider.destroy(),Ee.ydoc.destroy()}e(Ee=>[...Ee.filter(Ct=>he.has(Ct.id)),...Re]),B!==null&&r(Ee=>Ee===null||!he.has(Ee)?B:De.length>0&&B===Ee?Ee:B)},O.useEffect(()=>{const _=new Mi,B=new hA({url:`ws://localhost:${fC}`,name:Cz,document:_});return xe.current={ydoc:_,provider:B},B.on("status",({status:E})=>{s(E==="connected"),c(E),E==="connected"?(ae.current=!0,d(0),m(null)):E==="disconnected"?m(X=>X??Date.now()):E==="connecting"&&(ae.current&&d(X=>X+1),m(X=>X??Date.now()))}),$(!0),()=>{B.destroy(),_.destroy(),xe.current=null}},[]),O.useEffect(()=>{if(!xe.current)return;const _=xe.current.ydoc.getMap(hh),B=()=>{var ge;const E=_.get("generationId");E&&fe.current&&E!==fe.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),D(!0),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>D(!1),5e3)),E&&(fe.current=E);const X=_.get("openDocuments"),he=_.get("activeDocumentId");X&&((ge=Z.current)==null||ge.call(Z,X,he??null))};return _.observe(B),B(),()=>{_.unobserve(B),K.current&&clearTimeout(K.current)}},[]),O.useEffect(()=>{for(const B of G.current.values())B.cleanup();G.current.clear();const _=le.current.find(B=>B.id===n);if(_){const B=me(_);G.current.set(_.id,{cleanup:B})}else b([]),v(null),T(!1),j(!1)},[n,me]);const Ae=O.useCallback(_=>{r(B=>{if(B!==_)return B;const E=le.current,X=E.findIndex(ge=>ge.id===_),he=E.filter(ge=>ge.id!==_);return he.length===0?null:he[Math.min(X,he.length-1)].id}),fetch(`http://localhost:${Ya}/api/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:_})}).then(B=>{B.ok||console.warn("[Tandem] Server rejected close:",B.status)}).catch(B=>{console.warn("[Tandem] Failed to close document on server:",B)})},[]);return{tabs:t,activeTabId:n,setActiveTabId:r,handleTabClose:Ae,connected:i,connectionStatus:l,reconnectAttempts:f,disconnectedSince:p,annotations:g,claudeStatus:S,claudeActive:C,readOnly:H,bootstrapYdoc:((M=xe.current)==null?void 0:M.ydoc)??null,ready:ne,serverRestarted:N}}function v7(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const k7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E7={};function pA(t,e){return(E7.jsx?C7:k7).test(t)}const T7=/[ \t\n\f\r]/g;function A7(t){return typeof t=="object"?t.type==="text"?mA(t.value):!1:mA(t)}function mA(t){return t.replace(T7,"")===""}class vf{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}vf.prototype.normal={};vf.prototype.property={};vf.prototype.space=void 0;function aD(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new vf(n,r,e)}function px(t){return t.toLowerCase()}class ar{constructor(e,n){this.attribute=n,this.property=e}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let M7=0;const $e=bl(),Qt=bl(),mx=bl(),ue=bl(),Et=bl(),Aa=bl(),gr=bl();function bl(){return 2**++M7}const gx=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:Qt,commaOrSpaceSeparated:gr,commaSeparated:Aa,number:ue,overloadedBoolean:mx,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),H0=Object.keys(gx);class Y1 extends ar{constructor(e,n,r,i){let s=-1;if(super(e,n),gA(this,"space",i),typeof r=="number")for(;++s<H0.length;){const l=H0[s];gA(this,H0[s],(r&gx[l])===gx[l])}}}Y1.prototype.defined=!0;function gA(t,e,n){n&&(t[e]=n)}function nc(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Y1(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[px(r)]=r,n[px(s.attribute)]=r}return new vf(e,n,t.space)}const cD=nc({properties:{ariaActiveDescendant:null,ariaAtomic:Qt,ariaAutoComplete:null,ariaBusy:Qt,ariaChecked:Qt,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Qt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Qt,ariaFlowTo:Et,ariaGrabbed:Qt,ariaHasPopup:null,ariaHidden:Qt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:ue,ariaLive:null,ariaModal:Qt,ariaMultiLine:Qt,ariaMultiSelectable:Qt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Qt,ariaReadOnly:Qt,ariaRelevant:null,ariaRequired:Qt,ariaRoleDescription:Et,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Qt,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function uD(t,e){return e in t?t[e]:e}function fD(t,e){return uD(t,e.toLowerCase())}const O7=nc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Aa,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:Et,autoFocus:$e,autoPlay:$e,blocking:Et,capture:null,charSet:null,checked:$e,cite:null,className:Et,cols:ue,colSpan:null,content:null,contentEditable:Qt,controls:$e,controlsList:Et,coords:ue|Aa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:mx,draggable:Qt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:Et,height:ue,hidden:mx,high:ue,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:Et,itemRef:Et,itemScope:$e,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:$e,optimum:ue,pattern:null,ping:Et,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:Et,required:$e,reversed:$e,rows:ue,rowSpan:ue,sandbox:Et,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Qt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:$e,useMap:null,value:Qt,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Qt,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$e,disableRemotePlayback:$e,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:fD}),_7=nc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:Et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:$e,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Aa,g2:Aa,glyphName:Aa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ue,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:uD}),dD=nc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),hD=nc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fD}),pD=nc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),D7={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},R7=/[A-Z]/g,yA=/-[a-z]/g,N7=/^data[-\w.:]+$/i;function z7(t,e){const n=px(e);let r=e,i=ar;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&N7.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(yA,j7);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!yA.test(s)){let l=s.replace(R7,L7);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=Y1}return new i(r,e)}function L7(t){return"-"+t.toLowerCase()}function j7(t){return t.charAt(1).toUpperCase()}const I7=aD([cD,O7,dD,hD,pD],"html"),K1=aD([cD,_7,dD,hD,pD],"svg");function B7(t){return t.join(" ").trim()}var oa={},V0,bA;function U7(){if(bA)return V0;bA=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
297
+ `,d="/",p="*",m="",g="comment",b="declaration";function S(C,T){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];T=T||{};var H=1,j=1;function ne(ie){var G=ie.match(e);G&&(H+=G.length);var I=ie.lastIndexOf(f);j=~I?ie.length-I:j+ie.length}function $(){var ie={line:H,column:j};return function(G){return G.position=new N(ie),ae(),G}}function N(ie){this.start=ie,this.end={line:H,column:j},this.source=T.source}N.prototype.content=C;function D(ie){var G=new Error(T.source+":"+H+":"+j+": "+ie);if(G.reason=ie,G.filename=T.source,G.line=H,G.column=j,G.source=C,!T.silent)throw G}function K(ie){var G=ie.exec(C);if(G){var I=G[0];return ne(I),C=C.slice(I.length),G}}function ae(){K(n)}function xe(ie){var G;for(ie=ie||[];G=fe();)G!==!1&&ie.push(G);return ie}function fe(){var ie=$();if(!(d!=C.charAt(0)||p!=C.charAt(1))){for(var G=2;m!=C.charAt(G)&&(p!=C.charAt(G)||d!=C.charAt(G+1));)++G;if(G+=2,m===C.charAt(G-1))return D("End of comment missing");var I=C.slice(2,G-2);return j+=2,ne(I),C=C.slice(G),j+=2,ie({type:g,comment:I})}}function le(){var ie=$(),G=K(r);if(G){if(fe(),!K(i))return D("property missing ':'");var I=K(s),Z=ie({type:b,property:v(G[0].replace(t,m)),value:I?v(I[0].replace(t,m)):m});return K(l),Z}}function Q(){var ie=[];xe(ie);for(var G;G=le();)G!==!1&&(ie.push(G),xe(ie));return ie}return ae(),Q()}function v(C){return C?C.replace(c,m):m}return V0=S,V0}var xA;function H7(){if(xA)return oa;xA=1;var t=oa&&oa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(oa,"__esModule",{value:!0}),oa.default=n;const e=t(U7());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,e.default)(r),c=typeof i=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:d,value:p}=f;c?i(d,p,f):p&&(s=s||{},s[d]=p)}),s}return oa}var Qc={},SA;function V7(){if(SA)return Qc;SA=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(d){return!d||n.test(d)||t.test(d)},l=function(d,p){return p.toUpperCase()},c=function(d,p){return"".concat(p,"-")},f=function(d,p){return p===void 0&&(p={}),s(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(e,l))};return Qc.camelCase=f,Qc}var eu,wA;function P7(){if(wA)return eu;wA=1;var t=eu&&eu.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(H7()),n=V7();function r(i,s){var l={};return!i||typeof i!="string"||(0,e.default)(i,function(c,f){c&&f&&(l[(0,n.camelCase)(c,s)]=f)}),l}return r.default=r,eu=r,eu}var $7=P7();const F7=Wp($7),mD=gD("end"),W1=gD("start");function gD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function q7(t){const e=W1(t),n=mD(t);if(e&&n)return{start:e,end:n}}function Au(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?vA(t.position):"start"in t||"end"in t?vA(t):"line"in t||"column"in t?yx(t):""}function yx(t){return kA(t&&t.line)+":"+kA(t&&t.column)}function vA(t){return yx(t&&t.start)+"-"+yx(t&&t.end)}function kA(t){return t&&typeof t=="number"?t:1}class Un extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(l=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?s.ruleId=r:(s.source=r.slice(0,f),s.ruleId=r.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){const f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Au(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Un.prototype.file="";Un.prototype.name="";Un.prototype.reason="";Un.prototype.message="";Un.prototype.stack="";Un.prototype.column=void 0;Un.prototype.line=void 0;Un.prototype.ancestors=void 0;Un.prototype.cause=void 0;Un.prototype.fatal=void 0;Un.prototype.place=void 0;Un.prototype.ruleId=void 0;Un.prototype.source=void 0;const G1={}.hasOwnProperty,Y7=new Map,K7=/[A-Z]/g,W7=new Set(["table","tbody","thead","tfoot","tr"]),G7=new Set(["td","th"]),yD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z7(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=i$(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=r$(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?K1:I7,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=bD(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function bD(t,e,n){if(e.type==="element")return J7(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return X7(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return e$(t,e,n);if(e.type==="mdxjsEsm")return Q7(t,e);if(e.type==="root")return t$(t,e,n);if(e.type==="text")return n$(t,e)}function J7(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=K1,t.schema=i),t.ancestors.push(e);const s=SD(t,e.tagName,!1),l=s$(t,e);let c=J1(t,e);return W7.has(e.tagName)&&(c=c.filter(function(f){return typeof f=="string"?!A7(f):!0})),xD(t,l,s,e),Z1(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function X7(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}ff(t,e.position)}function Q7(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ff(t,e.position)}function e$(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=K1,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:SD(t,e.name,!0),l=o$(t,e),c=J1(t,e);return xD(t,l,s,e),Z1(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function t$(t,e,n){const r={};return Z1(r,J1(t,e)),t.create(e,t.Fragment,r,n)}function n$(t,e){return e.value}function xD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Z1(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function r$(t,e,n){return r;function r(i,s,l,c){const d=Array.isArray(l.children)?n:e;return c?d(s,l,c):d(s,l)}}function i$(t,e){return n;function n(r,i,s,l){const c=Array.isArray(s.children),f=W1(r);return e(i,s,l,c,{columnNumber:f?f.column-1:void 0,fileName:t,lineNumber:f?f.line:void 0},void 0)}}function s$(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&G1.call(e.properties,i)){const s=l$(t,i,e.properties[i]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&G7.has(e.tagName)?r=c:n[l]=c}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function o$(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else ff(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,s=t.evaluater.evaluateExpression(c.expression)}else ff(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function J1(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:Y7;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const f=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(f){const d=i.get(f)||0;l=f+"-"+d,i.set(f,d+1)}}const c=bD(t,s,l);c!==void 0&&n.push(c)}return n}function l$(t,e,n){const r=z7(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?v7(n):B7(n)),r.property==="style"){let i=typeof n=="object"?n:a$(t,String(n));return t.stylePropertyNameCase==="css"&&(i=c$(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?D7[r.property]||r.property:r.attribute,n]}}function a$(t,e){try{return F7(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Un("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=yD+"#cannot-parse-style-attribute",i}}function SD(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,l;for(;++s<i.length;){const c=pA(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=l}else r=pA(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return G1.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);ff(t)}function ff(t,e){const n=new Un("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=yD+"#cannot-handle-mdx-estrees-without-createevaluater",n}function c$(t){const e={};let n;for(n in t)G1.call(t,n)&&(e[u$(n)]=t[n]);return e}function u$(t){let e=t.replace(K7,f$);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function f$(t){return"-"+t.toLowerCase()}const P0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},d$={};function h$(t,e){const n=d$,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return wD(t,r,i)}function wD(t,e,n){if(p$(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return CA(t.children,e,n)}return Array.isArray(t)?CA(t,e,n):""}function CA(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=wD(t[i],e,n);return r.join("")}function p$(t){return!!(t&&typeof t=="object")}const EA=document.createElement("i");function X1(t){const e="&"+t+";";EA.innerHTML=e;const n=EA.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Oi(t,e,n,r){const i=t.length;let s=0,l;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(e,0),t.splice(...l),s+=1e4,e+=1e4}function Hr(t,e){return t.length>0?(Oi(t,t.length,0,e),t):e}const TA={}.hasOwnProperty;function m$(t){const e={};let n=-1;for(;++n<t.length;)g$(e,t[n]);return e}function g$(t,e){let n;for(n in e){const i=(TA.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){TA.call(i,l)||(i[l]=[]);const c=s[l];y$(i[l],Array.isArray(c)?c:c?[c]:[])}}}function y$(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Oi(t,0,0,r)}function vD(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ma(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xi=So(/[A-Za-z]/),wr=So(/[\dA-Za-z]/),b$=So(/[#-'*+\--9=?A-Z^-~]/);function bx(t){return t!==null&&(t<32||t===127)}const xx=So(/\d/),x$=So(/[\dA-Fa-f]/),S$=So(/[!-/:-@[-`{-~]/);function Le(t){return t!==null&&t<-2}function lr(t){return t!==null&&(t<0||t===32)}function ft(t){return t===-2||t===-1||t===32}const w$=So(new RegExp("\\p{P}|\\p{S}","u")),v$=So(/\s/);function So(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function rc(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&wr(t.charCodeAt(n+1))&&wr(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const c=t.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(l=String.fromCharCode(s,c),i=1):l="�"}else l=String.fromCharCode(s);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Tt(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(f){return ft(f)?(t.enter(n),c(f)):e(f)}function c(f){return ft(f)&&s++<i?(t.consume(f),c):(t.exit(n),e(f))}}const k$={tokenize:C$};function C$(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),Tt(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const f=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Le(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const E$={tokenize:T$},AA={tokenize:A$};function T$(t){const e=this,n=[];let r=0,i,s,l;return c;function c(j){if(r<n.length){const ne=n[r];return e.containerState=ne[1],t.attempt(ne[0].continuation,f,d)(j)}return d(j)}function f(j){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&H();const ne=e.events.length;let $=ne,N;for(;$--;)if(e.events[$][0]==="exit"&&e.events[$][1].type==="chunkFlow"){N=e.events[$][1].end;break}T(r);let D=ne;for(;D<e.events.length;)e.events[D][1].end={...N},D++;return Oi(e.events,$+1,0,e.events.slice(ne)),e.events.length=D,d(j)}return c(j)}function d(j){if(r===n.length){if(!i)return g(j);if(i.currentConstruct&&i.currentConstruct.concrete)return S(j);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(AA,p,m)(j)}function p(j){return i&&H(),T(r),g(j)}function m(j){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,S(j)}function g(j){return e.containerState={},t.attempt(AA,b,S)(j)}function b(j){return r++,n.push([e.currentConstruct,e.containerState]),g(j)}function S(j){if(j===null){i&&H(),T(0),t.consume(j);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(j)}function v(j){if(j===null){C(t.exit("chunkFlow"),!0),T(0),t.consume(j);return}return Le(j)?(t.consume(j),C(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(j),v)}function C(j,ne){const $=e.sliceStream(j);if(ne&&$.push(null),j.previous=s,s&&(s.next=j),s=j,i.defineSkip(j.start),i.write($),e.parser.lazy[j.start.line]){let N=i.events.length;for(;N--;)if(i.events[N][1].start.offset<l&&(!i.events[N][1].end||i.events[N][1].end.offset>l))return;const D=e.events.length;let K=D,ae,xe;for(;K--;)if(e.events[K][0]==="exit"&&e.events[K][1].type==="chunkFlow"){if(ae){xe=e.events[K][1].end;break}ae=!0}for(T(r),N=D;N<e.events.length;)e.events[N][1].end={...xe},N++;Oi(e.events,K+1,0,e.events.slice(D)),e.events.length=N}}function T(j){let ne=n.length;for(;ne-- >j;){const $=n[ne];e.containerState=$[1],$[0].exit.call(e,t)}n.length=j}function H(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function A$(t,e,n){return Tt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function MA(t){if(t===null||lr(t)||v$(t))return 1;if(w$(t))return 2}function Q1(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Sx={name:"attention",resolveAll:M$,tokenize:O$};function M$(t,e){let n=-1,r,i,s,l,c,f,d,p;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;f=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};OA(m,-f),OA(g,f),l={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:f>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:f>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:f>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=Hr(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=Hr(d,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",s,e]]),d=Hr(d,Q1(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=Hr(d,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(p=2,d=Hr(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):p=0,Oi(t,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function O$(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=MA(r);let s;return l;function l(f){return s=f,t.enter("attentionSequence"),c(f)}function c(f){if(f===s)return t.consume(f),c;const d=t.exit("attentionSequence"),p=MA(f),m=!p||p===2&&i||n.includes(f),g=!i||i===2&&p||n.includes(r);return d._open=!!(s===42?m:m&&(i||!g)),d._close=!!(s===42?g:g&&(p||!m)),e(f)}}function OA(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const _$={name:"autolink",tokenize:D$};function D$(t,e,n){let r=0;return i;function i(b){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(b){return xi(b)?(t.consume(b),l):b===64?n(b):d(b)}function l(b){return b===43||b===45||b===46||wr(b)?(r=1,c(b)):d(b)}function c(b){return b===58?(t.consume(b),r=0,f):(b===43||b===45||b===46||wr(b))&&r++<32?(t.consume(b),c):(r=0,d(b))}function f(b){return b===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):b===null||b===32||b===60||bx(b)?n(b):(t.consume(b),f)}function d(b){return b===64?(t.consume(b),p):b$(b)?(t.consume(b),d):n(b)}function p(b){return wr(b)?m(b):n(b)}function m(b){return b===46?(t.consume(b),r=0,p):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):g(b)}function g(b){if((b===45||wr(b))&&r++<63){const S=b===45?g:m;return t.consume(b),S}return n(b)}}const Tm={partial:!0,tokenize:R$};function R$(t,e,n){return r;function r(s){return ft(s)?Tt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Le(s)?e(s):n(s)}}const kD={continuation:{tokenize:z$},exit:L$,name:"blockQuote",tokenize:N$};function N$(t,e,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(l),t.exit("blockQuoteMarker"),s}return n(l)}function s(l){return ft(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function z$(t,e,n){const r=this;return i;function i(l){return ft(l)?Tt(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt(kD,e,n)(l)}}function L$(t){t.exit("blockQuote")}const CD={name:"characterEscape",tokenize:j$};function j$(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return S$(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const ED={name:"characterReference",tokenize:I$};function I$(t,e,n){const r=this;let i=0,s,l;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),f}function f(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),s=31,l=wr,p(m))}function d(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=x$,p):(t.enter("characterReferenceValue"),s=7,l=xx,p(m))}function p(m){if(m===59&&i){const g=t.exit("characterReferenceValue");return l===wr&&!X1(r.sliceSerialize(g))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return l(m)&&i++<s?(t.consume(m),p):n(m)}}const _A={partial:!0,tokenize:U$},DA={concrete:!0,name:"codeFenced",tokenize:B$};function B$(t,e,n){const r=this,i={partial:!0,tokenize:$};let s=0,l=0,c;return f;function f(N){return d(N)}function d(N){const D=r.events[r.events.length-1];return s=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,c=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),p(N)}function p(N){return N===c?(l++,t.consume(N),p):l<3?n(N):(t.exit("codeFencedFenceSequence"),ft(N)?Tt(t,m,"whitespace")(N):m(N))}function m(N){return N===null||Le(N)?(t.exit("codeFencedFence"),r.interrupt?e(N):t.check(_A,v,ne)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(N))}function g(N){return N===null||Le(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(N)):ft(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Tt(t,b,"whitespace")(N)):N===96&&N===c?n(N):(t.consume(N),g)}function b(N){return N===null||Le(N)?m(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(N))}function S(N){return N===null||Le(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(N)):N===96&&N===c?n(N):(t.consume(N),S)}function v(N){return t.attempt(i,ne,C)(N)}function C(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),T}function T(N){return s>0&&ft(N)?Tt(t,H,"linePrefix",s+1)(N):H(N)}function H(N){return N===null||Le(N)?t.check(_A,v,ne)(N):(t.enter("codeFlowValue"),j(N))}function j(N){return N===null||Le(N)?(t.exit("codeFlowValue"),H(N)):(t.consume(N),j)}function ne(N){return t.exit("codeFenced"),e(N)}function $(N,D,K){let ae=0;return xe;function xe(G){return N.enter("lineEnding"),N.consume(G),N.exit("lineEnding"),fe}function fe(G){return N.enter("codeFencedFence"),ft(G)?Tt(N,le,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):le(G)}function le(G){return G===c?(N.enter("codeFencedFenceSequence"),Q(G)):K(G)}function Q(G){return G===c?(ae++,N.consume(G),Q):ae>=l?(N.exit("codeFencedFenceSequence"),ft(G)?Tt(N,ie,"whitespace")(G):ie(G)):K(G)}function ie(G){return G===null||Le(G)?(N.exit("codeFencedFence"),D(G)):K(G)}}}function U$(t,e,n){const r=this;return i;function i(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const $0={name:"codeIndented",tokenize:V$},H$={partial:!0,tokenize:P$};function V$(t,e,n){const r=this;return i;function i(d){return t.enter("codeIndented"),Tt(t,s,"linePrefix",5)(d)}function s(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?f(d):Le(d)?t.attempt(H$,l,f)(d):(t.enter("codeFlowValue"),c(d))}function c(d){return d===null||Le(d)?(t.exit("codeFlowValue"),l(d)):(t.consume(d),c)}function f(d){return t.exit("codeIndented"),e(d)}}function P$(t,e,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):Le(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):Tt(t,s,"linePrefix",5)(l)}function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Le(l)?i(l):n(l)}}const $$={name:"codeText",previous:q$,resolve:F$,tokenize:Y$};function F$(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function q$(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Y$(t,e,n){let r=0,i,s;return l;function l(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),r++,c):(t.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),f):m===96?(s=t.enter("codeTextSequence"),i=0,p(m)):Le(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),f):(t.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||Le(m)?(t.exit("codeTextData"),f(m)):(t.consume(m),d)}function p(m){return m===96?(t.consume(m),i++,p):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",d(m))}}class K${constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&tu(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),tu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),tu(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);tu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);tu(this.left,n.reverse())}}}function tu(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function TD(t){const e={};let n=-1,r,i,s,l,c,f,d;const p=new K$(t);for(;++n<p.length;){for(;n in e;)n=e[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,s=0,s<f.length&&f[s][1].type==="lineEndingBlank"&&(s+=2),s<f.length&&f[s][1].type==="content"))for(;++s<f.length&&f[s][1].type!=="content";)f[s][1].type==="chunkText"&&(f[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,W$(p,n)),n=e[n],d=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=p.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return Oi(t,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function W$(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,f=[],d={};let p,m,g=-1,b=n,S=0,v=0;const C=[v];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(p=r.sliceStream(b),b.next||p.push(null),m&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++g<c.length;)c[g][0]==="exit"&&c[g-1][0]==="enter"&&c[g][1].type===c[g-1][1].type&&c[g][1].start.line!==c[g][1].end.line&&(v=g+1,C.push(v),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),g=C.length;g--;){const T=c.slice(C[g],C[g+1]),H=s.pop();f.push([H,H+T.length-1]),t.splice(H,2,T)}for(f.reverse(),g=-1;++g<f.length;)d[S+f[g][0]]=S+f[g][1],S+=f[g][1]-f[g][0]-1;return d}const G$={resolve:J$,tokenize:X$},Z$={partial:!0,tokenize:Q$};function J$(t){return TD(t),t}function X$(t,e){let n;return r;function r(c){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?s(c):Le(c)?t.check(Z$,l,s)(c):(t.consume(c),i)}function s(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function l(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Q$(t,e,n){const r=this;return i;function i(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Tt(t,s,"linePrefix")}function s(l){if(l===null||Le(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function AD(t,e,n,r,i,s,l,c,f){const d=f||Number.POSITIVE_INFINITY;let p=0;return m;function m(T){return T===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(T),t.exit(s),g):T===null||T===32||T===41||bx(T)?n(T):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),v(T))}function g(T){return T===62?(t.enter(s),t.consume(T),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===62?(t.exit("chunkString"),t.exit(c),g(T)):T===null||T===60||Le(T)?n(T):(t.consume(T),T===92?S:b)}function S(T){return T===60||T===62||T===92?(t.consume(T),b):b(T)}function v(T){return!p&&(T===null||T===41||lr(T))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(T)):p<d&&T===40?(t.consume(T),p++,v):T===41?(t.consume(T),p--,v):T===null||T===32||T===40||bx(T)?n(T):(t.consume(T),T===92?C:v)}function C(T){return T===40||T===41||T===92?(t.consume(T),v):v(T)}}function MD(t,e,n,r,i,s){const l=this;let c=0,f;return d;function d(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),p}function p(b){return c>999||b===null||b===91||b===93&&!f||b===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(t.exit(s),t.enter(i),t.consume(b),t.exit(i),t.exit(r),e):Le(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),p):(t.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Le(b)||c++>999?(t.exit("chunkString"),p(b)):(t.consume(b),f||(f=!ft(b)),b===92?g:m)}function g(b){return b===91||b===92||b===93?(t.consume(b),c++,m):m(b)}}function OD(t,e,n,r,i,s){let l;return c;function c(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),l=g===40?41:g,f):n(g)}function f(g){return g===l?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),d(g))}function d(g){return g===l?(t.exit(s),f(l)):g===null?n(g):Le(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Tt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===l||g===null||Le(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?m:p)}function m(g){return g===l||g===92?(t.consume(g),p):p(g)}}function Mu(t,e){let n;return r;function r(i){return Le(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ft(i)?Tt(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const eF={name:"definition",tokenize:nF},tF={partial:!0,tokenize:rF};function nF(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),l(b)}function l(b){return MD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function c(b){return i=Ma(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),f):n(b)}function f(b){return lr(b)?Mu(t,d)(b):d(b)}function d(b){return AD(t,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return t.attempt(tF,m,m)(b)}function m(b){return ft(b)?Tt(t,g,"whitespace")(b):g(b)}function g(b){return b===null||Le(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function rF(t,e,n){return r;function r(c){return lr(c)?Mu(t,i)(c):n(c)}function i(c){return OD(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return ft(c)?Tt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Le(c)?e(c):n(c)}}const iF={name:"hardBreakEscape",tokenize:sF};function sF(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Le(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const oF={name:"headingAtx",resolve:lF,tokenize:aF};function lF(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Oi(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function aF(t,e,n){let r=0;return i;function i(p){return t.enter("atxHeading"),s(p)}function s(p){return t.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(t.consume(p),l):p===null||lr(p)?(t.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(t.enter("atxHeadingSequence"),f(p)):p===null||Le(p)?(t.exit("atxHeading"),e(p)):ft(p)?Tt(t,c,"whitespace")(p):(t.enter("atxHeadingText"),d(p))}function f(p){return p===35?(t.consume(p),f):(t.exit("atxHeadingSequence"),c(p))}function d(p){return p===null||p===35||lr(p)?(t.exit("atxHeadingText"),c(p)):(t.consume(p),d)}}const cF=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],RA=["pre","script","style","textarea"],uF={concrete:!0,name:"htmlFlow",resolveTo:hF,tokenize:pF},fF={partial:!0,tokenize:gF},dF={partial:!0,tokenize:mF};function hF(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function pF(t,e,n){const r=this;let i,s,l,c,f;return d;function d(E){return p(E)}function p(E){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(E),m}function m(E){return E===33?(t.consume(E),g):E===47?(t.consume(E),s=!0,v):E===63?(t.consume(E),i=3,r.interrupt?e:M):xi(E)?(t.consume(E),l=String.fromCharCode(E),C):n(E)}function g(E){return E===45?(t.consume(E),i=2,b):E===91?(t.consume(E),i=5,c=0,S):xi(E)?(t.consume(E),i=4,r.interrupt?e:M):n(E)}function b(E){return E===45?(t.consume(E),r.interrupt?e:M):n(E)}function S(E){const X="CDATA[";return E===X.charCodeAt(c++)?(t.consume(E),c===X.length?r.interrupt?e:le:S):n(E)}function v(E){return xi(E)?(t.consume(E),l=String.fromCharCode(E),C):n(E)}function C(E){if(E===null||E===47||E===62||lr(E)){const X=E===47,he=l.toLowerCase();return!X&&!s&&RA.includes(he)?(i=1,r.interrupt?e(E):le(E)):cF.includes(l.toLowerCase())?(i=6,X?(t.consume(E),T):r.interrupt?e(E):le(E)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):s?H(E):j(E))}return E===45||wr(E)?(t.consume(E),l+=String.fromCharCode(E),C):n(E)}function T(E){return E===62?(t.consume(E),r.interrupt?e:le):n(E)}function H(E){return ft(E)?(t.consume(E),H):xe(E)}function j(E){return E===47?(t.consume(E),xe):E===58||E===95||xi(E)?(t.consume(E),ne):ft(E)?(t.consume(E),j):xe(E)}function ne(E){return E===45||E===46||E===58||E===95||wr(E)?(t.consume(E),ne):$(E)}function $(E){return E===61?(t.consume(E),N):ft(E)?(t.consume(E),$):j(E)}function N(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(t.consume(E),f=E,D):ft(E)?(t.consume(E),N):K(E)}function D(E){return E===f?(t.consume(E),f=null,ae):E===null||Le(E)?n(E):(t.consume(E),D)}function K(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||lr(E)?$(E):(t.consume(E),K)}function ae(E){return E===47||E===62||ft(E)?j(E):n(E)}function xe(E){return E===62?(t.consume(E),fe):n(E)}function fe(E){return E===null||Le(E)?le(E):ft(E)?(t.consume(E),fe):n(E)}function le(E){return E===45&&i===2?(t.consume(E),I):E===60&&i===1?(t.consume(E),Z):E===62&&i===4?(t.consume(E),_):E===63&&i===3?(t.consume(E),M):E===93&&i===5?(t.consume(E),Ae):Le(E)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(fF,B,Q)(E)):E===null||Le(E)?(t.exit("htmlFlowData"),Q(E)):(t.consume(E),le)}function Q(E){return t.check(dF,ie,B)(E)}function ie(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),G}function G(E){return E===null||Le(E)?Q(E):(t.enter("htmlFlowData"),le(E))}function I(E){return E===45?(t.consume(E),M):le(E)}function Z(E){return E===47?(t.consume(E),l="",me):le(E)}function me(E){if(E===62){const X=l.toLowerCase();return RA.includes(X)?(t.consume(E),_):le(E)}return xi(E)&&l.length<8?(t.consume(E),l+=String.fromCharCode(E),me):le(E)}function Ae(E){return E===93?(t.consume(E),M):le(E)}function M(E){return E===62?(t.consume(E),_):E===45&&i===2?(t.consume(E),M):le(E)}function _(E){return E===null||Le(E)?(t.exit("htmlFlowData"),B(E)):(t.consume(E),_)}function B(E){return t.exit("htmlFlow"),e(E)}}function mF(t,e,n){const r=this;return i;function i(l){return Le(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function gF(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Tm,e,n)}}const yF={name:"htmlText",tokenize:bF};function bF(t,e,n){const r=this;let i,s,l;return c;function c(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),f}function f(M){return M===33?(t.consume(M),d):M===47?(t.consume(M),$):M===63?(t.consume(M),j):xi(M)?(t.consume(M),K):n(M)}function d(M){return M===45?(t.consume(M),p):M===91?(t.consume(M),s=0,S):xi(M)?(t.consume(M),H):n(M)}function p(M){return M===45?(t.consume(M),b):n(M)}function m(M){return M===null?n(M):M===45?(t.consume(M),g):Le(M)?(l=m,Z(M)):(t.consume(M),m)}function g(M){return M===45?(t.consume(M),b):m(M)}function b(M){return M===62?I(M):M===45?g(M):m(M)}function S(M){const _="CDATA[";return M===_.charCodeAt(s++)?(t.consume(M),s===_.length?v:S):n(M)}function v(M){return M===null?n(M):M===93?(t.consume(M),C):Le(M)?(l=v,Z(M)):(t.consume(M),v)}function C(M){return M===93?(t.consume(M),T):v(M)}function T(M){return M===62?I(M):M===93?(t.consume(M),T):v(M)}function H(M){return M===null||M===62?I(M):Le(M)?(l=H,Z(M)):(t.consume(M),H)}function j(M){return M===null?n(M):M===63?(t.consume(M),ne):Le(M)?(l=j,Z(M)):(t.consume(M),j)}function ne(M){return M===62?I(M):j(M)}function $(M){return xi(M)?(t.consume(M),N):n(M)}function N(M){return M===45||wr(M)?(t.consume(M),N):D(M)}function D(M){return Le(M)?(l=D,Z(M)):ft(M)?(t.consume(M),D):I(M)}function K(M){return M===45||wr(M)?(t.consume(M),K):M===47||M===62||lr(M)?ae(M):n(M)}function ae(M){return M===47?(t.consume(M),I):M===58||M===95||xi(M)?(t.consume(M),xe):Le(M)?(l=ae,Z(M)):ft(M)?(t.consume(M),ae):I(M)}function xe(M){return M===45||M===46||M===58||M===95||wr(M)?(t.consume(M),xe):fe(M)}function fe(M){return M===61?(t.consume(M),le):Le(M)?(l=fe,Z(M)):ft(M)?(t.consume(M),fe):ae(M)}function le(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),i=M,Q):Le(M)?(l=le,Z(M)):ft(M)?(t.consume(M),le):(t.consume(M),ie)}function Q(M){return M===i?(t.consume(M),i=void 0,G):M===null?n(M):Le(M)?(l=Q,Z(M)):(t.consume(M),Q)}function ie(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||lr(M)?ae(M):(t.consume(M),ie)}function G(M){return M===47||M===62||lr(M)?ae(M):n(M)}function I(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),e):n(M)}function Z(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),me}function me(M){return ft(M)?Tt(t,Ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Ae(M)}function Ae(M){return t.enter("htmlTextData"),l(M)}}const eS={name:"labelEnd",resolveAll:vF,resolveTo:kF,tokenize:CF},xF={tokenize:EF},SF={tokenize:TF},wF={tokenize:AF};function vF(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Oi(t,0,t.length,n),t}function kF(t,e){let n=t.length,r=0,i,s,l,c;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const f={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},p={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",f,e],["enter",d,e]],c=Hr(c,t.slice(s+1,s+r+3)),c=Hr(c,[["enter",p,e]]),c=Hr(c,Q1(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=Hr(c,[["exit",p,e],t[l-2],t[l-1],["exit",d,e]]),c=Hr(c,t.slice(l+1)),c=Hr(c,[["exit",f,e]]),Oi(t,s,t.length,c),t}function CF(t,e,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return c;function c(g){return s?s._inactive?m(g):(l=r.parser.defined.includes(Ma(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),f):n(g)}function f(g){return g===40?t.attempt(xF,p,l?p:m)(g):g===91?t.attempt(SF,p,l?d:m)(g):l?p(g):m(g)}function d(g){return t.attempt(wF,p,m)(g)}function p(g){return e(g)}function m(g){return s._balanced=!0,n(g)}}function EF(t,e,n){return r;function r(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),i}function i(m){return lr(m)?Mu(t,s)(m):s(m)}function s(m){return m===41?p(m):AD(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return lr(m)?Mu(t,f)(m):p(m)}function c(m){return n(m)}function f(m){return m===34||m===39||m===40?OD(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function d(m){return lr(m)?Mu(t,p)(m):p(m)}function p(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function TF(t,e,n){const r=this;return i;function i(c){return MD.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Ma(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function AF(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const MF={name:"labelStartImage",resolveAll:eS.resolveAll,tokenize:OF};function OF(t,e,n){const r=this;return i;function i(c){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(c),t.exit("labelImageMarker"),s}function s(c){return c===91?(t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):e(c)}}const _F={name:"labelStartLink",resolveAll:eS.resolveAll,tokenize:DF};function DF(t,e,n){const r=this;return i;function i(l){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const F0={name:"lineEnding",tokenize:RF};function RF(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Tt(t,e,"linePrefix")}}const _h={name:"thematicBreak",tokenize:NF};function NF(t,e,n){let r=0,i;return s;function s(d){return t.enter("thematicBreak"),l(d)}function l(d){return i=d,c(d)}function c(d){return d===i?(t.enter("thematicBreakSequence"),f(d)):r>=3&&(d===null||Le(d))?(t.exit("thematicBreak"),e(d)):n(d)}function f(d){return d===i?(t.consume(d),r++,f):(t.exit("thematicBreakSequence"),ft(d)?Tt(t,c,"whitespace")(d):c(d))}}const nr={continuation:{tokenize:IF},exit:UF,name:"list",tokenize:jF},zF={partial:!0,tokenize:HF},LF={partial:!0,tokenize:BF};function jF(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(b){const S=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:xx(b)){if(r.containerState.type||(r.containerState.type=S,t.enter(S,{_container:!0})),S==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(_h,n,d)(b):d(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),f(b)}return n(b)}function f(b){return xx(b)&&++l<10?(t.consume(b),f):(!r.interrupt||l<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),d(b)):n(b)}function d(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(Tm,r.interrupt?n:p,t.attempt(zF,g,m))}function p(b){return r.containerState.initialBlankLine=!0,s++,g(b)}function m(b){return ft(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),g):n(b)}function g(b){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function IF(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Tm,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Tt(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!ft(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(LF,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Tt(t,t.attempt(nr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function BF(t,e,n){const r=this;return Tt(t,i,"listItemIndent",r.containerState.size+1);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(s):n(s)}}function UF(t){t.exit(this.containerState.type)}function HF(t,e,n){const r=this;return Tt(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const l=r.events[r.events.length-1];return!ft(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const NA={name:"setextUnderline",resolveTo:VF,tokenize:PF};function VF(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",l,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function PF(t,e,n){const r=this;let i;return s;function s(d){let p=r.events.length,m;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){m=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),i=d,l(d)):n(d)}function l(d){return t.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(t.consume(d),c):(t.exit("setextHeadingLineSequence"),ft(d)?Tt(t,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Le(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const $F={tokenize:FF};function FF(t){const e=this,n=t.attempt(Tm,r,t.attempt(this.parser.constructs.flowInitial,i,Tt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(G$,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const qF={resolveAll:DD()},YF=_D("string"),KF=_D("text");function _D(t){return{resolveAll:DD(t==="text"?WF:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,l,c);return l;function l(p){return d(p)?s(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),f}function f(p){return d(p)?(n.exit("data"),s(p)):(n.consume(p),f)}function d(p){if(p===null)return!0;const m=i[p];let g=-1;if(m)for(;++g<m.length;){const b=m[g];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function DD(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function WF(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,l=-1,c=0,f;for(;s--;){const d=i[s];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(d===-2)f=!0,c++;else if(d!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const d={type:n===t.length||f||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const GF={42:nr,43:nr,45:nr,48:nr,49:nr,50:nr,51:nr,52:nr,53:nr,54:nr,55:nr,56:nr,57:nr,62:kD},ZF={91:eF},JF={[-2]:$0,[-1]:$0,32:$0},XF={35:oF,42:_h,45:[NA,_h],60:uF,61:NA,95:_h,96:DA,126:DA},QF={38:ED,92:CD},eq={[-5]:F0,[-4]:F0,[-3]:F0,33:MF,38:ED,42:Sx,60:[_$,yF],91:_F,92:[iF,CD],93:eS,95:Sx,96:$$},tq={null:[Sx,qF]},nq={null:[42,95]},rq={null:[]},iq=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:nq,contentInitial:ZF,disable:rq,document:GF,flow:XF,flowInitial:JF,insideSpan:tq,string:QF,text:eq},Symbol.toStringTag,{value:"Module"}));function sq(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let l=[],c=[];const f={attempt:D($),check:D(N),consume:H,enter:j,exit:ne,interrupt:D(N,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:S,parser:t,previous:null,sliceSerialize:g,sliceStream:b,write:m};let p=e.tokenize.call(d,f);return e.resolveAll&&s.push(e),d;function m(fe){return l=Hr(l,fe),C(),l[l.length-1]!==null?[]:(K(e,0),d.events=Q1(s,d.events,d),d.events)}function g(fe,le){return lq(b(fe),le)}function b(fe){return oq(l,fe)}function S(){const{_bufferIndex:fe,_index:le,line:Q,column:ie,offset:G}=r;return{_bufferIndex:fe,_index:le,line:Q,column:ie,offset:G}}function v(fe){i[fe.line]=fe.column,xe()}function C(){let fe;for(;r._index<l.length;){const le=l[r._index];if(typeof le=="string")for(fe=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===fe&&r._bufferIndex<le.length;)T(le.charCodeAt(r._bufferIndex));else T(le)}}function T(fe){p=p(fe)}function H(fe){Le(fe)?(r.line++,r.column=1,r.offset+=fe===-3?2:1,xe()):fe!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=fe}function j(fe,le){const Q=le||{};return Q.type=fe,Q.start=S(),d.events.push(["enter",Q,d]),c.push(Q),Q}function ne(fe){const le=c.pop();return le.end=S(),d.events.push(["exit",le,d]),le}function $(fe,le){K(fe,le.from)}function N(fe,le){le.restore()}function D(fe,le){return Q;function Q(ie,G,I){let Z,me,Ae,M;return Array.isArray(ie)?B(ie):"tokenize"in ie?B([ie]):_(ie);function _(ge){return Re;function Re(De){const Ue=De!==null&&ge[De],kt=De!==null&&ge.null,Ee=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(kt)?kt:kt?[kt]:[]];return B(Ee)(De)}}function B(ge){return Z=ge,me=0,ge.length===0?I:E(ge[me])}function E(ge){return Re;function Re(De){return M=ae(),Ae=ge,ge.partial||(d.currentConstruct=ge),ge.name&&d.parser.constructs.disable.null.includes(ge.name)?he():ge.tokenize.call(le?Object.assign(Object.create(d),le):d,f,X,he)(De)}}function X(ge){return fe(Ae,M),G}function he(ge){return M.restore(),++me<Z.length?E(Z[me]):I}}}function K(fe,le){fe.resolveAll&&!s.includes(fe)&&s.push(fe),fe.resolve&&Oi(d.events,le,d.events.length-le,fe.resolve(d.events.slice(le),d)),fe.resolveTo&&(d.events=fe.resolveTo(d.events,d))}function ae(){const fe=S(),le=d.previous,Q=d.currentConstruct,ie=d.events.length,G=Array.from(c);return{from:ie,restore:I};function I(){r=fe,d.previous=le,d.currentConstruct=Q,d.events.length=ie,c=G,xe()}}function xe(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function oq(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let l;if(n===i)l=[t[n].slice(r,s)];else{if(l=t.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}s>0&&l.push(t[i].slice(0,s))}return l}function lq(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
298
+ `;break}case-3:{l=`\r
299
+ `;break}case-2:{l=e?" ":" ";break}case-1:{if(!e&&i)continue;l=" ";break}default:l=String.fromCharCode(s)}i=s===-2,r.push(l)}return r.join("")}function aq(t){const r={constructs:m$([iq,...(t||{}).extensions||[]]),content:i(k$),defined:[],document:i(E$),flow:i($F),lazy:{},string:i(YF),text:i(KF)};return r;function i(s){return l;function l(c){return sq(r,s,c)}}}function cq(t){for(;!TD(t););return t}const zA=/[\0\t\n\r]/g;function uq(){let t=1,e="",n=!0,r;return i;function i(s,l,c){const f=[];let d,p,m,g,b;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),m=0,e="",n&&(s.charCodeAt(0)===65279&&m++,n=void 0);m<s.length;){if(zA.lastIndex=m,d=zA.exec(s),g=d&&d.index!==void 0?d.index:s.length,b=s.charCodeAt(g),!d){e=s.slice(m);break}if(b===10&&m===g&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),m<g&&(f.push(s.slice(m,g)),t+=g-m),b){case 0:{f.push(65533),t++;break}case 9:{for(p=Math.ceil(t/4)*4,f.push(-2);t++<p;)f.push(-1);break}case 10:{f.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return c&&(r&&f.push(-5),e&&f.push(e),f.push(null)),f}}const fq=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dq(t){return t.replace(fq,hq)}function hq(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return vD(n.slice(s?2:1),s?16:10)}return X1(n)||t}const RD={}.hasOwnProperty;function pq(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),mq(n)(cq(aq(n).document().write(uq()(t,e,!0))))}function mq(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(kr),autolinkProtocol:ae,autolinkEmail:ae,atxHeading:s(_n),blockQuote:s(kt),characterEscape:ae,characterReference:ae,codeFenced:s(Ee),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(Ee,l),codeText:s(Fe,l),codeTextData:ae,data:ae,codeFlowValue:ae,definition:s(Ct),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(Nt),hardBreakEscape:s(bn),hardBreakTrailing:s(bn),htmlFlow:s($t,l),htmlFlowData:ae,htmlText:s($t,l),htmlTextData:ae,image:s(Kn),label:l,link:s(kr),listItem:s(Wn),listItemValue:g,listOrdered:s(Cr,m),listUnordered:s(Cr),paragraph:s(Ni),reference:E,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(_n),strong:s(zi),thematicBreak:s(Li)},exit:{atxHeading:f(),atxHeadingSequence:$,autolink:f(),autolinkEmail:Ue,autolinkProtocol:De,blockQuote:f(),characterEscapeValue:xe,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:ge,characterReference:Re,codeFenced:f(C),codeFencedFence:v,codeFencedFenceInfo:b,codeFencedFenceMeta:S,codeFlowValue:xe,codeIndented:f(T),codeText:f(G),codeTextData:xe,data:xe,definition:f(),definitionDestinationString:ne,definitionLabelString:H,definitionTitleString:j,emphasis:f(),hardBreakEscape:f(le),hardBreakTrailing:f(le),htmlFlow:f(Q),htmlFlowData:xe,htmlText:f(ie),htmlTextData:xe,image:f(Z),label:Ae,labelText:me,lineEnding:fe,link:f(I),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:X,resourceDestinationString:M,resourceTitleString:_,resource:B,setextHeading:f(K),setextHeadingLineSequence:D,setextHeadingText:N,strong:f(),thematicBreak:f()}};ND(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(Y){let L={type:"root",children:[]};const se={stack:[L],tokenStack:[],config:e,enter:c,exit:d,buffer:l,resume:p,data:n},ye=[];let Te=-1;for(;++Te<Y.length;)if(Y[Te][1].type==="listOrdered"||Y[Te][1].type==="listUnordered")if(Y[Te][0]==="enter")ye.push(Te);else{const re=ye.pop();Te=i(Y,re,Te)}for(Te=-1;++Te<Y.length;){const re=e[Y[Te][0]];RD.call(re,Y[Te][1].type)&&re[Y[Te][1].type].call(Object.assign({sliceSerialize:Y[Te][2].sliceSerialize},se),Y[Te][1])}if(se.tokenStack.length>0){const re=se.tokenStack[se.tokenStack.length-1];(re[1]||LA).call(se,void 0,re[0])}for(L.position={start:Fs(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:Fs(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<e.transforms.length;)L=e.transforms[Te](L)||L;return L}function i(Y,L,se){let ye=L-1,Te=-1,re=!1,Ke,Ze,at,pt;for(;++ye<=se;){const oe=Y[ye];switch(oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{oe[0]==="enter"?Te++:Te--,pt=void 0;break}case"lineEndingBlank":{oe[0]==="enter"&&(Ke&&!pt&&!Te&&!at&&(at=ye),pt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pt=void 0}if(!Te&&oe[0]==="enter"&&oe[1].type==="listItemPrefix"||Te===-1&&oe[0]==="exit"&&(oe[1].type==="listUnordered"||oe[1].type==="listOrdered")){if(Ke){let ct=ye;for(Ze=void 0;ct--;){const mt=Y[ct];if(mt[1].type==="lineEnding"||mt[1].type==="lineEndingBlank"){if(mt[0]==="exit")continue;Ze&&(Y[Ze][1].type="lineEndingBlank",re=!0),mt[1].type="lineEnding",Ze=ct}else if(!(mt[1].type==="linePrefix"||mt[1].type==="blockQuotePrefix"||mt[1].type==="blockQuotePrefixWhitespace"||mt[1].type==="blockQuoteMarker"||mt[1].type==="listItemIndent"))break}at&&(!Ze||at<Ze)&&(Ke._spread=!0),Ke.end=Object.assign({},Ze?Y[Ze][1].start:oe[1].end),Y.splice(Ze||ye,0,["exit",Ke,oe[2]]),ye++,se++}if(oe[1].type==="listItemPrefix"){const ct={type:"listItem",_spread:!1,start:Object.assign({},oe[1].start),end:void 0};Ke=ct,Y.splice(ye,0,["enter",ct,oe[2]]),ye++,se++,at=void 0,pt=!0}}}return Y[L][1]._spread=re,se}function s(Y,L){return se;function se(ye){c.call(this,Y(ye),ye),L&&L.call(this,ye)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(Y,L,se){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([L,se||void 0]),Y.position={start:Fs(L.start),end:void 0}}function f(Y){return L;function L(se){Y&&Y.call(this,se),d.call(this,se)}}function d(Y,L){const se=this.stack.pop(),ye=this.tokenStack.pop();if(ye)ye[0].type!==Y.type&&(L?L.call(this,Y,ye[0]):(ye[1]||LA).call(this,Y,ye[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Au({start:Y.start,end:Y.end})+"): it’s not open");se.position.end=Fs(Y.end)}function p(){return h$(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(Y){if(this.data.expectingFirstListItemValue){const L=this.stack[this.stack.length-2];L.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function b(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.lang=Y}function S(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.meta=Y}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.value=Y.replace(/(\r?\n|\r)$/g,"")}function H(Y){const L=this.resume(),se=this.stack[this.stack.length-1];se.label=L,se.identifier=Ma(this.sliceSerialize(Y)).toLowerCase()}function j(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.title=Y}function ne(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.url=Y}function $(Y){const L=this.stack[this.stack.length-1];if(!L.depth){const se=this.sliceSerialize(Y).length;L.depth=se}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(Y){const L=this.stack[this.stack.length-1];L.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function ae(Y){const se=this.stack[this.stack.length-1].children;let ye=se[se.length-1];(!ye||ye.type!=="text")&&(ye=Ft(),ye.position={start:Fs(Y.start),end:void 0},se.push(ye)),this.stack.push(ye)}function xe(Y){const L=this.stack.pop();L.value+=this.sliceSerialize(Y),L.position.end=Fs(Y.end)}function fe(Y){const L=this.stack[this.stack.length-1];if(this.data.atHardBreak){const se=L.children[L.children.length-1];se.position.end=Fs(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(L.type)&&(ae.call(this,Y),xe.call(this,Y))}function le(){this.data.atHardBreak=!0}function Q(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.value=Y}function ie(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.value=Y}function G(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.value=Y}function I(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=L,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function Z(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=L,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function me(Y){const L=this.sliceSerialize(Y),se=this.stack[this.stack.length-2];se.label=dq(L),se.identifier=Ma(L).toLowerCase()}function Ae(){const Y=this.stack[this.stack.length-1],L=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){const ye=Y.children;se.children=ye}else se.alt=L}function M(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.url=Y}function _(){const Y=this.resume(),L=this.stack[this.stack.length-1];L.title=Y}function B(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function X(Y){const L=this.resume(),se=this.stack[this.stack.length-1];se.label=L,se.identifier=Ma(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function he(Y){this.data.characterReferenceType=Y.type}function ge(Y){const L=this.sliceSerialize(Y),se=this.data.characterReferenceType;let ye;se?(ye=vD(L,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ye=X1(L);const Te=this.stack[this.stack.length-1];Te.value+=ye}function Re(Y){const L=this.stack.pop();L.position.end=Fs(Y.end)}function De(Y){xe.call(this,Y);const L=this.stack[this.stack.length-1];L.url=this.sliceSerialize(Y)}function Ue(Y){xe.call(this,Y);const L=this.stack[this.stack.length-1];L.url="mailto:"+this.sliceSerialize(Y)}function kt(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Fe(){return{type:"inlineCode",value:""}}function Ct(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Nt(){return{type:"emphasis",children:[]}}function _n(){return{type:"heading",depth:0,children:[]}}function bn(){return{type:"break"}}function $t(){return{type:"html",value:""}}function Kn(){return{type:"image",title:null,url:"",alt:null}}function kr(){return{type:"link",title:null,url:"",children:[]}}function Cr(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Wn(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Ni(){return{type:"paragraph",children:[]}}function zi(){return{type:"strong",children:[]}}function Ft(){return{type:"text",value:""}}function Li(){return{type:"thematicBreak"}}}function Fs(t){return{line:t.line,column:t.column,offset:t.offset}}function ND(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?ND(t,r):gq(t,r)}}function gq(t,e){let n;for(n in e)if(RD.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function LA(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Au({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Au({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Au({start:e.start,end:e.end})+") is still open")}function yq(t){const e=this;e.parser=n;function n(r){return pq(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function bq(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function xq(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
300
+ `}]}function Sq(t,e){const n=e.value?e.value+`
301
+ `:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function wq(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function vq(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function kq(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=rc(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let l,c=t.footnoteCounts.get(r);c===void 0?(c=0,t.footnoteOrder.push(r),l=t.footnoteOrder.length):l=s+1,c+=1,t.footnoteCounts.set(r,c);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return t.patch(e,d),t.applyData(e,d)}function Cq(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Eq(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function zD(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function Tq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return zD(t,e);const i={src:rc(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function Aq(t,e){const n={src:rc(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Mq(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Oq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return zD(t,e);const i={href:rc(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function _q(t,e){const n={href:rc(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Dq(t,e,n){const r=t.all(e),i=n?Rq(n):LD(e),s={},l=[];if(typeof e.checked=="boolean"){const p=r[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(i||c!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
302
+ `}),p.type==="element"&&p.tagName==="p"&&!i?l.push(...p.children):l.push(p)}const f=r[r.length-1];f&&(i||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
303
+ `});const d={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,d),t.applyData(e,d)}function Rq(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=LD(n[r])}return e}function LD(t){const e=t.spread;return e??t.children.length>1}function Nq(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function zq(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Lq(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function jq(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Iq(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=W1(e.children[1]),f=mD(e.children[e.children.length-1]);c&&f&&(l.position={start:c,end:f}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function Bq(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let f=-1;const d=[];for(;++f<c;){const m=e.children[f],g={},b=l?l[f]:void 0;b&&(g.align=b);let S={type:"element",tagName:s,properties:g,children:[]};m&&(S.children=t.all(m),t.patch(m,S),S=t.applyData(m,S)),d.push(S)}const p={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,p),t.applyData(e,p)}function Uq(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const jA=9,IA=32;function Hq(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(BA(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(BA(e.slice(i),i>0,!1)),s.join("")}function BA(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===jA||s===IA;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===jA||s===IA;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Vq(t,e){const n={type:"text",value:Hq(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Pq(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const $q={blockquote:bq,break:xq,code:Sq,delete:wq,emphasis:vq,footnoteReference:kq,heading:Cq,html:Eq,imageReference:Tq,image:Aq,inlineCode:Mq,linkReference:Oq,link:_q,listItem:Dq,list:Nq,paragraph:zq,root:Lq,strong:jq,table:Iq,tableCell:Uq,tableRow:Bq,text:Vq,thematicBreak:Pq,toml:ah,yaml:ah,definition:ah,footnoteDefinition:ah};function ah(){}const jD=-1,Am=0,Ou=1,qp=2,tS=3,nS=4,rS=5,iS=6,ID=7,BD=8,UA=typeof self=="object"?self:globalThis,Fq=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,l]=e[i];switch(s){case Am:case jD:return n(l,i);case Ou:{const c=n([],i);for(const f of l)c.push(r(f));return c}case qp:{const c=n({},i);for(const[f,d]of l)c[r(f)]=r(d);return c}case tS:return n(new Date(l),i);case nS:{const{source:c,flags:f}=l;return n(new RegExp(c,f),i)}case rS:{const c=n(new Map,i);for(const[f,d]of l)c.set(r(f),r(d));return c}case iS:{const c=n(new Set,i);for(const f of l)c.add(r(f));return c}case ID:{const{name:c,message:f}=l;return n(new UA[c](f),i)}case BD:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new UA[s](l),i)};return r},HA=t=>Fq(new Map,t)(0),la="",{toString:qq}={},{keys:Yq}=Object,nu=t=>{const e=typeof t;if(e!=="object"||!t)return[Am,e];const n=qq.call(t).slice(8,-1);switch(n){case"Array":return[Ou,la];case"Object":return[qp,la];case"Date":return[tS,la];case"RegExp":return[nS,la];case"Map":return[rS,la];case"Set":return[iS,la];case"DataView":return[Ou,n]}return n.includes("Array")?[Ou,n]:n.includes("Error")?[ID,n]:[qp,n]},ch=([t,e])=>t===Am&&(e==="function"||e==="symbol"),Kq=(t,e,n,r)=>{const i=(l,c)=>{const f=r.push(l)-1;return n.set(c,f),f},s=l=>{if(n.has(l))return n.get(l);let[c,f]=nu(l);switch(c){case Am:{let p=l;switch(f){case"bigint":c=BD,p=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+f);p=null;break;case"undefined":return i([jD],l)}return i([c,p],l)}case Ou:{if(f){let g=l;return f==="DataView"?g=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(g=new Uint8Array(l)),i([f,[...g]],l)}const p=[],m=i([c,p],l);for(const g of l)p.push(s(g));return m}case qp:{if(f)switch(f){case"BigInt":return i([f,l.toString()],l);case"Boolean":case"Number":case"String":return i([f,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const p=[],m=i([c,p],l);for(const g of Yq(l))(t||!ch(nu(l[g])))&&p.push([s(g),s(l[g])]);return m}case tS:return i([c,l.toISOString()],l);case nS:{const{source:p,flags:m}=l;return i([c,{source:p,flags:m}],l)}case rS:{const p=[],m=i([c,p],l);for(const[g,b]of l)(t||!(ch(nu(g))||ch(nu(b))))&&p.push([s(g),s(b)]);return m}case iS:{const p=[],m=i([c,p],l);for(const g of l)(t||!ch(nu(g)))&&p.push(s(g));return m}}const{message:d}=l;return i([c,{name:f,message:d}],l)};return s},VA=(t,{json:e,lossy:n}={})=>{const r=[];return Kq(!(e||n),!!e,new Map,r)(t),r},Yp=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?HA(VA(t,e)):structuredClone(t):(t,e)=>HA(VA(t,e));function Wq(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Gq(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Zq(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Wq,r=t.options.footnoteBackLabel||Gq,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let f=-1;for(;++f<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[f]);if(!d)continue;const p=t.all(d),m=String(d.identifier).toUpperCase(),g=rc(m.toLowerCase());let b=0;const S=[],v=t.footnoteCounts.get(m);for(;v!==void 0&&++b<=v;){S.length>0&&S.push({type:"text",value:" "});let H=typeof n=="string"?n:n(f,b);typeof H=="string"&&(H={type:"text",value:H}),S.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,b),className:["data-footnote-backref"]},children:Array.isArray(H)?H:[H]})}const C=p[p.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const H=C.children[C.children.length-1];H&&H.type==="text"?H.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...S)}else p.push(...S);const T={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(p,!0)};t.patch(d,T),c.push(T)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Yp(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
304
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
305
+ `}]}}const UD=(function(t){if(t==null)return eY;if(typeof t=="function")return Mm(t);if(typeof t=="object")return Array.isArray(t)?Jq(t):Xq(t);if(typeof t=="string")return Qq(t);throw new Error("Expected function, string, or object as test")});function Jq(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=UD(t[n]);return Mm(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Xq(t){const e=t;return Mm(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function Qq(t){return Mm(e);function e(n){return n&&n.type===t}}function Mm(t){return e;function e(n,r,i){return!!(tY(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function eY(){return!0}function tY(t){return t!==null&&typeof t=="object"&&"type"in t}const HD=[],nY=!0,PA=!1,rY="skip";function iY(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=UD(i),l=r?-1:1;c(t,void 0,[])();function c(f,d,p){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return g;function g(){let b=HD,S,v,C;if((!e||s(f,d,p[p.length-1]||void 0))&&(b=sY(n(f,p)),b[0]===PA))return b;if("children"in f&&f.children){const T=f;if(T.children&&b[0]!==rY)for(v=(r?T.children.length:-1)+l,C=p.concat(T);v>-1&&v<T.children.length;){const H=T.children[v];if(S=c(H,v,C)(),S[0]===PA)return S;v=typeof S[1]=="number"?S[1]:v+l}}return b}}}function sY(t){return Array.isArray(t)?t:typeof t=="number"?[nY,t]:t==null?HD:[t]}function VD(t,e,n,r){let i,s,l;typeof e=="function"&&typeof n!="function"?(s=void 0,l=e,i=n):(s=e,l=n,i=r),iY(t,s,c,i);function c(f,d){const p=d[d.length-1],m=p?p.children.indexOf(f):void 0;return l(f,m,p)}}const wx={}.hasOwnProperty,oY={};function lY(t,e){const n=e||oY,r=new Map,i=new Map,s=new Map,l={...$q,...n.handlers},c={all:d,applyData:cY,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:f,options:n,patch:aY,wrap:fY};return VD(t,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?r:i,g=String(p.identifier).toUpperCase();m.has(g)||m.set(g,p)}}),c;function f(p,m){const g=p.type,b=c.handlers[g];if(wx.call(c.handlers,g)&&b)return b(c,p,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in p){const{children:v,...C}=p,T=Yp(C);return T.children=c.all(p),T}return Yp(p)}return(c.options.unknownHandler||uY)(c,p,m)}function d(p){const m=[];if("children"in p){const g=p.children;let b=-1;for(;++b<g.length;){const S=c.one(g[b],p);if(S){if(b&&g[b-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=$A(S.value)),!Array.isArray(S)&&S.type==="element")){const v=S.children[0];v&&v.type==="text"&&(v.value=$A(v.value))}Array.isArray(S)?m.push(...S):m.push(S)}}}return m}}function aY(t,e){t.position&&(e.position=q7(t))}function cY(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,Yp(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function uY(t,e){const n=e.data||{},r="value"in e&&!(wx.call(n,"hProperties")||wx.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function fY(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
306
+ `});++r<t.length;)r&&n.push({type:"text",value:`
307
+ `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
308
+ `}),n}function $A(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function FA(t,e){const n=lY(t,e),r=n.one(t,void 0),i=Zq(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
309
+ `},i),s}function dY(t,e){return t&&"run"in t?async function(n,r){const i=FA(n,{file:r,...e});await t.run(i,r)}:function(n,r){return FA(n,{file:r,...t||e})}}function qA(t){if(t)throw t}var q0,YA;function hY(){if(YA)return q0;YA=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},s=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var p=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!m)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},l=function(d,p){n&&p.name==="__proto__"?n(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},c=function(d,p){if(p==="__proto__")if(t.call(d,p)){if(r)return r(d,p).value}else return;return d[p]};return q0=function f(){var d,p,m,g,b,S,v=arguments[0],C=1,T=arguments.length,H=!1;for(typeof v=="boolean"&&(H=v,v=arguments[1]||{},C=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});C<T;++C)if(d=arguments[C],d!=null)for(p in d)m=c(v,p),g=c(d,p),v!==g&&(H&&g&&(s(g)||(b=i(g)))?(b?(b=!1,S=m&&i(m)?m:[]):S=m&&s(m)?m:{},l(v,{name:p,newValue:f(H,S,g)})):typeof g<"u"&&l(v,{name:p,newValue:g}));return v},q0}var pY=hY();const Y0=Wp(pY);function vx(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function mY(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(f,...d){const p=t[++s];let m=-1;if(f){l(f);return}for(;++m<i.length;)(d[m]===null||d[m]===void 0)&&(d[m]=i[m]);i=d,p?gY(p,c)(...d):l(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function gY(t,e){let n;return r;function r(...l){const c=t.length>l.length;let f;c&&l.push(i);try{f=t.apply(this,l)}catch(d){const p=d;if(c&&n)throw p;return i(p)}c||(f&&f.then&&typeof f.then=="function"?f.then(s,i):f instanceof Error?i(f):s(f))}function i(l,...c){n||(n=!0,e(l,...c))}function s(l){i(null,l)}}const bi={basename:yY,dirname:bY,extname:xY,join:SY,sep:"/"};function yY(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');kf(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else l<0&&(s=!0,l=i+1),c>-1&&(t.codePointAt(i)===e.codePointAt(c--)?c<0&&(r=i):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function bY(t){if(kf(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function xY(t){kf(t);let e=t.length,n=-1,r=0,i=-1,s=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function SY(...t){let e=-1,n;for(;++e<t.length;)kf(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":wY(n)}function wY(t){kf(t);const e=t.codePointAt(0)===47;let n=vY(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function vY(t,e){let n="",r=0,i=-1,s=0,l=-1,c,f;for(;++l<=t.length;){if(l<t.length)c=t.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,l):n=t.slice(i+1,l),r=l-i-1;i=l,s=0}else c===46&&s>-1?s++:s=-1}return n}function kf(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const kY={cwd:CY};function CY(){return"/"}function kx(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function EY(t){if(typeof t=="string")t=new URL(t);else if(!kx(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return TY(t)}function TY(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const K0=["history","path","basename","stem","extname","dirname"];class PD{constructor(e){let n;e?kx(e)?n={path:e}:typeof e=="string"||AY(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":kY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<K0.length;){const s=K0[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)K0.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?bi.basename(this.path):void 0}set basename(e){G0(e,"basename"),W0(e,"basename"),this.path=bi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?bi.dirname(this.path):void 0}set dirname(e){KA(this.basename,"dirname"),this.path=bi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?bi.extname(this.path):void 0}set extname(e){if(W0(e,"extname"),KA(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=bi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){kx(e)&&(e=EY(e)),G0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?bi.basename(this.path,this.extname):void 0}set stem(e){G0(e,"stem"),W0(e,"stem"),this.path=bi.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new Un(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function W0(t,e){if(t&&t.includes(bi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+bi.sep+"`")}function G0(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function KA(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function AY(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const MY=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),OY={}.hasOwnProperty;class sS extends MY{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=mY()}copy(){const e=new sS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Y0(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(X0("data",this.frozen),this.namespace[e]=n,this):OY.call(this.namespace,e)&&this.namespace[e]||void 0:e?(X0("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=uh(e),r=this.parser||this.Parser;return Z0("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Z0("process",this.parser||this.Parser),J0("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=uh(e),f=r.parse(c);r.run(f,c,function(p,m,g){if(p||!m||!g)return d(p);const b=m,S=r.stringify(b,g);RY(S)?g.value=S:g.result=S,d(p,g)});function d(p,m){p||!m?l(p):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),Z0("processSync",this.parser||this.Parser),J0("processSync",this.compiler||this.Compiler),this.process(e,i),GA("processSync","process",n),r;function i(s,l){n=!0,qA(s),r=l}}run(e,n,r){WA(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,c){const f=uh(n);i.run(e,f,d);function d(p,m,g){const b=m||e;p?c(p):l?l(b):r(void 0,b,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),GA("runSync","run",r),i;function s(l,c){qA(l),i=c,r=!0}}stringify(e,n){this.freeze();const r=uh(n),i=this.compiler||this.Compiler;return J0("stringify",i),WA(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(X0("use",this.frozen),e!=null)if(typeof e=="function")f(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(d){if(typeof d=="function")f(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...m]=d;f(p,m)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(d.plugins),d.settings&&(i.settings=Y0(!0,i.settings,d.settings))}function c(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const m=d[p];s(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function f(d,p){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===d){g=m;break}if(g===-1)r.push([d,...p]);else if(p.length>0){let[b,...S]=p;const v=r[g][1];vx(v)&&vx(b)&&(b=Y0(!0,v,b)),r[g]=[d,b,...S]}}}}const _Y=new sS().freeze();function Z0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function J0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function X0(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function WA(t){if(!vx(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function GA(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function uh(t){return DY(t)?t:new PD(t)}function DY(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function RY(t){return typeof t=="string"||NY(t)}function NY(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const zY="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ZA=[],JA={allowDangerousHtml:!0},LY=/^(https?|ircs?|mailto|xmpp)$/i,jY=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function IY(t){const e=BY(t),n=UY(t);return HY(e.runSync(e.parse(n),n),t)}function BY(t){const e=t.rehypePlugins||ZA,n=t.remarkPlugins||ZA,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...JA}:JA;return _Y().use(yq).use(n).use(dY,r).use(e)}function UY(t){const e=t.children||"",n=new PD;return typeof e=="string"&&(n.value=e),n}function HY(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,f=e.urlTransform||VY;for(const p of jY)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+zY+p.id,void 0);return VD(t,d),Z7(t,{Fragment:k.Fragment,components:i,ignoreInvalidStyle:!0,jsx:k.jsx,jsxs:k.jsxs,passKeys:!0,passNode:!0});function d(p,m,g){if(p.type==="raw"&&g&&typeof m=="number")return l?g.children.splice(m,1):g.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let b;for(b in P0)if(Object.hasOwn(P0,b)&&Object.hasOwn(p.properties,b)){const S=p.properties[b],v=P0[b];(v===null||v.includes(p.tagName))&&(p.properties[b]=f(String(S||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(p,m,g)),b&&g&&typeof m=="number")return c&&p.children?g.children.splice(m,1,...p.children):g.children.splice(m,1),m}}}function VY(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||LY.test(t.slice(0,e))?t:""}const PY={width:"5px",height:"5px",borderRadius:"50%",background:Tx},$Y=[0,.2,.4];function Q0({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:l,capturedAnchor:c,onCapturedAnchorChange:f,inputRef:d}){const[p,m]=O.useState([]),[g,b]=O.useState(""),S=O.useRef(null),v=O.useRef(null);O.useEffect(()=>{d&&(d.current=v.current)},[d]),O.useEffect(()=>{if(!t)return;const D=t.getMap(hC),K=()=>{const ae=[];D.forEach(xe=>{ae.push(xe)}),ae.sort((xe,fe)=>xe.timestamp-fe.timestamp||xe.id.localeCompare(fe.id)),m(ae)};return D.observe(K),K(),()=>D.unobserve(K)},[t]);const C=O.useRef(!1);O.useEffect(()=>{var D;if(!i&&C.current){C.current=!1;return}C.current=!!i,(D=S.current)==null||D.scrollIntoView({behavior:"smooth"})},[p,i]),O.useEffect(()=>{var D;l&&((D=S.current)==null||D.scrollIntoView({behavior:"smooth"}))},[l]);const T=O.useCallback(()=>{if(!t||!g.trim())return;const D=t.getMap(hC),K={id:AV(),author:"user",text:g.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};D.set(K.id,K),b(""),f(null)},[t,g,n,c,f]),H=O.useCallback(D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),T())},[T]),j=O.useCallback((D,K)=>{if(!(!e||K&&K!==n))try{const ae=pl(e.state.doc,D.from),xe=pl(e.state.doc,D.to);e.chain().focus().setTextSelection({from:ae,to:xe}).scrollIntoView().run()}catch(ae){console.warn("[ChatPanel] Could not scroll to anchor:",ae instanceof Error?ae.message:ae)}},[e,n]),ne=D=>{if(!D)return null;const K=r.find(ae=>ae.id===D);return(K==null?void 0:K.fileName)??null},$=p.filter(D=>D.author==="claude"&&!D.read).length,N=O.useCallback(async()=>{try{await fetch(`http://localhost:${Ya}/api/chat`,{method:"DELETE"})}catch(D){console.warn("[ChatPanel] Failed to clear chat:",D)}},[]);return k.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"#fafafa",flex:1,minHeight:0},children:[k.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e5e7eb",fontWeight:600,fontSize:"14px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Chat",k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[$>0&&k.jsx("span",{style:{background:"#6366f1",color:"white",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:$}),p.length>0&&k.jsx("button",{onClick:N,title:"Clear chat history","data-testid":"clear-chat-btn",style:{background:"none",border:"none",cursor:"pointer",color:"#9ca3af",fontSize:"13px",padding:"2px 4px",lineHeight:1},children:"Clear"})]})]}),k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[p.length===0&&k.jsx("div",{style:{color:"#9ca3af",fontSize:"13px",textAlign:"center",marginTop:"24px"},children:"No messages yet. Select text and send a message to Claude."}),p.map(D=>k.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:D.author==="user"?"#eef2ff":"#ffffff",border:"1px solid "+(D.author==="user"?"#c7d2fe":"#e5e7eb"),fontSize:"13px"},children:[k.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[k.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:D.author==="claude"?"#6366f1":"#374151",textTransform:"uppercase"},children:D.author}),D.documentId&&k.jsx("span",{style:{fontSize:"10px",color:"#6b7280",background:"#f3f4f6",padding:"1px 6px",borderRadius:"4px"},children:ne(D.documentId)??D.documentId}),k.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",marginLeft:"auto"},children:new Date(D.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),D.anchor&&k.jsx("div",{onClick:()=>j(D.anchor,D.documentId),className:"chat-anchor-quote",style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid #c7d2fe",background:"#f5f3ff",fontSize:"12px",color:"#4338ca",cursor:"pointer",borderRadius:"0 4px 4px 0",maxHeight:"60px",overflow:"hidden",transition:"max-height 0.3s ease"},title:"Click to scroll to this text",onMouseEnter:K=>{K.currentTarget.style.maxHeight="500px"},onMouseLeave:K=>{K.currentTarget.style.maxHeight="60px"},children:D.anchor.textSnapshot}),D.author==="claude"?k.jsx("div",{className:"chat-markdown",children:k.jsx(IY,{children:D.text})}):k.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:D.text})]},D.id)),i&&k.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:Tx,display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:$Y.map(D=>k.jsx("span",{style:{...PY,animation:`tandem-typing-bounce 1.2s ease-in-out ${D}s infinite`}},D))}),k.jsx("span",{children:s??"Claude is thinking..."})]}),k.jsx("div",{ref:S})]}),c&&k.jsxs("div",{style:{padding:"4px 12px",background:"#eef2ff",borderTop:"1px solid #c7d2fe",fontSize:"11px",color:"#4338ca",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),k.jsx("button",{onClick:()=>f(null),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",fontSize:"14px"},children:"x"})]}),k.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid #e5e7eb",display:"flex",gap:"8px"},children:[k.jsx("textarea",{ref:v,value:g,onChange:D=>b(D.target.value),onKeyDown:H,placeholder:"Message Claude...",rows:2,style:{flex:1,padding:"8px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"13px",resize:"none",outline:"none",fontFamily:"inherit"}}),k.jsx("button",{onClick:T,disabled:!g.trim(),style:{padding:"8px 12px",background:g.trim()?"#6366f1":"#d1d5db",color:"white",border:"none",borderRadius:"6px",cursor:g.trim()?"pointer":"default",fontSize:"13px",fontWeight:500,alignSelf:"flex-end"},children:"Send"})]}),k.jsx("style",{children:`
310
+ @keyframes tandem-typing-bounce {
311
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
312
+ 30% { transform: translateY(-4px); opacity: 1; }
313
+ }
314
+ `})]})}function FY({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return k.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.4)",zIndex:1e3},onClick:r,children:k.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"32px 40px",maxWidth:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)",textAlign:"center"},onClick:s=>s.stopPropagation(),children:[k.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),k.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"#111827"},children:"Review Complete"}),k.jsx("p",{style:{margin:"0 0 20px",color:"#6b7280",fontSize:"14px"},children:"All annotations have been resolved."}),k.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[k.jsxs("div",{children:[k.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"#16a34a"},children:t}),k.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Accepted"})]}),k.jsx("div",{style:{width:"1px",background:"#e5e7eb"}}),k.jsxs("div",{children:[k.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"#dc2626"},children:e}),k.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Dismissed"})]}),k.jsx("div",{style:{width:"1px",background:"#e5e7eb"}}),k.jsxs("div",{children:[k.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"#6366f1"},children:[i,"%"]}),k.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Accept rate"})]})]}),k.jsx("button",{onClick:r,style:{padding:"8px 24px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",background:"#6366f1",color:"white",cursor:"pointer"},children:"Done"})]})})}function qY({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=O.useState(!1);if(e!=="docx")return null;const s=t.filter(d=>d.status==="accepted"),l=t.filter(d=>d.status==="pending"),c=s.length===0||r;async function f(){if(c||!n)return;let d=`Apply ${s.length} change(s) as tracked revisions?
315
+
316
+ The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
317
+
318
+ Your original file will be backed up.`;if(l.length>0&&(d+=`
319
+
320
+ ⚠ ${l.length} annotation(s) are still pending review and will not be applied.`),!!confirm(d)){i(!0);try{const p=await fetch(`${zu}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await p.json().catch(b=>(console.error("[ApplyChanges] Failed to parse response JSON:",b),null));if(!p.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${p.status}).`);return}const g=m==null?void 0:m.data;if(g){const b=[`Applied ${g.applied??0} tracked change(s).`];g.rejected>0&&b.push(`${g.rejected} could not be applied.`),g.backupPath&&b.push(`
321
+ Backup saved to:
322
+ ${g.backupPath}`),alert(b.join(" "))}else alert("Changes applied successfully.")}catch(p){console.error("[ApplyChanges] Request failed:",p),alert(p instanceof TypeError?"Could not reach the server.":`Apply failed: ${p instanceof Error?p.message:String(p)}`)}finally{i(!1)}}}return k.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:f,disabled:c,title:s.length===0?"No accepted suggestions to apply":void 0,style:{width:"100%",padding:"6px 12px",fontSize:"12px",fontWeight:500,border:"1px solid #bfdbfe",borderRadius:"4px",background:c?"#f3f4f6":"#2563eb",color:c?"#9ca3af":"white",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}function YY(t,e){O.useEffect(()=>{function n(r){if(r.ctrlKey&&r.shiftKey&&r.key==="R"){r.preventDefault(),e.onToggleReviewMode();return}if(t)if(r.key==="Tab"&&!r.ctrlKey&&!r.altKey)r.preventDefault(),e.navigateReview(r.shiftKey?"prev":"next");else if(r.key==="y"||r.key==="Y"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.acceptCurrent()}else if(r.key==="n"||r.key==="N"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.dismissCurrent()}else if(r.key==="z"||r.key==="Z"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.undoLast()}else if(r.key==="e"||r.key==="E"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.scrollToCurrentAndExit()}else r.key==="Escape"&&e.cancelBulkOrExit()}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}function KY(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const s=Math.floor(i/60);return s<24?`${s}h ago`:e.toLocaleDateString()}function WY({replies:t}){return t.length===0?null:k.jsx("div",{"data-testid":"comment-thread",style:{marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid #e5e7eb"},children:t.map(e=>k.jsxs("div",{"data-testid":`reply-${e.id}`,style:{padding:"4px 0",fontSize:"12px",lineHeight:"1.4"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[k.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:e.author==="claude"?"#6366f1":"#374151"},children:e.author==="claude"?"Claude":"You"}),k.jsxs("span",{style:{fontSize:"10px",color:"#9ca3af"},children:[e.editedAt&&k.jsx("span",{style:{fontStyle:"italic",marginRight:"4px"},children:"(edited)"}),KY(e.timestamp)]})]}),k.jsx("p",{style:{margin:0,color:"#4b5563"},children:e.text})]},e.id))})}function GY(t){return t.color?_u[t.color]||"#e5e7eb":t.suggestedText!==void 0?"#8b5cf6":t.directedAt==="claude"?"#6366f1":t.type==="flag"?"#ef4444":"#3b82f6"}const XA=un.memo(function({annotation:e,replies:n=[],isReviewTarget:r,onAccept:i,onDismiss:s,onUndo:l,onEdit:c,onReply:f,undoable:d,onClick:p}){const m=GY(e),g=e.status==="pending",[b,S]=O.useState(!1),[v,C]=O.useState(""),[T,H]=O.useState(""),[j,ne]=O.useState(""),[$,N]=O.useState(!1),[D,K]=O.useState(""),[ae,xe]=O.useState(!1),fe=e.suggestedText!==void 0;function le(){fe?(H(e.suggestedText??""),ne(e.content)):C(e.content),S(!0)}function Q(){const E=fe?JSON.stringify({suggestedText:T,content:j}):v;c==null||c(e.id,E),S(!1)}function ie(){S(!1)}function G(E){E.key==="Escape"&&(E.stopPropagation(),ie())}function I(E){E.key==="Escape"&&(E.stopPropagation(),N(!1),K(""))}async function Z(){const E=D.trim();if(!(!E||ae)){xe(!0);try{await(f==null?void 0:f(e.id,E))!==!1&&(K(""),N(!1))}finally{xe(!1)}}}const me={width:"100%",padding:"4px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",resize:"vertical",fontFamily:"inherit",minHeight:"40px",boxSizing:"border-box"},Ae={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"#9ca3af",cursor:"pointer",lineHeight:1},M=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",_=fe?"replacement":e.directedAt==="claude"?"question":e.type,B=`${_} annotation${M?": "+M:""}, ${e.status}`;return k.jsxs("div",{onClick:p,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":B,"aria-current":r?"true":void 0,style:{padding:"8px 10px",marginBottom:"6px",borderLeft:`3px solid ${m}`,background:r?"#eef2ff":"white",borderRadius:"0 4px 4px 0",fontSize:"13px",opacity:g?1:.6,cursor:p?"pointer":"default",outline:r?"2px solid #6366f1":"none",transition:"background 0.15s, outline 0.15s"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[k.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[_,!g&&k.jsx("span",{style:{marginLeft:"6px",fontSize:"10px",color:e.status==="accepted"?"#16a34a":"#dc2626",fontWeight:600},children:e.status}),g&&c&&!r&&!b&&k.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:E=>{E.stopPropagation(),le()},style:Ae,title:"Edit this annotation's content",children:"✎ Edit"})]}),k.jsxs("span",{style:{fontSize:"11px",color:"#9ca3af",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&k.jsx("span",{style:{fontStyle:"italic",fontSize:"10px",color:"#b0b0b0"},children:"(edited)"}),e.author==="claude"?"Claude":e.author==="import"?"Imported":"You"]})]}),e.textSnapshot&&k.jsx("div",{"data-testid":`annotation-snippet-${e.id}`,style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid #d1d5db",color:"#6b7280",fontSize:"12px",fontStyle:"italic",backgroundColor:"#f9fafb",borderRadius:"2px"},children:e.textSnapshot.length>80?e.textSnapshot.slice(0,77)+"...":e.textSnapshot}),b?k.jsxs("div",{style:{marginTop:"4px"},onClick:E=>E.stopPropagation(),children:[fe?k.jsxs(k.Fragment,{children:[k.jsx("label",{style:{fontSize:"11px",color:"#6b7280",display:"block",marginBottom:"2px"},children:"Replacement text"}),k.jsx("textarea",{"data-testid":`edit-newtext-${e.id}`,value:T,onChange:E=>H(E.target.value),onKeyDown:G,style:me,autoFocus:!0}),k.jsx("label",{style:{fontSize:"11px",color:"#6b7280",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),k.jsx("textarea",{"data-testid":`edit-reason-${e.id}`,value:j,onChange:E=>ne(E.target.value),onKeyDown:G,style:me})]}):k.jsx("textarea",{"data-testid":`edit-text-${e.id}`,value:v,onChange:E=>C(E.target.value),onKeyDown:G,style:me,autoFocus:!0}),k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[k.jsx("button",{"data-testid":`edit-save-btn-${e.id}`,onClick:E=>{E.stopPropagation(),Q()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#f0fdf4",color:"#166534",cursor:"pointer"},children:"Save"}),k.jsx("button",{"data-testid":`edit-cancel-btn-${e.id}`,onClick:E=>{E.stopPropagation(),ie()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fff",color:"#6b7280",cursor:"pointer"},children:"Cancel"})]})]}):k.jsx("div",{style:{margin:0,color:"#4b5563",lineHeight:"1.4"},children:fe?k.jsxs(k.Fragment,{children:[k.jsxs("div",{"data-testid":`suggestion-diff-${e.id}`,style:{padding:"4px 8px",marginBottom:e.content?"4px":0,backgroundColor:"#f9fafb",borderRadius:"3px",fontSize:"12px",lineHeight:"1.5"},children:[e.textSnapshot&&k.jsx("span",{style:{textDecoration:"line-through",color:"#dc2626",backgroundColor:"#fef2f2",padding:"0 2px",borderRadius:"2px"},children:e.textSnapshot}),e.textSnapshot&&" → ",k.jsx("span",{style:{color:"#166534",backgroundColor:"#f0fdf4",padding:"0 2px",borderRadius:"2px"},children:e.suggestedText})]}),e.content&&k.jsx("p",{style:{margin:0,fontSize:"12px",color:"#6b7280"},children:e.content})]}):k.jsx("p",{style:{margin:0},children:e.content||"(no note)"})}),g&&!b&&(i||s)&&k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[i&&k.jsx("button",{"data-testid":`accept-btn-${e.id}`,onClick:E=>{E.stopPropagation(),i(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#f0fdf4",color:"#166534",cursor:"pointer"},children:"Accept"}),s&&k.jsx("button",{"data-testid":`dismiss-btn-${e.id}`,onClick:E=>{E.stopPropagation(),s(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fef2f2",color:"#991b1b",cursor:"pointer"},children:"Reject"})]}),!g&&d&&l&&k.jsxs("div",{style:{marginTop:"4px",position:"relative"},children:[k.jsx("button",{"data-testid":"undo-btn",onClick:E=>{E.stopPropagation(),l(e.id)},style:{padding:"1px 6px",fontSize:"11px",border:"none",background:"none",color:"#6366f1",cursor:"pointer",textDecoration:"underline"},children:"Undo"}),k.jsx("div",{"data-testid":"undo-countdown",style:{height:"2px",marginTop:"2px",borderRadius:"1px",backgroundColor:"#6366f1",animation:"undo-countdown-shrink 10s linear forwards"}}),k.jsx("style",{children:`@keyframes undo-countdown-shrink {
323
+ from { width: 100%; }
324
+ to { width: 0%; }
325
+ }`})]}),k.jsx(WY,{replies:n}),g&&f&&!b&&k.jsx("div",{style:{marginTop:"6px"},onClick:E=>E.stopPropagation(),children:$?k.jsxs("div",{children:[k.jsx("textarea",{"data-testid":`reply-input-${e.id}`,value:D,onChange:E=>K(E.target.value),onKeyDown:I,placeholder:"Write a reply...",style:me,autoFocus:!0}),k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[k.jsx("button",{"data-testid":`reply-send-btn-${e.id}`,onClick:Z,disabled:!D.trim()||ae,style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:D.trim()?"#eef2ff":"#f3f4f6",color:D.trim()?"#4338ca":"#9ca3af",cursor:D.trim()?"pointer":"default"},children:"Send"}),k.jsx("button",{"data-testid":`reply-cancel-btn-${e.id}`,onClick:()=>{N(!1),K("")},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fff",color:"#6b7280",cursor:"pointer"},children:"Cancel"})]})]}):k.jsxs("button",{"data-testid":`reply-btn-${e.id}`,onClick:()=>N(!0),style:{padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"#9ca3af",cursor:"pointer"},children:["Reply",n.length>0?` (${n.length})`:""]})}),!g&&n.length>0&&!f&&k.jsxs("div",{style:{marginTop:"4px",fontSize:"11px",color:"#9ca3af"},children:[n.length," ",n.length===1?"reply":"replies"]})]})});function eb({value:t,onChange:e,options:n,testId:r}){return k.jsx("select",{"data-testid":r,value:t,onChange:i=>e(i.target.value),style:{padding:"2px 4px",fontSize:"11px",border:"1px solid #e5e7eb",borderRadius:"3px",background:"#fff",color:"#374151",cursor:"pointer"},children:n.map(i=>k.jsx("option",{value:i.value,children:i.label},i.value))})}const fh={padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",cursor:"pointer"};function ZY(t,e,n){if(t.suggestedText===void 0)return!1;const r=t.suggestedText,i=Vp(t,e.state.doc,n);if(!i)return console.warn("[SidePanel] Could not resolve range for suggestion",t.id),!1;try{e.chain().focus().deleteRange({from:i.from,to:i.to}).insertContentAt(i.from,r).run()}catch(s){return console.error("[SidePanel] Editor mutation failed for suggestion",t.id,s),!1}return!0}function tb({annotations:t,editor:e,ydoc:n,heldCount:r=0,tandemMode:i,onModeChange:s,activeDocFormat:l,documentId:c,reviewMode:f,onToggleReviewMode:d,onExitReviewMode:p,activeAnnotationId:m,onActiveAnnotationChange:g}){const[b,S]=O.useState("all"),[v,C]=O.useState("all"),[T,H]=O.useState("all"),[j,ne]=O.useState(0),$=O.useRef(0),[N,D]=O.useState(null),K=O.useRef(N);K.current=N;const ae=O.useRef(null),[xe,fe]=O.useState(new Set),le=O.useRef(null),Q=O.useRef(new Map);O.useEffect(()=>{const L=Q.current;return()=>{for(const se of L.values())clearTimeout(se)}},[]);const ie=O.useRef(n),G=O.useRef(e);ie.current=n,G.current=e;const[I,Z]=O.useState(new Map);O.useEffect(()=>{if(!n){Z(new Map);return}const L=n.getMap(Az);function se(){const Te=new Map;L.forEach(re=>{const Ke=re;if(Ke&&typeof Ke=="object"&&Ke.annotationId){const Ze=Te.get(Ke.annotationId)??[];Ze.push(Ke),Te.set(Ke.annotationId,Ze)}});for(const re of Te.values())re.sort((Ke,Ze)=>Ke.timestamp-Ze.timestamp);Z(Te)}se();const ye=()=>se();return L.observe(ye),()=>L.unobserve(ye)},[n]);const{filtered:me,pending:Ae,resolved:M,allPending:_}=O.useMemo(()=>{const L=[],se=[];for(const re of t){re.status==="pending"&&se.push(re);let Ke;b==="all"?Ke=!0:b==="with-replacement"?Ke=re.suggestedText!==void 0:b==="for-claude"?Ke=re.directedAt==="claude":Ke=re.type===b;const Ze=v==="all"||re.author===v,at=T==="all"||re.status===T;Ke&&Ze&&at&&L.push(re)}const ye=L.filter(re=>re.status==="pending"),Te=L.filter(re=>re.status!=="pending");return{filtered:L,pending:ye,resolved:Te,allPending:se}},[t,b,v,T]),B=_,E=O.useRef(B);E.current=B;function X(L,se){const ye=ie.current;if(!ye)return;const Te=ye.getMap(ga),re=Te.get(L);if(!re)return;const Ke=vu(re);if(Te.set(L,{...Ke,status:se}),se==="accepted"&&Ke.suggestedText!==void 0&&G.current&&!ZY(Ke,G.current,ie.current)){Te.set(L,{...Ke,status:"pending"});return}le.current=L,fe(pt=>new Set(pt).add(L));const Ze=Q.current.get(L);Ze&&clearTimeout(Ze);const at=setTimeout(()=>{Q.current.delete(L),fe(pt=>{const oe=new Set(pt);return oe.delete(L),oe}),le.current===L&&(le.current=null)},1e4);Q.current.set(L,at)}function he(L){const se=ie.current;if(!se)return;const ye=se.getMap(ga),Te=ye.get(L);if(!Te||Te.status==="pending")return;const re=vu(Te);if(re.status==="accepted"&&re.suggestedText!==void 0&&G.current)try{const Ze=re.suggestedText,at=re.textSnapshot;if(typeof Ze=="string"&&typeof at=="string"){const pt=Vp(re,G.current.state.doc,se);if(!pt){console.warn(`[undo] Cannot resolve range for annotation ${L}, skipping`);return}if(G.current.state.doc.textBetween(pt.from,pt.to)!==Ze){console.warn(`[undo] Text changed since accept for annotation ${L}, skipping`);return}G.current.chain().focus().deleteRange({from:pt.from,to:pt.to}).insertContentAt(pt.from,at).run()}}catch(Ze){console.warn(`[undo] Failed to revert text for annotation ${L}:`,Ze);return}ye.set(L,{...re,status:"pending"});const Ke=Q.current.get(L);Ke&&(clearTimeout(Ke),Q.current.delete(L)),fe(Ze=>{const at=new Set(Ze);return at.delete(L),at}),le.current===L&&(le.current=null)}function ge(L){X(L,"accepted")}function Re(L){X(L,"dismissed")}function De(L){he(L)}function Ue(L,se){const ye=ie.current;if(!ye)return;const Te=ye.getMap(ga),re=Te.get(L);if(!re)return;const Ke=vu(re);if(Ke.suggestedText!==void 0){try{const Ze=JSON.parse(se);Te.set(L,{...Ke,suggestedText:Ze.suggestedText,content:Ze.content,editedAt:Date.now()})}catch{console.warn(`[SidePanel] Failed to parse edit payload for annotation ${L}`)}return}Te.set(L,{...Ke,content:se,editedAt:Date.now()})}async function kt(L,se){try{const ye=await fetch(`http://localhost:${Ya}/api/annotation-reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:L,text:se,documentId:c})});if(!ye.ok){const Te=await ye.json().catch(()=>({}));return console.warn(`[SidePanel] Reply failed (${ye.status}): ${Te.message??"unknown error"}`),!1}return!0}catch(ye){return console.error("[SidePanel] Reply request failed:",ye),!1}}function Ee(){for(const L of Ae)X(L.id,"accepted");D(null)}function Fe(){for(const L of Ae)X(L.id,"dismissed");D(null)}const Ct=O.useCallback(L=>{const se=G.current;if(!se)return;const ye=Vp(L,se.state.doc,ie.current);if(!ye)return;se.chain().focus().setTextSelection({from:ye.from,to:ye.to}).run();const Te=se.view.domAtPos(ye.from),re=Te.node instanceof HTMLElement?Te.node:Te.node.parentElement;re==null||re.scrollIntoView({behavior:"smooth",block:"center"})},[]),Nt=O.useCallback(L=>{const se=E.current;if(se.length===0)return;let ye=$.current;ye=L==="next"?(ye+1)%se.length:(ye-1+se.length)%se.length,$.current=ye,ne(ye),Ct(se[ye])},[Ct]),_n=O.useCallback(()=>{const L=E.current;if(L.length===0)return;const se=L[$.current];se&&X(se.id,"accepted")},[]),bn=O.useCallback(()=>{const L=E.current;if(L.length===0)return;const se=L[$.current];se&&X(se.id,"dismissed")},[]),$t=O.useRef(!1);O.useEffect(()=>{f&&!$t.current&&B.length>0&&($.current=0,ne(0),Ct(B[0])),$t.current=f},[f,B,Ct]),O.useEffect(()=>{var L;f&&B.length>0?g(((L=B[j])==null?void 0:L.id)??null):g(null)},[f,j,B,g]);const Kn=O.useCallback(()=>{const se=E.current[$.current];se&&Ct(se),p()},[Ct,p]),kr=O.useCallback(()=>{const L=le.current;L&&he(L)},[]),Cr=O.useCallback(()=>{K.current?D(null):p()},[p]),Wn=O.useMemo(()=>({onToggleReviewMode:d,onExitReviewMode:p,navigateReview:Nt,acceptCurrent:_n,dismissCurrent:bn,scrollToCurrentAndExit:Kn,cancelBulkOrExit:Cr,undoLast:kr}),[d,p,Nt,_n,bn,Kn,Cr,kr]);YY(f,Wn),O.useEffect(()=>{var L;N&&((L=ae.current)==null||L.focus())},[N]),O.useEffect(()=>{D(null)},[b,v,T]);const Ni=O.useRef(null),zi=O.useRef(!1),Ft=O.useRef(m);Ft.current=m,O.useEffect(()=>{var se;if(!zi.current){zi.current=!0;return}const L=Ft.current;if(L){const ye=document.querySelector(`[data-testid="annotation-card-${L}"]`);if(ye){ye.scrollIntoView({block:"center"});return}console.warn(`[tandem] SidePanel: active annotation ${L} not found on filter change; scrolling to top`)}(se=Ni.current)==null||se.scrollTo({top:0})},[b,v,T]),O.useEffect(()=>{if(f&&$.current>=B.length){const L=Math.max(0,B.length-1);$.current=L,ne(L)}},[f,B.length]),O.useEffect(()=>{f&&B.length===0&&p()},[f,B.length,p]),O.useEffect(()=>{if(!m)return;const L=setTimeout(()=>{const se=document.querySelector(`[data-testid="annotation-card-${m}"]`);if(se){se.scrollIntoView({behavior:"smooth",block:"nearest"}),se.classList.add("tandem-annotation-flash");const ye=()=>se.classList.remove("tandem-annotation-flash");se.addEventListener("animationend",ye,{once:!0})}else console.warn(`[tandem] SidePanel: active annotation ${m} not found after 50ms delay; scroll-to-card skipped`)},50);return()=>clearTimeout(L)},[m]);const Li=b!=="all"||v!=="all"||T!=="all",Y=f&&B.length>0?B[j]:null;return k.jsxs("div",{ref:Ni,"data-testid":"annotation-list-scroll-container",style:{width:"100%",background:"#fafafa",display:"flex",flexDirection:"column",overflowY:"auto"},children:[r>0&&k.jsxs("div",{style:{padding:"6px 16px",background:"#fef3c7",borderBottom:"1px solid #fde68a",fontSize:"12px",color:"#92400e",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{"data-testid":"held-banner",children:[r," annotation",r!==1?"s":""," held"]}),k.jsx("button",{onClick:()=>s==null?void 0:s("tandem"),style:{fontSize:"11px",padding:"1px 8px",border:"1px solid #fbbf24",borderRadius:"4px",background:"#fff",color:"#92400e",cursor:"pointer",fontWeight:500},children:"Show all"})]}),k.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e5e7eb"},children:k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",_.length>0&&k.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"#6366f1",color:"white",borderRadius:"10px"},children:_.length})]}),k.jsxs("span",{"aria-live":"polite",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)"},children:[_.length," pending annotation",_.length!==1?"s":""]}),_.length>0&&k.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[k.jsx("button",{"data-testid":"review-mode-btn",onClick:d,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":f,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${f?"#6366f1":"#d1d5db"}`,borderRadius:"3px",background:f?"#eef2ff":"#fff",color:f?"#6366f1":"#6b7280",cursor:"pointer",fontWeight:f?600:400},children:f?"Exit Review":"Review"}),k.jsx("div",{"data-testid":"review-shortcut-hints",style:{fontSize:"10px",color:"#9ca3af",marginTop:"2px"},children:"Y / N / ↑↓ / Z"})]})]})}),f&&B.length>0&&k.jsxs("div",{style:{padding:"8px 16px",background:"#eef2ff",borderBottom:"1px solid #e5e7eb",fontSize:"12px",color:"#4338ca"},children:[k.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",j+1," / ",B.length]}),k.jsx("div",{style:{color:"#6366f1"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),k.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[k.jsx(eb,{testId:"filter-type",value:b,onChange:L=>S(L),options:[{value:"all",label:"All types"},{value:"highlight",label:"Highlights"},{value:"comment",label:"Comments"},{value:"with-replacement",label:"With replacement"},{value:"for-claude",label:"For Claude"},{value:"flag",label:"Flags"}]}),k.jsx(eb,{testId:"filter-author",value:v,onChange:L=>C(L),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),k.jsx(eb,{testId:"filter-status",value:T,onChange:L=>H(L),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),Li&&k.jsx("button",{"data-testid":"clear-filters-btn",onClick:()=>{S("all"),C("all"),H("all")},style:{background:"none",border:"none",color:"#6366f1",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]}),k.jsx("div",{style:{padding:"4px 16px 0"},children:k.jsx(qY,{annotations:t,activeDocFormat:l,documentId:c})}),Ae.length>1&&k.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",gap:"6px",alignItems:"center"},children:N?(()=>{const L=N==="accept";return k.jsxs(k.Fragment,{children:[k.jsxs("span",{style:{fontSize:"11px",color:"#374151"},children:[L?"Accept":"Reject"," ",Ae.length===_.length?`${Ae.length} annotations?`:`${Ae.length} of ${_.length} pending?`]}),k.jsx("button",{ref:ae,"data-testid":"bulk-confirm-btn",onClick:L?Ee:Fe,style:{...fh,background:L?"#f0fdf4":"#fef2f2",color:L?"#166534":"#991b1b",fontWeight:600},children:"Confirm"}),k.jsx("button",{"data-testid":"bulk-cancel-btn",onClick:()=>D(null),style:{...fh,background:"#fff",color:"#6b7280"},children:"Cancel"})]})})():k.jsxs(k.Fragment,{children:[k.jsxs("button",{"data-testid":"bulk-accept-btn",onClick:()=>D("accept"),style:{...fh,background:"#f0fdf4",color:"#166534"},children:["Accept All (",Ae.length,")"]}),k.jsx("button",{"data-testid":"bulk-dismiss-btn",onClick:()=>D("dismiss"),style:{...fh,background:"#fef2f2",color:"#991b1b"},children:"Reject All"})]})}),k.jsx("div",{style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:me.length===0?k.jsx("p",{role:"status",style:{fontSize:"13px",color:"#9ca3af",marginTop:"8px"},children:Li?"No annotations match filters.":"No annotations yet. Open a document to get started."}):k.jsxs(k.Fragment,{children:[Ae.map(L=>{const se=(Y==null?void 0:Y.id)===L.id;return k.jsx(XA,{annotation:L,replies:I.get(L.id)??[],isReviewTarget:se,onAccept:ge,onDismiss:Re,onEdit:Ue,onReply:kt,onClick:()=>Ct(L)},L.id)}),M.length>0&&k.jsxs("details",{style:{marginTop:"12px"},children:[k.jsxs("summary",{style:{fontSize:"12px",color:"#9ca3af",cursor:"pointer"},children:[M.length," resolved"]}),k.jsx("div",{role:"list","aria-label":"Resolved annotations",children:M.map(L=>k.jsx(XA,{annotation:L,replies:I.get(L.id)??[],onUndo:De,undoable:xe.has(L.id),onClick:()=>Ct(L)},L.id))})]})]})}),k.jsx("style",{children:`
326
+ @keyframes tandem-annotation-flash {
327
+ 0% { background-color: rgba(99, 102, 241, 0.2); }
328
+ 100% { background-color: transparent; }
329
+ }
330
+ .tandem-annotation-flash {
331
+ animation: tandem-annotation-flash 0.8s ease-out;
332
+ }
333
+ `})]})}const JY=2e3;function XY({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:l,documentCount:c=0,saving:f=!1}){const[d,p]=O.useState(()=>{var N;try{return((N=localStorage.getItem(ib))==null?void 0:N.trim())||au}catch{return au}}),[m,g]=O.useState(d),b=()=>{const N=m.trim()||au;p(N),g(N);try{localStorage.setItem(ib,N)}catch{}},[S,v]=O.useState(!1),[C,T]=O.useState(0),H=O.useRef(t);O.useEffect(()=>{const N=H.current;if(H.current=t,t&&!N){v(!0);const D=setTimeout(()=>v(!1),JY);return()=>clearTimeout(D)}},[t]),O.useEffect(()=>{if(r==null){T(0);return}T(Math.floor((Date.now()-r)/1e3));const N=setInterval(()=>{T(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(N)},[r]);const j=e==="connecting",ne=t?"#22c55e":j?"#eab308":"#ef4444";let $;if(S)$="Reconnected";else if(e==="connected")$="Connected";else if(e==="connecting"){const N=["Reconnecting…"];if(n>0||C>0){const D=[];n>0&&D.push(`attempt ${n}`),C>0&&D.push(`${C}s`),N.push(`(${D.join(", ")})`)}$=N.join(" ")}else $="Disconnected — check that the server is running";return k.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 16px",height:"28px",borderTop:"1px solid #e5e7eb",background:"#fafafa",fontSize:"12px",color:"#6b7280",userSelect:"none"},children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:ne,display:"inline-block",animation:j?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),k.jsx("span",{children:$}),c>0&&k.jsxs("span",{style:{color:"#9ca3af"},children:[c," doc",c!==1?"s":""," open"]}),f&&k.jsx("span",{"data-testid":"save-indicator",style:{color:"#6366f1",fontStyle:"italic"},children:"Saving..."})]}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"#9ca3af"},children:[k.jsx("span",{children:"You:"}),k.jsx("input",{"data-testid":"user-name-input",type:"text",value:m,onChange:N=>g(N.target.value),onBlur:b,onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(g(d),N.currentTarget.blur())},"aria-label":"Display name",title:"Your display name (updates on next tab switch or refresh)",maxLength:40,style:{background:"transparent",border:"none",borderBottom:"1px solid #e5e7eb",color:"#6b7280",fontSize:"11px",width:"80px",outline:"none",padding:"0 2px"}})]}),l&&k.jsx("span",{style:{padding:"1px 8px",fontSize:"11px",fontWeight:600,color:"#92400e",background:"#fef3c7",borderRadius:"9999px",border:"1px solid #fde68a"},children:"Review Only"}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:Tx,opacity:s?1:.4,display:"inline-block",transition:"opacity 0.3s ease",animation:s?"tandem-status-pulse 1.5s ease-in-out infinite":"none"}}),k.jsx("span",{style:{transition:"color 0.3s ease",color:s?"#4b5563":"#9ca3af"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),k.jsx("style",{children:`
334
+ @keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
335
+ @keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
336
+ `})]})}function $D(t,e,n=Mz){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function FD(){try{const t=localStorage.getItem(Ax);if(!t)return[];const e=JSON.parse(t);return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}catch(t){return console.warn("[tandem] failed to load recent files:",t),[]}}function qD(t){try{localStorage.setItem(Ax,JSON.stringify(t))}catch(e){console.warn("[tandem] failed to save recent files:",e)}}function QY(){try{localStorage.removeItem(Ax)}catch(t){console.warn("[tandem] failed to clear recent files:",t)}}function eK({onClose:t}){const[e,n]=O.useState("path"),[r,i]=O.useState(""),[s,l]=O.useState(null),[c,f]=O.useState(!1),[d,p]=O.useState(!1),m=O.useRef(null),[g,b]=O.useState(FD),S=O.useCallback($=>{b(N=>{const D=$D(N,$);return qD(D),D})},[]),v=O.useCallback(()=>{QY(),b([])},[]),C=O.useCallback(async $=>{if(!c){l(null),f(!0);try{const N=await fetch(`${zu}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:$})}),D=await N.json();if(!N.ok){l(D.message??"Failed to open file");return}S($),t()}catch(N){console.error("FileOpenDialog: path open failed",N),N instanceof SyntaxError?l("Server returned an unexpected response"):N instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{f(!1)}}},[c,t,S]),T=O.useCallback(()=>{r.trim()&&C(r.trim())},[r,C]),H=O.useCallback(async $=>{if(!c){l(null),f(!0);try{const N=await uM($),D=await fetch(`${zu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:$.name,content:N})}),K=await D.json();if(!D.ok){l(K.message??"Failed to upload file");return}t()}catch(N){console.error("FileOpenDialog: upload failed",N),N instanceof SyntaxError?l("Server returned an unexpected response"):N instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{f(!1)}}},[c,t]),j=O.useCallback($=>{$.preventDefault(),p(!1);const N=$.dataTransfer.files[0];N&&H(N)},[H]),ne=O.useCallback($=>{var D;const N=(D=$.target.files)==null?void 0:D[0];N&&H(N)},[H]);return k.jsx("div",{style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"80px",background:"rgba(0,0,0,0.3)"},onClick:$=>{$.target===$.currentTarget&&t()},onKeyDown:$=>{$.key==="Escape"&&t()},children:k.jsxs("div",{style:{background:"#fff",borderRadius:"8px",boxShadow:"0 8px 30px rgba(0,0,0,0.15)",width:"440px",padding:"20px"},"data-testid":"file-open-dialog",children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[k.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"#111827"},children:"Open File"}),k.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"#9ca3af"},children:"×"})]}),k.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[k.jsx("button",{onClick:()=>n("path"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"4px",cursor:"pointer",background:e==="path"?"#6366f1":"#fff",color:e==="path"?"#fff":"#374151"},children:"File Path"}),k.jsx("button",{onClick:()=>n("upload"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"4px",cursor:"pointer",background:e==="upload"?"#6366f1":"#fff",color:e==="upload"?"#fff":"#374151"},children:"Upload"})]}),e==="path"?k.jsxs("div",{children:[k.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:$=>i($.target.value),onKeyDown:$=>{$.key==="Enter"&&T()},style:{width:"100%",padding:"8px 10px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",boxSizing:"border-box"},"data-testid":"file-path-input"}),k.jsx("button",{onClick:T,disabled:c||!r.trim(),style:{marginTop:"10px",width:"100%",padding:"8px",fontSize:"13px",fontWeight:500,border:"none",borderRadius:"4px",cursor:c?"wait":"pointer",background:c?"#9ca3af":"#6366f1",color:"#fff",opacity:r.trim()?1:.5},"data-testid":"file-open-submit",children:c?"Opening...":"Open"}),g.length>0&&k.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[k.jsx("span",{style:{fontSize:"11px",color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),k.jsx("button",{"data-testid":"clear-recent-files",onClick:v,type:"button",style:{background:"none",border:"none",color:"#9ca3af",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),k.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:g.map(($,N)=>{const D=$.split(/[/\\]/),K=D.pop()??$,ae=D.join("/")||"/";return k.jsxs("button",{type:"button","data-testid":`recent-file-${N}`,onClick:()=>{i($),C($)},style:{background:"none",border:"none",padding:"6px 8px",borderRadius:"4px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"1px"},onMouseEnter:xe=>{xe.currentTarget.style.background="#f3f4f6"},onMouseLeave:xe=>{xe.currentTarget.style.background="transparent"},children:[k.jsx("span",{style:{fontSize:"13px",color:"#111827"},children:K}),k.jsx("span",{style:{fontSize:"11px",color:"#9ca3af",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:ae})]},$)})})]})]}):k.jsxs("div",{onDragOver:$=>{$.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:j,onClick:()=>{var $;return($=m.current)==null?void 0:$.click()},style:{border:`2px dashed ${d?"#6366f1":"#d1d5db"}`,borderRadius:"6px",padding:"32px 16px",textAlign:"center",cursor:c?"wait":"pointer",background:d?"#eef2ff":"#f9fafb",transition:"border-color 0.15s, background 0.15s"},"data-testid":"file-upload-zone",children:[k.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:ne,style:{display:"none"}}),k.jsx("div",{style:{fontSize:"13px",color:"#6b7280"},children:c?"Uploading...":"Drop a file here or click to browse"}),k.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&k.jsx("div",{style:{marginTop:"10px",padding:"8px 10px",fontSize:"12px",color:"#991b1b",background:"#fef2f2",borderRadius:"4px",border:"1px solid #fecaca"},"data-testid":"file-open-error",children:s})]})})}function tK(t){const[e,n]=O.useState(!1),r=O.useRef(0),i=O.useRef(null);return O.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,l=s.getXmlFragment("default"),c=s.getMap(hh);let f=!1;const d=setTimeout(()=>{f=!0,i.current=c.get(pC)??0,r.current=0,n(!1)},500),p=()=>{f&&(r.current++,n(!0))};l.observeDeep(p);const m=()=>{if(!f)return;const g=c.get(pC);g!==void 0&&g!==i.current&&(i.current=g,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(d),l.unobserveDeep(p),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const nK={md:"M",txt:"T",html:"H",docx:"W"};function rK({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:l,onDrop:c,onDragEnd:f,onDragLeave:d,dropIndicator:p,onKeyDown:m}){const g=tK(t);return k.jsxs("div",{"data-testid":`tab-${t.id}`,"data-active":e,onClick:()=>n(t.id),draggable:i,tabIndex:0,onDragStart:b=>s(b,t.id),onDragOver:b=>l(b,t.id),onDrop:b=>c(b,t.id),onDragEnd:f,onDragLeave:d,onKeyDown:b=>m(b,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"#fff":"transparent",color:e?"#111827":"#6b7280",borderTop:e?"2px solid #6366f1":"2px solid transparent",borderBottom:e?"1px solid #fff":"1px solid transparent",borderLeft:p==="left"?"2px solid #6366f1":"2px solid transparent",borderRight:p==="right"?"2px solid #6366f1":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[g&&k.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"#f59e0b",fontSize:"10px"},children:"●"}),k.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"#6366f1":"#9ca3af",width:"14px",textAlign:"center"},children:nK[t.format]||"?"}),k.jsx("span",{"data-testid":`tab-name-${t.id}`,title:t.filePath,style:{fontWeight:e?500:400,maxWidth:"160px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.fileName}),t.readOnly&&k.jsx("span",{style:{fontSize:"9px",color:"#92400e",background:"#fef3c7",padding:"0 3px",borderRadius:"2px"},children:"RO"}),k.jsx("button",{onClick:b=>{b.stopPropagation(),r(t.id)},onDragOver:b=>{b.stopPropagation(),b.preventDefault()},onDrop:b=>{b.stopPropagation(),b.preventDefault()},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",lineHeight:1,color:"#9ca3af",padding:"0 2px",borderRadius:"2px"},onMouseEnter:b=>b.currentTarget.style.color="#ef4444",onMouseLeave:b=>b.currentTarget.style.color="#9ca3af",title:"Close document",children:"×"})]})}const Cx="tandem-tab-scroll-hide";function iK(){return k.jsx("style",{children:`
337
+ .${Cx} {
338
+ scrollbar-width: none;
339
+ -ms-overflow-style: none;
340
+ }
341
+ .${Cx}::-webkit-scrollbar {
342
+ display: none;
343
+ }
344
+ `})}const YD={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",minWidth:"28px",background:"linear-gradient(to right, #f3f4f6 70%, transparent)",border:"none",cursor:"pointer",fontSize:"12px",color:"#6b7280",padding:0,zIndex:1},sK={...YD,background:"linear-gradient(to left, #f3f4f6 70%, transparent)"};function oK({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i}){const[s,l]=O.useState(!1),c=O.useRef(new Set);O.useEffect(()=>{const Q=new Set(t.map(ie=>ie.id));for(const ie of c.current)Q.has(ie)||c.current.delete(ie)},[t]);const f=O.useCallback(Q=>{c.current.has(Q)||(c.current.add(Q),r(Q))},[r]),d=O.useRef(null),[p,m]=O.useState(!1),[g,b]=O.useState(!1),[S,v]=O.useState(null),[C,T]=O.useState(null);function H(){v(null),T(null)}const j=O.useCallback(()=>{const Q=d.current;Q&&(m(Q.scrollLeft>0),b(Q.scrollLeft+Q.clientWidth<Q.scrollWidth-1))},[]);O.useEffect(()=>{const Q=d.current;if(!Q)return;j(),Q.addEventListener("scroll",j,{passive:!0});const ie=new ResizeObserver(j);return ie.observe(Q),()=>{Q.removeEventListener("scroll",j),ie.disconnect()}},[j]),O.useEffect(()=>{j()},[t.length,j]),O.useEffect(()=>{if(!e||!d.current)return;const Q=d.current.querySelector(`[data-testid="tab-${e}"]`);Q&&Q.scrollIntoView({inline:"nearest",block:"nearest",behavior:"smooth"})},[e]),O.useEffect(()=>{H()},[t.length]);const ne=O.useCallback((Q,ie)=>{v(ie),Q.dataTransfer.setData("text/plain",ie),Q.dataTransfer.effectAllowed="move"},[]),$=O.useCallback((Q,ie)=>{if(Q.preventDefault(),!S||S===ie){T(null);return}const G=Q.currentTarget.getBoundingClientRect(),I=G.left+G.width/2,Z=Q.clientX<I?"left":"right";T({id:ie,side:Z})},[S]),N=O.useCallback((Q,ie)=>{Q.preventDefault();const G=Q.dataTransfer.getData("text/plain");if(G&&G!==ie&&i){const I=Q.currentTarget.getBoundingClientRect(),Z=I.left+I.width/2,me=Q.clientX<Z?"left":"right";i(G,ie,me)}H()},[i]),D=O.useCallback(()=>{H()},[]),K=O.useCallback(()=>{T(null)},[]),ae=O.useCallback((Q,ie)=>{if(!Q.altKey||!i||Q.key!=="ArrowLeft"&&Q.key!=="ArrowRight")return;Q.preventDefault();const G=t.findIndex(I=>I.id===ie);G!==-1&&(Q.key==="ArrowLeft"&&G>0?i(ie,t[G-1].id):Q.key==="ArrowRight"&&G<t.length-1&&i(t[G+1].id,ie))},[t,i]),xe=O.useCallback(()=>{var Q;(Q=d.current)==null||Q.scrollBy({left:-150,behavior:"smooth"})},[]),fe=O.useCallback(()=>{var Q;(Q=d.current)==null||Q.scrollBy({left:150,behavior:"smooth"})},[]),le=t.length<=1;return k.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"#f3f4f6",borderBottom:"1px solid #e5e7eb",minHeight:"32px"},children:[k.jsx(iK,{}),p&&k.jsx("button",{"data-testid":"tab-scroll-left",onClick:xe,style:YD,title:"Scroll tabs left",children:"◀"}),k.jsx("div",{ref:d,"data-testid":"tab-scroll-container",className:Cx,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",overflowY:"hidden",padding:"0 4px"},children:t.map(Q=>k.jsx(rK,{tab:Q,isActive:Q.id===e,onSwitch:n,onClose:f,draggable:!le,onDragStart:ne,onDragOver:$,onDrop:N,onDragEnd:D,onDragLeave:K,dropIndicator:(C==null?void 0:C.id)===Q.id?C.side:null,onKeyDown:ae},Q.id))}),g&&k.jsx("button",{"data-testid":"tab-scroll-right",onClick:fe,style:sK,title:"Scroll tabs right",children:"▶"}),k.jsx("button",{onClick:()=>l(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"#6b7280",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:Q=>{Q.currentTarget.style.color="#6366f1",Q.currentTarget.style.borderColor="#6366f1"},onMouseLeave:Q=>{Q.currentTarget.style.color="#6b7280",Q.currentTarget.style.borderColor="#d1d5db"},children:"+"}),s&&k.jsx(eK,{onClose:()=>l(!1)})]})}function QA({connected:t,claudeActive:e}){const[n,r]=O.useState(!1);return O.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),Sz);return()=>clearTimeout(i)},[t]),k.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"#9ca3af",gap:"8px"},children:n?k.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):k.jsxs(k.Fragment,{children:[k.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&k.jsx("span",{style:{fontSize:"0.85em",color:"#b0b8c4"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}function lK({onDismiss:t}){return k.jsxs("div",{style:{padding:"8px 16px",background:"#fef2f2",borderBottom:"1px solid #fca5a5",fontSize:"13px",color:"#991b1b",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"12px"},children:[k.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),k.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"#991b1b",fontSize:"16px",lineHeight:1,padding:"0 4px"},"aria-label":"Dismiss connection banner",children:"\\u00d7"})]})}const KD=200,WD=600,GD=300;function dh(t){const e=nM[t];try{const n=localStorage.getItem(e);if(n){const r=parseInt(n,10);if(Number.isFinite(r))return Math.max(KD,Math.min(WD,r));console.warn(`[tandem] ignoring non-numeric panel width for ${e}: ${n}`)}}catch(n){console.warn(`[tandem] localStorage unavailable reading ${e}:`,n)}return GD}function aK(){aP();const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,annotations:f,claudeStatus:d,claudeActive:p,readOnly:m,bootstrapYdoc:g,ready:b,serverRestarted:S}=w7(),{orderedTabs:v,reorder:C}=eP(t);XV(v,e,n),O.useEffect(()=>{if(t.length!==0)try{const oe=FD();let ct=oe;for(const mt of t)mt.filePath.startsWith("upload://")||(ct=$D(ct,mt.filePath));(ct.length!==oe.length||ct.some((mt,Zr)=>mt!==oe[Zr]))&&qD(ct)}catch(oe){console.warn("[tandem] failed to sync recent files:",oe)}},[t.length]);const[T,H]=O.useState(()=>{try{const oe=localStorage.getItem(Ud);return r3.safeParse(oe).success?oe:dC}catch(oe){return console.warn(`[tandem] localStorage unavailable reading ${Ud}:`,oe),dC}});O.useEffect(()=>{try{localStorage.setItem(Ud,T)}catch(oe){console.warn(`[tandem] failed to persist ${Ud}:`,oe)}},[T]),O.useEffect(()=>{if(!g)return;g.getMap(rb).set(Ez,T)},[T,g]);const[j,ne]=O.useState(!1),[$,N]=O.useState(!1);O.useEffect(()=>{if(c==null){ne(!1),N(!1);return}const oe=Date.now()-c,ct=wz-oe;if(ct<=0){ne(!0);return}const mt=setTimeout(()=>ne(!0),ct);return()=>clearTimeout(mt)},[c]);const{visibleAnnotations:D,heldCount:K}=KV(f,T),ae=O.useMemo(()=>t.map(oe=>({id:oe.id,fileName:oe.fileName})),[t]),{saving:xe}=ZV(e),{toasts:fe,dismiss:le}=WV(),{fileDragOver:Q,handleEditorDragOver:ie,handleEditorDragLeave:G,handleEditorDrop:I}=qV(),{showReviewSummary:Z,reviewSummaryData:me,dismissReviewSummary:Ae}=GV(f),{settings:M,updateSettings:_}=nP(),[B,E]=O.useState(!1),[X,he]=O.useState(null);O.useEffect(()=>{if(!g)return;g.getMap(rb).set(Tz,M.selectionDwellMs)},[M.selectionDwellMs,g]),O.useEffect(()=>{const oe=$t.current;if(!oe)return;const ct=oe.state.tr.setMeta(da,{type:"toggle",visible:M.showAuthorship});oe.view.dispatch(ct)},[M.showAuthorship]);const[ge,Re]=O.useState(!1),[De,Ue]=O.useState(()=>M.primaryTab==="chat"),kt=O.useMemo(()=>De?D.filter(oe=>oe.status==="pending").length:0,[D,De]),[Ee,Fe]=O.useState(null),[Ct,Nt]=O.useState(!1),[_n,bn]=O.useState(null),$t=O.useRef(null),Kn=O.useRef(null),kr=O.useCallback(oe=>{$t.current=oe},[]),Cr=O.useCallback(oe=>{Ue(!1),Fe(oe)},[]),[Wn,Ni]=O.useState(()=>M.layout==="three-panel"?{kind:"three-panel",left:dh("left"),right:dh("right")}:{kind:"tabbed",right:dh("right")});O.useEffect(()=>{Ni(oe=>M.layout==="three-panel"?oe.kind==="three-panel"?oe:{kind:"three-panel",left:dh("left"),right:oe.right}:oe.kind==="tabbed"?oe:{kind:"tabbed",right:oe.right})},[M.layout]);const zi=M.editorWidthPercent<100?`${M.editorWidthPercent}%`:void 0,Ft=M.editorWidthPercent<100?"0 auto":void 0,Li=O.useRef(Wn);Li.current=Wn;const Y=O.useRef(null);O.useEffect(()=>()=>{Y.current&&(document.removeEventListener("mousemove",Y.current.move),document.removeEventListener("mouseup",Y.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]);const L=O.useCallback((oe,ct)=>{oe.preventDefault();const mt=oe.clientX,Zr=Li.current,Er=ct==="left"?Zr.kind==="three-panel"?Zr.left:GD:Zr.right,wo=nM[ct];let ci=Er;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const Jr=ji=>{const Cf=ji.clientX-mt,Ef=ct==="left"?Er+Cf:Er-Cf;ci=Math.max(KD,Math.min(WD,Ef)),Ni(Ii=>ct==="right"?Ii.kind==="three-panel"?{...Ii,right:ci}:{kind:"tabbed",right:ci}:Ii.kind!=="three-panel"?Ii:{...Ii,left:ci})},bs=()=>{document.removeEventListener("mousemove",Jr),document.removeEventListener("mouseup",bs),Y.current=null,document.body.style.userSelect="",document.body.style.cursor="";try{localStorage.setItem(wo,String(ci))}catch(ji){console.warn(`[tandem] failed to persist ${wo}:`,ji)}};Y.current={move:Jr,up:bs},document.addEventListener("mousemove",Jr),document.addEventListener("mouseup",bs)},[]),se=O.useCallback(()=>{Re(oe=>!oe)},[]),ye=O.useCallback(()=>{Re(!1)},[]),Te=O.useCallback(()=>{if(De)return;const oe=$t.current;if(!oe)return;const{from:ct,to:mt}=oe.state.selection;if(ct===mt)return;const Zr=K2(oe.state.doc,{from:Fr(ct),to:Fr(mt)}),Er=oe.state.doc.textBetween(ct,mt,`
345
+ `);bn({...Zr,textSnapshot:Er.length>200?Er.slice(0,197)+"...":Er})},[De]);O.useEffect(()=>{const oe=ct=>{if(ct.key!=="?")return;const mt=ct.target;mt.tagName==="INPUT"||mt.tagName==="TEXTAREA"||mt.isContentEditable||Nt(Zr=>!Zr)};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[]);const re=t.find(oe=>oe.id===e),{tutorialActive:Ke,currentStep:Ze,dismissTutorial:at,nextStep:pt}=iP(f,$t,re==null?void 0:re.fileName);return b?k.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[S&&k.jsx("div",{style:{padding:"8px 16px",background:"#fef3c7",borderBottom:"1px solid #fbbf24",fontSize:"13px",color:"#92400e",textAlign:"center"},children:"Server restarted — refreshing documents"}),j&&!$&&k.jsx(lK,{onDismiss:()=>N(!0)}),k.jsx(FV,{editor:$t.current,ydoc:(re==null?void 0:re.ydoc)??null,onSettingsClick:oe=>{he(oe),E(!0)},tandemMode:T,onModeChange:H,heldCount:K}),k.jsx(oK,{tabs:v,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:C}),Wn.kind==="three-panel"?k.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Wn.left}px`,borderRight:"1px solid #e5e7eb"},children:[k.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"#6b7280",borderBottom:"1px solid #e5e7eb",background:"#f9fafb",textTransform:"uppercase",letterSpacing:"0.5px"},children:M.panelOrder==="chat-editor-annotations"?"Chat":"Annotations"}),k.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:M.panelOrder==="chat-editor-annotations"?k.jsx(Q0,{ctrlYdoc:g,editor:$t.current,activeDocId:e,openDocs:ae,claudeActive:p,claudeStatus:d,visible:!0,capturedAnchor:_n,onCapturedAnchorChange:bn,inputRef:Kn}):k.jsx(tb,{annotations:D,editor:$t.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:K,tandemMode:T,onModeChange:H,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:ge,onToggleReviewMode:se,onExitReviewMode:ye,activeAnnotationId:Ee,onActiveAnnotationChange:Fe})})]}),k.jsx("div",{"data-testid":"left-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize left panel",tabIndex:0,onMouseDown:oe=>L(oe,"left"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:oe=>{oe.currentTarget.style.background="#d1d5db"},onMouseLeave:oe=>{oe.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:Q?"2px dashed #6366f1":"2px solid transparent",background:Q?"#eef2ff":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ie,onDragLeave:G,onDrop:I,children:[k.jsx(IC,{visible:(re==null?void 0:re.readOnly)===!0&&(re==null?void 0:re.format)==="docx",documentId:re==null?void 0:re.id}),k.jsx("div",{style:{maxWidth:zi,margin:Ft},children:re?k.jsx(nA,{ydoc:re.ydoc,provider:re.provider,readOnly:m,reviewMode:ge,activeAnnotationId:Ee,onEditorReady:kr,onAnnotationClick:Cr},re.id):k.jsx(QA,{connected:i,claudeActive:p})})]}),k.jsx("div",{"data-testid":"right-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right panel",tabIndex:0,onMouseDown:oe=>L(oe,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:oe=>{oe.currentTarget.style.background="#d1d5db"},onMouseLeave:oe=>{oe.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Wn.right}px`,borderLeft:"1px solid #e5e7eb"},children:[k.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"#6b7280",borderBottom:"1px solid #e5e7eb",background:"#f9fafb",textTransform:"uppercase",letterSpacing:"0.5px"},children:M.panelOrder==="chat-editor-annotations"?"Annotations":"Chat"}),k.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:M.panelOrder==="chat-editor-annotations"?k.jsx(tb,{annotations:D,editor:$t.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:K,tandemMode:T,onModeChange:H,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:ge,onToggleReviewMode:se,onExitReviewMode:ye,activeAnnotationId:Ee,onActiveAnnotationChange:Fe}):k.jsx(Q0,{ctrlYdoc:g,editor:$t.current,activeDocId:e,openDocs:ae,claudeActive:p,claudeStatus:d,visible:!0,capturedAnchor:_n,onCapturedAnchorChange:bn,inputRef:Kn})})]})]}):k.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:Q?"2px dashed #6366f1":"2px solid transparent",background:Q?"#eef2ff":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ie,onDragLeave:G,onDrop:I,children:[k.jsx(IC,{visible:(re==null?void 0:re.readOnly)===!0&&(re==null?void 0:re.format)==="docx",documentId:re==null?void 0:re.id}),k.jsx("div",{style:{maxWidth:zi,margin:Ft},children:re?k.jsx(nA,{ydoc:re.ydoc,provider:re.provider,readOnly:m,reviewMode:ge,activeAnnotationId:Ee,onEditorReady:kr,onAnnotationClick:Cr},re.id):k.jsx(QA,{connected:i,claudeActive:p})})]}),k.jsx("div",{"data-testid":"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",tabIndex:0,onMouseDown:oe=>L(oe,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:oe=>{oe.currentTarget.style.background="#d1d5db"},onMouseLeave:oe=>{oe.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Wn.right}px`,borderLeft:"1px solid #e5e7eb"},children:[k.jsxs("div",{style:{display:"flex",borderBottom:"1px solid #e5e7eb",background:"#f9fafb"},children:[k.jsxs("button",{"data-testid":"annotations-tab",onClick:()=>Ue(!1),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:De?400:600,border:"none",borderBottom:De?"none":"2px solid #6366f1",background:"transparent",cursor:"pointer",color:De?"#6b7280":"#6366f1",position:"relative"},children:["Annotations",De&&kt>0&&k.jsx("span",{style:{position:"absolute",top:"2px",right:"6px",background:"#ef4444",color:"#fff",fontSize:"9px",width:"16px",height:"16px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700},children:kt>9?"9+":kt})]}),k.jsx("button",{"data-testid":"chat-tab",onMouseDown:Te,onClick:()=>Ue(!0),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:De?600:400,border:"none",borderBottom:De?"2px solid #6366f1":"none",background:"transparent",cursor:"pointer",color:De?"#6366f1":"#6b7280",position:"relative"},children:"Chat"})]}),k.jsx("div",{style:{display:De?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:k.jsx(Q0,{ctrlYdoc:g,editor:$t.current,activeDocId:e,openDocs:ae,claudeActive:p,claudeStatus:d,visible:De,capturedAnchor:_n,onCapturedAnchorChange:bn,inputRef:Kn})}),k.jsx("div",{style:{display:De?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:k.jsx(tb,{annotations:D,editor:$t.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:K,tandemMode:T,onModeChange:H,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:ge,onToggleReviewMode:se,onExitReviewMode:ye,activeAnnotationId:Ee,onActiveAnnotationChange:Fe})})]})]}),k.jsx(XY,{connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,claudeStatus:d,claudeActive:p,readOnly:m,documentCount:t.length,saving:xe}),Z&&me&&k.jsx(FY,{accepted:me.accepted,dismissed:me.dismissed,total:me.total,onDismiss:Ae}),k.jsx(u3,{open:B,onClose:()=>E(!1),anchorRect:X,settings:M,onUpdate:_}),k.jsx(s3,{open:Ct,onClose:()=>Nt(!1)}),k.jsx(d3,{toasts:fe,onDismiss:le}),Ke&&k.jsx(l3,{currentStep:Ze,onNext:pt,onDismiss:at})]}):k.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"#9ca3af"},children:"Connecting..."})}class cK extends un.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("[Tandem] React error boundary caught:",e,n.componentStack)}render(){var e;return this.state.hasError?k.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[k.jsx("h2",{children:"Something went wrong"}),k.jsx("p",{style:{color:"#666"},children:"The editor encountered an unexpected error. Reload the page to continue."}),k.jsx("pre",{style:{background:"#f5f5f5",padding:"1rem",borderRadius:"4px",fontSize:"12px",overflow:"auto",maxHeight:"200px"},children:(e=this.state.error)==null?void 0:e.message}),k.jsx("button",{onClick:()=>window.location.reload(),style:{marginTop:"1rem",padding:"8px 16px",cursor:"pointer",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff"},children:"Reload"})]}):this.props.children}}const uK=bz.createRoot(document.getElementById("root"));uK.render(k.jsx(un.StrictMode,{children:k.jsx(cK,{children:k.jsx(aK,{})})}));