tandem-editor 0.7.1 → 0.9.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,228 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webview-BQBJMQvJ.js","assets/core-DhEqZVGG.js"])))=>i.map(i=>d[i]);
2
+ var Vz=Object.defineProperty;var Pz=(t,e,n)=>e in t?Vz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Pf=(t,e,n)=>Pz(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 Xp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ky={exports:{}},Gc={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var bC;function $z(){if(bC)return Gc;bC=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 Gc.Fragment=e,Gc.jsx=n,Gc.jsxs=n,Gc}var xC;function Fz(){return xC||(xC=1,Ky.exports=$z()),Ky.exports}var S=Fz(),Yy={exports:{}},je={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var vC;function qz(){if(vC)return je;vC=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"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=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 v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function E(_,B,A){this.props=_,this.context=B,this.refs=C,this.updater=A||v}E.prototype.isReactComponent={},E.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")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function j(){}j.prototype=E.prototype;function N(_,B,A){this.props=_,this.context=B,this.refs=C,this.updater=A||v}var q=N.prototype=new j;q.constructor=N,k(q,E.prototype),q.isPureReactComponent=!0;var H=Array.isArray;function R(){}var I={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function W(_,B,A){var re=A.ref;return{$$typeof:t,type:_,key:B,ref:re!==void 0?re:null,props:A}}function oe(_,B){return W(_.type,B,_.props)}function ne(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function se(_){var B={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(A){return B[A]})}var be=/\/+/g;function ae(_,B){return typeof _=="object"&&_!==null&&_.key!=null?se(""+_.key):B.toString(36)}function V(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(R,R):(_.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 z(_,B,A,re,Z){var ie=typeof _;(ie==="undefined"||ie==="boolean")&&(_=null);var me=!1;if(_===null)me=!0;else switch(ie){case"bigint":case"string":case"number":me=!0;break;case"object":switch(_.$$typeof){case t:case e:me=!0;break;case h:return me=_._init,z(me(_._payload),B,A,re,Z)}}if(me)return Z=Z(_),me=re===""?"."+ae(_,0):re,H(Z)?(A="",me!=null&&(A=me.replace(be,"$&/")+"/"),z(Z,B,A,"",function(Le){return Le})):Z!=null&&(ne(Z)&&(Z=oe(Z,A+(Z.key==null||_&&_.key===Z.key?"":(""+Z.key).replace(be,"$&/")+"/")+me)),B.push(Z)),1;me=0;var Ae=re===""?".":re+":";if(H(_))for(var ge=0;ge<_.length;ge++)re=_[ge],ie=Ae+ae(re,ge),me+=z(re,B,A,ie,Z);else if(ge=b(_),typeof ge=="function")for(_=ge.call(_),ge=0;!(re=_.next()).done;)re=re.value,ie=Ae+ae(re,ge++),me+=z(re,B,A,ie,Z);else if(ie==="object"){if(typeof _.then=="function")return z(V(_),B,A,re,Z);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 me}function Y(_,B,A){if(_==null)return _;var re=[],Z=0;return z(_,re,"","",function(ie){return B.call(A,ie,Z++)}),re}function pe(_){if(_._status===-1){var B=_._result;B=B(),B.then(function(A){(_._status===0||_._status===-1)&&(_._status=1,_._result=A)},function(A){(_._status===0||_._status===-1)&&(_._status=2,_._result=A)}),_._status===-1&&(_._status=0,_._result=B)}if(_._status===1)return _._result.default;throw _._result}var _e=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(_)},O={map:Y,forEach:function(_,B,A){Y(_,function(){B.apply(this,arguments)},A)},count:function(_){var B=0;return Y(_,function(){B++}),B},toArray:function(_){return Y(_,function(B){return B})||[]},only:function(_){if(!ne(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return je.Activity=m,je.Children=O,je.Component=E,je.Fragment=n,je.Profiler=i,je.PureComponent=N,je.StrictMode=r,je.Suspense=u,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,je.__COMPILER_RUNTIME={__proto__:null,c:function(_){return I.H.useMemoCache(_)}},je.cache=function(_){return function(){return _.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(_,B,A){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var re=k({},_.props),Z=_.key;if(B!=null)for(ie in B.key!==void 0&&(Z=""+B.key),B)!Q.call(B,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&B.ref===void 0||(re[ie]=B[ie]);var ie=arguments.length-2;if(ie===1)re.children=A;else if(1<ie){for(var me=Array(ie),Ae=0;Ae<ie;Ae++)me[Ae]=arguments[Ae+2];re.children=me}return W(_.type,Z,re)},je.createContext=function(_){return _={$$typeof:l,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:s,_context:_},_},je.createElement=function(_,B,A){var re,Z={},ie=null;if(B!=null)for(re in B.key!==void 0&&(ie=""+B.key),B)Q.call(B,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(Z[re]=B[re]);var me=arguments.length-2;if(me===1)Z.children=A;else if(1<me){for(var Ae=Array(me),ge=0;ge<me;ge++)Ae[ge]=arguments[ge+2];Z.children=Ae}if(_&&_.defaultProps)for(re in me=_.defaultProps,me)Z[re]===void 0&&(Z[re]=me[re]);return W(_,ie,Z)},je.createRef=function(){return{current:null}},je.forwardRef=function(_){return{$$typeof:c,render:_}},je.isValidElement=ne,je.lazy=function(_){return{$$typeof:h,_payload:{_status:-1,_result:_},_init:pe}},je.memo=function(_,B){return{$$typeof:f,type:_,compare:B===void 0?null:B}},je.startTransition=function(_){var B=I.T,A={};I.T=A;try{var re=_(),Z=I.S;Z!==null&&Z(A,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(R,_e)}catch(ie){_e(ie)}finally{B!==null&&A.types!==null&&(B.types=A.types),I.T=B}},je.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},je.use=function(_){return I.H.use(_)},je.useActionState=function(_,B,A){return I.H.useActionState(_,B,A)},je.useCallback=function(_,B){return I.H.useCallback(_,B)},je.useContext=function(_){return I.H.useContext(_)},je.useDebugValue=function(){},je.useDeferredValue=function(_,B){return I.H.useDeferredValue(_,B)},je.useEffect=function(_,B){return I.H.useEffect(_,B)},je.useEffectEvent=function(_){return I.H.useEffectEvent(_)},je.useId=function(){return I.H.useId()},je.useImperativeHandle=function(_,B,A){return I.H.useImperativeHandle(_,B,A)},je.useInsertionEffect=function(_,B){return I.H.useInsertionEffect(_,B)},je.useLayoutEffect=function(_,B){return I.H.useLayoutEffect(_,B)},je.useMemo=function(_,B){return I.H.useMemo(_,B)},je.useOptimistic=function(_,B){return I.H.useOptimistic(_,B)},je.useReducer=function(_,B,A){return I.H.useReducer(_,B,A)},je.useRef=function(_){return I.H.useRef(_)},je.useState=function(_){return I.H.useState(_)},je.useSyncExternalStore=function(_,B,A){return I.H.useSyncExternalStore(_,B,A)},je.useTransition=function(){return I.H.useTransition()},je.version="19.2.4",je}var SC;function jx(){return SC||(SC=1,Yy.exports=qz()),Yy.exports}var M=jx();const on=Xp(M);var Wy={exports:{}},Zc={},Gy={exports:{}},Zy={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var wC;function Kz(){return wC||(wC=1,(function(t){function e(z,Y){var pe=z.length;z.push(Y);e:for(;0<pe;){var _e=pe-1>>>1,O=z[_e];if(0<i(O,Y))z[_e]=Y,z[pe]=O,pe=_e;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var Y=z[0],pe=z.pop();if(pe!==Y){z[0]=pe;e:for(var _e=0,O=z.length,_=O>>>1;_e<_;){var B=2*(_e+1)-1,A=z[B],re=B+1,Z=z[re];if(0>i(A,pe))re<O&&0>i(Z,A)?(z[_e]=Z,z[re]=pe,_e=re):(z[_e]=A,z[B]=pe,_e=B);else if(re<O&&0>i(Z,pe))z[_e]=Z,z[re]=pe,_e=re;else break e}}return Y}function i(z,Y){var pe=z.sortIndex-Y.sortIndex;return pe!==0?pe:z.id-Y.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 u=[],f=[],h=1,m=null,g=3,b=!1,v=!1,k=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function q(z){for(var Y=n(f);Y!==null;){if(Y.callback===null)r(f);else if(Y.startTime<=z)r(f),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=n(f)}}function H(z){if(k=!1,q(z),!v)if(n(u)!==null)v=!0,R||(R=!0,se());else{var Y=n(f);Y!==null&&V(H,Y.startTime-z)}}var R=!1,I=-1,Q=5,W=-1;function oe(){return C?!0:!(t.unstable_now()-W<Q)}function ne(){if(C=!1,R){var z=t.unstable_now();W=z;var Y=!0;try{e:{v=!1,k&&(k=!1,j(I),I=-1),b=!0;var pe=g;try{t:{for(q(z),m=n(u);m!==null&&!(m.expirationTime>z&&oe());){var _e=m.callback;if(typeof _e=="function"){m.callback=null,g=m.priorityLevel;var O=_e(m.expirationTime<=z);if(z=t.unstable_now(),typeof O=="function"){m.callback=O,q(z),Y=!0;break t}m===n(u)&&r(u),q(z)}else r(u);m=n(u)}if(m!==null)Y=!0;else{var _=n(f);_!==null&&V(H,_.startTime-z),Y=!1}}break e}finally{m=null,g=pe,b=!1}Y=void 0}}finally{Y?se():R=!1}}}var se;if(typeof N=="function")se=function(){N(ne)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,ae=be.port2;be.port1.onmessage=ne,se=function(){ae.postMessage(null)}}else se=function(){E(ne,0)};function V(z,Y){I=E(function(){z(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(z){switch(g){case 1:case 2:case 3:var Y=3;break;default:Y=g}var pe=g;g=Y;try{return z()}finally{g=pe}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(z,Y){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var pe=g;g=z;try{return Y()}finally{g=pe}},t.unstable_scheduleCallback=function(z,Y,pe){var _e=t.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?_e+pe:_e):pe=_e,z){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=pe+O,z={id:h++,callback:Y,priorityLevel:z,startTime:pe,expirationTime:O,sortIndex:-1},pe>_e?(z.sortIndex=pe,e(f,z),n(u)===null&&z===n(f)&&(k?(j(I),I=-1):k=!0,V(H,pe-_e))):(z.sortIndex=O,e(u,z),v||b||(v=!0,R||(R=!0,se()))),z},t.unstable_shouldYield=oe,t.unstable_wrapCallback=function(z){var Y=g;return function(){var pe=g;g=Y;try{return z.apply(this,arguments)}finally{g=pe}}}})(Zy)),Zy}var kC;function Yz(){return kC||(kC=1,Gy.exports=Kz()),Gy.exports}var Jy={exports:{}},An={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var CC;function Wz(){if(CC)return An;CC=1;var t=jx();function e(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+f+" 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(u,f,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:u,containerInfo:f,implementation:h}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return An.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,An.createPortal=function(u,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(u,f,null,h)},An.flushSync=function(u){var f=l.T,h=r.p;try{if(l.T=null,r.p=2,u)return u()}finally{l.T=f,r.p=h,r.d.f()}},An.preconnect=function(u,f){typeof u=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(u,f))},An.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},An.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var h=f.as,m=c(h,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(u,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:b}):h==="script"&&r.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},An.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=c(f.as,f.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(u)},An.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,m=c(h,f.crossOrigin);r.d.L(u,h,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},An.preloadModule=function(u,f){if(typeof u=="string")if(f){var h=c(f.as,f.crossOrigin);r.d.m(u,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(u)},An.requestFormReset=function(u){r.d.r(u)},An.unstable_batchedUpdates=function(u,f){return u(f)},An.useFormState=function(u,f,h){return l.H.useFormState(u,f,h)},An.useFormStatus=function(){return l.H.useHostTransitionStatus()},An.version="19.2.4",An}var EC;function yM(){if(EC)return Jy.exports;EC=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(),Jy.exports=Wz(),Jy.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var TC;function Gz(){if(TC)return Zc;TC=1;var t=Yz(),e=jx(),n=yM();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(d=a.return),o=a.return;while(o)}return a.tag===3?d:null}function 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 u(o){if(s(o)!==o)throw Error(r(188))}function f(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var d=o,p=a;;){var y=d.return;if(y===null)break;var x=y.alternate;if(x===null){if(p=y.return,p!==null){d=p;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===d)return u(y),o;if(x===p)return u(y),a;x=x.sibling}throw Error(r(188))}if(d.return!==p.return)d=y,p=x;else{for(var w=!1,T=y.child;T;){if(T===d){w=!0,d=y,p=x;break}if(T===p){w=!0,p=y,d=x;break}T=T.sibling}if(!w){for(T=x.child;T;){if(T===d){w=!0,d=x,p=y;break}if(T===p){w=!0,p=x,d=y;break}T=T.sibling}if(!w)throw Error(r(189))}}if(d.alternate!==p)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?o:a}function h(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=h(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"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),N=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),oe=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function se(o){return o===null||typeof o!="object"?null:(o=ne&&o[ne]||o["@@iterator"],typeof o=="function"?o:null)}var be=Symbol.for("react.client.reference");function ae(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===be?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case k:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case H:return"Suspense";case R:return"SuspenseList";case W:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case N:return o.displayName||"Context";case j:return(o._context.displayName||"Context")+".Consumer";case q:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case I:return a=o.displayName||null,a!==null?a:ae(o.type)||"Memo";case Q:a=o._payload,o=o._init;try{return ae(o(a))}catch{}}return null}var V=Array.isArray,z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},_e=[],O=-1;function _(o){return{current:o}}function B(o){0>O||(o.current=_e[O],_e[O]=null,O--)}function A(o,a){O++,_e[O]=o.current,o.current=a}var re=_(null),Z=_(null),ie=_(null),me=_(null);function Ae(o,a){switch(A(ie,a),A(Z,o),A(re,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Vk(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Vk(a),o=Pk(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}B(re),A(re,o)}function ge(){B(re),B(Z),B(ie)}function Le(o){o.memoizedState!==null&&A(me,o);var a=re.current,d=Pk(a,o.type);a!==d&&(A(Z,o),A(re,d))}function ke(o){Z.current===o&&(B(re),B(Z)),me.current===o&&(B(me),qc._currentValue=pe)}var xt,Ot;function pt(o){if(xt===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);xt=a&&a[1]||"",Ot=-1<d.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+xt+o+Ot}var jn=!1;function kr(o,a){if(!o||jn)return"";jn=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={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(K){var F=K}Reflect.construct(o,[],ee)}else{try{ee.call()}catch(K){F=K}o.call(ee.prototype)}}else{try{throw Error()}catch(K){F=K}(ee=o())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.stack,F.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),w=x[0],T=x[1];if(w&&T){var D=w.split(`
45
+ `),$=T.split(`
46
+ `);for(y=p=0;p<D.length&&!D[p].includes("DetermineComponentFrameRoot");)p++;for(;y<$.length&&!$[y].includes("DetermineComponentFrameRoot");)y++;if(p===D.length||y===$.length)for(p=D.length-1,y=$.length-1;1<=p&&0<=y&&D[p]!==$[y];)y--;for(;1<=p&&0<=y;p--,y--)if(D[p]!==$[y]){if(p!==1||y!==1)do if(p--,y--,0>y||D[p]!==$[y]){var G=`
47
+ `+D[p].replace(" at new "," at ");return o.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",o.displayName)),G}while(1<=p&&0<=y);break}}}finally{jn=!1,Error.prepareStackTrace=d}return(d=o?o.displayName||o.name:"")?pt(d):""}function In(o,a){switch(o.tag){case 26:case 27:case 5:return pt(o.type);case 16:return pt("Lazy");case 13:return o.child!==a&&a!==null?pt("Suspense Fallback"):pt("Suspense");case 19:return pt("SuspenseList");case 0:case 15:return kr(o.type,!1);case 11:return kr(o.type.render,!1);case 1:return kr(o.type,!0);case 31:return pt("Activity");default:return""}}function hs(o){try{var a="",d=null;do a+=In(o,d),d=o,o=o.return;while(o);return a}catch(p){return`
48
+ Error generating stack: `+p.message+`
49
+ `+p.stack}}var or=Object.prototype.hasOwnProperty,ai=t.unstable_scheduleCallback,lr=t.unstable_cancelCallback,xl=t.unstable_shouldYield,xo=t.unstable_requestPaint,Jt=t.unstable_now,ps=t.unstable_getCurrentPriorityLevel,J=t.unstable_ImmediatePriority,fe=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,ce=t.unstable_LowPriority,tt=t.unstable_IdlePriority,Bn=t.log,Wr=t.unstable_setDisableYieldValue,mn=null,Bt=null;function Xt(o){if(typeof Bn=="function"&&Wr(o),Bt&&typeof Bt.setStrictMode=="function")try{Bt.setStrictMode(mn,o)}catch{}}var nt=Math.clz32?Math.clz32:gn,ve=Math.log,mt=Math.LN2;function gn(o){return o>>>=0,o===0?32:31-(ve(o)/mt|0)|0}var Gr=256,ms=262144,Ad=4194304;function vo(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 Md(o,a,d){var p=o.pendingLanes;if(p===0)return 0;var y=0,x=o.suspendedLanes,w=o.pingedLanes;o=o.warmLanes;var T=p&134217727;return T!==0?(p=T&~x,p!==0?y=vo(p):(w&=T,w!==0?y=vo(w):d||(d=T&~o,d!==0&&(y=vo(d))))):(T=p&~x,T!==0?y=vo(T):w!==0?y=vo(w):d||(d=p&~o,d!==0&&(y=vo(d)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,d=a&-a,x>=d||x===32&&(d&4194048)!==0)?a:y}function ic(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function M2(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 wv(){var o=Ad;return Ad<<=1,(Ad&62914560)===0&&(Ad=4194304),o}function zm(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function sc(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function O2(o,a,d,p,y,x){var w=o.pendingLanes;o.pendingLanes=d,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=d,o.entangledLanes&=d,o.errorRecoveryDisabledLanes&=d,o.shellSuspendCounter=0;var T=o.entanglements,D=o.expirationTimes,$=o.hiddenUpdates;for(d=w&~d;0<d;){var G=31-nt(d),ee=1<<G;T[G]=0,D[G]=-1;var F=$[G];if(F!==null)for($[G]=null,G=0;G<F.length;G++){var K=F[G];K!==null&&(K.lane&=-536870913)}d&=~ee}p!==0&&kv(o,p,0),x!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=x&~(w&~a))}function kv(o,a,d){o.pendingLanes|=a,o.suspendedLanes&=~a;var p=31-nt(a);o.entangledLanes|=a,o.entanglements[p]=o.entanglements[p]|1073741824|d&261930}function Cv(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var p=31-nt(d),y=1<<p;y&a|o[p]&a&&(o[p]|=a),d&=~y}}function Ev(o,a){var d=a&-a;return d=(d&42)!==0?1:Lm(d),(d&(o.suspendedLanes|a))!==0?0:d}function Lm(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 jm(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Tv(){var o=Y.p;return o!==0?o:(o=window.event,o===void 0?32:dC(o.type))}function Av(o,a){var d=Y.p;try{return Y.p=o,a()}finally{Y.p=d}}var gs=Math.random().toString(36).slice(2),yn="__reactFiber$"+gs,Kn="__reactProps$"+gs,vl="__reactContainer$"+gs,Im="__reactEvents$"+gs,_2="__reactListeners$"+gs,D2="__reactHandles$"+gs,Mv="__reactResources$"+gs,oc="__reactMarker$"+gs;function Bm(o){delete o[yn],delete o[Kn],delete o[Im],delete o[_2],delete o[D2]}function Sl(o){var a=o[yn];if(a)return a;for(var d=o.parentNode;d;){if(a=d[vl]||d[yn]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(o=Gk(o);o!==null;){if(d=o[yn])return d;o=Gk(o)}return a}o=d,d=o.parentNode}return null}function wl(o){if(o=o[yn]||o[vl]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function lc(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function kl(o){var a=o[Mv];return a||(a=o[Mv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function tn(o){o[oc]=!0}var Ov=new Set,_v={};function So(o,a){Cl(o,a),Cl(o+"Capture",a)}function Cl(o,a){for(_v[o]=a,o=0;o<a.length;o++)Ov.add(a[o])}var R2=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]*$"),Dv={},Rv={};function N2(o){return or.call(Rv,o)?!0:or.call(Dv,o)?!1:R2.test(o)?Rv[o]=!0:(Dv[o]=!0,!1)}function Od(o,a,d){if(N2(a))if(d===null)o.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var p=a.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+d)}}function _d(o,a,d){if(d===null)o.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+d)}}function Ri(o,a,d,p){if(p===null)o.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(d);return}o.setAttributeNS(a,d,""+p)}}function Cr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Nv(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function z2(o,a,d){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var y=p.get,x=p.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return y.call(this)},set:function(w){d=""+w,x.call(this,w)}}),Object.defineProperty(o,a,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(w){d=""+w},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Um(o){if(!o._valueTracker){var a=Nv(o)?"checked":"value";o._valueTracker=z2(o,a,""+o[a])}}function zv(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var d=a.getValue(),p="";return o&&(p=Nv(o)?o.checked?"true":"false":o.value),o=p,o!==d?(a.setValue(o),!0):!1}function Dd(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 L2=/[\n"\\]/g;function Er(o){return o.replace(L2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Hm(o,a,d,p,y,x,w,T){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=""+Cr(a)):o.value!==""+Cr(a)&&(o.value=""+Cr(a)):w!=="submit"&&w!=="reset"||o.removeAttribute("value"),a!=null?Vm(o,w,Cr(a)):d!=null?Vm(o,w,Cr(d)):p!=null&&o.removeAttribute("value"),y==null&&x!=null&&(o.defaultChecked=!!x),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?o.name=""+Cr(T):o.removeAttribute("name")}function Lv(o,a,d,p,y,x,w,T){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),a!=null||d!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Um(o);return}d=d!=null?""+Cr(d):"",a=a!=null?""+Cr(a):d,T||a===o.value||(o.value=a),o.defaultValue=a}p=p??y,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=T?o.checked:!!p,o.defaultChecked=!!p,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.name=w),Um(o)}function Vm(o,a,d){a==="number"&&Dd(o.ownerDocument)===o||o.defaultValue===""+d||(o.defaultValue=""+d)}function El(o,a,d,p){if(o=o.options,a){a={};for(var y=0;y<d.length;y++)a["$"+d[y]]=!0;for(d=0;d<o.length;d++)y=a.hasOwnProperty("$"+o[d].value),o[d].selected!==y&&(o[d].selected=y),y&&p&&(o[d].defaultSelected=!0)}else{for(d=""+Cr(d),a=null,y=0;y<o.length;y++){if(o[y].value===d){o[y].selected=!0,p&&(o[y].defaultSelected=!0);return}a!==null||o[y].disabled||(a=o[y])}a!==null&&(a.selected=!0)}}function jv(o,a,d){if(a!=null&&(a=""+Cr(a),a!==o.value&&(o.value=a),d==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=d!=null?""+Cr(d):""}function Iv(o,a,d,p){if(a==null){if(p!=null){if(d!=null)throw Error(r(92));if(V(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),a=d}d=Cr(a),o.defaultValue=d,p=o.textContent,p===d&&p!==""&&p!==null&&(o.value=p),Um(o)}function Tl(o,a){if(a){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=a;return}}o.textContent=a}var j2=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 Bv(o,a,d){var p=a.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":p?o.setProperty(a,d):typeof d!="number"||d===0||j2.has(a)?a==="float"?o.cssFloat=d:o[a]=(""+d).trim():o[a]=d+"px"}function Uv(o,a,d){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||a!=null&&a.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var y in a)p=a[y],a.hasOwnProperty(y)&&d[y]!==p&&Bv(o,y,p)}else for(var x in a)a.hasOwnProperty(x)&&Bv(o,x,a[x])}function Pm(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 I2=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"]]),B2=/^[\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 Rd(o){return B2.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Ni(){}var $m=null;function Fm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Al=null,Ml=null;function Hv(o){var a=wl(o);if(a&&(o=a.stateNode)){var d=o[Kn]||null;e:switch(o=a.stateNode,a.type){case"input":if(Hm(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),a=d.name,d.type==="radio"&&a!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Er(""+a)+'"][type="radio"]'),a=0;a<d.length;a++){var p=d[a];if(p!==o&&p.form===o.form){var y=p[Kn]||null;if(!y)throw Error(r(90));Hm(p,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<d.length;a++)p=d[a],p.form===o.form&&zv(p)}break e;case"textarea":jv(o,d.value,d.defaultValue);break e;case"select":a=d.value,a!=null&&El(o,!!d.multiple,a,!1)}}}var qm=!1;function Vv(o,a,d){if(qm)return o(a,d);qm=!0;try{var p=o(a);return p}finally{if(qm=!1,(Al!==null||Ml!==null)&&(vf(),Al&&(a=Al,o=Ml,Ml=Al=null,Hv(a),o)))for(a=0;a<o.length;a++)Hv(o[a])}}function ac(o,a){var d=o.stateNode;if(d===null)return null;var p=d[Kn]||null;if(p===null)return null;d=p[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":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(r(231,a,typeof d));return d}var zi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Km=!1;if(zi)try{var cc={};Object.defineProperty(cc,"passive",{get:function(){Km=!0}}),window.addEventListener("test",cc,cc),window.removeEventListener("test",cc,cc)}catch{Km=!1}var ys=null,Ym=null,Nd=null;function Pv(){if(Nd)return Nd;var o,a=Ym,d=a.length,p,y="value"in ys?ys.value:ys.textContent,x=y.length;for(o=0;o<d&&a[o]===y[o];o++);var w=d-o;for(p=1;p<=w&&a[d-p]===y[x-p];p++);return Nd=y.slice(o,1<p?1-p:void 0)}function zd(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 Ld(){return!0}function $v(){return!1}function Yn(o){function a(d,p,y,x,w){this._reactName=d,this._targetInst=y,this.type=p,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var T in o)o.hasOwnProperty(T)&&(d=o[T],this[T]=d?d(x):x[T]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ld:$v,this.isPropagationStopped=$v,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Ld)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Ld)},persist:function(){},isPersistent:Ld}),a}var wo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jd=Yn(wo),uc=m({},wo,{view:0,detail:0}),U2=Yn(uc),Wm,Gm,dc,Id=m({},uc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jm,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!==dc&&(dc&&o.type==="mousemove"?(Wm=o.screenX-dc.screenX,Gm=o.screenY-dc.screenY):Gm=Wm=0,dc=o),Wm)},movementY:function(o){return"movementY"in o?o.movementY:Gm}}),Fv=Yn(Id),H2=m({},Id,{dataTransfer:0}),V2=Yn(H2),P2=m({},uc,{relatedTarget:0}),Zm=Yn(P2),$2=m({},wo,{animationName:0,elapsedTime:0,pseudoElement:0}),F2=Yn($2),q2=m({},wo,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),K2=Yn(q2),Y2=m({},wo,{data:0}),qv=Yn(Y2),W2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},G2={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"},Z2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function J2(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=Z2[o])?!!a[o]:!1}function Jm(){return J2}var X2=m({},uc,{key:function(o){if(o.key){var a=W2[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=zd(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?G2[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jm,charCode:function(o){return o.type==="keypress"?zd(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?zd(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Q2=Yn(X2),eN=m({},Id,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kv=Yn(eN),tN=m({},uc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jm}),nN=Yn(tN),rN=m({},wo,{propertyName:0,elapsedTime:0,pseudoElement:0}),iN=Yn(rN),sN=m({},Id,{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}),oN=Yn(sN),lN=m({},wo,{newState:0,oldState:0}),aN=Yn(lN),cN=[9,13,27,32],Xm=zi&&"CompositionEvent"in window,fc=null;zi&&"documentMode"in document&&(fc=document.documentMode);var uN=zi&&"TextEvent"in window&&!fc,Yv=zi&&(!Xm||fc&&8<fc&&11>=fc),Wv=" ",Gv=!1;function Zv(o,a){switch(o){case"keyup":return cN.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jv(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ol=!1;function dN(o,a){switch(o){case"compositionend":return Jv(a);case"keypress":return a.which!==32?null:(Gv=!0,Wv);case"textInput":return o=a.data,o===Wv&&Gv?null:o;default:return null}}function fN(o,a){if(Ol)return o==="compositionend"||!Xm&&Zv(o,a)?(o=Pv(),Nd=Ym=ys=null,Ol=!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 Yv&&a.locale!=="ko"?null:a.data;default:return null}}var hN={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 Xv(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!hN[o.type]:a==="textarea"}function Qv(o,a,d,p){Al?Ml?Ml.push(p):Ml=[p]:Al=p,a=Af(a,"onChange"),0<a.length&&(d=new jd("onChange","change",null,d,p),o.push({event:d,listeners:a}))}var hc=null,pc=null;function pN(o){Lk(o,0)}function Bd(o){var a=lc(o);if(zv(a))return o}function eS(o,a){if(o==="change")return a}var tS=!1;if(zi){var Qm;if(zi){var eg="oninput"in document;if(!eg){var nS=document.createElement("div");nS.setAttribute("oninput","return;"),eg=typeof nS.oninput=="function"}Qm=eg}else Qm=!1;tS=Qm&&(!document.documentMode||9<document.documentMode)}function rS(){hc&&(hc.detachEvent("onpropertychange",iS),pc=hc=null)}function iS(o){if(o.propertyName==="value"&&Bd(pc)){var a=[];Qv(a,pc,o,Fm(o)),Vv(pN,a)}}function mN(o,a,d){o==="focusin"?(rS(),hc=a,pc=d,hc.attachEvent("onpropertychange",iS)):o==="focusout"&&rS()}function gN(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Bd(pc)}function yN(o,a){if(o==="click")return Bd(a)}function bN(o,a){if(o==="input"||o==="change")return Bd(a)}function xN(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var ar=typeof Object.is=="function"?Object.is:xN;function mc(o,a){if(ar(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),p=Object.keys(a);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var y=d[p];if(!or.call(a,y)||!ar(o[y],a[y]))return!1}return!0}function sS(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function oS(o,a){var d=sS(o);o=0;for(var p;d;){if(d.nodeType===3){if(p=o+d.textContent.length,o<=a&&p>=a)return{node:d,offset:a-o};o=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=sS(d)}}function lS(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?lS(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function aS(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Dd(o.document);a instanceof o.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)o=a.contentWindow;else break;a=Dd(o.document)}return a}function tg(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 vN=zi&&"documentMode"in document&&11>=document.documentMode,_l=null,ng=null,gc=null,rg=!1;function cS(o,a,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;rg||_l==null||_l!==Dd(p)||(p=_l,"selectionStart"in p&&tg(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),gc&&mc(gc,p)||(gc=p,p=Af(ng,"onSelect"),0<p.length&&(a=new jd("onSelect","select",null,a,d),o.push({event:a,listeners:p}),a.target=_l)))}function ko(o,a){var d={};return d[o.toLowerCase()]=a.toLowerCase(),d["Webkit"+o]="webkit"+a,d["Moz"+o]="moz"+a,d}var Dl={animationend:ko("Animation","AnimationEnd"),animationiteration:ko("Animation","AnimationIteration"),animationstart:ko("Animation","AnimationStart"),transitionrun:ko("Transition","TransitionRun"),transitionstart:ko("Transition","TransitionStart"),transitioncancel:ko("Transition","TransitionCancel"),transitionend:ko("Transition","TransitionEnd")},ig={},uS={};zi&&(uS=document.createElement("div").style,"AnimationEvent"in window||(delete Dl.animationend.animation,delete Dl.animationiteration.animation,delete Dl.animationstart.animation),"TransitionEvent"in window||delete Dl.transitionend.transition);function Co(o){if(ig[o])return ig[o];if(!Dl[o])return o;var a=Dl[o],d;for(d in a)if(a.hasOwnProperty(d)&&d in uS)return ig[o]=a[d];return o}var dS=Co("animationend"),fS=Co("animationiteration"),hS=Co("animationstart"),SN=Co("transitionrun"),wN=Co("transitionstart"),kN=Co("transitioncancel"),pS=Co("transitionend"),mS=new Map,sg="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(" ");sg.push("scrollEnd");function Zr(o,a){mS.set(o,a),So(a,[o])}var Ud=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)},Tr=[],Rl=0,og=0;function Hd(){for(var o=Rl,a=og=Rl=0;a<o;){var d=Tr[a];Tr[a++]=null;var p=Tr[a];Tr[a++]=null;var y=Tr[a];Tr[a++]=null;var x=Tr[a];if(Tr[a++]=null,p!==null&&y!==null){var w=p.pending;w===null?y.next=y:(y.next=w.next,w.next=y),p.pending=y}x!==0&&gS(d,y,x)}}function Vd(o,a,d,p){Tr[Rl++]=o,Tr[Rl++]=a,Tr[Rl++]=d,Tr[Rl++]=p,og|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function lg(o,a,d,p){return Vd(o,a,d,p),Pd(o)}function Eo(o,a){return Vd(o,null,null,a),Pd(o)}function gS(o,a,d){o.lanes|=d;var p=o.alternate;p!==null&&(p.lanes|=d);for(var y=!1,x=o.return;x!==null;)x.childLanes|=d,p=x.alternate,p!==null&&(p.childLanes|=d),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-nt(d),o=x.hiddenUpdates,p=o[y],p===null?o[y]=[a]:p.push(a),a.lane=d|536870912),x):null}function Pd(o){if(50<Bc)throw Bc=0,gy=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Nl={};function CN(o,a,d,p){this.tag=o,this.key=d,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=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cr(o,a,d,p){return new CN(o,a,d,p)}function ag(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Li(o,a){var d=o.alternate;return d===null?(d=cr(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&65011712,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d.refCleanup=o.refCleanup,d}function yS(o,a){o.flags&=65011714;var d=o.alternate;return d===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=d.childLanes,o.lanes=d.lanes,o.child=d.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=d.memoizedProps,o.memoizedState=d.memoizedState,o.updateQueue=d.updateQueue,o.type=d.type,a=d.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function $d(o,a,d,p,y,x){var w=0;if(p=o,typeof o=="function")ag(o)&&(w=1);else if(typeof o=="string")w=Oz(o,d,re.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case W:return o=cr(31,d,a,y),o.elementType=W,o.lanes=x,o;case k:return To(d.children,y,x,a);case C:w=8,y|=24;break;case E:return o=cr(12,d,a,y|2),o.elementType=E,o.lanes=x,o;case H:return o=cr(13,d,a,y),o.elementType=H,o.lanes=x,o;case R:return o=cr(19,d,a,y),o.elementType=R,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case N:w=10;break e;case j:w=9;break e;case q:w=11;break e;case I:w=14;break e;case Q:w=16,p=null;break e}w=29,d=Error(r(130,o===null?"null":typeof o,"")),p=null}return a=cr(w,d,a,y),a.elementType=o,a.type=p,a.lanes=x,a}function To(o,a,d,p){return o=cr(7,o,p,a),o.lanes=d,o}function cg(o,a,d){return o=cr(6,o,null,a),o.lanes=d,o}function bS(o){var a=cr(18,null,null,0);return a.stateNode=o,a}function ug(o,a,d){return a=cr(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var xS=new WeakMap;function Ar(o,a){if(typeof o=="object"&&o!==null){var d=xS.get(o);return d!==void 0?d:(a={value:o,source:a,stack:hs(a)},xS.set(o,a),a)}return{value:o,source:a,stack:hs(a)}}var zl=[],Ll=0,Fd=null,yc=0,Mr=[],Or=0,bs=null,ci=1,ui="";function ji(o,a){zl[Ll++]=yc,zl[Ll++]=Fd,Fd=o,yc=a}function vS(o,a,d){Mr[Or++]=ci,Mr[Or++]=ui,Mr[Or++]=bs,bs=o;var p=ci;o=ui;var y=32-nt(p)-1;p&=~(1<<y),d+=1;var x=32-nt(a)+y;if(30<x){var w=y-y%5;x=(p&(1<<w)-1).toString(32),p>>=w,y-=w,ci=1<<32-nt(a)+y|d<<y|p,ui=x+o}else ci=1<<x|d<<y|p,ui=o}function dg(o){o.return!==null&&(ji(o,1),vS(o,1,0))}function fg(o){for(;o===Fd;)Fd=zl[--Ll],zl[Ll]=null,yc=zl[--Ll],zl[Ll]=null;for(;o===bs;)bs=Mr[--Or],Mr[Or]=null,ui=Mr[--Or],Mr[Or]=null,ci=Mr[--Or],Mr[Or]=null}function SS(o,a){Mr[Or++]=ci,Mr[Or++]=ui,Mr[Or++]=bs,ci=a.id,ui=a.overflow,bs=o}var bn=null,Ct=null,Xe=!1,xs=null,_r=!1,hg=Error(r(519));function vs(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bc(Ar(a,o)),hg}function wS(o){var a=o.stateNode,d=o.type,p=o.memoizedProps;switch(a[yn]=o,a[Kn]=p,d){case"dialog":We("cancel",a),We("close",a);break;case"iframe":case"object":case"embed":We("load",a);break;case"video":case"audio":for(d=0;d<Hc.length;d++)We(Hc[d],a);break;case"source":We("error",a);break;case"img":case"image":case"link":We("error",a),We("load",a);break;case"details":We("toggle",a);break;case"input":We("invalid",a),Lv(a,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":We("invalid",a);break;case"textarea":We("invalid",a),Iv(a,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||a.textContent===""+d||p.suppressHydrationWarning===!0||Uk(a.textContent,d)?(p.popover!=null&&(We("beforetoggle",a),We("toggle",a)),p.onScroll!=null&&We("scroll",a),p.onScrollEnd!=null&&We("scrollend",a),p.onClick!=null&&(a.onclick=Ni),a=!0):a=!1,a||vs(o,!0)}function kS(o){for(bn=o.return;bn;)switch(bn.tag){case 5:case 31:case 13:_r=!1;return;case 27:case 3:_r=!0;return;default:bn=bn.return}}function jl(o){if(o!==bn)return!1;if(!Xe)return kS(o),Xe=!0,!1;var a=o.tag,d;if((d=a!==3&&a!==27)&&((d=a===5)&&(d=o.type,d=!(d!=="form"&&d!=="button")||Dy(o.type,o.memoizedProps)),d=!d),d&&Ct&&vs(o),kS(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Ct=Wk(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Ct=Wk(o)}else a===27?(a=Ct,zs(o.type)?(o=jy,jy=null,Ct=o):Ct=a):Ct=bn?Rr(o.stateNode.nextSibling):null;return!0}function Ao(){Ct=bn=null,Xe=!1}function pg(){var o=xs;return o!==null&&(Jn===null?Jn=o:Jn.push.apply(Jn,o),xs=null),o}function bc(o){xs===null?xs=[o]:xs.push(o)}var mg=_(null),Mo=null,Ii=null;function Ss(o,a,d){A(mg,a._currentValue),a._currentValue=d}function Bi(o){o._currentValue=mg.current,B(mg)}function gg(o,a,d){for(;o!==null;){var p=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,p!==null&&(p.childLanes|=a)):p!==null&&(p.childLanes&a)!==a&&(p.childLanes|=a),o===d)break;o=o.return}}function yg(o,a,d,p){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 T=x;x=y;for(var D=0;D<a.length;D++)if(T.context===a[D]){x.lanes|=d,T=x.alternate,T!==null&&(T.lanes|=d),gg(x.return,d,o),p||(w=null);break e}x=T.next}}else if(y.tag===18){if(w=y.return,w===null)throw Error(r(341));w.lanes|=d,x=w.alternate,x!==null&&(x.lanes|=d),gg(w,d,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 Il(o,a,d,p){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 T=y.type;ar(y.pendingProps.value,w.value)||(o!==null?o.push(T):o=[T])}}else if(y===me.current){if(w=y.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(qc):o=[qc])}y=y.return}o!==null&&yg(a,o,d,p),a.flags|=262144}function qd(o){for(o=o.firstContext;o!==null;){if(!ar(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Oo(o){Mo=o,Ii=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function xn(o){return CS(Mo,o)}function Kd(o,a){return Mo===null&&Oo(o),CS(o,a)}function CS(o,a){var d=a._currentValue;if(a={context:a,memoizedValue:d,next:null},Ii===null){if(o===null)throw Error(r(308));Ii=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else Ii=Ii.next=a;return d}var EN=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(d,p){o.push(p)}};this.abort=function(){a.aborted=!0,o.forEach(function(d){return d()})}},TN=t.unstable_scheduleCallback,AN=t.unstable_NormalPriority,$t={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bg(){return{controller:new EN,data:new Map,refCount:0}}function xc(o){o.refCount--,o.refCount===0&&TN(AN,function(){o.controller.abort()})}var vc=null,xg=0,Bl=0,Ul=null;function MN(o,a){if(vc===null){var d=vc=[];xg=0,Bl=wy(),Ul={status:"pending",value:void 0,then:function(p){d.push(p)}}}return xg++,a.then(ES,ES),a}function ES(){if(--xg===0&&vc!==null){Ul!==null&&(Ul.status="fulfilled");var o=vc;vc=null,Bl=0,Ul=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function ON(o,a){var d=[],p={status:"pending",value:null,reason:null,then:function(y){d.push(y)}};return o.then(function(){p.status="fulfilled",p.value=a;for(var y=0;y<d.length;y++)(0,d[y])(a)},function(y){for(p.status="rejected",p.reason=y,y=0;y<d.length;y++)(0,d[y])(void 0)}),p}var TS=z.S;z.S=function(o,a){ck=Jt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&MN(o,a),TS!==null&&TS(o,a)};var _o=_(null);function vg(){var o=_o.current;return o!==null?o:gt.pooledCache}function Yd(o,a){a===null?A(_o,_o.current):A(_o,a.pool)}function AS(){var o=vg();return o===null?null:{parent:$t._currentValue,pool:o}}var Hl=Error(r(460)),Sg=Error(r(474)),Wd=Error(r(542)),Gd={then:function(){}};function MS(o){return o=o.status,o==="fulfilled"||o==="rejected"}function OS(o,a,d){switch(d=o[d],d===void 0?o.push(a):d!==a&&(a.then(Ni,Ni),a=d),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,DS(o),o;default:if(typeof a.status=="string")a.then(Ni,Ni);else{if(o=gt,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(p){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=p}},function(p){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=p}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,DS(o),o}throw Ro=a,Hl}}function Do(o){try{var a=o._init;return a(o._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Ro=d,Hl):d}}var Ro=null;function _S(){if(Ro===null)throw Error(r(459));var o=Ro;return Ro=null,o}function DS(o){if(o===Hl||o===Wd)throw Error(r(483))}var Vl=null,Sc=0;function Zd(o){var a=Sc;return Sc+=1,Vl===null&&(Vl=[]),OS(Vl,o,a)}function wc(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Jd(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 RS(o){function a(U,L){if(o){var P=U.deletions;P===null?(U.deletions=[L],U.flags|=16):P.push(L)}}function d(U,L){if(!o)return null;for(;L!==null;)a(U,L),L=L.sibling;return null}function p(U){for(var L=new Map;U!==null;)U.key!==null?L.set(U.key,U):L.set(U.index,U),U=U.sibling;return L}function y(U,L){return U=Li(U,L),U.index=0,U.sibling=null,U}function x(U,L,P){return U.index=P,o?(P=U.alternate,P!==null?(P=P.index,P<L?(U.flags|=67108866,L):P):(U.flags|=67108866,L)):(U.flags|=1048576,L)}function w(U){return o&&U.alternate===null&&(U.flags|=67108866),U}function T(U,L,P,X){return L===null||L.tag!==6?(L=cg(P,U.mode,X),L.return=U,L):(L=y(L,P),L.return=U,L)}function D(U,L,P,X){var Me=P.type;return Me===k?G(U,L,P.props.children,X,P.key):L!==null&&(L.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===Q&&Do(Me)===L.type)?(L=y(L,P.props),wc(L,P),L.return=U,L):(L=$d(P.type,P.key,P.props,null,U.mode,X),wc(L,P),L.return=U,L)}function $(U,L,P,X){return L===null||L.tag!==4||L.stateNode.containerInfo!==P.containerInfo||L.stateNode.implementation!==P.implementation?(L=ug(P,U.mode,X),L.return=U,L):(L=y(L,P.children||[]),L.return=U,L)}function G(U,L,P,X,Me){return L===null||L.tag!==7?(L=To(P,U.mode,X,Me),L.return=U,L):(L=y(L,P),L.return=U,L)}function ee(U,L,P){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=cg(""+L,U.mode,P),L.return=U,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case b:return P=$d(L.type,L.key,L.props,null,U.mode,P),wc(P,L),P.return=U,P;case v:return L=ug(L,U.mode,P),L.return=U,L;case Q:return L=Do(L),ee(U,L,P)}if(V(L)||se(L))return L=To(L,U.mode,P,null),L.return=U,L;if(typeof L.then=="function")return ee(U,Zd(L),P);if(L.$$typeof===N)return ee(U,Kd(U,L),P);Jd(U,L)}return null}function F(U,L,P,X){var Me=L!==null?L.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Me!==null?null:T(U,L,""+P,X);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case b:return P.key===Me?D(U,L,P,X):null;case v:return P.key===Me?$(U,L,P,X):null;case Q:return P=Do(P),F(U,L,P,X)}if(V(P)||se(P))return Me!==null?null:G(U,L,P,X,null);if(typeof P.then=="function")return F(U,L,Zd(P),X);if(P.$$typeof===N)return F(U,L,Kd(U,P),X);Jd(U,P)}return null}function K(U,L,P,X,Me){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return U=U.get(P)||null,T(L,U,""+X,Me);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case b:return U=U.get(X.key===null?P:X.key)||null,D(L,U,X,Me);case v:return U=U.get(X.key===null?P:X.key)||null,$(L,U,X,Me);case Q:return X=Do(X),K(U,L,P,X,Me)}if(V(X)||se(X))return U=U.get(P)||null,G(L,U,X,Me,null);if(typeof X.then=="function")return K(U,L,P,Zd(X),Me);if(X.$$typeof===N)return K(U,L,P,Kd(L,X),Me);Jd(L,X)}return null}function xe(U,L,P,X){for(var Me=null,rt=null,Ce=L,Ve=L=0,Ze=null;Ce!==null&&Ve<P.length;Ve++){Ce.index>Ve?(Ze=Ce,Ce=null):Ze=Ce.sibling;var it=F(U,Ce,P[Ve],X);if(it===null){Ce===null&&(Ce=Ze);break}o&&Ce&&it.alternate===null&&a(U,Ce),L=x(it,L,Ve),rt===null?Me=it:rt.sibling=it,rt=it,Ce=Ze}if(Ve===P.length)return d(U,Ce),Xe&&ji(U,Ve),Me;if(Ce===null){for(;Ve<P.length;Ve++)Ce=ee(U,P[Ve],X),Ce!==null&&(L=x(Ce,L,Ve),rt===null?Me=Ce:rt.sibling=Ce,rt=Ce);return Xe&&ji(U,Ve),Me}for(Ce=p(Ce);Ve<P.length;Ve++)Ze=K(Ce,U,Ve,P[Ve],X),Ze!==null&&(o&&Ze.alternate!==null&&Ce.delete(Ze.key===null?Ve:Ze.key),L=x(Ze,L,Ve),rt===null?Me=Ze:rt.sibling=Ze,rt=Ze);return o&&Ce.forEach(function(Us){return a(U,Us)}),Xe&&ji(U,Ve),Me}function Re(U,L,P,X){if(P==null)throw Error(r(151));for(var Me=null,rt=null,Ce=L,Ve=L=0,Ze=null,it=P.next();Ce!==null&&!it.done;Ve++,it=P.next()){Ce.index>Ve?(Ze=Ce,Ce=null):Ze=Ce.sibling;var Us=F(U,Ce,it.value,X);if(Us===null){Ce===null&&(Ce=Ze);break}o&&Ce&&Us.alternate===null&&a(U,Ce),L=x(Us,L,Ve),rt===null?Me=Us:rt.sibling=Us,rt=Us,Ce=Ze}if(it.done)return d(U,Ce),Xe&&ji(U,Ve),Me;if(Ce===null){for(;!it.done;Ve++,it=P.next())it=ee(U,it.value,X),it!==null&&(L=x(it,L,Ve),rt===null?Me=it:rt.sibling=it,rt=it);return Xe&&ji(U,Ve),Me}for(Ce=p(Ce);!it.done;Ve++,it=P.next())it=K(Ce,U,Ve,it.value,X),it!==null&&(o&&it.alternate!==null&&Ce.delete(it.key===null?Ve:it.key),L=x(it,L,Ve),rt===null?Me=it:rt.sibling=it,rt=it);return o&&Ce.forEach(function(Hz){return a(U,Hz)}),Xe&&ji(U,Ve),Me}function ft(U,L,P,X){if(typeof P=="object"&&P!==null&&P.type===k&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case b:e:{for(var Me=P.key;L!==null;){if(L.key===Me){if(Me=P.type,Me===k){if(L.tag===7){d(U,L.sibling),X=y(L,P.props.children),X.return=U,U=X;break e}}else if(L.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===Q&&Do(Me)===L.type){d(U,L.sibling),X=y(L,P.props),wc(X,P),X.return=U,U=X;break e}d(U,L);break}else a(U,L);L=L.sibling}P.type===k?(X=To(P.props.children,U.mode,X,P.key),X.return=U,U=X):(X=$d(P.type,P.key,P.props,null,U.mode,X),wc(X,P),X.return=U,U=X)}return w(U);case v:e:{for(Me=P.key;L!==null;){if(L.key===Me)if(L.tag===4&&L.stateNode.containerInfo===P.containerInfo&&L.stateNode.implementation===P.implementation){d(U,L.sibling),X=y(L,P.children||[]),X.return=U,U=X;break e}else{d(U,L);break}else a(U,L);L=L.sibling}X=ug(P,U.mode,X),X.return=U,U=X}return w(U);case Q:return P=Do(P),ft(U,L,P,X)}if(V(P))return xe(U,L,P,X);if(se(P)){if(Me=se(P),typeof Me!="function")throw Error(r(150));return P=Me.call(P),Re(U,L,P,X)}if(typeof P.then=="function")return ft(U,L,Zd(P),X);if(P.$$typeof===N)return ft(U,L,Kd(U,P),X);Jd(U,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,L!==null&&L.tag===6?(d(U,L.sibling),X=y(L,P),X.return=U,U=X):(d(U,L),X=cg(P,U.mode,X),X.return=U,U=X),w(U)):d(U,L)}return function(U,L,P,X){try{Sc=0;var Me=ft(U,L,P,X);return Vl=null,Me}catch(Ce){if(Ce===Hl||Ce===Wd)throw Ce;var rt=cr(29,Ce,null,U.mode);return rt.lanes=X,rt.return=U,rt}finally{}}}var No=RS(!0),NS=RS(!1),ws=!1;function wg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function kg(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 ks(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Cs(o,a,d){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(ot&2)!==0){var y=p.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),p.pending=a,a=Pd(o),gS(o,null,d),a}return Vd(o,p,a,d),Pd(o)}function kc(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194048)!==0)){var p=a.lanes;p&=o.pendingLanes,d|=p,a.lanes=d,Cv(o,d)}}function Cg(o,a){var d=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var y=null,x=null;if(d=d.firstBaseUpdate,d!==null){do{var w={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};x===null?y=x=w:x=x.next=w,d=d.next}while(d!==null);x===null?y=x=a:x=x.next=a}else y=x=a;d={baseState:p.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}var Eg=!1;function Cc(){if(Eg){var o=Ul;if(o!==null)throw o}}function Ec(o,a,d,p){Eg=!1;var y=o.updateQueue;ws=!1;var x=y.firstBaseUpdate,w=y.lastBaseUpdate,T=y.shared.pending;if(T!==null){y.shared.pending=null;var D=T,$=D.next;D.next=null,w===null?x=$:w.next=$,w=D;var G=o.alternate;G!==null&&(G=G.updateQueue,T=G.lastBaseUpdate,T!==w&&(T===null?G.firstBaseUpdate=$:T.next=$,G.lastBaseUpdate=D))}if(x!==null){var ee=y.baseState;w=0,G=$=D=null,T=x;do{var F=T.lane&-536870913,K=F!==T.lane;if(K?(Ge&F)===F:(p&F)===F){F!==0&&F===Bl&&(Eg=!0),G!==null&&(G=G.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var xe=o,Re=T;F=a;var ft=d;switch(Re.tag){case 1:if(xe=Re.payload,typeof xe=="function"){ee=xe.call(ft,ee,F);break e}ee=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Re.payload,F=typeof xe=="function"?xe.call(ft,ee,F):xe,F==null)break e;ee=m({},ee,F);break e;case 2:ws=!0}}F=T.callback,F!==null&&(o.flags|=64,K&&(o.flags|=8192),K=y.callbacks,K===null?y.callbacks=[F]:K.push(F))}else K={lane:F,tag:T.tag,payload:T.payload,callback:T.callback,next:null},G===null?($=G=K,D=ee):G=G.next=K,w|=F;if(T=T.next,T===null){if(T=y.shared.pending,T===null)break;K=T,T=K.next,K.next=null,y.lastBaseUpdate=K,y.shared.pending=null}}while(!0);G===null&&(D=ee),y.baseState=D,y.firstBaseUpdate=$,y.lastBaseUpdate=G,x===null&&(y.shared.lanes=0),Os|=w,o.lanes=w,o.memoizedState=ee}}function zS(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function LS(o,a){var d=o.callbacks;if(d!==null)for(o.callbacks=null,o=0;o<d.length;o++)zS(d[o],a)}var Pl=_(null),Xd=_(0);function jS(o,a){o=Yi,A(Xd,o),A(Pl,a),Yi=o|a.baseLanes}function Tg(){A(Xd,Yi),A(Pl,Pl.current)}function Ag(){Yi=Xd.current,B(Pl),B(Xd)}var ur=_(null),Dr=null;function Es(o){var a=o.alternate;A(Ut,Ut.current&1),A(ur,o),Dr===null&&(a===null||Pl.current!==null||a.memoizedState!==null)&&(Dr=o)}function Mg(o){A(Ut,Ut.current),A(ur,o),Dr===null&&(Dr=o)}function IS(o){o.tag===22?(A(Ut,Ut.current),A(ur,o),Dr===null&&(Dr=o)):Ts()}function Ts(){A(Ut,Ut.current),A(ur,ur.current)}function dr(o){B(ur),Dr===o&&(Dr=null),B(Ut)}var Ut=_(0);function Qd(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||zy(d)||Ly(d)))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 Ui=0,He=null,ut=null,Ft=null,ef=!1,$l=!1,zo=!1,tf=0,Tc=0,Fl=null,_N=0;function Dt(){throw Error(r(321))}function Og(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!ar(o[d],a[d]))return!1;return!0}function _g(o,a,d,p,y,x){return Ui=x,He=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,z.H=o===null||o.memoizedState===null?vw:qg,zo=!1,x=d(p,y),zo=!1,$l&&(x=US(a,d,p,y)),BS(o),x}function BS(o){z.H=Oc;var a=ut!==null&&ut.next!==null;if(Ui=0,Ft=ut=He=null,ef=!1,Tc=0,Fl=null,a)throw Error(r(300));o===null||qt||(o=o.dependencies,o!==null&&qd(o)&&(qt=!0))}function US(o,a,d,p){He=o;var y=0;do{if($l&&(Fl=null),Tc=0,$l=!1,25<=y)throw Error(r(301));if(y+=1,Ft=ut=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}z.H=Sw,x=a(d,p)}while($l);return x}function DN(){var o=z.H,a=o.useState()[0];return a=typeof a.then=="function"?Ac(a):a,o=o.useState()[0],(ut!==null?ut.memoizedState:null)!==o&&(He.flags|=1024),a}function Dg(){var o=tf!==0;return tf=0,o}function Rg(o,a,d){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~d}function Ng(o){if(ef){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}ef=!1}Ui=0,Ft=ut=He=null,$l=!1,Tc=tf=0,Fl=null}function Un(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?He.memoizedState=Ft=o:Ft=Ft.next=o,Ft}function Ht(){if(ut===null){var o=He.alternate;o=o!==null?o.memoizedState:null}else o=ut.next;var a=Ft===null?He.memoizedState:Ft.next;if(a!==null)Ft=a,ut=o;else{if(o===null)throw He.alternate===null?Error(r(467)):Error(r(310));ut=o,o={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Ft===null?He.memoizedState=Ft=o:Ft=Ft.next=o}return Ft}function nf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ac(o){var a=Tc;return Tc+=1,Fl===null&&(Fl=[]),o=OS(Fl,o,a),a=He,(Ft===null?a.memoizedState:Ft.next)===null&&(a=a.alternate,z.H=a===null||a.memoizedState===null?vw:qg),o}function rf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ac(o);if(o.$$typeof===N)return xn(o)}throw Error(r(438,String(o)))}function zg(o){var a=null,d=He.updateQueue;if(d!==null&&(a=d.memoCache),a==null){var p=He.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(a={data:p.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),d===null&&(d=nf(),He.updateQueue=d),d.memoCache=a,d=a.data[a.index],d===void 0)for(d=a.data[a.index]=Array(o),p=0;p<o;p++)d[p]=oe;return a.index++,d}function Hi(o,a){return typeof a=="function"?a(o):a}function sf(o){var a=Ht();return Lg(a,ut,o)}function Lg(o,a,d){var p=o.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var y=o.baseQueue,x=p.pending;if(x!==null){if(y!==null){var w=y.next;y.next=x.next,x.next=w}a.baseQueue=y=x,p.pending=null}if(x=o.baseState,y===null)o.memoizedState=x;else{a=y.next;var T=w=null,D=null,$=a,G=!1;do{var ee=$.lane&-536870913;if(ee!==$.lane?(Ge&ee)===ee:(Ui&ee)===ee){var F=$.revertLane;if(F===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),ee===Bl&&(G=!0);else if((Ui&F)===F){$=$.next,F===Bl&&(G=!0);continue}else ee={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},D===null?(T=D=ee,w=x):D=D.next=ee,He.lanes|=F,Os|=F;ee=$.action,zo&&d(x,ee),x=$.hasEagerState?$.eagerState:d(x,ee)}else F={lane:ee,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},D===null?(T=D=F,w=x):D=D.next=F,He.lanes|=ee,Os|=ee;$=$.next}while($!==null&&$!==a);if(D===null?w=x:D.next=T,!ar(x,o.memoizedState)&&(qt=!0,G&&(d=Ul,d!==null)))throw d;o.memoizedState=x,o.baseState=w,o.baseQueue=D,p.lastRenderedState=x}return y===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function jg(o){var a=Ht(),d=a.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var p=d.dispatch,y=d.pending,x=a.memoizedState;if(y!==null){d.pending=null;var w=y=y.next;do x=o(x,w.action),w=w.next;while(w!==y);ar(x,a.memoizedState)||(qt=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),d.lastRenderedState=x}return[x,p]}function HS(o,a,d){var p=He,y=Ht(),x=Xe;if(x){if(d===void 0)throw Error(r(407));d=d()}else d=a();var w=!ar((ut||y).memoizedState,d);if(w&&(y.memoizedState=d,qt=!0),y=y.queue,Ug($S.bind(null,p,y,o),[o]),y.getSnapshot!==a||w||Ft!==null&&Ft.memoizedState.tag&1){if(p.flags|=2048,ql(9,{destroy:void 0},PS.bind(null,p,y,d,a),null),gt===null)throw Error(r(349));x||(Ui&127)!==0||VS(p,a,d)}return d}function VS(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=He.updateQueue,a===null?(a=nf(),He.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function PS(o,a,d,p){a.value=d,a.getSnapshot=p,FS(a)&&qS(o)}function $S(o,a,d){return d(function(){FS(a)&&qS(o)})}function FS(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!ar(o,d)}catch{return!0}}function qS(o){var a=Eo(o,2);a!==null&&Xn(a,o,2)}function Ig(o){var a=Un();if(typeof o=="function"){var d=o;if(o=d(),zo){Xt(!0);try{d()}finally{Xt(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hi,lastRenderedState:o},a}function KS(o,a,d,p){return o.baseState=d,Lg(o,ut,typeof p=="function"?p:Hi)}function RN(o,a,d,p,y){if(af(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)}};z.T!==null?d(!0):x.isTransition=!1,p(x),d=a.pending,d===null?(x.next=a.pending=x,YS(a,x)):(x.next=d.next,a.pending=d.next=x)}}function YS(o,a){var d=a.action,p=a.payload,y=o.state;if(a.isTransition){var x=z.T,w={};z.T=w;try{var T=d(y,p),D=z.S;D!==null&&D(w,T),WS(o,a,T)}catch($){Bg(o,a,$)}finally{x!==null&&w.types!==null&&(x.types=w.types),z.T=x}}else try{x=d(y,p),WS(o,a,x)}catch($){Bg(o,a,$)}}function WS(o,a,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){GS(o,a,p)},function(p){return Bg(o,a,p)}):GS(o,a,d)}function GS(o,a,d){a.status="fulfilled",a.value=d,ZS(a),o.state=d,a=o.pending,a!==null&&(d=a.next,d===a?o.pending=null:(d=d.next,a.next=d,YS(o,d)))}function Bg(o,a,d){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do a.status="rejected",a.reason=d,ZS(a),a=a.next;while(a!==p)}o.action=null}function ZS(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function JS(o,a){return a}function XS(o,a){if(Xe){var d=gt.formState;if(d!==null){e:{var p=He;if(Xe){if(Ct){t:{for(var y=Ct,x=_r;y.nodeType!==8;){if(!x){y=null;break t}if(y=Rr(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){Ct=Rr(y.nextSibling),p=y.data==="F!";break e}}vs(p)}p=!1}p&&(a=d[0])}}return d=Un(),d.memoizedState=d.baseState=a,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:JS,lastRenderedState:a},d.queue=p,d=yw.bind(null,He,p),p.dispatch=d,p=Ig(!1),x=Fg.bind(null,He,!1,p.queue),p=Un(),y={state:a,dispatch:null,action:o,pending:null},p.queue=y,d=RN.bind(null,He,y,x,d),y.dispatch=d,p.memoizedState=o,[a,d,!1]}function QS(o){var a=Ht();return ew(a,ut,o)}function ew(o,a,d){if(a=Lg(o,a,JS)[0],o=sf(Hi)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var p=Ac(a)}catch(w){throw w===Hl?Wd:w}else p=a;a=Ht();var y=a.queue,x=y.dispatch;return d!==a.memoizedState&&(He.flags|=2048,ql(9,{destroy:void 0},NN.bind(null,y,d),null)),[p,x,o]}function NN(o,a){o.action=a}function tw(o){var a=Ht(),d=ut;if(d!==null)return ew(a,d,o);Ht(),a=a.memoizedState,d=Ht();var p=d.queue.dispatch;return d.memoizedState=o,[a,p,!1]}function ql(o,a,d,p){return o={tag:o,create:d,deps:p,inst:a,next:null},a=He.updateQueue,a===null&&(a=nf(),He.updateQueue=a),d=a.lastEffect,d===null?a.lastEffect=o.next=o:(p=d.next,d.next=o,o.next=p,a.lastEffect=o),o}function nw(){return Ht().memoizedState}function of(o,a,d,p){var y=Un();He.flags|=o,y.memoizedState=ql(1|a,{destroy:void 0},d,p===void 0?null:p)}function lf(o,a,d,p){var y=Ht();p=p===void 0?null:p;var x=y.memoizedState.inst;ut!==null&&p!==null&&Og(p,ut.memoizedState.deps)?y.memoizedState=ql(a,x,d,p):(He.flags|=o,y.memoizedState=ql(1|a,x,d,p))}function rw(o,a){of(8390656,8,o,a)}function Ug(o,a){lf(2048,8,o,a)}function zN(o){He.flags|=4;var a=He.updateQueue;if(a===null)a=nf(),He.updateQueue=a,a.events=[o];else{var d=a.events;d===null?a.events=[o]:d.push(o)}}function iw(o){var a=Ht().memoizedState;return zN({ref:a,nextImpl:o}),function(){if((ot&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function sw(o,a){return lf(4,2,o,a)}function ow(o,a){return lf(4,4,o,a)}function lw(o,a){if(typeof a=="function"){o=o();var d=a(o);return function(){typeof d=="function"?d():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function aw(o,a,d){d=d!=null?d.concat([o]):null,lf(4,4,lw.bind(null,a,o),d)}function Hg(){}function cw(o,a){var d=Ht();a=a===void 0?null:a;var p=d.memoizedState;return a!==null&&Og(a,p[1])?p[0]:(d.memoizedState=[o,a],o)}function uw(o,a){var d=Ht();a=a===void 0?null:a;var p=d.memoizedState;if(a!==null&&Og(a,p[1]))return p[0];if(p=o(),zo){Xt(!0);try{o()}finally{Xt(!1)}}return d.memoizedState=[p,a],p}function Vg(o,a,d){return d===void 0||(Ui&1073741824)!==0&&(Ge&261930)===0?o.memoizedState=a:(o.memoizedState=d,o=dk(),He.lanes|=o,Os|=o,d)}function dw(o,a,d,p){return ar(d,a)?d:Pl.current!==null?(o=Vg(o,d,p),ar(o,a)||(qt=!0),o):(Ui&42)===0||(Ui&1073741824)!==0&&(Ge&261930)===0?(qt=!0,o.memoizedState=d):(o=dk(),He.lanes|=o,Os|=o,a)}function fw(o,a,d,p,y){var x=Y.p;Y.p=x!==0&&8>x?x:8;var w=z.T,T={};z.T=T,Fg(o,!1,a,d);try{var D=y(),$=z.S;if($!==null&&$(T,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var G=ON(D,p);Mc(o,a,G,pr(o))}else Mc(o,a,p,pr(o))}catch(ee){Mc(o,a,{then:function(){},status:"rejected",reason:ee},pr())}finally{Y.p=x,w!==null&&T.types!==null&&(w.types=T.types),z.T=w}}function LN(){}function Pg(o,a,d,p){if(o.tag!==5)throw Error(r(476));var y=hw(o).queue;fw(o,y,a,pe,d===null?LN:function(){return pw(o),d(p)})}function hw(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hi,lastRenderedState:pe},next:null};var d={};return a.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hi,lastRenderedState:d},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function pw(o){var a=hw(o);a.next===null&&(a=o.alternate.memoizedState),Mc(o,a.next.queue,{},pr())}function $g(){return xn(qc)}function mw(){return Ht().memoizedState}function gw(){return Ht().memoizedState}function jN(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var d=pr();o=ks(d);var p=Cs(a,o,d);p!==null&&(Xn(p,a,d),kc(p,a,d)),a={cache:bg()},o.payload=a;return}a=a.return}}function IN(o,a,d){var p=pr();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},af(o)?bw(a,d):(d=lg(o,a,d,p),d!==null&&(Xn(d,o,p),xw(d,a,p)))}function yw(o,a,d){var p=pr();Mc(o,a,d,p)}function Mc(o,a,d,p){var y={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(af(o))bw(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,T=x(w,d);if(y.hasEagerState=!0,y.eagerState=T,ar(T,w))return Vd(o,a,y,0),gt===null&&Hd(),!1}catch{}finally{}if(d=lg(o,a,y,p),d!==null)return Xn(d,o,p),xw(d,a,p),!0}return!1}function Fg(o,a,d,p){if(p={lane:2,revertLane:wy(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},af(o)){if(a)throw Error(r(479))}else a=lg(o,d,p,2),a!==null&&Xn(a,o,2)}function af(o){var a=o.alternate;return o===He||a!==null&&a===He}function bw(o,a){$l=ef=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function xw(o,a,d){if((d&4194048)!==0){var p=a.lanes;p&=o.pendingLanes,d|=p,a.lanes=d,Cv(o,d)}}var Oc={readContext:xn,use:rf,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};Oc.useEffectEvent=Dt;var vw={readContext:xn,use:rf,useCallback:function(o,a){return Un().memoizedState=[o,a===void 0?null:a],o},useContext:xn,useEffect:rw,useImperativeHandle:function(o,a,d){d=d!=null?d.concat([o]):null,of(4194308,4,lw.bind(null,a,o),d)},useLayoutEffect:function(o,a){return of(4194308,4,o,a)},useInsertionEffect:function(o,a){of(4,2,o,a)},useMemo:function(o,a){var d=Un();a=a===void 0?null:a;var p=o();if(zo){Xt(!0);try{o()}finally{Xt(!1)}}return d.memoizedState=[p,a],p},useReducer:function(o,a,d){var p=Un();if(d!==void 0){var y=d(a);if(zo){Xt(!0);try{d(a)}finally{Xt(!1)}}}else y=a;return p.memoizedState=p.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},p.queue=o,o=o.dispatch=IN.bind(null,He,o),[p.memoizedState,o]},useRef:function(o){var a=Un();return o={current:o},a.memoizedState=o},useState:function(o){o=Ig(o);var a=o.queue,d=yw.bind(null,He,a);return a.dispatch=d,[o.memoizedState,d]},useDebugValue:Hg,useDeferredValue:function(o,a){var d=Un();return Vg(d,o,a)},useTransition:function(){var o=Ig(!1);return o=fw.bind(null,He,o.queue,!0,!1),Un().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,d){var p=He,y=Un();if(Xe){if(d===void 0)throw Error(r(407));d=d()}else{if(d=a(),gt===null)throw Error(r(349));(Ge&127)!==0||VS(p,a,d)}y.memoizedState=d;var x={value:d,getSnapshot:a};return y.queue=x,rw($S.bind(null,p,x,o),[o]),p.flags|=2048,ql(9,{destroy:void 0},PS.bind(null,p,x,d,a),null),d},useId:function(){var o=Un(),a=gt.identifierPrefix;if(Xe){var d=ui,p=ci;d=(p&~(1<<32-nt(p)-1)).toString(32)+d,a="_"+a+"R_"+d,d=tf++,0<d&&(a+="H"+d.toString(32)),a+="_"}else d=_N++,a="_"+a+"r_"+d.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:$g,useFormState:XS,useActionState:XS,useOptimistic:function(o){var a=Un();a.memoizedState=a.baseState=o;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=d,a=Fg.bind(null,He,!0,d),d.dispatch=a,[o,a]},useMemoCache:zg,useCacheRefresh:function(){return Un().memoizedState=jN.bind(null,He)},useEffectEvent:function(o){var a=Un(),d={impl:o};return a.memoizedState=d,function(){if((ot&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},qg={readContext:xn,use:rf,useCallback:cw,useContext:xn,useEffect:Ug,useImperativeHandle:aw,useInsertionEffect:sw,useLayoutEffect:ow,useMemo:uw,useReducer:sf,useRef:nw,useState:function(){return sf(Hi)},useDebugValue:Hg,useDeferredValue:function(o,a){var d=Ht();return dw(d,ut.memoizedState,o,a)},useTransition:function(){var o=sf(Hi)[0],a=Ht().memoizedState;return[typeof o=="boolean"?o:Ac(o),a]},useSyncExternalStore:HS,useId:mw,useHostTransitionStatus:$g,useFormState:QS,useActionState:QS,useOptimistic:function(o,a){var d=Ht();return KS(d,ut,o,a)},useMemoCache:zg,useCacheRefresh:gw};qg.useEffectEvent=iw;var Sw={readContext:xn,use:rf,useCallback:cw,useContext:xn,useEffect:Ug,useImperativeHandle:aw,useInsertionEffect:sw,useLayoutEffect:ow,useMemo:uw,useReducer:jg,useRef:nw,useState:function(){return jg(Hi)},useDebugValue:Hg,useDeferredValue:function(o,a){var d=Ht();return ut===null?Vg(d,o,a):dw(d,ut.memoizedState,o,a)},useTransition:function(){var o=jg(Hi)[0],a=Ht().memoizedState;return[typeof o=="boolean"?o:Ac(o),a]},useSyncExternalStore:HS,useId:mw,useHostTransitionStatus:$g,useFormState:tw,useActionState:tw,useOptimistic:function(o,a){var d=Ht();return ut!==null?KS(d,ut,o,a):(d.baseState=o,[o,d.queue.dispatch])},useMemoCache:zg,useCacheRefresh:gw};Sw.useEffectEvent=iw;function Kg(o,a,d,p){a=o.memoizedState,d=d(p,a),d=d==null?a:m({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Yg={enqueueSetState:function(o,a,d){o=o._reactInternals;var p=pr(),y=ks(p);y.payload=a,d!=null&&(y.callback=d),a=Cs(o,y,p),a!==null&&(Xn(a,o,p),kc(a,o,p))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var p=pr(),y=ks(p);y.tag=1,y.payload=a,d!=null&&(y.callback=d),a=Cs(o,y,p),a!==null&&(Xn(a,o,p),kc(a,o,p))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=pr(),p=ks(d);p.tag=2,a!=null&&(p.callback=a),a=Cs(o,p,d),a!==null&&(Xn(a,o,d),kc(a,o,d))}};function ww(o,a,d,p,y,x,w){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,x,w):a.prototype&&a.prototype.isPureReactComponent?!mc(d,p)||!mc(y,x):!0}function kw(o,a,d,p){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,p),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,p),a.state!==o&&Yg.enqueueReplaceState(a,a.state,null)}function Lo(o,a){var d=a;if("ref"in a){d={};for(var p in a)p!=="ref"&&(d[p]=a[p])}if(o=o.defaultProps){d===a&&(d=m({},d));for(var y in o)d[y]===void 0&&(d[y]=o[y])}return d}function Cw(o){Ud(o)}function Ew(o){console.error(o)}function Tw(o){Ud(o)}function cf(o,a){try{var d=o.onUncaughtError;d(a.value,{componentStack:a.stack})}catch(p){setTimeout(function(){throw p})}}function Aw(o,a,d){try{var p=o.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Wg(o,a,d){return d=ks(d),d.tag=3,d.payload={element:null},d.callback=function(){cf(o,a)},d}function Mw(o){return o=ks(o),o.tag=3,o}function Ow(o,a,d,p){var y=d.type.getDerivedStateFromError;if(typeof y=="function"){var x=p.value;o.payload=function(){return y(x)},o.callback=function(){Aw(a,d,p)}}var w=d.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(o.callback=function(){Aw(a,d,p),typeof y!="function"&&(_s===null?_s=new Set([this]):_s.add(this));var T=p.stack;this.componentDidCatch(p.value,{componentStack:T!==null?T:""})})}function BN(o,a,d,p,y){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(a=d.alternate,a!==null&&Il(a,d,y,!0),d=ur.current,d!==null){switch(d.tag){case 31:case 13:return Dr===null?Sf():d.alternate===null&&Rt===0&&(Rt=3),d.flags&=-257,d.flags|=65536,d.lanes=y,p===Gd?d.flags|=16384:(a=d.updateQueue,a===null?d.updateQueue=new Set([p]):a.add(p),xy(o,p,y)),!1;case 22:return d.flags|=65536,p===Gd?d.flags|=16384:(a=d.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=a):(d=a.retryQueue,d===null?a.retryQueue=new Set([p]):d.add(p)),xy(o,p,y)),!1}throw Error(r(435,d.tag))}return xy(o,p,y),Sf(),!1}if(Xe)return a=ur.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,p!==hg&&(o=Error(r(422),{cause:p}),bc(Ar(o,d)))):(p!==hg&&(a=Error(r(423),{cause:p}),bc(Ar(a,d))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,p=Ar(p,d),y=Wg(o.stateNode,p,y),Cg(o,y),Rt!==4&&(Rt=2)),!1;var x=Error(r(520),{cause:p});if(x=Ar(x,d),Ic===null?Ic=[x]:Ic.push(x),Rt!==4&&(Rt=2),a===null)return!0;p=Ar(p,d),d=a;do{switch(d.tag){case 3:return d.flags|=65536,o=y&-y,d.lanes|=o,o=Wg(d.stateNode,p,o),Cg(d,o),!1;case 1:if(a=d.type,x=d.stateNode,(d.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(_s===null||!_s.has(x))))return d.flags|=65536,y&=-y,d.lanes|=y,y=Mw(y),Ow(y,o,d,p),Cg(d,y),!1}d=d.return}while(d!==null);return!1}var Gg=Error(r(461)),qt=!1;function vn(o,a,d,p){a.child=o===null?NS(a,null,d,p):No(a,o.child,d,p)}function _w(o,a,d,p,y){d=d.render;var x=a.ref;if("ref"in p){var w={};for(var T in p)T!=="ref"&&(w[T]=p[T])}else w=p;return Oo(a),p=_g(o,a,d,w,x,y),T=Dg(),o!==null&&!qt?(Rg(o,a,y),Vi(o,a,y)):(Xe&&T&&dg(a),a.flags|=1,vn(o,a,p,y),a.child)}function Dw(o,a,d,p,y){if(o===null){var x=d.type;return typeof x=="function"&&!ag(x)&&x.defaultProps===void 0&&d.compare===null?(a.tag=15,a.type=x,Rw(o,a,x,p,y)):(o=$d(d.type,null,p,a,a.mode,y),o.ref=a.ref,o.return=a,a.child=o)}if(x=o.child,!ry(o,y)){var w=x.memoizedProps;if(d=d.compare,d=d!==null?d:mc,d(w,p)&&o.ref===a.ref)return Vi(o,a,y)}return a.flags|=1,o=Li(x,p),o.ref=a.ref,o.return=a,a.child=o}function Rw(o,a,d,p,y){if(o!==null){var x=o.memoizedProps;if(mc(x,p)&&o.ref===a.ref)if(qt=!1,a.pendingProps=p=x,ry(o,y))(o.flags&131072)!==0&&(qt=!0);else return a.lanes=o.lanes,Vi(o,a,y)}return Zg(o,a,d,p,y)}function Nw(o,a,d,p){var y=p.children,x=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|d:d,o!==null){for(p=a.child=o.child,y=0;p!==null;)y=y|p.lanes|p.childLanes,p=p.sibling;p=y&~x}else p=0,a.child=null;return zw(o,a,x,d,p)}if((d&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&Yd(a,x!==null?x.cachePool:null),x!==null?jS(a,x):Tg(),IS(a);else return p=a.lanes=536870912,zw(o,a,x!==null?x.baseLanes|d:d,d,p)}else x!==null?(Yd(a,x.cachePool),jS(a,x),Ts(),a.memoizedState=null):(o!==null&&Yd(a,null),Tg(),Ts());return vn(o,a,y,d),a.child}function _c(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function zw(o,a,d,p,y){var x=vg();return x=x===null?null:{parent:$t._currentValue,pool:x},a.memoizedState={baseLanes:d,cachePool:x},o!==null&&Yd(a,null),Tg(),IS(a),o!==null&&Il(o,a,p,!0),a.childLanes=y,null}function uf(o,a){return a=ff({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Lw(o,a,d){return No(a,o.child,null,d),o=uf(a,a.pendingProps),o.flags|=2,dr(a),a.memoizedState=null,o}function UN(o,a,d){var p=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(Xe){if(p.mode==="hidden")return o=uf(a,p),a.lanes=536870912,_c(null,o);if(Mg(a),(o=Ct)?(o=Yk(o,_r),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:bs!==null?{id:ci,overflow:ui}:null,retryLane:536870912,hydrationErrors:null},d=bS(o),d.return=a,a.child=d,bn=a,Ct=null)):o=null,o===null)throw vs(a);return a.lanes=536870912,null}return uf(a,p)}var x=o.memoizedState;if(x!==null){var w=x.dehydrated;if(Mg(a),y)if(a.flags&256)a.flags&=-257,a=Lw(o,a,d);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(qt||Il(o,a,d,!1),y=(d&o.childLanes)!==0,qt||y){if(p=gt,p!==null&&(w=Ev(p,d),w!==0&&w!==x.retryLane))throw x.retryLane=w,Eo(o,w),Xn(p,o,w),Gg;Sf(),a=Lw(o,a,d)}else o=x.treeContext,Ct=Rr(w.nextSibling),bn=a,Xe=!0,xs=null,_r=!1,o!==null&&SS(a,o),a=uf(a,p),a.flags|=4096;return a}return o=Li(o.child,{mode:p.mode,children:p.children}),o.ref=a.ref,a.child=o,o.return=a,o}function df(o,a){var d=a.ref;if(d===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(o===null||o.ref!==d)&&(a.flags|=4194816)}}function Zg(o,a,d,p,y){return Oo(a),d=_g(o,a,d,p,void 0,y),p=Dg(),o!==null&&!qt?(Rg(o,a,y),Vi(o,a,y)):(Xe&&p&&dg(a),a.flags|=1,vn(o,a,d,y),a.child)}function jw(o,a,d,p,y,x){return Oo(a),a.updateQueue=null,d=US(a,p,d,y),BS(o),p=Dg(),o!==null&&!qt?(Rg(o,a,x),Vi(o,a,x)):(Xe&&p&&dg(a),a.flags|=1,vn(o,a,d,x),a.child)}function Iw(o,a,d,p,y){if(Oo(a),a.stateNode===null){var x=Nl,w=d.contextType;typeof w=="object"&&w!==null&&(x=xn(w)),x=new d(p,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Yg,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=p,x.state=a.memoizedState,x.refs={},wg(a),w=d.contextType,x.context=typeof w=="object"&&w!==null?xn(w):Nl,x.state=a.memoizedState,w=d.getDerivedStateFromProps,typeof w=="function"&&(Kg(a,d,w,p),x.state=a.memoizedState),typeof d.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&&Yg.enqueueReplaceState(x,x.state,null),Ec(a,p,x,y),Cc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),p=!0}else if(o===null){x=a.stateNode;var T=a.memoizedProps,D=Lo(d,T);x.props=D;var $=x.context,G=d.contextType;w=Nl,typeof G=="object"&&G!==null&&(w=xn(G));var ee=d.getDerivedStateFromProps;G=typeof ee=="function"||typeof x.getSnapshotBeforeUpdate=="function",T=a.pendingProps!==T,G||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T||$!==w)&&kw(a,x,p,w),ws=!1;var F=a.memoizedState;x.state=F,Ec(a,p,x,y),Cc(),$=a.memoizedState,T||F!==$||ws?(typeof ee=="function"&&(Kg(a,d,ee,p),$=a.memoizedState),(D=ws||ww(a,d,D,p,F,$,w))?(G||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=p,a.memoizedState=$),x.props=p,x.state=$,x.context=w,p=D):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),p=!1)}else{x=a.stateNode,kg(o,a),w=a.memoizedProps,G=Lo(d,w),x.props=G,ee=a.pendingProps,F=x.context,$=d.contextType,D=Nl,typeof $=="object"&&$!==null&&(D=xn($)),T=d.getDerivedStateFromProps,($=typeof T=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ee||F!==D)&&kw(a,x,p,D),ws=!1,F=a.memoizedState,x.state=F,Ec(a,p,x,y),Cc();var K=a.memoizedState;w!==ee||F!==K||ws||o!==null&&o.dependencies!==null&&qd(o.dependencies)?(typeof T=="function"&&(Kg(a,d,T,p),K=a.memoizedState),(G=ws||ww(a,d,G,p,F,K,D)||o!==null&&o.dependencies!==null&&qd(o.dependencies))?($||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,K,D),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,K,D)),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=p,a.memoizedState=K),x.props=p,x.state=K,x.context=D,p=G):(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),p=!1)}return x=p,df(o,a),p=(a.flags&128)!==0,x||p?(x=a.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,o!==null&&p?(a.child=No(a,o.child,null,y),a.child=No(a,null,d,y)):vn(o,a,d,y),a.memoizedState=x.state,o=a.child):o=Vi(o,a,y),o}function Bw(o,a,d,p){return Ao(),a.flags|=256,vn(o,a,d,p),a.child}var Jg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xg(o){return{baseLanes:o,cachePool:AS()}}function Qg(o,a,d){return o=o!==null?o.childLanes&~d:0,a&&(o|=hr),o}function Uw(o,a,d){var p=a.pendingProps,y=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=o!==null&&o.memoizedState===null?!1:(Ut.current&2)!==0),w&&(y=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,o===null){if(Xe){if(y?Es(a):Ts(),(o=Ct)?(o=Yk(o,_r),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:bs!==null?{id:ci,overflow:ui}:null,retryLane:536870912,hydrationErrors:null},d=bS(o),d.return=a,a.child=d,bn=a,Ct=null)):o=null,o===null)throw vs(a);return Ly(o)?a.lanes=32:a.lanes=536870912,null}var T=p.children;return p=p.fallback,y?(Ts(),y=a.mode,T=ff({mode:"hidden",children:T},y),p=To(p,y,d,null),T.return=a,p.return=a,T.sibling=p,a.child=T,p=a.child,p.memoizedState=Xg(d),p.childLanes=Qg(o,w,d),a.memoizedState=Jg,_c(null,p)):(Es(a),ey(a,T))}var D=o.memoizedState;if(D!==null&&(T=D.dehydrated,T!==null)){if(x)a.flags&256?(Es(a),a.flags&=-257,a=ty(o,a,d)):a.memoizedState!==null?(Ts(),a.child=o.child,a.flags|=128,a=null):(Ts(),T=p.fallback,y=a.mode,p=ff({mode:"visible",children:p.children},y),T=To(T,y,d,null),T.flags|=2,p.return=a,T.return=a,p.sibling=T,a.child=p,No(a,o.child,null,d),p=a.child,p.memoizedState=Xg(d),p.childLanes=Qg(o,w,d),a.memoizedState=Jg,a=_c(null,p));else if(Es(a),Ly(T)){if(w=T.nextSibling&&T.nextSibling.dataset,w)var $=w.dgst;w=$,p=Error(r(419)),p.stack="",p.digest=w,bc({value:p,source:null,stack:null}),a=ty(o,a,d)}else if(qt||Il(o,a,d,!1),w=(d&o.childLanes)!==0,qt||w){if(w=gt,w!==null&&(p=Ev(w,d),p!==0&&p!==D.retryLane))throw D.retryLane=p,Eo(o,p),Xn(w,o,p),Gg;zy(T)||Sf(),a=ty(o,a,d)}else zy(T)?(a.flags|=192,a.child=o.child,a=null):(o=D.treeContext,Ct=Rr(T.nextSibling),bn=a,Xe=!0,xs=null,_r=!1,o!==null&&SS(a,o),a=ey(a,p.children),a.flags|=4096);return a}return y?(Ts(),T=p.fallback,y=a.mode,D=o.child,$=D.sibling,p=Li(D,{mode:"hidden",children:p.children}),p.subtreeFlags=D.subtreeFlags&65011712,$!==null?T=Li($,T):(T=To(T,y,d,null),T.flags|=2),T.return=a,p.return=a,p.sibling=T,a.child=p,_c(null,p),p=a.child,T=o.child.memoizedState,T===null?T=Xg(d):(y=T.cachePool,y!==null?(D=$t._currentValue,y=y.parent!==D?{parent:D,pool:D}:y):y=AS(),T={baseLanes:T.baseLanes|d,cachePool:y}),p.memoizedState=T,p.childLanes=Qg(o,w,d),a.memoizedState=Jg,_c(o.child,p)):(Es(a),d=o.child,o=d.sibling,d=Li(d,{mode:"visible",children:p.children}),d.return=a,d.sibling=null,o!==null&&(w=a.deletions,w===null?(a.deletions=[o],a.flags|=16):w.push(o)),a.child=d,a.memoizedState=null,d)}function ey(o,a){return a=ff({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function ff(o,a){return o=cr(22,o,null,a),o.lanes=0,o}function ty(o,a,d){return No(a,o.child,null,d),o=ey(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Hw(o,a,d){o.lanes|=a;var p=o.alternate;p!==null&&(p.lanes|=a),gg(o.return,a,d)}function ny(o,a,d,p,y,x){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:y,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=p,w.tail=d,w.tailMode=y,w.treeForkCount=x)}function Vw(o,a,d){var p=a.pendingProps,y=p.revealOrder,x=p.tail;p=p.children;var w=Ut.current,T=(w&2)!==0;if(T?(w=w&1|2,a.flags|=128):w&=1,A(Ut,w),vn(o,a,p,d),p=Xe?yc:0,!T&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Hw(o,d,a);else if(o.tag===19)Hw(o,d,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(d=a.child,y=null;d!==null;)o=d.alternate,o!==null&&Qd(o)===null&&(y=d),d=d.sibling;d=y,d===null?(y=a.child,a.child=null):(y=d.sibling,d.sibling=null),ny(a,!1,y,d,x,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,y=a.child,a.child=null;y!==null;){if(o=y.alternate,o!==null&&Qd(o)===null){a.child=y;break}o=y.sibling,y.sibling=d,d=y,y=o}ny(a,!0,d,null,x,p);break;case"together":ny(a,!1,null,null,void 0,p);break;default:a.memoizedState=null}return a.child}function Vi(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),Os|=a.lanes,(d&a.childLanes)===0)if(o!==null){if(Il(o,a,d,!1),(d&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,d=Li(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=Li(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function ry(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&qd(o)))}function HN(o,a,d){switch(a.tag){case 3:Ae(a,a.stateNode.containerInfo),Ss(a,$t,o.memoizedState.cache),Ao();break;case 27:case 5:Le(a);break;case 4:Ae(a,a.stateNode.containerInfo);break;case 10:Ss(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Mg(a),null;break;case 13:var p=a.memoizedState;if(p!==null)return p.dehydrated!==null?(Es(a),a.flags|=128,null):(d&a.child.childLanes)!==0?Uw(o,a,d):(Es(a),o=Vi(o,a,d),o!==null?o.sibling:null);Es(a);break;case 19:var y=(o.flags&128)!==0;if(p=(d&a.childLanes)!==0,p||(Il(o,a,d,!1),p=(d&a.childLanes)!==0),y){if(p)return Vw(o,a,d);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),A(Ut,Ut.current),p)break;return null;case 22:return a.lanes=0,Nw(o,a,d,a.pendingProps);case 24:Ss(a,$t,o.memoizedState.cache)}return Vi(o,a,d)}function Pw(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps)qt=!0;else{if(!ry(o,d)&&(a.flags&128)===0)return qt=!1,HN(o,a,d);qt=(o.flags&131072)!==0}else qt=!1,Xe&&(a.flags&1048576)!==0&&vS(a,yc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var p=a.pendingProps;if(o=Do(a.elementType),a.type=o,typeof o=="function")ag(o)?(p=Lo(o,p),a.tag=1,a=Iw(null,a,o,p,d)):(a.tag=0,a=Zg(null,a,o,p,d));else{if(o!=null){var y=o.$$typeof;if(y===q){a.tag=11,a=_w(null,a,o,p,d);break e}else if(y===I){a.tag=14,a=Dw(null,a,o,p,d);break e}}throw a=ae(o)||o,Error(r(306,a,""))}}return a;case 0:return Zg(o,a,a.type,a.pendingProps,d);case 1:return p=a.type,y=Lo(p,a.pendingProps),Iw(o,a,p,y,d);case 3:e:{if(Ae(a,a.stateNode.containerInfo),o===null)throw Error(r(387));p=a.pendingProps;var x=a.memoizedState;y=x.element,kg(o,a),Ec(a,p,null,d);var w=a.memoizedState;if(p=w.cache,Ss(a,$t,p),p!==x.cache&&yg(a,[$t],d,!0),Cc(),p=w.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=Bw(o,a,p,d);break e}else if(p!==y){y=Ar(Error(r(424)),a),bc(y),a=Bw(o,a,p,d);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(Ct=Rr(o.firstChild),bn=a,Xe=!0,xs=null,_r=!0,d=NS(a,null,p,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(Ao(),p===y){a=Vi(o,a,d);break e}vn(o,a,p,d)}a=a.child}return a;case 26:return df(o,a),o===null?(d=Qk(a.type,null,a.pendingProps,null))?a.memoizedState=d:Xe||(d=a.type,o=a.pendingProps,p=Mf(ie.current).createElement(d),p[yn]=a,p[Kn]=o,Sn(p,d,o),tn(p),a.stateNode=p):a.memoizedState=Qk(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Le(a),o===null&&Xe&&(p=a.stateNode=Zk(a.type,a.pendingProps,ie.current),bn=a,_r=!0,y=Ct,zs(a.type)?(jy=y,Ct=Rr(p.firstChild)):Ct=y),vn(o,a,a.pendingProps.children,d),df(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&Xe&&((y=p=Ct)&&(p=gz(p,a.type,a.pendingProps,_r),p!==null?(a.stateNode=p,bn=a,Ct=Rr(p.firstChild),_r=!1,y=!0):y=!1),y||vs(a)),Le(a),y=a.type,x=a.pendingProps,w=o!==null?o.memoizedProps:null,p=x.children,Dy(y,x)?p=null:w!==null&&Dy(y,w)&&(a.flags|=32),a.memoizedState!==null&&(y=_g(o,a,DN,null,null,d),qc._currentValue=y),df(o,a),vn(o,a,p,d),a.child;case 6:return o===null&&Xe&&((o=d=Ct)&&(d=yz(d,a.pendingProps,_r),d!==null?(a.stateNode=d,bn=a,Ct=null,o=!0):o=!1),o||vs(a)),null;case 13:return Uw(o,a,d);case 4:return Ae(a,a.stateNode.containerInfo),p=a.pendingProps,o===null?a.child=No(a,null,p,d):vn(o,a,p,d),a.child;case 11:return _w(o,a,a.type,a.pendingProps,d);case 7:return vn(o,a,a.pendingProps,d),a.child;case 8:return vn(o,a,a.pendingProps.children,d),a.child;case 12:return vn(o,a,a.pendingProps.children,d),a.child;case 10:return p=a.pendingProps,Ss(a,a.type,p.value),vn(o,a,p.children,d),a.child;case 9:return y=a.type._context,p=a.pendingProps.children,Oo(a),y=xn(y),p=p(y),a.flags|=1,vn(o,a,p,d),a.child;case 14:return Dw(o,a,a.type,a.pendingProps,d);case 15:return Rw(o,a,a.type,a.pendingProps,d);case 19:return Vw(o,a,d);case 31:return UN(o,a,d);case 22:return Nw(o,a,d,a.pendingProps);case 24:return Oo(a),p=xn($t),o===null?(y=vg(),y===null&&(y=gt,x=bg(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=d),y=x),a.memoizedState={parent:p,cache:y},wg(a),Ss(a,$t,y)):((o.lanes&d)!==0&&(kg(o,a),Ec(a,null,null,d),Cc()),y=o.memoizedState,x=a.memoizedState,y.parent!==p?(y={parent:p,cache:p},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),Ss(a,$t,p)):(p=x.cache,Ss(a,$t,p),p!==y.cache&&yg(a,[$t],d,!0))),vn(o,a,a.pendingProps.children,d),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Pi(o){o.flags|=4}function iy(o,a,d,p,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(mk())o.flags|=8192;else throw Ro=Gd,Sg}else o.flags&=-16777217}function $w(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!iC(a))if(mk())o.flags|=8192;else throw Ro=Gd,Sg}function hf(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?wv():536870912,o.lanes|=a,Gl|=a)}function Dc(o,a){if(!Xe)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Et(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,p=0;if(a)for(var y=o.child;y!==null;)d|=y.lanes|y.childLanes,p|=y.subtreeFlags&65011712,p|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)d|=y.lanes|y.childLanes,p|=y.subtreeFlags,p|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=p,o.childLanes=d,a}function VN(o,a,d){var p=a.pendingProps;switch(fg(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(a),null;case 1:return Et(a),null;case 3:return d=a.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),a.memoizedState.cache!==p&&(a.flags|=2048),Bi($t),ge(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(jl(a)?Pi(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,pg())),Et(a),null;case 26:var y=a.type,x=a.memoizedState;return o===null?(Pi(a),x!==null?(Et(a),$w(a,x)):(Et(a),iy(a,y,null,p,d))):x?x!==o.memoizedState?(Pi(a),Et(a),$w(a,x)):(Et(a),a.flags&=-16777217):(o=o.memoizedProps,o!==p&&Pi(a),Et(a),iy(a,y,o,p,d)),null;case 27:if(ke(a),d=ie.current,y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&Pi(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return Et(a),null}o=re.current,jl(a)?wS(a):(o=Zk(y,p,d),a.stateNode=o,Pi(a))}return Et(a),null;case 5:if(ke(a),y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&Pi(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return Et(a),null}if(x=re.current,jl(a))wS(a);else{var w=Mf(ie.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 p.is=="string"?w.createElement("select",{is:p.is}):w.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?w.createElement(y,{is:p.is}):w.createElement(y)}}x[yn]=a,x[Kn]=p;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(Sn(x,y,p),y){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Pi(a)}}return Et(a),iy(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,d),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==p&&Pi(a);else{if(typeof p!="string"&&a.stateNode===null)throw Error(r(166));if(o=ie.current,jl(a)){if(o=a.stateNode,d=a.memoizedProps,p=null,y=bn,y!==null)switch(y.tag){case 27:case 5:p=y.memoizedProps}o[yn]=a,o=!!(o.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||Uk(o.nodeValue,d)),o||vs(a,!0)}else o=Mf(o).createTextNode(p),o[yn]=a,a.stateNode=o}return Et(a),null;case 31:if(d=a.memoizedState,o===null||o.memoizedState!==null){if(p=jl(a),d!==null){if(o===null){if(!p)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[yn]=a}else Ao(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Et(a),o=!1}else d=pg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=d),o=!0;if(!o)return a.flags&256?(dr(a),a):(dr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Et(a),null;case 13:if(p=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=jl(a),p!==null&&p.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[yn]=a}else Ao(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Et(a),y=!1}else y=pg(),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=d,a):(d=p!==null,o=o!==null&&o.memoizedState!==null,d&&(p=a.child,y=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(y=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==y&&(p.flags|=2048)),d!==o&&d&&(a.child.flags|=8192),hf(a,a.updateQueue),Et(a),null);case 4:return ge(),o===null&&Ty(a.stateNode.containerInfo),Et(a),null;case 10:return Bi(a.type),Et(a),null;case 19:if(B(Ut),p=a.memoizedState,p===null)return Et(a),null;if(y=(a.flags&128)!==0,x=p.rendering,x===null)if(y)Dc(p,!1);else{if(Rt!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(x=Qd(o),x!==null){for(a.flags|=128,Dc(p,!1),o=x.updateQueue,a.updateQueue=o,hf(a,o),a.subtreeFlags=0,o=d,d=a.child;d!==null;)yS(d,o),d=d.sibling;return A(Ut,Ut.current&1|2),Xe&&ji(a,p.treeForkCount),a.child}o=o.sibling}p.tail!==null&&Jt()>bf&&(a.flags|=128,y=!0,Dc(p,!1),a.lanes=4194304)}else{if(!y)if(o=Qd(x),o!==null){if(a.flags|=128,y=!0,o=o.updateQueue,a.updateQueue=o,hf(a,o),Dc(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!Xe)return Et(a),null}else 2*Jt()-p.renderingStartTime>bf&&d!==536870912&&(a.flags|=128,y=!0,Dc(p,!1),a.lanes=4194304);p.isBackwards?(x.sibling=a.child,a.child=x):(o=p.last,o!==null?o.sibling=x:a.child=x,p.last=x)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=Jt(),o.sibling=null,d=Ut.current,A(Ut,y?d&1|2:d&1),Xe&&ji(a,p.treeForkCount),o):(Et(a),null);case 22:case 23:return dr(a),Ag(),p=a.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(a.flags|=8192):p&&(a.flags|=8192),p?(d&536870912)!==0&&(a.flags&128)===0&&(Et(a),a.subtreeFlags&6&&(a.flags|=8192)):Et(a),d=a.updateQueue,d!==null&&hf(a,d.retryQueue),d=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),p=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(p=a.memoizedState.cachePool.pool),p!==d&&(a.flags|=2048),o!==null&&B(_o),null;case 24:return d=null,o!==null&&(d=o.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Bi($t),Et(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function PN(o,a){switch(fg(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Bi($t),ge(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return ke(a),null;case 31:if(a.memoizedState!==null){if(dr(a),a.alternate===null)throw Error(r(340));Ao()}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));Ao()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return B(Ut),null;case 4:return ge(),null;case 10:return Bi(a.type),null;case 22:case 23:return dr(a),Ag(),o!==null&&B(_o),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Bi($t),null;case 25:return null;default:return null}}function Fw(o,a){switch(fg(a),a.tag){case 3:Bi($t),ge();break;case 26:case 27:case 5:ke(a);break;case 4:ge();break;case 31:a.memoizedState!==null&&dr(a);break;case 13:dr(a);break;case 19:B(Ut);break;case 10:Bi(a.type);break;case 22:case 23:dr(a),Ag(),o!==null&&B(_o);break;case 24:Bi($t)}}function Rc(o,a){try{var d=a.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var y=p.next;d=y;do{if((d.tag&o)===o){p=void 0;var x=d.create,w=d.inst;p=x(),w.destroy=p}d=d.next}while(d!==y)}}catch(T){ct(a,a.return,T)}}function As(o,a,d){try{var p=a.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var x=y.next;p=x;do{if((p.tag&o)===o){var w=p.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,y=a;var D=d,$=T;try{$()}catch(G){ct(y,D,G)}}}p=p.next}while(p!==x)}}catch(G){ct(a,a.return,G)}}function qw(o){var a=o.updateQueue;if(a!==null){var d=o.stateNode;try{LS(a,d)}catch(p){ct(o,o.return,p)}}}function Kw(o,a,d){d.props=Lo(o.type,o.memoizedProps),d.state=o.memoizedState;try{d.componentWillUnmount()}catch(p){ct(o,a,p)}}function Nc(o,a){try{var d=o.ref;if(d!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof d=="function"?o.refCleanup=d(p):d.current=p}}catch(y){ct(o,a,y)}}function di(o,a){var d=o.ref,p=o.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(y){ct(o,a,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(y){ct(o,a,y)}else d.current=null}function Yw(o){var a=o.type,d=o.memoizedProps,p=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":d.autoFocus&&p.focus();break e;case"img":d.src?p.src=d.src:d.srcSet&&(p.srcset=d.srcSet)}}catch(y){ct(o,o.return,y)}}function sy(o,a,d){try{var p=o.stateNode;uz(p,o.type,d,a),p[Kn]=a}catch(y){ct(o,o.return,y)}}function Ww(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&zs(o.type)||o.tag===4}function oy(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Ww(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&&zs(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 ly(o,a,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(o,a):(a=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,a.appendChild(o),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=Ni));else if(p!==4&&(p===27&&zs(o.type)&&(d=o.stateNode,a=null),o=o.child,o!==null))for(ly(o,a,d),o=o.sibling;o!==null;)ly(o,a,d),o=o.sibling}function pf(o,a,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?d.insertBefore(o,a):d.appendChild(o);else if(p!==4&&(p===27&&zs(o.type)&&(d=o.stateNode),o=o.child,o!==null))for(pf(o,a,d),o=o.sibling;o!==null;)pf(o,a,d),o=o.sibling}function Gw(o){var a=o.stateNode,d=o.memoizedProps;try{for(var p=o.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);Sn(a,p,d),a[yn]=o,a[Kn]=d}catch(x){ct(o,o.return,x)}}var $i=!1,Kt=!1,ay=!1,Zw=typeof WeakSet=="function"?WeakSet:Set,nn=null;function $N(o,a){if(o=o.containerInfo,Oy=Lf,o=aS(o),tg(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var y=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{d.nodeType,x.nodeType}catch{d=null;break e}var w=0,T=-1,D=-1,$=0,G=0,ee=o,F=null;t:for(;;){for(var K;ee!==d||y!==0&&ee.nodeType!==3||(T=w+y),ee!==x||p!==0&&ee.nodeType!==3||(D=w+p),ee.nodeType===3&&(w+=ee.nodeValue.length),(K=ee.firstChild)!==null;)F=ee,ee=K;for(;;){if(ee===o)break t;if(F===d&&++$===y&&(T=w),F===x&&++G===p&&(D=w),(K=ee.nextSibling)!==null)break;ee=F,F=ee.parentNode}ee=K}d=T===-1||D===-1?null:{start:T,end:D}}else d=null}d=d||{start:0,end:0}}else d=null;for(_y={focusedElem:o,selectionRange:d},Lf=!1,nn=a;nn!==null;)if(a=nn,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,nn=o;else for(;nn!==null;){switch(a=nn,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(d=0;d<o.length;d++)y=o[d],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&x!==null){o=void 0,d=a,y=x.memoizedProps,x=x.memoizedState,p=d.stateNode;try{var xe=Lo(d.type,y);o=p.getSnapshotBeforeUpdate(xe,x),p.__reactInternalSnapshotBeforeUpdate=o}catch(Re){ct(d,d.return,Re)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,d=o.nodeType,d===9)Ny(o);else if(d===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Ny(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,nn=o;break}nn=a.return}}function Jw(o,a,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:qi(o,d),p&4&&Rc(5,d);break;case 1:if(qi(o,d),p&4)if(o=d.stateNode,a===null)try{o.componentDidMount()}catch(w){ct(d,d.return,w)}else{var y=Lo(d.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(y,a,o.__reactInternalSnapshotBeforeUpdate)}catch(w){ct(d,d.return,w)}}p&64&&qw(d),p&512&&Nc(d,d.return);break;case 3:if(qi(o,d),p&64&&(o=d.updateQueue,o!==null)){if(a=null,d.child!==null)switch(d.child.tag){case 27:case 5:a=d.child.stateNode;break;case 1:a=d.child.stateNode}try{LS(o,a)}catch(w){ct(d,d.return,w)}}break;case 27:a===null&&p&4&&Gw(d);case 26:case 5:qi(o,d),a===null&&p&4&&Yw(d),p&512&&Nc(d,d.return);break;case 12:qi(o,d);break;case 31:qi(o,d),p&4&&ek(o,d);break;case 13:qi(o,d),p&4&&tk(o,d),p&64&&(o=d.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(d=XN.bind(null,d),bz(o,d))));break;case 22:if(p=d.memoizedState!==null||$i,!p){a=a!==null&&a.memoizedState!==null||Kt,y=$i;var x=Kt;$i=p,(Kt=a)&&!x?Ki(o,d,(d.subtreeFlags&8772)!==0):qi(o,d),$i=y,Kt=x}break;case 30:break;default:qi(o,d)}}function Xw(o){var a=o.alternate;a!==null&&(o.alternate=null,Xw(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Bm(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 Mt=null,Wn=!1;function Fi(o,a,d){for(d=d.child;d!==null;)Qw(o,a,d),d=d.sibling}function Qw(o,a,d){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(mn,d)}catch{}switch(d.tag){case 26:Kt||di(d,a),Fi(o,a,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:Kt||di(d,a);var p=Mt,y=Wn;zs(d.type)&&(Mt=d.stateNode,Wn=!1),Fi(o,a,d),Pc(d.stateNode),Mt=p,Wn=y;break;case 5:Kt||di(d,a);case 6:if(p=Mt,y=Wn,Mt=null,Fi(o,a,d),Mt=p,Wn=y,Mt!==null)if(Wn)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(d.stateNode)}catch(x){ct(d,a,x)}else try{Mt.removeChild(d.stateNode)}catch(x){ct(d,a,x)}break;case 18:Mt!==null&&(Wn?(o=Mt,qk(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,d.stateNode),ra(o)):qk(Mt,d.stateNode));break;case 4:p=Mt,y=Wn,Mt=d.stateNode.containerInfo,Wn=!0,Fi(o,a,d),Mt=p,Wn=y;break;case 0:case 11:case 14:case 15:As(2,d,a),Kt||As(4,d,a),Fi(o,a,d);break;case 1:Kt||(di(d,a),p=d.stateNode,typeof p.componentWillUnmount=="function"&&Kw(d,a,p)),Fi(o,a,d);break;case 21:Fi(o,a,d);break;case 22:Kt=(p=Kt)||d.memoizedState!==null,Fi(o,a,d),Kt=p;break;default:Fi(o,a,d)}}function ek(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{ra(o)}catch(d){ct(a,a.return,d)}}}function tk(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{ra(o)}catch(d){ct(a,a.return,d)}}function FN(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Zw),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Zw),a;default:throw Error(r(435,o.tag))}}function mf(o,a){var d=FN(o);a.forEach(function(p){if(!d.has(p)){d.add(p);var y=QN.bind(null,o,p);p.then(y,y)}})}function Gn(o,a){var d=a.deletions;if(d!==null)for(var p=0;p<d.length;p++){var y=d[p],x=o,w=a,T=w;e:for(;T!==null;){switch(T.tag){case 27:if(zs(T.type)){Mt=T.stateNode,Wn=!1;break e}break;case 5:Mt=T.stateNode,Wn=!1;break e;case 3:case 4:Mt=T.stateNode.containerInfo,Wn=!0;break e}T=T.return}if(Mt===null)throw Error(r(160));Qw(x,w,y),Mt=null,Wn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)nk(a,o),a=a.sibling}var Jr=null;function nk(o,a){var d=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Gn(a,o),Zn(o),p&4&&(As(3,o,o.return),Rc(3,o),As(5,o,o.return));break;case 1:Gn(a,o),Zn(o),p&512&&(Kt||d===null||di(d,d.return)),p&64&&$i&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(d=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var y=Jr;if(Gn(a,o),Zn(o),p&512&&(Kt||d===null||di(d,d.return)),p&4){var x=d!==null?d.memoizedState:null;if(p=o.memoizedState,d===null)if(p===null)if(o.stateNode===null){e:{p=o.type,d=o.memoizedProps,y=y.ownerDocument||y;t:switch(p){case"title":x=y.getElementsByTagName("title")[0],(!x||x[oc]||x[yn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(p),y.head.insertBefore(x,y.querySelector("head > title"))),Sn(x,p,d),x[yn]=o,tn(x),p=x;break e;case"link":var w=nC("link","href",y).get(p+(d.href||""));if(w){for(var T=0;T<w.length;T++)if(x=w[T],x.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&x.getAttribute("rel")===(d.rel==null?null:d.rel)&&x.getAttribute("title")===(d.title==null?null:d.title)&&x.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){w.splice(T,1);break t}}x=y.createElement(p),Sn(x,p,d),y.head.appendChild(x);break;case"meta":if(w=nC("meta","content",y).get(p+(d.content||""))){for(T=0;T<w.length;T++)if(x=w[T],x.getAttribute("content")===(d.content==null?null:""+d.content)&&x.getAttribute("name")===(d.name==null?null:d.name)&&x.getAttribute("property")===(d.property==null?null:d.property)&&x.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&x.getAttribute("charset")===(d.charSet==null?null:d.charSet)){w.splice(T,1);break t}}x=y.createElement(p),Sn(x,p,d),y.head.appendChild(x);break;default:throw Error(r(468,p))}x[yn]=o,tn(x),p=x}o.stateNode=p}else rC(y,o.type,o.stateNode);else o.stateNode=tC(y,p,o.memoizedProps);else x!==p?(x===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):x.count--,p===null?rC(y,o.type,o.stateNode):tC(y,p,o.memoizedProps)):p===null&&o.stateNode!==null&&sy(o,o.memoizedProps,d.memoizedProps)}break;case 27:Gn(a,o),Zn(o),p&512&&(Kt||d===null||di(d,d.return)),d!==null&&p&4&&sy(o,o.memoizedProps,d.memoizedProps);break;case 5:if(Gn(a,o),Zn(o),p&512&&(Kt||d===null||di(d,d.return)),o.flags&32){y=o.stateNode;try{Tl(y,"")}catch(xe){ct(o,o.return,xe)}}p&4&&o.stateNode!=null&&(y=o.memoizedProps,sy(o,y,d!==null?d.memoizedProps:y)),p&1024&&(ay=!0);break;case 6:if(Gn(a,o),Zn(o),p&4){if(o.stateNode===null)throw Error(r(162));p=o.memoizedProps,d=o.stateNode;try{d.nodeValue=p}catch(xe){ct(o,o.return,xe)}}break;case 3:if(Df=null,y=Jr,Jr=Of(a.containerInfo),Gn(a,o),Jr=y,Zn(o),p&4&&d!==null&&d.memoizedState.isDehydrated)try{ra(a.containerInfo)}catch(xe){ct(o,o.return,xe)}ay&&(ay=!1,rk(o));break;case 4:p=Jr,Jr=Of(o.stateNode.containerInfo),Gn(a,o),Zn(o),Jr=p;break;case 12:Gn(a,o),Zn(o);break;case 31:Gn(a,o),Zn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,mf(o,p)));break;case 13:Gn(a,o),Zn(o),o.child.flags&8192&&o.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(yf=Jt()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,mf(o,p)));break;case 22:y=o.memoizedState!==null;var D=d!==null&&d.memoizedState!==null,$=$i,G=Kt;if($i=$||y,Kt=G||D,Gn(a,o),Kt=G,$i=$,Zn(o),p&8192)e:for(a=o.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(d===null||D||$i||Kt||jo(o)),d=null,a=o;;){if(a.tag===5||a.tag===26){if(d===null){D=d=a;try{if(x=D.stateNode,y)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{T=D.stateNode;var ee=D.memoizedProps.style,F=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;T.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(xe){ct(D,D.return,xe)}}}else if(a.tag===6){if(d===null){D=a;try{D.stateNode.nodeValue=y?"":D.memoizedProps}catch(xe){ct(D,D.return,xe)}}}else if(a.tag===18){if(d===null){D=a;try{var K=D.stateNode;y?Kk(K,!0):Kk(D.stateNode,!1)}catch(xe){ct(D,D.return,xe)}}}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;d===a&&(d=null),a=a.return}d===a&&(d=null),a.sibling.return=a.return,a=a.sibling}p&4&&(p=o.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,mf(o,d))));break;case 19:Gn(a,o),Zn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,mf(o,p)));break;case 30:break;case 21:break;default:Gn(a,o),Zn(o)}}function Zn(o){var a=o.flags;if(a&2){try{for(var d,p=o.return;p!==null;){if(Ww(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var y=d.stateNode,x=oy(o);pf(o,x,y);break;case 5:var w=d.stateNode;d.flags&32&&(Tl(w,""),d.flags&=-33);var T=oy(o);pf(o,T,w);break;case 3:case 4:var D=d.stateNode.containerInfo,$=oy(o);ly(o,$,D);break;default:throw Error(r(161))}}catch(G){ct(o,o.return,G)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function rk(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;rk(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function qi(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Jw(o,a.alternate,a),a=a.sibling}function jo(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:As(4,a,a.return),jo(a);break;case 1:di(a,a.return);var d=a.stateNode;typeof d.componentWillUnmount=="function"&&Kw(a,a.return,d),jo(a);break;case 27:Pc(a.stateNode);case 26:case 5:di(a,a.return),jo(a);break;case 22:a.memoizedState===null&&jo(a);break;case 30:jo(a);break;default:jo(a)}o=o.sibling}}function Ki(o,a,d){for(d=d&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var p=a.alternate,y=o,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:Ki(y,x,d),Rc(4,x);break;case 1:if(Ki(y,x,d),p=x,y=p.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch($){ct(p,p.return,$)}if(p=x,y=p.updateQueue,y!==null){var T=p.stateNode;try{var D=y.shared.hiddenCallbacks;if(D!==null)for(y.shared.hiddenCallbacks=null,y=0;y<D.length;y++)zS(D[y],T)}catch($){ct(p,p.return,$)}}d&&w&64&&qw(x),Nc(x,x.return);break;case 27:Gw(x);case 26:case 5:Ki(y,x,d),d&&p===null&&w&4&&Yw(x),Nc(x,x.return);break;case 12:Ki(y,x,d);break;case 31:Ki(y,x,d),d&&w&4&&ek(y,x);break;case 13:Ki(y,x,d),d&&w&4&&tk(y,x);break;case 22:x.memoizedState===null&&Ki(y,x,d),Nc(x,x.return);break;case 30:break;default:Ki(y,x,d)}a=a.sibling}}function cy(o,a){var d=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==d&&(o!=null&&o.refCount++,d!=null&&xc(d))}function uy(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&xc(o))}function Xr(o,a,d,p){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)ik(o,a,d,p),a=a.sibling}function ik(o,a,d,p){var y=a.flags;switch(a.tag){case 0:case 11:case 15:Xr(o,a,d,p),y&2048&&Rc(9,a);break;case 1:Xr(o,a,d,p);break;case 3:Xr(o,a,d,p),y&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&xc(o)));break;case 12:if(y&2048){Xr(o,a,d,p),o=a.stateNode;try{var x=a.memoizedProps,w=x.id,T=x.onPostCommit;typeof T=="function"&&T(w,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(D){ct(a,a.return,D)}}else Xr(o,a,d,p);break;case 31:Xr(o,a,d,p);break;case 13:Xr(o,a,d,p);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?Xr(o,a,d,p):zc(o,a):x._visibility&2?Xr(o,a,d,p):(x._visibility|=2,Kl(o,a,d,p,(a.subtreeFlags&10256)!==0||!1)),y&2048&&cy(w,a);break;case 24:Xr(o,a,d,p),y&2048&&uy(a.alternate,a);break;default:Xr(o,a,d,p)}}function Kl(o,a,d,p,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=o,w=a,T=d,D=p,$=w.flags;switch(w.tag){case 0:case 11:case 15:Kl(x,w,T,D,y),Rc(8,w);break;case 23:break;case 22:var G=w.stateNode;w.memoizedState!==null?G._visibility&2?Kl(x,w,T,D,y):zc(x,w):(G._visibility|=2,Kl(x,w,T,D,y)),y&&$&2048&&cy(w.alternate,w);break;case 24:Kl(x,w,T,D,y),y&&$&2048&&uy(w.alternate,w);break;default:Kl(x,w,T,D,y)}a=a.sibling}}function zc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var d=o,p=a,y=p.flags;switch(p.tag){case 22:zc(d,p),y&2048&&cy(p.alternate,p);break;case 24:zc(d,p),y&2048&&uy(p.alternate,p);break;default:zc(d,p)}a=a.sibling}}var Lc=8192;function Yl(o,a,d){if(o.subtreeFlags&Lc)for(o=o.child;o!==null;)sk(o,a,d),o=o.sibling}function sk(o,a,d){switch(o.tag){case 26:Yl(o,a,d),o.flags&Lc&&o.memoizedState!==null&&_z(d,Jr,o.memoizedState,o.memoizedProps);break;case 5:Yl(o,a,d);break;case 3:case 4:var p=Jr;Jr=Of(o.stateNode.containerInfo),Yl(o,a,d),Jr=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=Lc,Lc=16777216,Yl(o,a,d),Lc=p):Yl(o,a,d));break;default:Yl(o,a,d)}}function ok(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 jc(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var p=a[d];nn=p,ak(p,o)}ok(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)lk(o),o=o.sibling}function lk(o){switch(o.tag){case 0:case 11:case 15:jc(o),o.flags&2048&&As(9,o,o.return);break;case 3:jc(o);break;case 12:jc(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,gf(o)):jc(o);break;default:jc(o)}}function gf(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var p=a[d];nn=p,ak(p,o)}ok(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:As(8,a,a.return),gf(a);break;case 22:d=a.stateNode,d._visibility&2&&(d._visibility&=-3,gf(a));break;default:gf(a)}o=o.sibling}}function ak(o,a){for(;nn!==null;){var d=nn;switch(d.tag){case 0:case 11:case 15:As(8,d,a);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var p=d.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:xc(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,nn=p;else e:for(d=o;nn!==null;){p=nn;var y=p.sibling,x=p.return;if(Xw(p),p===d){nn=null;break e}if(y!==null){y.return=x,nn=y;break e}nn=x}}}var qN={getCacheForType:function(o){var a=xn($t),d=a.data.get(o);return d===void 0&&(d=o(),a.data.set(o,d)),d},cacheSignal:function(){return xn($t).controller.signal}},KN=typeof WeakMap=="function"?WeakMap:Map,ot=0,gt=null,Ye=null,Ge=0,at=0,fr=null,Ms=!1,Wl=!1,dy=!1,Yi=0,Rt=0,Os=0,Io=0,fy=0,hr=0,Gl=0,Ic=null,Jn=null,hy=!1,yf=0,ck=0,bf=1/0,xf=null,_s=null,Qt=0,Ds=null,Zl=null,Wi=0,py=0,my=null,uk=null,Bc=0,gy=null;function pr(){return(ot&2)!==0&&Ge!==0?Ge&-Ge:z.T!==null?wy():Tv()}function dk(){if(hr===0)if((Ge&536870912)===0||Xe){var o=ms;ms<<=1,(ms&3932160)===0&&(ms=262144),hr=o}else hr=536870912;return o=ur.current,o!==null&&(o.flags|=32),hr}function Xn(o,a,d){(o===gt&&(at===2||at===9)||o.cancelPendingCommit!==null)&&(Jl(o,0),Rs(o,Ge,hr,!1)),sc(o,d),((ot&2)===0||o!==gt)&&(o===gt&&((ot&2)===0&&(Io|=d),Rt===4&&Rs(o,Ge,hr,!1)),fi(o))}function fk(o,a,d){if((ot&6)!==0)throw Error(r(327));var p=!d&&(a&127)===0&&(a&o.expiredLanes)===0||ic(o,a),y=p?GN(o,a):by(o,a,!0),x=p;do{if(y===0){Wl&&!p&&Rs(o,a,0,!1);break}else{if(d=o.current.alternate,x&&!YN(d)){y=by(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 T=o;y=Ic;var D=T.current.memoizedState.isDehydrated;if(D&&(Jl(T,w).flags|=256),w=by(T,w,!1),w!==2){if(dy&&!D){T.errorRecoveryDisabledLanes|=x,Io|=x,y=4;break e}x=Jn,Jn=y,x!==null&&(Jn===null?Jn=x:Jn.push.apply(Jn,x))}y=w}if(x=!1,y!==2)continue}}if(y===1){Jl(o,0),Rs(o,a,0,!0);break}e:{switch(p=o,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Rs(p,a,hr,!Ms);break e;case 2:Jn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=yf+300-Jt(),10<y)){if(Rs(p,a,hr,!Ms),Md(p,0,!0)!==0)break e;Wi=a,p.timeoutHandle=$k(hk.bind(null,p,d,Jn,xf,hy,a,hr,Io,Gl,Ms,x,"Throttled",-0,0),y);break e}hk(p,d,Jn,xf,hy,a,hr,Io,Gl,Ms,x,null,-0,0)}}break}while(!0);fi(o)}function hk(o,a,d,p,y,x,w,T,D,$,G,ee,F,K){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:Ni},sk(a,x,ee);var xe=(x&62914560)===x?yf-Jt():(x&4194048)===x?ck-Jt():0;if(xe=Dz(ee,xe),xe!==null){Wi=x,o.cancelPendingCommit=xe(Sk.bind(null,o,a,x,d,p,y,w,T,D,G,ee,null,F,K)),Rs(o,x,w,!$);return}}Sk(o,a,x,d,p,y,w,T,D)}function YN(o){for(var a=o;;){var d=a.tag;if((d===0||d===11||d===15)&&a.flags&16384&&(d=a.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var y=d[p],x=y.getSnapshot;y=y.value;try{if(!ar(x(),y))return!1}catch{return!1}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Rs(o,a,d,p){a&=~fy,a&=~Io,o.suspendedLanes|=a,o.pingedLanes&=~a,p&&(o.warmLanes|=a),p=o.expirationTimes;for(var y=a;0<y;){var x=31-nt(y),w=1<<x;p[x]=-1,y&=~w}d!==0&&kv(o,d,a)}function vf(){return(ot&6)===0?(Uc(0),!1):!0}function yy(){if(Ye!==null){if(at===0)var o=Ye.return;else o=Ye,Ii=Mo=null,Ng(o),Vl=null,Sc=0,o=Ye;for(;o!==null;)Fw(o.alternate,o),o=o.return;Ye=null}}function Jl(o,a){var d=o.timeoutHandle;d!==-1&&(o.timeoutHandle=-1,hz(d)),d=o.cancelPendingCommit,d!==null&&(o.cancelPendingCommit=null,d()),Wi=0,yy(),gt=o,Ye=d=Li(o.current,null),Ge=a,at=0,fr=null,Ms=!1,Wl=ic(o,a),dy=!1,Gl=hr=fy=Io=Os=Rt=0,Jn=Ic=null,hy=!1,(a&8)!==0&&(a|=a&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=a;0<p;){var y=31-nt(p),x=1<<y;a|=o[y],p&=~x}return Yi=a,Hd(),d}function pk(o,a){He=null,z.H=Oc,a===Hl||a===Wd?(a=_S(),at=3):a===Sg?(a=_S(),at=4):at=a===Gg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,fr=a,Ye===null&&(Rt=1,cf(o,Ar(a,o.current)))}function mk(){var o=ur.current;return o===null?!0:(Ge&4194048)===Ge?Dr===null:(Ge&62914560)===Ge||(Ge&536870912)!==0?o===Dr:!1}function gk(){var o=z.H;return z.H=Oc,o===null?Oc:o}function yk(){var o=z.A;return z.A=qN,o}function Sf(){Rt=4,Ms||(Ge&4194048)!==Ge&&ur.current!==null||(Wl=!0),(Os&134217727)===0&&(Io&134217727)===0||gt===null||Rs(gt,Ge,hr,!1)}function by(o,a,d){var p=ot;ot|=2;var y=gk(),x=yk();(gt!==o||Ge!==a)&&(xf=null,Jl(o,a)),a=!1;var w=Rt;e:do try{if(at!==0&&Ye!==null){var T=Ye,D=fr;switch(at){case 8:yy(),w=6;break e;case 3:case 2:case 9:case 6:ur.current===null&&(a=!0);var $=at;if(at=0,fr=null,Xl(o,T,D,$),d&&Wl){w=0;break e}break;default:$=at,at=0,fr=null,Xl(o,T,D,$)}}WN(),w=Rt;break}catch(G){pk(o,G)}while(!0);return a&&o.shellSuspendCounter++,Ii=Mo=null,ot=p,z.H=y,z.A=x,Ye===null&&(gt=null,Ge=0,Hd()),w}function WN(){for(;Ye!==null;)bk(Ye)}function GN(o,a){var d=ot;ot|=2;var p=gk(),y=yk();gt!==o||Ge!==a?(xf=null,bf=Jt()+500,Jl(o,a)):Wl=ic(o,a);e:do try{if(at!==0&&Ye!==null){a=Ye;var x=fr;t:switch(at){case 1:at=0,fr=null,Xl(o,a,x,1);break;case 2:case 9:if(MS(x)){at=0,fr=null,xk(a);break}a=function(){at!==2&&at!==9||gt!==o||(at=7),fi(o)},x.then(a,a);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:MS(x)?(at=0,fr=null,xk(a)):(at=0,fr=null,Xl(o,a,x,7));break;case 5:var w=null;switch(Ye.tag){case 26:w=Ye.memoizedState;case 5:case 27:var T=Ye;if(w?iC(w):T.stateNode.complete){at=0,fr=null;var D=T.sibling;if(D!==null)Ye=D;else{var $=T.return;$!==null?(Ye=$,wf($)):Ye=null}break t}}at=0,fr=null,Xl(o,a,x,5);break;case 6:at=0,fr=null,Xl(o,a,x,6);break;case 8:yy(),Rt=6;break e;default:throw Error(r(462))}}ZN();break}catch(G){pk(o,G)}while(!0);return Ii=Mo=null,z.H=p,z.A=y,ot=d,Ye!==null?0:(gt=null,Ge=0,Hd(),Rt)}function ZN(){for(;Ye!==null&&!xl();)bk(Ye)}function bk(o){var a=Pw(o.alternate,o,Yi);o.memoizedProps=o.pendingProps,a===null?wf(o):Ye=a}function xk(o){var a=o,d=a.alternate;switch(a.tag){case 15:case 0:a=jw(d,a,a.pendingProps,a.type,void 0,Ge);break;case 11:a=jw(d,a,a.pendingProps,a.type.render,a.ref,Ge);break;case 5:Ng(a);default:Fw(d,a),a=Ye=yS(a,Yi),a=Pw(d,a,Yi)}o.memoizedProps=o.pendingProps,a===null?wf(o):Ye=a}function Xl(o,a,d,p){Ii=Mo=null,Ng(a),Vl=null,Sc=0;var y=a.return;try{if(BN(o,y,a,d,Ge)){Rt=1,cf(o,Ar(d,o.current)),Ye=null;return}}catch(x){if(y!==null)throw Ye=y,x;Rt=1,cf(o,Ar(d,o.current)),Ye=null;return}a.flags&32768?(Xe||p===1?o=!0:Wl||(Ge&536870912)!==0?o=!1:(Ms=o=!0,(p===2||p===9||p===3||p===6)&&(p=ur.current,p!==null&&p.tag===13&&(p.flags|=16384))),vk(a,o)):wf(a)}function wf(o){var a=o;do{if((a.flags&32768)!==0){vk(a,Ms);return}o=a.return;var d=VN(a.alternate,a,Yi);if(d!==null){Ye=d;return}if(a=a.sibling,a!==null){Ye=a;return}Ye=a=o}while(a!==null);Rt===0&&(Rt=5)}function vk(o,a){do{var d=PN(o.alternate,o);if(d!==null){d.flags&=32767,Ye=d;return}if(d=o.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!a&&(o=o.sibling,o!==null)){Ye=o;return}Ye=o=d}while(o!==null);Rt=6,Ye=null}function Sk(o,a,d,p,y,x,w,T,D){o.cancelPendingCommit=null;do kf();while(Qt!==0);if((ot&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=og,O2(o,d,x,w,T,D),o===gt&&(Ye=gt=null,Ge=0),Zl=a,Ds=o,Wi=d,py=x,my=y,uk=p,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,ez(De,function(){return Tk(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||p){p=z.T,z.T=null,y=Y.p,Y.p=2,w=ot,ot|=4;try{$N(o,a,d)}finally{ot=w,Y.p=y,z.T=p}}Qt=1,wk(),kk(),Ck()}}function wk(){if(Qt===1){Qt=0;var o=Ds,a=Zl,d=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||d){d=z.T,z.T=null;var p=Y.p;Y.p=2;var y=ot;ot|=4;try{nk(a,o);var x=_y,w=aS(o.containerInfo),T=x.focusedElem,D=x.selectionRange;if(w!==T&&T&&T.ownerDocument&&lS(T.ownerDocument.documentElement,T)){if(D!==null&&tg(T)){var $=D.start,G=D.end;if(G===void 0&&(G=$),"selectionStart"in T)T.selectionStart=$,T.selectionEnd=Math.min(G,T.value.length);else{var ee=T.ownerDocument||document,F=ee&&ee.defaultView||window;if(F.getSelection){var K=F.getSelection(),xe=T.textContent.length,Re=Math.min(D.start,xe),ft=D.end===void 0?Re:Math.min(D.end,xe);!K.extend&&Re>ft&&(w=ft,ft=Re,Re=w);var U=oS(T,Re),L=oS(T,ft);if(U&&L&&(K.rangeCount!==1||K.anchorNode!==U.node||K.anchorOffset!==U.offset||K.focusNode!==L.node||K.focusOffset!==L.offset)){var P=ee.createRange();P.setStart(U.node,U.offset),K.removeAllRanges(),Re>ft?(K.addRange(P),K.extend(L.node,L.offset)):(P.setEnd(L.node,L.offset),K.addRange(P))}}}}for(ee=[],K=T;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<ee.length;T++){var X=ee[T];X.element.scrollLeft=X.left,X.element.scrollTop=X.top}}Lf=!!Oy,_y=Oy=null}finally{ot=y,Y.p=p,z.T=d}}o.current=a,Qt=2}}function kk(){if(Qt===2){Qt=0;var o=Ds,a=Zl,d=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||d){d=z.T,z.T=null;var p=Y.p;Y.p=2;var y=ot;ot|=4;try{Jw(o,a.alternate,a)}finally{ot=y,Y.p=p,z.T=d}}Qt=3}}function Ck(){if(Qt===4||Qt===3){Qt=0,xo();var o=Ds,a=Zl,d=Wi,p=uk;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Qt=5:(Qt=0,Zl=Ds=null,Ek(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(_s=null),jm(d),a=a.stateNode,Bt&&typeof Bt.onCommitFiberRoot=="function")try{Bt.onCommitFiberRoot(mn,a,void 0,(a.current.flags&128)===128)}catch{}if(p!==null){a=z.T,y=Y.p,Y.p=2,z.T=null;try{for(var x=o.onRecoverableError,w=0;w<p.length;w++){var T=p[w];x(T.value,{componentStack:T.stack})}}finally{z.T=a,Y.p=y}}(Wi&3)!==0&&kf(),fi(o),y=o.pendingLanes,(d&261930)!==0&&(y&42)!==0?o===gy?Bc++:(Bc=0,gy=o):Bc=0,Uc(0)}}function Ek(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,xc(a)))}function kf(){return wk(),kk(),Ck(),Tk()}function Tk(){if(Qt!==5)return!1;var o=Ds,a=py;py=0;var d=jm(Wi),p=z.T,y=Y.p;try{Y.p=32>d?32:d,z.T=null,d=my,my=null;var x=Ds,w=Wi;if(Qt=0,Zl=Ds=null,Wi=0,(ot&6)!==0)throw Error(r(331));var T=ot;if(ot|=4,lk(x.current),ik(x,x.current,w,d),ot=T,Uc(0,!1),Bt&&typeof Bt.onPostCommitFiberRoot=="function")try{Bt.onPostCommitFiberRoot(mn,x)}catch{}return!0}finally{Y.p=y,z.T=p,Ek(o,a)}}function Ak(o,a,d){a=Ar(d,a),a=Wg(o.stateNode,a,2),o=Cs(o,a,2),o!==null&&(sc(o,2),fi(o))}function ct(o,a,d){if(o.tag===3)Ak(o,o,d);else for(;a!==null;){if(a.tag===3){Ak(a,o,d);break}else if(a.tag===1){var p=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(_s===null||!_s.has(p))){o=Ar(d,o),d=Mw(2),p=Cs(a,d,2),p!==null&&(Ow(d,p,a,o),sc(p,2),fi(p));break}}a=a.return}}function xy(o,a,d){var p=o.pingCache;if(p===null){p=o.pingCache=new KN;var y=new Set;p.set(a,y)}else y=p.get(a),y===void 0&&(y=new Set,p.set(a,y));y.has(d)||(dy=!0,y.add(d),o=JN.bind(null,o,a,d),a.then(o,o))}function JN(o,a,d){var p=o.pingCache;p!==null&&p.delete(a),o.pingedLanes|=o.suspendedLanes&d,o.warmLanes&=~d,gt===o&&(Ge&d)===d&&(Rt===4||Rt===3&&(Ge&62914560)===Ge&&300>Jt()-yf?(ot&2)===0&&Jl(o,0):fy|=d,Gl===Ge&&(Gl=0)),fi(o)}function Mk(o,a){a===0&&(a=wv()),o=Eo(o,a),o!==null&&(sc(o,a),fi(o))}function XN(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Mk(o,d)}function QN(o,a){var d=0;switch(o.tag){case 31:case 13:var p=o.stateNode,y=o.memoizedState;y!==null&&(d=y.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(a),Mk(o,d)}function ez(o,a){return ai(o,a)}var Cf=null,Ql=null,vy=!1,Ef=!1,Sy=!1,Ns=0;function fi(o){o!==Ql&&o.next===null&&(Ql===null?Cf=Ql=o:Ql=Ql.next=o),Ef=!0,vy||(vy=!0,nz())}function Uc(o,a){if(!Sy&&Ef){Sy=!0;do for(var d=!1,p=Cf;p!==null;){if(o!==0){var y=p.pendingLanes;if(y===0)var x=0;else{var w=p.suspendedLanes,T=p.pingedLanes;x=(1<<31-nt(42|o)+1)-1,x&=y&~(w&~T),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(d=!0,Rk(p,x))}else x=Ge,x=Md(p,p===gt?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||ic(p,x)||(d=!0,Rk(p,x));p=p.next}while(d);Sy=!1}}function tz(){Ok()}function Ok(){Ef=vy=!1;var o=0;Ns!==0&&fz()&&(o=Ns);for(var a=Jt(),d=null,p=Cf;p!==null;){var y=p.next,x=_k(p,a);x===0?(p.next=null,d===null?Cf=y:d.next=y,y===null&&(Ql=d)):(d=p,(o!==0||(x&3)!==0)&&(Ef=!0)),p=y}Qt!==0&&Qt!==5||Uc(o),Ns!==0&&(Ns=0)}function _k(o,a){for(var d=o.suspendedLanes,p=o.pingedLanes,y=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var w=31-nt(x),T=1<<w,D=y[w];D===-1?((T&d)===0||(T&p)!==0)&&(y[w]=M2(T,a)):D<=a&&(o.expiredLanes|=T),x&=~T}if(a=gt,d=Ge,d=Md(o,o===a?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,d===0||o===a&&(at===2||at===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&lr(p),o.callbackNode=null,o.callbackPriority=0;if((d&3)===0||ic(o,d)){if(a=d&-d,a===o.callbackPriority)return a;switch(p!==null&&lr(p),jm(d)){case 2:case 8:d=fe;break;case 32:d=De;break;case 268435456:d=tt;break;default:d=De}return p=Dk.bind(null,o),d=ai(d,p),o.callbackPriority=a,o.callbackNode=d,a}return p!==null&&p!==null&&lr(p),o.callbackPriority=2,o.callbackNode=null,2}function Dk(o,a){if(Qt!==0&&Qt!==5)return o.callbackNode=null,o.callbackPriority=0,null;var d=o.callbackNode;if(kf()&&o.callbackNode!==d)return null;var p=Ge;return p=Md(o,o===gt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(fk(o,p,a),_k(o,Jt()),o.callbackNode!=null&&o.callbackNode===d?Dk.bind(null,o):null)}function Rk(o,a){if(kf())return null;fk(o,a,!0)}function nz(){pz(function(){(ot&6)!==0?ai(J,tz):Ok()})}function wy(){if(Ns===0){var o=Bl;o===0&&(o=Gr,Gr<<=1,(Gr&261888)===0&&(Gr=256)),Ns=o}return Ns}function Nk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Rd(""+o)}function zk(o,a){var d=a.ownerDocument.createElement("input");return d.name=a.name,d.value=a.value,o.id&&d.setAttribute("form",o.id),a.parentNode.insertBefore(d,a),o=new FormData(o),d.parentNode.removeChild(d),o}function rz(o,a,d,p,y){if(a==="submit"&&d&&d.stateNode===y){var x=Nk((y[Kn]||null).action),w=p.submitter;w&&(a=(a=w[Kn]||null)?Nk(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var T=new jd("action","action",null,p,y);o.push({event:T,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Ns!==0){var D=w?zk(y,w):new FormData(y);Pg(d,{pending:!0,data:D,method:y.method,action:x},null,D)}}else typeof x=="function"&&(T.preventDefault(),D=w?zk(y,w):new FormData(y),Pg(d,{pending:!0,data:D,method:y.method,action:x},x,D))},currentTarget:y}]})}}for(var ky=0;ky<sg.length;ky++){var Cy=sg[ky],iz=Cy.toLowerCase(),sz=Cy[0].toUpperCase()+Cy.slice(1);Zr(iz,"on"+sz)}Zr(dS,"onAnimationEnd"),Zr(fS,"onAnimationIteration"),Zr(hS,"onAnimationStart"),Zr("dblclick","onDoubleClick"),Zr("focusin","onFocus"),Zr("focusout","onBlur"),Zr(SN,"onTransitionRun"),Zr(wN,"onTransitionStart"),Zr(kN,"onTransitionCancel"),Zr(pS,"onTransitionEnd"),Cl("onMouseEnter",["mouseout","mouseover"]),Cl("onMouseLeave",["mouseout","mouseover"]),Cl("onPointerEnter",["pointerout","pointerover"]),Cl("onPointerLeave",["pointerout","pointerover"]),So("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),So("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),So("onBeforeInput",["compositionend","keypress","textInput","paste"]),So("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),So("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),So("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hc="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(" "),oz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hc));function Lk(o,a){a=(a&4)!==0;for(var d=0;d<o.length;d++){var p=o[d],y=p.event;p=p.listeners;e:{var x=void 0;if(a)for(var w=p.length-1;0<=w;w--){var T=p[w],D=T.instance,$=T.currentTarget;if(T=T.listener,D!==x&&y.isPropagationStopped())break e;x=T,y.currentTarget=$;try{x(y)}catch(G){Ud(G)}y.currentTarget=null,x=D}else for(w=0;w<p.length;w++){if(T=p[w],D=T.instance,$=T.currentTarget,T=T.listener,D!==x&&y.isPropagationStopped())break e;x=T,y.currentTarget=$;try{x(y)}catch(G){Ud(G)}y.currentTarget=null,x=D}}}}function We(o,a){var d=a[Im];d===void 0&&(d=a[Im]=new Set);var p=o+"__bubble";d.has(p)||(jk(a,o,2,!1),d.add(p))}function Ey(o,a,d){var p=0;a&&(p|=4),jk(d,o,p,a)}var Tf="_reactListening"+Math.random().toString(36).slice(2);function Ty(o){if(!o[Tf]){o[Tf]=!0,Ov.forEach(function(d){d!=="selectionchange"&&(oz.has(d)||Ey(d,!1,o),Ey(d,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Tf]||(a[Tf]=!0,Ey("selectionchange",!1,a))}}function jk(o,a,d,p){switch(dC(a)){case 2:var y=zz;break;case 8:y=Lz;break;default:y=Vy}d=y.bind(null,a,d,o),y=void 0,!Km||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),p?y!==void 0?o.addEventListener(a,d,{capture:!0,passive:y}):o.addEventListener(a,d,!0):y!==void 0?o.addEventListener(a,d,{passive:y}):o.addEventListener(a,d,!1)}function Ay(o,a,d,p,y){var x=p;if((a&1)===0&&(a&2)===0&&p!==null)e:for(;;){if(p===null)return;var w=p.tag;if(w===3||w===4){var T=p.stateNode.containerInfo;if(T===y)break;if(w===4)for(w=p.return;w!==null;){var D=w.tag;if((D===3||D===4)&&w.stateNode.containerInfo===y)return;w=w.return}for(;T!==null;){if(w=Sl(T),w===null)return;if(D=w.tag,D===5||D===6||D===26||D===27){p=x=w;continue e}T=T.parentNode}}p=p.return}Vv(function(){var $=x,G=Fm(d),ee=[];e:{var F=mS.get(o);if(F!==void 0){var K=jd,xe=o;switch(o){case"keypress":if(zd(d)===0)break e;case"keydown":case"keyup":K=Q2;break;case"focusin":xe="focus",K=Zm;break;case"focusout":xe="blur",K=Zm;break;case"beforeblur":case"afterblur":K=Zm;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=Fv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=V2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=nN;break;case dS:case fS:case hS:K=F2;break;case pS:K=iN;break;case"scroll":case"scrollend":K=U2;break;case"wheel":K=oN;break;case"copy":case"cut":case"paste":K=K2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Kv;break;case"toggle":case"beforetoggle":K=aN}var Re=(a&4)!==0,ft=!Re&&(o==="scroll"||o==="scrollend"),U=Re?F!==null?F+"Capture":null:F;Re=[];for(var L=$,P;L!==null;){var X=L;if(P=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||P===null||U===null||(X=ac(L,U),X!=null&&Re.push(Vc(L,X,P))),ft)break;L=L.return}0<Re.length&&(F=new K(F,xe,null,d,G),ee.push({event:F,listeners:Re}))}}if((a&7)===0){e:{if(F=o==="mouseover"||o==="pointerover",K=o==="mouseout"||o==="pointerout",F&&d!==$m&&(xe=d.relatedTarget||d.fromElement)&&(Sl(xe)||xe[vl]))break e;if((K||F)&&(F=G.window===G?G:(F=G.ownerDocument)?F.defaultView||F.parentWindow:window,K?(xe=d.relatedTarget||d.toElement,K=$,xe=xe?Sl(xe):null,xe!==null&&(ft=s(xe),Re=xe.tag,xe!==ft||Re!==5&&Re!==27&&Re!==6)&&(xe=null)):(K=null,xe=$),K!==xe)){if(Re=Fv,X="onMouseLeave",U="onMouseEnter",L="mouse",(o==="pointerout"||o==="pointerover")&&(Re=Kv,X="onPointerLeave",U="onPointerEnter",L="pointer"),ft=K==null?F:lc(K),P=xe==null?F:lc(xe),F=new Re(X,L+"leave",K,d,G),F.target=ft,F.relatedTarget=P,X=null,Sl(G)===$&&(Re=new Re(U,L+"enter",xe,d,G),Re.target=P,Re.relatedTarget=ft,X=Re),ft=X,K&&xe)t:{for(Re=lz,U=K,L=xe,P=0,X=U;X;X=Re(X))P++;X=0;for(var Me=L;Me;Me=Re(Me))X++;for(;0<P-X;)U=Re(U),P--;for(;0<X-P;)L=Re(L),X--;for(;P--;){if(U===L||L!==null&&U===L.alternate){Re=U;break t}U=Re(U),L=Re(L)}Re=null}else Re=null;K!==null&&Ik(ee,F,K,Re,!1),xe!==null&&ft!==null&&Ik(ee,ft,xe,Re,!0)}}e:{if(F=$?lc($):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var rt=eS;else if(Xv(F))if(tS)rt=bN;else{rt=gN;var Ce=mN}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?$&&Pm($.elementType)&&(rt=eS):rt=yN;if(rt&&(rt=rt(o,$))){Qv(ee,rt,d,G);break e}Ce&&Ce(o,F,$),o==="focusout"&&$&&F.type==="number"&&$.memoizedProps.value!=null&&Vm(F,"number",F.value)}switch(Ce=$?lc($):window,o){case"focusin":(Xv(Ce)||Ce.contentEditable==="true")&&(_l=Ce,ng=$,gc=null);break;case"focusout":gc=ng=_l=null;break;case"mousedown":rg=!0;break;case"contextmenu":case"mouseup":case"dragend":rg=!1,cS(ee,d,G);break;case"selectionchange":if(vN)break;case"keydown":case"keyup":cS(ee,d,G)}var Ve;if(Xm)e:{switch(o){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else Ol?Zv(o,d)&&(Ze="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(Ze="onCompositionStart");Ze&&(Yv&&d.locale!=="ko"&&(Ol||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Ol&&(Ve=Pv()):(ys=G,Ym="value"in ys?ys.value:ys.textContent,Ol=!0)),Ce=Af($,Ze),0<Ce.length&&(Ze=new qv(Ze,o,null,d,G),ee.push({event:Ze,listeners:Ce}),Ve?Ze.data=Ve:(Ve=Jv(d),Ve!==null&&(Ze.data=Ve)))),(Ve=uN?dN(o,d):fN(o,d))&&(Ze=Af($,"onBeforeInput"),0<Ze.length&&(Ce=new qv("onBeforeInput","beforeinput",null,d,G),ee.push({event:Ce,listeners:Ze}),Ce.data=Ve)),rz(ee,o,$,d,G)}Lk(ee,a)})}function Vc(o,a,d){return{instance:o,listener:a,currentTarget:d}}function Af(o,a){for(var d=a+"Capture",p=[];o!==null;){var y=o,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=ac(o,d),y!=null&&p.unshift(Vc(o,y,x)),y=ac(o,a),y!=null&&p.push(Vc(o,y,x))),o.tag===3)return p;o=o.return}return[]}function lz(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Ik(o,a,d,p,y){for(var x=a._reactName,w=[];d!==null&&d!==p;){var T=d,D=T.alternate,$=T.stateNode;if(T=T.tag,D!==null&&D===p)break;T!==5&&T!==26&&T!==27||$===null||(D=$,y?($=ac(d,x),$!=null&&w.unshift(Vc(d,$,D))):y||($=ac(d,x),$!=null&&w.push(Vc(d,$,D)))),d=d.return}w.length!==0&&o.push({event:a,listeners:w})}var az=/\r\n?/g,cz=/\u0000|\uFFFD/g;function Bk(o){return(typeof o=="string"?o:""+o).replace(az,`
50
+ `).replace(cz,"")}function Uk(o,a){return a=Bk(a),Bk(o)===a}function dt(o,a,d,p,y,x){switch(d){case"children":typeof p=="string"?a==="body"||a==="textarea"&&p===""||Tl(o,p):(typeof p=="number"||typeof p=="bigint")&&a!=="body"&&Tl(o,""+p);break;case"className":_d(o,"class",p);break;case"tabIndex":_d(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":_d(o,d,p);break;case"style":Uv(o,p,x);break;case"data":if(a!=="object"){_d(o,"data",p);break}case"src":case"href":if(p===""&&(a!=="a"||d!=="href")){o.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=Rd(""+p),o.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(d,"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"&&(d==="formAction"?(a!=="input"&&dt(o,a,"name",y.name,y,null),dt(o,a,"formEncType",y.formEncType,y,null),dt(o,a,"formMethod",y.formMethod,y,null),dt(o,a,"formTarget",y.formTarget,y,null)):(dt(o,a,"encType",y.encType,y,null),dt(o,a,"method",y.method,y,null),dt(o,a,"target",y.target,y,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=Rd(""+p),o.setAttribute(d,p);break;case"onClick":p!=null&&(o.onclick=Ni);break;case"onScroll":p!=null&&We("scroll",o);break;case"onScrollEnd":p!=null&&We("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}d=Rd(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""+p):o.removeAttribute(d);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":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""):o.removeAttribute(d);break;case"capture":case"download":p===!0?o.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,p):o.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(d,p):o.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(d):o.setAttribute(d,p);break;case"popover":We("beforetoggle",o),We("toggle",o),Od(o,"popover",p);break;case"xlinkActuate":Ri(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Ri(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Ri(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Ri(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Ri(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Ri(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Ri(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Ri(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Ri(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Od(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=I2.get(d)||d,Od(o,d,p))}}function My(o,a,d,p,y,x){switch(d){case"style":Uv(o,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"children":typeof p=="string"?Tl(o,p):(typeof p=="number"||typeof p=="bigint")&&Tl(o,""+p);break;case"onScroll":p!=null&&We("scroll",o);break;case"onScrollEnd":p!=null&&We("scrollend",o);break;case"onClick":p!=null&&(o.onclick=Ni);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_v.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(y=d.endsWith("Capture"),a=d.slice(2,y?d.length-7:void 0),x=o[Kn]||null,x=x!=null?x[d]:null,typeof x=="function"&&o.removeEventListener(a,x,y),typeof p=="function")){typeof x!="function"&&x!==null&&(d in o?o[d]=null:o.hasAttribute(d)&&o.removeAttribute(d)),o.addEventListener(a,p,y);break e}d in o?o[d]=p:p===!0?o.setAttribute(d,""):Od(o,d,p)}}}function Sn(o,a,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",o),We("load",o);var p=!1,y=!1,x;for(x in d)if(d.hasOwnProperty(x)){var w=d[x];if(w!=null)switch(x){case"src":p=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:dt(o,a,x,w,d,null)}}y&&dt(o,a,"srcSet",d.srcSet,d,null),p&&dt(o,a,"src",d.src,d,null);return;case"input":We("invalid",o);var T=x=w=y=null,D=null,$=null;for(p in d)if(d.hasOwnProperty(p)){var G=d[p];if(G!=null)switch(p){case"name":y=G;break;case"type":w=G;break;case"checked":D=G;break;case"defaultChecked":$=G;break;case"value":x=G;break;case"defaultValue":T=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,a));break;default:dt(o,a,p,G,d,null)}}Lv(o,x,T,D,$,w,y,!1);return;case"select":We("invalid",o),p=w=x=null;for(y in d)if(d.hasOwnProperty(y)&&(T=d[y],T!=null))switch(y){case"value":x=T;break;case"defaultValue":w=T;break;case"multiple":p=T;default:dt(o,a,y,T,d,null)}a=x,d=w,o.multiple=!!p,a!=null?El(o,!!p,a,!1):d!=null&&El(o,!!p,d,!0);return;case"textarea":We("invalid",o),x=y=p=null;for(w in d)if(d.hasOwnProperty(w)&&(T=d[w],T!=null))switch(w){case"value":p=T;break;case"defaultValue":y=T;break;case"children":x=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(91));break;default:dt(o,a,w,T,d,null)}Iv(o,p,y,x);return;case"option":for(D in d)if(d.hasOwnProperty(D)&&(p=d[D],p!=null))switch(D){case"selected":o.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:dt(o,a,D,p,d,null)}return;case"dialog":We("beforetoggle",o),We("toggle",o),We("cancel",o),We("close",o);break;case"iframe":case"object":We("load",o);break;case"video":case"audio":for(p=0;p<Hc.length;p++)We(Hc[p],o);break;case"image":We("error",o),We("load",o);break;case"details":We("toggle",o);break;case"embed":case"source":case"link":We("error",o),We("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($ in d)if(d.hasOwnProperty($)&&(p=d[$],p!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:dt(o,a,$,p,d,null)}return;default:if(Pm(a)){for(G in d)d.hasOwnProperty(G)&&(p=d[G],p!==void 0&&My(o,a,G,p,d,void 0));return}}for(T in d)d.hasOwnProperty(T)&&(p=d[T],p!=null&&dt(o,a,T,p,d,null))}function uz(o,a,d,p){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,T=null,D=null,$=null,G=null;for(K in d){var ee=d[K];if(d.hasOwnProperty(K)&&ee!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":D=ee;default:p.hasOwnProperty(K)||dt(o,a,K,null,p,ee)}}for(var F in p){var K=p[F];if(ee=d[F],p.hasOwnProperty(F)&&(K!=null||ee!=null))switch(F){case"type":x=K;break;case"name":y=K;break;case"checked":$=K;break;case"defaultChecked":G=K;break;case"value":w=K;break;case"defaultValue":T=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,a));break;default:K!==ee&&dt(o,a,F,K,p,ee)}}Hm(o,w,T,D,$,G,x,y);return;case"select":K=w=T=F=null;for(x in d)if(D=d[x],d.hasOwnProperty(x)&&D!=null)switch(x){case"value":break;case"multiple":K=D;default:p.hasOwnProperty(x)||dt(o,a,x,null,p,D)}for(y in p)if(x=p[y],D=d[y],p.hasOwnProperty(y)&&(x!=null||D!=null))switch(y){case"value":F=x;break;case"defaultValue":T=x;break;case"multiple":w=x;default:x!==D&&dt(o,a,y,x,p,D)}a=T,d=w,p=K,F!=null?El(o,!!d,F,!1):!!p!=!!d&&(a!=null?El(o,!!d,a,!0):El(o,!!d,d?[]:"",!1));return;case"textarea":K=F=null;for(T in d)if(y=d[T],d.hasOwnProperty(T)&&y!=null&&!p.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:dt(o,a,T,null,p,y)}for(w in p)if(y=p[w],x=d[w],p.hasOwnProperty(w)&&(y!=null||x!=null))switch(w){case"value":F=y;break;case"defaultValue":K=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&dt(o,a,w,y,p,x)}jv(o,F,K);return;case"option":for(var xe in d)if(F=d[xe],d.hasOwnProperty(xe)&&F!=null&&!p.hasOwnProperty(xe))switch(xe){case"selected":o.selected=!1;break;default:dt(o,a,xe,null,p,F)}for(D in p)if(F=p[D],K=d[D],p.hasOwnProperty(D)&&F!==K&&(F!=null||K!=null))switch(D){case"selected":o.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:dt(o,a,D,F,p,K)}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 Re in d)F=d[Re],d.hasOwnProperty(Re)&&F!=null&&!p.hasOwnProperty(Re)&&dt(o,a,Re,null,p,F);for($ in p)if(F=p[$],K=d[$],p.hasOwnProperty($)&&F!==K&&(F!=null||K!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,a));break;default:dt(o,a,$,F,p,K)}return;default:if(Pm(a)){for(var ft in d)F=d[ft],d.hasOwnProperty(ft)&&F!==void 0&&!p.hasOwnProperty(ft)&&My(o,a,ft,void 0,p,F);for(G in p)F=p[G],K=d[G],!p.hasOwnProperty(G)||F===K||F===void 0&&K===void 0||My(o,a,G,F,p,K);return}}for(var U in d)F=d[U],d.hasOwnProperty(U)&&F!=null&&!p.hasOwnProperty(U)&&dt(o,a,U,null,p,F);for(ee in p)F=p[ee],K=d[ee],!p.hasOwnProperty(ee)||F===K||F==null&&K==null||dt(o,a,ee,F,p,K)}function Hk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dz(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var y=d[p],x=y.transferSize,w=y.initiatorType,T=y.duration;if(x&&T&&Hk(w)){for(w=0,T=y.responseEnd,p+=1;p<d.length;p++){var D=d[p],$=D.startTime;if($>T)break;var G=D.transferSize,ee=D.initiatorType;G&&Hk(ee)&&(D=D.responseEnd,w+=G*(D<T?1:(T-$)/(D-$)))}if(--p,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 Oy=null,_y=null;function Mf(o){return o.nodeType===9?o:o.ownerDocument}function Vk(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 Pk(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 Dy(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 Ry=null;function fz(){var o=window.event;return o&&o.type==="popstate"?o===Ry?!1:(Ry=o,!0):(Ry=null,!1)}var $k=typeof setTimeout=="function"?setTimeout:void 0,hz=typeof clearTimeout=="function"?clearTimeout:void 0,Fk=typeof Promise=="function"?Promise:void 0,pz=typeof queueMicrotask=="function"?queueMicrotask:typeof Fk<"u"?function(o){return Fk.resolve(null).then(o).catch(mz)}:$k;function mz(o){setTimeout(function(){throw o})}function zs(o){return o==="head"}function qk(o,a){var d=a,p=0;do{var y=d.nextSibling;if(o.removeChild(d),y&&y.nodeType===8)if(d=y.data,d==="/$"||d==="/&"){if(p===0){o.removeChild(y),ra(a);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")Pc(o.ownerDocument.documentElement);else if(d==="head"){d=o.ownerDocument.head,Pc(d);for(var x=d.firstChild;x;){var w=x.nextSibling,T=x.nodeName;x[oc]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&x.rel.toLowerCase()==="stylesheet"||d.removeChild(x),x=w}}else d==="body"&&Pc(o.ownerDocument.body);d=y}while(d);ra(a)}function Kk(o,a){var d=o;o=0;do{var p=d.nextSibling;if(d.nodeType===1?a?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(a?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),p&&p.nodeType===8)if(d=p.data,d==="/$"){if(o===0)break;o--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||o++;d=p}while(d)}function Ny(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var d=a;switch(a=a.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Ny(d),Bm(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}o.removeChild(d)}}function gz(o,a,d,p){for(;o.nodeType===1;){var y=d;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[oc])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=Rr(o.nextSibling),o===null)break}return null}function yz(o,a,d){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!d||(o=Rr(o.nextSibling),o===null))return null;return o}function Yk(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Rr(o.nextSibling),o===null))return null;return o}function zy(o){return o.data==="$?"||o.data==="$~"}function Ly(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function bz(o,a){var d=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||d.readyState!=="loading")a();else{var p=function(){a(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function Rr(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 jy=null;function Wk(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"||d==="/&"){if(a===0)return Rr(o.nextSibling);a--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||a++}o=o.nextSibling}return null}function Gk(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(a===0)return o;a--}else d!=="/$"&&d!=="/&"||a++}o=o.previousSibling}return null}function Zk(o,a,d){switch(a=Mf(d),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 Pc(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);Bm(o)}var Nr=new Map,Jk=new Set;function Of(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Gi=Y.d;Y.d={f:xz,r:vz,D:Sz,C:wz,L:kz,m:Cz,X:Tz,S:Ez,M:Az};function xz(){var o=Gi.f(),a=vf();return o||a}function vz(o){var a=wl(o);a!==null&&a.tag===5&&a.type==="form"?pw(a):Gi.r(o)}var ea=typeof document>"u"?null:document;function Xk(o,a,d){var p=ea;if(p&&typeof a=="string"&&a){var y=Er(a);y='link[rel="'+o+'"][href="'+y+'"]',typeof d=="string"&&(y+='[crossorigin="'+d+'"]'),Jk.has(y)||(Jk.add(y),o={rel:o,crossOrigin:d,href:a},p.querySelector(y)===null&&(a=p.createElement("link"),Sn(a,"link",o),tn(a),p.head.appendChild(a)))}}function Sz(o){Gi.D(o),Xk("dns-prefetch",o,null)}function wz(o,a){Gi.C(o,a),Xk("preconnect",o,a)}function kz(o,a,d){Gi.L(o,a,d);var p=ea;if(p&&o&&a){var y='link[rel="preload"][as="'+Er(a)+'"]';a==="image"&&d&&d.imageSrcSet?(y+='[imagesrcset="'+Er(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(y+='[imagesizes="'+Er(d.imageSizes)+'"]')):y+='[href="'+Er(o)+'"]';var x=y;switch(a){case"style":x=ta(o);break;case"script":x=na(o)}Nr.has(x)||(o=m({rel:"preload",href:a==="image"&&d&&d.imageSrcSet?void 0:o,as:a},d),Nr.set(x,o),p.querySelector(y)!==null||a==="style"&&p.querySelector($c(x))||a==="script"&&p.querySelector(Fc(x))||(a=p.createElement("link"),Sn(a,"link",o),tn(a),p.head.appendChild(a)))}}function Cz(o,a){Gi.m(o,a);var d=ea;if(d&&o){var p=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Er(p)+'"][href="'+Er(o)+'"]',x=y;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=na(o)}if(!Nr.has(x)&&(o=m({rel:"modulepreload",href:o},a),Nr.set(x,o),d.querySelector(y)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Fc(x)))return}p=d.createElement("link"),Sn(p,"link",o),tn(p),d.head.appendChild(p)}}}function Ez(o,a,d){Gi.S(o,a,d);var p=ea;if(p&&o){var y=kl(p).hoistableStyles,x=ta(o);a=a||"default";var w=y.get(x);if(!w){var T={loading:0,preload:null};if(w=p.querySelector($c(x)))T.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":a},d),(d=Nr.get(x))&&Iy(o,d);var D=w=p.createElement("link");tn(D),Sn(D,"link",o),D._p=new Promise(function($,G){D.onload=$,D.onerror=G}),D.addEventListener("load",function(){T.loading|=1}),D.addEventListener("error",function(){T.loading|=2}),T.loading|=4,_f(w,a,p)}w={type:"stylesheet",instance:w,count:1,state:T},y.set(x,w)}}}function Tz(o,a){Gi.X(o,a);var d=ea;if(d&&o){var p=kl(d).hoistableScripts,y=na(o),x=p.get(y);x||(x=d.querySelector(Fc(y)),x||(o=m({src:o,async:!0},a),(a=Nr.get(y))&&By(o,a),x=d.createElement("script"),tn(x),Sn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(y,x))}}function Az(o,a){Gi.M(o,a);var d=ea;if(d&&o){var p=kl(d).hoistableScripts,y=na(o),x=p.get(y);x||(x=d.querySelector(Fc(y)),x||(o=m({src:o,async:!0,type:"module"},a),(a=Nr.get(y))&&By(o,a),x=d.createElement("script"),tn(x),Sn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(y,x))}}function Qk(o,a,d,p){var y=(y=ie.current)?Of(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(a=ta(d.href),d=kl(y).hoistableStyles,p=d.get(a),p||(p={type:"style",instance:null,count:0,state:null},d.set(a,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){o=ta(d.href);var x=kl(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($c(o)))&&!x._p&&(w.instance=x,w.state.loading=5),Nr.has(o)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Nr.set(o,d),x||Mz(y,o,d,w.state))),a&&p===null)throw Error(r(528,""));return w}if(a&&p!==null)throw Error(r(529,""));return null;case"script":return a=d.async,d=d.src,typeof d=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=na(d),d=kl(y).hoistableScripts,p=d.get(a),p||(p={type:"script",instance:null,count:0,state:null},d.set(a,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function ta(o){return'href="'+Er(o)+'"'}function $c(o){return'link[rel="stylesheet"]['+o+"]"}function eC(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function Mz(o,a,d,p){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?p.loading=1:(a=o.createElement("link"),p.preload=a,a.addEventListener("load",function(){return p.loading|=1}),a.addEventListener("error",function(){return p.loading|=2}),Sn(a,"link",d),tn(a),o.head.appendChild(a))}function na(o){return'[src="'+Er(o)+'"]'}function Fc(o){return"script[async]"+o}function tC(o,a,d){if(a.count++,a.instance===null)switch(a.type){case"style":var p=o.querySelector('style[data-href~="'+Er(d.href)+'"]');if(p)return a.instance=p,tn(p),p;var y=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),tn(p),Sn(p,"style",y),_f(p,d.precedence,o),a.instance=p;case"stylesheet":y=ta(d.href);var x=o.querySelector($c(y));if(x)return a.state.loading|=4,a.instance=x,tn(x),x;p=eC(d),(y=Nr.get(y))&&Iy(p,y),x=(o.ownerDocument||o).createElement("link"),tn(x);var w=x;return w._p=new Promise(function(T,D){w.onload=T,w.onerror=D}),Sn(x,"link",p),a.state.loading|=4,_f(x,d.precedence,o),a.instance=x;case"script":return x=na(d.src),(y=o.querySelector(Fc(x)))?(a.instance=y,tn(y),y):(p=d,(y=Nr.get(x))&&(p=m({},d),By(p,y)),o=o.ownerDocument||o,y=o.createElement("script"),tn(y),Sn(y,"link",p),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&&(p=a.instance,a.state.loading|=4,_f(p,d.precedence,o));return a.instance}function _f(o,a,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=p.length?p[p.length-1]:null,x=y,w=0;w<p.length;w++){var T=p[w];if(T.dataset.precedence===a)x=T;else if(x!==y)break}x?x.parentNode.insertBefore(o,x.nextSibling):(a=d.nodeType===9?d.head:d,a.insertBefore(o,a.firstChild))}function Iy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function By(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Df=null;function nC(o,a,d){if(Df===null){var p=new Map,y=Df=new Map;y.set(d,p)}else y=Df,p=y.get(d),p||(p=new Map,y.set(d,p));if(p.has(o))return p;for(p.set(o,null),d=d.getElementsByTagName(o),y=0;y<d.length;y++){var x=d[y];if(!(x[oc]||x[yn]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=o+w;var T=p.get(w);T?T.push(x):p.set(w,[x])}}return p}function rC(o,a,d){o=o.ownerDocument||o,o.head.insertBefore(d,a==="title"?o.querySelector("head > title"):null)}function Oz(o,a,d){if(d===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 iC(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function _z(o,a,d,p){if(d.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var y=ta(p.href),x=a.querySelector($c(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=Rf.bind(o),a.then(o,o)),d.state.loading|=4,d.instance=x,tn(x);return}x=a.ownerDocument||a,p=eC(p),(y=Nr.get(y))&&Iy(p,y),x=x.createElement("link"),tn(x);var w=x;w._p=new Promise(function(T,D){w.onload=T,w.onerror=D}),Sn(x,"link",p),d.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(d,a),(a=d.state.preload)&&(d.state.loading&3)===0&&(o.count++,d=Rf.bind(o),a.addEventListener("load",d),a.addEventListener("error",d))}}var Uy=0;function Dz(o,a){return o.stylesheets&&o.count===0&&zf(o,o.stylesheets),0<o.count||0<o.imgCount?function(d){var p=setTimeout(function(){if(o.stylesheets&&zf(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+a);0<o.imgBytes&&Uy===0&&(Uy=62500*dz());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&zf(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>Uy?50:800)+a);return o.unsuspend=d,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(y)}}:null}function Rf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Nf=null;function zf(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Nf=new Map,a.forEach(Rz,o),Nf=null,Rf.call(o))}function Rz(o,a){if(!(a.state.loading&4)){var d=Nf.get(o);if(d)var p=d.get(null);else{d=new Map,Nf.set(o,d);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")&&(d.set(w.dataset.precedence,w),p=w)}p&&d.set(null,p)}y=a.instance,w=y.getAttribute("data-precedence"),x=d.get(w)||p,x===p&&d.set(null,y),d.set(w,y),this.count++,p=Rf.bind(this),y.addEventListener("load",p),y.addEventListener("error",p),x?x.parentNode.insertBefore(y,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),a.state.loading|=4}}var qc={$$typeof:N,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function Nz(o,a,d,p,y,x,w,T,D){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=zm(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zm(0),this.hiddenUpdates=zm(null),this.identifierPrefix=p,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function sC(o,a,d,p,y,x,w,T,D,$,G,ee){return o=new Nz(o,a,d,w,D,$,G,ee,T),a=1,x===!0&&(a|=24),x=cr(3,null,null,a),o.current=x,x.stateNode=o,a=bg(),a.refCount++,o.pooledCache=a,a.refCount++,x.memoizedState={element:p,isDehydrated:d,cache:a},wg(x),o}function oC(o){return o?(o=Nl,o):Nl}function lC(o,a,d,p,y,x){y=oC(y),p.context===null?p.context=y:p.pendingContext=y,p=ks(a),p.payload={element:d},x=x===void 0?null:x,x!==null&&(p.callback=x),d=Cs(o,p,a),d!==null&&(Xn(d,o,a),kc(d,o,a))}function aC(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function Hy(o,a){aC(o,a),(o=o.alternate)&&aC(o,a)}function cC(o){if(o.tag===13||o.tag===31){var a=Eo(o,67108864);a!==null&&Xn(a,o,67108864),Hy(o,67108864)}}function uC(o){if(o.tag===13||o.tag===31){var a=pr();a=Lm(a);var d=Eo(o,a);d!==null&&Xn(d,o,a),Hy(o,a)}}var Lf=!0;function zz(o,a,d,p){var y=z.T;z.T=null;var x=Y.p;try{Y.p=2,Vy(o,a,d,p)}finally{Y.p=x,z.T=y}}function Lz(o,a,d,p){var y=z.T;z.T=null;var x=Y.p;try{Y.p=8,Vy(o,a,d,p)}finally{Y.p=x,z.T=y}}function Vy(o,a,d,p){if(Lf){var y=Py(p);if(y===null)Ay(o,a,p,jf,d),fC(o,p);else if(Iz(y,o,a,d,p))p.stopPropagation();else if(fC(o,p),a&4&&-1<jz.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=vo(x.pendingLanes);if(w!==0){var T=x;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var D=1<<31-nt(w);T.entanglements[1]|=D,w&=~D}fi(x),(ot&6)===0&&(bf=Jt()+500,Uc(0))}}break;case 31:case 13:T=Eo(x,2),T!==null&&Xn(T,x,2),vf(),Hy(x,2)}if(x=Py(p),x===null&&Ay(o,a,p,jf,d),x===y)break;y=x}y!==null&&p.stopPropagation()}else Ay(o,a,p,null,d)}}function Py(o){return o=Fm(o),$y(o)}var jf=null;function $y(o){if(jf=null,o=Sl(o),o!==null){var a=s(o);if(a===null)o=null;else{var d=a.tag;if(d===13){if(o=l(a),o!==null)return o;o=null}else if(d===31){if(o=c(a),o!==null)return o;o=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return jf=o,null}function dC(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(ps()){case J:return 2;case fe:return 8;case De:case ce:return 32;case tt:return 268435456;default:return 32}default:return 32}}var Fy=!1,Ls=null,js=null,Is=null,Kc=new Map,Yc=new Map,Bs=[],jz="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 fC(o,a){switch(o){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":js=null;break;case"mouseover":case"mouseout":Is=null;break;case"pointerover":case"pointerout":Kc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yc.delete(a.pointerId)}}function Wc(o,a,d,p,y,x){return o===null||o.nativeEvent!==x?(o={blockedOn:a,domEventName:d,eventSystemFlags:p,nativeEvent:x,targetContainers:[y]},a!==null&&(a=wl(a),a!==null&&cC(a)),o):(o.eventSystemFlags|=p,a=o.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),o)}function Iz(o,a,d,p,y){switch(a){case"focusin":return Ls=Wc(Ls,o,a,d,p,y),!0;case"dragenter":return js=Wc(js,o,a,d,p,y),!0;case"mouseover":return Is=Wc(Is,o,a,d,p,y),!0;case"pointerover":var x=y.pointerId;return Kc.set(x,Wc(Kc.get(x)||null,o,a,d,p,y)),!0;case"gotpointercapture":return x=y.pointerId,Yc.set(x,Wc(Yc.get(x)||null,o,a,d,p,y)),!0}return!1}function hC(o){var a=Sl(o.target);if(a!==null){var d=s(a);if(d!==null){if(a=d.tag,a===13){if(a=l(d),a!==null){o.blockedOn=a,Av(o.priority,function(){uC(d)});return}}else if(a===31){if(a=c(d),a!==null){o.blockedOn=a,Av(o.priority,function(){uC(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function If(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var d=Py(o.nativeEvent);if(d===null){d=o.nativeEvent;var p=new d.constructor(d.type,d);$m=p,d.target.dispatchEvent(p),$m=null}else return a=wl(d),a!==null&&cC(a),o.blockedOn=d,!1;a.shift()}return!0}function pC(o,a,d){If(o)&&d.delete(a)}function Bz(){Fy=!1,Ls!==null&&If(Ls)&&(Ls=null),js!==null&&If(js)&&(js=null),Is!==null&&If(Is)&&(Is=null),Kc.forEach(pC),Yc.forEach(pC)}function Bf(o,a){o.blockedOn===a&&(o.blockedOn=null,Fy||(Fy=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bz)))}var Uf=null;function mC(o){Uf!==o&&(Uf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Uf===o&&(Uf=null);for(var a=0;a<o.length;a+=3){var d=o[a],p=o[a+1],y=o[a+2];if(typeof p!="function"){if($y(p||d)===null)continue;break}var x=wl(d);x!==null&&(o.splice(a,3),a-=3,Pg(x,{pending:!0,data:y,method:d.method,action:p},p,y))}}))}function ra(o){function a(D){return Bf(D,o)}Ls!==null&&Bf(Ls,o),js!==null&&Bf(js,o),Is!==null&&Bf(Is,o),Kc.forEach(a),Yc.forEach(a);for(var d=0;d<Bs.length;d++){var p=Bs[d];p.blockedOn===o&&(p.blockedOn=null)}for(;0<Bs.length&&(d=Bs[0],d.blockedOn===null);)hC(d),d.blockedOn===null&&Bs.shift();if(d=(o.ownerDocument||o).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var y=d[p],x=d[p+1],w=y[Kn]||null;if(typeof x=="function")w||mC(d);else if(w){var T=null;if(x&&x.hasAttribute("formAction")){if(y=x,w=x[Kn]||null)T=w.formAction;else if($y(y)!==null)continue}else T=w.action;typeof T=="function"?d[p+1]=T:(d.splice(p,3),p-=3),mC(d)}}}function gC(){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),p||setTimeout(d,20)}function d(){if(!p&&!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 p=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function qy(o){this._internalRoot=o}Hf.prototype.render=qy.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var d=a.current,p=pr();lC(d,p,o,a,null,null)},Hf.prototype.unmount=qy.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;lC(o.current,2,null,o,null,null),vf(),a[vl]=null}};function Hf(o){this._internalRoot=o}Hf.prototype.unstable_scheduleHydration=function(o){if(o){var a=Tv();o={blockedOn:null,target:o,priority:a};for(var d=0;d<Bs.length&&a!==0&&a<Bs[d].priority;d++);Bs.splice(d,0,o),d===0&&hC(o)}};var yC=e.version;if(yC!=="19.2.4")throw Error(r(527,yC,"19.2.4"));Y.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=f(a),o=o!==null?h(o):null,o=o===null?null:o.stateNode,o};var Uz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vf.isDisabled&&Vf.supportsFiber)try{mn=Vf.inject(Uz),Bt=Vf}catch{}}return Zc.createRoot=function(o,a){if(!i(o))throw Error(r(299));var d=!1,p="",y=Cw,x=Ew,w=Tw;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(p=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=sC(o,1,!1,null,null,d,p,null,y,x,w,gC),o[vl]=a.current,Ty(o),new qy(a)},Zc.hydrateRoot=function(o,a,d){if(!i(o))throw Error(r(299));var p=!1,y="",x=Cw,w=Ew,T=Tw,D=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(y=d.identifierPrefix),d.onUncaughtError!==void 0&&(x=d.onUncaughtError),d.onCaughtError!==void 0&&(w=d.onCaughtError),d.onRecoverableError!==void 0&&(T=d.onRecoverableError),d.formState!==void 0&&(D=d.formState)),a=sC(o,1,!0,a,d??null,p,y,D,x,w,T,gC),a.context=oC(null),d=a.current,p=pr(),p=Lm(p),y=ks(p),y.callback=null,Cs(d,y,p),d=p,a.current.lanes=d,sc(a,d),fi(a),o[vl]=a.current,Ty(o),new Hf(a)},Zc.version="19.2.4",Zc}var AC;function Zz(){if(AC)return Wy.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(),Wy.exports=Gz(),Wy.exports}var Jz=Zz();const Xz="upload://";function Qz(t){return t.startsWith(Xz)}const gh=t=>t,Sr=t=>t;function eL({onDismiss:t}){return S.jsxs("div",{style:{padding:"8px 16px",background:"var(--tandem-error-bg)",borderBottom:"1px solid var(--tandem-error-border)",fontSize:"13px",color:"var(--tandem-error-fg-strong)",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"12px"},children:[S.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),S.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-error-fg-strong)",fontSize:"16px",lineHeight:1,padding:"0 4px"},"aria-label":"Dismiss connection banner",children:"×"})]})}const MC=3478,fd=3479,tL=3e3,nL=3e3,rL=3e4,Du={yellow:"rgba(255, 235, 59, 0.3)",green:"rgba(76, 175, 80, 0.3)",blue:"rgba(33, 150, 243, 0.3)",pink:"rgba(236, 72, 153, 0.3)"},OC="tandem",$f="tandem:mode",bM="tandem:settings",iL="tandem-panel-width",sL="tandem-left-panel-width",xM={left:sL,right:iL},vM=1e3,Lh=500,jh=3e3,oL="__tandem_ctrl__",Oa="annotations",SM="awareness",db="userAwareness",lL="mode",aL="selectionDwellMs",_C="chat",yh="documentMeta",cL="annotationReplies",DC="savedAtVersion",RC="authorship",wM="tandem:showAuthorship",Ix="tandem:recentFiles",uL=20,Bx="tandem:userName",kM="You",fb="tandem:user-name-changed",CM=40,NC={error:8e3,warning:6e3,info:4e3},dL=5,EM="tandem:tutorialCompleted",fL="tutorial-",TM="tandem:coworkOnboardingSkipped",hL=3e4,LW=2e3,zC="tandem:zoomLevel",LC=.5,jC=2,Jc=1;function jW(t){return t?t.osSupported?t.coworkDetected?"normal":"undetected":"unsupported":"loading"}function pL(t){switch(t.kind){case"adminDeclined":return"Admin permission was denied. Retry with admin, or disable Cowork integration.";case"netshNotFound":return"Windows Firewall command (netsh) was not found on PATH. Confirm your Windows install is intact.";case"netshFailure":return`Windows Firewall command failed (exit ${t.exitCode}). Details: ${mL(t.stderrTail)}`;case"subnetDetectionFailed":return"Could not detect the Hyper-V / Cowork VM subnet. Is Claude Desktop Cowork actually set up on this machine?";case"adapterEnumerationFailed":return"Could not enumerate Hyper-V network adapters. Run Tandem as administrator or reboot to refresh the adapter list.";default:return`Unexpected firewall error (${t.kind}). Please restart Tandem.`}}function mL(t){const e=t.trim();return e.length===0?"(no output)":e.length<=200?e:`${e.slice(0,197)}...`}function AM(t){try{const e=JSON.parse(t);if(typeof e=="object"&&e!==null&&"kind"in e&&typeof e.kind=="string")try{return pL(e)}catch(n){return console.error("[cowork] firewallErrorHint failed for:",e,n),t}return t}catch{return t}}function IW(t){switch(t){case"ok":return"Installed";case"alreadyPresent":return"Already installed";case"locked":return"Locked (retrying)";case"schemaDrift":return"Schema drift";case"insecureAcl":return"Insecure ACL";case"failed":return"Failed"}}function BW(t){switch(t){case"ok":case"alreadyPresent":return"success";case"locked":return"warning";case"schemaDrift":case"insecureAcl":case"failed":return"error"}}function UW(t){const e=["failed","schemaDrift","insecureAcl","locked","alreadyPresent","ok"],n=[t.installedPlugins,t.knownMarketplaces,t.coworkSettings];for(const r of e)if(n.includes(r))return r;return"ok"}function MM(t,e){return!(!t||e||!t.osSupported||!t.coworkDetected||t.enabled)}function OM(){try{return localStorage.getItem(TM)==="true"}catch{return!1}}function gL(){try{localStorage.setItem(TM,"true")}catch{}}function hd(){try{return typeof window<"u"&&"__TAURI_INTERNALS__"in window}catch{return!1}}function HW(t){let e=null;return{schedule(n){e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,n()},t)},cancel(){e!==null&&(clearTimeout(e),e=null)}}}const yL="modulepreload",bL=function(t){return"/"+t},IC={},Ux=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(f=>{if(f=bL(f),f in IC)return;IC[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":yL,h||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),h)return new Promise((b,v)=>{g.addEventListener("load",b),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}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)})},_M="Tauri runtime not available";async function Hx(){try{return(await Ux(()=>import("./core-DhEqZVGG.js"),[])).invoke}catch(t){return hd()&&console.error("[cowork] Failed to load @tauri-apps/api/core:",t),(()=>Promise.reject(new Error(_M)))}}function xL(t){return t("cowork_get_status")}function DM(t,e){return t("cowork_toggle_integration",{enabled:e})}function VW(t){return t("cowork_rescan")}function PW(t,e){return t("cowork_set_lan_ip_override",{enabled:e})}function vL(t){return t("cowork_retry_admin_elevation")}function RM(t){const[e,n]=M.useState(null),[r,i]=M.useState(t),[s,l]=M.useState(null),c=M.useRef(null),u=M.useRef(!1),f=M.useRef(!0),h=M.useRef(null),m=M.useCallback(async()=>{if(u.current){f.current&&i(!1);return}const g=c.current;if(g)try{const b=await xL(g);if(!f.current)return;n(b),l(null)}catch(b){if(!f.current)return;const v=b instanceof Error?b.message:String(b);if(v===_M){u.current=!0,h.current!==null&&(clearInterval(h.current),h.current=null),i(!1);return}l(v)}finally{f.current&&i(!1)}},[]);return M.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),M.useEffect(()=>{if(!t){i(!1);return}let g=!1;return Hx().then(b=>{if(!g)return c.current=b,i(!0),m()}).catch(b=>{if(g)return;const v=b instanceof Error?b.message:String(b);l(v),i(!1)}),h.current=setInterval(()=>{g||u.current||m()},hL),()=>{g=!0,h.current!==null&&(clearInterval(h.current),h.current=null)}},[t,m]),{status:e,loading:r,error:s,refetch:m}}const SL='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function wL(){const{status:t,error:e,refetch:n}=RM(!0),r=(t==null?void 0:t.uacDeclined)===!0,i=M.useRef(null),s=M.useRef(!0),[l,c]=M.useState(!1),[u,f]=M.useState(!1),[h,m]=M.useState(null);M.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]),M.useEffect(()=>{if(!r)return;const k=typeof document<"u"?document.title:null;return typeof document<"u"&&!document.title.startsWith("⚠")&&(document.title=`⚠ ${document.title}`),()=>{typeof document<"u"&&k!==null&&(document.title=k)}},[r]),M.useEffect(()=>{if(!r)return;const k=C=>{if(C.key!=="Tab"||!i.current)return;const E=i.current.querySelectorAll(SL);if(E.length===0)return;const j=E[0],N=E[E.length-1],q=document.activeElement;if(!i.current.contains(q)){C.preventDefault(),j.focus();return}C.shiftKey&&q===j?(C.preventDefault(),N.focus()):!C.shiftKey&&q===N&&(C.preventDefault(),j.focus())};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[r]),M.useEffect(()=>{var k;r&&((k=i.current)==null||k.focus())},[r]);const g=M.useCallback(async(k,C)=>{f(!0),m(null);try{const E=await Hx();await k(E)}catch(E){const j=E instanceof Error?E.message:String(E),N=AM(j);s.current&&m(`${C}: ${N}`)}finally{s.current&&f(!1)}},[]),b=M.useCallback(async()=>{await g(async k=>{await vL(k),await n()},"Retry failed")},[g,n]),v=M.useCallback(async()=>{await g(async k=>{await DM(k,!1),await n()},"Failed to disable Cowork"),c(!1)},[g,n]);return e&&!t?S.jsx("div",{"data-testid":"cowork-admin-declined-status-error",role:"alert",style:{position:"fixed",bottom:16,right:16,zIndex:1e4,maxWidth:400,border:"1px solid var(--tandem-error-border)",background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)",borderRadius:6,padding:"10px 14px",fontSize:12,lineHeight:1.5},children:"Cowork status check failed: unable to determine if admin elevation was declined. Please restart Tandem to restore normal operation."}):r?S.jsx("div",{"data-testid":"cowork-admin-declined-backdrop",style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.45)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"},children:S.jsxs("div",{ref:i,"data-testid":"cowork-admin-declined-modal",role:"dialog","aria-modal":"true","aria-labelledby":"cowork-admin-declined-heading",tabIndex:-1,style:{width:440,maxWidth:"calc(100vw - 32px)",background:"var(--tandem-surface)",color:"var(--tandem-fg)",border:"1px solid var(--tandem-error-border)",borderRadius:8,padding:20,boxShadow:"0 8px 32px rgba(0,0,0,0.24)",outline:"none",display:"flex",flexDirection:"column",gap:12},children:[S.jsx("h2",{id:"cowork-admin-declined-heading",style:{margin:0,fontSize:16,fontWeight:600,color:"var(--tandem-error-fg-strong)"},children:"Admin permission required"}),S.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)"},children:"Cowork integration requires Windows admin permission to configure firewall rules. Without it, Tandem can't safely be reached from inside the Cowork VM. Port 3479 is currently blocked by a deny rule to protect your machine."}),h&&S.jsx("div",{"data-testid":"cowork-admin-declined-error",role:"alert",style:{fontSize:12,color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",border:"1px solid var(--tandem-error-border)",borderRadius:4,padding:"6px 8px"},children:h}),l?S.jsxs("div",{"data-testid":"cowork-admin-declined-confirm-disable",style:{fontSize:12,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",border:"1px solid var(--tandem-warning-border)",borderRadius:4,padding:"8px 10px"},children:[S.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Disable Cowork integration?"}),S.jsx("div",{style:{marginBottom:8},children:"The deny rule will remain in place. You can re-enable Cowork later from Settings."}),S.jsxs("div",{style:{display:"flex",gap:8},children:[S.jsx("button",{"data-testid":"cowork-admin-declined-disable-confirm-btn",type:"button",onClick:()=>void v(),disabled:u,style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-error-border)",borderRadius:4,background:"var(--tandem-error)",color:"var(--tandem-error-fg)",cursor:"pointer",fontWeight:600},children:"Disable"}),S.jsx("button",{"data-testid":"cowork-admin-declined-disable-cancel-btn",type:"button",onClick:()=>c(!1),disabled:u,style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]}):S.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[S.jsx("button",{"data-testid":"cowork-admin-declined-disable-btn",type:"button",onClick:()=>c(!0),disabled:u,style:{padding:"6px 12px",fontSize:13,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Disable Cowork"}),S.jsx("button",{"data-testid":"cowork-admin-declined-retry-btn",type:"button",onClick:()=>void b(),disabled:u,style:{padding:"6px 12px",fontSize:13,border:"1px solid var(--tandem-accent)",borderRadius:4,background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer",fontWeight:600},children:"Retry with admin"})]})]})}):null}function Xy({connected:t,claudeActive:e}){const[n,r]=M.useState(!1);return M.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),nL);return()=>clearTimeout(i)},[t]),S.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--tandem-fg-subtle)",gap:"8px"},children:n?S.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):S.jsxs(S.Fragment,{children:[S.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&S.jsx("span",{style:{fontSize:"0.85em",color:"var(--tandem-fg-subtle)"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}const kL=[{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 CL({open:t,onClose:e}){return M.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?S.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:S.jsxs("div",{style:{backgroundColor:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",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:[S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[S.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"var(--tandem-fg)"},children:"Keyboard Shortcuts"}),S.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:"var(--tandem-fg-muted)",lineHeight:1,padding:"2px 6px",borderRadius:"4px"},children:"✕"})]}),kL.map(n=>S.jsxs("div",{style:{marginBottom:"18px"},children:[S.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:n.title}),S.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:S.jsx("tbody",{children:n.rows.map(r=>S.jsxs("tr",{children:[S.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:S.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>S.jsxs("span",{children:[S.jsx("kbd",{style:{display:"inline-block",padding:"1px 6px",fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border-strong)",borderBottom:"2px solid var(--tandem-border-strong)",borderRadius:"4px",color:"var(--tandem-fg)",lineHeight:"1.5"},children:i}),s<r.keys.length-1&&S.jsx("span",{style:{color:"var(--tandem-fg-subtle)",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),S.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"var(--tandem-fg-muted)",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),S.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid var(--tandem-border)",fontSize:"11px",color:"var(--tandem-fg-subtle)",textAlign:"center"},children:["Press"," ",S.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border)",borderRadius:"3px",color:"var(--tandem-fg-subtle)"},children:"?"})," ","or"," ",S.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border)",borderRadius:"3px",color:"var(--tandem-fg-subtle)"},children:"Esc"})," ","to close"]})]})}):null}function EL({status:t,onAdvance:e,onLearnMore:n}){const[r,i]=M.useState(!1),[s,l]=M.useState(!1),[c,u]=M.useState(null),f=M.useRef(!0);M.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const h=M.useCallback(async(b,v)=>{l(!0),u(null);try{const k=await Hx();return await b(k),!0}catch(k){const C=k instanceof Error?k.message:String(k),E=AM(C);return f.current&&u(`${v}: ${E}`),!1}finally{f.current&&l(!1)}},[]),m=M.useCallback(async()=>{await h(async v=>{await DM(v,!0)},"Failed to enable Cowork")&&e()},[h,e]),g=M.useCallback(()=>{gL(),e()},[e]);return S.jsxs("div",{"data-testid":"cowork-onboarding-step",style:{display:"flex",flexDirection:"column",gap:8},children:[S.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--tandem-fg)"},children:"Claude Desktop Cowork detected"}),S.jsxs("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)"},children:["Enable Tandem inside Cowork workspaces?",t.vethernetCidr!==null&&S.jsxs(S.Fragment,{children:[" ","Detected VM subnet: ",S.jsx("code",{children:t.vethernetCidr}),"."]})]}),c&&S.jsx("div",{"data-testid":"cowork-onboarding-error",role:"alert",style:{fontSize:12,color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",border:"1px solid var(--tandem-error-border)",borderRadius:4,padding:"6px 8px"},children:c}),r?S.jsxs("div",{"data-testid":"cowork-onboarding-confirm",style:{fontSize:12,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",border:"1px solid var(--tandem-warning-border)",borderRadius:4,padding:"8px 10px"},children:[S.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Confirm: Enable Cowork"}),S.jsx("div",{style:{marginBottom:8},children:"Windows will prompt for admin permission to modify firewall rules. This is expected."}),S.jsxs("div",{style:{display:"flex",gap:8},children:[S.jsx("button",{"data-testid":"cowork-onboarding-enable-confirm-btn",type:"button",onClick:()=>void m(),disabled:s,style:BC,children:"Enable"}),S.jsx("button",{"data-testid":"cowork-onboarding-enable-cancel-btn",type:"button",onClick:()=>i(!1),disabled:s,style:Qy,children:"Cancel"})]})]}):S.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[S.jsx("button",{"data-testid":"cowork-onboarding-enable-btn",type:"button",onClick:()=>i(!0),disabled:s,style:BC,children:"Enable"}),S.jsx("button",{"data-testid":"cowork-onboarding-skip-btn",type:"button",onClick:g,disabled:s,style:Qy,children:"Skip"}),n?S.jsx("button",{"data-testid":"cowork-onboarding-learn-more-btn",type:"button",onClick:n,disabled:s,style:Qy,children:"Learn more"}):S.jsx("a",{"data-testid":"cowork-onboarding-learn-more-link",href:"https://github.com/bloknayrb/tandem#cowork",target:"_blank",rel:"noreferrer",style:{fontSize:12,color:"var(--tandem-accent)",alignSelf:"center",textDecoration:"underline"},children:"Learn more"})]})]})}const BC={padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-accent)",borderRadius:4,background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer",fontWeight:600},Qy={padding:"4px 10px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},TL=[{id:"review",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."},{id:"question",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."},{id:"edit",title:"Make an edit",text:"Click in the document and type something. All changes sync in real-time."},{id:"cowork",title:"Claude Desktop Cowork detected",text:""},{id:"complete",title:"You're ready!",text:"You've learned the basics. Press ? anytime to see keyboard shortcuts."}];function AL({currentStep:t,onNext:e,onDismiss:n,coworkStatus:r}){const i=hd(),s=M.useMemo(OM,[]),l=i&&MM(r,s),c=M.useMemo(()=>TL.filter(g=>g.id!=="cowork"||l),[l]),u=c.length-1,f=c[t];if(!f)return null;const h=t>=u,m=f.id==="cowork";return S.jsxs("div",{"data-testid":"onboarding-tutorial",style:{position:"fixed",bottom:48,left:24,zIndex:900,maxWidth:340,background:"var(--tandem-surface)",borderLeft:"4px solid var(--tandem-accent)",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:[!h&&S.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:u},(g,b)=>S.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:b<=t?"var(--tandem-accent)":"var(--tandem-border)",transition:"background 0.2s"}},b))}),m&&r!==null?S.jsx(EL,{status:r,onAdvance:e}):S.jsxs(S.Fragment,{children:[S.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--tandem-fg)",marginBottom:6},children:f.title}),S.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)",marginBottom:h?0:14},children:f.text})]}),!h&&!m&&S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("span",{style:{fontSize:11,color:"var(--tandem-fg-subtle)"},children:["Step ",t+1," of ",u]}),S.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[S.jsx("button",{"data-testid":"tutorial-dismiss-btn",onClick:n,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"var(--tandem-fg-subtle)",padding:0,textDecoration:"underline"},children:"Dismiss tutorial"}),S.jsx("button",{"data-testid":"tutorial-next-btn",onClick:e,style:{padding:"4px 12px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:500},children:t===u-1?"Done":"Next"})]})]})]})}function ML(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const OL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_L=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DL={};function UC(t,e){return(DL.jsx?_L:OL).test(t)}const RL=/[ \t\n\f\r]/g;function NL(t){return typeof t=="object"?t.type==="text"?HC(t.value):!1:HC(t)}function HC(t){return t.replace(RL,"")===""}let pd=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};pd.prototype.normal={};pd.prototype.property={};pd.prototype.space=void 0;function NM(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new pd(n,r,e)}function hb(t){return t.toLowerCase()}class sr{constructor(e,n){this.attribute=n,this.property=e}}sr.prototype.attribute="";sr.prototype.booleanish=!1;sr.prototype.boolean=!1;sr.prototype.commaOrSpaceSeparated=!1;sr.prototype.commaSeparated=!1;sr.prototype.defined=!1;sr.prototype.mustUseProperty=!1;sr.prototype.number=!1;sr.prototype.overloadedBoolean=!1;sr.prototype.property="";sr.prototype.spaceSeparated=!1;sr.prototype.space=void 0;let zL=0;const Pe=ml(),Yt=ml(),pb=ml(),ue=ml(),vt=ml(),ya=ml(),mr=ml();function ml(){return 2**++zL}const mb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:Yt,commaOrSpaceSeparated:mr,commaSeparated:ya,number:ue,overloadedBoolean:pb,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),e0=Object.keys(mb);class Vx extends sr{constructor(e,n,r,i){let s=-1;if(super(e,n),VC(this,"space",i),typeof r=="number")for(;++s<e0.length;){const l=e0[s];VC(this,e0[s],(r&mb[l])===mb[l])}}}Vx.prototype.defined=!0;function VC(t,e,n){n&&(t[e]=n)}function Ya(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Vx(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[hb(r)]=r,n[hb(s.attribute)]=r}return new pd(e,n,t.space)}const zM=Ya({properties:{ariaActiveDescendant:null,ariaAtomic:Yt,ariaAutoComplete:null,ariaBusy:Yt,ariaChecked:Yt,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:vt,ariaCurrent:null,ariaDescribedBy:vt,ariaDetails:null,ariaDisabled:Yt,ariaDropEffect:vt,ariaErrorMessage:null,ariaExpanded:Yt,ariaFlowTo:vt,ariaGrabbed:Yt,ariaHasPopup:null,ariaHidden:Yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vt,ariaLevel:ue,ariaLive:null,ariaModal:Yt,ariaMultiLine:Yt,ariaMultiSelectable:Yt,ariaOrientation:null,ariaOwns:vt,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Yt,ariaReadOnly:Yt,ariaRelevant:null,ariaRequired:Yt,ariaRoleDescription:vt,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Yt,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 LM(t,e){return e in t?t[e]:e}function jM(t,e){return LM(t,e.toLowerCase())}const LL=Ya({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ya,acceptCharset:vt,accessKey:vt,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:vt,autoFocus:Pe,autoPlay:Pe,blocking:vt,capture:null,charSet:null,checked:Pe,cite:null,className:vt,cols:ue,colSpan:null,content:null,contentEditable:Yt,controls:Pe,controlsList:vt,coords:ue|ya,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:pb,draggable:Yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:vt,height:ue,hidden:pb,high:ue,href:null,hrefLang:null,htmlFor:vt,httpEquiv:vt,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:vt,itemRef:vt,itemScope:Pe,itemType:vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,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:Pe,optimum:ue,pattern:null,ping:vt,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:vt,required:Pe,reversed:Pe,rows:ue,rowSpan:ue,sandbox:vt,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Yt,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:Pe,useMap:null,value:Yt,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vt,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:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Yt,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:Pe,disableRemotePlayback:Pe,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:jM}),jL=Ya({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:mr,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:vt,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:Pe,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:ya,g2:ya,glyphName:ya,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:mr,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:vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mr,rev:mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mr,requiredFeatures:mr,requiredFonts:mr,requiredFormats:mr,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:mr,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:mr,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:mr,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:LM}),IM=Ya({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()}}),BM=Ya({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jM}),UM=Ya({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),IL={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"},BL=/[A-Z]/g,PC=/-[a-z]/g,UL=/^data[-\w.:]+$/i;function HL(t,e){const n=hb(e);let r=e,i=sr;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&UL.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(PC,PL);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!PC.test(s)){let l=s.replace(BL,VL);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=Vx}return new i(r,e)}function VL(t){return"-"+t.toLowerCase()}function PL(t){return t.charAt(1).toUpperCase()}const $L=NM([zM,LL,IM,BM,UM],"html"),Px=NM([zM,jL,IM,BM,UM],"svg");function FL(t){return t.join(" ").trim()}var ia={},t0,$C;function qL(){if($C)return t0;$C=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
51
+ `,f="/",h="*",m="",g="comment",b="declaration";function v(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var j=1,N=1;function q(ae){var V=ae.match(e);V&&(j+=V.length);var z=ae.lastIndexOf(u);N=~z?ae.length-z:N+ae.length}function H(){var ae={line:j,column:N};return function(V){return V.position=new R(ae),W(),V}}function R(ae){this.start=ae,this.end={line:j,column:N},this.source=E.source}R.prototype.content=C;function I(ae){var V=new Error(E.source+":"+j+":"+N+": "+ae);if(V.reason=ae,V.filename=E.source,V.line=j,V.column=N,V.source=C,!E.silent)throw V}function Q(ae){var V=ae.exec(C);if(V){var z=V[0];return q(z),C=C.slice(z.length),V}}function W(){Q(n)}function oe(ae){var V;for(ae=ae||[];V=ne();)V!==!1&&ae.push(V);return ae}function ne(){var ae=H();if(!(f!=C.charAt(0)||h!=C.charAt(1))){for(var V=2;m!=C.charAt(V)&&(h!=C.charAt(V)||f!=C.charAt(V+1));)++V;if(V+=2,m===C.charAt(V-1))return I("End of comment missing");var z=C.slice(2,V-2);return N+=2,q(z),C=C.slice(V),N+=2,ae({type:g,comment:z})}}function se(){var ae=H(),V=Q(r);if(V){if(ne(),!Q(i))return I("property missing ':'");var z=Q(s),Y=ae({type:b,property:k(V[0].replace(t,m)),value:z?k(z[0].replace(t,m)):m});return Q(l),Y}}function be(){var ae=[];oe(ae);for(var V;V=se();)V!==!1&&(ae.push(V),oe(ae));return ae}return W(),be()}function k(C){return C?C.replace(c,m):m}return t0=v,t0}var FC;function KL(){if(FC)return ia;FC=1;var t=ia&&ia.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ia,"__esModule",{value:!0}),ia.default=n;const e=t(qL());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(u=>{if(u.type!=="declaration")return;const{property:f,value:h}=u;c?i(f,h,u):h&&(s=s||{},s[f]=h)}),s}return ia}var Xc={},qC;function YL(){if(qC)return Xc;qC=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(f){return!f||n.test(f)||t.test(f)},l=function(f,h){return h.toUpperCase()},c=function(f,h){return"".concat(h,"-")},u=function(f,h){return h===void 0&&(h={}),s(f)?f:(f=f.toLowerCase(),h.reactCompat?f=f.replace(i,c):f=f.replace(r,c),f.replace(e,l))};return Xc.camelCase=u,Xc}var Qc,KC;function WL(){if(KC)return Qc;KC=1;var t=Qc&&Qc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(KL()),n=YL();function r(i,s){var l={};return!i||typeof i!="string"||(0,e.default)(i,function(c,u){c&&u&&(l[(0,n.camelCase)(c,s)]=u)}),l}return r.default=r,Qc=r,Qc}var GL=WL();const ZL=Xp(GL),HM=VM("end"),$x=VM("start");function VM(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 JL(t){const e=$x(t),n=HM(t);if(e&&n)return{start:e,end:n}}function uu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?YC(t.position):"start"in t||"end"in t?YC(t):"line"in t||"column"in t?gb(t):""}function gb(t){return WC(t&&t.line)+":"+WC(t&&t.column)}function YC(t){return gb(t&&t.start)+"-"+gb(t&&t.end)}function WC(t){return t&&typeof t=="number"?t:1}class zn 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 u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.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=uu(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}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const Fx={}.hasOwnProperty,XL=new Map,QL=/[A-Z]/g,e3=new Set(["table","tbody","thead","tfoot","tr"]),t3=new Set(["td","th"]),PM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function n3(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=u3(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=c3(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"?Px:$L,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=$M(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function $M(t,e,n){if(e.type==="element")return r3(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return i3(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return o3(t,e,n);if(e.type==="mdxjsEsm")return s3(t,e);if(e.type==="root")return l3(t,e,n);if(e.type==="text")return a3(t,e)}function r3(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Px,t.schema=i),t.ancestors.push(e);const s=qM(t,e.tagName,!1),l=d3(t,e);let c=Kx(t,e);return e3.has(e.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!NL(u):!0})),FM(t,l,s,e),qx(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function i3(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)}Ru(t,e.position)}function s3(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Ru(t,e.position)}function o3(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Px,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:qM(t,e.name,!0),l=f3(t,e),c=Kx(t,e);return FM(t,l,s,e),qx(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function l3(t,e,n){const r={};return qx(r,Kx(t,e)),t.create(e,t.Fragment,r,n)}function a3(t,e){return e.value}function FM(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function qx(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function c3(t,e,n){return r;function r(i,s,l,c){const f=Array.isArray(l.children)?n:e;return c?f(s,l,c):f(s,l)}}function u3(t,e){return n;function n(r,i,s,l){const c=Array.isArray(s.children),u=$x(r);return e(i,s,l,c,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function d3(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Fx.call(e.properties,i)){const s=h3(t,i,e.properties[i]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&t3.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 f3(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 Ru(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 Ru(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Kx(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:XL;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const f=i.get(u)||0;l=u+"-"+f,i.set(u,f+1)}}const c=$M(t,s,l);c!==void 0&&n.push(c)}return n}function h3(t,e,n){const r=HL(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ML(n):FL(n)),r.property==="style"){let i=typeof n=="object"?n:p3(t,String(n));return t.stylePropertyNameCase==="css"&&(i=m3(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?IL[r.property]||r.property:r.attribute,n]}}function p3(t,e){try{return ZL(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new zn("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=PM+"#cannot-parse-style-attribute",i}}function qM(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=UC(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=UC(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Fx.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Ru(t)}function Ru(t,e){const n=new zn("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=PM+"#cannot-handle-mdx-estrees-without-createevaluater",n}function m3(t){const e={};let n;for(n in t)Fx.call(t,n)&&(e[g3(n)]=t[n]);return e}function g3(t){let e=t.replace(QL,y3);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function y3(t){return"-"+t.toLowerCase()}const n0={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"]},b3={};function x3(t,e){const n=b3,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return KM(t,r,i)}function KM(t,e,n){if(v3(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 GC(t.children,e,n)}return Array.isArray(t)?GC(t,e,n):""}function GC(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=KM(t[i],e,n);return r.join("")}function v3(t){return!!(t&&typeof t=="object")}const ZC=document.createElement("i");function Yx(t){const e="&"+t+";";ZC.innerHTML=e;const n=ZC.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ci(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 Ur(t,e){return t.length>0?(Ci(t,t.length,0,e),t):e}const JC={}.hasOwnProperty;function S3(t){const e={};let n=-1;for(;++n<t.length;)w3(e,t[n]);return e}function w3(t,e){let n;for(n in e){const i=(JC.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){JC.call(i,l)||(i[l]=[]);const c=s[l];k3(i[l],Array.isArray(c)?c:c?[c]:[])}}}function k3(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ci(t,0,0,r)}function YM(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 ba(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bi=mo(/[A-Za-z]/),vr=mo(/[\dA-Za-z]/),C3=mo(/[#-'*+\--9=?A-Z^-~]/);function yb(t){return t!==null&&(t<32||t===127)}const bb=mo(/\d/),E3=mo(/[\dA-Fa-f]/),T3=mo(/[!-/:-@[-`{-~]/);function ze(t){return t!==null&&t<-2}function nr(t){return t!==null&&(t<0||t===32)}function lt(t){return t===-2||t===-1||t===32}const A3=mo(new RegExp("\\p{P}|\\p{S}","u")),M3=mo(/\s/);function mo(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Wa(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&vr(t.charCodeAt(n+1))&&vr(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 St(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(u){return lt(u)?(t.enter(n),c(u)):e(u)}function c(u){return lt(u)&&s++<i?(t.consume(u),c):(t.exit(n),e(u))}}const O3={tokenize:_3};function _3(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"),St(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const u=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return ze(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const D3={tokenize:R3},XC={tokenize:N3};function R3(t){const e=this,n=[];let r=0,i,s,l;return c;function c(N){if(r<n.length){const q=n[r];return e.containerState=q[1],t.attempt(q[0].continuation,u,f)(N)}return f(N)}function u(N){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&j();const q=e.events.length;let H=q,R;for(;H--;)if(e.events[H][0]==="exit"&&e.events[H][1].type==="chunkFlow"){R=e.events[H][1].end;break}E(r);let I=q;for(;I<e.events.length;)e.events[I][1].end={...R},I++;return Ci(e.events,H+1,0,e.events.slice(q)),e.events.length=I,f(N)}return c(N)}function f(N){if(r===n.length){if(!i)return g(N);if(i.currentConstruct&&i.currentConstruct.concrete)return v(N);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(XC,h,m)(N)}function h(N){return i&&j(),E(r),g(N)}function m(N){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,v(N)}function g(N){return e.containerState={},t.attempt(XC,b,v)(N)}function b(N){return r++,n.push([e.currentConstruct,e.containerState]),g(N)}function v(N){if(N===null){i&&j(),E(0),t.consume(N);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),k(N)}function k(N){if(N===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(N);return}return ze(N)?(t.consume(N),C(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(N),k)}function C(N,q){const H=e.sliceStream(N);if(q&&H.push(null),N.previous=s,s&&(s.next=N),s=N,i.defineSkip(N.start),i.write(H),e.parser.lazy[N.start.line]){let R=i.events.length;for(;R--;)if(i.events[R][1].start.offset<l&&(!i.events[R][1].end||i.events[R][1].end.offset>l))return;const I=e.events.length;let Q=I,W,oe;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(W){oe=e.events[Q][1].end;break}W=!0}for(E(r),R=I;R<e.events.length;)e.events[R][1].end={...oe},R++;Ci(e.events,Q+1,0,e.events.slice(I)),e.events.length=R}}function E(N){let q=n.length;for(;q-- >N;){const H=n[q];e.containerState=H[1],H[0].exit.call(e,t)}n.length=N}function j(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function N3(t,e,n){return St(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function QC(t){if(t===null||nr(t)||M3(t))return 1;if(A3(t))return 2}function Wx(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 xb={name:"attention",resolveAll:z3,tokenize:L3};function z3(t,e){let n=-1,r,i,s,l,c,u,f,h;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;u=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};eE(m,-u),eE(g,u),l={type:u>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},f=[],t[r][1].end.offset-t[r][1].start.offset&&(f=Ur(f,[["enter",t[r][1],e],["exit",t[r][1],e]])),f=Ur(f,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",s,e]]),f=Ur(f,Wx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),f=Ur(f,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,f=Ur(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Ci(t,r-1,n-r+3,f),n=r+f.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function L3(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=QC(r);let s;return l;function l(u){return s=u,t.enter("attentionSequence"),c(u)}function c(u){if(u===s)return t.consume(u),c;const f=t.exit("attentionSequence"),h=QC(u),m=!h||h===2&&i||n.includes(u),g=!i||i===2&&h||n.includes(r);return f._open=!!(s===42?m:m&&(i||!g)),f._close=!!(s===42?g:g&&(h||!m)),e(u)}}function eE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const j3={name:"autolink",tokenize:I3};function I3(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 bi(b)?(t.consume(b),l):b===64?n(b):f(b)}function l(b){return b===43||b===45||b===46||vr(b)?(r=1,c(b)):f(b)}function c(b){return b===58?(t.consume(b),r=0,u):(b===43||b===45||b===46||vr(b))&&r++<32?(t.consume(b),c):(r=0,f(b))}function u(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||yb(b)?n(b):(t.consume(b),u)}function f(b){return b===64?(t.consume(b),h):C3(b)?(t.consume(b),f):n(b)}function h(b){return vr(b)?m(b):n(b)}function m(b){return b===46?(t.consume(b),r=0,h):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||vr(b))&&r++<63){const v=b===45?g:m;return t.consume(b),v}return n(b)}}const Qp={partial:!0,tokenize:B3};function B3(t,e,n){return r;function r(s){return lt(s)?St(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||ze(s)?e(s):n(s)}}const WM={continuation:{tokenize:H3},exit:V3,name:"blockQuote",tokenize:U3};function U3(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 lt(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function H3(t,e,n){const r=this;return i;function i(l){return lt(l)?St(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt(WM,e,n)(l)}}function V3(t){t.exit("blockQuote")}const GM={name:"characterEscape",tokenize:P3};function P3(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 T3(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const ZM={name:"characterReference",tokenize:$3};function $3(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"),u}function u(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),s=31,l=vr,h(m))}function f(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=E3,h):(t.enter("characterReferenceValue"),s=7,l=bb,h(m))}function h(m){if(m===59&&i){const g=t.exit("characterReferenceValue");return l===vr&&!Yx(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),h):n(m)}}const tE={partial:!0,tokenize:q3},nE={concrete:!0,name:"codeFenced",tokenize:F3};function F3(t,e,n){const r=this,i={partial:!0,tokenize:H};let s=0,l=0,c;return u;function u(R){return f(R)}function f(R){const I=r.events[r.events.length-1];return s=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,c=R,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===c?(l++,t.consume(R),h):l<3?n(R):(t.exit("codeFencedFenceSequence"),lt(R)?St(t,m,"whitespace")(R):m(R))}function m(R){return R===null||ze(R)?(t.exit("codeFencedFence"),r.interrupt?e(R):t.check(tE,k,q)(R)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(R))}function g(R){return R===null||ze(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(R)):lt(R)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),St(t,b,"whitespace")(R)):R===96&&R===c?n(R):(t.consume(R),g)}function b(R){return R===null||ze(R)?m(R):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===null||ze(R)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(R)):R===96&&R===c?n(R):(t.consume(R),v)}function k(R){return t.attempt(i,q,C)(R)}function C(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),E}function E(R){return s>0&&lt(R)?St(t,j,"linePrefix",s+1)(R):j(R)}function j(R){return R===null||ze(R)?t.check(tE,k,q)(R):(t.enter("codeFlowValue"),N(R))}function N(R){return R===null||ze(R)?(t.exit("codeFlowValue"),j(R)):(t.consume(R),N)}function q(R){return t.exit("codeFenced"),e(R)}function H(R,I,Q){let W=0;return oe;function oe(V){return R.enter("lineEnding"),R.consume(V),R.exit("lineEnding"),ne}function ne(V){return R.enter("codeFencedFence"),lt(V)?St(R,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):se(V)}function se(V){return V===c?(R.enter("codeFencedFenceSequence"),be(V)):Q(V)}function be(V){return V===c?(W++,R.consume(V),be):W>=l?(R.exit("codeFencedFenceSequence"),lt(V)?St(R,ae,"whitespace")(V):ae(V)):Q(V)}function ae(V){return V===null||ze(V)?(R.exit("codeFencedFence"),I(V)):Q(V)}}}function q3(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 r0={name:"codeIndented",tokenize:Y3},K3={partial:!0,tokenize:W3};function Y3(t,e,n){const r=this;return i;function i(f){return t.enter("codeIndented"),St(t,s,"linePrefix",5)(f)}function s(f){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?u(f):ze(f)?t.attempt(K3,l,u)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||ze(f)?(t.exit("codeFlowValue"),l(f)):(t.consume(f),c)}function u(f){return t.exit("codeIndented"),e(f)}}function W3(t,e,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):St(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):ze(l)?i(l):n(l)}}const G3={name:"codeText",previous:J3,resolve:Z3,tokenize:X3};function Z3(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 J3(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function X3(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"),u(m))}function u(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),u):m===96?(s=t.enter("codeTextSequence"),i=0,h(m)):ze(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||ze(m)?(t.exit("codeTextData"),u(m)):(t.consume(m),f)}function h(m){return m===96?(t.consume(m),i++,h):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",f(m))}}class Q3{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&&eu(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),eu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eu(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);eu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);eu(this.left,n.reverse())}}}function eu(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 JM(t){const e={};let n=-1,r,i,s,l,c,u,f;const h=new Q3(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,e4(h,n)),n=e[n],f=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=h.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(h.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={...h.get(i)[1].start},c=h.slice(i,n),c.unshift(r),h.splice(i,n-i+1,c))}}return Ci(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!f}function e4(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,u=[],f={};let h,m,g=-1,b=n,v=0,k=0;const C=[k];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(h=r.sliceStream(b),b.next||h.push(null),m&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),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&&(k=g+1,C.push(k),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 E=c.slice(C[g],C[g+1]),j=s.pop();u.push([j,j+E.length-1]),t.splice(j,2,E)}for(u.reverse(),g=-1;++g<u.length;)f[v+u[g][0]]=v+u[g][1],v+=u[g][1]-u[g][0]-1;return f}const t4={resolve:r4,tokenize:i4},n4={partial:!0,tokenize:s4};function r4(t){return JM(t),t}function i4(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):ze(c)?t.check(n4,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 s4(t,e,n){const r=this;return i;function i(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),St(t,s,"linePrefix")}function s(l){if(l===null||ze(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 XM(t,e,n,r,i,s,l,c,u){const f=u||Number.POSITIVE_INFINITY;let h=0;return m;function m(E){return E===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(E),t.exit(s),g):E===null||E===32||E===41||yb(E)?n(E):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(E))}function g(E){return E===62?(t.enter(s),t.consume(E),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===62?(t.exit("chunkString"),t.exit(c),g(E)):E===null||E===60||ze(E)?n(E):(t.consume(E),E===92?v:b)}function v(E){return E===60||E===62||E===92?(t.consume(E),b):b(E)}function k(E){return!h&&(E===null||E===41||nr(E))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(E)):h<f&&E===40?(t.consume(E),h++,k):E===41?(t.consume(E),h--,k):E===null||E===32||E===40||yb(E)?n(E):(t.consume(E),E===92?C:k)}function C(E){return E===40||E===41||E===92?(t.consume(E),k):k(E)}}function QM(t,e,n,r,i,s){const l=this;let c=0,u;return f;function f(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),h}function h(b){return c>999||b===null||b===91||b===93&&!u||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):ze(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||ze(b)||c++>999?(t.exit("chunkString"),h(b)):(t.consume(b),u||(u=!lt(b)),b===92?g:m)}function g(b){return b===91||b===92||b===93?(t.consume(b),c++,m):m(b)}}function eO(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,u):n(g)}function u(g){return g===l?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),f(g))}function f(g){return g===l?(t.exit(s),u(l)):g===null?n(g):ze(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),St(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===l||g===null||ze(g)?(t.exit("chunkString"),f(g)):(t.consume(g),g===92?m:h)}function m(g){return g===l||g===92?(t.consume(g),h):h(g)}}function du(t,e){let n;return r;function r(i){return ze(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):lt(i)?St(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const o4={name:"definition",tokenize:a4},l4={partial:!0,tokenize:c4};function a4(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),l(b)}function l(b){return QM.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function c(b){return i=ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),u):n(b)}function u(b){return nr(b)?du(t,f)(b):f(b)}function f(b){return XM(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return t.attempt(l4,m,m)(b)}function m(b){return lt(b)?St(t,g,"whitespace")(b):g(b)}function g(b){return b===null||ze(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function c4(t,e,n){return r;function r(c){return nr(c)?du(t,i)(c):n(c)}function i(c){return eO(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return lt(c)?St(t,l,"whitespace")(c):l(c)}function l(c){return c===null||ze(c)?e(c):n(c)}}const u4={name:"hardBreakEscape",tokenize:d4};function d4(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return ze(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const f4={name:"headingAtx",resolve:h4,tokenize:p4};function h4(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"},Ci(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function p4(t,e,n){let r=0;return i;function i(h){return t.enter("atxHeading"),s(h)}function s(h){return t.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&r++<6?(t.consume(h),l):h===null||nr(h)?(t.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(t.enter("atxHeadingSequence"),u(h)):h===null||ze(h)?(t.exit("atxHeading"),e(h)):lt(h)?St(t,c,"whitespace")(h):(t.enter("atxHeadingText"),f(h))}function u(h){return h===35?(t.consume(h),u):(t.exit("atxHeadingSequence"),c(h))}function f(h){return h===null||h===35||nr(h)?(t.exit("atxHeadingText"),c(h)):(t.consume(h),f)}}const m4=["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"],rE=["pre","script","style","textarea"],g4={concrete:!0,name:"htmlFlow",resolveTo:x4,tokenize:v4},y4={partial:!0,tokenize:w4},b4={partial:!0,tokenize:S4};function x4(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 v4(t,e,n){const r=this;let i,s,l,c,u;return f;function f(A){return h(A)}function h(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),m}function m(A){return A===33?(t.consume(A),g):A===47?(t.consume(A),s=!0,k):A===63?(t.consume(A),i=3,r.interrupt?e:O):bi(A)?(t.consume(A),l=String.fromCharCode(A),C):n(A)}function g(A){return A===45?(t.consume(A),i=2,b):A===91?(t.consume(A),i=5,c=0,v):bi(A)?(t.consume(A),i=4,r.interrupt?e:O):n(A)}function b(A){return A===45?(t.consume(A),r.interrupt?e:O):n(A)}function v(A){const re="CDATA[";return A===re.charCodeAt(c++)?(t.consume(A),c===re.length?r.interrupt?e:se:v):n(A)}function k(A){return bi(A)?(t.consume(A),l=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||nr(A)){const re=A===47,Z=l.toLowerCase();return!re&&!s&&rE.includes(Z)?(i=1,r.interrupt?e(A):se(A)):m4.includes(l.toLowerCase())?(i=6,re?(t.consume(A),E):r.interrupt?e(A):se(A)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):s?j(A):N(A))}return A===45||vr(A)?(t.consume(A),l+=String.fromCharCode(A),C):n(A)}function E(A){return A===62?(t.consume(A),r.interrupt?e:se):n(A)}function j(A){return lt(A)?(t.consume(A),j):oe(A)}function N(A){return A===47?(t.consume(A),oe):A===58||A===95||bi(A)?(t.consume(A),q):lt(A)?(t.consume(A),N):oe(A)}function q(A){return A===45||A===46||A===58||A===95||vr(A)?(t.consume(A),q):H(A)}function H(A){return A===61?(t.consume(A),R):lt(A)?(t.consume(A),H):N(A)}function R(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),u=A,I):lt(A)?(t.consume(A),R):Q(A)}function I(A){return A===u?(t.consume(A),u=null,W):A===null||ze(A)?n(A):(t.consume(A),I)}function Q(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||nr(A)?H(A):(t.consume(A),Q)}function W(A){return A===47||A===62||lt(A)?N(A):n(A)}function oe(A){return A===62?(t.consume(A),ne):n(A)}function ne(A){return A===null||ze(A)?se(A):lt(A)?(t.consume(A),ne):n(A)}function se(A){return A===45&&i===2?(t.consume(A),z):A===60&&i===1?(t.consume(A),Y):A===62&&i===4?(t.consume(A),_):A===63&&i===3?(t.consume(A),O):A===93&&i===5?(t.consume(A),_e):ze(A)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(y4,B,be)(A)):A===null||ze(A)?(t.exit("htmlFlowData"),be(A)):(t.consume(A),se)}function be(A){return t.check(b4,ae,B)(A)}function ae(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),V}function V(A){return A===null||ze(A)?be(A):(t.enter("htmlFlowData"),se(A))}function z(A){return A===45?(t.consume(A),O):se(A)}function Y(A){return A===47?(t.consume(A),l="",pe):se(A)}function pe(A){if(A===62){const re=l.toLowerCase();return rE.includes(re)?(t.consume(A),_):se(A)}return bi(A)&&l.length<8?(t.consume(A),l+=String.fromCharCode(A),pe):se(A)}function _e(A){return A===93?(t.consume(A),O):se(A)}function O(A){return A===62?(t.consume(A),_):A===45&&i===2?(t.consume(A),O):se(A)}function _(A){return A===null||ze(A)?(t.exit("htmlFlowData"),B(A)):(t.consume(A),_)}function B(A){return t.exit("htmlFlow"),e(A)}}function S4(t,e,n){const r=this;return i;function i(l){return ze(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 w4(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Qp,e,n)}}const k4={name:"htmlText",tokenize:C4};function C4(t,e,n){const r=this;let i,s,l;return c;function c(O){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(O),u}function u(O){return O===33?(t.consume(O),f):O===47?(t.consume(O),H):O===63?(t.consume(O),N):bi(O)?(t.consume(O),Q):n(O)}function f(O){return O===45?(t.consume(O),h):O===91?(t.consume(O),s=0,v):bi(O)?(t.consume(O),j):n(O)}function h(O){return O===45?(t.consume(O),b):n(O)}function m(O){return O===null?n(O):O===45?(t.consume(O),g):ze(O)?(l=m,Y(O)):(t.consume(O),m)}function g(O){return O===45?(t.consume(O),b):m(O)}function b(O){return O===62?z(O):O===45?g(O):m(O)}function v(O){const _="CDATA[";return O===_.charCodeAt(s++)?(t.consume(O),s===_.length?k:v):n(O)}function k(O){return O===null?n(O):O===93?(t.consume(O),C):ze(O)?(l=k,Y(O)):(t.consume(O),k)}function C(O){return O===93?(t.consume(O),E):k(O)}function E(O){return O===62?z(O):O===93?(t.consume(O),E):k(O)}function j(O){return O===null||O===62?z(O):ze(O)?(l=j,Y(O)):(t.consume(O),j)}function N(O){return O===null?n(O):O===63?(t.consume(O),q):ze(O)?(l=N,Y(O)):(t.consume(O),N)}function q(O){return O===62?z(O):N(O)}function H(O){return bi(O)?(t.consume(O),R):n(O)}function R(O){return O===45||vr(O)?(t.consume(O),R):I(O)}function I(O){return ze(O)?(l=I,Y(O)):lt(O)?(t.consume(O),I):z(O)}function Q(O){return O===45||vr(O)?(t.consume(O),Q):O===47||O===62||nr(O)?W(O):n(O)}function W(O){return O===47?(t.consume(O),z):O===58||O===95||bi(O)?(t.consume(O),oe):ze(O)?(l=W,Y(O)):lt(O)?(t.consume(O),W):z(O)}function oe(O){return O===45||O===46||O===58||O===95||vr(O)?(t.consume(O),oe):ne(O)}function ne(O){return O===61?(t.consume(O),se):ze(O)?(l=ne,Y(O)):lt(O)?(t.consume(O),ne):W(O)}function se(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(t.consume(O),i=O,be):ze(O)?(l=se,Y(O)):lt(O)?(t.consume(O),se):(t.consume(O),ae)}function be(O){return O===i?(t.consume(O),i=void 0,V):O===null?n(O):ze(O)?(l=be,Y(O)):(t.consume(O),be)}function ae(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||nr(O)?W(O):(t.consume(O),ae)}function V(O){return O===47||O===62||nr(O)?W(O):n(O)}function z(O){return O===62?(t.consume(O),t.exit("htmlTextData"),t.exit("htmlText"),e):n(O)}function Y(O){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),pe}function pe(O){return lt(O)?St(t,_e,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):_e(O)}function _e(O){return t.enter("htmlTextData"),l(O)}}const Gx={name:"labelEnd",resolveAll:M4,resolveTo:O4,tokenize:_4},E4={tokenize:D4},T4={tokenize:R4},A4={tokenize:N4};function M4(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&&Ci(t,0,t.length,n),t}function O4(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 u={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},h={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",u,e],["enter",f,e]],c=Ur(c,t.slice(s+1,s+r+3)),c=Ur(c,[["enter",h,e]]),c=Ur(c,Wx(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=Ur(c,[["exit",h,e],t[l-2],t[l-1],["exit",f,e]]),c=Ur(c,t.slice(l+1)),c=Ur(c,[["exit",u,e]]),Ci(t,s,t.length,c),t}function _4(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(ba(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),u):n(g)}function u(g){return g===40?t.attempt(E4,h,l?h:m)(g):g===91?t.attempt(T4,h,l?f:m)(g):l?h(g):m(g)}function f(g){return t.attempt(A4,h,m)(g)}function h(g){return e(g)}function m(g){return s._balanced=!0,n(g)}}function D4(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 nr(m)?du(t,s)(m):s(m)}function s(m){return m===41?h(m):XM(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return nr(m)?du(t,u)(m):h(m)}function c(m){return n(m)}function u(m){return m===34||m===39||m===40?eO(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function f(m){return nr(m)?du(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function R4(t,e,n){const r=this;return i;function i(c){return QM.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function N4(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 z4={name:"labelStartImage",resolveAll:Gx.resolveAll,tokenize:L4};function L4(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 j4={name:"labelStartLink",resolveAll:Gx.resolveAll,tokenize:I4};function I4(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 i0={name:"lineEnding",tokenize:B4};function B4(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),St(t,e,"linePrefix")}}const bh={name:"thematicBreak",tokenize:U4};function U4(t,e,n){let r=0,i;return s;function s(f){return t.enter("thematicBreak"),l(f)}function l(f){return i=f,c(f)}function c(f){return f===i?(t.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||ze(f))?(t.exit("thematicBreak"),e(f)):n(f)}function u(f){return f===i?(t.consume(f),r++,u):(t.exit("thematicBreakSequence"),lt(f)?St(t,c,"whitespace")(f):c(f))}}const Qn={continuation:{tokenize:$4},exit:q4,name:"list",tokenize:P4},H4={partial:!0,tokenize:K4},V4={partial:!0,tokenize:F4};function P4(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 v=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:bb(b)){if(r.containerState.type||(r.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(bh,n,f)(b):f(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(b)}return n(b)}function u(b){return bb(b)&&++l<10?(t.consume(b),u):(!r.interrupt||l<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),f(b)):n(b)}function f(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(Qp,r.interrupt?n:h,t.attempt(H4,g,m))}function h(b){return r.containerState.initialBlankLine=!0,s++,g(b)}function m(b){return lt(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 $4(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Qp,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,St(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!lt(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(V4,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,St(t,t.attempt(Qn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function F4(t,e,n){const r=this;return St(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 q4(t){t.exit(this.containerState.type)}function K4(t,e,n){const r=this;return St(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!lt(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const iE={name:"setextUnderline",resolveTo:Y4,tokenize:W4};function Y4(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 W4(t,e,n){const r=this;let i;return s;function s(f){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),i=f,l(f)):n(f)}function l(f){return t.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===i?(t.consume(f),c):(t.exit("setextHeadingLineSequence"),lt(f)?St(t,u,"lineSuffix")(f):u(f))}function u(f){return f===null||ze(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const G4={tokenize:Z4};function Z4(t){const e=this,n=t.attempt(Qp,r,t.attempt(this.parser.constructs.flowInitial,i,St(t,t.attempt(this.parser.constructs.flow,i,t.attempt(t4,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 J4={resolveAll:nO()},X4=tO("string"),Q4=tO("text");function tO(t){return{resolveAll:nO(t==="text"?ej: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(h){return f(h)?s(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return f(h)?(n.exit("data"),s(h)):(n.consume(h),u)}function f(h){if(h===null)return!0;const m=i[h];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 nO(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 ej(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,u;for(;s--;){const f=i[s];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)u=!0,c++;else if(f!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const f={type:n===t.length||u||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={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(t.splice(n,0,["enter",f,e],["exit",f,e]),n+=2)}n++}return t}const tj={42:Qn,43:Qn,45:Qn,48:Qn,49:Qn,50:Qn,51:Qn,52:Qn,53:Qn,54:Qn,55:Qn,56:Qn,57:Qn,62:WM},nj={91:o4},rj={[-2]:r0,[-1]:r0,32:r0},ij={35:f4,42:bh,45:[iE,bh],60:g4,61:iE,95:bh,96:nE,126:nE},sj={38:ZM,92:GM},oj={[-5]:i0,[-4]:i0,[-3]:i0,33:z4,38:ZM,42:xb,60:[j3,k4],91:j4,92:[u4,GM],93:Gx,95:xb,96:G3},lj={null:[xb,J4]},aj={null:[42,95]},cj={null:[]},uj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:aj,contentInitial:nj,disable:cj,document:tj,flow:ij,flowInitial:rj,insideSpan:lj,string:sj,text:oj},Symbol.toStringTag,{value:"Module"}));function dj(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 u={attempt:I(H),check:I(R),consume:j,enter:N,exit:q,interrupt:I(R,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:t,previous:null,sliceSerialize:g,sliceStream:b,write:m};let h=e.tokenize.call(f,u);return e.resolveAll&&s.push(e),f;function m(ne){return l=Ur(l,ne),C(),l[l.length-1]!==null?[]:(Q(e,0),f.events=Wx(s,f.events,f),f.events)}function g(ne,se){return hj(b(ne),se)}function b(ne){return fj(l,ne)}function v(){const{_bufferIndex:ne,_index:se,line:be,column:ae,offset:V}=r;return{_bufferIndex:ne,_index:se,line:be,column:ae,offset:V}}function k(ne){i[ne.line]=ne.column,oe()}function C(){let ne;for(;r._index<l.length;){const se=l[r._index];if(typeof se=="string")for(ne=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ne&&r._bufferIndex<se.length;)E(se.charCodeAt(r._bufferIndex));else E(se)}}function E(ne){h=h(ne)}function j(ne){ze(ne)?(r.line++,r.column=1,r.offset+=ne===-3?2:1,oe()):ne!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=ne}function N(ne,se){const be=se||{};return be.type=ne,be.start=v(),f.events.push(["enter",be,f]),c.push(be),be}function q(ne){const se=c.pop();return se.end=v(),f.events.push(["exit",se,f]),se}function H(ne,se){Q(ne,se.from)}function R(ne,se){se.restore()}function I(ne,se){return be;function be(ae,V,z){let Y,pe,_e,O;return Array.isArray(ae)?B(ae):"tokenize"in ae?B([ae]):_(ae);function _(ie){return me;function me(Ae){const ge=Ae!==null&&ie[Ae],Le=Ae!==null&&ie.null,ke=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return B(ke)(Ae)}}function B(ie){return Y=ie,pe=0,ie.length===0?z:A(ie[pe])}function A(ie){return me;function me(Ae){return O=W(),_e=ie,ie.partial||(f.currentConstruct=ie),ie.name&&f.parser.constructs.disable.null.includes(ie.name)?Z():ie.tokenize.call(se?Object.assign(Object.create(f),se):f,u,re,Z)(Ae)}}function re(ie){return ne(_e,O),V}function Z(ie){return O.restore(),++pe<Y.length?A(Y[pe]):z}}}function Q(ne,se){ne.resolveAll&&!s.includes(ne)&&s.push(ne),ne.resolve&&Ci(f.events,se,f.events.length-se,ne.resolve(f.events.slice(se),f)),ne.resolveTo&&(f.events=ne.resolveTo(f.events,f))}function W(){const ne=v(),se=f.previous,be=f.currentConstruct,ae=f.events.length,V=Array.from(c);return{from:ae,restore:z};function z(){r=ne,f.previous=se,f.currentConstruct=be,f.events.length=ae,c=V,oe()}}function oe(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function fj(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 hj(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=`
52
+ `;break}case-3:{l=`\r
53
+ `;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 pj(t){const r={constructs:S3([uj,...(t||{}).extensions||[]]),content:i(O3),defined:[],document:i(D3),flow:i(G4),lazy:{},string:i(X4),text:i(Q4)};return r;function i(s){return l;function l(c){return dj(r,s,c)}}}function mj(t){for(;!JM(t););return t}const sE=/[\0\t\n\r]/g;function gj(){let t=1,e="",n=!0,r;return i;function i(s,l,c){const u=[];let f,h,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(sE.lastIndex=m,f=sE.exec(s),g=f&&f.index!==void 0?f.index:s.length,b=s.charCodeAt(g),!f){e=s.slice(m);break}if(b===10&&m===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),m<g&&(u.push(s.slice(m,g)),t+=g-m),b){case 0:{u.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,u.push(-2);t++<h;)u.push(-1);break}case 10:{u.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return c&&(r&&u.push(-5),e&&u.push(e),u.push(null)),u}}const yj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bj(t){return t.replace(yj,xj)}function xj(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return YM(n.slice(s?2:1),s?16:10)}return Yx(n)||t}const rO={}.hasOwnProperty;function vj(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),Sj(n)(mj(pj(n).document().write(gj()(t,e,!0))))}function Sj(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(or),autolinkProtocol:W,autolinkEmail:W,atxHeading:s(jn),blockQuote:s(Le),characterEscape:W,characterReference:W,codeFenced:s(ke),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(ke,l),codeText:s(xt,l),codeTextData:W,data:W,codeFlowValue:W,definition:s(Ot),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(pt),hardBreakEscape:s(kr),hardBreakTrailing:s(kr),htmlFlow:s(In,l),htmlFlowData:W,htmlText:s(In,l),htmlTextData:W,image:s(hs),label:l,link:s(or),listItem:s(lr),listItemValue:g,listOrdered:s(ai,m),listUnordered:s(ai),paragraph:s(xl),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(jn),strong:s(xo),thematicBreak:s(ps)},exit:{atxHeading:u(),atxHeadingSequence:H,autolink:u(),autolinkEmail:ge,autolinkProtocol:Ae,blockQuote:u(),characterEscapeValue:oe,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ie,characterReference:me,codeFenced:u(C),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:v,codeFlowValue:oe,codeIndented:u(E),codeText:u(V),codeTextData:oe,data:oe,definition:u(),definitionDestinationString:q,definitionLabelString:j,definitionTitleString:N,emphasis:u(),hardBreakEscape:u(se),hardBreakTrailing:u(se),htmlFlow:u(be),htmlFlowData:oe,htmlText:u(ae),htmlTextData:oe,image:u(Y),label:_e,labelText:pe,lineEnding:ne,link:u(z),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:re,resourceDestinationString:O,resourceTitleString:_,resource:B,setextHeading:u(Q),setextHeadingLineSequence:I,setextHeadingText:R,strong:u(),thematicBreak:u()}};iO(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(J){let fe={type:"root",children:[]};const De={stack:[fe],tokenStack:[],config:e,enter:c,exit:f,buffer:l,resume:h,data:n},ce=[];let tt=-1;for(;++tt<J.length;)if(J[tt][1].type==="listOrdered"||J[tt][1].type==="listUnordered")if(J[tt][0]==="enter")ce.push(tt);else{const Bn=ce.pop();tt=i(J,Bn,tt)}for(tt=-1;++tt<J.length;){const Bn=e[J[tt][0]];rO.call(Bn,J[tt][1].type)&&Bn[J[tt][1].type].call(Object.assign({sliceSerialize:J[tt][2].sliceSerialize},De),J[tt][1])}if(De.tokenStack.length>0){const Bn=De.tokenStack[De.tokenStack.length-1];(Bn[1]||oE).call(De,void 0,Bn[0])}for(fe.position={start:Hs(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:Hs(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<e.transforms.length;)fe=e.transforms[tt](fe)||fe;return fe}function i(J,fe,De){let ce=fe-1,tt=-1,Bn=!1,Wr,mn,Bt,Xt;for(;++ce<=De;){const nt=J[ce];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?tt++:tt--,Xt=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(Wr&&!Xt&&!tt&&!Bt&&(Bt=ce),Xt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xt=void 0}if(!tt&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||tt===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(Wr){let ve=ce;for(mn=void 0;ve--;){const mt=J[ve];if(mt[1].type==="lineEnding"||mt[1].type==="lineEndingBlank"){if(mt[0]==="exit")continue;mn&&(J[mn][1].type="lineEndingBlank",Bn=!0),mt[1].type="lineEnding",mn=ve}else if(!(mt[1].type==="linePrefix"||mt[1].type==="blockQuotePrefix"||mt[1].type==="blockQuotePrefixWhitespace"||mt[1].type==="blockQuoteMarker"||mt[1].type==="listItemIndent"))break}Bt&&(!mn||Bt<mn)&&(Wr._spread=!0),Wr.end=Object.assign({},mn?J[mn][1].start:nt[1].end),J.splice(mn||ce,0,["exit",Wr,nt[2]]),ce++,De++}if(nt[1].type==="listItemPrefix"){const ve={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};Wr=ve,J.splice(ce,0,["enter",ve,nt[2]]),ce++,De++,Bt=void 0,Xt=!0}}}return J[fe][1]._spread=Bn,De}function s(J,fe){return De;function De(ce){c.call(this,J(ce),ce),fe&&fe.call(this,ce)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(J,fe,De){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([fe,De||void 0]),J.position={start:Hs(fe.start),end:void 0}}function u(J){return fe;function fe(De){J&&J.call(this,De),f.call(this,De)}}function f(J,fe){const De=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==J.type&&(fe?fe.call(this,J,ce[0]):(ce[1]||oE).call(this,J,ce[0]));else throw new Error("Cannot close `"+J.type+"` ("+uu({start:J.start,end:J.end})+"): it’s not open");De.position.end=Hs(J.end)}function h(){return x3(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(J){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function b(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=J}function v(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=J}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.value=J.replace(/(\r?\n|\r)$/g,"")}function j(J){const fe=this.resume(),De=this.stack[this.stack.length-1];De.label=fe,De.identifier=ba(this.sliceSerialize(J)).toLowerCase()}function N(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.title=J}function q(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.url=J}function H(J){const fe=this.stack[this.stack.length-1];if(!fe.depth){const De=this.sliceSerialize(J).length;fe.depth=De}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function I(J){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function Q(){this.data.setextHeadingSlurpLineEnding=void 0}function W(J){const De=this.stack[this.stack.length-1].children;let ce=De[De.length-1];(!ce||ce.type!=="text")&&(ce=Jt(),ce.position={start:Hs(J.start),end:void 0},De.push(ce)),this.stack.push(ce)}function oe(J){const fe=this.stack.pop();fe.value+=this.sliceSerialize(J),fe.position.end=Hs(J.end)}function ne(J){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=fe.children[fe.children.length-1];De.position.end=Hs(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(fe.type)&&(W.call(this,J),oe.call(this,J))}function se(){this.data.atHardBreak=!0}function be(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.value=J}function ae(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.value=J}function V(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.value=J}function z(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=fe,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function Y(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=fe,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function pe(J){const fe=this.sliceSerialize(J),De=this.stack[this.stack.length-2];De.label=bj(fe),De.identifier=ba(fe).toLowerCase()}function _e(){const J=this.stack[this.stack.length-1],fe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const ce=J.children;De.children=ce}else De.alt=fe}function O(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.url=J}function _(){const J=this.resume(),fe=this.stack[this.stack.length-1];fe.title=J}function B(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function re(J){const fe=this.resume(),De=this.stack[this.stack.length-1];De.label=fe,De.identifier=ba(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function Z(J){this.data.characterReferenceType=J.type}function ie(J){const fe=this.sliceSerialize(J),De=this.data.characterReferenceType;let ce;De?(ce=YM(fe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=Yx(fe);const tt=this.stack[this.stack.length-1];tt.value+=ce}function me(J){const fe=this.stack.pop();fe.position.end=Hs(J.end)}function Ae(J){oe.call(this,J);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(J)}function ge(J){oe.call(this,J);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(J)}function Le(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function xt(){return{type:"inlineCode",value:""}}function Ot(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pt(){return{type:"emphasis",children:[]}}function jn(){return{type:"heading",depth:0,children:[]}}function kr(){return{type:"break"}}function In(){return{type:"html",value:""}}function hs(){return{type:"image",title:null,url:"",alt:null}}function or(){return{type:"link",title:null,url:"",children:[]}}function ai(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function lr(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function xl(){return{type:"paragraph",children:[]}}function xo(){return{type:"strong",children:[]}}function Jt(){return{type:"text",value:""}}function ps(){return{type:"thematicBreak"}}}function Hs(t){return{line:t.line,column:t.column,offset:t.offset}}function iO(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?iO(t,r):wj(t,r)}}function wj(t,e){let n;for(n in e)if(rO.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 oE(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+uu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+uu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+uu({start:e.start,end:e.end})+") is still open")}function kj(t){const e=this;e.parser=n;function n(r){return vj(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Cj(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 Ej(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
54
+ `}]}function Tj(t,e){const n=e.value?e.value+`
55
+ `:"",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 Aj(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Mj(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Oj(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Wa(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 u={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,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,f),t.applyData(e,f)}function _j(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 Dj(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function sO(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 Rj(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return sO(t,e);const i={src:Wa(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 Nj(t,e){const n={src:Wa(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 zj(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 Lj(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return sO(t,e);const i={href:Wa(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 jj(t,e){const n={href:Wa(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 Ij(t,e,n){const r=t.all(e),i=n?Bj(n):oO(e),s={},l=[];if(typeof e.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(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 h=r[c];(i||c!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
56
+ `}),h.type==="element"&&h.tagName==="p"&&!i?l.push(...h.children):l.push(h)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
57
+ `});const f={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,f),t.applyData(e,f)}function Bj(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=oO(n[r])}return e}function oO(t){const e=t.spread;return e??t.children.length>1}function Uj(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 Hj(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Vj(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Pj(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $j(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=$x(e.children[1]),u=HM(e.children[e.children.length-1]);c&&u&&(l.position={start:c,end:u}),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 Fj(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 u=-1;const f=[];for(;++u<c;){const m=e.children[u],g={},b=l?l[u]:void 0;b&&(g.align=b);let v={type:"element",tagName:s,properties:g,children:[]};m&&(v.children=t.all(m),t.patch(m,v),v=t.applyData(m,v)),f.push(v)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(e,h),t.applyData(e,h)}function qj(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const lE=9,aE=32;function Kj(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(cE(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(cE(e.slice(i),i>0,!1)),s.join("")}function cE(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===lE||s===aE;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===lE||s===aE;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Yj(t,e){const n={type:"text",value:Kj(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Wj(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Gj={blockquote:Cj,break:Ej,code:Tj,delete:Aj,emphasis:Mj,footnoteReference:Oj,heading:_j,html:Dj,imageReference:Rj,image:Nj,inlineCode:zj,linkReference:Lj,link:jj,listItem:Ij,list:Uj,paragraph:Hj,root:Vj,strong:Pj,table:$j,tableCell:qj,tableRow:Fj,text:Yj,thematicBreak:Wj,toml:Ff,yaml:Ff,definition:Ff,footnoteDefinition:Ff};function Ff(){}const lO=-1,em=0,fu=1,Ih=2,Zx=3,Jx=4,Xx=5,Qx=6,aO=7,cO=8,uE=typeof self=="object"?self:globalThis,Zj=(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 em:case lO:return n(l,i);case fu:{const c=n([],i);for(const u of l)c.push(r(u));return c}case Ih:{const c=n({},i);for(const[u,f]of l)c[r(u)]=r(f);return c}case Zx:return n(new Date(l),i);case Jx:{const{source:c,flags:u}=l;return n(new RegExp(c,u),i)}case Xx:{const c=n(new Map,i);for(const[u,f]of l)c.set(r(u),r(f));return c}case Qx:{const c=n(new Set,i);for(const u of l)c.add(r(u));return c}case aO:{const{name:c,message:u}=l;return n(new uE[c](u),i)}case cO: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 uE[s](l),i)};return r},dE=t=>Zj(new Map,t)(0),sa="",{toString:Jj}={},{keys:Xj}=Object,tu=t=>{const e=typeof t;if(e!=="object"||!t)return[em,e];const n=Jj.call(t).slice(8,-1);switch(n){case"Array":return[fu,sa];case"Object":return[Ih,sa];case"Date":return[Zx,sa];case"RegExp":return[Jx,sa];case"Map":return[Xx,sa];case"Set":return[Qx,sa];case"DataView":return[fu,n]}return n.includes("Array")?[fu,n]:n.includes("Error")?[aO,n]:[Ih,n]},qf=([t,e])=>t===em&&(e==="function"||e==="symbol"),Qj=(t,e,n,r)=>{const i=(l,c)=>{const u=r.push(l)-1;return n.set(c,u),u},s=l=>{if(n.has(l))return n.get(l);let[c,u]=tu(l);switch(c){case em:{let h=l;switch(u){case"bigint":c=cO,h=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([lO],l)}return i([c,h],l)}case fu:{if(u){let g=l;return u==="DataView"?g=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(l)),i([u,[...g]],l)}const h=[],m=i([c,h],l);for(const g of l)h.push(s(g));return m}case Ih:{if(u)switch(u){case"BigInt":return i([u,l.toString()],l);case"Boolean":case"Number":case"String":return i([u,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const h=[],m=i([c,h],l);for(const g of Xj(l))(t||!qf(tu(l[g])))&&h.push([s(g),s(l[g])]);return m}case Zx:return i([c,l.toISOString()],l);case Jx:{const{source:h,flags:m}=l;return i([c,{source:h,flags:m}],l)}case Xx:{const h=[],m=i([c,h],l);for(const[g,b]of l)(t||!(qf(tu(g))||qf(tu(b))))&&h.push([s(g),s(b)]);return m}case Qx:{const h=[],m=i([c,h],l);for(const g of l)(t||!qf(tu(g)))&&h.push(s(g));return m}}const{message:f}=l;return i([c,{name:u,message:f}],l)};return s},fE=(t,{json:e,lossy:n}={})=>{const r=[];return Qj(!(e||n),!!e,new Map,r)(t),r},Bh=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?dE(fE(t,e)):structuredClone(t):(t,e)=>dE(fE(t,e));function eI(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 tI(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function nI(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||eI,r=t.options.footnoteBackLabel||tI,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[u]);if(!f)continue;const h=t.all(f),m=String(f.identifier).toUpperCase(),g=Wa(m.toLowerCase());let b=0;const v=[],k=t.footnoteCounts.get(m);for(;k!==void 0&&++b<=k;){v.length>0&&v.push({type:"text",value:" "});let j=typeof n=="string"?n:n(u,b);typeof j=="string"&&(j={type:"text",value:j}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,b),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const j=C.children[C.children.length-1];j&&j.type==="text"?j.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...v)}else h.push(...v);const E={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(h,!0)};t.patch(f,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Bh(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
58
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
59
+ `}]}}const uO=(function(t){if(t==null)return oI;if(typeof t=="function")return tm(t);if(typeof t=="object")return Array.isArray(t)?rI(t):iI(t);if(typeof t=="string")return sI(t);throw new Error("Expected function, string, or object as test")});function rI(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=uO(t[n]);return tm(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function iI(t){const e=t;return tm(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function sI(t){return tm(e);function e(n){return n&&n.type===t}}function tm(t){return e;function e(n,r,i){return!!(lI(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function oI(){return!0}function lI(t){return t!==null&&typeof t=="object"&&"type"in t}const dO=[],aI=!0,hE=!1,cI="skip";function uI(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=uO(i),l=r?-1:1;c(t,void 0,[])();function c(u,f,h){const m=u&&typeof u=="object"?u:{};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 ("+(u.type+(b?"<"+b+">":""))+")"})}return g;function g(){let b=dO,v,k,C;if((!e||s(u,f,h[h.length-1]||void 0))&&(b=dI(n(u,h)),b[0]===hE))return b;if("children"in u&&u.children){const E=u;if(E.children&&b[0]!==cI)for(k=(r?E.children.length:-1)+l,C=h.concat(E);k>-1&&k<E.children.length;){const j=E.children[k];if(v=c(j,k,C)(),v[0]===hE)return v;k=typeof v[1]=="number"?v[1]:k+l}}return b}}}function dI(t){return Array.isArray(t)?t:typeof t=="number"?[aI,t]:t==null?dO:[t]}function fO(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),uI(t,s,c,i);function c(u,f){const h=f[f.length-1],m=h?h.children.indexOf(u):void 0;return l(u,m,h)}}const vb={}.hasOwnProperty,fI={};function hI(t,e){const n=e||fI,r=new Map,i=new Map,s=new Map,l={...Gj,...n.handlers},c={all:f,applyData:mI,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:u,options:n,patch:pI,wrap:yI};return fO(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?r:i,g=String(h.identifier).toUpperCase();m.has(g)||m.set(g,h)}}),c;function u(h,m){const g=h.type,b=c.handlers[g];if(vb.call(c.handlers,g)&&b)return b(c,h,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in h){const{children:k,...C}=h,E=Bh(C);return E.children=c.all(h),E}return Bh(h)}return(c.options.unknownHandler||gI)(c,h,m)}function f(h){const m=[];if("children"in h){const g=h.children;let b=-1;for(;++b<g.length;){const v=c.one(g[b],h);if(v){if(b&&g[b-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=pE(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=pE(k.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function pI(t,e){t.position&&(e.position=JL(t))}function mI(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,Bh(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function gI(t,e){const n=e.data||{},r="value"in e&&!(vb.call(n,"hProperties")||vb.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 yI(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
60
+ `});++r<t.length;)r&&n.push({type:"text",value:`
61
+ `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
62
+ `}),n}function pE(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function mE(t,e){const n=hI(t,e),r=n.one(t,void 0),i=nI(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
63
+ `},i),s}function bI(t,e){return t&&"run"in t?async function(n,r){const i=mE(n,{file:r,...e});await t.run(i,r)}:function(n,r){return mE(n,{file:r,...t||e})}}function gE(t){if(t)throw t}var s0,yE;function xI(){if(yE)return s0;yE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},s=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var h=t.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!m)return!1;var g;for(g in f);return typeof g>"u"||t.call(f,g)},l=function(f,h){n&&h.name==="__proto__"?n(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):f[h.name]=h.newValue},c=function(f,h){if(h==="__proto__")if(t.call(f,h)){if(r)return r(f,h).value}else return;return f[h]};return s0=function u(){var f,h,m,g,b,v,k=arguments[0],C=1,E=arguments.length,j=!1;for(typeof k=="boolean"&&(j=k,k=arguments[1]||{},C=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});C<E;++C)if(f=arguments[C],f!=null)for(h in f)m=c(k,h),g=c(f,h),k!==g&&(j&&g&&(s(g)||(b=i(g)))?(b?(b=!1,v=m&&i(m)?m:[]):v=m&&s(m)?m:{},l(k,{name:h,newValue:u(j,v,g)})):typeof g<"u"&&l(k,{name:h,newValue:g}));return k},s0}var vI=xI();const o0=Xp(vI);function Sb(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 SI(){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(u,...f){const h=t[++s];let m=-1;if(u){l(u);return}for(;++m<i.length;)(f[m]===null||f[m]===void 0)&&(f[m]=i[m]);i=f,h?wI(h,c)(...f):l(null,...f)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function wI(t,e){let n;return r;function r(...l){const c=t.length>l.length;let u;c&&l.push(i);try{u=t.apply(this,l)}catch(f){const h=f;if(c&&n)throw h;return i(h)}c||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(l,...c){n||(n=!0,e(l,...c))}function s(l){i(null,l)}}const pi={basename:kI,dirname:CI,extname:EI,join:TI,sep:"/"};function kI(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');md(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 CI(t){if(md(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 EI(t){md(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 TI(...t){let e=-1,n;for(;++e<t.length;)md(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":AI(n)}function AI(t){md(t);const e=t.codePointAt(0)===47;let n=MI(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function MI(t,e){let n="",r=0,i=-1,s=0,l=-1,c,u;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(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),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 md(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const OI={cwd:_I};function _I(){return"/"}function wb(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function DI(t){if(typeof t=="string")t=new URL(t);else if(!wb(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 RI(t)}function RI(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 l0=["history","path","basename","stem","extname","dirname"];class hO{constructor(e){let n;e?wb(e)?n={path:e}:typeof e=="string"||NI(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":OI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<l0.length;){const s=l0[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)l0.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?pi.basename(this.path):void 0}set basename(e){c0(e,"basename"),a0(e,"basename"),this.path=pi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?pi.dirname(this.path):void 0}set dirname(e){bE(this.basename,"dirname"),this.path=pi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?pi.extname(this.path):void 0}set extname(e){if(a0(e,"extname"),bE(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=pi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){wb(e)&&(e=DI(e)),c0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?pi.basename(this.path,this.extname):void 0}set stem(e){c0(e,"stem"),a0(e,"stem"),this.path=pi.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 zn(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 a0(t,e){if(t&&t.includes(pi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+pi.sep+"`")}function c0(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function bE(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function NI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const zI=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),LI={}.hasOwnProperty;class e1 extends zI{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=SI()}copy(){const e=new e1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(o0(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(f0("data",this.frozen),this.namespace[e]=n,this):LI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(f0("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=Kf(e),r=this.parser||this.Parser;return u0("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),u0("process",this.parser||this.Parser),d0("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=Kf(e),u=r.parse(c);r.run(u,c,function(h,m,g){if(h||!m||!g)return f(h);const b=m,v=r.stringify(b,g);BI(v)?g.value=v:g.result=v,f(h,g)});function f(h,m){h||!m?l(h):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),u0("processSync",this.parser||this.Parser),d0("processSync",this.compiler||this.Compiler),this.process(e,i),vE("processSync","process",n),r;function i(s,l){n=!0,gE(s),r=l}}run(e,n,r){xE(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 u=Kf(n);i.run(e,u,f);function f(h,m,g){const b=m||e;h?c(h):l?l(b):r(void 0,b,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),vE("runSync","run",r),i;function s(l,c){gE(l),i=c,r=!0}}stringify(e,n){this.freeze();const r=Kf(n),i=this.compiler||this.Compiler;return d0("stringify",i),xE(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(f0("use",this.frozen),e!=null)if(typeof e=="function")u(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(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[h,...m]=f;u(h,m)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))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(f.plugins),f.settings&&(i.settings=o0(!0,i.settings,f.settings))}function c(f){let h=-1;if(f!=null)if(Array.isArray(f))for(;++h<f.length;){const m=f[h];s(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,h){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===f){g=m;break}if(g===-1)r.push([f,...h]);else if(h.length>0){let[b,...v]=h;const k=r[g][1];Sb(k)&&Sb(b)&&(b=o0(!0,k,b)),r[g]=[f,b,...v]}}}}const jI=new e1().freeze();function u0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function d0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function f0(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 xE(t){if(!Sb(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function vE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Kf(t){return II(t)?t:new hO(t)}function II(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function BI(t){return typeof t=="string"||UI(t)}function UI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const HI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",SE=[],wE={allowDangerousHtml:!0},VI=/^(https?|ircs?|mailto|xmpp)$/i,PI=[{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 $I(t){const e=FI(t),n=qI(t);return KI(e.runSync(e.parse(n),n),t)}function FI(t){const e=t.rehypePlugins||SE,n=t.remarkPlugins||SE,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...wE}:wE;return jI().use(kj).use(n).use(bI,r).use(e)}function qI(t){const e=t.children||"",n=new hO;return typeof e=="string"&&(n.value=e),n}function KI(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,u=e.urlTransform||YI;for(const h of PI)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+HI+h.id,void 0);return fO(t,f),n3(t,{Fragment:S.Fragment,components:i,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function f(h,m,g){if(h.type==="raw"&&g&&typeof m=="number")return l?g.children.splice(m,1):g.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let b;for(b in n0)if(Object.hasOwn(n0,b)&&Object.hasOwn(h.properties,b)){const v=h.properties[b],k=n0[b];(k===null||k.includes(h.tagName))&&(h.properties[b]=u(String(v||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(h,m,g)),b&&g&&typeof m=="number")return c&&h.children?g.children.splice(m,1,...h.children):g.children.splice(m,1),m}}}function YI(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||VI.test(t.slice(0,e))?t:""}function t1(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function WI(){return t1("ann")}function GI(){return t1("msg")}function ZI(t){return t1(t)}const $r=()=>new Map,kb=t=>{const e=$r();return t.forEach((n,r)=>{e.set(r,n)}),e},_i=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},JI=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},XI=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},nl=()=>new Set,h0=t=>t[t.length-1],QI=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},lo=Array.from,n1=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},r1=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},eB=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},_a=Array.isArray;class pO{constructor(){this._observers=$r()}on(e,n){return _i(this._observers,e,nl).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 lo((this._observers.get(e)||$r()).values()).forEach(r=>r(...n))}destroy(){this._observers=$r()}}const ti=Math.floor,xh=Math.abs,is=(t,e)=>t<e?t:e,ni=(t,e)=>t>e?t:e,mO=t=>t!==0?t<0:1/t<0,kE=1,CE=2,p0=4,m0=8,Nu=32,ss=64,Vn=128,tB=1<<29,nm=31,Cb=63,Wo=127,nB=2147483647,Uh=Number.MAX_SAFE_INTEGER,EE=Number.MIN_SAFE_INTEGER,rB=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ti(t)===t),gO=String.fromCharCode,iB=t=>t.toLowerCase(),sB=/^\s*/g,oB=t=>t.replace(sB,""),lB=/([A-Z])/g,TE=(t,e)=>oB(t.replace(lB,n=>`${e}${iB(n)}`)),aB=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},zu=typeof TextEncoder<"u"?new TextEncoder:null,cB=t=>zu.encode(t),uB=zu?cB:aB;let hu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});hu&&hu.decode(new Uint8Array).length===1&&(hu=null);const dB=(t,e)=>eB(e,()=>t).join("");let gd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const yd=()=>new gd,fB=t=>{const e=yd();return t(e),ei(e)},hB=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},ei=t=>{const e=new Uint8Array(hB(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},pB=(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(ni(n,e)*2),t.cpos=0)},sn=(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},Eb=sn,Je=(t,e)=>{for(;e>Wo;)sn(t,Vn|Wo&e),e=ti(e/128);sn(t,Wo&e)},i1=(t,e)=>{const n=mO(e);for(n&&(e=-e),sn(t,(e>Cb?Vn:0)|(n?ss:0)|Cb&e),e=ti(e/64);e>0;)sn(t,(e>Wo?Vn:0)|Wo&e),e=ti(e/128)},Tb=new Uint8Array(3e4),mB=Tb.length/3,gB=(t,e)=>{if(e.length<mB){const n=zu.encodeInto(e,Tb).written||0;Je(t,n);for(let r=0;r<n;r++)sn(t,Tb[r])}else gr(t,uB(e))},yB=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Je(t,r);for(let i=0;i<r;i++)sn(t,n.codePointAt(i))},xa=zu&&zu.encodeInto?gB:yB,rm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=is(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(ni(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},gr=(t,e)=>{Je(t,e.byteLength),rm(t,e)},s1=(t,e)=>{pB(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},bB=(t,e)=>s1(t,4).setFloat32(0,e,!1),xB=(t,e)=>s1(t,8).setFloat64(0,e,!1),vB=(t,e)=>s1(t,8).setBigInt64(0,e,!1),AE=new DataView(new ArrayBuffer(4)),SB=t=>(AE.setFloat32(0,t),AE.getFloat32(0)===t),Da=(t,e)=>{switch(typeof e){case"string":sn(t,119),xa(t,e);break;case"number":rB(e)&&xh(e)<=nB?(sn(t,125),i1(t,e)):SB(e)?(sn(t,124),bB(t,e)):(sn(t,123),xB(t,e));break;case"bigint":sn(t,122),vB(t,e);break;case"object":if(e===null)sn(t,126);else if(_a(e)){sn(t,117),Je(t,e.length);for(let n=0;n<e.length;n++)Da(t,e[n])}else if(e instanceof Uint8Array)sn(t,116),gr(t,e);else{sn(t,118);const n=Object.keys(e);Je(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];xa(t,i),Da(t,e[i])}}break;case"boolean":sn(t,e?120:121);break;default:sn(t,127)}};class ME extends gd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Je(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const OE=t=>{t.count>0&&(i1(t.encoder,t.count===1?t.s:-t.s),t.count>1&&Je(t.encoder,t.count-2))};class vh{constructor(){this.encoder=new gd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(OE(this),this.count=1,this.s=e)}toUint8Array(){return OE(this),ei(this.encoder)}}const _E=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);i1(t.encoder,e),t.count>1&&Je(t.encoder,t.count-2)}};class g0{constructor(){this.encoder=new gd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(_E(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return _E(this),ei(this.encoder)}}class wB{constructor(){this.sarr=[],this.s="",this.lensE=new vh}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 gd;return this.sarr.push(this.s),this.s="",xa(e,this.sarr.join("")),rm(e,this.lensE.toUint8Array()),ei(e)}}const Ei=t=>new Error(t),Fr=()=>{throw Ei("Method unimplemented")},Dn=()=>{throw Ei("Unexpected case")},yO=Ei("Unexpected end of array"),bO=Ei("Integer out of Range");let im=class{constructor(e){this.arr=e,this.pos=0}};const Ga=t=>new im(t),kB=t=>t.pos!==t.arr.length,CB=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},yr=t=>CB(t,qe(t)),Ra=t=>t.arr[t.pos++],qe=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&Wo)*n,n*=128,i<Vn)return e;if(e>Uh)throw bO}throw yO},o1=t=>{let e=t.arr[t.pos++],n=e&Cb,r=64;const i=(e&ss)>0?-1:1;if((e&Vn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Wo)*r,r*=128,e<Vn)return i*n;if(n>Uh)throw bO}throw yO},EB=t=>{let e=qe(t);if(e===0)return"";{let n=String.fromCodePoint(Ra(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Ra(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))}},TB=t=>hu.decode(yr(t)),va=hu?TB:EB,l1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},AB=t=>l1(t,4).getFloat32(0,!1),MB=t=>l1(t,8).getFloat64(0,!1),OB=t=>l1(t,8).getBigInt64(0,!1),_B=[t=>{},t=>null,o1,AB,MB,OB,t=>!1,t=>!0,va,t=>{const e=qe(t),n={};for(let r=0;r<e;r++){const i=va(t);n[i]=Lu(t)}return n},t=>{const e=qe(t),n=[];for(let r=0;r<e;r++)n.push(Lu(t));return n},yr],Lu=t=>_B[127-Ra(t)](t);class DE extends im{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),kB(this)?this.count=qe(this)+1:this.count=-1),this.count--,this.s}}class Sh extends im{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=o1(this);const e=mO(this.s);this.count=1,e&&(this.s=-this.s,this.count=qe(this)+2)}return this.count--,this.s}}class y0 extends im{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=o1(this),n=e&1;this.diff=ti(e/2),this.count=1,n&&(this.count=qe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class DB{constructor(e){this.decoder=new Sh(e),this.str=va(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 RB=crypto.getRandomValues.bind(crypto),NB=Math.random,xO=()=>RB(new Uint32Array(1))[0],zB=t=>t[ti(NB()*t.length)],LB="10000000-1000-4000-8000"+-1e11,jB=()=>LB.replace(/[018]/g,t=>(t^xO()&15>>t/4).toString(16)),IB=Date.now,RE=t=>new Promise(t);Promise.all.bind(Promise);const NE=t=>t===void 0?null:t;class BB{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let vO=new BB,UB=!0;try{typeof localStorage<"u"&&localStorage&&(vO=localStorage,UB=!1)}catch{}const HB=vO,ju=Symbol("Equality"),SO=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[ju])!=null&&n.call(t,e))||!1},VB=t=>typeof t=="object",PB=Object.assign,wO=Object.keys,$B=(t,e)=>{for(const n in t)e(t[n],n)},Hh=t=>wO(t).length,FB=t=>{for(const e in t)return!1;return!0},Za=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},a1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),qB=(t,e)=>t===e||Hh(t)===Hh(e)&&Za(t,(n,r)=>(n!==void 0||a1(e,r))&&SO(e[r],n)),KB=Object.freeze,kO=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&kO(t[e])}return KB(t)},c1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&c1(t,e,n+1)}},YB=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[ju]!=null)return t[ju](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(Hh(t)!==Hh(e))return!1;for(const n in t)if(!a1(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},WB=(t,e)=>e.includes(t);var CO={};const Na=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",EO=typeof window<"u"&&typeof document<"u"&&!Na;let hi;const GB=()=>{if(hi===void 0)if(Na){hi=$r();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&hi.set(e,""),e=r):e!==null&&(hi.set(e,r),e=null)}e!==null&&hi.set(e,"")}else typeof location=="object"?(hi=$r(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");hi.set(`--${TE(e,"-")}`,n),hi.set(`-${TE(e,"-")}`,n)}})):hi=$r();return hi},Ab=t=>GB().has(t),Vh=t=>NE(Na?CO[t.toUpperCase().replaceAll("-","_")]:HB.getItem(t)),TO=t=>Ab("--"+t)||Vh(t)!==null,ZB=TO("production"),JB=Na&&WB(CO.FORCE_COLOR,["true","1","2"]),XB=JB||!Ab("--no-colors")&&!TO("no-color")&&(!Na||process.stdout.isTTY)&&(!Na||Ab("--color")||Vh("COLORTERM")!==null||(Vh("TERM")||"").includes("color")),QB=t=>new Uint8Array(t),e6=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=gO(t[n]);return btoa(e)},t6=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),n6=EO?e6:t6,r6=t=>{const e=QB(t.byteLength);return e.set(t),e},i6=t=>fB(e=>Da(e,t));class s6{constructor(e,n){this.left=e,this.right=n}}const Zi=(t,e)=>new s6(t,e),zE=t=>t.next()>=.5,b0=(t,e,n)=>ti(t.next()*(n+1-e)+e),AO=(t,e,n)=>ti(t.next()*(n+1-e)+e),u1=(t,e,n)=>AO(t,e,n),o6=t=>gO(u1(t,97,122)),l6=(t,e=0,n=20)=>{const r=u1(t,e,n);let i="";for(let s=0;s<r;s++)i+=o6(t);return i},x0=(t,e)=>e[u1(t,0,e.length-1)],a6=Symbol("0schema");class c6{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(dB(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
64
+ `)}}const Mb=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[ju]?SO(t,e):_a(t)?n1(t,n=>r1(e,r=>Mb(n,r))):VB(t)?Za(t,(n,r)=>Mb(n,e[r])):!1;var ub;let qn=(ub=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Mb(n,r)}equals(e){return this.constructor===e.constructor&&wh(this.shape,e.shape)}[a6](){return!0}[ju](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Fr()}get nullable(){return Ja(this,cm)}get optional(){return new _O(this)}cast(e){return LE(e,this),e}expect(e){return LE(e,this),e}},Pf(ub,"_dilutes",!1),ub);class d1 extends qn{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 Zt=(t,e=null)=>new d1(t,e);Zt(d1);class f1 extends qn{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 pn=t=>new f1(t);Zt(f1);class sm extends qn{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 om=(...t)=>new sm(t),MO=Zt(sm),u6=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),OO=t=>{if(za.check(t))return[u6(t)];if(MO.check(t))return t.shape.map(e=>e+"");if(UO.check(t))return["[+-]?\\d+.?\\d*"];if(HO.check(t))return[".*"];if($h.check(t))return t.shape.map(OO).flat(1);Dn()};class d6 extends qn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(OO).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}}Zt(d6);const f6=Symbol("optional");class _O extends qn{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[f6](){return!0}}const h6=Zt(_O);class p6 extends qn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}Zt(p6);const Jp=class Jp extends qn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new Jp(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):Za(this.shape,(r,i)=>{const s=this._isPartial&&!a1(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})}};Pf(Jp,"_dilutes",!0);let Ph=Jp;const m6=t=>new Ph(t),g6=Zt(Ph),y6=pn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class DO extends qn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Za(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 RO=(t,e)=>new DO(t,e),b6=Zt(DO);class NO extends qn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Za(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const x6=(...t)=>new NO(t);Zt(NO);class zO extends qn{constructor(e){super(),this.shape=e.length===1?e[0]:new lm(e)}check(e,n){const r=_a(e)&&n1(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const LO=(...t)=>new zO(t),v6=Zt(zO),S6=pn(t=>_a(t));class jO extends qn{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 w6=(t,e=null)=>new jO(t,e);Zt(jO);const k6=w6(qn);class C6 extends qn{constructor(e){super(),this.len=e.length-1,this.args=x6(...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 E6=Zt(C6),T6=pn(t=>typeof t=="function");class A6 extends qn{constructor(e){super(),this.shape=e}check(e,n){const r=n1(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}Zt(A6,t=>t.shape.length>0);class lm extends qn{constructor(e){super(),this.shape=e}check(e,n){const r=r1(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Pf(lm,"_dilutes",!0);const Ja=(...t)=>t.findIndex(e=>$h.check(e))>=0?Ja(...t.map(e=>Iu(e)).map(e=>$h.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new lm(t),$h=Zt(lm),IO=()=>!0,Fh=pn(IO),M6=Zt(f1,t=>t.shape===IO),h1=pn(t=>typeof t=="bigint"),O6=pn(t=>t===h1),BO=pn(t=>typeof t=="symbol");pn(t=>t===BO);const Sa=pn(t=>typeof t=="number"),UO=pn(t=>t===Sa),za=pn(t=>typeof t=="string"),HO=pn(t=>t===za),am=pn(t=>typeof t=="boolean"),_6=pn(t=>t===am),VO=om(void 0);Zt(sm,t=>t.shape.length===1&&t.shape[0]===void 0);om(void 0);const cm=om(null),D6=Zt(sm,t=>t.shape.length===1&&t.shape[0]===null);Zt(Uint8Array);Zt(d1,t=>t.shape===Uint8Array);const R6=Ja(Sa,za,cm,VO,h1,am,BO);(()=>{const t=LO(Fh),e=RO(za,Fh),n=Ja(Sa,za,cm,am,t,e);return t.shape=n,e.shape.values=n,n})();const Iu=t=>{if(k6.check(t))return t;if(y6.check(t)){const e={};for(const n in t)e[n]=Iu(t[n]);return m6(e)}else{if(S6.check(t))return Ja(...t.map(Iu));if(R6.check(t))return om(t);if(T6.check(t))return Zt(t)}Dn()},LE=ZB?()=>{}:(t,e)=>{const n=new c6;if(!e.check(t,n))throw Ei(`Expected value to be of type ${e.constructor.name}.
65
+ ${n.toString()}`)};class N6{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Iu(e),h:n}),this}else(e){return this.if(Fh,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 Ei("Unhandled pattern")}}}const z6=t=>new N6(t),PO=z6(Fh).if(UO,(t,e)=>b0(e,EE,Uh)).if(HO,(t,e)=>l6(e)).if(_6,(t,e)=>zE(e)).if(O6,(t,e)=>BigInt(b0(e,EE,Uh))).if($h,(t,e)=>oa(e,x0(e,t.shape))).if(g6,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(h6.check(i)){if(zE(e))continue;i=i.shape}n[r]=PO(i,e)}return n}).if(v6,(t,e)=>{const n=[],r=AO(e,0,42);for(let i=0;i<r;i++)n.push(oa(e,t.shape));return n}).if(MO,(t,e)=>x0(e,t.shape)).if(D6,(t,e)=>null).if(E6,(t,e)=>{const n=oa(e,t.res);return()=>n}).if(M6,(t,e)=>oa(e,x0(e,[Sa,za,cm,VO,h1,am,LO(Sa),RO(Ja("a","b","c"),Sa)]))).if(b6,(t,e)=>{const n={},r=b0(e,0,3);for(let i=0;i<r;i++){const s=oa(e,t.shape.keys),l=oa(e,t.shape.values);n[s]=l}return n}).done(),oa=(t,e)=>PO(Iu(e),t),bd=typeof document<"u"?document:{};pn(t=>t.nodeType===U6);typeof DOMParser<"u"&&new DOMParser;pn(t=>t.nodeType===j6);pn(t=>t.nodeType===I6);const L6=t=>JI(t,(e,n)=>`${n}:${e};`).join(""),j6=bd.ELEMENT_NODE,I6=bd.TEXT_NODE,B6=bd.DOCUMENT_NODE,U6=bd.DOCUMENT_FRAGMENT_NODE;pn(t=>t.nodeType===B6);const H6=t=>class{constructor(n){this._=n}destroy(){t(this._)}},V6=H6(clearTimeout),p1=(t,e)=>new V6(setTimeout(e,t)),fs=Symbol,$O=fs(),FO=fs(),P6=fs(),$6=fs(),F6=fs(),qO=fs(),q6=fs(),m1=fs(),K6=fs(),Y6=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},W6={[$O]:Zi("font-weight","bold"),[FO]:Zi("font-weight","normal"),[P6]:Zi("color","blue"),[F6]:Zi("color","green"),[$6]:Zi("color","grey"),[qO]:Zi("color","red"),[q6]:Zi("color","purple"),[m1]:Zi("color","orange"),[K6]:Zi("color","black")},G6=t=>{var l;t.length===1&&((l=t[0])==null?void 0:l.constructor)===Function&&(t=t[0]());const e=[],n=[],r=$r();let i=[],s=0;for(;s<t.length;s++){const c=t[s],u=W6[c];if(u!==void 0)r.set(u.left,u.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const f=L6(r);s>0||f.length>0?(e.push("%c"+c),n.push(f)):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},KO=XB?G6:Y6,Z6=(...t)=>{console.log(...KO(t)),WO.forEach(e=>e.print(t))},YO=(...t)=>{console.warn(...KO(t)),t.unshift(m1),WO.forEach(e=>e.print(t))},WO=nl(),GO=t=>({[Symbol.iterator](){return this},next:t}),J6=(t,e)=>GO(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),v0=(t,e)=>GO(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class um{constructor(e,n){this.clock=e,this.len=n}}class Xa{constructor(){this.clients=new Map}}const ao=(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 u=0,f=r[u];u<r.length&&f.clock<c;f=r[++u])c_(t,s,f.clock,f.len,n)}}),X6=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=ti((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},Qa=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&X6(n,e.clock)!==null},g1=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 um(i.clock,ni(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Ob=t=>{const e=new Xa;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++)QI(s,t[l].clients.get(i)||[]);e.clients.set(i,s)}});return g1(e),e},Bu=(t,e,n,r)=>{_i(t.clients,e,()=>[]).push(new um(n,r))},ZO=()=>new Xa,JO=t=>{const e=ZO();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 u=l.length;if(s+1<n.length)for(let f=n[s+1];s+1<n.length&&f.deleted;f=n[++s+1])u+=f.length;i.push(new um(c,u))}}i.length>0&&e.clients.set(r,i)}),e},ec=(t,e)=>{Je(t.restEncoder,e.clients.size),lo(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),Je(t.restEncoder,n);const i=r.length;Je(t.restEncoder,i);for(let s=0;s<i;s++){const l=r[s];t.writeDsClock(l.clock),t.writeDsLen(l.len)}})},y1=t=>{const e=new Xa,n=qe(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=qe(t.restDecoder),s=qe(t.restDecoder);if(s>0){const l=_i(e.clients,i,()=>[]);for(let c=0;c<s;c++)l.push(new um(t.readDsClock(),t.readDsLen()))}}return e},jE=(t,e,n)=>{const r=new Xa,i=qe(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const l=qe(t.restDecoder),c=qe(t.restDecoder),u=n.clients.get(l)||[],f=Vt(n,l);for(let h=0;h<c;h++){const m=t.readDsClock(),g=m+t.readDsLen();if(m<f){f<g&&Bu(r,l,f,g-f);let b=ri(u,m),v=u[b];for(!v.deleted&&v.id.clock<m&&(u.splice(b+1,0,Jh(e,v,m-v.id.clock)),b++);b<u.length&&(v=u[b++],v.id.clock<g);)v.deleted||(g<v.id.clock+v.length&&u.splice(b,0,Jh(e,v,g-v.id.clock)),v.delete(e))}else Bu(r,l,m,g-m)}}if(r.clients.size>0){const s=new rl;return Je(s.restEncoder,0),ec(s,r),s.toUint8Array()}return null},XO=xO;class Ti extends pO{constructor({guid:e=jB(),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=XO(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new l_,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=RE(f=>{this.on("load",()=>{this.isLoaded=!0,f(this)})});const u=()=>RE(f=>{const h=m=>{(m===void 0||m===!0)&&(this.off("sync",h),f())};this.on("sync",h)});this.on("sync",f=>{f===!1&&this.isSynced&&(this.whenSynced=u()),this.isSynced=f===void 0||f===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=u()}load(){const e=this._item;e!==null&&!this.shouldLoad&&yt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(lo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return yt(this,e,n)}get(e,n=cn){const r=_i(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==cn&&i!==n)if(i===cn){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,co)}getMap(e=""){return this.get(e,ja)}getXmlElement(e=""){return this.get(e,an)}getXmlFragment(e=""){return this.get(e,il)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,lo(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Ti({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,yt(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 QO{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return qe(this.restDecoder)}readDsLen(){return qe(this.restDecoder)}}class e_ extends QO{readLeftID(){return Ue(qe(this.restDecoder),qe(this.restDecoder))}readRightID(){return Ue(qe(this.restDecoder),qe(this.restDecoder))}readClient(){return qe(this.restDecoder)}readInfo(){return Ra(this.restDecoder)}readString(){return va(this.restDecoder)}readParentInfo(){return qe(this.restDecoder)===1}readTypeRef(){return qe(this.restDecoder)}readLen(){return qe(this.restDecoder)}readAny(){return Lu(this.restDecoder)}readBuf(){return r6(yr(this.restDecoder))}readJSON(){return JSON.parse(va(this.restDecoder))}readKey(){return va(this.restDecoder)}}class Q6{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=qe(this.restDecoder),this.dsCurrVal}readDsLen(){const e=qe(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class La extends Q6{constructor(e){super(e),this.keys=[],qe(e),this.keyClockDecoder=new y0(yr(e)),this.clientDecoder=new Sh(yr(e)),this.leftClockDecoder=new y0(yr(e)),this.rightClockDecoder=new y0(yr(e)),this.infoDecoder=new DE(yr(e),Ra),this.stringDecoder=new DB(yr(e)),this.parentInfoDecoder=new DE(yr(e),Ra),this.typeRefDecoder=new Sh(yr(e)),this.lenDecoder=new Sh(yr(e))}readLeftID(){return new wa(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new wa(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 Lu(this.restDecoder)}readBuf(){return yr(this.restDecoder)}readJSON(){return Lu(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 t_{constructor(){this.restEncoder=yd()}toUint8Array(){return ei(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Je(this.restEncoder,e)}writeDsLen(e){Je(this.restEncoder,e)}}class xd extends t_{writeLeftID(e){Je(this.restEncoder,e.client),Je(this.restEncoder,e.clock)}writeRightID(e){Je(this.restEncoder,e.client),Je(this.restEncoder,e.clock)}writeClient(e){Je(this.restEncoder,e)}writeInfo(e){Eb(this.restEncoder,e)}writeString(e){xa(this.restEncoder,e)}writeParentInfo(e){Je(this.restEncoder,e?1:0)}writeTypeRef(e){Je(this.restEncoder,e)}writeLen(e){Je(this.restEncoder,e)}writeAny(e){Da(this.restEncoder,e)}writeBuf(e){gr(this.restEncoder,e)}writeJSON(e){xa(this.restEncoder,JSON.stringify(e))}writeKey(e){xa(this.restEncoder,e)}}class n_{constructor(){this.restEncoder=yd(),this.dsCurrVal=0}toUint8Array(){return ei(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,Je(this.restEncoder,n)}writeDsLen(e){e===0&&Dn(),Je(this.restEncoder,e-1),this.dsCurrVal+=e}}class rl extends n_{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new g0,this.clientEncoder=new vh,this.leftClockEncoder=new g0,this.rightClockEncoder=new g0,this.infoEncoder=new ME(Eb),this.stringEncoder=new wB,this.parentInfoEncoder=new ME(Eb),this.typeRefEncoder=new vh,this.lenEncoder=new vh}toUint8Array(){const e=yd();return Je(e,0),gr(e,this.keyClockEncoder.toUint8Array()),gr(e,this.clientEncoder.toUint8Array()),gr(e,this.leftClockEncoder.toUint8Array()),gr(e,this.rightClockEncoder.toUint8Array()),gr(e,ei(this.infoEncoder)),gr(e,this.stringEncoder.toUint8Array()),gr(e,ei(this.parentInfoEncoder)),gr(e,this.typeRefEncoder.toUint8Array()),gr(e,this.lenEncoder.toUint8Array()),rm(e,ei(this.restEncoder)),ei(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){Da(this.restEncoder,e)}writeBuf(e){gr(this.restEncoder,e)}writeJSON(e){Da(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 e5=(t,e,n,r)=>{r=ni(r,e[0].id.clock);const i=ri(e,r);Je(t.restEncoder,e.length-i),t.writeClient(n),Je(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)},b1=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Vt(e,s)>i&&r.set(s,i)}),vd(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),Je(t.restEncoder,r.size),lo(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{e5(t,e.clients.get(i),i,s)})},t5=(t,e)=>{const n=$r(),r=qe(t.restDecoder);for(let i=0;i<r;i++){const s=qe(t.restDecoder),l=new Array(s),c=t.readClient();let u=qe(t.restDecoder);n.set(c,{i:0,refs:l});for(let f=0;f<s;f++){const h=t.readInfo();switch(nm&h){case 0:{const m=t.readLen();l[f]=new Hr(Ue(c,u),m),u+=m;break}case 10:{const m=qe(t.restDecoder);l[f]=new Vr(Ue(c,u),m),u+=m;break}default:{const m=(h&(ss|Vn))===0,g=new wt(Ue(c,u),null,(h&Vn)===Vn?t.readLeftID():null,null,(h&ss)===ss?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(h&Nu)===Nu?t.readString():null,D_(t,h));l[f]=g,u+=g.length}}}}return n},n5=(t,e,n)=>{const r=[];let i=lo(n.keys()).sort((b,v)=>b-v);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 l_,u=new Map,f=(b,v)=>{const k=u.get(b);(k==null||k>v)&&u.set(b,v)};let h=l.refs[l.i++];const m=new Map,g=()=>{for(const b of r){const v=b.id.client,k=n.get(v);k?(k.i--,c.clients.set(v,k.refs.slice(k.i)),n.delete(v),k.i=0,k.refs=[]):c.clients.set(v,[b]),i=i.filter(C=>C!==v)}r.length=0};for(;;){if(h.constructor!==Vr){const v=_i(m,h.id.client,()=>Vt(e,h.id.client))-h.id.clock;if(v<0)r.push(h),f(h.id.client,h.id.clock-1),g();else{const k=h.getMissing(t,e);if(k!==null){r.push(h);const C=n.get(k)||{refs:[],i:0};if(C.refs.length===C.i)f(k,Vt(e,k)),g();else{h=C.refs[C.i++];continue}}else(v===0||v<h.length)&&(h.integrate(t,v),m.set(h.id.client,h.id.clock+h.length))}}if(r.length>0)h=r.pop();else if(l!==null&&l.i<l.refs.length)h=l.refs[l.i++];else{if(l=s(),l===null)break;h=l.refs[l.i++]}}if(c.clients.size>0){const b=new rl;return b1(b,c,new Map),Je(b.restEncoder,0),{missing:u,update:b.toUint8Array()}}return null},r5=(t,e)=>b1(t,e.doc.store,e.beforeState),i5=(t,e,n,r=new La(t))=>yt(e,i=>{i.local=!1;let s=!1;const l=i.doc,c=l.store,u=t5(r,l),f=n5(i,c,u),h=c.pendingStructs;if(h){for(const[g,b]of h.missing)if(b<Vt(c,g)){s=!0;break}if(f){for(const[g,b]of f.missing){const v=h.missing.get(g);(v==null||v>b)&&h.missing.set(g,b)}h.update=Kh([h.update,f.update])}}else c.pendingStructs=f;const m=jE(r,i,c);if(c.pendingDs){const g=new La(Ga(c.pendingDs));qe(g.restDecoder);const b=jE(g,i,c);m&&b?c.pendingDs=Kh([m,b]):c.pendingDs=m||b}else c.pendingDs=m;if(s){const g=c.pendingStructs.update;c.pendingStructs=null,qh(i.doc,g)}},n,!1),qh=(t,e,n,r=La)=>{const i=Ga(e);i5(i,t,n,new r(i))},s5=(t,e,n)=>qh(t,e,n,e_),o5=(t,e,n=new Map)=>{b1(t,e.store,n),ec(t,JO(e.store))},l5=(t,e=new Uint8Array([0]),n=new rl)=>{const r=r_(e);o5(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(T5(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===xd)return C5(i.map((s,l)=>l===0?s:M5(s)));if(n.constructor===rl)return Kh(i)}return i[0]},a5=(t,e)=>l5(t,e,new xd),c5=t=>{const e=new Map,n=qe(t.restDecoder);for(let r=0;r<n;r++){const i=qe(t.restDecoder),s=qe(t.restDecoder);e.set(i,s)}return e},r_=t=>c5(new QO(Ga(t))),i_=(t,e)=>(Je(t.restEncoder,e.size),lo(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{Je(t.restEncoder,n),Je(t.restEncoder,r)}),t),u5=(t,e)=>i_(t,vd(e.store)),d5=(t,e=new n_)=>(t instanceof Map?i_(e,t):u5(e,t),e.toUint8Array()),f5=t=>d5(t,new t_);class h5{constructor(){this.l=[]}}const IE=()=>new h5,BE=(t,e)=>t.l.push(e),UE=(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.")},s_=(t,e,n)=>c1(t.l,[e,n]);class wa{constructor(e,n){this.client=e,this.clock=n}}const pa=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ue=(t,e)=>new wa(t,e),Uu=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Dn()},Hu=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Vu{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const Go=t=>new Vu(t.type==null?null:Ue(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Ue(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class p5{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const m5=(t,e,n=0)=>new p5(t,e,n),Yf=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Uu(t):r=Ue(t._item.id.client,t._item.id.clock),new Vu(r,i,e,n)},S0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Yf(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Yf(t,Ue(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Yf(t,r.lastId,n);r=r.right}return Yf(t,null,n)},g5=(t,e)=>{const n=ka(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},_b=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,l=t.tname,c=t.assoc;let u=null,f=0;if(i!==null){if(Vt(r,i.client)<=i.clock)return null;const h=n?zb(r,i):g5(r,i),m=h.item;if(!(m instanceof wt))return null;if(u=m.parent,u._item===null||!u._item.deleted){f=m.deleted||!m.countable?0:h.diff+(c>=0?0:1);let g=m.left;for(;g!==null;)!g.deleted&&g.countable&&(f+=g.length),g=g.left}}else{if(l!==null)u=e.get(l);else if(s!==null){if(Vt(r,s.client)<=s.clock)return null;const{item:h}=n?zb(r,s):{item:ka(r,s)};if(h instanceof wt&&h.content instanceof si)u=h.content.type;else return null}else throw Dn();c>=0?f=u._length:f=0}return m5(u,f,t.assoc)},HE=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&pa(t.item,e.item)&&pa(t.type,e.type)&&t.assoc===e.assoc;class x1{constructor(e,n){this.ds=e,this.sv=n}}const o_=(t,e)=>new x1(t,e),w0=t=>o_(JO(t.store),vd(t.store)),Ho=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Qa(e.ds,t.id),Db=(t,e)=>{const n=_i(t.meta,Db,nl),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Vt(r,s)&&tr(t,Ue(s,i))}),ao(t,e.ds,i=>{}),n.add(e))};class l_{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const vd=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},Vt=(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},a_=(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 Dn()}n.push(e)},ri=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let l=ti(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=ti((n+r)/2)}throw Dn()},y5=(t,e)=>{const n=t.clients.get(e.client);return n[ri(n,e.clock)]},ka=y5,Rb=(t,e,n)=>{const r=ri(e,n),i=e[r];return i.id.clock<n&&i instanceof wt?(e.splice(r+1,0,Jh(t,i,n-i.id.clock)),r+1):r},tr=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Rb(t,n,e.clock)]},VE=(t,e,n)=>{const r=e.clients.get(n.client),i=ri(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Hr&&r.splice(i+1,0,Jh(t,s,n.clock-s.id.clock+1)),s},b5=(t,e,n)=>{const r=t.clients.get(e.id.client);r[ri(r,e.id.clock)]=n},c_=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let l=Rb(t,e,n),c;do c=e[l++],s<c.id.clock+c.length&&Rb(t,e,s),i(c);while(l<e.length&&e[l].id.clock<s)};let x5=class{constructor(e,n,r){this.doc=e,this.deleteSet=new Xa,this.beforeState=vd(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 PE=(t,e)=>e.deleteSet.clients.size===0&&!XI(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(g1(e.deleteSet),r5(t,e),ec(t,e.deleteSet),!0),$E=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&_i(t.changed,e,nl).add(n)},kh=(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 wt&&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},v5=(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],u=c.clock+c.len;for(let f=ri(s,c.clock),h=s[f];f<s.length&&h.id.clock<u;h=s[++f]){const m=s[f];if(c.clock+c.len<=m.id.clock)break;m instanceof wt&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},S5=(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=is(i.length-1,1+ri(i,l.clock+l.len-1));for(let u=c,f=i[u];u>0&&f.id.clock>=l.clock;f=i[u])u-=1+kh(i,u)}})},u_=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,l=n._mergeStructs;try{g1(s),n.afterState=vd(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((u,f)=>c.push(()=>{(f._item===null||!f._item.deleted)&&f._callObserver(n,u)})),c.push(()=>{n.changedParentTypes.forEach((u,f)=>{f._dEH.l.length>0&&(f._item===null||!f._item.deleted)&&(u=u.filter(h=>h.target._item===null||!h.target._item.deleted),u.forEach(h=>{h.currentTarget=f,h._path=null}),u.sort((h,m)=>h.path.length-m.path.length),c.push(()=>{s_(f._dEH,u,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&P5(n)})}),c1(c,[])}finally{r.gc&&v5(s,i,r.gcFilter),S5(s,i),n.afterState.forEach((h,m)=>{const g=n.beforeState.get(m)||0;if(g!==h){const b=i.clients.get(m),v=ni(ri(b,g),1);for(let k=b.length-1;k>=v;)k-=1+kh(b,k)}});for(let h=l.length-1;h>=0;h--){const{client:m,clock:g}=l[h].id,b=i.clients.get(m),v=ri(b,g);v+1<b.length&&kh(b,v+1)>1||v>0&&kh(b,v)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(Z6(m1,$O,"[yjs] ",FO,qO,"Changed the client-id because another client seems to be using it."),r.clientID=XO()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const h=new xd;PE(h,n)&&r.emit("update",[h.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const h=new rl;PE(h,n)&&r.emit("updateV2",[h.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:u,subdocsRemoved:f}=n;(c.size>0||f.size>0||u.size>0)&&(c.forEach(h=>{h.clientID=r.clientID,h.collectionid==null&&(h.collectionid=r.collectionid),r.subdocs.add(h)}),f.forEach(h=>r.subdocs.delete(h)),r.emit("subdocs",[{loaded:u,added:c,removed:f},r,n]),f.forEach(h=>h.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):u_(t,e+1)}}},yt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,l=null;t._transaction===null&&(s=!0,t._transaction=new x5(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&&u_(i,0)}}return l};class w5{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const FE=(t,e,n)=>{ao(t,n.deletions,r=>{r instanceof wt&&e.scope.some(i=>i===t.doc||Hu(i,r))&&A1(r,!1)})},qE=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;yt(i,c=>{for(;e.length>0&&t.currStackItem===null;){const u=i.store,f=e.pop(),h=new Set,m=[];let g=!1;ao(c,f.insertions,b=>{if(b instanceof wt){if(b.redone!==null){let{item:v,diff:k}=zb(u,b.id);k>0&&(v=tr(c,Ue(v.id.client,v.id.clock+k))),b=v}!b.deleted&&s.some(v=>v===c.doc||Hu(v,b))&&m.push(b)}}),ao(c,f.deletions,b=>{b instanceof wt&&s.some(v=>v===c.doc||Hu(v,b))&&!Qa(f.insertions,b.id)&&h.add(b)}),h.forEach(b=>{g=__(c,b,h,f.insertions,t.ignoreRemoteMapChanges,t)!==null||g});for(let b=m.length-1;b>=0;b--){const v=m[b];t.deleteFilter(v)&&(v.delete(c),g=!0)}t.currStackItem=g?f:null}c.changed.forEach((u,f)=>{u.has(null)&&f._searchMarker&&(f._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 d_ extends pO{constructor(e,{captureTimeout:n=500,captureTransaction:r=u=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:c=_a(e)?e[0].doc:e instanceof Ti?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=u=>{if(!this.captureTransaction(u)||!this.scope.some(C=>u.changedParentTypes.has(C)||C===this.doc)||!this.trackedOrigins.has(u.origin)&&(!u.origin||!this.trackedOrigins.has(u.origin.constructor)))return;const f=this.undoing,h=this.redoing,m=f?this.redoStack:this.undoStack;f?this.stopCapturing():h||this.clear(!1,!0);const g=new Xa;u.afterState.forEach((C,E)=>{const j=u.beforeState.get(E)||0,N=C-j;N>0&&Bu(g,E,j,N)});const b=IB();let v=!1;if(this.lastChange>0&&b-this.lastChange<this.captureTimeout&&m.length>0&&!f&&!h){const C=m[m.length-1];C.deletions=Ob([C.deletions,u.deleteSet]),C.insertions=Ob([C.insertions,g])}else m.push(new w5(u.deleteSet,g)),v=!0;!f&&!h&&(this.lastChange=b),ao(u,u.deleteSet,C=>{C instanceof wt&&this.scope.some(E=>E===u.doc||Hu(E,C))&&A1(C,!0)});const k=[{stackItem:m[m.length-1],origin:u.origin,type:f?"redo":"undo",changedParentTypes:u.changedParentTypes},this];v?this.emit("stack-item-added",k):this.emit("stack-item-updated",k)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=_a(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof cn?r.doc!==this.doc:r!==this.doc)&&YO("[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=>FE(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>FE(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=qE(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=qE(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*k5(t){const e=qe(t.restDecoder);for(let n=0;n<e;n++){const r=qe(t.restDecoder),i=t.readClient();let s=qe(t.restDecoder);for(let l=0;l<r;l++){const c=t.readInfo();if(c===10){const u=qe(t.restDecoder);yield new Vr(Ue(i,s),u),s+=u}else if((nm&c)!==0){const u=(c&(ss|Vn))===0,f=new wt(Ue(i,s),null,(c&Vn)===Vn?t.readLeftID():null,null,(c&ss)===ss?t.readRightID():null,u?t.readParentInfo()?t.readString():t.readLeftID():null,u&&(c&Nu)===Nu?t.readString():null,D_(t,c));yield f,s+=f.length}else{const u=t.readLen();yield new Hr(Ue(i,s),u),s+=u}}}}class v1{constructor(e,n){this.gen=k5(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===Vr);return this.curr}}class S1{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const C5=t=>Kh(t,e_,xd),E5=(t,e)=>{if(t.constructor===Hr){const{client:n,clock:r}=t.id;return new Hr(Ue(n,r+e),t.length-e)}else if(t.constructor===Vr){const{client:n,clock:r}=t.id;return new Vr(Ue(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new wt(Ue(r,i+e),null,Ue(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Kh=(t,e=La,n=rl)=>{if(t.length===1)return t[0];const r=t.map(h=>new e(Ga(h)));let i=r.map(h=>new v1(h,!0)),s=null;const l=new n,c=new S1(l);for(;i=i.filter(g=>g.curr!==null),i.sort((g,b)=>{if(g.curr.id.client===b.curr.id.client){const v=g.curr.id.clock-b.curr.id.clock;return v===0?g.curr.constructor===b.curr.constructor?0:g.curr.constructor===Vr?1:-1:v}else return b.curr.id.client-g.curr.id.client}),i.length!==0;){const h=i[0],m=h.curr.id.client;if(s!==null){let g=h.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=h.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)Ws(c,s.struct,s.offset),s={struct:g,offset:0},h.next();else if(s.struct.id.clock+s.struct.length<g.id.clock)if(s.struct.constructor===Vr)s.struct.length=g.id.clock+g.length-s.struct.id.clock;else{Ws(c,s.struct,s.offset);const v=g.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Vr(Ue(m,s.struct.id.clock+s.struct.length),v),offset:0}}else{const v=s.struct.id.clock+s.struct.length-g.id.clock;v>0&&(s.struct.constructor===Vr?s.struct.length-=v:g=E5(g,v)),s.struct.mergeWith(g)||(Ws(c,s.struct,s.offset),s={struct:g,offset:0},h.next())}}else s={struct:h.curr,offset:0},h.next();for(let g=h.curr;g!==null&&g.id.client===m&&g.id.clock===s.struct.id.clock+s.struct.length&&g.constructor!==Vr;g=h.next())Ws(c,s.struct,s.offset),s={struct:g,offset:0}}s!==null&&(Ws(c,s.struct,s.offset),s=null),w1(c);const u=r.map(h=>y1(h)),f=Ob(u);return ec(l,f),l.toUint8Array()},T5=(t,e,n=La,r=rl)=>{const i=r_(e),s=new r,l=new S1(s),c=new n(Ga(t)),u=new v1(c,!1);for(;u.curr;){const h=u.curr,m=h.id.client,g=i.get(m)||0;if(u.curr.constructor===Vr){u.next();continue}if(h.id.clock+h.length>g)for(Ws(l,h,ni(g-h.id.clock,0)),u.next();u.curr&&u.curr.id.client===m;)Ws(l,u.curr,0),u.next();else for(;u.curr&&u.curr.id.client===m&&u.curr.id.clock+u.curr.length<=g;)u.next()}w1(l);const f=y1(c);return ec(s,f),s.toUint8Array()},f_=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:ei(t.encoder.restEncoder)}),t.encoder.restEncoder=yd(),t.written=0)},Ws=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&f_(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),Je(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},w1=t=>{f_(t);const e=t.encoder.restEncoder;Je(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];Je(e,r.written),rm(e,r.restEncoder)}},A5=(t,e,n,r)=>{const i=new n(Ga(t)),s=new v1(i,!1),l=new r,c=new S1(l);for(let f=s.curr;f!==null;f=s.next())Ws(c,e(f),0);w1(c);const u=y1(i);return ec(l,u),l.toUint8Array()},M5=t=>A5(t,YB,La,xd),KE="You must not compute changes after the event-handler fired.";class dm{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=O5(this.currentTarget,this.target))}deletes(e){return Qa(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ei(KE);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 u=s.left;for(;u!==null&&this.adds(u);)u=u.left;if(this.deletes(s))if(u!==null&&this.deletes(u))l="delete",c=h0(u.content.getContent());else return;else u!==null&&this.deletes(u)?(l="update",c=h0(u.content.getContent())):(l="add",c=void 0)}else if(this.deletes(s))l="delete",c=h0(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 Ei(KE);const n=this.target,r=nl(),i=nl(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const u=()=>{c&&s.push(c)};for(let f=n._start;f!==null;f=f.right)f.deleted?this.deletes(f)&&!this.adds(f)&&((c===null||c.delete===void 0)&&(u(),c={delete:0}),c.delete+=f.length,i.add(f)):this.adds(f)?((c===null||c.insert===void 0)&&(u(),c={insert:[]}),c.insert=c.insert.concat(f.content.getContent()),r.add(f)):((c===null||c.retain===void 0)&&(u(),c={retain:0}),c.retain+=f.length);c!==null&&c.retain===void 0&&u()}this._changes=e}return e}}const O5=(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},On=()=>{YO("Invalid access: Add Yjs type to a document before reading data.")},h_=80;let k1=0;class _5{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=k1++}}const D5=t=>{t.timestamp=k1++},p_=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=k1++},R5=(t,e,n)=>{if(t.length>=h_){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return p_(r,e,n),r}else{const r=new _5(e,n);return t.push(r),r}},fm=(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)=>xh(e-s.index)<xh(e-l.index)?s:l);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,D5(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&&xh(n.index-i)<r.parent.length/h_?(p_(n,r,i),n):R5(t._searchMarker,r,i)},Pu=(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=ni(e,i.index+n))}},hm=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;_i(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;s_(r._eH,n,e)};class cn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=IE(),this._dEH=IE(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Fr()}clone(){throw Fr()}_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){BE(this._eH,e)}observeDeep(e){BE(this._dEH,e)}unobserve(e){UE(this._eH,e)}unobserveDeep(e){UE(this._dEH,e)}toJSON(){}}const m_=(t,e,n)=>{t.doc??On(),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},g_=t=>{t.doc??On();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},y_=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Ho(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},$u=(t,e)=>{let n=0,r=t._start;for(t.doc??On();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}},b_=(t,e)=>{const n=[];return $u(t,(r,i)=>{n.push(e(r,i,t))}),n},N5=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}}}},x_=(t,e)=>{t.doc??On();const n=fm(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}},Yh=(t,e,n,r)=>{let i=n;const s=t.doc,l=s.clientID,c=s.store,u=n===null?e._start:n.right;let f=[];const h=()=>{f.length>0&&(i=new wt(Ue(l,Vt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new sl(f)),i.integrate(t,0),f=[])};r.forEach(m=>{if(m===null)f.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:f.push(m);break;default:switch(h(),m.constructor){case Uint8Array:case ArrayBuffer:i=new wt(Ue(l,Vt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new Sd(new Uint8Array(m))),i.integrate(t,0);break;case Ti:i=new wt(Ue(l,Vt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new wd(m)),i.integrate(t,0);break;default:if(m instanceof cn)i=new wt(Ue(l,Vt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new si(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},v_=()=>Ei("Length exceeded!"),S_=(t,e,n,r)=>{if(n>e._length)throw v_();if(n===0)return e._searchMarker&&Pu(e._searchMarker,n,r.length),Yh(t,e,null,r);const i=n,s=fm(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&&tr(t,Ue(l.id.client,l.id.clock+n));break}n-=l.length}return e._searchMarker&&Pu(e._searchMarker,i,r.length),Yh(t,e,l,r)},z5=(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 Yh(t,e,i,n)},w_=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,l=fm(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&&tr(t,Ue(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&tr(t,Ue(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw v_();e._searchMarker&&Pu(e._searchMarker,i,-s+r)},Wh=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},C1=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,l=s.clientID;let c;if(r==null)c=new sl([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new sl([r]);break;case Uint8Array:c=new Sd(r);break;case Ti:c=new wd(r);break;default:if(r instanceof cn)c=new si(r);else throw new Error("Unexpected content type")}new wt(Ue(l,Vt(s.store,l)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},E1=(t,e)=>{t.doc??On();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},k_=t=>{const e={};return t.doc??On(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},C_=(t,e)=>{t.doc??On();const n=t._map.get(e);return n!==void 0&&!n.deleted},L5=(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&&Ho(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Wf=t=>(t.doc??On(),J6(t._map.entries(),e=>!e[1].deleted));class j5 extends dm{}class Ca extends cn{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 cn?n.clone():n)),e}get length(){return this.doc??On(),this._length}_callObserver(e,n){super._callObserver(e,n),hm(this,e,new j5(this,e))}insert(e,n){this.doc!==null?yt(this.doc,r=>{S_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?yt(this.doc,n=>{z5(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?yt(this.doc,r=>{w_(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return x_(this,e)}toArray(){return g_(this)}slice(e=0,n=this.length){return m_(this,e,n)}toJSON(){return this.map(e=>e instanceof cn?e.toJSON():e)}map(e){return b_(this,e)}forEach(e){$u(this,e)}[Symbol.iterator](){return N5(this)}_write(e){e.writeTypeRef(lU)}}const I5=t=>new Ca;class B5 extends dm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class ja extends cn{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 ja}clone(){const e=new ja;return this.forEach((n,r)=>{e.set(r,n instanceof cn?n.clone():n)}),e}_callObserver(e,n){hm(this,e,new B5(this,e,n))}toJSON(){this.doc??On();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof cn?i.toJSON():i}}),e}get size(){return[...Wf(this)].length}keys(){return v0(Wf(this),e=>e[0])}values(){return v0(Wf(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return v0(Wf(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??On(),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?yt(this.doc,n=>{Wh(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?yt(this.doc,r=>{C1(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return E1(this,e)}has(e){return C_(this,e)}clear(){this.doc!==null?yt(this.doc,e=>{this.forEach(function(n,r,i){Wh(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(aU)}}const U5=t=>new ja,Xs=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&qB(t,e);class Nb{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Dn(),this.right.content.constructor){case Gt:this.right.deleted||tc(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 YE=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Gt:e.right.deleted||tc(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&tr(t,Ue(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},Gf=(t,e,n,r)=>{const i=new Map,s=r?fm(e,n):null;if(s){const l=new Nb(s.p.left,s.p,s.index,i);return YE(t,l,n-s.index)}else{const l=new Nb(null,e._start,0,i);return YE(t,l,n)}},E_=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Gt&&Xs(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 u=n.left,f=n.right,h=new wt(Ue(s,Vt(i.store,s)),u,u&&u.lastId,f,f&&f.id,e,null,new Gt(c,l));h.integrate(t,0),n.right=h,n.forward()})},tc=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},T_=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Gt&&Xs(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},A_=(t,e,n,r)=>{const i=t.doc,s=i.clientID,l=new Map;for(const c in r){const u=r[c],f=n.currentAttributes.get(c)??null;if(!Xs(f,u)){l.set(c,f);const{left:h,right:m}=n;n.right=new wt(Ue(s,Vt(i.store,s)),h,h&&h.lastId,m,m&&m.id,e,null,new Gt(c,u)),n.right.integrate(t,0),n.forward()}}return l},k0=(t,e,n,r,i)=>{n.currentAttributes.forEach((g,b)=>{i[b]===void 0&&(i[b]=null)});const s=t.doc,l=s.clientID;T_(n,i);const c=A_(t,e,n,i),u=r.constructor===String?new ii(r):r instanceof cn?new si(r):new gl(r);let{left:f,right:h,index:m}=n;e._searchMarker&&Pu(e._searchMarker,n.index,u.getLength()),h=new wt(Ue(l,Vt(s.store,l)),f,f&&f.lastId,h,h&&h.id,e,null,u),h.integrate(t,0),n.right=h,n.index=m,n.forward(),E_(t,e,n,c)},WE=(t,e,n,r,i)=>{const s=t.doc,l=s.clientID;T_(n,i);const c=A_(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===Gt));){if(!n.right.deleted)switch(n.right.content.constructor){case Gt:{const{key:u,value:f}=n.right.content,h=i[u];if(h!==void 0){if(Xs(h,f))c.delete(u);else{if(r===0)break e;c.set(u,f)}n.right.delete(t)}else n.currentAttributes.set(u,f);break}default:r<n.right.length&&tr(t,Ue(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let u="";for(;r>0;r--)u+=`
66
+ `;n.right=new wt(Ue(l,Vt(s.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ii(u)),n.right.integrate(t,0),n.forward()}E_(t,e,n,c)},M_=(t,e,n,r,i)=>{let s=e;const l=$r();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Gt){const f=s.content;l.set(f.key,f)}s=s.right}let c=0,u=!1;for(;e!==s;){if(n===e&&(u=!0),!e.deleted){const f=e.content;switch(f.constructor){case Gt:{const{key:h,value:m}=f,g=r.get(h)??null;(l.get(h)!==f||g===m)&&(e.delete(t),c++,!u&&(i.get(h)??null)===m&&g!==m&&(g===null?i.delete(h):i.set(h,g))),!u&&!e.deleted&&tc(i,f);break}}}e=e.right}return c},H5=(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===Gt){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},V5=t=>{let e=0;return yt(t.doc,n=>{let r=t._start,i=t._start,s=$r();const l=kb(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Gt:tc(l,i.content);break;default:e+=M_(n,r,i,s,l),s=kb(l),r=i;break}i=i.right}}),e},P5=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&&c_(t,n.store.clients.get(r),s,i,l=>{!l.deleted&&l.content.constructor===Gt&&l.constructor!==Hr&&e.add(l.parent)})}yt(n,r=>{ao(t,t.deleteSet,i=>{if(i instanceof Hr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Gt?e.add(s):H5(r,i)});for(const i of e)V5(i)})},GE=(t,e,n)=>{const r=n,i=kb(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case si:case gl:case ii:n<e.right.length&&tr(t,Ue(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&M_(t,s,e.right,i,e.currentAttributes);const l=(e.left||e.right).parent;return l._searchMarker&&Pu(l._searchMarker,e.index,-r+n),e};class $5 extends dm{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=[];yt(e,r=>{const i=new Map,s=new Map;let l=this.target._start,c=null;const u={};let f="",h=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 f=="object"||f.length>0)&&(b={insert:f},i.size>0&&(b.attributes={},i.forEach((v,k)=>{v!==null&&(b.attributes[k]=v)}))),f="";break;case"retain":h>0&&(b={retain:h},FB(u)||(b.attributes=PB({},u))),h=0;break}b&&n.push(b),c=null}};for(;l!==null;){switch(l.content.constructor){case si:case gl:this.adds(l)?this.deletes(l)||(g(),c="insert",f=l.content.getContent()[0],g()):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=1):l.deleted||(c!=="retain"&&(g(),c="retain"),h+=1);break;case ii:this.adds(l)?this.deletes(l)||(c!=="insert"&&(g(),c="insert"),f+=l.content.str):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=l.length):l.deleted||(c!=="retain"&&(g(),c="retain"),h+=l.length);break;case Gt:{const{key:b,value:v}=l.content;if(this.adds(l)){if(!this.deletes(l)){const k=i.get(b)??null;Xs(k,v)?v!==null&&l.delete(r):(c==="retain"&&g(),Xs(v,s.get(b)??null)?delete u[b]:u[b]=v)}}else if(this.deletes(l)){s.set(b,v);const k=i.get(b)??null;Xs(k,v)||(c==="retain"&&g(),u[b]=k)}else if(!l.deleted){s.set(b,v);const k=u[b];k!==void 0&&(Xs(k,v)?k!==null&&l.delete(r):(c==="retain"&&g(),v===null?delete u[b]:u[b]=v))}l.deleted||(c==="insert"&&g(),tc(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 co extends cn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??On(),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 co}clone(){const e=new co;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new $5(this,e,n);hm(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??On();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ii&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?yt(this.doc,r=>{const i=new Nb(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)===`
67
+ `?l.insert.slice(0,-1):l.insert;(typeof c!="string"||c.length>0)&&k0(r,this,i,c,l.attributes||{})}else l.retain!==void 0?WE(r,this,i,l.retain,l.attributes||{}):l.delete!==void 0&&GE(r,i,l.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??On();const i=[],s=new Map,l=this.doc;let c="",u=this._start;function f(){if(c.length>0){const m={};let g=!1;s.forEach((v,k)=>{g=!0,m[k]=v});const b={insert:c};g&&(b.attributes=m),i.push(b),c=""}}const h=()=>{for(;u!==null;){if(Ho(u,e)||n!==void 0&&Ho(u,n))switch(u.content.constructor){case ii:{const m=s.get("ychange");e!==void 0&&!Ho(u,e)?(m===void 0||m.user!==u.id.client||m.type!=="removed")&&(f(),s.set("ychange",r?r("removed",u.id):{type:"removed"})):n!==void 0&&!Ho(u,n)?(m===void 0||m.user!==u.id.client||m.type!=="added")&&(f(),s.set("ychange",r?r("added",u.id):{type:"added"})):m!==void 0&&(f(),s.delete("ychange")),c+=u.content.str;break}case si:case gl:{f();const m={insert:u.content.getContent()[0]};if(s.size>0){const g={};m.attributes=g,s.forEach((b,v)=>{g[v]=b})}i.push(m);break}case Gt:Ho(u,e)&&(f(),tc(s,u.content));break}u=u.right}f()};return e||n?yt(l,m=>{e&&Db(m,e),n&&Db(m,n),h()},"cleanup"):h(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?yt(i,s=>{const l=Gf(s,this,e,!r);r||(r={},l.currentAttributes.forEach((c,u)=>{r[u]=c})),k0(s,this,l,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?yt(i,s=>{const l=Gf(s,this,e,!r);k0(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?yt(r,i=>{GE(i,Gf(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?yt(i,s=>{const l=Gf(s,this,e,!1);l.right!==null&&WE(s,this,l,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?yt(this.doc,n=>{Wh(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?yt(this.doc,r=>{C1(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return E1(this,e)}getAttributes(){return k_(this)}_write(e){e.writeTypeRef(cU)}}const F5=t=>new co;class C0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??On()}[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===an||n.constructor===il)&&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 il extends cn{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 il}clone(){const e=new il;return e.insert(0,this.toArray().map(n=>n instanceof cn?n.clone():n)),e}get length(){return this.doc??On(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new C0(this,e)}querySelector(e){e=e.toUpperCase();const r=new C0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),lo(new C0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){hm(this,e,new Y5(this,n,e))}toString(){return b_(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),$u(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?yt(this.doc,r=>{S_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)yt(this.doc,r=>{const i=e&&e instanceof cn?e._item:e;Yh(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 Ei("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?yt(this.doc,r=>{w_(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return g_(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return x_(this,e)}slice(e=0,n=this.length){return m_(this,e,n)}forEach(e){$u(this,e)}_write(e){e.writeTypeRef(dU)}}const q5=t=>new il;class an extends il{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 an(this.nodeName)}clone(){const e=new an(this.nodeName),n=this.getAttributes();return $B(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof cn?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 u=r[c];n.push(u+'="'+e[u]+'"')}const s=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${s}${l}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?yt(this.doc,n=>{Wh(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?yt(this.doc,r=>{C1(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return E1(this,e)}hasAttribute(e){return C_(this,e)}getAttributes(e){return e?L5(this,e):k_(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 $u(this,l=>{i.appendChild(l.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(uU),e.writeKey(this.nodeName)}}const K5=t=>new an(t.readKey());class Y5 extends dm{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 Gh extends ja{constructor(e){super(),this.hookName=e}_copy(){return new Gh(this.hookName)}clone(){const e=new Gh(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(fU),e.writeKey(this.hookName)}}const W5=t=>new Gh(t.readKey());class Pn extends co{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 Pn}clone(){const e=new Pn;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(hU)}}const G5=t=>new Pn;class T1{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Fr()}mergeWith(e){return!1}write(e,n,r){throw Fr()}integrate(e,n){throw Fr()}}const Z5=0;class Hr extends T1{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),a_(e.doc.store,this)}write(e,n){e.writeInfo(Z5),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Sd{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Sd(this.content)}splice(e){throw Fr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const J5=t=>new Sd(t.readBuf());class Fu{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Fu(this.len)}splice(e){const n=new Fu(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Bu(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 X5=t=>new Fu(t.readLen()),O_=(t,e)=>new Ti({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class wd{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 wd(O_(this.doc.guid,this.opts))}splice(e){throw Fr()}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 Q5=t=>new wd(O_(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 Fr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const eU=t=>new gl(t.readJSON());class Gt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Gt(this.key,this.value)}splice(e){throw Fr()}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 tU=t=>new Gt(t.readKey(),t.readJSON());class Zh{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Zh(this.arr)}splice(e){const n=new Zh(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 nU=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 Zh(n)},rU=Vh("node_env")==="development";class sl{constructor(e){this.arr=e,rU&&kO(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new sl(this.arr)}splice(e){const n=new sl(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 iU=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new sl(n)};class ii{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ii(this.str)}splice(e){const n=new ii(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 sU=t=>new ii(t.readString()),oU=[I5,U5,F5,K5,q5,W5,G5],lU=0,aU=1,cU=2,uU=3,dU=4,fU=5,hU=6;class si{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new si(this.type._copy())}splice(e){throw Fr()}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 pU=t=>new si(oU[t.readTypeRef()](t)),zb=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Ue(n.client,n.clock+r)),i=ka(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof wt);return{item:i,diff:r}},A1=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Jh=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new wt(Ue(r,i+n),e,Ue(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=Ue(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},ZE=(t,e)=>r1(t,n=>Qa(n.deletions,e)),__=(t,e,n,r,i,s)=>{const l=t.doc,c=l.store,u=l.clientID,f=e.redone;if(f!==null)return tr(t,f);let h=e.parent._item,m=null,g;if(h!==null&&h.deleted===!0){if(h.redone===null&&(!n.has(h)||__(t,h,n,r,i,s)===null))return null;for(;h.redone!==null;)h=tr(t,h.redone)}const b=h===null?e.parent:h.content.type;if(e.parentSub===null){for(m=e.left,g=e;m!==null;){let E=m;for(;E!==null&&E.parent._item!==h;)E=E.redone===null?null:tr(t,E.redone);if(E!==null&&E.parent._item===h){m=E;break}m=m.left}for(;g!==null;){let E=g;for(;E!==null&&E.parent._item!==h;)E=E.redone===null?null:tr(t,E.redone);if(E!==null&&E.parent._item===h){g=E;break}g=g.right}}else if(g=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||Qa(r,m.right.id)||ZE(s.undoStack,m.right.id)||ZE(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=tr(t,m.redone);if(m&&m.right!==null)return null}else m=b._map.get(e.parentSub)||null;const v=Vt(c,u),k=Ue(u,v),C=new wt(k,m,m&&m.lastId,g,g&&g.id,b,e.parentSub,e.content.copy());return e.redone=k,A1(C,!0),C.integrate(t,0),C};let wt=class Lb extends T1{constructor(e,n,r,i,s,l,c,u){super(e,u.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=l,this.parentSub=c,this.redone=null,this.content=u,this.info=this.content.isCountable()?CE:0}set marker(e){(this.info&m0)>0!==e&&(this.info^=m0)}get marker(){return(this.info&m0)>0}get keep(){return(this.info&kE)>0}set keep(e){this.keep!==e&&(this.info^=kE)}get countable(){return(this.info&CE)>0}get deleted(){return(this.info&p0)>0}set deleted(e){this.deleted!==e&&(this.info^=p0)}markDeleted(){this.info|=p0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Vt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Vt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===wa&&this.id.client!==this.parent.client&&this.parent.clock>=Vt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=VE(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=tr(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Hr||this.right&&this.right.constructor===Hr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Lb?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Lb&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===wa){const r=ka(n,this.parent);r.constructor===Hr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=VE(e,e.doc.store,Ue(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),pa(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(pa(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),a_(e.doc.store,this),this.content.integrate(e,this),$E(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Hr(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:Ue(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&pa(e.origin,this.lastId)&&this.right===e&&pa(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(),Bu(e.deleteSet,this.id.client,this.id.clock,this.length),$E(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Dn();this.content.gc(e),n?b5(e,this,new Hr(this.id,this.length)):this.content=new Fu(this.length)}write(e,n){const r=n>0?Ue(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,l=this.content.getRef()&nm|(r===null?0:Vn)|(i===null?0:ss)|(s===null?0:Nu);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 u=c._item;if(u===null){const f=Uu(c);e.writeParentInfo(!0),e.writeString(f)}else e.writeParentInfo(!1),e.writeLeftID(u.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===wa?(e.writeParentInfo(!1),e.writeLeftID(c)):Dn();s!==null&&e.writeString(s)}this.content.write(e,n)}};const D_=(t,e)=>mU[e&nm](t),mU=[()=>{Dn()},X5,nU,J5,sU,eU,tU,pU,iU,Q5,()=>{Dn()}],gU=10;class Vr extends T1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Dn()}write(e,n){e.writeInfo(gU),Je(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const R_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},N_="__ $YJS$ __";R_[N_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");R_[N_]=!0;function z_(t){return t?t+1:0}function pm(t){let e=0;return t.forEach(n=>{n.isText?e+=n.text.length:n.type.name==="hardBreak"&&(e+=1)}),e}function kd(t){if(t.isTextblock)return pm(t);let e=0;for(let n=0;n<t.childCount;n++)n>0&&(e+=1),e+=kd(t.child(n));return e}function L_(t,e,n){if(t.isTextblock)return Sr(n+Math.min(e,pm(t)));let r=0,i=n;for(let s=0;s<t.childCount;s++){const l=t.child(s),c=i+1;s>0&&(r+=1);const u=kd(l);if(r+u>e)return L_(l,e-r,c);r+=u,i+=l.nodeSize}return Sr(n+t.content.size)}function ol(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,u=l.type.name==="heading"?z_(l.attrs.level||1):0,f=kd(l),h=u+f;if(n+h>e){const m=e-n,g=Math.max(0,m-u);return L_(l,g,c)}if(n+=h,r+=l.nodeSize,s<i-1&&(n+=1,n>e))return Sr(c+l.content.size)}return Sr(t.content.size)}function j_(t,e,n){if(t.isTextblock)return Math.min(e-n,pm(t));let r=0,i=n;for(let s=0;s<t.childCount;s++){const l=t.child(s),c=i+1;s>0&&(r+=1);const u=i+l.nodeSize;if(e<u)return e<=c?r:r+j_(l,e,c);r+=kd(l),i+=l.nodeSize}return r}function Ia(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,u=l.type.name==="heading"?z_(l.attrs.level||1):0,f=kd(l),h=r+l.nodeSize;if(e<h)return e<=c?gh(n+u):gh(n+u+j_(l,e,c));n+=u+f,r+=l.nodeSize,s<i-1&&(n+=1)}return gh(n)}function I_(t,e,n,r){if(e.isTextblock){let l=0;for(let c=0;c<t.length;c++){const u=t.get(c);if(u instanceof Pn){if(u===r.type)return Sr(n+Math.min(l+r.index,pm(e)));l+=u.length}}return null}let i=n;t.length!==e.childCount&&console.warn(`[positions] Y.js/PM child count mismatch: yEl(${t.nodeName}).length=${t.length} vs pmNode(${e.type.name}).childCount=${e.childCount}`);const s=Math.min(t.length,e.childCount);for(let l=0;l<s;l++){const c=t.get(l),u=e.child(l),f=i+1;if(c instanceof an){const h=I_(c,u,f,r);if(h!==null)return h}i+=u.nodeSize}return null}function JE(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),u=r+1;if(l instanceof an){const f=I_(l,c,u,n);if(f!==null)return f}r+=c.nodeSize}return null}function B_(t,e,n){let r,i;try{const u=Go(n.fromRel),f=Go(n.toRel);r=_b(u,t),i=_b(f,t)}catch(u){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",u),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),l=JE(e,s,r),c=JE(e,s,i);return l===null||c===null?null:{from:l,to:c}}function Xh(t,e,n){if(t.relRange&&n){const r=B_(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:ol(e,t.range.from),to:ol(e,t.range.to),method:"flat"}:null}function U_(t,e){return{from:Ia(t,e.from),to:Ia(t,e.to)}}const yU=[0,.2,.4];function bU({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:l,capturedAnchor:c,onCapturedAnchorChange:u,inputRef:f,reduceMotion:h}){const m=h?"auto":"smooth",[g,b]=M.useState([]),[v,k]=M.useState(""),C=M.useRef(null),E=M.useRef(null);M.useEffect(()=>{f&&(f.current=E.current)},[f]),M.useEffect(()=>{if(!t)return;const W=t.getMap(_C),oe=()=>{const ne=[];W.forEach(se=>{ne.push(se)}),ne.sort((se,be)=>se.timestamp-be.timestamp||se.id.localeCompare(be.id)),b(ne)};return W.observe(oe),oe(),()=>W.unobserve(oe)},[t]);const j=M.useRef(!1);M.useEffect(()=>{var W;if(!i&&j.current){j.current=!1;return}j.current=!!i,(W=C.current)==null||W.scrollIntoView({behavior:m})},[g,i,m]),M.useEffect(()=>{var W;l&&((W=C.current)==null||W.scrollIntoView({behavior:m}))},[l,m]);const N=M.useCallback(()=>{if(!t||!v.trim())return;const W=t.getMap(_C),oe={id:GI(),author:"user",text:v.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};W.set(oe.id,oe),k(""),u(null)},[t,v,n,c,u]),q=M.useCallback(W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),N())},[N]),H=M.useCallback((W,oe)=>{if(!(!e||oe&&oe!==n))try{const ne=ol(e.state.doc,W.from),se=ol(e.state.doc,W.to);e.chain().focus().setTextSelection({from:ne,to:se}).scrollIntoView().run()}catch(ne){console.warn("[ChatPanel] Could not scroll to anchor:",ne instanceof Error?ne.message:ne)}},[e,n]),R=W=>{if(!W)return null;const oe=r.find(ne=>ne.id===W);return(oe==null?void 0:oe.fileName)??null},I=g.filter(W=>W.author==="claude"&&!W.read).length,Q=M.useCallback(async()=>{try{await fetch(`http://localhost:${fd}/api/chat`,{method:"DELETE"})}catch(W){console.warn("[ChatPanel] Failed to clear chat:",W)}},[]);return S.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"var(--tandem-surface-muted)",flex:1,minHeight:0},children:[S.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)",fontWeight:600,fontSize:"14px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Chat",S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[I>0&&S.jsx("span",{style:{background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:I}),g.length>0&&S.jsx("button",{onClick:Q,title:"Clear chat history","data-testid":"clear-chat-btn",style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-subtle)",fontSize:"13px",padding:"2px 4px",lineHeight:1},children:"Clear"})]})]}),S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[g.length===0&&S.jsx("div",{style:{color:"var(--tandem-fg-subtle)",fontSize:"13px",textAlign:"center",marginTop:"24px"},children:"No messages yet. Select text and send a message to Claude."}),g.map(W=>S.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:W.author==="user"?"var(--tandem-accent-bg)":"var(--tandem-surface)",border:`1px solid ${W.author==="user"?"var(--tandem-accent-border)":"var(--tandem-border)"}`,fontSize:"13px",color:"var(--tandem-fg)"},children:[S.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[S.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:W.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)",textTransform:"uppercase"},children:W.author}),W.documentId&&S.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-muted)",background:"var(--tandem-surface-muted)",padding:"1px 6px",borderRadius:"4px"},children:R(W.documentId)??W.documentId}),S.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginLeft:"auto"},children:new Date(W.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),W.anchor&&S.jsx("div",{onClick:()=>H(W.anchor,W.documentId),className:"chat-anchor-quote",style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid var(--tandem-accent-border)",background:"var(--tandem-accent-bg)",fontSize:"12px",color:"var(--tandem-accent-fg-strong)",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:oe=>{oe.currentTarget.style.maxHeight="500px"},onMouseLeave:oe=>{oe.currentTarget.style.maxHeight="60px"},children:W.anchor.textSnapshot}),W.author==="claude"?S.jsx("div",{className:"chat-markdown",children:S.jsx($I,{children:W.text})}):S.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:W.text})]},W.id)),i&&S.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:"var(--tandem-author-claude)",display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:yU.map(W=>S.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--tandem-author-claude)",animation:`tandem-typing-bounce 1.2s ease-in-out ${W}s infinite`}},W))}),S.jsx("span",{children:s??"Claude is thinking..."})]}),S.jsx("div",{ref:C})]}),c&&S.jsxs("div",{style:{padding:"4px 12px",background:"var(--tandem-accent-bg)",borderTop:"1px solid var(--tandem-accent-border)",fontSize:"11px",color:"var(--tandem-accent-fg-strong)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),S.jsx("button",{onClick:()=>u(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"x"})]}),S.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--tandem-border)",display:"flex",gap:"8px"},children:[S.jsx("textarea",{ref:E,value:v,onChange:W=>k(W.target.value),onKeyDown:q,placeholder:"Message Claude...",rows:2,style:{flex:1,padding:"8px",border:"1px solid var(--tandem-border-strong)",borderRadius:"6px",fontSize:"13px",resize:"none",outline:"none",fontFamily:"inherit",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),S.jsx("button",{onClick:N,disabled:!v.trim(),style:{padding:"8px 12px",background:v.trim()?"var(--tandem-accent)":"var(--tandem-border-strong)",color:v.trim()?"var(--tandem-accent-fg)":"var(--tandem-fg-subtle)",border:"none",borderRadius:"6px",cursor:v.trim()?"pointer":"default",fontSize:"13px",fontWeight:500,alignSelf:"flex-end"},children:"Send"})]}),S.jsx("style",{children:`
68
+ @keyframes tandem-typing-bounce {
69
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
70
+ 30% { transform: translateY(-4px); opacity: 1; }
71
+ }
72
+ `})]})}function qu(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}:{},...typeof e.rev=="number"?{rev:e.rev}:{}};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"})}const cs=`http://localhost:${fd}/api`;function xU(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 vU(t){return t.toLowerCase().endsWith(".docx")}async function H_(t){if(vU(t.name)){const e=await t.arrayBuffer();return xU(e)}return t.text()}function SU({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=M.useState(!1);if(e!=="docx")return null;const s=t.filter(f=>f.status==="accepted"),l=t.filter(f=>f.status==="pending"),c=s.length===0||r;async function u(){if(c||!n)return;let f=`Apply ${s.length} change(s) as tracked revisions?
73
+
74
+ The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
75
+
76
+ Your original file will be backed up.`;if(l.length>0&&(f+=`
77
+
78
+ ⚠ ${l.length} annotation(s) are still pending review and will not be applied.`),!!confirm(f)){i(!0);try{const h=await fetch(`${cs}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await h.json().catch(b=>(console.error("[ApplyChanges] Failed to parse response JSON:",b),null));if(!h.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${h.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(`
79
+ Backup saved to:
80
+ ${g.backupPath}`),alert(b.join(" "))}else alert("Changes applied successfully.")}catch(h){console.error("[ApplyChanges] Request failed:",h),alert(h instanceof TypeError?"Could not reach the server.":`Apply failed: ${h instanceof Error?h.message:String(h)}`)}finally{i(!1)}}}return S.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:u,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 ${c?"var(--tandem-border)":"var(--tandem-info-border)"}`,borderRadius:"4px",background:c?"var(--tandem-surface-muted)":"var(--tandem-info)",color:c?"var(--tandem-fg-subtle)":"var(--tandem-info-fg)",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}const E0={background:"var(--tandem-warning-bg)",border:"var(--tandem-warning-border)",color:"var(--tandem-warning-fg-strong)"};function wU({annotationId:t,isPending:e,isEditing:n,undoable:r,onAccept:i,onDismiss:s,onUndo:l,onRemove:c}){const[u,f]=M.useState(!1),h=M.useRef(null);return M.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),e&&!n&&(i||s)?S.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[i&&S.jsx("button",{"data-testid":`accept-btn-${t}`,onClick:m=>{m.stopPropagation(),i(t)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)",cursor:"pointer"},children:"Accept"}),s&&S.jsx("button",{"data-testid":`dismiss-btn-${t}`,onClick:m=>{m.stopPropagation(),s(t)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)",cursor:"pointer"},children:"Reject"})]}):e&&!n&&c?S.jsx("button",{"data-testid":`remove-btn-${t}`,onClick:m=>{m.stopPropagation(),c(t)},style:{marginTop:"6px",padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface-muted)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Remove"}):!e&&r&&l?S.jsxs("div",{style:{marginTop:"4px"},children:[S.jsx("button",{"data-testid":"undo-btn",onClick:m=>{m.stopPropagation(),l(t)||(f(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>f(!1),3e3))},style:{padding:"1px 6px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-accent)",cursor:"pointer",textDecoration:"underline"},children:"Undo"}),u&&S.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-error-fg)",marginTop:"2px"},children:"Can't undo — text has changed."})]}):null}function kU({annotationId:t,hasSuggestedText:e,editText:n,editNewText:r,editReason:i,onChangeEditText:s,onChangeEditNewText:l,onChangeEditReason:c,onKeyDown:u,onSave:f,onCancel:h}){return S.jsxs("div",{style:{marginTop:"4px"},onClick:m=>m.stopPropagation(),children:[e?S.jsxs(S.Fragment,{children:[S.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginBottom:"2px"},children:"Replacement text"}),S.jsx("textarea",{"data-testid":`edit-newtext-${t}`,value:r,onChange:m=>l(m.target.value),onKeyDown:u,style:Ch,autoFocus:!0}),S.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),S.jsx("textarea",{"data-testid":`edit-reason-${t}`,value:i,onChange:m=>c(m.target.value),onKeyDown:u,style:Ch})]}):S.jsx("textarea",{"data-testid":`edit-text-${t}`,value:n,onChange:m=>s(m.target.value),onKeyDown:u,style:Ch,autoFocus:!0}),S.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[S.jsx("button",{"data-testid":`edit-save-btn-${t}`,onClick:m=>{m.stopPropagation(),f()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)",cursor:"pointer"},children:"Save"}),S.jsx("button",{"data-testid":`edit-cancel-btn-${t}`,onClick:m=>{m.stopPropagation(),h()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]})}function CU(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 EU({replies:t}){return t.length===0?null:S.jsx("div",{"data-testid":"comment-thread",style:{marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--tandem-border)"},children:t.map(e=>S.jsxs("div",{"data-testid":`reply-${e.id}`,style:{padding:"4px 0",fontSize:"12px",lineHeight:"1.4"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[S.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:e.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)"},children:e.author==="claude"?"Claude":"You"}),S.jsxs("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[e.editedAt&&S.jsx("span",{style:{fontStyle:"italic",marginRight:"4px"},children:"(edited)"}),CU(e.timestamp)]})]}),S.jsx("p",{style:{margin:0,color:"var(--tandem-fg)"},children:e.text})]},e.id))})}function TU({annotationId:t,replies:e,isPending:n,isEditing:r,onReply:i}){const[s,l]=M.useState(!1),[c,u]=M.useState(""),[f,h]=M.useState(!1),m=!!c.trim();function g(v){v.key==="Escape"&&(v.stopPropagation(),l(!1),u(""))}async function b(){const v=c.trim();if(!(!v||f)){h(!0);try{await(i==null?void 0:i(t,v))!==!1&&(u(""),l(!1))}finally{h(!1)}}}return S.jsxs(S.Fragment,{children:[S.jsx(EU,{replies:e}),n&&i&&!r&&S.jsx("div",{style:{marginTop:"6px"},onClick:v=>v.stopPropagation(),children:s?S.jsxs("div",{children:[S.jsx("textarea",{"data-testid":`reply-input-${t}`,value:c,onChange:v=>u(v.target.value),onKeyDown:g,placeholder:"Write a reply...",style:Ch,autoFocus:!0}),S.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[S.jsx("button",{"data-testid":`reply-send-btn-${t}`,onClick:b,disabled:!m||f,style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:m?"var(--tandem-accent-bg)":"var(--tandem-surface-muted)",color:m?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-subtle)",cursor:m?"pointer":"default"},children:"Send"}),S.jsx("button",{"data-testid":`reply-cancel-btn-${t}`,onClick:()=>{l(!1),u("")},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]}):S.jsxs("button",{"data-testid":`reply-btn-${t}`,onClick:()=>l(!0),style:{padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:["Reply",e.length>0?` (${e.length})`:""]})}),!n&&e.length>0&&!i&&S.jsxs("div",{style:{marginTop:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[e.length," ",e.length===1?"reply":"replies"]})]})}const Ch={width:"100%",padding:"4px 6px",fontSize:"12px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",resize:"vertical",fontFamily:"inherit",minHeight:"40px",boxSizing:"border-box",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},AU={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer",lineHeight:1};function MU(t){return t.suggestedText!==void 0?"replacement":t.directedAt==="claude"?"question":t.type}function OU(t){return t==="claude"?"Claude":t==="import"?"Imported":"You"}function _U(t){return t.color?Du[t.color]||"var(--tandem-border)":t.suggestedText!==void 0?"var(--tandem-suggestion)":t.directedAt==="claude"?"var(--tandem-accent)":t.type==="flag"?"var(--tandem-error)":"var(--tandem-author-user)"}const XE=on.memo(function({annotation:e,replies:n=[],isReviewTarget:r,onAccept:i,onDismiss:s,onUndo:l,onEdit:c,onReply:u,onRemove:f,undoable:h,onClick:m}){const g=_U(e),b=e.status==="pending",[v,k]=M.useState(!1),[C,E]=M.useState(""),[j,N]=M.useState(""),[q,H]=M.useState(""),R=e.suggestedText!==void 0,I=MU(e);function Q(){R?(N(e.suggestedText??""),H(e.content)):E(e.content),k(!0)}function W(){const ae=R?JSON.stringify({suggestedText:j,content:q}):C;c==null||c(e.id,ae),k(!1)}function oe(){k(!1)}function ne(ae){ae.key==="Escape"&&(ae.stopPropagation(),oe())}const se=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",be=`${I} annotation${se?": "+se:""}, ${e.status}`;return S.jsxs("div",{onClick:m,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":be,"aria-current":r?"true":void 0,style:{padding:"8px 10px",marginBottom:"6px",borderLeft:`3px solid ${g}`,background:r?"var(--tandem-accent-bg)":"var(--tandem-surface)",borderRadius:"0 4px 4px 0",fontSize:"13px",opacity:b?1:.6,cursor:m?"pointer":"default",outline:r?"2px solid var(--tandem-accent)":"none",transition:"background 0.15s, outline 0.15s"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[S.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[I,!b&&S.jsx("span",{style:{marginLeft:"6px",fontSize:"10px",color:e.status==="accepted"?"var(--tandem-success)":"var(--tandem-error)",fontWeight:600},children:e.status}),b&&c&&!r&&!v&&S.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:ae=>{ae.stopPropagation(),Q()},style:AU,title:"Edit this annotation's content",children:"✎ Edit"})]}),S.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&S.jsx("span",{style:{fontStyle:"italic",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:"(edited)"}),OU(e.author)]})]}),e.textSnapshot&&S.jsx("div",{"data-testid":`annotation-snippet-${e.id}`,style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid var(--tandem-border-strong)",color:"var(--tandem-fg-muted)",fontSize:"12px",fontStyle:"italic",backgroundColor:"var(--tandem-surface-muted)",borderRadius:"2px"},children:e.textSnapshot.length>80?e.textSnapshot.slice(0,77)+"...":e.textSnapshot}),v?S.jsx(kU,{annotationId:e.id,hasSuggestedText:R,editText:C,editNewText:j,editReason:q,onChangeEditText:E,onChangeEditNewText:N,onChangeEditReason:H,onKeyDown:ne,onSave:W,onCancel:oe}):S.jsx("div",{style:{margin:0,color:"var(--tandem-fg)",lineHeight:"1.4"},children:R?S.jsxs(S.Fragment,{children:[S.jsxs("div",{"data-testid":`suggestion-diff-${e.id}`,style:{padding:"4px 8px",marginBottom:e.content?"4px":0,backgroundColor:"var(--tandem-surface-muted)",borderRadius:"3px",fontSize:"12px",lineHeight:"1.5"},children:[e.textSnapshot&&S.jsx("span",{style:{textDecoration:"line-through",color:"var(--tandem-error)",backgroundColor:"var(--tandem-error-bg)",padding:"0 2px",borderRadius:"2px"},children:e.textSnapshot}),e.textSnapshot&&" → ",S.jsx("span",{style:{color:"var(--tandem-success-fg-strong)",backgroundColor:"var(--tandem-success-bg)",padding:"0 2px",borderRadius:"2px"},children:e.suggestedText})]}),e.content&&S.jsx("p",{style:{margin:0,fontSize:"12px",color:"var(--tandem-fg-muted)"},children:e.content})]}):S.jsx("p",{style:{margin:0},children:e.content||"(no note)"})}),S.jsx(wU,{annotationId:e.id,isPending:b,isEditing:v,undoable:h,onAccept:i,onDismiss:s,onUndo:l,onRemove:f}),S.jsx(TU,{annotationId:e.id,replies:n,isPending:b,isEditing:v,onReply:u})]})}),Zf={padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",cursor:"pointer"};function DU({bulkConfirm:t,pendingCount:e,allPendingCount:n,confirmRef:r,onConfirmAccept:i,onConfirmDismiss:s,onCancel:l,onRequestAccept:c,onRequestDismiss:u}){if(e<=1)return null;const f=t==="accept",h=e===n?`${e} annotations?`:`${e} of ${n} pending?`;return S.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"6px",alignItems:"center"},children:t?S.jsxs(S.Fragment,{children:[S.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg)"},children:[f?"Accept":"Reject"," ",h]}),S.jsx("button",{ref:r,"data-testid":"bulk-confirm-btn",onClick:f?i:s,style:{...Zf,background:f?"var(--tandem-success-bg)":"var(--tandem-error-bg)",color:f?"var(--tandem-success-fg-strong)":"var(--tandem-error-fg-strong)",fontWeight:600},children:"Confirm"}),S.jsx("button",{"data-testid":"bulk-cancel-btn",onClick:l,style:{...Zf,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)"},children:"Cancel"})]}):S.jsxs(S.Fragment,{children:[S.jsxs("button",{"data-testid":"bulk-accept-btn",onClick:c,style:{...Zf,background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)"},children:["Accept All (",e,")"]}),S.jsx("button",{"data-testid":"bulk-dismiss-btn",onClick:u,style:{...Zf,background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)"},children:"Reject All"})]})})}function T0({value:t,onChange:e,options:n,testId:r}){return S.jsx("select",{"data-testid":r,value:t,onChange:i=>e(i.target.value),style:{padding:"2px 4px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg)",cursor:"pointer",outline:"none"},children:n.map(i=>S.jsx("option",{value:i.value,children:i.label},i.value))})}function RU({filterType:t,setFilterType:e,filterAuthor:n,setFilterAuthor:r,filterStatus:i,setFilterStatus:s,hasFilters:l,onClearFilters:c}){return S.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[S.jsx(T0,{testId:"filter-type",value:t,onChange:u=>e(u),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"}]}),S.jsx(T0,{testId:"filter-author",value:n,onChange:u=>r(u),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),S.jsx(T0,{testId:"filter-status",value:i,onChange:u=>s(u),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),l&&S.jsx("button",{"data-testid":"clear-filters-btn",onClick:c,style:{background:"none",border:"none",color:"var(--tandem-accent)",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]})}function NU(t,e){M.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 zU(t,e,n){if(t.suggestedText===void 0)return!1;const r=t.suggestedText,i=Xh(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 LU({ydocRef:t,editorRef:e,annotations:n,onActiveAnnotationChange:r,reviewMode:i,onToggleReviewMode:s,onExitReviewMode:l,bulkConfirmRef:c,setBulkConfirm:u,scrollBehavior:f}){const[h,m]=M.useState(0),g=M.useRef(0),b=M.useRef(null),[v,k]=M.useState(new Set),C=M.useRef(null),E=M.useRef(new Map);M.useEffect(()=>()=>{for(const O of E.current.values())clearTimeout(O)},[]);const j=M.useMemo(()=>n.filter(O=>O.status==="pending"),[n]),N=M.useRef(j);N.current=j;function q(O,_){const B=t.current;if(!B)return;const A=B.getMap(Oa),re=A.get(O);if(!re)return;const Z=qu(re);if(A.set(O,{...Z,status:_}),_==="accepted"&&Z.suggestedText!==void 0&&e.current&&!zU(Z,e.current,t.current)){A.set(O,{...Z,status:"pending"});return}C.current=O,k(ie=>new Set(ie).add(O))}function H(O){const _=E.current.get(O);_&&clearTimeout(_),E.current.set(O,setTimeout(()=>{E.current.delete(O),k(B=>{const A=new Set(B);return A.delete(O),A})},3e3))}function R(O){const _=E.current.get(O);_&&(clearTimeout(_),E.current.delete(O)),k(B=>{const A=new Set(B);return A.delete(O),A})}function I(O){const _=t.current;if(!_)return!1;const B=_.getMap(Oa),A=B.get(O);if(!A||A.status==="pending")return R(O),!1;const re=qu(A);if(re.status==="accepted"&&re.suggestedText!==void 0&&e.current)try{const Z=re.suggestedText,ie=re.textSnapshot;if(typeof Z=="string"&&typeof ie=="string"){const me=Xh(re,e.current.state.doc,_);if(!me)return console.warn(`[undo] Cannot resolve range for annotation ${O}, skipping`),H(O),!1;if(e.current.state.doc.textBetween(me.from,me.to)!==Z)return console.warn(`[undo] Text changed since accept for annotation ${O}, skipping`),H(O),!1;e.current.chain().focus().deleteRange({from:me.from,to:me.to}).insertContentAt(me.from,ie).run()}}catch(Z){return console.warn(`[undo] Failed to revert text for annotation ${O}:`,Z),H(O),!1}return B.set(O,{...re,status:"pending"}),R(O),C.current===O&&(C.current=null),!0}function Q(O){q(O,"accepted")}function W(O){q(O,"dismissed")}const oe=M.useCallback(O=>{const _=e.current;if(!_)return;const B=Xh(O,_.state.doc,t.current);if(!B)return;_.chain().focus().setTextSelection({from:B.from,to:B.to}).run();const A=_.view.domAtPos(B.from),re=A.node instanceof HTMLElement?A.node:A.node.parentElement;re==null||re.scrollIntoView({behavior:f,block:"center"})},[f,e,t]),ne=M.useCallback(O=>{const _=N.current;if(_.length===0)return;let B=g.current;B=O==="next"?(B+1)%_.length:(B-1+_.length)%_.length,g.current=B,m(B),oe(_[B])},[oe]),se=M.useCallback(()=>{const O=N.current;if(O.length===0)return;const _=O[g.current];_&&q(_.id,"accepted")},[]),be=M.useCallback(()=>{const O=N.current;if(O.length===0)return;const _=O[g.current];_&&q(_.id,"dismissed")},[]),ae=M.useRef(!1);M.useEffect(()=>{i&&!ae.current&&j.length>0&&(g.current=0,m(0),oe(j[0])),ae.current=i},[i,j,oe]),M.useEffect(()=>{var O;i&&j.length>0?r(((O=j[h])==null?void 0:O.id)??null):r(null)},[i,h,j,r]);const V=M.useCallback(()=>{const _=N.current[g.current];_&&oe(_),l()},[oe,l]),z=M.useCallback(()=>{const O=C.current;O&&I(O)},[]),Y=M.useCallback(()=>{c.current?u(null):l()},[l,c,u]),pe=M.useMemo(()=>({onToggleReviewMode:s,onExitReviewMode:l,navigateReview:ne,acceptCurrent:se,dismissCurrent:be,scrollToCurrentAndExit:V,cancelBulkOrExit:Y,undoLast:z}),[s,l,ne,se,be,V,Y,z]);NU(i,pe),M.useEffect(()=>{if(i&&g.current>=j.length){const O=Math.max(0,j.length-1);g.current=O,m(O)}},[i,j.length]),M.useEffect(()=>{i&&j.length===0&&l()},[i,j.length,l]);const _e=i&&j.length>0?j[h]:null;return{resolveAnnotation:q,undoResolveAnnotation:I,handleAccept:Q,handleDismiss:W,scrollToAnnotation:oe,recentlyResolved:v,reviewIndex:h,reviewTargets:j,activeReviewAnn:_e,confirmRef:b}}function jU({annotations:t,editor:e,ydoc:n,heldCount:r=0,tandemMode:i,onModeChange:s,activeDocFormat:l,documentId:c,reviewMode:u,onToggleReviewMode:f,onExitReviewMode:h,activeAnnotationId:m,onActiveAnnotationChange:g,reduceMotion:b}){const v=b?"auto":"smooth",[k,C]=M.useState("all"),[E,j]=M.useState("all"),[N,q]=M.useState("all"),[H,R]=M.useState(null),I=M.useRef(H);I.current=H;const Q=M.useRef(n),W=M.useRef(e);Q.current=n,W.current=e;const oe=LU({ydocRef:Q,editorRef:W,annotations:t,onActiveAnnotationChange:g,reviewMode:u,onToggleReviewMode:f,onExitReviewMode:h,bulkConfirmRef:I,setBulkConfirm:R,scrollBehavior:v});M.useEffect(()=>{var Z;H&&((Z=oe.confirmRef.current)==null||Z.focus())},[H,oe.confirmRef]);const[ne,se]=M.useState(new Map);M.useEffect(()=>{if(!n){se(new Map);return}const Z=n.getMap(cL);function ie(){const Ae=new Map;Z.forEach(ge=>{const Le=ge;if(Le&&typeof Le=="object"&&Le.annotationId){const ke=Ae.get(Le.annotationId)??[];ke.push(Le),Ae.set(Le.annotationId,ke)}});for(const ge of Ae.values())ge.sort((Le,ke)=>Le.timestamp-ke.timestamp);se(Ae)}ie();const me=()=>ie();return Z.observe(me),()=>Z.unobserve(me)},[n]);const{filtered:be,pending:ae,resolved:V,allPending:z}=M.useMemo(()=>{const Z=[],ie=[];for(const ge of t){ge.status==="pending"&&ie.push(ge);let Le;k==="all"?Le=!0:k==="with-replacement"?Le=ge.suggestedText!==void 0:k==="for-claude"?Le=ge.directedAt==="claude":Le=ge.type===k;const ke=E==="all"||ge.author===E,xt=N==="all"||ge.status===N;Le&&ke&&xt&&Z.push(ge)}const me=Z.filter(ge=>ge.status==="pending"),Ae=Z.filter(ge=>ge.status!=="pending");return{filtered:Z,pending:me,resolved:Ae,allPending:ie}},[t,k,E,N]);function Y(Z,ie){const me=Q.current;if(!me)return;const Ae=me.getMap(Oa),ge=Ae.get(Z);if(!ge)return;const Le=qu(ge);if(Le.suggestedText!==void 0){try{const ke=JSON.parse(ie);Ae.set(Z,{...Le,suggestedText:ke.suggestedText,content:ke.content,editedAt:Date.now()})}catch{console.warn(`[SidePanel] Failed to parse edit payload for annotation ${Z}`)}return}Ae.set(Z,{...Le,content:ie,editedAt:Date.now()})}async function pe(Z){try{const ie=await fetch(`${cs}/remove-annotation`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:Z,documentId:c})});if(!ie.ok){const me=await ie.json().catch(()=>({message:"Unknown error"}));console.error("[Tandem] Remove annotation failed:",me)}}catch(ie){console.error("[Tandem] Remove annotation failed:",ie)}}async function _e(Z,ie){try{const me=await fetch(`${cs}/annotation-reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:Z,text:ie,documentId:c})});if(!me.ok){const Ae=await me.json().catch(()=>({}));return console.warn(`[SidePanel] Reply failed (${me.status}): ${Ae.message??"unknown error"}`),!1}return!0}catch(me){return console.error("[SidePanel] Reply request failed:",me),!1}}function O(Z){for(const ie of ae)oe.resolveAnnotation(ie.id,Z);R(null)}M.useEffect(()=>{R(null)},[k,E,N]);const _=M.useRef(null),B=M.useRef(!1),A=M.useRef(m);A.current=m,M.useEffect(()=>{var ie;if(!B.current){B.current=!0;return}const Z=A.current;if(Z){const me=document.querySelector(`[data-testid="annotation-card-${Z}"]`);if(me){me.scrollIntoView({block:"center"});return}console.warn(`[tandem] SidePanel: active annotation ${Z} not found on filter change; scrolling to top`)}(ie=_.current)==null||ie.scrollTo({top:0})},[k,E,N]),M.useEffect(()=>{if(!m)return;const Z=setTimeout(()=>{const ie=document.querySelector(`[data-testid="annotation-card-${m}"]`);if(ie){ie.scrollIntoView({behavior:v,block:"nearest"}),ie.classList.add("tandem-annotation-flash");const me=()=>ie.classList.remove("tandem-annotation-flash");ie.addEventListener("animationend",me,{once:!0})}else console.warn(`[tandem] SidePanel: active annotation ${m} not found after 50ms delay; scroll-to-card skipped`)},50);return()=>clearTimeout(Z)},[m,v]);const re=k!=="all"||E!=="all"||N!=="all";return S.jsxs("div",{ref:_,"data-testid":"annotation-list-scroll-container",style:{width:"100%",background:"var(--tandem-surface-muted)",display:"flex",flexDirection:"column",overflowY:"auto"},children:[r>0&&S.jsxs("div",{style:{padding:"6px 16px",background:E0.background,borderBottom:`1px solid ${E0.border}`,fontSize:"12px",color:E0.color,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("span",{"data-testid":"held-banner",children:[r," annotation",r!==1?"s":""," held"]}),S.jsx("button",{onClick:()=>s==null?void 0:s("tandem"),style:{fontSize:"11px",padding:"1px 8px",border:"1px solid var(--tandem-warning-border)",borderRadius:"4px",background:"var(--tandem-surface)",color:"var(--tandem-warning-fg-strong)",cursor:"pointer",fontWeight:500},children:"Show all"})]}),S.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)"},children:S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",z.length>0&&S.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px"},children:z.length})]}),S.jsxs("span",{"aria-live":"polite",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)"},children:[z.length," pending annotation",z.length!==1?"s":""]}),z.length>0&&S.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[S.jsx("button",{"data-testid":"review-mode-btn",onClick:f,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":u,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${u?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"3px",background:u?"var(--tandem-accent-bg)":"var(--tandem-surface)",color:u?"var(--tandem-accent)":"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:u?600:400},children:u?"Exit Review":"Review"}),S.jsx("div",{"data-testid":"review-shortcut-hints",style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"2px"},children:"Y / N / ↑↓ / Z"})]})]})}),u&&oe.reviewTargets.length>0&&S.jsxs("div",{style:{padding:"8px 16px",background:"var(--tandem-accent-bg)",borderBottom:"1px solid var(--tandem-border)",fontSize:"12px",color:"var(--tandem-accent-fg-strong)"},children:[S.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",oe.reviewIndex+1," / ",oe.reviewTargets.length]}),S.jsx("div",{style:{color:"var(--tandem-accent)"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),S.jsx(RU,{filterType:k,setFilterType:C,filterAuthor:E,setFilterAuthor:j,filterStatus:N,setFilterStatus:q,hasFilters:re,onClearFilters:()=>{C("all"),j("all"),q("all")}}),S.jsx("div",{style:{padding:"4px 16px 0"},children:S.jsx(SU,{annotations:t,activeDocFormat:l,documentId:c})}),S.jsx(DU,{bulkConfirm:H,pendingCount:ae.length,allPendingCount:z.length,confirmRef:oe.confirmRef,onConfirmAccept:()=>O("accepted"),onConfirmDismiss:()=>O("dismissed"),onCancel:()=>R(null),onRequestAccept:()=>R("accept"),onRequestDismiss:()=>R("dismiss")}),S.jsx("div",{style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:be.length===0?S.jsx("p",{role:"status",style:{fontSize:"13px",color:"var(--tandem-fg-subtle)",marginTop:"8px"},children:re?"No annotations match filters.":"No annotations yet. Open a document to get started."}):S.jsxs(S.Fragment,{children:[ae.map(Z=>{var me;const ie=((me=oe.activeReviewAnn)==null?void 0:me.id)===Z.id;return S.jsx(XE,{annotation:Z,replies:ne.get(Z.id)??[],isReviewTarget:ie,onAccept:Z.author!=="user"?oe.handleAccept:void 0,onDismiss:Z.author!=="user"?oe.handleDismiss:void 0,onRemove:Z.author==="user"?pe:void 0,onEdit:Y,onReply:_e,onClick:()=>oe.scrollToAnnotation(Z)},Z.id)}),V.length>0&&S.jsxs("details",{style:{marginTop:"12px"},children:[S.jsxs("summary",{style:{fontSize:"12px",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:[V.length," resolved"]}),S.jsx("div",{role:"list","aria-label":"Resolved annotations",children:V.map(Z=>S.jsx(XE,{annotation:Z,replies:ne.get(Z.id)??[],onUndo:oe.undoResolveAnnotation,undoable:oe.recentlyResolved.has(Z.id),onClick:()=>oe.scrollToAnnotation(Z)},Z.id))})]})]})}),S.jsx("style",{children:`
81
+ @keyframes tandem-annotation-flash {
82
+ 0% { background-color: color-mix(in srgb, var(--tandem-accent) 20%, transparent); }
83
+ 100% { background-color: transparent; }
84
+ }
85
+ .tandem-annotation-flash {
86
+ animation: tandem-annotation-flash 0.8s ease-out;
87
+ }
88
+ @media (prefers-reduced-motion: reduce) {
89
+ .tandem-annotation-flash { animation: none; }
90
+ }
91
+ body.tandem-reduce-motion .tandem-annotation-flash { animation: none; }
92
+ `})]})}function V_({visible:t,children:e}){return t===void 0?S.jsx(S.Fragment,{children:e}):S.jsx("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:e})}function jb({visible:t,...e}){return S.jsx(V_,{visible:t,children:S.jsx(bU,{...e,visible:t})})}function Ib({visible:t,...e}){return S.jsx(V_,{visible:t,children:S.jsx(jU,{...e})})}const QE="tandem:reviewOnlyBannerDismissed";function A0({visible:t,documentId:e}){const[n,r]=M.useState(()=>{try{return localStorage.getItem(QE)==="true"}catch{return!1}}),[i,s]=M.useState(!1),[l,c]=M.useState(null);if(!t||n)return null;async function u(){if(!(!e||i)){s(!0),c(null);try{const f=await fetch(`${cs}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!f.ok){const h=await f.json().catch(()=>null);c((h==null?void 0:h.message)??`Conversion failed (HTTP ${f.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return S.jsxs("div",{"data-testid":"review-only-banner",style:{padding:"8px 16px",backgroundColor:"var(--tandem-info-bg)",borderBottom:"1px solid var(--tandem-info-border)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"13px",color:"var(--tandem-info-fg-strong)",gap:"12px"},children:[S.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l&&S.jsx("span",{style:{color:"var(--tandem-error-fg-strong)",fontSize:"12px",maxWidth:"200px"},children:l}),e&&S.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:u,disabled:i,style:{background:"var(--tandem-info)",border:"none",color:"var(--tandem-info-fg)",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"}),S.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(QE,"true")}catch{}r(!0)},style:{background:"none",border:"none",color:"var(--tandem-info-fg-strong)",cursor:"pointer",fontWeight:500,fontSize:"13px",padding:"2px 8px",whiteSpace:"nowrap"},children:"Dismiss"})]})]})}let pu=null;async function IU(t){if(pu!==null)return pu;const e=await fetch(`${cs}/info`,{signal:t});if(!e.ok)throw new Error(`/api/info responded ${e.status} ${e.statusText}`);const n=await e.json();return pu=n,n}function BU(t){const[e,n]=M.useState(pu),[r,i]=M.useState(t&&pu===null);return M.useEffect(()=>{if(!t)return;let s=!1;const l=new AbortController,c=setTimeout(()=>l.abort(),3e3);return i(!0),IU(l.signal).then(u=>{s||n(u)}).catch(u=>{u instanceof Error&&u.name!=="AbortError"&&console.warn("[useAppInfo] failed to load /api/info:",u)}).finally(()=>{clearTimeout(c),s||i(!1)}),()=>{s=!0,clearTimeout(c),l.abort()}},[t]),{info:e,loading:r}}function M1(t){return(t==null?void 0:t.trim())||kM}function O1(){try{return M1(localStorage.getItem(Bx))}catch{return kM}}function UU(t){const e=M1(t);try{localStorage.setItem(Bx,e)}catch{}return typeof window<"u"&&window.dispatchEvent(new Event(fb)),e}function P_(t){const e=()=>t(O1()),n=r=>{r.key===Bx&&t(M1(r.newValue))};return window.addEventListener(fb,e),window.addEventListener("storage",n),()=>{window.removeEventListener(fb,e),window.removeEventListener("storage",n)}}function $_(){const[t,e]=M.useState(O1);M.useEffect(()=>P_(e),[]);const n=M.useCallback(r=>{const i=UU(r);e(i)},[]);return{userName:t,setUserName:n}}const xi={fontSize:"11px",fontWeight:600,color:"var(--tandem-fg)",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"};function HU({settings:t,onUpdate:e}){return S.jsxs("div",{children:[S.jsx("div",{style:xi,children:"Authorship"}),S.jsxs("label",{"data-testid":"authorship-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[S.jsx("input",{type:"checkbox",checked:t.showAuthorship,onChange:n=>e({showAuthorship:n.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),S.jsx("span",{children:"Show who wrote what"})]}),S.jsxs("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:["Highlights text by author: ",S.jsx("span",{style:{color:"var(--tandem-author-user)"},children:"you"})," /"," ",S.jsx("span",{style:{color:"var(--tandem-author-claude)"},children:"Claude"})]})]})}function nu(t,e,n,r){const i=r?e.filter(u=>!r(u)):e,s=u=>{var C;const{key:f}=u;if(f!=="ArrowLeft"&&f!=="ArrowRight"&&f!=="ArrowUp"&&f!=="ArrowDown"&&f!=="Home"&&f!=="End"||i.length===0)return;u.preventDefault();const h=i.indexOf(t),m=i.length-1;let g;f==="Home"?g=0:f==="End"?g=m:f==="ArrowLeft"||f==="ArrowUp"?g=h<=0?m:h-1:g=h>=m?0:h+1;const b=i[g];n(b);const v=u.currentTarget.querySelectorAll('[role="radio"]'),k=e.indexOf(b);(C=v[k])==null||C.focus()},l=r!=null&&r(t)?i[0]:t;return{handleKeyDown:s,tabIndexFor:u=>r!=null&&r(u)?-1:u===l?0:-1}}const VU=[{value:"tabbed",label:"Tabbed",icon:"[=|]"},{value:"tabbed-left",label:"Tabbed-Left",icon:"[|=]"},{value:"three-panel",label:"Three-Panel",icon:"[|||]"}];function Bo(t,e){return{flex:1,padding:"8px",minHeight:"24px",border:`2px solid ${t?"var(--tandem-accent)":"var(--tandem-border)"}`,borderRadius:"6px",background:e?"var(--tandem-surface-muted)":t?"var(--tandem-accent-bg)":"var(--tandem-surface)",cursor:e?"not-allowed":"pointer",textAlign:"center",fontSize:"11px",color:e?"var(--tandem-fg-subtle)":t?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-muted)",fontWeight:t?600:400,opacity:e?.6:1,transition:"border-color 0.15s, background 0.15s"}}function PU({open:t,settings:e,onUpdate:n}){const[r,i]=M.useState(window.innerWidth),s=r<768,l=nu(e.theme,["light","dark","system"],m=>n({theme:m})),c=nu(e.layout,["tabbed","tabbed-left","three-panel"],m=>n({layout:m}),m=>m==="three-panel"&&s),u=nu(e.primaryTab,["chat","annotations"],m=>n({primaryTab:m})),f=nu(e.panelOrder,["chat-editor-annotations","annotations-editor-chat"],m=>n({panelOrder:m})),h=nu(e.textSize,["s","m","l"],m=>n({textSize:m}));return M.useEffect(()=>{if(!t)return;i(window.innerWidth);const m=()=>i(window.innerWidth);return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[t]),S.jsxs(S.Fragment,{children:[S.jsxs("div",{children:[S.jsx("div",{id:"settings-theme-label",style:xi,children:"Theme"}),S.jsx("div",{role:"radiogroup","aria-labelledby":"settings-theme-label",onKeyDown:l.handleKeyDown,style:{display:"flex",gap:"8px"},children:["light","dark","system"].map(m=>S.jsx("button",{"data-testid":`theme-${m}-btn`,role:"radio","aria-checked":e.theme===m,tabIndex:l.tabIndexFor(m),onClick:()=>n({theme:m}),style:Bo(e.theme===m),children:m==="light"?"Light":m==="dark"?"Dark":"System"},m))})]}),S.jsxs("div",{children:[S.jsx("div",{id:"settings-layout-label",style:xi,children:"Layout"}),S.jsx("div",{role:"radiogroup","aria-labelledby":"settings-layout-label",onKeyDown:c.handleKeyDown,style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:VU.map(({value:m,label:g,icon:b})=>{const v=m==="three-panel"&&s;return S.jsxs("button",{"data-testid":`layout-${m}-btn`,role:"radio","aria-checked":e.layout===m,"aria-disabled":v||void 0,tabIndex:c.tabIndexFor(m),onClick:()=>{v||n({layout:m})},style:Bo(e.layout===m,v),title:v?"Requires viewport wider than 768px":void 0,children:[S.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:b}),g]},m)})}),s&&S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Three-panel requires a wider viewport"})]}),(e.layout==="tabbed"||e.layout==="tabbed-left")&&S.jsxs("div",{children:[S.jsx("div",{id:"settings-default-tab-label",style:xi,children:"Default Tab"}),S.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-default-tab-label",onKeyDown:u.handleKeyDown,style:{display:"flex",gap:"8px"},children:[S.jsx("button",{"data-testid":"default-tab-chat-btn",role:"radio","aria-checked":e.primaryTab==="chat",tabIndex:u.tabIndexFor("chat"),onClick:()=>n({primaryTab:"chat"}),style:Bo(e.primaryTab==="chat"),children:"Chat"}),S.jsx("button",{"data-testid":"default-tab-annotations-btn",role:"radio","aria-checked":e.primaryTab==="annotations",tabIndex:u.tabIndexFor("annotations"),onClick:()=>n({primaryTab:"annotations"}),style:Bo(e.primaryTab==="annotations"),children:"Annotations"})]})]}),e.layout==="three-panel"&&S.jsxs("div",{children:[S.jsx("div",{id:"settings-panel-order-label",style:xi,children:"Panel Order"}),S.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-panel-order-label",onKeyDown:f.handleKeyDown,style:{display:"flex",gap:"8px"},children:[S.jsx("button",{"data-testid":"panel-order-cea-btn",role:"radio","aria-checked":e.panelOrder==="chat-editor-annotations",tabIndex:f.tabIndexFor("chat-editor-annotations"),onClick:()=>n({panelOrder:"chat-editor-annotations"}),style:Bo(e.panelOrder==="chat-editor-annotations"),children:"Chat | Editor | Ann."}),S.jsx("button",{"data-testid":"panel-order-aec-btn",role:"radio","aria-checked":e.panelOrder==="annotations-editor-chat",tabIndex:f.tabIndexFor("annotations-editor-chat"),onClick:()=>n({panelOrder:"annotations-editor-chat"}),style:Bo(e.panelOrder==="annotations-editor-chat"),children:"Ann. | Editor | Chat"})]})]}),S.jsxs("div",{children:[S.jsx("div",{id:"settings-text-size-label",style:xi,children:"Text Size"}),S.jsx("div",{role:"radiogroup","aria-labelledby":"settings-text-size-label",onKeyDown:h.handleKeyDown,style:{display:"flex",gap:"8px"},children:["s","m","l"].map(m=>S.jsx("button",{"data-testid":`text-size-${m}-btn`,role:"radio","aria-checked":e.textSize===m,tabIndex:h.tabIndexFor(m),onClick:()=>n({textSize:m}),style:Bo(e.textSize===m),children:m==="s"?"Small":m==="m"?"Medium":"Large"},m))}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Reading density only — use browser zoom (Ctrl + =/−) to scale the whole UI."})]}),S.jsxs("div",{children:[S.jsxs("label",{"data-testid":"reduce-motion-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[S.jsx("input",{type:"checkbox",checked:e.reduceMotion,onChange:m=>n({reduceMotion:m.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),S.jsx("span",{children:"Reduce motion"})]}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Disables smooth autoscroll and the annotation flash animation."})]})]})}function $U({settings:t,onUpdate:e}){return S.jsxs("div",{children:[S.jsxs("div",{style:xi,children:["Editor Width:"," ",S.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[t.editorWidthPercent,"%"]})]}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How much of the available space the editor text fills"}),S.jsx("input",{"data-testid":"editor-width-slider",type:"range",min:40,max:100,step:5,value:t.editorWidthPercent,onChange:n=>e({editorWidthPercent:Number(n.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Editor width"}),S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[S.jsx("span",{children:"40%"}),S.jsx("span",{children:"100%"})]})]})}const FU=M.lazy(()=>Ux(()=>import("./CoworkSettings-C9Dd4D9z.js"),[]).then(t=>({default:t.CoworkSettings}))),qU=320,eT="tandem-settings-heading",KU='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function YU({open:t,onClose:e,settings:n,onUpdate:r,returnFocusRef:i,anchorRef:s}){const l=M.useRef(null),c=M.useRef(null),{userName:u,setUserName:f}=$_(),[h,m]=M.useState(u),{info:g,loading:b}=BU(t),[v,k]=M.useState(!1),[C,E]=M.useState(null),j=M.useCallback(async()=>{const N=g==null?void 0:g.changelogPath;if(!N){E("Changelog file not found.");return}k(!0),E(null);try{const q=await fetch(`${cs}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:N,readOnly:!0})});if(!q.ok){let H="Failed to open changelog.";try{const R=await q.json();R.message&&(H=R.message)}catch{}q.status===404&&(H="Changelog file not found."),E(H);return}e()}catch{E("Server unavailable.")}finally{k(!1)}},[g,e]);return M.useEffect(()=>{h!==u&&document.activeElement!==c.current&&m(u)},[u,h]),M.useEffect(()=>{if(!t)return;const N=l.current;return N==null||N.focus(),()=>{var q;(q=i==null?void 0:i.current)==null||q.focus()}},[t,i]),M.useEffect(()=>{if(!t)return;const N=H=>{var I;const R=H.target;(I=s==null?void 0:s.current)!=null&&I.contains(R)||l.current&&!l.current.contains(R)&&e()},q=setTimeout(()=>document.addEventListener("pointerdown",N),0);return()=>{clearTimeout(q),document.removeEventListener("pointerdown",N)}},[t,e,s]),M.useEffect(()=>{if(!t)return;const N=q=>{if(q.key==="Escape"){e();return}if(q.key!=="Tab"||!l.current)return;const H=l.current.querySelectorAll(KU);if(H.length===0)return;const R=H[0],I=H[H.length-1],Q=document.activeElement;if(!l.current.contains(Q)){q.preventDefault(),R.focus();return}q.shiftKey&&Q===R?(q.preventDefault(),I.focus()):!q.shiftKey&&Q===I&&(q.preventDefault(),R.focus())};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[t,e]),t?S.jsxs("div",{ref:l,"data-testid":"settings-popover",role:"dialog","aria-modal":"true","aria-labelledby":eT,tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",width:`${qU}px`,background:"var(--tandem-surface)",color:"var(--tandem-fg)",border:"1px solid var(--tandem-border)",borderRadius:"8px",boxShadow:"0 4px 24px rgba(0,0,0,0.12)",padding:"16px",zIndex:9999,display:"flex",flexDirection:"column",gap:"14px",outline:"none"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[S.jsx("span",{id:eT,style:{fontSize:"13px",fontWeight:600,color:"var(--tandem-fg)"},children:"Settings"}),S.jsx("button",{onClick:e,style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-subtle)",fontSize:"16px",lineHeight:1,padding:"4px 6px",minWidth:"24px",minHeight:"24px"},"aria-label":"Close settings",children:"×"})]}),S.jsxs("div",{children:[S.jsx("label",{htmlFor:"settings-display-name",style:xi,children:"Display Name"}),S.jsx("input",{ref:c,id:"settings-display-name","data-testid":"settings-display-name",type:"text",value:h,onChange:N=>m(N.target.value),onBlur:()=>f(h),onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(m(u),N.currentTarget.blur())},maxLength:CM,style:{width:"100%",padding:"6px 8px",fontSize:"12px",color:"var(--tandem-fg)",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",outline:"none"}})]}),S.jsx(PU,{open:t,settings:n,onUpdate:r}),S.jsx($U,{settings:n,onUpdate:r}),S.jsx(HU,{settings:n,onUpdate:r}),S.jsxs("div",{children:[S.jsxs("div",{style:xi,children:["Selection Sensitivity:"," ",S.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[(n.selectionDwellMs/1e3).toFixed(1),"s"]})]}),S.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How long you must hold a selection before Claude notices it"}),S.jsx("input",{"data-testid":"dwell-time-slider",type:"range",min:Lh,max:jh,step:100,value:n.selectionDwellMs,onChange:N=>r({selectionDwellMs:Number(N.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Selection dwell time"}),S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[S.jsxs("span",{children:[(Lh/1e3).toFixed(1),"s"]}),S.jsxs("span",{children:[(jh/1e3).toFixed(1),"s"]})]})]}),S.jsxs("div",{children:[S.jsx("button",{"data-testid":"view-changelog-btn",onClick:j,disabled:v||b,style:{width:"100%",padding:"8px",fontSize:"13px",fontWeight:500,border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:v||b?"not-allowed":"pointer",background:"var(--tandem-surface-muted)",color:"var(--tandem-fg)",opacity:v||b?.6:1},children:v?"Opening…":"View Changelog"}),C&&S.jsx("div",{style:{marginTop:"6px",fontSize:"11px",color:"var(--tandem-error-fg)"},children:C})]}),hd()&&S.jsx(M.Suspense,{fallback:S.jsx("div",{"data-testid":"cowork-settings-suspense-fallback",style:{fontSize:12,color:"var(--tandem-fg-subtle)"},children:"Loading Cowork integration..."}),children:S.jsx(FU,{})}),(b||g!==null)&&S.jsxs("div",{"data-testid":"app-info-footer",style:{borderTop:"1px solid var(--tandem-border)",paddingTop:"10px"},children:[S.jsx("div",{style:xi,children:"About"}),b?S.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:"Loading..."}):S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"3px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[S.jsxs("span",{children:["Tandem v",g==null?void 0:g.version]}),S.jsxs("span",{children:["MCP SDK ",g==null?void 0:g.mcpSdkVersion]})]})]})]}):null}const WU={error:"var(--tandem-error)",warning:"var(--tandem-warning)",info:"var(--tandem-accent)"},GU={error:"var(--tandem-error-bg)",warning:"var(--tandem-warning-bg)",info:"var(--tandem-accent-bg)"},ZU={error:"var(--tandem-error-fg-strong)",warning:"var(--tandem-warning-fg-strong)",info:"var(--tandem-accent-fg-strong)"};function JU({toasts:t,onDismiss:e}){return t.length===0?null:S.jsxs(S.Fragment,{children:[S.jsx("style",{children:`
93
+ @keyframes tandem-toast-slide-in {
94
+ from {
95
+ opacity: 0;
96
+ transform: translateX(40px);
97
+ }
98
+ to {
99
+ opacity: 1;
100
+ transform: translateX(0);
101
+ }
102
+ }
103
+ `}),S.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=>S.jsx(XU,{toast:n,onDismiss:e},n.id))})]})}function XU({toast:t,onDismiss:e}){const n=WU[t.severity],r=GU[t.severity],i=ZU[t.severity],s=t.severity==="info"?"status":"alert";return S.jsxs("div",{role:s,"data-testid":`toast-${t.id}`,style:{pointerEvents:"auto",background:"var(--tandem-surface)",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:"var(--tandem-fg)"},children:[S.jsx("span",{children:t.message}),t.count>1&&S.jsxs("span",{"data-testid":`toast-count-${t.id}`,style:{marginLeft:6,fontSize:11,fontWeight:600,color:i,background:r,padding:"1px 5px",borderRadius:8},children:["×",t.count]}),S.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:"var(--tandem-fg-subtle)",lineHeight:1,padding:"2px 4px"},"aria-label":"Dismiss notification",children:"×"})]})}function wn(t){this.content=t}wn.prototype={constructor:wn,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 wn(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 wn(n)},addToStart:function(t,e){return new wn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new wn(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 wn(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=wn.from(t),t.size?new wn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=wn.from(t),t.size?new wn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=wn.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}};wn.from=function(t){if(t instanceof wn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new wn(e)};function F_(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=F_(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function q_(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let l=t.child(--i),c=e.child(--s),u=l.nodeSize;if(l==c){n-=u,r-=u;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=0,h=Math.min(l.text.length,c.text.length);for(;f<h&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let f=q_(l.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}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 u=this.content[l],f=c+u.nodeSize;if(f>e&&r(u,i+c,s||null,l)!==!1&&u.content.size){let h=c+1;u.nodesBetween(Math.max(0,e-h),Math.min(u.content.size,n-h),r,i+h)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new 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],u=l+c.nodeSize;u>e&&((l<e||u>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=u}return new 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 F_(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return q_(this,e,n,r)}findIndex(e){if(e==0)return Jf(0,e);if(e==this.size)return Jf(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?Jf(n+1,s):Jf(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 M0={index:0,offset:0};function Jf(t,e){return M0.index=t,M0.offset=e,M0}function Qh(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(!Qh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Qh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let bt=class Bb{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&&Qh(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 Bb.none;if(e instanceof Bb)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};bt.none=[];class ep extends Error{}class he{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Y_(this.content,e+this.openStart,n);return r&&new he(r,this.openStart,this.openEnd)}removeBetween(e,n){return new he(K_(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return he.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new he(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 he(e,r,i)}}he.empty=new he(te.empty,0,0);function K_(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(K_(s.content,e-i-1,n-i-1)))}function Y_(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=Y_(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function QU(t,e,n){if(n.openStart>t.depth)throw new ep("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ep("Inconsistent open depths");return W_(t,e,n,0)}function W_(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=W_(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 Jo(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=eH(n,t);return Jo(s,Z_(t,l,c,e,r))}else return Jo(s,tp(t,e,r))}function G_(t,e){if(!e.type.compatibleContent(t.type))throw new ep("Cannot join "+e.type.name+" onto "+t.type.name)}function Ub(t,e,n){let r=t.node(n);return G_(r,e.node(n)),r}function Zo(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 mu(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&&(Zo(t.nodeAfter,r),s++));for(let c=s;c<l;c++)Zo(i.child(c),r);e&&e.depth==n&&e.textOffset&&Zo(e.nodeBefore,r)}function Jo(t,e){return t.type.checkContent(e),t.copy(e)}function Z_(t,e,n,r,i){let s=t.depth>i&&Ub(t,e,i+1),l=r.depth>i&&Ub(n,r,i+1),c=[];return mu(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(G_(s,l),Zo(Jo(s,Z_(t,e,n,r,i+1)),c)):(s&&Zo(Jo(s,tp(t,e,i+1)),c),mu(e,n,i,c),l&&Zo(Jo(l,tp(n,r,i+1)),c)),mu(r,null,i,c),new te(c)}function tp(t,e,n){let r=[];if(mu(null,t,n,r),t.depth>n){let i=Ub(t,e,n+1);Zo(Jo(i,tp(t,e,n+1)),r)}return mu(e,null,n,r),new te(r)}function eH(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 Ku{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 bt.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 np(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let l=e;;){let{index:c,offset:u}=l.content.findIndex(s),f=s-u;if(r.push(l,c,i+u),!f||(l=l.child(c),l.isText))break;s=f-1,i+=u+1}return new Ku(n,r,s)}static resolveCached(e,n){let r=tT.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 tT.set(e,r=new tH);let i=r.elts[r.i]=Ku.resolve(e,n);return r.i=(r.i+1)%nH,i}}class tH{constructor(){this.elts=[],this.i=0}}const nH=12,tT=new WeakMap;class np{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 rH=Object.create(null);let no=class Hb{constructor(e,n,r,i=bt.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&&Qh(this.attrs,n||e.defaultAttrs||rH)&&bt.sameSet(this.marks,r||bt.none)}copy(e=null){return e==this.content?this:new Hb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Hb(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return he.empty;let i=this.resolve(e),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),f=i.node(l).content.cut(i.pos-c,s.pos-c);return new he(f,i.depth-l,s.depth-l)}replace(e,n,r){return QU(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 Ku.resolveCached(this,e)}resolveNoCache(e){return Ku.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()+")"),J_(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 u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=bt.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(!bt.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}};no.prototype.text=void 0;class rp extends no{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):J_(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 rp(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new rp(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 J_(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ll{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new iH(e,n);if(r.next==null)return ll.empty;let i=X_(r);r.next&&r.err("Unexpected trailing text");let s=dH(uH(i));return fH(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(l,c){let u=l.matchFragment(e,r);if(u&&(!n||u.validEnd))return te.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:h,next:m}=l.next[f];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,c.concat(h));if(g)return g}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:u}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
104
+ `)}}ll.empty=new ll(!0);class iH{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 X_(t){let e=[];do e.push(sH(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function sH(t){let e=[];do e.push(oH(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function oH(t){let e=cH(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=lH(t,e);else break;return e}function nT(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function lH(t,e){let n=nT(t),r=n;return t.eat(",")&&(t.next!="}"?r=nT(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function aH(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 cH(t){if(t.eat("(")){let e=X_(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=aH(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 uH(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,u){let f={term:u,to:c};return e[l].push(f),f}function i(l,c){l.forEach(u=>u.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((u,f)=>u.concat(s(f,c)),[]);if(l.type=="seq")for(let u=0;;u++){let f=s(l.exprs[u],c);if(u==l.exprs.length-1)return f;i(f,c=n())}else if(l.type=="star"){let u=n();return r(c,u),i(s(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=n();return i(s(l.expr,c),u),i(s(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let u=c;for(let f=0;f<l.min;f++){let h=n();i(s(l.expr,u),h),u=h}if(l.max==-1)i(s(l.expr,u),u);else for(let f=l.min;f<l.max;f++){let h=n();r(u,h),i(s(l.expr,u),h),u=h}return[r(u)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function Q_(t,e){return e-t}function rT(t,e){let n=[];return r(e),n.sort(Q_);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:u}=s[l];!c&&n.indexOf(u)==-1&&r(u)}}}function dH(t){let e=Object.create(null);return n(rT(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let h=0;h<i.length;h++)i[h][0]==c&&(f=i[h][1]);rT(t,u).forEach(h=>{f||i.push([c,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let s=e[r.join(",")]=new ll(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(Q_);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function fH(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];l.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function eD(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 tD(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 nD(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 rD(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new pH(t,r,e[r]);return n}let iT=class iD{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=rD(e,r.attrs),this.defaultAttrs=eD(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==ll.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:tD(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new no(this,this.computeAttrs(e),te.from(n),bt.setFrom(r))}createChecked(e=null,n,r){return n=te.from(n),this.checkContent(n),new no(this,this.computeAttrs(e),n,bt.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 no(this,e,n.append(s),bt.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){nD(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:bt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new iD(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 hH(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 pH{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?hH(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class mm{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=rD(e,i.attrs),this.excluded=null;let s=eD(this.attrs);this.instance=s?new bt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new bt(this,tD(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new mm(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){nD(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class sD{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=wn.from(e.nodes),n.marks=wn.from(e.marks||{}),this.nodes=iT.compile(this.spec.nodes,this),this.marks=mm.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]=ll.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?sT(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==""?[]:sT(this,l.split(" "))}this.nodeFromJSON=i=>no.fromJSON(this,i),this.markFromJSON=i=>bt.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 iT){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 rp(r,r.defaultAttrs,e,bt.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 sT(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],l=s;if(s)n.push(s);else for(let c in t.marks){let u=t.marks[c];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function mH(t){return t.tag!=null}function gH(t){return t.style!=null}let gu=class Vb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(mH(i))this.tags.push(i);else if(gH(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 lT(this,n,!1);return r.addAll(e,bt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new lT(this,n,!0);return r.addAll(e,bt.none,n.from,n.to),he.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(xH(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=aT(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=aT(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Vb(e,Vb.schemaRules(e)))}};const oD={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},yH={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lD={ol:!0,ul:!0},Yu=1,Pb=2,yu=4;function oT(t,e,n){return e!=null?(e?Yu:0)|(e==="full"?Pb:0):t&&t.whitespace=="pre"?Yu|Pb:n&~yu}class Xf{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=bt.none,this.match=s||(l&yu?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&Yu)){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&&!oD.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lT{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=oT(null,n.preserveWhitespace,0)|(r?yu:0);i?s=new Xf(i.type,i.attrs,bt.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new Xf(null,null,bt.none,!0,null,l):s=new Xf(e.schema.topNodeType,null,bt.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&Yu)>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,`
105
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(l.text(c[u]),n,!/\S/.test(c[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],u=e.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),c;lD.hasOwnProperty(l)&&this.parser.normalizeLists&&bH(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:yH.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,h=this.needsBlock;if(oD.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=h}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
106
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let u=this.parser.matchStyle(s,l,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(l,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let u=this.nodes[l],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=bt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):cT(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=oT(e,s,l.options);l.options&yu&&l.content.length==0&&(c|=yu);let u=bt.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):cT(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new Xf(e,n,u,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Yu)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),l=(c,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(l(c-1,u))return!0;return!1}else{let h=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!h||h.name!=f&&!h.isInGroup(f))return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function bH(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&lD.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function xH(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function aT(t){let e={};for(let n in t)e[n]=t[n];return e}function cT(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],l=c=>{s.push(c);for(let u=0;u<c.edgeCount;u++){let{type:f,next:h}=c.edge(u);if(f==e||s.indexOf(h)<0&&l(h))return!0}};if(l(i.contentMatch))return!0}}class yl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=O0(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,u=0;for(;c<s.length&&u<l.marks.length;){let f=l.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<s.length;)i=s.pop()[1];for(;u<l.marks.length;){let f=l.marks[u++],h=this.serializeMark(f,l.isInline,n);h&&(s.push([f,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Eh(O0(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&&Eh(O0(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Eh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=uT(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return uT(e.marks)}}function uT(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function O0(t){return t.document||window.document}const dT=new WeakMap;function vH(t){let e=dT.get(t);return e===void 0&&dT.set(t,e=SH(t)),e}function SH(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 Eh(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=vH(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&u.style?u.style.cssText=f[m]:u.setAttribute(m,f[m])}}for(let m=h;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:v}=Eh(t,g,n,r);if(u.appendChild(b),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const aD=65535,cD=Math.pow(2,16);function wH(t,e){return t+e*cD}function fT(t){return t&aD}function kH(t){return(t-(t&aD))/cD}const uD=1,dD=2,Th=4,fD=8;class $b{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&fD)>0}get deletedBefore(){return(this.delInfo&(uD|Th))>0}get deletedAfter(){return(this.delInfo&(dD|Th))>0}get deletedAcross(){return(this.delInfo&Th)>0}}class br{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&br.empty)return br.empty}recover(e){let n=0,r=fT(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+kH(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[c+s],h=this.ranges[c+l],m=u+f;if(e<=m){let g=f?e==u?-1:e==m?1:n:n,b=u+i+(g<0?0:h);if(r)return b;let v=e==(n<0?u:m)?null:wH(c/3,e-u),k=e==u?dD:e==m?uD:Th;return(n<0?e!=u:e!=m)&&(k|=fD),new $b(b,k,v)}i+=h-f}return r?e+i:new $b(e+i,0,null)}touches(e,n){let r=0,i=fT(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[c+s],h=u+f;if(e<=h&&c==i*3)return!0;r+=this.ranges[c+l]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?s:0),u=l+(this.inverted?0:s),f=this.ranges[i+n],h=this.ranges[i+r];e(c,c+f,u,u+h),s+=h-f}}invert(){return new br(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?br.empty:new br(e<0?[0,-e,0]:[0,0,e])}}br.empty=new br([]);class Wu{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 Wu(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 Wu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(e,n);if(c.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new $b(e,i,null)}}const _0=Object.create(null);class Ln{getMap(){return br.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_0[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 _0)throw new RangeError("Duplicate use of step JSON ID "+e);return _0[e]=n,n.prototype.jsonID=e,n}}class Wt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Wt(e,null)}static fail(e){return new Wt(null,e)}static fromReplace(e,n,r,i){try{return Wt.ok(e.replace(n,r,i))}catch(s){if(s instanceof ep)return Wt.fail(s.message);throw s}}}function _1(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(_1(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return te.fromArray(r)}class Qs extends Ln{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new he(_1(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 Wt.fromReplace(e,this.from,this.to,s)}invert(){return new vi(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 Qs(n.pos,r.pos,this.mark)}merge(e){return e instanceof Qs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qs(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 Qs(n.from,n.to,e.markFromJSON(n.mark))}}Ln.jsonID("addMark",Qs);class vi extends Ln{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new he(_1(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Wt.fromReplace(e,this.from,this.to,r)}invert(){return new Qs(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 vi(n.pos,r.pos,this.mark)}merge(e){return e instanceof vi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new vi(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 vi(n.from,n.to,e.markFromJSON(n.mark))}}Ln.jsonID("removeMark",vi);class eo extends Ln{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Wt.fromReplace(e,this.pos,this.pos+1,new he(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 eo(this.pos,n.marks[i]);return new eo(this.pos,this.mark)}}return new al(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new eo(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 eo(n.pos,e.markFromJSON(n.mark))}}Ln.jsonID("addNodeMark",eo);class al extends Ln{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Wt.fromReplace(e,this.pos,this.pos+1,new he(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 eo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new al(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 al(n.pos,e.markFromJSON(n.mark))}}Ln.jsonID("removeNodeMark",al);class ln extends Ln{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Fb(e,this.from,this.to)?Wt.fail("Structure replace would overwrite content"):Wt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new br([this.from,this.to-this.from,this.slice.size])}invert(e){return new ln(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 ln(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ln)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?he.empty:new he(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ln(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?he.empty:new he(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ln(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 ln(n.from,n.to,he.fromJSON(e,n.slice),!!n.structure)}}Ln.jsonID("replace",ln);class un extends Ln{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&&(Fb(e,this.from,this.gapFrom)||Fb(e,this.gapTo,this.to)))return Wt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Wt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Wt.fromReplace(e,this.from,this.to,r):Wt.fail("Content does not fit in gap")}getMap(){return new br([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 un(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 un(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 un(n.from,n.to,n.gapFrom,n.gapTo,he.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ln.jsonID("replaceAround",un);function Fb(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 CH(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(u,f,h)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let g=Math.max(f,e),b=Math.min(f+u.nodeSize,n),v=r.addToSet(m);for(let k=0;k<m.length;k++)m[k].isInSet(v)||(l&&l.to==g&&l.mark.eq(m[k])?l.to=b:i.push(l=new vi(g,b,m[k])));c&&c.to==g?c.to=b:s.push(c=new Qs(g,b,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function EH(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let u=null;if(r instanceof mm){let f=l.marks,h;for(;h=r.isInSet(f);)(u||(u=[])).push(h),f=h.removeFromSet(f)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let f=Math.min(c+l.nodeSize,n);for(let h=0;h<u.length;h++){let m=u[h],g;for(let b=0;b<i.length;b++){let v=i[b];v.step==s-1&&m.eq(i[b].style)&&(g=v)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(c,e),to:f,step:s})}}}),i.forEach(l=>t.step(new vi(l.from,l.to,l.style)))}function D1(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),h=c+f.nodeSize,m=r.matchType(f.type);if(!m)l.push(new ln(c,h,he.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new vi(c,h,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,b=/\r?\n|\r/g,v;for(;g=b.exec(f.text);)v||(v=new he(te.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new ln(c+g.index,c+g.index+g[0].length,v))}}c=h}if(!r.validEnd){let u=r.fillBefore(te.empty,!0);t.replace(c,c,new he(u,0,0))}for(let u=l.length-1;u>=0;u--)t.step(l[u])}function TH(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function nc(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,u,n))return r;if(r==0||l.type.spec.isolating||!TH(l,c,u))break;c&&(i=1),u<l.childCount&&(s=1)}return null}function AH(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),u=l,f=c,h=te.empty,m=0;for(let v=s,k=!1;v>n;v--)k||r.index(v)>0?(k=!0,h=te.from(r.node(v).copy(h)),m++):u--;let g=te.empty,b=0;for(let v=s,k=!1;v>n;v--)k||i.after(v+1)<i.end(v)?(k=!0,g=te.from(i.node(v).copy(g)),b++):f++;t.step(new un(u,f,l,c,new he(h.append(g),m,b),h.size-m,!0))}function R1(t,e,n=null,r=t){let i=MH(t,e),s=i&&OH(r,e);return s?i.map(hT).concat({type:e,attrs:n}).concat(s.map(hT)):null}function hT(t){return{type:t,attrs:null}}function MH(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 OH(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let u=(l.length?l[l.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:l}function _H(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 un(i,s,i,s,new he(r,0,0),n.length,!0))}function DH(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(l,c)=>{let u=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,u)&&RH(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?f=!1:!b&&v&&(f=!0)}f===!1&&pD(t,l,c,s),D1(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let h=t.mapping.slice(s),m=h.map(c,1),g=h.map(c+l.nodeSize,1);return t.step(new un(m,g,m+1,g-1,new he(te.from(r.create(u,null,l.marks)),0,0),1,!0)),f===!0&&hD(t,l,c,s),!1}})}function hD(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function pD(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(`
107
+ `))}})}function RH(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function NH(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 un(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new he(te.from(l),0,0),1,!0))}function ls(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,h=n-2;f>s;f--,h--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),v=r&&r[h+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let k=r&&r[h]||m;if(!m.canReplace(g+1,m.childCount)||!k.type.validContent(b))return!1}let c=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(c,c,u?u.type:i.node(s+1).type)}function zH(t,e,n=1,r){let i=t.doc.resolve(e),s=te.empty,l=te.empty;for(let c=i.depth,u=i.depth-n,f=n-1;c>u;c--,f--){s=te.from(i.node(c).copy(s));let h=r&&r[f];l=te.from(h?h.type.create(h.attrs,l):i.node(c).copy(l))}t.step(new ln(e,e,new he(s.append(l),n,n),!0))}function go(t,e){let n=t.resolve(e),r=n.index();return mD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function LH(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 mD(t,e){return!!(t&&e&&!t.isLeaf&&LH(t,e))}function gm(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&&mD(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 jH(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 h=l.whitespace=="pre",m=!!l.contentMatch.matchType(i);h&&!m?r=!1:!h&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);pD(t,h.node(),h.before(),c)}l.inlineContent&&D1(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),f=u.map(e-n);if(t.step(new ln(f,u.map(e+n,-1),he.empty,!0)),r===!0){let h=t.doc.resolve(f);hD(t,h.node(),h.before(),t.steps.length)}return t}function IH(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 gD(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,u=r.index(l)+(c>0?1:0),f=r.node(l),h=!1;if(s==1)h=f.canReplace(u,u,i);else{let m=f.contentMatchAt(u).findWrapping(i.firstChild.type);h=m&&f.canReplaceWith(u,u,m[0])}if(h)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function ym(t,e,n=e,r=he.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return yD(i,s,r)?new ln(e,n,r):new BH(i,s,r).fit()}function yD(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class BH{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 f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let u=new he(s,l,c);return e>-1?new un(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new ln(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=D0(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:f}=this.frontier[c],h,m=null;if(n==1&&(l?f.matchType(l.type)||(m=f.fillBefore(te.from(l),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(h=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:h};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=D0(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new he(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=D0(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new he(su(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new he(su(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 k=0;k<s.length;k++)this.openFrontierNode(s[k]);let l=this.unplaced,c=r?r.content:l.content,u=l.openStart-e,f=0,h=[],{match:m,type:g}=this.frontier[n];if(i){for(let k=0;k<i.childCount;k++)h.push(i.child(k));m=m.matchFragment(i)}let b=c.size+e-(l.content.size-l.openEnd);for(;f<c.childCount;){let k=c.child(f),C=m.matchType(k.type);if(!C)break;f++,(f>1||u==0||k.content.size)&&(m=C,h.push(bD(k.mark(g.allowedMarks(k.marks)),f==1?u:0,f==c.childCount?b:-1)))}let v=f==c.childCount;v||(b=-1),this.placed=ou(this.placed,n,te.from(h)),this.frontier[n].match=m,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,C=c;k<b;k++){let E=C.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),C=E.content}this.unplaced=v?e==0?he.empty:new he(su(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new he(su(l.content,e,f),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!R0(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=R0(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],h=R0(e,c,f,u,!0);if(!h||h.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=ou(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=ou(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=ou(this.placed,this.frontier.length,n))}}function su(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(su(t.firstChild.content,e-1,n)))}function ou(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ou(t.lastChild.content,e-1,n)))}function D0(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function bD(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,bD(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 R0(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&&!UH(n,s.content,l)?c:null}function UH(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function HH(t){return t.spec.defining||t.spec.definingForContent}function VH(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(yD(i,s,r))return t.step(new ln(e,n,r));let l=vD(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 v=i.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==b&&l.splice(1,0,-g)}let u=l.indexOf(c),f=[],h=r.openStart;for(let g=r.content,b=0;;b++){let v=g.firstChild;if(f.push(v),b==r.openStart)break;g=v.content}for(let g=h-1;g>=0;g--){let b=f[g],v=HH(b.type);if(v&&!b.sameMarkup(i.node(Math.abs(c)-1)))h=g;else if(v||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+h+1)%(r.openStart+1),v=f[b];if(v)for(let k=0;k<l.length;k++){let C=l[(k+u)%l.length],E=!0;C<0&&(E=!1,C=-C);let j=i.node(C-1),N=i.index(C-1);if(j.canReplaceWith(N,N,v.type,v.marks))return t.replace(i.before(C),E?s.after(C):n,new he(xD(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 xD(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(xD(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 PH(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=IH(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new he(te.from(r),0,0))}function $H(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=vD(r,i);for(let l=0;l<s.length;l++){let c=s[l],u=l==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function vD(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 Ea extends Ln{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 Wt.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 Wt.fromReplace(e,this.pos,this.pos+1,new he(te.from(i),0,n.isLeaf?0:1))}getMap(){return br.empty}invert(e){return new Ea(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 Ea(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 Ea(n.pos,n.attr,n.value)}}Ln.jsonID("attr",Ea);class Gu extends Ln{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 Wt.ok(r)}getMap(){return br.empty}invert(e){return new Gu(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 Gu(n.attr,n.value)}}Ln.jsonID("docAttr",Gu);let Ba=class extends Error{};Ba=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ba.prototype=Object.create(Error.prototype);Ba.prototype.constructor=Ba;Ba.prototype.name="TransformError";class N1{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Wu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ba(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,l,c,u)=>{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=he.empty){let i=ym(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new he(te.from(r),0,0))}delete(e,n){return this.replace(e,n,he.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return VH(this,e,n,r),this}replaceRangeWith(e,n,r){return PH(this,e,n,r),this}deleteRange(e,n){return $H(this,e,n),this}lift(e,n){return AH(this,e,n),this}join(e,n=1){return jH(this,e,n),this}wrap(e,n){return _H(this,e,n),this}setBlockType(e,n=e,r,i=null){return DH(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return NH(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Ea(e,n,r)),this}setDocAttribute(e,n){return this.step(new Gu(e,n)),this}addNodeMark(e,n){return this.step(new eo(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 bt)n.isInSet(r.marks)&&this.step(new al(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new al(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 zH(this,e,n,r),this}addMark(e,n,r){return CH(this,e,n,r),this}removeMark(e,n,r){return EH(this,e,n,r),this}clearIncompatible(e,n,r){return D1(this,e,n,r),this}}const N0=Object.create(null);class Ne{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new SD(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=he.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:u,$to:f}=l[c],h=e.mapping.slice(s);e.replaceRange(h.map(u.pos),h.map(f.pos),c?he.empty:n),c==0&&gT(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:c}=i[s],u=e.mapping.slice(r),f=u.map(l.pos),h=u.map(c.pos);s?e.deleteRange(f,h):(e.replaceRangeWith(f,h,n),gT(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Oe(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 rr(e.node(0))}static atStart(e){return ca(e,e,0,0,1)||new rr(e)}static atEnd(e){return ca(e,e,e.content.size,e.childCount,-1)||new rr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=N0[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 N0)throw new RangeError("Duplicate use of selection JSON ID "+e);return N0[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Ne.prototype.visible=!0;class SD{constructor(e,n){this.$from=e,this.$to=n}}let pT=!1;function mT(t){!pT&&!t.parent.inlineContent&&(pT=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Ne{constructor(e,n=e){mT(e),mT(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 Ne.near(r);let i=e.resolve(n.map(this.anchor));return new Oe(i.parent.inlineContent?i:r,r)}replace(e,n=he.empty){if(super.replace(e,n),n==he.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bm(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 Oe(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=Ne.findFrom(n,r,!0)||Ne.findFrom(n,-r,!0);if(s)n=s.$head;else return Ne.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ne.findFrom(e,-r,!0)||Ne.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oe(e,n)}}Ne.jsonID("text",Oe);class bm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new bm(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Te extends Ne{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?Ne.near(s):new Te(s)}content(){return new he(te.from(this.node),0,0)}eq(e){return e instanceof Te&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new z1(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(e.resolve(n.anchor))}static create(e,n){return new Te(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Te.prototype.visible=!1;Ne.jsonID("node",Te);class z1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new bm(r,r):new z1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):Ne.near(n)}}class rr extends Ne{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=he.empty){if(n==he.empty){e.delete(0,e.doc.content.size);let r=Ne.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new rr(e)}map(e){return new rr(e)}eq(e){return e instanceof rr}getBookmark(){return FH}}Ne.jsonID("all",rr);const FH={map(){return this},resolve(t){return new rr(t)}};function ca(t,e,n,r,i,s=!1){if(e.inlineContent)return Oe.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&&Te.isSelectable(c))return Te.create(t,n-(i<0?c.nodeSize:0))}else{let u=ca(t,c,n+i,i<0?c.childCount:0,i,s);if(u)return u}n+=c.nodeSize*i}return null}function gT(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ln||i instanceof un))return;let s=t.mapping.maps[r],l;s.forEach((c,u,f,h)=>{l==null&&(l=h)}),t.setSelection(Ne.near(t.doc.resolve(l),n))}const yT=1,Qf=2,bT=4;class qH extends N1{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|yT)&~Qf,this.storedMarks=null,this}get selectionSet(){return(this.updated&yT)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Qf,this}ensureMarks(e){return bt.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&Qf)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Qf,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)||bt.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(Ne.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|=bT,this}get scrolledIntoView(){return(this.updated&bT)>0}}function xT(t,e){return!e||!t?t:t.bind(e)}class lu{constructor(e,n,r){this.name=e,this.init=xT(n.init,r),this.apply=xT(n.apply,r)}}const KH=[new lu("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new lu("selection",{init(t,e){return t.selection||Ne.atStart(e.doc)},apply(t){return t.selection}}),new lu("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new lu("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class z0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=KH.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 lu(r.key,r.spec.state,r))})}}class ma{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let u=i?i[l].n:0,f=i?i[l].state:this,h=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,f,r);if(h&&r.filterTransaction(h,l)){if(h.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(h),r=r.applyInner(h),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 ma(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 qH(this)}static create(e){let n=new z0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ma(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 z0(this.schema,e.plugins),r=n.fields,i=new ma(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 z0(e.schema,e.plugins),s=new ma(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=no.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=Ne.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],f=u.spec.state;if(u.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=f.fromJSON.call(u,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function wD(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=wD(i,e,{})),n[r]=i}return n}class ht{constructor(e){this.spec=e,this.props={},e.props&&wD(e.props,this,this.props),this.key=e.key?e.key.key:kD("plugin")}getState(e){return e[this.key]}}const L0=Object.create(null);function kD(t){return t in L0?t+"$"+ ++L0[t]:(L0[t]=0,t+"$")}class At{constructor(e="key"){this.key=kD(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Cn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ua=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let qb=null;const ns=function(t,e,n){let r=qb||(qb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},YH=function(){qb=null},cl=function(t,e,n,r){return n&&(vT(t,e,n,r,-1)||vT(t,e,n,r,1))},WH=/^(img|br|input|textarea|hr)$/i;function vT(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Pr(t))){let l=t.parentNode;if(!l||l.nodeType!=1||Cd(t)||WH.test(t.nodeName)||t.contentEditable=="false")return!1;e=Cn(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?Pr(t):0}else return!1}}function Pr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function GH(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=Pr(t)}else if(t.parentNode&&!Cd(t))e=Cn(t),t=t.parentNode;else return null}}function ZH(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&&!Cd(t))e=Cn(t)+1,t=t.parentNode;else return null}}function JH(t,e,n){for(let r=e==0,i=e==Pr(t);r||i;){if(t==n)return!0;let s=Cn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Pr(t)}}function Cd(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 xm=function(t){return t.focusNode&&cl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Vo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function XH(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function QH(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Pr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Pr(r.startContainer),r.startOffset)}}}const Ai=typeof navigator<"u"?navigator:null,ST=typeof document<"u"?document:null,yo=Ai&&Ai.userAgent||"",Kb=/Edge\/(\d+)/.exec(yo),CD=/MSIE \d/.exec(yo),Yb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yo),ir=!!(CD||Yb||Kb),ro=CD?document.documentMode:Yb?+Yb[1]:Kb?+Kb[1]:0,qr=!ir&&/gecko\/(\d+)/i.test(yo);qr&&+(/Firefox\/(\d+)/.exec(yo)||[0,0])[1];const Wb=!ir&&/Chrome\/(\d+)/.exec(yo),Tn=!!Wb,ED=Wb?+Wb[1]:0,Rn=!ir&&!!Ai&&/Apple Computer/.test(Ai.vendor),Ha=Rn&&(/Mobile\/\w+/.test(yo)||!!Ai&&Ai.maxTouchPoints>2),Br=Ha||(Ai?/Mac/.test(Ai.platform):!1),TD=Ai?/Win/.test(Ai.platform):!1,rs=/Android \d/.test(yo),Ed=!!ST&&"webkitFontSmoothing"in ST.documentElement.style,e8=Ed?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function t8(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 Ji(t,e){return typeof t=="number"?t:t[e]}function n8(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 wT(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=Ua(l);continue}let c=l,u=c==s.body,f=u?t8(s):n8(c),h=0,m=0;if(e.top<f.top+Ji(r,"top")?m=-(f.top-e.top+Ji(i,"top")):e.bottom>f.bottom-Ji(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+Ji(i,"top")-f.top:e.bottom-f.bottom+Ji(i,"bottom")),e.left<f.left+Ji(r,"left")?h=-(f.left-e.left+Ji(i,"left")):e.right>f.right-Ji(r,"right")&&(h=e.right-f.right+Ji(i,"right")),h||m)if(u)s.defaultView.scrollBy(h,m);else{let b=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),h&&(c.scrollLeft+=h);let k=c.scrollLeft-b,C=c.scrollTop-v;e={left:e.left-k,top:e.top-C,right:e.right-k,bottom:e.bottom-C}}let g=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:Ua(l)}}function r8(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(s,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:AD(t.dom)}}function AD(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ua(r));return e}function i8({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;MD(n,r==0?0:r-e)}function MD(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 la=null;function s8(t){if(t.setActive)return t.setActive();if(la)return t.focus(la);let e=AD(t);t.focus(la==null?{get preventScroll(){return la={preventScroll:!0},!0}}:void 0),la||(la=!1,MD(e,0))}function OD(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,u,f;for(let h=t.firstChild,m=0;h;h=h.nextSibling,m++){let g;if(h.nodeType==1)g=h.getClientRects();else if(h.nodeType==3)g=ns(h).getClientRects();else continue;for(let b=0;b<g.length;b++){let v=g[b];if(v.top<=l&&v.bottom>=c){l=Math.max(v.bottom,l),c=Math.min(v.top,c);let k=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(k<r){n=h,r=k,i=k&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,h.nodeType==1&&k&&(s=m+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=h,f={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?o8(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:OD(n,i)}function o8(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=$s(r,1);if(l.top!=l.bottom&&L1(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 L1(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function l8(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function a8(t,e,n){let{node:r,offset:i}=OD(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 c8(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?i=c.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function _D(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let l=t.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let u=0;u<c.length;u++){let f=c[u];if(L1(e,f))return _D(l,e,f)}}if((s=(s+1)%r)==i)break}return t}function u8(t,e){let n=t.dom.ownerDocument,r,i=0,s=QH(n,e.left,e.top);s&&({node:r,offset:i}=s);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let f=t.dom.getBoundingClientRect();if(!L1(e,f)||(l=_D(t.dom,e,f),!l))return null}if(Rn)for(let f=l;r&&f;f=Ua(f))f.draggable&&(r=void 0);if(l=l8(l,e),r){if(qr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let h=r.childNodes[i],m;h.nodeName=="IMG"&&(m=h.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;Ed&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=c8(t,r,i,e))}c==null&&(c=a8(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function kT(t){return t.top<t.bottom||t.left<t.right}function $s(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(kT(r))return r}return Array.prototype.find.call(n,kT)||t.getBoundingClientRect()}const d8=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function DD(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=Ed||qr;if(r.nodeType==3)if(l&&(d8.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=$s(ns(r,i,i),n);if(qr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=$s(ns(r,i-1,i-1),-1);if(f.top==u.top){let h=$s(ns(r,i,i+1),-1);if(h.top!=u.top)return ru(h,h.left<f.left)}}return u}else{let u=i,f=i,h=n<0?1:-1;return n<0&&!i?(f++,h=-1):n>=0&&i==r.nodeValue.length?(u--,h=1):n<0?u--:f++,ru($s(ns(r,u,f),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Pr(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return j0(u.getBoundingClientRect(),!1)}if(s==null&&i<Pr(r)){let u=r.childNodes[i];if(u.nodeType==1)return j0(u.getBoundingClientRect(),!0)}return j0(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Pr(r))){let u=r.childNodes[i-1],f=u.nodeType==3?ns(u,Pr(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return ru($s(f,1),!1)}if(s==null&&i<Pr(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?ns(u,0,l?0:1):u.nodeType==1?u:null:null;if(f)return ru($s(f,-1),!0)}return ru($s(r.nodeType==3?ns(r):r,-n),n>=0)}function ru(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 j0(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 RD(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 f8(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return RD(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=DD(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ns(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.bottom>h.top+1&&(n=="up"?l.top-h.top>(h.bottom-l.top)*2:h.bottom-l.bottom>(l.bottom-h.top)*2))return!1}}return!0})}const h8=/[\u0590-\u08ac]/;function p8(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?!h8.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:RD(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:k}=t.domSelectionRange(),C=v&&!b.contains(v.nodeType==1?v:v.parentNode)||u==v&&f==k;try{c.collapse(h,m),u&&(u!=h||f!=m)&&c.extend&&c.extend(u,f)}catch{}return g!=null&&(c.caretBidiLevel=g),C}):r.pos==r.start()||r.pos==r.end()}let CT=null,ET=null,TT=!1;function m8(t,e,n){return CT==e&&ET==n?TT:(CT=e,ET=n,TT=n=="up"||n=="down"?f8(t,e,n):p8(t,e,n))}const Kr=0,AT=1,$o=2,Mi=3;class Td{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Kr,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>Cn(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 zD){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 ND&&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?Cn(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?Cn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=r,c=0;;c++){let u=this.children[c],f=l+u.size;if(i==-1&&e<=f){let h=l+u.border;if(e>=h&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,h);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=Cn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let h=c+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Cn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=f}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),l=Math.max(e,n);for(let b=0,v=0;b<this.children.length;b++){let k=this.children[b],C=v+k.size;if(s>v&&l<C)return k.setSelection(e-v-k.border,n-v-k.border,r,i);v=C}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((qr||Rn)&&e==n){let{node:b,offset:v}=c;if(b.nodeType==3){if(m=!!(v&&b.nodeValue[v-1]==`
108
+ `),m&&v==b.nodeValue.length)for(let k=b,C;k;k=k.parentNode){if(C=k.nextSibling){C.nodeName=="BR"&&(c=u={node:C.parentNode,offset:Cn(C)+1});break}let E=k.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let k=b.childNodes[v-1];m=k&&(k.nodeName=="BR"||k.contentEditable=="false")}}if(qr&&h.focusNode&&h.focusNode!=u.node&&h.focusNode.nodeType==1){let b=h.focusNode.childNodes[h.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&Rn)&&cl(c.node,c.offset,h.anchorNode,h.anchorOffset)&&cl(u.node,u.offset,h.focusNode,h.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&qr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let v=c;c=u,u=v}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),f.removeAllRanges(),f.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,u=l-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==l?$o:AT,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Mi:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?$o:Mi}r=l}this.dirty=$o}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?$o:AT;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ND extends Td{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==Kr&&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 g8 extends Td{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 ul extends Td{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=yl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ul(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Mi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Mi&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Kr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Kr}}slice(e,n,r){let i=ul.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=Zb(s,n,l,r)),e>0&&(s=Zb(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 io extends Td{constructor(e,n,r,i,s,l,c,u,f){super(e,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,l){let c=s.nodeViews[n.type.name],u,f=c&&c(n,s,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,i),h=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:m}=yl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let g=h;return h=ID(h,r,n),f?u=new y8(e,n,r,i,h,m||null,g,f,s,l+1):n.isText?new vm(e,n,r,i,h,g,s):new io(e,n,r,i,h,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==Kr&&e.eq(this.node)&&ip(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,u=new x8(this,l&&l.node,e);w8(this.node,this.innerDeco,(f,h,m)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!m&&u.syncToMarks(h==this.node.childCount?bt.none:this.node.child(h).marks,r,e,h),u.placeWidget(f,e,i)},(f,h,m,g)=>{u.syncToMarks(f.marks,r,e,g);let b;u.findNodeMatch(f,h,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(b=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,h,m,b,e)||u.updateNextNode(f,h,m,e,g,i)||u.addNode(f,h,m,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==$o)&&(l&&this.protectLocalComposition(e,l),LD(this.contentDOM,this.children,e),Ha&&k8(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Oe)||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=C8(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 g8(this,s,n,i);e.input.compositionNodes.push(l),this.children=Zb(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Mi||!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=Kr}updateOuterDeco(e){if(ip(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=jD(this.dom,this.nodeDOM,Gb(this.outerDeco,this.node,n),Gb(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 MT(t,e,n,r,i){ID(r,e,t);let s=new io(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class vm extends io{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==Mi||this.dirty!=Kr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Kr||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=Kr,!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 vm(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=Mi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zD extends Td{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Kr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class y8 extends io{constructor(e,n,r,i,s,l,c,u,f,h){super(e,n,r,i,s,l,c,f,h),this.spec=u}update(e,n,r,i){if(this.dirty==Mi)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 LD(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=OT(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof ul){let u=r?r.previousSibling:t.lastChild;LD(l.contentDOM,l.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=OT(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const bu=function(t){t&&(this.nodeName=t)};bu.prototype=Object.create(null);const Fo=[new bu];function Gb(t,e,n){if(t.length==0)return Fo;let r=n?Fo[0]:new bu,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new bu(l.nodeName));for(let c in l){let u=l[c];u!=null&&(n&&i.length==1&&i.push(r=new bu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return i}function jD(t,e,n,r){if(n==Fo&&r==Fo)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let u;c&&c.nodeName==l.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==l.nodeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(i),c=Fo[0]),i=u}b8(i,c||Fo[0],l)}return i}function b8(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 ID(t,e,n){return jD(t,t,Fo,Gb(e,n,t.nodeType!=1))}function ip(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 OT(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class x8{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=v8(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=Kr,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let h=this.index;h<f;h++){let m=this.top.children[h];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){u=h;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let h=ul.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let l=this.top.children[i];return l.dirty==Mi&&l.dom==l.contentDOM&&(l.dirty=$o),l.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof io){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let h=u.dom,m,g=this.isLocked(h)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Mi&&ip(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,c),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(u,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=$o,m.updateChildren(i,l+1),m.dirty=Kr),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)||!ip(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=io.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=io.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 ND(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 ul;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof vm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Rn||Tn)&&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 zD(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 v8(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,l=[];e:for(;i>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof ul)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function S8(t,e){return t.type.side-e.type.side}function w8(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let h=t.child(f);r(h,i,e.forChild(s,h),f),s+=h.nodeSize}return}let l=0,c=[],u=null;for(let f=0;;){let h,m;for(;l<i.length&&i[l].to==s;){let C=i[l++];C.widget&&(h?(m||(m=[h])).push(C):h=C)}if(h)if(m){m.sort(S8);for(let C=0;C<m.length;C++)n(m[C],f,!!u)}else n(h,f,!!u);let g,b;if(u)b=-1,g=u,u=null;else if(f<t.childCount)b=f,g=t.child(f++);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 v=s+g.nodeSize;if(g.isText){let C=v;l<i.length&&i[l].from<C&&(C=i[l].from);for(let E=0;E<c.length;E++)c[E].to<C&&(C=c[E].to);C<v&&(u=g.cut(C-s),g=g.cut(0,C-s),v=C,b=-1)}else for(;l<i.length&&i[l].to<v;)l++;let k=g.isInline&&!g.isLeaf?c.filter(C=>!C.inline):c.slice();r(g,k,e.forChild(s,g),b),s=v}}function k8(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 C8(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let l=t.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let u=l.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?u.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Zb(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let u=t[l],f=c,h=c+=u.size;f>=n||h<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),h>n&&s.push(u.slice(n-f,u.size,r)))}return s}function j1(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),u,f;if(xm(n)){for(u=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Te.isSelectable(m)&&i.parent&&!(m.isInline&&JH(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Te(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 v=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[u,l]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(l)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let h=r.resolve(u);if(!f){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;f=I1(t,h,c,m)}return f}function BD(t){return t.editable?t.hasFocus():HD(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function as(t,e=!1){let n=t.state.selection;if(UD(t,n),!!BD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Tn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&cl(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)T8(t);else{let{anchor:r,head:i}=n,s,l;_T&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=DT(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=DT(t,n.to))),t.docView.setSelection(r,i,t,e),_T&&(s&&RT(s),l&&RT(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&E8(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const _T=Rn||Tn&&ED<63;function DT(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(Rn&&i&&i.contentEditable=="false")return I0(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return I0(i);if(s)return I0(s)}}function I0(t){return t.contentEditable="true",Rn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function RT(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function E8(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(()=>{(!BD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function T8(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Cn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ir&&ro<=11&&(n.disabled=!0,n.disabled=!1)}function UD(t,e){if(e instanceof Te){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(NT(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else NT(t)}function NT(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function I1(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function zT(t){return t.editable&&!t.hasFocus()?!1:HD(t)}function HD(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 A8(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return cl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Jb(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&&Ne.findFrom(s,e)}function Fs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function LT(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 Fs(t,new Oe(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Jb(t.state,e);return i&&i instanceof Te?Fs(t,i):!1}else if(!(Br&&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?Te.isSelectable(s)?Fs(t,new Te(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Ed?Fs(t,new Oe(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Te&&r.node.isInline)return Fs(t,new Oe(e>0?r.$to:r.$from));{let i=Jb(t.state,e);return i?Fs(t,i):!1}}}function sp(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function xu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function aa(t,e){return e<0?M8(t):O8(t)}function M8(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<sp(n)&&xu(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(xu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(VD(n))break;{let c=n.previousSibling;for(;c&&xu(c,-1);)i=n.parentNode,s=Cn(c),c=c.previousSibling;if(c)n=c,r=sp(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?Xb(t,n,r):i&&Xb(t,i,s)}function O8(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=sp(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(xu(c,1))s=n,l=++r;else break}else{if(VD(n))break;{let c=n.nextSibling;for(;c&&xu(c,1);)s=c.parentNode,l=Cn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=sp(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Xb(t,s,l)}function VD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function _8(t,e){for(;t&&e==t.childNodes.length&&!Cd(t);)e=Cn(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 D8(t,e){for(;t&&!e&&!Cd(t);)e=Cn(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 Xb(t,e,n){if(e.nodeType!=3){let s,l;(l=_8(e,n))?(e=l,n=0):(s=D8(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(xm(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&&as(t)},50)}function jT(t,e){let n=t.state.doc.resolve(e);if(!(Tn||TD)&&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 IT(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||Br&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Jb(t.state,e);if(l&&l instanceof Te)return Fs(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof rr?Ne.near(l,e):Ne.findFrom(l,e);return c?Fs(t,c):!1}return!1}function BT(t,e){if(!(t.state.selection instanceof Oe))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 UT(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function R8(t){if(!Rn||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;UT(t,r,"true"),setTimeout(()=>UT(t,r,"false"),20)}return!1}function N8(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function z8(t,e){let n=e.keyCode,r=N8(e);if(n==8||Br&&n==72&&r=="c")return BT(t,-1)||aa(t,-1);if(n==46&&!e.shiftKey||Br&&n==68&&r=="c")return BT(t,1)||aa(t,1);if(n==13||n==27)return!0;if(n==37||Br&&n==66&&r=="c"){let i=n==37?jT(t,t.state.selection.from)=="ltr"?-1:1:-1;return LT(t,i,r)||aa(t,i)}else if(n==39||Br&&n==70&&r=="c"){let i=n==39?jT(t,t.state.selection.from)=="ltr"?1:-1:1;return LT(t,i,r)||aa(t,i)}else{if(n==38||Br&&n==80&&r=="c")return IT(t,-1,r)||aa(t,-1);if(n==40||Br&&n==78&&r=="c")return R8(t)||IT(t,1,r)||aa(t,1);if(r==(Br?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function B1(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")||yl.fromSchema(t.state.schema),c=YD(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));let f=u.firstChild,h,m=0;for(;f&&f.nodeType==1&&(h=KD[f.nodeName.toLowerCase()]);){for(let b=h.length-1;b>=0;b--){let v=c.createElement(h[b]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}f=u.firstChild}f&&f.nodeType==1&&f.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,`
109
+
110
+ `);return{dom:u,text:g,slice:e}}function PD(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new he(te.from(t.state.schema.text(e.replace(/\r\n?/g,`
111
+ `))),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,v=yl.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let C=l.appendChild(document.createElement("p"));k&&C.appendChild(v.serializeNode(b.text(k,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=B8(n),Ed&&U8(l);let f=l&&l.querySelector("[data-pm-slice]"),h=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[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")||gu.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||h),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!L8.test(g.parentNode.nodeName)?{ignore:!0}:null}})),h)c=H8(HT(c,+h[1],+h[2]),h[4]);else if(c=he.maxOpen(j8(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=HT(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,u)}),c}const L8=/^(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 j8(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,l=[];if(t.forEach(c=>{if(!l)return;let u=i.findWrapping(c.type),f;if(!u)return l=null;if(f=l.length&&s.length&&FD(u,s,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=qD(l[l.length-1],s.length));let h=$D(c,u);l.push(h),i=i.matchType(h.type),s=u}}),l)return te.from(l)}return t}function $D(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,te.from(t));return t}function FD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=FD(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($D(n,t,i+1))))}}function qD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,qD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(te.empty,!0);return t.copy(n.append(r))}function Qb(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=Qb(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 HT(t,e,n){return e<t.openStart&&(t=new he(Qb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new he(Qb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const KD={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 VT=null;function YD(){return VT||(VT=document.implementation.createHTMLDocument("title"))}let B0=null;function I8(t){let e=window.trustedTypes;return e?(B0||(B0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),B0.createHTML(t)):t}function B8(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=YD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&KD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=I8(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function U8(t){let e=t.querySelectorAll(Tn?"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 H8(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:l}=t;for(let c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=te.from(u.create(r[c+1],i)),s++,l++}return new he(i,s,l)}const $n={},Fn={},V8={touchstart:!0,touchmove:!0};class P8{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 $8(t){for(let e in $n){let n=$n[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{q8(t,r)&&!U1(t,r)&&(t.editable||!(r.type in Fn))&&n(t,r)},V8[e]?{passive:!0}:void 0)}Rn&&t.dom.addEventListener("input",()=>null),ex(t)}function to(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function F8(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 ex(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>U1(t,r))})}function U1(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function q8(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 K8(t,e){!U1(t,e)&&$n[e.type]&&(t.editable||!(e.type in Fn))&&$n[e.type](t,e)}Fn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!GD(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(rs&&Tn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ha&&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,Vo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||z8(t,n)?n.preventDefault():to(t,"key")};Fn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Fn.keypress=(t,e)=>{let n=e;if(GD(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Br&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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 Sm(t){return{left:t.clientX,top:t.clientY}}function Y8(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function H1(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 Ta(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 W8(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(Ta(t,new Te(n)),!0):!1}function G8(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Te&&(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(Te.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?(Ta(t,Te.create(t.state.doc,i)),!0):!1}function Z8(t,e,n,r,i){return H1(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?G8(t,n):W8(t,n))}function J8(t,e,n,r){return H1(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function X8(t,e,n,r){return H1(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Q8(t,n,r)}function Q8(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ta(t,Oe.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)Ta(t,Oe.create(r,c+1,c+1+l.content.size));else if(Te.isSelectable(l))Ta(t,Te.create(r,c));else continue;return!0}}function V1(t){return op(t)}const WD=Br?"metaKey":"ctrlKey";$n.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=V1(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Y8(n,t.input.lastClick)&&!n[WD]&&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(Sm(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new eV(t,l,n,!!r)):(s=="doubleClick"?J8:X8)(t,l.pos,l.inside,n)?n.preventDefault():to(t,"pointer"))};class eV{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[WD],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let h=e.state.doc.resolve(n.pos);s=h.parent,l=h.depth?h.before():0}const c=i?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Te&&f.from<=l&&f.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)),to(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(()=>as(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(Sm(e))),this.updateAllowDefault(e),this.allowDefault||!n?to(this.view,"pointer"):Z8(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rn&&this.mightDrag&&!this.mightDrag.node.isAtom||Tn&&!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)?(Ta(this.view,Ne.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):to(this.view,"pointer")}move(e){this.updateAllowDefault(e),to(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)}}$n.touchstart=t=>{t.input.lastTouch=Date.now(),V1(t),to(t,"pointer")};$n.touchmove=t=>{t.input.lastTouch=Date.now(),to(t,"pointer")};$n.contextmenu=t=>V1(t);function GD(t,e){return t.composing?!0:Rn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const tV=rs?5e3:-1;Fn.compositionstart=Fn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Tn&&TD&&nV(t)))t.markCursor=t.state.storedMarks||n.marks(),op(t,!0),t.markCursor=null;else if(op(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}ZD(t,tV)};function nV(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"}Fn.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++,ZD(t,20))};function ZD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>op(t),e))}function JD(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=iV());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function rV(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=GH(e.focusNode,e.focusOffset),r=ZH(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 iV(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function op(t,e=!1){if(!(rs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),JD(t),e||t.docView&&t.docView.dirty){let n=j1(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 sV(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 Zu=ir&&ro<15||Ha&&e8<604;$n.copy=Fn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Zu?null:n.clipboardData,l=r.content(),{dom:c,text:u}=B1(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):sV(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function oV(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function lV(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?Ju(t,r.value,null,i,e):Ju(t,r.textContent,r.innerHTML,i,e)},50)}function Ju(t,e,n,r,i){let s=PD(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||he.empty)))return!0;if(!s)return!1;let l=oV(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 XD(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," "):""}Fn.paste=(t,e)=>{let n=e;if(t.composing&&!rs)return;let r=Zu?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ju(t,XD(r),r.getData("text/html"),i,n)?n.preventDefault():lV(t,n)};class QD{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const aV=Br?"altKey":"ctrlKey";function eR(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[aV]}$n.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(Sm(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Te?i.to-1:i.to))){if(r&&r.mightDrag)l=Te.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=Te.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:u,text:f,slice:h}=B1(t,c);(!n.dataTransfer.files.length||!Tn||ED>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Zu||n.dataTransfer.setData("text/plain",f),t.dragging=new QD(h,eR(t,n),l)};$n.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Fn.dragover=Fn.dragenter=(t,e)=>e.preventDefault();Fn.drop=(t,e)=>{try{cV(t,e,t.dragging)}finally{t.dragging=null}};function cV(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Sm(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=PD(t,XD(e.dataTransfer),Zu?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&eR(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||he.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?gD(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(l){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let f=u.mapping.map(c),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(h?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(m))return;let g=u.doc.resolve(f);if(h&&Te.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Te(g));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,k,C,E)=>b=E),u.setSelection(I1(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}$n.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())&&as(t)},20))};$n.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)};$n.beforeinput=(t,e)=>{if(Tn&&rs&&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,Vo(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 Fn)$n[t]=Fn[t];function Xu(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 lp{constructor(e,n){this.toDOM=e,this.spec=n||Xo,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 jt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof lp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Xu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class so{constructor(e,n){this.attrs=e,this.spec=n||Xo}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 jt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof so&&Xu(this.attrs,e.attrs)&&Xu(this.spec,e.spec)}static is(e){return e.type instanceof so}destroy(){}}class P1{constructor(e,n){this.attrs=e,this.spec=n||Xo}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 jt(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 P1&&Xu(this.attrs,e.attrs)&&Xu(this.spec,e.spec)}destroy(){}}class jt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new jt(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 jt(e,e,new lp(n,r))}static inline(e,n,r,i){return new jt(e,n,new so(r,i))}static node(e,n,r,i){return new jt(e,n,new P1(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof so}get widget(){return this.type instanceof lp}}const ua=[],Xo={};class Qe{constructor(e,n){this.local=e.length?e:ua,this.children=n.length?n:ua}static create(e,n){return n.length?ap(n,e,0,Xo):Mn}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==Mn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Xo)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,i);u&&u.type.valid(n,u)?(l||(l=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?uV(this.children,l||[],e,n,r,i,s):l?new Qe(l.sort(Qo),ua):Mn}add(e,n){return n.length?this==Mn?Qe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,u)=>{let f=u+r,h;if(h=nR(n,c,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(c,h,f+1):i.splice(s,0,u,u+c.nodeSize,ap(h,c,f+1,Xo)),s+=3}});let l=tR(s?rR(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new Qe(l.length?this.local.concat(l).sort(Qo):this.local,i||this.children)}remove(e){return e.length==0||this==Mn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,u=r[s+1]+n;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>c&&m.to<u&&(e[h]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(l,c+1);f!=Mn?r[s+2]=f:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let c=0;c<i.length;c++)i[c].eq(l,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Qe(i,r):Mn}forChild(e,n){if(this==Mn)return this;if(n.isLeaf)return Qe.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<l&&u.to>s&&u.type instanceof so){let f=Math.max(s,u.from)-s,h=Math.min(l,u.to)-s;f<h&&(i||(i=[])).push(u.copy(f,h))}}if(i){let c=new Qe(i.sort(Qo),ua);return r?new Gs([c,r]):c}return r||Mn}eq(e){if(this==e)return!0;if(!(e instanceof Qe)||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 $1(this.localsInner(e))}localsInner(e){if(this==Mn)return ua;if(e.inlineContent||!this.local.some(so.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof so||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Qe.empty=new Qe([],[]);Qe.removeOverlap=$1;const Mn=Qe.empty;class Gs{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Xo));return Gs.from(r)}forChild(e,n){if(n.isLeaf)return Qe.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Mn&&(s instanceof Gs?r=r.concat(s.members):r.push(s))}return Gs.from(r)}eq(e){if(!(e instanceof Gs)||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?$1(r?n:n.sort(Qo)):ua}static from(e){switch(e.length){case 0:return Mn;case 1:return e[0];default:return new Gs(e.every(n=>n instanceof Qe)?e:e.reduce((n,r)=>n.concat(r instanceof Qe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function uV(t,e,n,r,i,s,l){let c=t.slice();for(let f=0,h=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,b,v,k)=>{let C=k-v-(b-g);for(let E=0;E<c.length;E+=3){let j=c[E+1];if(j<0||g>j+h-m)continue;let N=c[E]+h-m;b>=N?c[E+1]=g<=N?-2:-1:g>=h&&C&&(c[E]+=C,c[E+1]+=C)}m+=C}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[f+1]=-1;continue}let h=n.map(t[f]+s),m=h-i;if(m<0||m>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),b=g-i,{index:v,offset:k}=r.content.findIndex(m),C=r.maybeChild(v);if(C&&k==m&&k+C.nodeSize==b){let E=c[f+2].mapInner(n,C,h+1,t[f]+s+1,l);E!=Mn?(c[f]=m,c[f+1]=b,c[f+2]=E):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=dV(c,t,e,n,i,s,l),h=ap(f,r,0,l);e=h.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<h.children.length;m+=3){let b=h.children[m];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,h.children[m],h.children[m+1],h.children[m+2])}}return new Qe(e.sort(Qo),c)}function tR(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 jt(i.from+e,i.to+e,i.type))}return n}function dV(t,e,n,r,i,s,l){function c(u,f){for(let h=0;h<u.local.length;h++){let m=u.local[h].map(r,i,f);m?n.push(m):l.onRemove&&l.onRemove(u.local[h].spec)}for(let h=0;h<u.children.length;h+=3)c(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function nR(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 rR(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ap(t,e,n,r){let i=[],s=!1;e.forEach((c,u)=>{let f=nR(t,c,u+n);if(f){s=!0;let h=ap(f,c,n+u+1,r);h!=Mn&&i.push(u,u+c.nodeSize,h)}});let l=tR(s?rR(t):t,-n).sort(Qo);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 Qe(l,i):Mn}function Qo(t,e){return t.from-e.from||t.to-e.to}function $1(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),PT(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),PT(e,i,r.copy(s.from,r.to)));break}}}return e}function PT(t,e,n){for(;e<t.length&&Qo(n,t[e])>0;)e++;t.splice(e,0,n)}function U0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Mn&&e.push(r)}),t.cursorWrapper&&e.push(Qe.create(t.state.doc,[t.cursorWrapper.deco])),Gs.from(e)}const fV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},hV=ir&&ro<=11;class pV{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 mV{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new pV,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]);ir&&ro<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Rn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),hV&&(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,fV)),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(zT(this.view)){if(this.suppressingSelectionUpdates)return as(this.view);if(ir&&ro<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cl(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=Ua(s))n.add(s);for(let s=e.anchorNode;s;s=Ua(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)&&zT(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,u=[];if(e.editable)for(let h=0;h<n.length;h++){let m=this.registerMutation(n[h],u);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(u.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let h of u)if(h.nodeName=="BR"&&h.parentNode){let m=h.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){h.parentNode.removeChild(h);break}m=m.firstChild}}}else if(qr&&u.length){let h=u.filter(m=>m.nodeName=="BR");if(h.length==2){let[m,g]=h;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of h){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||bV(e,m)!=b)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&xm(r)&&(f=j1(e))&&f.eq(Ne.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,as(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),gV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,xV(e,u)),this.handleDOMChange(s,l,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||as(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 h=0;h<e.addedNodes.length;h++){let m=e.addedNodes[h];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(ir&&ro<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:g}=e.addedNodes[h];(!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?Cn(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),u=s&&s.parentNode==e.target?Cn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:c,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let $T=new WeakMap,FT=!1;function gV(t){if(!$T.has(t)&&($T.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=qr,FT)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."),FT=!0}}function qT(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return cl(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function yV(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return qT(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?qT(t,n):null}function bV(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 xV(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function vV(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),u=t.domSelectionRange(),f,h=u.anchorNode;if(h&&t.dom.contains(h.nodeType==1?h:h.parentNode)&&(f=[{node:h,offset:u.anchorOffset}],xm(u)||f.push({node:u.focusNode,offset:u.focusOffset})),Tn&&t.input.lastKeyCode===8)for(let C=s;C>i;C--){let E=r.childNodes[C-1],j=E.pmViewDesc;if(E.nodeName=="BR"&&!j){s=C;break}if(!j||j.size)break}let m=t.state.doc,g=t.someProp("domParser")||gu.fromSchema(t.state.schema),b=m.resolve(l),v=null,k=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:f,ruleFromNode:SV,context:b});if(f&&f[0].pos!=null){let C=f[0].pos,E=f[1]&&f[1].pos;E==null&&(E=C),v={anchor:C+l,head:E+l}}return{doc:k,sel:v,from:l,to:c}}function SV(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Rn&&/^(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||Rn&&/^(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 wV=/^(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 kV(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,Q=j1(t,I);if(Q&&!t.state.selection.eq(Q)){if(Tn&&rs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",oe=>oe(t,Vo(13,"Enter"))))return;let W=t.state.tr.setSelection(Q);I=="pointer"?W.setMeta("pointer",!0):I=="key"&&W.scrollIntoView(),s&&W.setMeta("composition",s),t.dispatch(W)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,f=vV(t,e,n),h=t.state.doc,m=h.slice(f.from,f.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 v=TV(m.content,f.doc.content,f.from,g,b);if(v&&t.input.domChangeCount++,(Ha&&t.input.lastIOSEnter>Date.now()-225||rs)&&i.some(I=>I.nodeType==1&&!wV.test(I.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",I=>I(t,Vo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Oe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let I=KT(t,t.state.doc,f.sel);if(I&&!I.eq(t.state.selection)){let Q=t.state.tr.setSelection(I);s&&Q.setMeta("composition",s),t.dispatch(Q)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof Oe&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),ir&&ro<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>f.from&&f.doc.textBetween(v.start-f.from-1,v.start-f.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let k=f.doc.resolveNoCache(v.start-f.from),C=f.doc.resolveNoCache(v.endB-f.from),E=h.resolve(v.start),j=k.sameParent(C)&&k.parent.inlineContent&&E.end()>=v.endA;if((Ha&&t.input.lastIOSEnter>Date.now()-225&&(!j||i.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!j&&k.pos<f.doc.content.size&&(!k.sameParent(C)||!k.parent.inlineContent)&&k.pos<C.pos&&!/\S/.test(f.doc.textBetween(k.pos,C.pos,"","")))&&t.someProp("handleKeyDown",I=>I(t,Vo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&EV(h,v.start,v.endA,k,C)&&t.someProp("handleKeyDown",I=>I(t,Vo(8,"Backspace")))){rs&&Tn&&t.domObserver.suppressSelectionUpdates();return}Tn&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),rs&&!j&&k.start()!=C.start()&&C.parentOffset==0&&k.depth==C.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==v.endA&&(v.endB-=2,C=f.doc.resolveNoCache(v.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,Vo(13,"Enter"))})},20));let N=v.start,q=v.endA,H=I=>{let Q=I||t.state.tr.replace(N,q,f.doc.slice(v.start-f.from,v.endB-f.from));if(f.sel){let W=KT(t,Q.doc,f.sel);W&&!(Tn&&t.composing&&W.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(W.head==N||W.head==Q.mapping.map(q)-1)||ir&&W.empty&&W.head==N)&&Q.setSelection(W)}return s&&Q.setMeta("composition",s),Q.scrollIntoView()},R;if(j)if(k.pos==C.pos){ir&&ro<=11&&k.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>as(t),20));let I=H(t.state.tr.delete(N,q)),Q=h.resolve(v.start).marksAcross(h.resolve(v.endA));Q&&I.ensureMarks(Q),t.dispatch(I)}else if(v.endA==v.endB&&(R=CV(k.parent.content.cut(k.parentOffset,C.parentOffset),E.parent.content.cut(E.parentOffset,v.endA-E.start())))){let I=H(t.state.tr);R.type=="add"?I.addMark(N,q,R.mark):I.removeMark(N,q,R.mark),t.dispatch(I)}else if(k.parent.child(k.index()).isText&&k.index()==C.index()-(C.textOffset?0:1)){let I=k.parent.textBetween(k.parentOffset,C.parentOffset),Q=()=>H(t.state.tr.insertText(I,N,q));t.someProp("handleTextInput",W=>W(t,N,q,I,Q))||t.dispatch(Q())}else t.dispatch(H());else t.dispatch(H())}function KT(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:I1(t,e.resolve(n.anchor),e.resolve(n.head))}function CV(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,u;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<n.length;h++)s=n[h].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",u=h=>h.mark(c.addToSet(h.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",u=h=>h.mark(c.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<e.childCount;h++)f.push(u(e.child(h)));if(te.from(f).eq(t))return{mark:c,type:l}}function EV(t,e,n,r,i){if(n-e<=i.pos-r.pos||H0(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(H0(s,!0,!0));return!l.parent.isTextblock||l.pos>n||H0(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function H0(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 TV(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,s-Math.min(l,c));r-=l+u-s}if(l<s&&t.size<e.size){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<e.size&&YT(e.textBetween(s-1,s+1))&&(s+=u?1:-1),c=s+(c-l),l=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,s&&s<t.size&&YT(t.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function YT(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 iR{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 P8,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(XT),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=ZT(this),GT(this),this.nodeViews=JT(this),this.docView=MT(this.state.doc,WT(this),U0(this),this.dom,this),this.domObserver=new mV(this,(r,i,s,l)=>kV(this,r,i,s,l)),this.domObserver.start(),$8(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&&ex(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(XT),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&&(JD(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=JT(this);MV(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&ex(this),this.editable=ZT(this),GT(this);let u=U0(this),f=WT(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,f,u);(m||!e.selection.eq(i.selection))&&(l=!0);let g=h=="preserve"&&l&&this.dom.style.overflowAnchor==null&&r8(this);if(l){this.domObserver.stop();let b=m&&(ir||Tn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&AV(i.selection,e.selection);if(m){let v=Tn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=rV(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=MT(e.doc,f,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&A8(this))?as(this,b):(UD(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),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():g&&i8(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 Te){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&wT(this,n.getBoundingClientRect(),e)}else wT(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 QD(e.slice,e.move,i<0?void 0:Te.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(ir){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&&s8(this.dom),as(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 u8(this,e)}coordsAtPos(e,n=1){return DD(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 m8(this,n||this.state,e)}pasteHTML(e,n){return Ju(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ju(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return B1(this,e)}destroy(){this.docView&&(F8(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],U0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,YH())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return K8(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rn&&this.root.nodeType===11&&XH(this.dom.ownerDocument)==this.dom&&yV(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}iR.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function WT(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"),[jt.node(0,t.state.doc.content.size,e)]}function GT(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:jt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ZT(t){return!t.someProp("editable",e=>e(t.state)===!1)}function AV(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 JT(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 MV(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 XT(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 uo={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:"'"},cp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},OV=typeof navigator<"u"&&/Mac/.test(navigator.platform),_V=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var En=0;En<10;En++)uo[48+En]=uo[96+En]=String(En);for(var En=1;En<=24;En++)uo[En+111]="F"+En;for(var En=65;En<=90;En++)uo[En]=String.fromCharCode(En+32),cp[En]=String.fromCharCode(En);for(var V0 in uo)cp.hasOwnProperty(V0)||(cp[V0]=uo[V0]);function DV(t){var e=OV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||_V&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?cp:uo)[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 RV=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),NV=typeof navigator<"u"&&/Win/.test(navigator.platform);function zV(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c++){let u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))RV?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function LV(t){let e=Object.create(null);for(let n in t)e[zV(n)]=t[n];return e}function P0(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 jV(t){return new ht({props:{handleKeyDown:F1(t)}})}function F1(t){let e=LV(t);return function(n,r){let i=DV(r),s,l=e[P0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[P0(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(NV&&r.ctrlKey&&r.altKey)&&(s=uo[r.keyCode])&&s!=i){let c=e[P0(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const q1=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function sR(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const oR=(t,e,n)=>{let r=sR(t,n);if(!r)return!1;let i=K1(r);if(!i){let l=r.blockRange(),c=l&&nc(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(mR(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Va(s,"end")||Te.isSelectable(s)))for(let l=r.depth;;l--){let c=ym(t.doc,r.before(l),r.after(l),he.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(Va(s,"end")?Ne.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Te.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},IV=(t,e,n)=>{let r=sR(t,n);if(!r)return!1;let i=K1(r);return i?lR(t,i,e):!1},BV=(t,e,n)=>{let r=cR(t,n);if(!r)return!1;let i=Y1(r);return i?lR(t,i,e):!1};function lR(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 h=i.lastChild;if(!h)return!1;i=h}let l=e.nodeAfter,c=l,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let h=c.firstChild;if(!h)return!1;c=h}let f=ym(t.doc,s,u,he.empty);if(!f||f.from!=s||f instanceof ln&&f.slice.size>=u-s)return!1;if(n){let h=t.tr.step(f);h.setSelection(Oe.create(h.doc,s)),n(h.scrollIntoView())}return!0}function Va(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 aR=(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=K1(r)}let l=s&&s.nodeBefore;return!l||!Te.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function K1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function cR(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const uR=(t,e,n)=>{let r=cR(t,n);if(!r)return!1;let i=Y1(r);if(!i)return!1;let s=i.nodeAfter;if(mR(t,i,e,1))return!0;if(r.parent.content.size==0&&(Va(s,"start")||Te.isSelectable(s))){let l=ym(t.doc,r.before(),r.after(),he.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Va(s,"start")?Ne.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Te.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},dR=(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=Y1(r)}let l=s&&s.nodeAfter;return!l||!Te.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos)).scrollIntoView()),!0)};function Y1(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 UV=(t,e)=>{let n=t.selection,r=n instanceof Te,i;if(r){if(n.node.isTextblock||!go(t.doc,n.from))return!1;i=n.from}else if(i=gm(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Te.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},HV=(t,e)=>{let n=t.selection,r;if(n instanceof Te){if(n.node.isTextblock||!go(t.doc,n.to))return!1;r=n.to}else if(r=gm(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},VV=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&nc(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},fR=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
112
+ `).scrollIntoView()),!0)};function W1(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 PV=(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=W1(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,l.createAndFill());u.setSelection(Ne.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},hR=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof rr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=W1(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(Oe.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},pR=(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(ls(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&nc(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function $V(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Te&&e.selection.node.isBlock)return!r.parentOffset||!ls(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,u=!1,f=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){u=r.end(b)==r.pos+(r.depth-b),f=r.start(b)==r.pos-(r.depth-b),c=W1(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(u&&c?{type:c}:null),l=b;break}else{if(b==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof Oe||e.selection instanceof rr)&&h.deleteSelection();let m=h.mapping.map(r.pos),g=ls(h.doc,m,s.length,s);if(g||(s[0]=c?{type:c}:null,g=ls(h.doc,m,s.length,s)),!g)return!1;if(h.split(m,s.length,s),!u&&f&&r.node(l).type!=c){let b=h.mapping.map(r.before(l)),v=h.doc.resolve(b);c&&r.node(l-1).canReplaceWith(v.index(),v.index()+1,c)&&h.setNodeMarkup(h.mapping.map(r.before(l)),c)}return n&&n(h.scrollIntoView()),!0}}const FV=$V(),qV=(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(Te.create(t.doc,i))),!0)};function KV(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||go(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function mR(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&KV(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,v=te.empty;for(let E=l.length-1;E>=0;E--)v=te.from(l[E].create(null,v));v=te.from(i.copy(v));let k=t.tr.step(new un(e.pos-1,b,e.pos,b,new he(v,1,0),l.length,!0)),C=k.doc.resolve(b+2*l.length);C.nodeAfter&&C.nodeAfter.type==i.type&&go(k.doc,C.pos)&&k.join(C.pos),n(k.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&u?null:Ne.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),g=m&&nc(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&Va(s,"start",!0)&&Va(i,"end")){let b=i,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let k=s,C=1;for(;!k.isTextblock;k=k.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(n){let E=te.empty;for(let N=v.length-1;N>=0;N--)E=te.from(v[N].copy(E));let j=t.tr.step(new un(e.pos-v.length,e.pos+s.nodeSize,e.pos+C,e.pos+s.nodeSize-C,new he(E,v.length,0),0,!0));n(j.scrollIntoView())}return!0}}return!1}function gR(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(Oe.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const YV=gR(-1),WV=gR(1);function GV(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&R1(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function QT(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let h=n.doc.resolve(f),m=h.index();i=h.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:u}}=n.selection.ranges[l];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function G1(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}G1(q1,oR,aR);G1(q1,uR,dR);G1(fR,hR,pR,FV);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ZV(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 JV(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function JV(t,e,n,r=null){let i=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=l.resolve(e.start-2);s=new np(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new np(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=R1(s,n,r,e);return c?(t&&XV(t,e,c,i,n),!0):!1}function XV(t,e,n,r,i){let s=te.empty;for(let h=n.length-1;h>=0;h--)s=te.from(n[h].type.create(n[h].attrs,s));t.step(new un(e.start-(r?2:0),e.end,e.start,e.end,new he(s,0,0),n.length,!0));let l=0;for(let h=0;h<n.length;h++)n[h].type==i&&(l=h+1);let c=n.length-l,u=e.start+n.length-(r?2:0),f=e.parent;for(let h=e.startIndex,m=e.endIndex,g=!0;h<m;h++,g=!1)!g&&ls(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=f.child(h).nodeSize;return t}function QV(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?eP(e,n,t,s):tP(e,n,s):!0:!1}}function eP(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new un(s-1,l,s,l,new he(te.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new np(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=nc(r);if(c==null)return!1;i.lift(r,c);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return go(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function tP(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,v=n.endIndex-1,k=n.startIndex;v>k;v--)b-=i.child(v).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,u=n.endIndex==i.childCount,f=s.node(-1),h=s.index(-1);if(!f.canReplace(h+(c?0:1),h+1,l.content.append(u?te.empty:te.from(i))))return!1;let m=s.pos,g=m+l.nodeSize;return r.step(new un(m-(c?1:0),g+(u?1:0),m+1,g-1,new he((c?te.empty:te.from(i.copy(te.empty))).append(u?te.empty:te.from(i.copy(te.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function nP(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,u=c.child(l-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,h=te.from(f?t.create():null),m=new he(te.from(t.create(null,te.from(c.type.create(null,h)))),f?3:1,0),g=s.start,b=s.end;n(e.tr.step(new un(g-(f?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}function wm(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 km{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,u])=>[c,(...h)=>{const m=u(...h)(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=[],u=!!e,f=e||s.tr,h=()=>(!u&&n&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(f),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...k)=>{const C=this.buildProps(f,n),E=b(...k)(C);return c.push(E),m}])),run:h};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(([u,f])=>[u,(...h)=>f(...h)({...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:wm({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(([u,f])=>[u,(...h)=>f(...h)(c)]))}};return c}}let rP=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 Se(t,e,n){return t.config[e]===void 0&&t.parent?Se(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Se(t.parent,e,n):null}):t.config[e]}function Cm(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 yR(t){const e=[],{nodeExtensions:n,markExtensions:r}=Cm(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},u=Se(l,"addGlobalAttributes",c);if(!u)return;u().forEach(h=>{h.types.forEach(m=>{Object.entries(h.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},u=Se(l,"addAttributes",c);if(!u)return;const f=u();Object.entries(f).forEach(([h,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:h,attribute:g})})}),e}function fn(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 It(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const c=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=c.filter(h=>!u.includes(h));r[i]=[...u,...f].join(" ")}else if(i==="style"){const c=s?s.split(";").map(h=>h.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(h=>h.trim()).filter(Boolean):[],f=new Map;u.forEach(h=>{const[m,g]=h.split(":").map(b=>b.trim());f.set(m,g)}),c.forEach(h=>{const[m,g]=h.split(":").map(b=>b.trim());f.set(m,g)}),r[i]=Array.from(f.entries()).map(([h,m])=>`${h}: ${m}`).join("; ")}else r[i]=s}),r},{})}function tx(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)=>It(n,r),{})}function bR(t){return typeof t=="function"}function Fe(t,e=void 0,...n){return bR(t)?e?t.bind(e)(...n):t(...n):t}function iP(t={}){return Object.keys(t).length===0&&t.constructor===Object}function sP(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function eA(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):sP(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function tA(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&iP(n)?!1:n!=null))}function oP(t,e){var n;const r=yR(t),{nodeExtensions:i,markExtensions:s}=Cm(t),l=(n=i.find(f=>Se(f,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(f=>{const h=r.filter(E=>E.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((E,j)=>{const N=Se(j,"extendNodeSchema",m);return{...E,...N?N(f):{}}},{}),b=tA({...g,content:Fe(Se(f,"content",m)),marks:Fe(Se(f,"marks",m)),group:Fe(Se(f,"group",m)),inline:Fe(Se(f,"inline",m)),atom:Fe(Se(f,"atom",m)),selectable:Fe(Se(f,"selectable",m)),draggable:Fe(Se(f,"draggable",m)),code:Fe(Se(f,"code",m)),whitespace:Fe(Se(f,"whitespace",m)),linebreakReplacement:Fe(Se(f,"linebreakReplacement",m)),defining:Fe(Se(f,"defining",m)),isolating:Fe(Se(f,"isolating",m)),attrs:Object.fromEntries(h.map(E=>{var j;return[E.name,{default:(j=E==null?void 0:E.attribute)===null||j===void 0?void 0:j.default}]}))}),v=Fe(Se(f,"parseHTML",m));v&&(b.parseDOM=v.map(E=>eA(E,h)));const k=Se(f,"renderHTML",m);k&&(b.toDOM=E=>k({node:E,HTMLAttributes:tx(E,h)}));const C=Se(f,"renderText",m);return C&&(b.toText=C),[f.name,b]})),u=Object.fromEntries(s.map(f=>{const h=r.filter(C=>C.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((C,E)=>{const j=Se(E,"extendMarkSchema",m);return{...C,...j?j(f):{}}},{}),b=tA({...g,inclusive:Fe(Se(f,"inclusive",m)),excludes:Fe(Se(f,"excludes",m)),group:Fe(Se(f,"group",m)),spanning:Fe(Se(f,"spanning",m)),code:Fe(Se(f,"code",m)),attrs:Object.fromEntries(h.map(C=>{var E;return[C.name,{default:(E=C==null?void 0:C.attribute)===null||E===void 0?void 0:E.default}]}))}),v=Fe(Se(f,"parseHTML",m));v&&(b.parseDOM=v.map(C=>eA(C,h)));const k=Se(f,"renderHTML",m);return k&&(b.toDOM=C=>k({mark:C,HTMLAttributes:tx(C,h)})),[f.name,b]}));return new sD({topNode:l,nodes:c,marks:u})}function $0(t,e){return e.nodes[t]||e.marks[t]||null}function nA(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Z1(t,e){const n=yl.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const lP=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var u,f;const h=((f=(u=i.type.spec).toText)===null||f===void 0?void 0:f.call(u,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function J1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Em{constructor(e){this.find=e.find,this.handler=e.handler}}const aP=(t,e)=>{if(J1(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 eh(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||!((e=f.nodeBefore||f.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let h=!1;const m=lP(f)+s;return l.forEach(g=>{if(h)return;const b=aP(m,g.find);if(!b)return;const v=u.state.tr,k=wm({state:u.state,transaction:v}),C={from:r-(b[0].length-s.length),to:i},{commands:E,chain:j,can:N}=new km({editor:n,state:k});g.handler({state:k,range:C,match:b,commands:E,chain:j,can:N})===null||!v.steps.length||(v.setMeta(c,{transform:v,from:r,to:i,text:s}),u.dispatch(v),h=!0)}),h}function cP(t){const{editor:e,rules:n}=t,r=new ht({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=Z1(te.from(h),l.schema);const{from:m}=u,g=m+h.length;eh({editor:e,from:m,to:g,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return eh({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&eh({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?eh({editor:e,from:l.pos,to:l.pos,text:`
113
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function uP(t){return Object.prototype.toString.call(t).slice(8,-1)}function th(t){return uP(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Tm(t,e){const n={...t};return th(t)&&th(e)&&Object.keys(e).forEach(r=>{th(e[r])&&th(t[r])?n[r]=Tm(t[r],e[r]):n[r]=e[r]}),n}class Oi{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=Fe(Se(this,"addOptions",{name:this.name}))),this.storage=Fe(Se(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Oi(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Tm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Oi(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=Fe(Se(n,"addOptions",{name:n.name})),n.storage=Fe(Se(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(f=>(f==null?void 0:f.type.name)===n.name))return!1;const u=l.find(f=>(f==null?void 0:f.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function dP(t){return typeof t=="number"}class fP{constructor(e){this.find=e.find,this.handler=e.handler}}const hP=(t,e,n)=>{if(J1(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 pP(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:u,chain:f,can:h}=new km({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,v)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(r,v),C=Math.min(i,v+b.content.size),E=b.textBetween(k-v,C-v,void 0,"");hP(E,s.find,l).forEach(N=>{if(N.index===void 0)return;const q=k+N.index+1,H=q+N[0].length,R={from:n.tr.mapping.map(q),to:n.tr.mapping.map(H)},I=s.handler({state:n,range:R,match:N,commands:u,chain:f,can:h,pasteEvent:l,dropEvent:c});m.push(I)})}),m.every(b=>b!==null)}let nh=null;const mP=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 gP(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:h,from:m,to:g,rule:b,pasteEvt:v})=>{const k=h.tr,C=wm({state:h,transaction:k});if(!(!pP({editor:e,state:C,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:v,dropEvent:c})||!k.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return n.map(h=>new ht({view(m){const g=v=>{var k;r=!((k=m.dom.parentElement)===null||k===void 0)&&k.contains(v.target)?m.dom.parentElement:null,r&&(nh=e)},b=()=>{nh&&(nh=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=nh;b!=null&&b.isEditable&&setTimeout(()=>{const v=b.state.selection;v&&b.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var b;const v=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const v=m[0],k=v.getMeta("uiEvent")==="paste"&&!i,C=v.getMeta("uiEvent")==="drop"&&!s,E=v.getMeta("applyPasteRules"),j=!!E;if(!k&&!C&&!j)return;if(j){let{text:H}=E;typeof H=="string"?H=H:H=Z1(te.from(H),b.schema);const{from:R}=E,I=R+H.length,Q=mP(H);return u({rule:h,state:b,from:R,to:{b:I},pasteEvt:Q})}const N=g.doc.content.findDiffStart(b.doc.content),q=g.doc.content.findDiffEnd(b.doc.content);if(!(!dP(N)||!q||N===q.b))return u({rule:h,state:b,from:N,to:q,pasteEvt:l})}}))}function yP(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class ga{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ga.resolve(e),this.schema=oP(this.extensions,n),this.setupExtensions()}static resolve(e){const n=ga.sort(ga.flatten(e)),r=yP(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=Se(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=Se(r,"priority")||100,l=Se(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:$0(n.name,this.schema)},i=Se(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=ga.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(l=>{const c={name:l.name,options:l.options,storage:l.storage,editor:e,type:$0(l.name,this.schema)},u=[],f=Se(l,"addKeyboardShortcuts",c);let h={};if(l.type==="mark"&&Se(l,"exitable",c)&&(h.ArrowRight=()=>Oi.handleExit({editor:e,mark:l})),f){const k=Object.fromEntries(Object.entries(f()).map(([C,E])=>[C,()=>E({editor:e})]));h={...h,...k}}const m=jV(h);u.push(m);const g=Se(l,"addInputRules",c);nA(l,e.options.enableInputRules)&&g&&r.push(...g());const b=Se(l,"addPasteRules",c);nA(l,e.options.enablePasteRules)&&b&&i.push(...b());const v=Se(l,"addProseMirrorPlugins",c);if(v){const k=v();u.push(...k)}return u}).flat();return[cP({editor:e,rules:r}),...gP({editor:e,rules:i}),...s]}get attributes(){return yR(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Cm(this.extensions);return Object.fromEntries(n.filter(r=>!!Se(r,"addNodeView")).map(r=>{const i=this.attributes.filter(u=>u.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:fn(r.name,this.schema)},l=Se(r,"addNodeView",s);if(!l)return[];const c=(u,f,h,m,g)=>{const b=tx(u,i);return l()({node:u,view:f,getPos:h,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:$0(e.name,this.schema)};e.type==="mark"&&(!((n=Fe(Se(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=Se(e,"onBeforeCreate",r),s=Se(e,"onCreate",r),l=Se(e,"onUpdate",r),c=Se(e,"onSelectionUpdate",r),u=Se(e,"onTransaction",r),f=Se(e,"onFocus",r),h=Se(e,"onBlur",r),m=Se(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),f&&this.editor.on("focus",f),h&&this.editor.on("blur",h),m&&this.editor.on("destroy",m)})}}class Pt{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=Fe(Se(this,"addOptions",{name:this.name}))),this.storage=Fe(Se(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Pt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Tm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Pt({...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=Fe(Se(n,"addOptions",{name:n.name})),n.storage=Fe(Se(n,"addStorage",{name:n.name,options:n.options})),n}}function xR(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
114
+
115
+ `,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(c+=s);const b=l==null?void 0:l[u.type.name];if(b)return h&&(c+=b({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)===null||g===void 0?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function vR(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const bP=Pt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ht({key:new At("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(h=>h.$from.pos)),c=Math.max(...s.map(h=>h.$to.pos)),u=vR(n);return xR(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),xP=()=>({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),vP=(t=!1)=>({commands:e})=>e.setContent("",t),SP=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+c.nodeSize)),b=m.blockRange(g);if(!b)return;const v=nc(b);if(c.type.isTextblock){const{defaultType:k}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,k)}(v||v===0)&&e.lift(b,v)})}),!0},wP=t=>e=>t(e),kP=()=>({state:t,dispatch:e})=>hR(t,e),CP=(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 Oe(r.doc.resolve(Math.max(l-1,0)))),!0},EP=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const c=i.before(s),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1},TP=t=>({tr:e,state:n,dispatch:r})=>{const i=fn(t,n.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const u=s.before(l),f=s.after(l);e.delete(u,f).scrollIntoView()}return!0}return!1},AP=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},MP=()=>({state:t,dispatch:e})=>q1(t,e),OP=()=>({commands:t})=>t.keyboardShortcut("Enter"),_P=()=>({state:t,dispatch:e})=>PV(t,e);function up(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:J1(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function SR(t,e,n={}){return t.find(r=>r.type===e&&up(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function rA(t,e,n={}){return!!SR(t,e,n)}function X1(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(h=>h.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(h=>h.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!SR([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,u=l+1,f=c+i.node.nodeSize;for(;l>0&&rA([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;u<t.parent.childCount&&rA([...t.parent.child(u).marks],e,n);)f+=t.parent.child(u).nodeSize,u+=1;return{from:c,to:f}}function bo(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 DP=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=bo(t,r.schema),{doc:l,selection:c}=n,{$from:u,from:f,to:h}=c;if(i){const m=X1(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=Oe.create(l,m.from,m.to);n.setSelection(g)}}return!0},RP=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 wR(t){return t instanceof Oe}function qo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function kR(t,e=null){if(!e)return null;const n=Ne.atStart(t),r=Ne.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Oe.create(t,qo(0,i,s),qo(t.content.size,i,s)):Oe.create(t,qo(e,i,s),qo(e,i,s))}function iA(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function dp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function NP(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const zP=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(dp()||iA())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),NP()&&!dp()&&!iA()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!wR(n.state.selection))return l(),!0;const c=kR(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},LP=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),jP=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),CR=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&&CR(r)}return t};function rh(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return CR(n)}function Qu(t,e,n){if(t instanceof no||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),Qu("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const u=new sD({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:f=>(l=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?gu.fromSchema(u).parseSlice(rh(t),n.parseOptions):gu.fromSchema(u).parse(rh(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=gu.fromSchema(e);return n.slice?s.parseSlice(rh(t),n.parseOptions).content:s.parse(rh(t),n.parseOptions)}return Qu("",e,n)}function IP(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof ln||i instanceof un))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,u,f,h)=>{l===0&&(l=h)}),t.setSelection(Ne.near(t.doc.resolve(l),n))}const BP=t=>!("type"in t),UP=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=C=>{s.emit("contentError",{editor:s,error:C,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Qu(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(C){u(C)}try{c=Qu(e,s.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(C){return u(C),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((BP(c)?c:[c]).forEach(C=>{C.check(),g=g?C.isText&&C.marks.length===0:!1,b=b?C.isBlock:!1}),h===m&&b){const{parent:C}=r.doc.resolve(h);C.isTextblock&&!C.type.spec.code&&!C.childCount&&(h-=1,m+=1)}let k;if(g){if(Array.isArray(e))k=e.map(C=>C.text||"").join("");else if(e instanceof te){let C="";e.forEach(E=>{E.text&&(C+=E.text)}),k=C}else typeof e=="object"&&e&&e.text?k=e.text:k=e;r.insertText(k,h,m)}else k=c,r.replaceWith(h,m,k);n.updateSelection&&IP(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:k}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:k})}return!0},HP=()=>({state:t,dispatch:e})=>UV(t,e),VP=()=>({state:t,dispatch:e})=>HV(t,e),PP=()=>({state:t,dispatch:e})=>oR(t,e),$P=()=>({state:t,dispatch:e})=>uR(t,e),FP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=gm(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},qP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=gm(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},KP=()=>({state:t,dispatch:e})=>IV(t,e),YP=()=>({state:t,dispatch:e})=>BV(t,e);function ER(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function WP(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c+=1){const u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))dp()||ER()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const GP=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=WP(t).split(/-(?!$)/),l=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u==null||u.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function ed(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?fn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),v=Math.min(i,g+m.nodeSize);c.push({node:m,from:b,to:v})});const u=i-r,f=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>up(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}const ZP=(t,e={})=>({state:n,dispatch:r})=>{const i=fn(t,n.schema);return ed(n,i,e)?VV(n,r):!1},JP=()=>({state:t,dispatch:e})=>pR(t,e),XP=t=>({state:e,dispatch:n})=>{const r=fn(t,e.schema);return QV(r)(e,n)},QP=()=>({state:t,dispatch:e})=>fR(t,e);function Am(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function sA(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 e9=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=Am(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=fn(t,r.schema)),c==="mark"&&(l=bo(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,sA(f.attrs,e)),l&&f.marks.length&&f.marks.forEach(m=>{l===m.type&&n.addMark(h,h+f.nodeSize,l.create(sA(m.attrs,e)))})})}),!0):!1},t9=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),n9=()=>({tr:t,dispatch:e})=>{if(e){const n=new rr(t.doc);t.setSelection(n)}return!0},r9=()=>({state:t,dispatch:e})=>aR(t,e),i9=()=>({state:t,dispatch:e})=>dR(t,e),s9=()=>({state:t,dispatch:e})=>qV(t,e),o9=()=>({state:t,dispatch:e})=>WV(t,e),l9=()=>({state:t,dispatch:e})=>YV(t,e);function nx(t,e,n={},r={}){return Qu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const a9=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var u,f;const{doc:h}=s;if(n.preserveWhitespace!=="full"){const m=nx(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return l&&s.replaceWith(0,h.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:h.content.size},t,{parseOptions:n,errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck})};function TR(t,e){const n=bo(e,t.schema),{from:r,to:i,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function c9(t,e){const n=new N1(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function u9(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 d9(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function AR(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 Q1(t){return e=>AR(e.$from,t)}function f9(t,e){const n={from:0,to:t.content.size};return xR(t,n,e)}function h9(t,e){const n=fn(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 MR(t,e){const n=Am(typeof e=="string"?e:e.name,t.schema);return n==="node"?h9(t,e):n==="mark"?TR(t,e):{}}function p9(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 m9(t){const e=p9(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 g9(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,u)=>{l.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}l.forEach(({from:c,to:u})=>{const f=e.slice(s).map(c,-1),h=e.slice(s).map(u),m=e.invert().map(f,-1),g=e.invert().map(h);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:h}})})}),m9(r)}function ev(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=X1(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 Ah(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 rx(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?bo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>up(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const b=m.pos,v=g.pos;t.doc.nodesBetween(b,v,(k,C)=>{if(!k.isText&&!k.marks.length)return;const E=Math.max(b,C),j=Math.min(v,C+k.nodeSize),N=j-E;l+=N,c.push(...k.marks.map(q=>({mark:q,from:E,to:j})))})}),l===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>up(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=l}function y9(t,e,n={}){if(!e)return ed(t,null,n)||rx(t,null,n);const r=Am(e,t.schema);return r==="node"?ed(t,e,n):r==="mark"?rx(t,e,n):!1}function oA(t,e){const{nodeExtensions:n}=Cm(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Fe(Se(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Mm(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&&(Mm(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function b9(t){return t instanceof Te}function x9(t,e,n){var r;const{selection:i}=e;let s=null;if(wR(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(u=>u.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const b=!g||g.type.allowsMarkType(n),v=!!n.isInSet(h.marks)||!h.marks.some(k=>k.type.excludes(n));f=b&&v}return!f}),f})}const v9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,u=bo(t,r.schema);if(i)if(l){const f=TR(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,b)=>{const v=Math.max(b,h),k=Math.min(b+g.nodeSize,m);g.marks.find(E=>E.type===u)?g.marks.forEach(E=>{u===E.type&&n.addMark(v,k,u.create({...E.attrs,...e}))}):n.addMark(v,k,u.create(e))})});return x9(r,n,u)},S9=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),w9=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=fn(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})=>QT(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>QT(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},k9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=qo(t,0,r.content.size),s=Te.create(r,i);e.setSelection(s)}return!0},C9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=Oe.atStart(r).from,c=Oe.atEnd(r).to,u=qo(i,l,c),f=qo(s,l,c),h=Oe.create(r,u,f);e.setSelection(h)}return!0},E9=t=>({state:e,dispatch:n})=>{const r=fn(t,e.schema);return nP(r)(e,n)};function lA(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 T9=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,h=Ah(f,c.node().type.name,c.node().attrs);if(s instanceof Te&&s.node.isBlock)return!c.parentOffset||!ls(l,c.pos)?!1:(r&&(t&&lA(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:u9(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:h}]:void 0,v=ls(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!v&&ls(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,b=g?[{type:g,attrs:h}]:void 0),r){if(v&&(s instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const k=e.mapping.map(c.before()),C=e.doc.resolve(k);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&lA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return v},A9=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=fn(t,r.schema),{$from:u,$to:f}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let E=te.empty;const j=u.index(-1)?1:u.index(-2)?2:3;for(let Q=u.depth-j;Q>=u.depth-3;Q-=1)E=te.from(u.node(Q).copy(E));const N=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,q={...Ah(g,u.node().type.name,u.node().attrs),...e},H=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(q))||void 0;E=E.append(te.from(c.createAndFill(null,H)||void 0));const R=u.before(u.depth-(j-1));n.replace(R,u.after(-N),new he(E,4-j,0));let I=-1;n.doc.nodesBetween(R,n.doc.content.size,(Q,W)=>{if(I>-1)return!1;Q.isTextblock&&Q.content.size===0&&(I=W+1)}),I>-1&&n.setSelection(Oe.near(n.doc.resolve(I))),n.scrollIntoView()}return!0}const b=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Ah(g,m.type.name,m.attrs),...e},k={...Ah(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const C=b?[{type:c,attrs:v},{type:b,attrs:k}]:[{type:c,attrs:v}];if(!ls(n.doc,u.pos,2))return!1;if(i){const{selection:E,storedMarks:j}=r,{splittableMarks:N}=s.extensionManager,q=j||E.$to.parentOffset&&E.$from.marks();if(n.split(u.pos,2,C).scrollIntoView(),!q||!i)return!0;const H=q.filter(R=>N.includes(R.type.name));n.ensureMarks(H)}return!0},F0=(t,e)=>{const n=Q1(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)&&go(t.doc,n.pos)&&t.join(n.pos),!0},q0=(t,e)=>{const n=Q1(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)&&go(t.doc,r)&&t.join(r),!0},M9=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,b=fn(t,l.schema),v=fn(e,l.schema),{selection:k,storedMarks:C}=l,{$from:E,$to:j}=k,N=E.blockRange(j),q=C||k.$to.parentOffset&&k.$from.marks();if(!N)return!1;const H=Q1(R=>oA(R.type.name,m))(k);if(N.depth>=1&&H&&N.depth-H.depth<=1){if(H.node.type===b)return f.liftListItem(v);if(oA(H.node.type.name,m)&&b.validContent(H.node.content)&&c)return u().command(()=>(s.setNodeMarkup(H.pos,b),!0)).command(()=>F0(s,b)).command(()=>q0(s,b)).run()}return!n||!q||!c?u().command(()=>h().wrapInList(b,r)?!0:f.clearNodes()).wrapInList(b,r).command(()=>F0(s,b)).command(()=>q0(s,b)).run():u().command(()=>{const R=h().wrapInList(b,r),I=q.filter(Q=>g.includes(Q.type.name));return s.ensureMarks(I),R?!0:f.clearNodes()}).wrapInList(b,r).command(()=>F0(s,b)).command(()=>q0(s,b)).run()},O9=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=bo(t,r.schema);return rx(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},_9=(t,e,n={})=>({state:r,commands:i})=>{const s=fn(t,r.schema),l=fn(e,r.schema),c=ed(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(l,u):i.setNode(s,{...u,...n})},D9=(t,e={})=>({state:n,commands:r})=>{const i=fn(t,n.schema);return ed(n,i,e)?r.lift(i):r.wrapIn(i,e)},R9=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const l=t.tr,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else l.delete(s.from,s.to)}return!0}}return!1},N9=()=>({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},z9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,u=bo(t,r.schema),{$from:f,empty:h,ranges:m}=c;if(!i)return!0;if(h&&l){let{from:g,to:b}=c;const v=(s=f.marks().find(C=>C.type===u))===null||s===void 0?void 0:s.attrs,k=X1(f,u,v);k&&(g=k.from,b=k.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},L9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=Am(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=fn(t,r.schema)),c==="mark"&&(l=bo(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const f=u.$from.pos,h=u.$to.pos;let m,g,b,v;n.selection.empty?r.doc.nodesBetween(f,h,(k,C)=>{s&&s===k.type&&(b=Math.max(C,f),v=Math.min(C+k.nodeSize,h),m=C,g=k)}):r.doc.nodesBetween(f,h,(k,C)=>{C<f&&s&&s===k.type&&(b=Math.max(C,f),v=Math.min(C+k.nodeSize,h),m=C,g=k),C>=f&&C<=h&&(s&&s===k.type&&n.setNodeMarkup(C,void 0,{...k.attrs,...e}),l&&k.marks.length&&k.marks.forEach(E=>{if(l===E.type){const j=Math.max(C,f),N=Math.min(C+k.nodeSize,h);n.addMark(j,N,l.create({...E.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(k=>{l===k.type&&n.addMark(b,v,l.create({...k.attrs,...e}))}))}),!0):!1},j9=(t,e={})=>({state:n,dispatch:r})=>{const i=fn(t,n.schema);return GV(i,e)(n,r)},I9=(t,e={})=>({state:n,dispatch:r})=>{const i=fn(t,n.schema);return ZV(i,e)(n,r)};var B9=Object.freeze({__proto__:null,blur:xP,clearContent:vP,clearNodes:SP,command:wP,createParagraphNear:kP,cut:CP,deleteCurrentNode:EP,deleteNode:TP,deleteRange:AP,deleteSelection:MP,enter:OP,exitCode:_P,extendMarkRange:DP,first:RP,focus:zP,forEach:LP,insertContent:jP,insertContentAt:UP,joinBackward:PP,joinDown:VP,joinForward:$P,joinItemBackward:FP,joinItemForward:qP,joinTextblockBackward:KP,joinTextblockForward:YP,joinUp:HP,keyboardShortcut:GP,lift:ZP,liftEmptyBlock:JP,liftListItem:XP,newlineInCode:QP,resetAttributes:e9,scrollIntoView:t9,selectAll:n9,selectNodeBackward:r9,selectNodeForward:i9,selectParentNode:s9,selectTextblockEnd:o9,selectTextblockStart:l9,setContent:a9,setMark:v9,setMeta:S9,setNode:w9,setNodeSelection:k9,setTextSelection:C9,sinkListItem:E9,splitBlock:T9,splitListItem:A9,toggleList:M9,toggleMark:O9,toggleNode:_9,toggleWrap:D9,undoInputRule:R9,unsetAllMarks:N9,unsetMark:z9,updateAttributes:L9,wrapIn:j9,wrapInList:I9});const U9=Pt.create({name:"commands",addCommands(){return{...B9}}}),H9=Pt.create({name:"drop",addProseMirrorPlugins(){return[new ht({key:new At("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),V9=Pt.create({name:"editable",addProseMirrorPlugins(){return[new ht({key:new At("editable"),props:{editable:()=>this.editor.options.editable}})]}}),P9=new At("focusEvents"),$9=Pt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ht({key:P9,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}}}})]}}),F9=Pt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:h,$anchor:m}=u,{pos:g,parent:b}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,k=v.parent.type.spec.isolating,C=m.pos-m.parentOffset,E=k&&v.parent.childCount===1?C===m.pos:Ne.atStart(f).from===g;return!h||!b.type.isTextblock||b.textContent.length||!E||E&&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 dp()||ER()?s:i},addProseMirrorPlugins(){return[new ht({key:new At("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(k=>k.getMeta("composition")))return;const r=t.some(k=>k.docChanged)&&!e.doc.eq(n.doc),i=t.some(k=>k.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,u=Ne.atStart(e.doc).from,f=Ne.atEnd(e.doc).to;if(s||!(l===u&&c===f)||!Mm(n.doc))return;const g=n.tr,b=wm({state:n,transaction:g}),{commands:v}=new km({editor:this.editor,state:b});if(v.clearNodes(),!!g.steps.length)return g}})]}}),q9=Pt.create({name:"paste",addProseMirrorPlugins(){return[new ht({key:new At("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),K9=Pt.create({name:"tabindex",addProseMirrorPlugins(){return[new ht({key:new At("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Po{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 Po(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 Po(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 Po(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 u=new Po(c,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new Po(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 u=l[c];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===e&&s.every(u=>n[u]===l.node.attrs[u])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const Y9=`.ProseMirror {
116
+ position: relative;
117
+ }
118
+
119
+ .ProseMirror {
120
+ word-wrap: break-word;
121
+ white-space: pre-wrap;
122
+ white-space: break-spaces;
123
+ -webkit-font-variant-ligatures: none;
124
+ font-variant-ligatures: none;
125
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
126
+ }
127
+
128
+ .ProseMirror [contenteditable="false"] {
129
+ white-space: normal;
130
+ }
131
+
132
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
133
+ white-space: pre-wrap;
134
+ }
135
+
136
+ .ProseMirror pre {
137
+ white-space: pre-wrap;
138
+ }
139
+
140
+ img.ProseMirror-separator {
141
+ display: inline !important;
142
+ border: none !important;
143
+ margin: 0 !important;
144
+ width: 0 !important;
145
+ height: 0 !important;
146
+ }
147
+
148
+ .ProseMirror-gapcursor {
149
+ display: none;
150
+ pointer-events: none;
151
+ position: absolute;
152
+ margin: 0;
153
+ }
154
+
155
+ .ProseMirror-gapcursor:after {
156
+ content: "";
157
+ display: block;
158
+ position: absolute;
159
+ top: -2px;
160
+ width: 20px;
161
+ border-top: 1px solid black;
162
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
163
+ }
164
+
165
+ @keyframes ProseMirror-cursor-blink {
166
+ to {
167
+ visibility: hidden;
168
+ }
169
+ }
170
+
171
+ .ProseMirror-hideselection *::selection {
172
+ background: transparent;
173
+ }
174
+
175
+ .ProseMirror-hideselection *::-moz-selection {
176
+ background: transparent;
177
+ }
178
+
179
+ .ProseMirror-hideselection * {
180
+ caret-color: transparent;
181
+ }
182
+
183
+ .ProseMirror-focused .ProseMirror-gapcursor {
184
+ display: block;
185
+ }
186
+
187
+ .tippy-box[data-animation=fade][data-state=hidden] {
188
+ opacity: 0
189
+ }`;function W9(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 G9=class extends rP{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=W9(Y9,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=bR(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?[V9,bP.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),U9,$9,F9,K9,H9,q9].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 ga(i,this)}createCommandManager(){this.commandManager=new km({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=nx(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=nx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=kR(n,this.options.autofocus);this.view=new iR(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:ma.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 MR(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return y9(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Z1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
190
+
191
+ `,textSerializers:r={}}=e||{};return f9(this.state.doc,{blockSeparator:n,textSerializers:{...vR(this.schema),...r}})}get isEmpty(){return Mm(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 Po(n,this)}get $doc(){return this.$pos(0)}};function dl(t){return new Em({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Fe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];if(l){const u=c.search(/\S/),f=n.from+c.indexOf(l),h=f+l.length;if(ev(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(k=>k===t.type&&k!==b.mark.type)).filter(b=>b.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+l.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Z9(t){return new Em({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Fe(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let h=l+f;h>c?h=c:c=h+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(h,c,u)}else if(r[0]){const f=t.type.isInline?l:l-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()}})}function ix(t){return new Em({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Fe(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 td(t){return new Em({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Fe(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),u=l.doc.resolve(n.from).blockRange(),f=u&&R1(u,t.type,s);if(!f)return null;if(l.wrap(u,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const k=v.filter(C=>b.includes(C.type.name));l.ensureMarks(k)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const h=l.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&go(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&l.join(n.from-1)}})}class hn{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=Fe(Se(this,"addOptions",{name:this.name}))),this.storage=Fe(Se(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new hn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Tm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new hn(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=Fe(Se(n,"addOptions",{name:n.name})),n.storage=Fe(Se(n,"addStorage",{name:n.name,options:n.options})),n}}function fo(t){return new fP({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Fe(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],u=r[0];let f=n.to;if(c){const h=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(ev(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(C=>C===t.type&&C!==v.mark.type)).filter(v=>v.to>m).length)return null;g<n.to&&l.delete(g,n.to),m>n.from&&l.delete(n.from+h,m),f=n.from+h+c.length,l.addMark(n.from+h,f,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}function J9(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Te){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 X9=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},Q9=/[\uD800-\uDBFF]/,e$=/[\uDC00-\uDFFF]/,t$=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&Q9.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&&e$.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},n$=t$,_t=new At("y-sync"),Si=new At("y-undo"),ih=new At("yjs-cursor"),wi=(t,e)=>t>>>e|t<<32-e,r$=t=>wi(t,2)^wi(t,13)^wi(t,22),i$=t=>wi(t,6)^wi(t,11)^wi(t,25),s$=t=>wi(t,7)^wi(t,18)^t>>>3,o$=t=>wi(t,17)^wi(t,19)^t>>>10,l$=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]),a$=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class c${constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(a$),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=o$(n[m-2])+n[m-7]+s$(n[m-15])+n[m-16];let r=e[0],i=e[1],s=e[2],l=e[3],c=e[4],u=e[5],f=e[6],h=e[7];for(let m=0,g,b;m<64;m++)g=h+i$(c)+(c&u^~c&f)+l$[m]+n[m]>>>0,b=r$(r)+(r&i^r&s^i&s)>>>0,h=f,f=u,u=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]+=u,e[6]+=f,e[7]+=h}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]|=Vn<<(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)]|=Vn<<(3-n%4)*8),this._W[14]=e.byteLength/tB,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 u$=t=>new c$().digest(t),d$=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},f$=t=>n6(d$(u$(i6(t)))),fp=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Qa(e.ds,t.id),h$=[{light:"#ecd44433",dark:"#ecd444"}],p$=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=nl();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,zB(e))}return t.get(n)},m$=(t,{colors:e=h$,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let l=!1;const c=new y$(t,s),u=new ht({props:{editable:f=>{const h=_t.getState(f);return h.snapshot==null&&h.prevSnapshot==null}},key:_t,state:{init:(f,h)=>({type:t,doc:t.doc,binding:c,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(f,h)=>{const m=f.getMeta(_t);if(m!==void 0){h=Object.assign({},h);for(const g in m)h[g]=m[g]}return h.addToHistory=f.getMeta("addToHistory")!==!1,h.isChangeOrigin=m!==void 0&&!!m.isChangeOrigin,h.isUndoRedoOperation=m!==void 0&&!!m.isChangeOrigin&&!!m.isUndoRedoOperation,c.prosemirrorView!==null&&m!==void 0&&(m.snapshot!=null||m.prevSnapshot!=null)&&p1(0,()=>{c.prosemirrorView!=null&&(m.restore==null?c._renderSnapshot(m.snapshot,m.prevSnapshot,h):(c._renderSnapshot(m.snapshot,m.snapshot,h),delete h.restore,delete h.snapshot,delete h.prevSnapshot,c.mux(()=>{c._prosemirrorChanged(c.prosemirrorView.state.doc)})))}),h}},view:f=>(c.initView(f),s==null&&c._forceRerender(),i(),{update:()=>{const h=u.getState(f.state);if(h.snapshot==null&&h.prevSnapshot==null&&(l||f.state.doc.content.findDiffStart(f.state.doc.type.createAndFill().content)!==null)){if(l=!0,h.addToHistory===!1&&!h.isChangeOrigin){const m=Si.getState(f.state),g=m&&m.undoManager;g&&g.stopCapturing()}c.mux(()=>{h.doc.transact(m=>{m.meta.set("addToHistory",h.addToHistory),c._prosemirrorChanged(f.state.doc)},_t)})}},destroy:()=>{c.destroy()}})});return u},g$=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new rr(t.doc));else if(e.type==="node"){const r=Aa(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Te.create(t.doc,r))}else{const r=Aa(n.doc,n.type,e.anchor,n.mapping),i=Aa(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=Oe.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},sx=(t,e)=>({type:e.selection.jsonID,anchor:pp(e.selection.anchor,t.type,t.mapping),head:pp(e.selection.head,t.type,t.mapping)});class y${constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=X9(),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=sx(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()?(EO&&this._domSelectionInView===null&&(p1(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=bd.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=o_(ZO(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(_t,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Mh(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(te.from(e),0,0));n.setMeta(_t,{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=>Mh(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(te.from(n),0,0));if(e){const i=is(ni(e.anchor,0),r.doc.content.size),s=is(ni(e.head,0),r.doc.content.size);r.setSelection(Oe.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(_t,{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))&&Dn(),i=new Ti({gc:!1}),qh(i,n),n=w0(i),qh(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=ri(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=>{ao(l,m,g=>{})});const u=(m,g)=>{const b=m==="added"?c.getUserByClientId(g.client):c.getUserByDeletedId(g);return{user:b,type:m,color:p$(r.colorMapping,r.colors,b)}},f=y_(s,new x1(n.ds,e.sv)).map(m=>!m._item.deleted||fp(m._item,e)||fp(m._item,n)?Mh(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,u):null).filter(m=>m!==null),h=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(te.from(f),0,0));this.prosemirrorView.dispatch(h.setMeta(_t,{isChangeOrigin:!0}))},_t)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=_t.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,u)=>this.mapping.delete(u);ao(n,n.deleteSet,c=>{if(c.constructor===wt){const u=c.content.type;u&&this.mapping.delete(u)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>OR(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let l=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(te.from(s),0,0));g$(l,this.beforeTransactionSelection,this),l=l.setMeta(_t,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof d_}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&l.scrollIntoView(),this.prosemirrorView.dispatch(l)})}_prosemirrorChanged(e){this.doc.transact(()=>{lx(this.doc,this.type,e,this),this.beforeTransactionSelection=sx(this,this.prosemirrorView.state)},_t)}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 OR=(t,e,n,r,i,s)=>{const l=n.mapping.get(t);if(l===void 0){if(t instanceof an)return Mh(t,e,n,r,i,s);throw Fr()}return l},Mh=(t,e,n,r,i,s)=>{const l=[],c=u=>{var f,h;if(u instanceof an){const m=OR(u,e,n,r,i,s);m!==null&&l.push(m)}else{const m=(h=(f=u._item.right)==null?void 0:f.content)==null?void 0:h.type;m instanceof co&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(u.applyDelta([{retain:u.length},...m.toDelta()]),m.doc.transact(b=>{m._item.delete(b)}));const g=b$(u,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):y_(t,new x1(i.ds,r.sv)).forEach(c);try{const u=t.getAttributes(r);r!==void 0&&(fp(t._item,r)?fp(t._item,i)||(u.ychange=s?s("added",t._item.id):{type:"added"}):u.ychange=s?s("removed",t._item.id):{type:"removed"});const f=e.node(t.nodeName,u,l);return n.mapping.set(t,f),f}catch{return t.doc.transact(f=>{t._item.delete(f)},_t),n.mapping.delete(t),null}},b$=(t,e,n,r,i,s)=>{const l=[],c=t.toDelta(r,i,s);try{for(let u=0;u<c.length;u++){const f=c[u];l.push(e.text(f.insert,C$(f.attributes,e)))}}catch{return t.doc.transact(f=>{t._item.delete(f)},_t),null}return l},x$=(t,e)=>{const n=new Pn,r=t.map(i=>({insert:i.text,attributes:DR(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},v$=(t,e)=>{const n=new an(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,Om(t).map(r=>ox(r,e))),e.mapping.set(n,t),n},ox=(t,e)=>t instanceof Array?x$(t,e):v$(t,e),aA=t=>typeof t=="object"&&t!==null,tv=(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||aA(l)&&aA(c)&&tv(l,c)}return r},Om=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},_R=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&wO(r.attributes||{}).length===e[i].marks.length&&Za(r.attributes,(s,l)=>{var f;const c=nv(l),u=e[i].marks;return tv(s,(f=u.find(h=>h.type.name===c))==null?void 0:f.attrs)}))},nd=(t,e)=>{if(t instanceof an&&!(e instanceof Array)&&ax(t,e)){const n=Om(e);return t._length===n.length&&tv(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>nd(r,n[i]))}return t instanceof Pn&&e instanceof Array&&_R(t,e)},hp=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),cA=(t,e,n)=>{const r=t.toArray(),i=Om(e),s=i.length,l=r.length,c=is(l,s);let u=0,f=0,h=!1;for(;u<c;u++){const m=r[u],g=i[u];if(hp(n.mapping.get(m),g))h=!0;else if(!nd(m,g))break}for(;u+f<c;f++){const m=r[l-f-1],g=i[s-f-1];if(hp(n.mapping.get(m),g))h=!0;else if(!nd(m,g))break}return{equalityFactor:u+f,foundMappedChild:h}},S$=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof ii?e+=n.content.str:n.content instanceof Gt&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},w$=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=S$(t),s=e.map(f=>({insert:f.text,attributes:Object.assign({},r,DR(f.marks,n))})),{insert:l,remove:c,index:u}=n$(i,s.map(f=>f.insert).join(""));t.delete(u,c),t.insert(u,l),t.applyDelta(s.map(f=>({retain:f.insert.length,attributes:f.attributes})))},k$=/(.*)(--[a-zA-Z0-9+/=]{8})$/,nv=t=>{var e;return((e=k$.exec(t))==null?void 0:e[1])??t},C$=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(nv(r),t[r]));return n},DR=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=_i(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${f$(r.toJSON())}`:r.type.name]=r.attrs}}),n},lx=(t,e,n,r)=>{if(e instanceof an&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof an){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=Om(n),s=i.length,l=e.toArray(),c=l.length,u=is(s,c);let f=0,h=0;for(;f<u;f++){const m=l[f],g=i[f];if(!hp(r.mapping.get(m),g))if(nd(m,g))r.mapping.set(m,g);else break}for(;h+f<u;h++){const m=l[c-h-1],g=i[s-h-1];if(!hp(r.mapping.get(m),g))if(nd(m,g))r.mapping.set(m,g);else break}t.transact(()=>{for(;c-f-h>0&&s-f-h>0;){const g=l[f],b=i[f],v=l[c-h-1],k=i[s-h-1];if(g instanceof Pn&&b instanceof Array)_R(g,b)||w$(g,b,r),f+=1;else{let C=g instanceof an&&ax(g,b),E=v instanceof an&&ax(v,k);if(C&&E){const j=cA(g,b,r),N=cA(v,k,r);j.foundMappedChild&&!N.foundMappedChild?E=!1:!j.foundMappedChild&&N.foundMappedChild||j.equalityFactor<N.equalityFactor?C=!1:E=!1}C?(lx(t,g,b,r),f+=1):E?(lx(t,v,k,r),h+=1):(r.mapping.delete(e.get(f)),e.delete(f,1),e.insert(f,[ox(b,r)]),f+=1)}}const m=c-f-h;if(c===1&&s===0&&l[0]instanceof Pn?(r.mapping.delete(l[0]),l[0].delete(0,l[0].length)):m>0&&(e.slice(f,f+m).forEach(g=>r.mapping.delete(g)),e.delete(f,m)),f+h<s){const g=[];for(let b=f;b<s-h;b++)g.push(ox(i[b],r));e.insert(f,g)}},_t)},ax=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let vu=null;const E$=()=>{const t=vu;vu=null,t.forEach((e,n)=>{const r=n.state.tr,i=_t.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,l)=>{r.setMeta(l,s)}),n.dispatch(r))})},T$=(t,e,n)=>{vu||(vu=new Map,p1(0,E$)),_i(vu,t,$r).set(e,n)},pp=(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 Pn){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 Vu(r._item===null?null:r._item.id,r._item===null?Uu(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 Vu(r._item===null?null:r._item.id,r._item===null?Uu(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 Dn();if(t===0&&r.constructor!==Pn&&r!==e)return A$(r._item.parent,r._item)}return S0(e,e._length,e.length===0?-1:0)},A$=(t,e)=>{let n=null,r=null;return t._item===null?r=Uu(t):n=Ue(t._item.id.client,t._item.id.clock),new Vu(n,r,e.id)},Aa=(t,e,n,r)=>{const i=_b(n,t);if(i===null||i.type!==e&&!Hu(e,i.type._item))return null;let s=i.type,l=0;if(s.constructor===Pn)l=i.index;else if(s._item===null||!s._item.deleted){let c=s._first,u=0;for(;u<s._length&&u<i.index&&c!==null;){if(!c.deleted){const f=c.content.type;u++,f instanceof Pn?l+=f._length:l+=r.get(f).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 u=c._first;for(;u!==null;){const f=u.content.type;if(f===s)break;u.deleted||(f instanceof Pn?l+=f._length:l+=r.get(f).nodeSize),u=u.right}}s=c}return l-1};function M$(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Pn)i=r.toDelta().map(l=>{const c={type:"text",text:l.insert};return l.attributes&&(c.marks=Object.keys(l.attributes).map(u=>{const f=l.attributes[u],m={type:nv(u)};return Object.keys(f)&&(m.attrs=f),m})),c});else if(r instanceof an){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 Dn();return i};return{type:"doc",content:e.map(n)}}const O$=(t,e,n)=>t!==e,_$=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},RR=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),D$=/^#[0-9a-fA-F]{6}$/,uA=(t,e,n,r,i)=>{const s=_t.getState(t),l=s.doc,c=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?Qe.create(t.doc,[]):(e.getStates().forEach((u,f)=>{if(n(l.clientID,f,u)&&u.cursor!=null){const h=u.user||{};h.color==null?h.color="#ffa500":D$.test(h.color)||console.warn("A user uses an unsupported color format",h),h.name==null&&(h.name=`User: ${f}`);let m=Aa(l,s.type,Go(u.cursor.anchor),s.binding.mapping),g=Aa(l,s.type,Go(u.cursor.head),s.binding.mapping);if(m!==null&&g!==null){const b=ni(t.doc.content.size-1,0);m=is(m,b),g=is(g,b),c.push(jt.widget(g,()=>r(h,f),{key:f+"",side:10}));const v=is(m,g),k=ni(m,g);c.push(jt.inline(v,k,i(h,f),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Qe.create(t.doc,c))},R$=(t,{awarenessStateFilter:e=O$,cursorBuilder:n=_$,selectionBuilder:r=RR,getSelection:i=l=>l.selection}={},s="cursor")=>new ht({key:ih,state:{init(l,c){return uA(c,t,e,n,r)},apply(l,c,u,f){const h=_t.getState(f),m=l.getMeta(ih);return h&&h.isChangeOrigin||m&&m.awarenessUpdated?uA(f,t,e,n,r):c.map(l.mapping,l.doc)}},props:{decorations:l=>ih.getState(l)},view:l=>{const c=()=>{l.docView&&T$(l,ih,{awarenessUpdated:!0})},u=()=>{const f=_t.getState(l.state),h=t.getLocalState()||{};if(l.hasFocus()){const m=i(l.state),g=pp(m.anchor,f.type,f.binding.mapping),b=pp(m.head,f.type,f.binding.mapping);(h.cursor==null||!HE(Go(h.cursor.anchor),g)||!HE(Go(h.cursor.head),b))&&t.setLocalStateField(s,{anchor:g,head:b})}else h.cursor!=null&&Aa(f.doc,f.type,Go(h.cursor.anchor),f.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),l.dom.addEventListener("focusin",u),l.dom.addEventListener("focusout",u),{update:u,destroy:()=>{l.dom.removeEventListener("focusin",u),l.dom.removeEventListener("focusout",u),t.off("change",c),t.setLocalStateField(s,null)}}}}),N$=t=>{var e,n;return((n=(e=Si.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},z$=t=>{var e,n;return((n=(e=Si.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},L$=new Set(["paragraph"]),j$=(t,e)=>!(t instanceof wt)||!(t.content instanceof si)||!(t.content.type instanceof co||t.content.type instanceof an&&e.has(t.content.type.nodeName))||t.content.type._length===0,I$=({protectedNodes:t=L$,trackedOrigins:e=[],undoManager:n=null}={})=>new ht({key:Si,state:{init:(r,i)=>{const s=_t.getState(i),l=n||new d_(s.type,{trackedOrigins:new Set([_t].concat(e)),deleteFilter:c=>j$(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=_t.getState(l).binding,u=i.undoManager,f=u.undoStack.length>0,h=u.redoStack.length>0;return c?{undoManager:u,prevSel:sx(c,s),hasUndoOps:f,hasRedoOps:h}:f!==i.hasUndoOps||h!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:u.undoStack.length>0,hasRedoOps:u.redoStack.length>0}):i}},view:r=>{const i=_t.getState(r.state),s=Si.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:l})=>{const c=i.binding;c&&l.meta.set(c,Si.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()}}}}),B$=Pt.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),Si.getState(e).undoManager.undoStack.length===0?!1:n?N$(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Si.getState(e).undoManager.redoStack.length===0?!1:n?z$(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=I$(this.options.yUndoOptions),r=n.spec.view;n.spec.view=l=>{const{undoManager:c}=Si.getState(l.state);c.restore&&(c.restore(),c.restore=()=>{});const u=r?r(l):void 0;return{destroy:()=>{const f=c.trackedOrigins.has(c),h=c._observers;c.restore=()=>{f&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=h},u!=null&&u.destroy&&u.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=m$(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const l=M$(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 ht({key:new At("filterInvalidContent"),filterTransaction:()=>{var l;return this.storage.isDisabled&&((l=e.doc)===null||l===void 0||l.destroy()),!0}})].filter(Boolean)}}),dA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),fA=()=>null,U$=Pt.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:RR,onUpdate:fA}},onCreate(){if(this.options.onUpdate!==fA&&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[R$((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=dA(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=dA(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),H$=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,V$=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,P$=Oi.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",It(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[dl({find:H$,type:this.type})]},addPasteRules(){return[fo({find:V$,type:this.type})]}}),$$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",F$="ελ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",cx="numeric",ux="ascii",dx="alpha",Su="asciinumeric",au="alphanumeric",fx="domain",NR="emoji",q$="scheme",K$="slashscheme",K0="whitespace";function Y$(t,e){return t in e||(e[t]=[]),e[t]}function Ko(t,e,n){e[cx]&&(e[Su]=!0,e[au]=!0),e[ux]&&(e[Su]=!0,e[dx]=!0),e[Su]&&(e[au]=!0),e[dx]&&(e[au]=!0),e[au]&&(e[fx]=!0),e[NR]&&(e[fx]=!0);for(const r in e){const i=Y$(r,n);i.indexOf(t)<0&&i.push(t)}}function W$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function er(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}er.groups={};er.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||er.groups;let i;return e&&e.j?i=e:(i=new er(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||er.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 er,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new er,s){if(r)if(l.t&&typeof l.t=="string"){const u=Object.assign(W$(l.t,r),n);Ko(s,u,r)}else n&&Ko(s,n,r);l.t=s}return i.j[t]=l,l}};const $e=(t,e,n,r,i)=>t.ta(e,n,r,i),Nt=(t,e,n,r,i)=>t.tr(e,n,r,i),hA=(t,e,n,r,i)=>t.ts(e,n,r,i),le=(t,e,n,r,i)=>t.tt(e,n,r,i),es="WORD",hx="UWORD",zR="ASCIINUMERICAL",LR="ALPHANUMERICAL",rd="LOCALHOST",px="TLD",mx="UTLD",Oh="SCHEME",da="SLASH_SCHEME",rv="NUM",gx="WS",iv="NL",wu="OPENBRACE",ku="CLOSEBRACE",mp="OPENBRACKET",gp="CLOSEBRACKET",yp="OPENPAREN",bp="CLOSEPAREN",xp="OPENANGLEBRACKET",vp="CLOSEANGLEBRACKET",Sp="FULLWIDTHLEFTPAREN",wp="FULLWIDTHRIGHTPAREN",kp="LEFTCORNERBRACKET",Cp="RIGHTCORNERBRACKET",Ep="LEFTWHITECORNERBRACKET",Tp="RIGHTWHITECORNERBRACKET",Ap="FULLWIDTHLESSTHAN",Mp="FULLWIDTHGREATERTHAN",Op="AMPERSAND",_p="APOSTROPHE",Dp="ASTERISK",qs="AT",Rp="BACKSLASH",Np="BACKTICK",zp="CARET",Zs="COLON",sv="COMMA",Lp="DOLLAR",mi="DOT",jp="EQUALS",ov="EXCLAMATION",Ir="HYPHEN",Cu="PERCENT",Ip="PIPE",Bp="PLUS",Up="POUND",Eu="QUERY",lv="QUOTE",jR="FULLWIDTHMIDDLEDOT",av="SEMI",gi="SLASH",Tu="TILDE",Hp="UNDERSCORE",IR="EMOJI",Vp="SYM";var BR=Object.freeze({__proto__:null,ALPHANUMERICAL:LR,AMPERSAND:Op,APOSTROPHE:_p,ASCIINUMERICAL:zR,ASTERISK:Dp,AT:qs,BACKSLASH:Rp,BACKTICK:Np,CARET:zp,CLOSEANGLEBRACKET:vp,CLOSEBRACE:ku,CLOSEBRACKET:gp,CLOSEPAREN:bp,COLON:Zs,COMMA:sv,DOLLAR:Lp,DOT:mi,EMOJI:IR,EQUALS:jp,EXCLAMATION:ov,FULLWIDTHGREATERTHAN:Mp,FULLWIDTHLEFTPAREN:Sp,FULLWIDTHLESSTHAN:Ap,FULLWIDTHMIDDLEDOT:jR,FULLWIDTHRIGHTPAREN:wp,HYPHEN:Ir,LEFTCORNERBRACKET:kp,LEFTWHITECORNERBRACKET:Ep,LOCALHOST:rd,NL:iv,NUM:rv,OPENANGLEBRACKET:xp,OPENBRACE:wu,OPENBRACKET:mp,OPENPAREN:yp,PERCENT:Cu,PIPE:Ip,PLUS:Bp,POUND:Up,QUERY:Eu,QUOTE:lv,RIGHTCORNERBRACKET:Cp,RIGHTWHITECORNERBRACKET:Tp,SCHEME:Oh,SEMI:av,SLASH:gi,SLASH_SCHEME:da,SYM:Vp,TILDE:Tu,TLD:px,UNDERSCORE:Hp,UTLD:mx,UWORD:hx,WORD:es,WS:gx});const Xi=/[a-z]/,iu=new RegExp("\\p{L}","u"),Y0=new RegExp("\\p{Emoji}","u"),Qi=/\d/,W0=/\s/,pA="\r",G0=`
192
+ `,G$="️",Z$="‍",Z0="";let sh=null,oh=null;function J$(t=[]){const e={};er.groups=e;const n=new er;sh==null&&(sh=mA($$)),oh==null&&(oh=mA(F$)),le(n,"'",_p),le(n,"{",wu),le(n,"}",ku),le(n,"[",mp),le(n,"]",gp),le(n,"(",yp),le(n,")",bp),le(n,"<",xp),le(n,">",vp),le(n,"(",Sp),le(n,")",wp),le(n,"「",kp),le(n,"」",Cp),le(n,"『",Ep),le(n,"』",Tp),le(n,"<",Ap),le(n,">",Mp),le(n,"&",Op),le(n,"*",Dp),le(n,"@",qs),le(n,"`",Np),le(n,"^",zp),le(n,":",Zs),le(n,",",sv),le(n,"$",Lp),le(n,".",mi),le(n,"=",jp),le(n,"!",ov),le(n,"-",Ir),le(n,"%",Cu),le(n,"|",Ip),le(n,"+",Bp),le(n,"#",Up),le(n,"?",Eu),le(n,'"',lv),le(n,"/",gi),le(n,";",av),le(n,"~",Tu),le(n,"_",Hp),le(n,"\\",Rp),le(n,"・",jR);const r=Nt(n,Qi,rv,{[cx]:!0});Nt(r,Qi,r);const i=Nt(r,Xi,zR,{[Su]:!0}),s=Nt(r,iu,LR,{[au]:!0}),l=Nt(n,Xi,es,{[ux]:!0});Nt(l,Qi,i),Nt(l,Xi,l),Nt(i,Qi,i),Nt(i,Xi,i);const c=Nt(n,iu,hx,{[dx]:!0});Nt(c,Xi),Nt(c,Qi,s),Nt(c,iu,c),Nt(s,Qi,s),Nt(s,Xi),Nt(s,iu,s);const u=le(n,G0,iv,{[K0]:!0}),f=le(n,pA,gx,{[K0]:!0}),h=Nt(n,W0,gx,{[K0]:!0});le(n,Z0,h),le(f,G0,u),le(f,Z0,h),Nt(f,W0,h),le(h,pA),le(h,G0),Nt(h,W0,h),le(h,Z0,h);const m=Nt(n,Y0,IR,{[NR]:!0});le(m,"#"),Nt(m,Y0,m),le(m,G$,m);const g=le(m,Z$);le(g,"#"),Nt(g,Y0,m);const b=[[Xi,l],[Qi,i]],v=[[Xi,null],[iu,c],[Qi,s]];for(let k=0;k<sh.length;k++)Vs(n,sh[k],px,es,b);for(let k=0;k<oh.length;k++)Vs(n,oh[k],mx,hx,v);Ko(px,{tld:!0,ascii:!0},e),Ko(mx,{utld:!0,alpha:!0},e),Vs(n,"file",Oh,es,b),Vs(n,"mailto",Oh,es,b),Vs(n,"http",da,es,b),Vs(n,"https",da,es,b),Vs(n,"ftp",da,es,b),Vs(n,"ftps",da,es,b),Ko(Oh,{scheme:!0,ascii:!0},e),Ko(da,{slashscheme:!0,ascii:!0},e),t=t.sort((k,C)=>k[0]>C[0]?1:-1);for(let k=0;k<t.length;k++){const C=t[k][0],j=t[k][1]?{[q$]:!0}:{[K$]:!0};C.indexOf("-")>=0?j[fx]=!0:Xi.test(C)?Qi.test(C)?j[Su]=!0:j[ux]=!0:j[cx]=!0,hA(n,C,C,j)}return hA(n,"localhost",rd,{ascii:!0}),n.jd=new er(Vp),{start:n,tokens:Object.assign({groups:e},BR)}}function UR(t,e){const n=X$(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,u=null,f=0,h=null,m=-1,g=-1;for(;l<r&&(u=c.go(n[l]));)c=u,c.accepts()?(m=0,g=0,h=c):m>=0&&(m+=n[l].length,g++),f+=n[l].length,s+=n[l].length,l++;s-=m,l-=g,f-=m,i.push({t:h.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function X$(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 Vs(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new er(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new er(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function mA(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 id={defaultProtocol:"http",events:null,format:gA,formatHref:gA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function cv(t,e=null){let n=Object.assign({},id);t&&(n=Object.assign(n,t instanceof cv?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}cv.prototype={o:id,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]:id[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 gA(t){return t}function HR(t,e){this.t="token",this.v=t,this.tk=e}HR.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=id.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),l={},c=t.get("className",n,e),u=t.get("target",n,e),f=t.get("rel",n,e),h=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),u&&(l.target=u),f&&(l.rel=f),h&&Object.assign(l,h),{tagName:i,attributes:l,content:s,eventListeners:m}}};function _m(t,e){class n extends HR{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 yA=_m("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bA=_m("text"),Q$=_m("nl"),lh=_m("url",{isLink:!0,toHref(t=id.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==rd&&t[1].t===Zs}}),zr=t=>new er(t);function eF({groups:t}){const e=t.domain.concat([Op,Dp,qs,Rp,Np,zp,Lp,jp,Ir,rv,Cu,Ip,Bp,Up,gi,Vp,Tu,Hp]),n=[_p,Zs,sv,mi,ov,Cu,Eu,lv,av,xp,vp,wu,ku,gp,mp,yp,bp,Sp,wp,kp,Cp,Ep,Tp,Ap,Mp],r=[Op,_p,Dp,Rp,Np,zp,Lp,jp,Ir,wu,ku,Cu,Ip,Bp,Up,Eu,gi,Vp,Tu,Hp],i=zr(),s=le(i,Tu);$e(s,r,s),$e(s,t.domain,s);const l=zr(),c=zr(),u=zr();$e(i,t.domain,l),$e(i,t.scheme,c),$e(i,t.slashscheme,u),$e(l,r,s),$e(l,t.domain,l);const f=le(l,qs);le(s,qs,f),le(c,qs,f),le(u,qs,f);const h=le(s,mi);$e(h,r,s),$e(h,t.domain,s);const m=zr();$e(f,t.domain,m),$e(m,t.domain,m);const g=le(m,mi);$e(g,t.domain,m);const b=zr(yA);$e(g,t.tld,b),$e(g,t.utld,b),le(f,rd,b);const v=le(m,Ir);le(v,Ir,v),$e(v,t.domain,m),$e(b,t.domain,m),le(b,mi,g),le(b,Ir,v);const k=le(b,Zs);$e(k,t.numeric,yA);const C=le(l,Ir),E=le(l,mi);le(C,Ir,C),$e(C,t.domain,l),$e(E,r,s),$e(E,t.domain,l);const j=zr(lh);$e(E,t.tld,j),$e(E,t.utld,j),$e(j,t.domain,l),$e(j,r,s),le(j,mi,E),le(j,Ir,C),le(j,qs,f);const N=le(j,Zs),q=zr(lh);$e(N,t.numeric,q);const H=zr(lh),R=zr();$e(H,e,H),$e(H,n,R),$e(R,e,H),$e(R,n,R),le(j,gi,H),le(q,gi,H);const I=le(c,Zs),Q=le(u,Zs),W=le(Q,gi),oe=le(W,gi);$e(c,t.domain,l),le(c,mi,E),le(c,Ir,C),$e(u,t.domain,l),le(u,mi,E),le(u,Ir,C),$e(I,t.domain,H),le(I,gi,H),le(I,Eu,H),$e(oe,t.domain,H),$e(oe,e,H),le(oe,gi,H);const ne=[[wu,ku],[mp,gp],[yp,bp],[xp,vp],[Sp,wp],[kp,Cp],[Ep,Tp],[Ap,Mp]];for(let se=0;se<ne.length;se++){const[be,ae]=ne[se],V=le(H,be);le(R,be,V),le(V,ae,H);const z=zr(lh);$e(V,e,z);const Y=zr();$e(V,n),$e(z,e,z),$e(z,n,Y),$e(Y,e,z),$e(Y,n,Y),le(z,ae,H),le(Y,ae,H)}return le(i,rd,j),le(i,iv,Q$),{start:i,tokens:BR}}function tF(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,u=null,f=null,h=0,m=null,g=-1;for(;i<r&&!(u=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(f=u||c.go(n[i].t));)u=null,c=f,c.accepts()?(g=0,m=c):g>=0&&g++,i++,h++;if(g<0)i-=h,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(J0(bA,e,l)),l=[]),i-=g,h-=g;const b=m.t,v=n.slice(i-h,i);s.push(J0(b,e,v))}}return l.length>0&&s.push(J0(bA,e,l)),s}function J0(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 nF=typeof console<"u"&&console&&console.warn||(()=>{}),rF="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Tt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function iF(){return er.groups={},Tt.scanner=null,Tt.parser=null,Tt.tokenQueue=[],Tt.pluginQueue=[],Tt.customSchemes=[],Tt.initialized=!1,Tt}function xA(t,e=!1){if(Tt.initialized&&nF(`linkifyjs: already initialized - will not register custom scheme "${t}" ${rF}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
193
+ 1. Must only contain digits, lowercase ASCII letters or "-"
194
+ 2. Cannot start or end with "-"
195
+ 3. "-" cannot repeat`);Tt.customSchemes.push([t,e])}function sF(){Tt.scanner=J$(Tt.customSchemes);for(let t=0;t<Tt.tokenQueue.length;t++)Tt.tokenQueue[t][1]({scanner:Tt.scanner});Tt.parser=eF(Tt.scanner.tokens);for(let t=0;t<Tt.pluginQueue.length;t++)Tt.pluginQueue[t][1]({scanner:Tt.scanner,parser:Tt.parser});return Tt.initialized=!0,Tt}function uv(t){return Tt.initialized||sF(),tF(Tt.parser.start,t,UR(Tt.scanner.start,t))}uv.scan=UR;function VR(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 cv(n),i=uv(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 dv="[\0-   ᠎ -\u2029  ]",oF=new RegExp(dv),lF=new RegExp(`${dv}$`),aF=new RegExp(dv,"g");function cF(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function uF(t){return new ht({key:new At("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=c9(n.doc,[...e]);if(g9(c).forEach(({newRange:f})=>{const h=d9(r.doc,f,b=>b.isTextblock);let m,g;if(h.length>1)m=h[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(h.length){const b=r.doc.textBetween(f.from,f.to," "," ");if(!lF.test(b))return;m=h[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const b=g.split(oF).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],k=m.pos+g.lastIndexOf(v);if(!v)return!1;const C=uv(v).map(E=>E.toObject(t.defaultProtocol));if(!cF(C))return!1;C.filter(E=>E.isLink).map(E=>({...E,from:k+E.start+1,to:k+E.end+1})).filter(E=>r.schema.marks.code?!r.doc.rangeHasMark(E.from,E.to,r.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{ev(E.from,E.to,r.doc).some(j=>j.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function dF(t){return new ht({key:new At("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 u=MR(e.state,t.type.name),f=r.target,h=(i=f==null?void 0:f.href)!==null&&i!==void 0?i:u.href,m=(s=f==null?void 0:f.target)!==null&&s!==void 0?s:u.target;return f&&h?(window.open(h,m),!0):!1}}})}function fF(t){return new ht({key:new At("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(f=>{c+=f.textContent});const u=VR(c,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===c);return!c||!u?!1:t.editor.commands.setMark(t.type,{href:u.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(aF,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const hF=Oi.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"){xA(t);return}xA(t.scheme,t.optionalSlashes)})},onDestroy(){iF()},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",It(this.options.HTMLAttributes,t),0]:["a",It(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[fo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=VR(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(uF({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(dF({type:this.type})),this.options.linkOnPaste&&t.push(fF({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),pF=Pt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ht({key:new At("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 u=r>=c&&r<=c+l.nodeSize,f=!l.isLeaf&&Mm(l);if((u||!this.options.showOnlyCurrent)&&f){const h=[this.options.emptyNodeClass];s&&h.push(this.options.emptyEditorClass);const m=jt.node(c,c+l.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:u}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),Qe.create(t,i)}}})]}});let yx,bx;if(typeof WeakMap<"u"){let t=new WeakMap;yx=e=>t.get(e),bx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;yx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},bx=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Lt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,l=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;l<this.height&&this.map[e+this.width*c]==n;c++)l++;return{left:r,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:l==this.height)?null:this.map[r+this.width*(n<0?s-1:l)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:l,right:c,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,u),right:Math.max(r,c),bottom:Math.max(s,f)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==t.left&&i&&this.map[s-1]==l||r==t.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let l=e+t*this.width;const c=(t+1)*this.width;for(;l<c&&this.map[l]<i;)l++;return l==c?s-1:this.map[l]}i=s}}static get(t){return yx(t)||bx(t,mF(t))}};function mF(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=gF(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let f=0,h=e*n;f<h;f++)r[f]=0;for(let f=0,h=0;f<n;f++){const m=t.child(f);h++;for(let v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==m.childCount)break;const k=m.child(v),{colspan:C,rowspan:E,colwidth:j}=k.attrs;for(let N=0;N<E;N++){if(N+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:h,n:E-N});break}const q=i+N*e;for(let H=0;H<C;H++){r[q+H]==0?r[q+H]=h:(s||(s=[])).push({type:"collision",row:f,pos:h,n:C-H});const R=j&&j[H];if(R){const I=(q+H)%e*2,Q=l[I];Q==null||Q!=R&&l[I+1]==1?(l[I]=R,l[I+1]=1):Q==R&&l[I+1]++}}}i+=C,h+=k.nodeSize}const g=(f+1)*e;let b=0;for(;i<g;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:f,n:b}),h++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Lt(e,n,r,s);let u=!1;for(let f=0;!u&&f<l.length;f+=2)l[f]!=null&&l[f+1]<n&&(u=!0);return u&&yF(c,l,t),c}function gF(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let l=0;l<r;l++){const c=t.child(l);for(let u=0;u<c.childCount;u++){const f=c.child(u);l+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const c=i.child(l);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function yF(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let c=null;const u=l.attrs;for(let f=0;f<u.colspan;f++){const h=e[(i+f)%t.width*2];h!=null&&(!u.colwidth||u.colwidth[f]!=h)&&((c||(c=bF(u)))[f]=h)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function bF(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Nn(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 Js=new At("selectingCells");function fl(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 xF(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 oi(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 Dm(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=fl(e.$head)||vF(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function vF(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 xx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function SF(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function fv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function PR(t,e,n){const r=t.node(-1),i=Lt.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 $R(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 wF(t,e,n){const r=Nn(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 kt=class ts extends Ne{constructor(e,n=e){const r=e.node(-1),i=Lt.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),u=i.cellsInRect(l).filter(h=>h!=n.pos-s);u.unshift(n.pos-s);const f=u.map(h=>{const m=r.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const g=s+h+1;return new SD(c.resolve(g),c.resolve(g+m.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(xx(r)&&xx(i)&&fv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?ts.rowSelection(r,i):s&&this.isColSelection()?ts.colSelection(r,i):new ts(r,i)}return Oe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Lt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let h=u*n.width+i.left,m=i.left;m<i.right;m++,h++){const g=n.map[h];if(s[g])continue;s[g]=!0;const b=n.findCell(g);let v=e.nodeAt(g);if(!v)throw new RangeError(`No cell with offset ${g} found`);const k=i.left-b.left,C=b.right-i.right;if(k>0||C>0){let E=v.attrs;if(k>0&&(E=hl(E,0,k)),C>0&&(E=hl(E,E.colspan-C,C)),b.left<i.left){if(v=v.type.createAndFill(E),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else v=v.type.create(E,v.content)}if(b.top<i.top||b.bottom>i.bottom){const E={...v.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?v=v.type.createAndFill(E):v=v.type.create(E,v.content)}f.push(v)}l.push(e.child(u).copy(te.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new he(te.from(c),1,1)}replace(e,n=he.empty){const r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:c,$to:u}=i[l],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(u.pos),l?he.empty:n)}const s=Ne.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new he(te.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Lt.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=Lt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.top<=c.top?(l.top>0&&(e=u.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=u.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new ts(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Lt.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 ts&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Lt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.left<=c.left?(l.left>0&&(e=u.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=u.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=u.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=u.resolve(s+i.map[i.width*(l.top+1)-1]))),new ts(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ts(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ts(e.resolve(n),e.resolve(r))}getBookmark(){return new kF(this.$anchorCell.pos,this.$headCell.pos)}};kt.prototype.visible=!1;Ne.jsonID("cell",kt);var kF=class FR{constructor(e,n){this.anchor=e,this.head=n}map(e){return new FR(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&&fv(n,r)?new kt(n,r):Ne.near(r,1)}};function CF(t){if(!(t.selection instanceof kt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Qe.create(t.doc,e)}function EF({$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 TF({$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 AF(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,l;if(r instanceof Te&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=kt.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=kt.rowSelection(c,c)}else if(!n){const c=Lt.get(r.node),u=r.from+1,f=u+c.map[c.width*c.height-1];s=kt.create(i,u+1,f)}}else r instanceof Oe&&EF(r)?s=Oe.create(i,r.from):r instanceof Oe&&TF(r)&&(s=Oe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const MF=new At("fix-tables");function qR(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const u=e.child(l);for(let f=c,h=Math.min(i,l+3);f<h;f++)if(t.child(f)==u){c=f+1,n+=u.nodeSize;continue e}r(u,n),c<i&&t.child(c).sameMarkup(u)?qR(t.child(c),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function KR(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=OF(t,i,s,n))};return e?e.doc!=t.doc&&qR(e.doc,t.doc,0,r):t.doc.descendants(r),n}function OF(t,e,n,r){const i=Lt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const h=e.nodeAt(f.pos);if(!h)continue;const m=h.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,hl(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const h=r.mapping.map(n);r.delete(h,h+e.nodeSize)}}let l,c;for(let u=0;u<s.length;u++)s[u]&&(l==null&&(l=u),c=u);for(let u=0,f=n+1;u<i.height;u++){const h=e.child(u),m=f+h.nodeSize,g=s[u];if(g>0){let b="cell";h.firstChild&&(b=h.firstChild.type.spec.tableRole);const v=[];for(let C=0;C<g;C++){const E=Nn(t.schema)[b].createAndFill();E&&v.push(E)}const k=(u==0||l==u-1)&&c==u?f+1:m-1;r.insert(r.mapping.map(k),v)}f=m}return r.setMeta(MF,{fixTables:!0})}function Di(t){const e=t.selection,n=Dm(t),r=n.node(-1),i=n.start(-1),s=Lt.get(r);return{...e instanceof kt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function YR(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;wF(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const c=l*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const u=e.map[c],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,$R(f.attrs,i-e.colCount(u))),l+=f.attrs.rowspan-1}else{const u=s==null?Nn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(l,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function _F(t,e){if(!oi(t))return!1;if(e){const n=Di(t);e(YR(t.tr,n,n.left))}return!0}function DF(t,e){if(!oi(t))return!1;if(e){const n=Di(t);e(YR(t.tr,n,n.right))}return!0}function RF(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let l=0;l<e.height;){const c=l*e.width+i,u=e.map[c],f=n.nodeAt(u),h=f.attrs;if(i>0&&e.map[c-1]==u||i<e.width-1&&e.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,hl(h,i-e.colCount(u)));else{const m=t.mapping.slice(s).map(r+u);t.delete(m,m+f.nodeSize)}l+=h.rowspan}}function NF(t,e){if(!oi(t))return!1;if(e){const n=Di(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;RF(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=Lt.get(s)}e(r)}return!0}function zF(t,e,n){var r;const i=Nn(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 WR(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const l=[];let c=i>0?-1:0;zF(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let f=0,h=e.width*i;f<e.width;f++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const m=e.map[h],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const m=c==null?Nn(r.type.schema).cell:(u=r.nodeAt(e.map[h+c*e.width]))===null||u===void 0?void 0:u.type,g=m==null?void 0:m.createAndFill();g&&l.push(g)}return t.insert(s,Nn(r.type.schema).row.create(null,l)),t}function LF(t,e){if(!oi(t))return!1;if(e){const n=Di(t);e(WR(t.tr,n,n.top))}return!0}function jF(t,e){if(!oi(t))return!1;if(e){const n=Di(t);e(WR(t.tr,n,n.bottom))}return!0}function IF(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const u=new Set;for(let f=0,h=i*e.width;f<e.width;f++,h++){const m=e.map[h];if(!u.has(m)){if(u.add(m),i>0&&m==e.map[h-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[h+e.width]){const g=n.nodeAt(m),b=g.attrs,v=g.type.create({...b,rowspan:g.attrs.rowspan-1},g.content),k=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+k),v),f+=b.colspan-1}}}}function BF(t,e){if(!oi(t))return!1;if(e){const n=Di(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;IF(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=Lt.get(n.table)}e(r)}return!0}function vA(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function UF({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,l=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[c]==n[c+1])return!0;s+=t,c+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function SA(t,e){const n=t.selection;if(!(n instanceof kt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Di(t),{map:i}=r;if(UF(i,r))return!1;if(e){const s=t.tr,l={};let c=te.empty,u,f;for(let h=r.top;h<r.bottom;h++)for(let m=r.left;m<r.right;m++){const g=i.map[h*i.width+m],b=r.table.nodeAt(g);if(!(l[g]||!b))if(l[g]=!0,u==null)u=g,f=b;else{vA(b)||(c=c.append(b.content));const v=s.mapping.map(g+r.tableStart);s.delete(v,v+b.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...$R(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const h=u+1+f.content.size,m=vA(f)?u+1:h;s.replaceWith(m+r.tableStart,h+r.tableStart,c)}s.setSelection(new kt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function wA(t,e){const n=Nn(t.schema);return HF(({node:r})=>n[r.type.spec.tableRole])(t,e)}function HF(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof kt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=xF(r.$from),!i)return!1;s=(l=fl(r.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const u=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const h=Di(e),m=e.tr;for(let b=0;b<h.right-h.left;b++)u.push(f?{...c,colwidth:f&&f[b]?[f[b]]:null}:c);let g;for(let b=h.top;b<h.bottom;b++){let v=h.map.positionAt(b,h.left,h.table);b==h.top&&(v+=i.nodeSize);for(let k=h.left,C=0;k<h.right;k++,C++)k==h.left&&b==h.top||m.insert(g=m.mapping.map(v+h.tableStart,1),t({node:i,row:b,col:k}).createAndFill(u[C]))}m.setNodeMarkup(s,t({node:i,row:h.top,col:h.left}),u[0]),r instanceof kt&&m.setSelection(new kt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function VF(t,e){return function(n,r){if(!oi(n))return!1;const i=Dm(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof kt?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 PF(t){return function(e,n){if(!oi(e))return!1;if(n){const r=Nn(e.schema),i=Di(e),s=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=l.map(u=>i.table.nodeAt(u));for(let u=0;u<l.length;u++)c[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[u],r.cell,c[u].attrs);if(s.steps.length===0)for(let u=0;u<l.length;u++)s.setNodeMarkup(i.tableStart+l[u],r.header_cell,c[u].attrs);n(s)}return!0}}function kA(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 sd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?PF(t):function(n,r){if(!oi(n))return!1;if(r){const i=Nn(n.schema),s=Di(n),l=n.tr,c=kA("row",s,i),u=kA("column",s,i),f=(t==="column"?c:t==="row"&&u)?1:0,h=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(g=>{const b=g+s.tableStart,v=l.doc.nodeAt(b);v&&l.setNodeMarkup(b,m,v.attrs)}),r(l)}return!0}}sd("row",{useDeprecatedLogic:!0});sd("column",{useDeprecatedLogic:!0});const $F=sd("cell",{useDeprecatedLogic:!0});function FF(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 CA(t){return function(e,n){if(!oi(e))return!1;const r=FF(Dm(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Oe.between(i,SF(i))).scrollIntoView())}return!0}}function qF(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 ah(t,e){const n=t.selection;if(!(n instanceof kt))return!1;if(e){const r=t.tr,i=Nn(t.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new he(i,0,0))}),r.docChanged&&e(r)}return!0}function KF(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,l=i.type.schema,c=[];if(s=="row")for(let u=0;u<e.childCount;u++){let f=e.child(u).content;const h=u?0:Math.max(0,n-1),m=u<e.childCount-1?0:Math.max(0,r-1);(h||m)&&(f=vx(Nn(l).row,new he(f,h,m)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?vx(Nn(l).row,new he(e,n,r)).content:e);else return null;return YF(l,c)}function YF(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:c,colspan:u}=s.child(l).attrs;for(let f=i;f<i+c;f++)n[f]=(n[f]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(te.empty),n[i]<r){const s=Nn(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 vx(t,e){const n=t.createAndFill();return new N1(n).replace(0,n.content.size,e).doc}function WF({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const u=n[c],f=[];for(let h=s[c]||0,m=0;h<r;m++){let g=u.child(m%u.childCount);h+g.attrs.colspan>r&&(g=g.type.createChecked(hl(g.attrs,g.attrs.colspan,h+g.attrs.colspan-r),g.content)),f.push(g),h+=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(f))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const u=[],f=n[c%e];for(let h=0;h<f.childCount;h++){let m=f.child(h);l+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}s.push(te.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function GF(t,e,n,r,i,s,l){const c=t.doc.type.schema,u=Nn(c);let f,h;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const b=n.child(m);g+=b.nodeSize;const v=[];let k;b.lastChild==null||b.lastChild.type==u.cell?k=f||(f=u.cell.createAndFill()):k=h||(h=u.header_cell.createAndFill());for(let C=e.width;C<i;C++)v.push(k);t.insert(t.mapping.slice(l).map(g-1+r),v)}if(s>e.height){const m=[];for(let v=0,k=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const C=v>=e.width?!1:n.nodeAt(e.map[k+v]).type==u.header_cell;m.push(C?h||(h=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,te.from(m)),b=[];for(let v=e.height;v<s;v++)b.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),b)}return!!(f||h)}function EA(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const h=l*e.width+f,m=e.map[h];if(e.map[h-e.width]==m){u=!0;const g=n.nodeAt(m),{top:b,left:v}=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,v,n)),g.type.createAndFill({...g.attrs,rowspan:b+g.attrs.rowspan-l})),f+=g.attrs.colspan-1}}return u}function TA(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const h=f*e.width+l,m=e.map[h];if(e.map[h-1]==m){u=!0;const g=n.nodeAt(m),b=e.colCount(m),v=t.mapping.slice(c).map(m+r);t.setNodeMarkup(v,null,hl(g.attrs,l-b,g.attrs.colspan-(l-b))),t.insert(v+g.nodeSize,g.type.createAndFill(hl(g.attrs,0,l-b))),f+=g.attrs.rowspan-1}}return u}function AA(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=Lt.get(s);const{top:c,left:u}=r,f=u+i.width,h=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=Lt.get(s),g=m.mapping.maps.length}GF(m,l,s,n,f,h,g)&&b(),EA(m,l,s,n,u,f,c,g)&&b(),EA(m,l,s,n,u,f,h,g)&&b(),TA(m,l,s,n,c,h,u,g)&&b(),TA(m,l,s,n,c,h,f,g)&&b();for(let v=c;v<h;v++){const k=l.positionAt(v,u,s),C=l.positionAt(v,f,s);m.replace(m.mapping.slice(g).map(k+n),m.mapping.slice(g).map(C+n),new he(i.rows[v-c],0,0))}b(),m.setSelection(new kt(m.doc.resolve(n+l.positionAt(c,u,s)),m.doc.resolve(n+l.positionAt(h-1,f-1,s)))),e(m)}const ZF=F1({ArrowLeft:ch("horiz",-1),ArrowRight:ch("horiz",1),ArrowUp:ch("vert",-1),ArrowDown:ch("vert",1),"Shift-ArrowLeft":uh("horiz",-1),"Shift-ArrowRight":uh("horiz",1),"Shift-ArrowUp":uh("vert",-1),"Shift-ArrowDown":uh("vert",1),Backspace:ah,"Mod-Backspace":ah,Delete:ah,"Mod-Delete":ah});function _h(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function ch(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof kt)return _h(n,r,Ne.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=GR(i,t,e);if(l==null)return!1;if(t=="horiz")return _h(n,r,Ne.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),u=PR(c,t,e);let f;return u?f=Ne.near(u,1):e<0?f=Ne.near(n.doc.resolve(c.before(-1)),-1):f=Ne.near(n.doc.resolve(c.after(-1)),1),_h(n,r,f)}}}function uh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof kt)l=s;else{const u=GR(i,t,e);if(u==null)return!1;l=new kt(n.doc.resolve(u))}const c=PR(l.$headCell,t,e);return c?_h(n,r,new kt(l.$anchorCell,c)):!1}}function JF(t,e){const n=t.state.doc,r=fl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new kt(r))),!0):!1}function XF(t,e,n){if(!oi(t.state))return!1;let r=KF(n);const i=t.state.selection;if(i instanceof kt){r||(r={width:1,height:1,rows:[te.from(vx(Nn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=Lt.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=WF(r,c.right-c.left,c.bottom-c.top),AA(t.state,t.dispatch,l,c,r),!0}else if(r){const s=Dm(t.state),l=s.start(-1);return AA(t.state,t.dispatch,l,Lt.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function QF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=MA(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof kt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=fl(t.state.selection.$anchor))!=null&&((n=X0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,f){let h=X0(t,f);const m=Js.getState(t.state)==null;if(!h||!fv(u,h))if(m)h=u;else return;const g=new kt(u,h);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(Js,u.pos),t.dispatch(b)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),Js.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Js,-1))}function c(u){const f=u,h=Js.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(MA(t,f.target)!=r&&(m=X0(t,e),!m))return l();m&&s(m,f)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",c)}function GR(t,e,n){if(!(t.state.selection instanceof Oe))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 MA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function X0(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&&fl(t.state.doc.resolve(r))||fl(t.state.doc.resolve(i))}var e7=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")),Sx(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,Sx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Sx(t,e,n,r,i,s){let l=0,c=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:b,colwidth:v}=f.child(m).attrs;for(let k=0;k<b;k++,g++){const C=i==g?s:v&&v[k],E=C?C+"px":"";if(l+=C||r,C||(c=!1),u)u.style.width!=E&&(u.style.width=E),u=u.nextSibling;else{const j=document.createElement("col");j.style.width=E,e.appendChild(j)}}}for(;u;){var h;const m=u.nextSibling;(h=u.parentNode)===null||h===void 0||h.removeChild(u),u=m}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const xr=new At("tableColumnResizing");function t7({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=e7,lastColumnResizable:i=!0}={}){const s=new ht({key:xr,state:{init(l,c){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=Nn(c.schema).table.name;return r&&f&&(f[h]=(m,g)=>new r(m,n,g)),new n7(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=xr.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{r7(l,c,t,i)},mouseleave:l=>{i7(l)},mousedown:(l,c)=>{s7(l,c,e,n)}},decorations:l=>{const c=xr.getState(l);if(c&&c.activeHandle>-1)return u7(l,c.activeHandle)},nodeViews:{}}});return s}var n7=class Dh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(xr);if(r&&r.setHandle!=null)return new Dh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Dh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return xx(e.doc.resolve(i))||(i=-1),new Dh(i,n.dragging)}return n}};function r7(t,e,n,r){if(!t.editable)return;const i=xr.getState(t.state);if(i&&!i.dragging){const s=l7(e.target);let l=-1;if(s){const{left:c,right:u}=s.getBoundingClientRect();e.clientX-c<=n?l=OA(t,e,"left",n):u-e.clientX<=n&&(l=OA(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),u=c.node(-1),f=Lt.get(u),h=c.start(-1);if(f.colCount(c.pos-h)+c.nodeAfter.attrs.colspan-1==f.width-1)return}ZR(t,l)}}}function i7(t){if(!t.editable)return;const e=xr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&ZR(t,-1)}function s7(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=xr.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),u=o7(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(xr,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",h);const g=xr.getState(t.state);g!=null&&g.dragging&&(a7(t,g.activeHandle,_A(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(xr,{setDragging:null})))}function h(m){if(!m.which)return f(m);const g=xr.getState(t.state);if(g&&g.dragging){const b=_A(g.dragging,m,n);DA(t,g.activeHandle,b,r)}}return DA(t,l.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",h),e.preventDefault(),!0}function o7(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let u=0;u<n;u++)r[u]&&(l-=r[u],c--);return l/c}function l7(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function OA(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=fl(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const u=Lt.get(c.node(-1)),f=c.start(-1),h=u.map.indexOf(c.pos-f);return h%u.width==0?-1:f+u.map[h-1]}function _A(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function ZR(t,e){t.dispatch(t.state.tr.setMeta(xr,{setHandle:e}))}function a7(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Lt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const h=f*s.width+c;if(f&&s.map[h]==s.map[h-s.width])continue;const m=s.map[h],g=i.nodeAt(m).attrs,b=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[b]==n)continue;const v=g.colwidth?g.colwidth.slice():c7(g.colspan);v[b]=n,u.setNodeMarkup(l+m,null,{...g,colwidth:v})}u.docChanged&&t.dispatch(u)}function DA(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=Lt.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&Sx(s,u.firstChild,u,r,c,n)}function c7(t){return Array(t).fill(0)}function u7(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Qe.empty;const s=Lt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const h=c+f*s.width;if((c==s.width-1||s.map[h]!=s.map[h+1])&&(f==0||s.map[h]!=s.map[h-s.width])){var u;const m=s.map[h],g=l+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((u=xr.getState(t))===null||u===void 0)&&u.dragging&&n.push(jt.node(l+m,l+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(jt.widget(g,b))}}return Qe.create(t.doc,n)}function d7({allowTableNodeSelection:t=!1}={}){return new ht({key:Js,state:{init(){return null},apply(e,n){const r=e.getMeta(Js);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:CF,handleDOMEvents:{mousedown:QF},createSelectionBetween(e){return Js.getState(e.state)!=null?e.state.selection:null},handleTripleClick:JF,handleKeyDown:ZF,handlePaste:XF},appendTransaction(e,n,r){return AF(r,KR(r,n),t)}})}function wx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function RA(t,e,n,r,i,s){var l;let c=0,u=!0,f=e.firstChild;const h=t.firstChild;if(h!==null)for(let m=0,g=0;m<h.childCount;m+=1){const{colspan:b,colwidth:v}=h.child(m).attrs;for(let k=0;k<b;k+=1,g+=1){const C=i===g?s:v&&v[k],E=C?`${C}px`:"";if(c+=C||r,C||(u=!1),f){if(f.style.width!==E){const[j,N]=wx(r,C);f.style.setProperty(j,N)}f=f.nextSibling}else{const j=document.createElement("col"),[N,q]=wx(r,C);j.style.setProperty(N,q),e.appendChild(j)}}}for(;f;){const m=f.nextSibling;(l=f.parentNode)===null||l===void 0||l.removeChild(f),f=m}u?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class f7{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")),RA(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,RA(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function h7(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:v}=c.child(m).attrs;for(let k=0;k<b;k+=1,g+=1){const C=n===g?r:v&&v[k];i+=C||e,C||(s=!1);const[E,j]=wx(e,C);l.push(["col",{style:`${E}: ${j}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:u,tableMinWidth:f}}function NA(t,e){return t.createAndFill()}function p7(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 m7(t,e,n,r,i){const s=p7(t),l=[],c=[];for(let f=0;f<n;f+=1){const h=NA(s.cell);if(h&&c.push(h),r){const m=NA(s.header_cell);m&&l.push(m)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?l:c));return s.table.createChecked(null,u)}function g7(t){return t instanceof kt}const dh=({editor:t})=>{const{selection:e}=t.state;if(!g7(e))return!1;let n=0;const r=AR(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},y7=hn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:f7,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}=h7(t,this.options.cellMinWidth),s=["table",It(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=m7(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(Oe.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>_F(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>DF(t,e),deleteColumn:()=>({state:t,dispatch:e})=>NF(t,e),addRowBefore:()=>({state:t,dispatch:e})=>LF(t,e),addRowAfter:()=>({state:t,dispatch:e})=>jF(t,e),deleteRow:()=>({state:t,dispatch:e})=>BF(t,e),deleteTable:()=>({state:t,dispatch:e})=>qF(t,e),mergeCells:()=>({state:t,dispatch:e})=>SA(t,e),splitCell:()=>({state:t,dispatch:e})=>wA(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>sd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>sd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>$F(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>SA(t,e)?!0:wA(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>VF(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>CA(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>CA(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&KR(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=kt.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:dh,"Mod-Backspace":dh,Delete:dh,"Mod-Delete":dh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[t7({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],d7({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Fe(Se(t,"tableRole",e))}}}),b7=hn.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",It(this.options.HTMLAttributes,t),0]}}),x7=hn.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",It(this.options.HTMLAttributes,t),0]}}),v7=hn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",It(this.options.HTMLAttributes,t),0]}});var S7=yM();const w7=Xp(S7);function k7(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var JR={exports:{}},Q0={};/**
196
+ * @license React
197
+ * use-sync-external-store-shim.production.min.js
198
+ *
199
+ * Copyright (c) Facebook, Inc. and its affiliates.
200
+ *
201
+ * This source code is licensed under the MIT license found in the
202
+ * LICENSE file in the root directory of this source tree.
203
+ */var zA;function C7(){if(zA)return Q0;zA=1;var t=on;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(),v=r({inst:{value:b,getSnapshot:g}}),k=v[0].inst,C=v[1];return s(function(){k.value=b,k.getSnapshot=g,u(k)&&C({inst:k})},[m,b,g]),i(function(){return u(k)&&C({inst:k}),m(function(){u(k)&&C({inst:k})})},[m]),l(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function f(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Q0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,Q0}JR.exports=C7();var hv=JR.exports;const E7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},T7=({contentComponent:t})=>{const e=hv.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return on.createElement(on.Fragment,null,Object.values(e))};function A7(){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]:w7.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 M7 extends on.Component{constructor(e){var n;super(e),this.editorContentRef=on.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=A7(),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 on.createElement(on.Fragment,null,on.createElement("div",{ref:E7(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&on.createElement(T7,{contentComponent:e.contentComponent}))}}const O7=M.forwardRef((t,e)=>{const n=on.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return on.createElement(M7,{key:n,innerRef:e,...t})}),_7=on.memo(O7);var D7=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},R7=k7(D7),XR={exports:{}},eb={};/**
204
+ * @license React
205
+ * use-sync-external-store-shim/with-selector.production.min.js
206
+ *
207
+ * Copyright (c) Facebook, Inc. and its affiliates.
208
+ *
209
+ * This source code is licensed under the MIT license found in the
210
+ * LICENSE file in the root directory of this source tree.
211
+ */var LA;function N7(){if(LA)return eb;LA=1;var t=on,e=hv;function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return eb.useSyncExternalStoreWithSelector=function(f,h,m,g,b){var v=s(null);if(v.current===null){var k={hasValue:!1,value:null};v.current=k}else k=v.current;v=c(function(){function E(R){if(!j){if(j=!0,N=R,R=g(R),b!==void 0&&k.hasValue){var I=k.value;if(b(I,R))return q=I}return q=R}if(I=q,r(N,R))return I;var Q=g(R);return b!==void 0&&b(I,Q)?I:(N=R,q=Q)}var j=!1,N,q,H=m===void 0?null:m;return[function(){return E(h())},H===null?void 0:function(){return E(H())}]},[h,m,g,b]);var C=i(f,v[0],v[1]);return l(function(){k.hasValue=!0,k.value=C},[C]),u(C),C},eb}XR.exports=N7();var z7=XR.exports;const L7=typeof window<"u"?M.useLayoutEffect:M.useEffect;class j7{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 I7(t){var e;const[n]=M.useState(()=>new j7(t.editor)),r=z7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:R7);return L7(()=>n.watch(t.editor),[t.editor,n]),M.useDebugValue(r),r}const B7=!1,kx=typeof window>"u",U7=kx||!!(typeof window<"u"&&window.next);class pv{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?kx||U7?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 G9(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?pv.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 H7(t={},e=[]){const n=M.useRef(t);n.current=t;const[r]=M.useState(()=>new pv(n)),i=hv.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return M.useDebugValue(i),M.useEffect(r.onRender(e)),I7({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const V7=M.createContext({editor:null});V7.Consumer;const P7=M.createContext({onDragStart:void 0}),$7=()=>M.useContext(P7);on.forwardRef((t,e)=>{const{onDragStart:n}=$7(),r=t.as||"div";return on.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const F7=/^\s*>\s$/,q7=hn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",It(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[td({find:F7,type:this.type})]}}),K7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Y7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,W7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,G7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Z7=Oi.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",It(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[dl({find:K7,type:this.type}),dl({find:W7,type:this.type})]},addPasteRules(){return[fo({find:Y7,type:this.type}),fo({find:G7,type:this.type})]}}),J7="listItem",jA="textStyle",IA=/^\s*([-+*])\s$/,X7=hn.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",It(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(J7,this.editor.getAttributes(jA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=td({find:IA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=td({find:IA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(jA),editor:this.editor})),[t]}}),Q7=/(^|[^`])`([^`]+)`(?!`)/,eq=/(^|[^`])`([^`]+)`(?!`)/g,tq=Oi.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",It(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[dl({find:Q7,type:this.type})]},addPasteRules(){return[fo({find:eq,type:this.type})]}}),nq=/^```([a-z]+)?[\s\n]$/,rq=/^~~~([a-z]+)?[\s\n]$/,iq=hn.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",It(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(`
212
+
213
+ `);return!s||!l?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection(Ne.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[ix({find:nq,type:this.type,getAttributes:t=>({language:t[1]})}),ix({find:rq,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ht({key:new At("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:l,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,`
214
+ `));return l.replaceSelectionWith(this.type.create({language:s},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(Oe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),sq=hn.create({name:"doc",topNode:!0,content:"block+"});function oq(t={}){return new ht({view(e){return new lq(e,t)}})}class lq{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 v=b.getBoundingClientRect(),k=m?v.bottom:v.top;m&&g&&(k=(k+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*c;r={left:v.left,right:v.right,top:k-C,bottom:k+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 u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let f,h;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,h=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;f=m.left-u.scrollLeft*g,h=m.top-u.scrollTop*b}this.element.style.left=(r.left-f)/l+"px",this.element.style.top=(r.top-h)/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=gD(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 aq=Pt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[oq(this.options)]}});class zt extends Ne{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return zt.valid(r)?new zt(r):Ne.near(r)}content(){return he.empty}eq(e){return e instanceof zt&&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 zt(e.resolve(n.pos))}getBookmark(){return new mv(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!cq(e)||!uq(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&&zt.valid(e))return e;let i=e.pos,s=null;for(let l=e.depth;;l--){let c=e.node(l);if(n>0?e.indexAfter(l)<c.childCount:e.index(l)>0){s=c.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=n;let u=e.doc.resolve(i);if(zt.valid(u))return u}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Te.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(zt.valid(c))return c}return null}}}zt.prototype.visible=!1;zt.findFrom=zt.findGapCursorFrom;Ne.jsonID("gapcursor",zt);class mv{constructor(e){this.pos=e}map(e){return new mv(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return zt.valid(n)?new zt(n):Ne.near(n)}}function QR(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function cq(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||QR(i.type))return!0;if(i.inlineContent)return!1}}return!0}function uq(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||QR(i.type))return!0;if(i.inlineContent)return!1}}return!0}function dq(){return new ht({props:{decorations:mq,createSelectionBetween(t,e,n){return e.pos==n.pos&&zt.valid(n)?new zt(n):null},handleClick:hq,handleKeyDown:fq,handleDOMEvents:{beforeinput:pq}}})}const fq=F1({ArrowLeft:fh("horiz",-1),ArrowRight:fh("horiz",1),ArrowUp:fh("vert",-1),ArrowDown:fh("vert",1)});function fh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let l=r.selection,c=e>0?l.$to:l.$from,u=l.empty;if(l instanceof Oe){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=zt.findGapCursorFrom(c,e,u);return f?(i&&i(r.tr.setSelection(new zt(f))),!0):!1}}function hq(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!zt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Te.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new zt(r))),!0)}function pq(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof zt))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 he(i,0,0));return s.setSelection(Oe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function mq(t){if(!(t.selection instanceof zt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Qe.create(t.doc,[jt.widget(t.selection.head,e,{key:"gapcursor"})])}const gq=Pt.create({name:"gapCursor",addProseMirrorPlugins(){return[dq()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Fe(Se(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),yq=hn.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",It(this.options.HTMLAttributes,t)]},renderText(){return`
215
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:h})=>{if(h&&u&&l){const m=u.filter(g=>c.includes(g.type.name));f.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),bq=hn.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]}`,It(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=>ix({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Pp=200,dn=function(){};dn.prototype.append=function(e){return e.length?(e=dn.from(e),!this.length&&e||e.length<Pp&&this.leafAppend(e)||this.length<Pp&&e.leafPrepend(this)||this.appendInner(e)):this};dn.prototype.prepend=function(e){return e.length?dn.from(e).append(this):this};dn.prototype.appendInner=function(e){return new xq(this,e)};dn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?dn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};dn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};dn.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)};dn.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};dn.from=function(e){return e instanceof dn?e:e&&e.length?new e2(e):dn.empty};var e2=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,l,c){for(var u=s;u<l;u++)if(i(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var u=s-1;u>=l;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Pp)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Pp)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})(dn);dn.empty=new e2([]);var xq=(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})(dn);const vq=500;class Qr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=e.tr,c,u,f=[],h=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,h.push(m);return}if(i){h.push(new yi(m.map));let b=m.step.map(i.slice(s)),v;b&&l.maybeStep(b).doc&&(v=l.mapping.maps[l.mapping.maps.length-1],f.push(new yi(v,void 0,void 0,f.length+h.length))),s--,v&&i.appendMap(v,s)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,u=new Qr(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),g=new yi(e.mapping.maps[h],m,n),b;(b=u&&u.merge(g))&&(g=b,h?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(u=g)}let f=l-r.depth;return f>wq&&(c=Sq(c,f),l-=f),new Qr(c.append(s),l)}remapping(e,n){let r=new Wu;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 Qr(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 u=n;this.items.forEach(g=>{let b=s.getMirror(--u);if(b==null)return;l=Math.min(l,b);let v=s.maps[b];if(g.step){let k=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(s.slice(u+1,b));C&&c++,r.push(new yi(v,k,C))}else r.push(new yi(v))},i);let f=[];for(let g=n;g<l;g++)f.push(new yi(s.maps[g]));let h=this.items.slice(0,i).append(f).append(r),m=new Qr(h,c);return m.emptyItemCount()>vq&&(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 u=l.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let h=l.selection&&l.selection.map(n.slice(r));h&&s++;let m=new yi(f.invert(),u,h),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 Qr(dn.from(i.reverse()),s)}}Qr.empty=new Qr(dn.empty,0);function Sq(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 Ks{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const wq=20;function kq(t,e,n,r){let i=n.getMeta(el),s;if(i)return i.historyState;n.getMeta(Tq)&&(t=new Ks(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 Ks(t.done.addTransform(n,void 0,r,Rh(e)),t.undone,BA(n.mapping.maps),t.prevTime,t.prevComposition):new Ks(t.done,t.undone.addTransform(n,void 0,r,Rh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Cq(n,t.prevRanges)),f=l?tb(t.prevRanges,n.mapping):BA(n.mapping.maps);return new Ks(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Rh(e)),Qr.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Ks(t.done.rebased(n,s),t.undone.rebased(n,s),tb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ks(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),tb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Cq(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 BA(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 tb(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 Eq(t,e,n){let r=Rh(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),u=new Ks(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(el,{redo:n,historyState:u})}let nb=!1,UA=null;function Rh(t){let e=t.plugins;if(UA!=e){nb=!1,UA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){nb=!0;break}}return nb}const el=new At("history"),Tq=new At("closeHistory");function Aq(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ht({key:el,state:{init(){return new Ks(Qr.empty,Qr.empty,null,0,-1)},apply(e,n,r){return kq(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?n2:r=="historyRedo"?r2:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function t2(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=Eq(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const n2=t2(!1,!0),r2=t2(!0,!0),Mq=Pt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>n2(t,e),redo:()=>({state:t,dispatch:e})=>r2(t,e)}},addProseMirrorPlugins(){return[Aq(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()}}}),Oq=hn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",It(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!J9(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}):b9(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:c})=>{var u;if(c){const{$to:f}=l.selection,h=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?l.setSelection(Oe.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Te.create(l.doc,f.pos)):l.setSelection(Oe.create(l.doc,f.pos));else{const m=(u=f.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();m&&(l.insert(h,m),l.setSelection(Oe.create(l.doc,h+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Z9({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_q=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Dq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Rq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Nq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,zq=Oi.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",It(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[dl({find:_q,type:this.type}),dl({find:Rq,type:this.type})]},addPasteRules(){return[fo({find:Dq,type:this.type}),fo({find:Nq,type:this.type})]}}),Lq=hn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",It(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)}}}),jq="listItem",HA="textStyle",VA=/^(\d+)\.\s$/,Iq=hn.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",It(this.options.HTMLAttributes,n),0]:["ol",It(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(jq,this.editor.getAttributes(HA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=td({find:VA,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=td({find:VA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(HA)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Bq=hn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",It(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Uq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Hq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Vq=Oi.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",It(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[dl({find:Uq,type:this.type})]},addPasteRules(){return[fo({find:Hq,type:this.type})]}}),Pq=hn.create({name:"text",group:"inline"}),$q=Pt.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(Z7.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(q7.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(X7.configure(this.options.bulletList)),this.options.code!==!1&&t.push(tq.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(iq.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(sq.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(aq.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(gq.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(yq.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(bq.configure(this.options.heading)),this.options.history!==!1&&t.push(Mq.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(Oq.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(zq.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Lq.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Iq.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Bq.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Vq.configure(this.options.strike)),this.options.text!==!1&&t.push(Pq.configure(this.options.text)),t}}),hh=new At("tandemAnnotations");function rb(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const l=qu(s);if(l.status!=="pending"||!l.range&&!l.relRange)return;const c=Xh(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:u,to:f}=c;if(u>=f||u<0||f>i)return;let h={};switch(l.type){case"highlight":{const m=l.color||"yellow",g=Du[m]||Du.yellow;h={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?h={class:"tandem-suggestion",style:"background: var(--tandem-suggestion-bg); text-decoration: underline wavy var(--tandem-suggestion); text-underline-offset: 3px;","data-annotation-id":l.id,"aria-label":"Replacement annotation"}:l.directedAt==="claude"?h={class:"tandem-question",style:"background: var(--tandem-accent-bg); border-bottom: 2px solid var(--tandem-accent); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Question annotation"}:h={class:"tandem-comment",style:"border-bottom: 2px dashed var(--tandem-author-user); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Comment annotation"};break;case"flag":h={class:"tandem-flag",style:"background: var(--tandem-error-bg); border-bottom: 2px solid var(--tandem-error); 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(jt.inline(u,f,h))}catch(m){if(!(m instanceof RangeError))throw m;console.debug("[annotation] RangeError for %s (from=%d, to=%d), skipping",l.id,u,f)}}),Qe.create(t,r)}const Fq=Pt.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(Oa);let n=e.size>0,r=!1;return[new ht({key:hh,state:{init(i,s){return rb(s.doc,e,t)},apply(i,s,l,c){if(i.getMeta(hh))return rb(c.doc,e,t);if(i.docChanged){if(!r&&s===Qe.empty&&n){const u=rb(c.doc,e,t);return u!==Qe.empty&&(r=!0),u}return s.map(i.mapping,i.doc)}return s}},props:{decorations(i){return hh.getState(i)}},view(i){const s=()=>{n=e.size>0,r=!1;const l=i.state.tr.setMeta(hh,!0);i.dispatch(l)};return e.observe(s),{destroy(){e.unobserve(s)}}}})]}}),fa=new At("tandemAuthorship");function qq(t,e,n){if(t.relRange){const r=B_(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=ol(e,t.range.from),i=ol(e,t.range.to);if(r<i)return{from:r,to:i}}return null}function ib(t,e,n,r){if(!r)return Qe.empty;const i=[],s=t.content.size;return e.forEach(l=>{const c=l;if(!c.author||!c.range||!["user","claude"].includes(c.author))return;const f=qq(c,t,n);if(!f)return;const{from:h,to:m}=f;if(h>=m||h<0||m>s)return;const g={"data-tandem-author":c.author};try{i.push(jt.inline(h,m,g))}catch(b){if(!(b instanceof RangeError))throw b;console.warn("[authorship] Decoration RangeError for entry",c.id,b)}}),Qe.create(t,i)}const Kq=Pt.create({name:"tandemAuthorship",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(RC);let n=!1;try{n=localStorage.getItem(wM)==="true"}catch(r){console.warn("[authorship] localStorage unavailable",r)}return[new ht({key:fa,state:{init(r,i){return{visible:n,decorations:ib(i.doc,e,t,n)}},apply(r,i,s,l){const c=r.getMeta(fa);if((c==null?void 0:c.type)==="toggle"){const u=c.visible;return{visible:u,decorations:ib(l.doc,e,t,u)}}return(c==null?void 0:c.type)==="rebuild"?{visible:i.visible,decorations:ib(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=fa.getState(r))==null?void 0:i.decorations)??Qe.empty}},view(r){const i=()=>{const l=r.state.tr.setMeta(fa,{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(fa)||!t.docChanged)return;const n=e.getMap(RC),r=t.doc;t.steps.forEach(i=>{i.getMap().forEach((l,c,u,f)=>{if(f-u-(c-l)>0)try{const m=Ia(r,Sr(u)),g=Ia(r,Sr(f));if(g<=m)return;const b=ZI("user"),v={id:b,author:"user",range:{from:m,to:g},timestamp:Date.now()};n.set(b,v)}catch(m){console.warn("[authorship] Position conversion failed during user attribution",m)}})})}}),ph=new At("tandemAwareness");function PA(t,e){if(!e)return Qe.empty;const n=[],{focusParagraph:r,focusOffset:i,active:s}=e;if(r!==null&&r>=0){let l=0;t.forEach((c,u)=>{l===r&&n.push(jt.node(u,u+c.nodeSize,{class:"tandem-claude-focus",style:"background: var(--tandem-claude-focus-bg); border-left: 3px solid var(--tandem-claude-focus-border); padding-left: 8px; transition: background 0.3s ease, border-color 0.3s ease;"})),l++})}if(i!==null&&i>=0)try{const l=ol(t,gh(i)),c=s===!1?" tandem-claude-cursor-idle":"";n.push(jt.widget(l,()=>{const u=document.createElement("span");u.className=`tandem-claude-cursor${c}`,u.setAttribute("aria-hidden","true");const f=document.createElement("span");return f.className="tandem-claude-cursor-label",f.textContent="Claude",u.appendChild(f),u}))}catch(l){console.warn("[awareness] cursor decoration failed, falling back to gutter-only:",l)}return n.length===0?Qe.empty:Qe.create(t,n)}const Yq=Pt.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(SM),n=t.getMap(db);return[new ht({key:ph,state:{init(r,i){const s=e.get("claude");return PA(i.doc,s??null)},apply(r,i,s,l){if(r.getMeta(ph)){const c=e.get("claude");return PA(l.doc,c??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return ph.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(ph,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new ht({key:new At("tandemUserAwareness"),view(){let r=null,i=null,s=null,l=!1,c=-1;return{update(u,f){const{state:h}=u;if(!h.selection.eq(f.selection)){const m=U_(h.doc,{from:Sr(h.selection.from),to:Sr(h.selection.to)});if(h.selection.from===h.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const g=h.doc.textBetween(h.selection.from,h.selection.to,`
216
+ `),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)}}h.doc!==f.doc&&(c=h.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:u.state.selection.from,lastEdit:Date.now()})},tL))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function sb({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s,onAnnotationClick:l}){const c=H7({extensions:[$q.configure({history:!1}),P$.configure({multicolor:!0}),hF.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),pF.configure({placeholder:"Open a document with Claude to get started..."}),y7.configure({resizable:!0}),v7,b7,x7,B$.configure({document:t}),U$.configure({provider:e,user:{name:O1(),color:"var(--tandem-warning)"}}),Fq.configure({ydoc:t}),Kq.configure({ydoc:t}),Yq.configure({ydoc:t})],editorProps:{attributes:{class:"tandem-editor",style:"outline: none; min-height: 500px; font-size: var(--tandem-editor-font-size, 16px); line-height: 1.6;"}}},[t,e]);M.useEffect(()=>{c&&c.setEditable(!n)},[c,n]),M.useEffect(()=>{if(c)return P_(h=>c.commands.updateUser({name:h}))},[c]),M.useEffect(()=>(s==null||s(c),()=>s==null?void 0:s(null)),[c,s]),M.useEffect(()=>{if(!c)return;const h=c.view.dom;h.querySelectorAll(".tandem-annotation-active").forEach(m=>{m.classList.remove("tandem-annotation-active")}),i&&r&&h.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(m=>{m.classList.add("tandem-annotation-active")})},[c,i,r]);const u=M.useCallback(h=>{const m=h.target.closest("[data-annotation-id]");if(!m)return;const g=m.getAttribute("data-annotation-id");g&&l&&l(g)},[l]),f=r?"tandem-review-dimmed":"";return S.jsx("div",{className:f,onClick:u,children:S.jsx(_7,{editor:c})})}function rn({label:t,ariaLabel:e,shortcut:n,disabled:r,disabledTitle:i,active:s,onMouseDown:l,onClick:c,style:u}){let f="1px solid var(--tandem-border)",h="var(--tandem-surface)",m="var(--tandem-fg)";r?(h="var(--tandem-surface-muted)",m="var(--tandem-fg-subtle)"):s&&(f="1px solid var(--tandem-accent)",h="var(--tandem-accent-bg)",m="var(--tandem-accent)");const g=e??(typeof t=="string"?t:void 0),b=g??"";return S.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",...u,border:f,background:h,color:m},children:t})}const Wq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),S.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),S.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),Gq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),S.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),S.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),S.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),Zq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.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"}),S.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"})]}),Jq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("path",{d:"M5 4L1 8l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M11 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M9 2l-2 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Xq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),S.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),S.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),S.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),Qq=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),eK=S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),S.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),i2=[1,2,3],tK={1:700,2:600,3:500};function nK(t){for(const e of i2)if(t.isActive("heading",{level:e}))return e;return null}function Lr(t){return e=>{e.preventDefault(),t()}}function rK({editor:t,disabled:e}){var v,k;const[,n]=M.useState(0),[r,i]=M.useState(!1),s=M.useRef(null);if(M.useEffect(()=>{if(!t)return;const C=()=>{t.isDestroyed||n(E=>E+1)};return t.on("transaction",C),()=>{t.off("transaction",C)}},[t]),M.useEffect(()=>{if(!r)return;function C(E){s.current&&!s.current.contains(E.target)&&i(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[r]),!t)return null;const c=!t.isEditable||!!e,u=Si.getState(t.state),f=!c&&(((v=u==null?void 0:u.undoManager)==null?void 0:v.undoStack.length)??0)>0,h=!c&&(((k=u==null?void 0:u.undoManager)==null?void 0:k.redoStack.length)??0)>0,m=nK(t);function g(C){return E=>{E.preventDefault(),!(!t||t.isDestroyed)&&(t.chain().focus().toggleHeading({level:C}).run(),i(!1))}}const b=m?`H${m}`:"H";return S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[S.jsx(rn,{label:Qq,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!f,onMouseDown:Lr(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx(rn,{label:eK,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!h,onMouseDown:Lr(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),S.jsx(rn,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Lr(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),S.jsx(rn,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Lr(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),S.jsx(rn,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Lr(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),S.jsx(rn,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Lr(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),S.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:C=>{C.key==="Escape"&&i(!1)},children:[S.jsx(rn,{label:b,disabled:c,active:m!==null,onMouseDown:C=>{C.preventDefault(),i(E=>!E)},style:{minWidth:"30px"}}),r&&S.jsx("div",{role:"menu","aria-label":"Heading level",style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"6px",padding:"4px",display:"flex",flexDirection:"column",gap:"2px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:i2.map(C=>S.jsxs("button",{type:"button",role:"menuitem",onMouseDown:g(C),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===C?"var(--tandem-accent-bg)":"transparent",color:m===C?"var(--tandem-accent)":"var(--tandem-fg)",cursor:"pointer",textAlign:"left",fontWeight:tK[C],whiteSpace:"nowrap"},children:["Heading ",C]},C))})]}),S.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),S.jsx(rn,{label:Wq,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Lr(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx(rn,{label:Gq,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Lr(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx(rn,{label:Xq,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Lr(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}}),S.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),S.jsx(rn,{label:Zq,ariaLabel:"Link",shortcut:"Ctrl+K",disabled:c||!t.isActive("link")&&t.state.selection.from===t.state.selection.to,active:t.isActive("link"),onMouseDown:Lr(()=>{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"}}),S.jsx(rn,{label:"—",ariaLabel:"Horizontal rule",disabled:c,onMouseDown:Lr(()=>t.chain().focus().setHorizontalRule().run()),style:{minWidth:"30px"}}),S.jsx(rn,{label:Jq,ariaLabel:"Code block",disabled:c,active:t.isActive("codeBlock"),onMouseDown:Lr(()=>t.chain().focus().toggleCodeBlock().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}const iK=[{value:"yellow",label:"Yellow"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"pink",label:"Pink"}];function sK({disabled:t,onHighlight:e}){const[n,r]=M.useState("yellow"),[i,s]=M.useState(!1),l=M.useRef(null);M.useEffect(()=>{if(!i)return;function h(m){l.current&&!l.current.contains(m.target)&&s(!1)}return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]);function c(h){h.preventDefault(),e(n)}function u(h){h.preventDefault(),s(m=>!m)}function f(h){r(h),s(!1)}return S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[S.jsx(rn,{label:"Highlight",disabled:t,disabledTitle:"Select text first",onMouseDown:c,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),S.jsx("button",{disabled:t,onMouseDown:u,title:"Choose highlight color",style:{padding:"4px 6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"0 4px 4px 0",background:t?"var(--tandem-surface-muted)":"var(--tandem-surface)",cursor:t?"not-allowed":"pointer",display:"flex",alignItems:"center"},children:S.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:Du[n],border:"1px solid rgba(0,0,0,0.15)"}})}),i&&S.jsxs("div",{ref:l,style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"6px",padding:"6px",display:"flex",gap:"4px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[iK.map(({value:h,label:m})=>S.jsx("button",{title:m,onClick:()=>f(h),style:{width:"24px",height:"24px",borderRadius:"4px",border:h===n?"2px solid var(--tandem-fg)":"1px solid rgba(0,0,0,0.15)",background:Du[h],cursor:"pointer",padding:0}},h)),S.jsx("button",{"data-testid":"color-picker-close",title:"Close",onClick:()=>s(!1),style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",cursor:"pointer",padding:0,fontSize:"13px",color:"var(--tandem-fg-muted)",display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]})}function oK({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:l,submitLabel:c,borderColor:u,canSubmit:f,secondaryInput:h}){return S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[S.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 ${u}`,borderRadius:"4px",outline:"none",minWidth:"120px",flex:"1 1 200px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),h,S.jsx(rn,{label:c,disabled:!f,onClick:i}),S.jsx(rn,{label:"Cancel",disabled:!1,onClick:s})]})}function lK({tandemMode:t,onModeChange:e}){return S.jsxs("div",{"data-testid":"mode-toggle",role:"group","aria-label":"Claude collaboration mode",style:{display:"flex",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",overflow:"hidden"},children:[S.jsxs("button",{"data-testid":"mode-solo-btn",title:"Write undisturbed — Claude only responds when you message","aria-pressed":t==="solo",onClick:()=>e("solo"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:t==="solo"?"var(--tandem-accent)":"transparent",color:t==="solo"?"var(--tandem-accent-fg)":"var(--tandem-fg-muted)",fontWeight:t==="solo"?600:400,borderRight:"1px solid var(--tandem-border-strong)",display:"flex",alignItems:"center",gap:"5px"},children:[t==="solo"&&S.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-fg-subtle)",display:"inline-block"}}),"Solo"]}),S.jsxs("button",{"data-testid":"mode-tandem-btn",title:"Full collaboration — Claude reacts to selections and document changes","aria-pressed":t==="tandem",onClick:()=>e("tandem"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:t==="tandem"?"var(--tandem-accent)":"transparent",color:t==="tandem"?"var(--tandem-accent-fg)":"var(--tandem-fg-muted)",fontWeight:t==="tandem"?600:400,display:"flex",alignItems:"center",gap:"5px"},children:[t==="tandem"&&S.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-success)",display:"inline-block"}}),"Tandem"]})]})}function aK({editor:t,ydoc:e,onSettingsOpen:n,settingsBtnRef:r,tandemMode:i,onModeChange:s,heldCount:l}){const[c,u]=M.useState(!1),[f,h]=M.useState("idle"),[m,g]=M.useState(""),b=M.useRef(null),v=M.useRef(null);M.useEffect(()=>{if(!t)return;const ne=t;function se(){const{from:be,to:ae}=ne.state.selection,V=be!==ae;u(z=>z===V?z:V)}return t.on("selectionUpdate",se),()=>{t.off("selectionUpdate",se)}},[t]),M.useEffect(()=>{f==="comment"&&v.current&&v.current.focus()},[f]);function k(ne,se,be){if(!t||!e)return;const ae=b.current??t.state.selection,{from:V,to:z}=ae;if(V===z)return;const Y=Ia(t.state.doc,Sr(V)),pe=Ia(t.state.doc,Sr(z)),_e=WI(),O={id:_e,author:"user",type:ne,range:{from:Y,to:pe},content:se,status:"pending",timestamp:Date.now(),...be!=null&&be.color?{color:be.color}:{}};e.getMap(Oa).set(_e,O),b.current=null}function C(){if(!t)return;const{from:ne,to:se}=t.state.selection;b.current={from:ne,to:se}}function E(){b.current=null,t==null||t.chain().focus().run()}const j=f!=="idle";function N(ne){k("highlight","",{color:ne})}const q=M.useCallback(ne=>se=>{se.preventDefault(),C(),h(ne),g("")},[t]),H=M.useMemo(()=>q("comment"),[q]);function R(){h("idle"),g(""),E()}function I(){if(!m.trim()){R();return}k("comment",m.trim()),h("idle"),g(""),t==null||t.chain().focus().run()}function Q(ne){ne.key==="Enter"?(ne.preventDefault(),I()):ne.key==="Escape"&&R()}function W(ne){ne.preventDefault(),k("flag","")}const oe=t&&e&&c;return S.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",minHeight:"42px",padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",userSelect:"none"},children:[S.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"var(--tandem-accent)",letterSpacing:"-0.02em"},children:"Tandem"}),S.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),S.jsx(rK,{editor:t,disabled:j}),S.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),S.jsx(sK,{disabled:!oe||j,onHighlight:N}),S.jsx(rn,{label:"Comment",disabled:!oe||j,disabledTitle:"Select text first",onMouseDown:H}),f==="comment"&&S.jsx(oK,{inputRef:v,value:m,onChange:g,onKeyDown:Q,onSubmit:I,onCancel:R,placeholder:"Add a comment...",submitLabel:"Add",borderColor:"var(--tandem-author-user)",canSubmit:!!m.trim()}),S.jsx(rn,{label:"Flag",disabled:!oe||j,onMouseDown:W}),S.jsx("div",{style:{flex:1}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(l??0)>0&&S.jsxs("span",{"data-testid":"held-badge",style:{padding:"1px 6px",fontSize:"10px",fontWeight:600,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",borderRadius:"9999px"},children:[l," held"]}),i&&s&&S.jsx(lK,{tandemMode:i,onModeChange:s}),n&&S.jsx("button",{ref:r,"data-testid":"settings-btn",onClick:n,title:"Settings (Ctrl+,)","aria-label":"Settings","aria-keyshortcuts":"Control+Comma",style:{background:"none",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"13px",padding:"4px 12px",minHeight:"24px"},children:"Settings"})]})]})}function cK(t){const[e,n]=M.useState(!1),[r,i]=M.useState(!1);return M.useEffect(()=>{if(t==null){n(!1),i(!1);return}const s=Date.now()-t,l=rL-s;if(l<=0){n(!0);return}const c=setTimeout(()=>n(!0),l);return()=>clearTimeout(c)},[t]),{showBanner:e&&!r,dismiss:()=>i(!0)}}const s2=200,o2=600,gv=300;function Cx(t){return"right"in t?t.right:gv}function Ps(t){const e=xM[t];try{const n=localStorage.getItem(e);if(n){const r=parseInt(n,10);if(Number.isFinite(r))return Math.max(s2,Math.min(o2,r));console.warn(`[tandem] ignoring non-numeric panel width for ${e}: ${n}`)}}catch(n){console.warn(`[tandem] localStorage unavailable reading ${e}:`,n)}return gv}function uK({panelLayout:t,setPanelLayout:e}){const n=M.useRef(t);n.current=t;const r=M.useRef(null);return M.useEffect(()=>()=>{r.current&&(document.removeEventListener("mousemove",r.current.move),document.removeEventListener("mouseup",r.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]),{handleResizeStart:M.useCallback((s,l)=>{s.preventDefault();const c=s.clientX,u=n.current;let f;l==="left"?f="left"in u?u.left:gv:f=Cx(u);const h=xM[l];let m=f;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const g=v=>{const k=v.clientX-c,C=l==="left"?f+k:f-k;m=Math.max(s2,Math.min(o2,C)),e(E=>l==="right"?E.kind==="three-panel"?{...E,right:m}:E.kind==="tabbed"?{kind:"tabbed",right:m}:E:E.kind==="three-panel"?{...E,left:m}:E.kind==="tabbed-left"?{...E,left:m}:E)},b=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",b),r.current=null,document.body.style.userSelect="",document.body.style.cursor="";const v=n.current;if(l==="left"&&"left"in v||l==="right"&&"right"in v)try{localStorage.setItem(h,String(m))}catch(C){console.warn(`[tandem] failed to persist ${h}:`,C)}};r.current={move:g,up:b},document.addEventListener("mousemove",g),document.addEventListener("mouseup",b)},[e])}}function dK(){const[t,e]=M.useState(!1),n=M.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=M.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=M.useCallback(async s=>{if(e(!1),!s.dataTransfer.files.length)return;s.preventDefault();const l=s.dataTransfer.files[0],c=await H_(l);try{const u=await fetch(`${cs}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:l.name,content:c})});if(!u.ok){const f=await u.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",u.status,f.message??f.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function fK(t,e){return t.status!=="pending"||e==="tandem"?!0:t.author!=="claude"}function hK(t,e){return M.useMemo(()=>{const n=[];let r=0;for(const i of t)fK(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function pK(){const[t,e]=M.useState([]),n=M.useRef(new Map),r=M.useCallback((l,c)=>{const u=n.current.get(l);u&&clearTimeout(u);const f=NC[c]??NC.info,h=setTimeout(()=>{e(m=>m.filter(g=>g.id!==l)),n.current.delete(l)},f);n.current.set(l,h)},[]),i=M.useCallback(l=>{const c=n.current.get(l);c&&(clearTimeout(c),n.current.delete(l))},[]),s=M.useCallback(l=>{e(c=>c.filter(u=>u.id!==l)),i(l)},[i]);return M.useEffect(()=>{const l=`http://localhost:${fd}/api/notify-stream`,c=new EventSource(l);return c.onmessage=u=>{let f;try{f=JSON.parse(u.data)}catch{console.warn("[useNotifications] Malformed SSE data:",u.data);return}e(h=>{if(f.dedupKey){const b=h.findIndex(v=>v.dedupKey===f.dedupKey);if(b!==-1){const v=h[b];i(v.id);const k={...f,count:v.count+1},C=[...h];return C[b]=k,r(k.id,k.severity),C}}const m={...f,count:1},g=[...h,m];for(;g.length>dL;){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 u of n.current.values())clearTimeout(u);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function mK(t){const[e,n]=M.useState(!1),[r,i]=M.useState(null),s=M.useRef(0),{pendingCount:l,acceptedCount:c,dismissedCount:u}=M.useMemo(()=>{let h=0,m=0,g=0;for(const b of t)b.status==="pending"?h++:b.status==="accepted"?m++:b.status==="dismissed"&&g++;return{pendingCount:h,acceptedCount:m,dismissedCount:g}},[t]);M.useEffect(()=>{const h=c+u;s.current>0&&l===0&&h>0&&(i({accepted:c,dismissed:u,total:h}),n(!0)),s.current=l},[l,c,u]);const f=M.useCallback(()=>{n(!1)},[]);return{pendingCount:l,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:f}}function gK(t){const[e,n]=M.useState(!1),r=M.useRef(!1),i=M.useCallback(async()=>{if(!(!t||r.current)){r.current=!0,n(!0);try{const s=await fetch(`http://localhost:${fd}/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 M.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 yK(t){return t.isComposing||t.code!=="Comma"?!1:t.ctrlKey||t.metaKey}function bK(t){M.useEffect(()=>{const e=n=>{yK(n)&&(n.preventDefault(),t())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t])}function xK(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 vK(t,e,n){const r=M.useRef(t);r.current=t;const i=M.useRef(e);i.current=e,M.useEffect(()=>{const s=l=>{if(!l.ctrlKey&&!l.metaKey||l.key!=="Tab")return;const c=xK(r.current,i.current,l.shiftKey);c&&(l.preventDefault(),n(c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}function $A(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 SK(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 u=[...s];u.splice(l,1);const f=u.indexOf(n),h=i==="right"?f+1:f;return u.splice(h,0,e),u}function wK(t){const[e,n]=M.useState([]),r=M.useMemo(()=>{const l=new Map(t.map(f=>[f.id,f])),c=t.map(f=>f.id);return $A(e,c).map(f=>l.get(f)).filter(Boolean)},[t,e]),i=M.useMemo(()=>t.map(l=>l.id),[t]);M.useEffect(()=>{n(l=>{const c=$A(l,i);return l.length===c.length&&l.every((u,f)=>u===c[f])?l:c})},[i]);const s=M.useCallback(function(c,u,f="left"){if(c===u)return;const h=new Set(i);n(m=>SK(m,c,u,h,f))},[i]);return{orderedTabs:r,reorder:s}}var st;(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})(st||(st={}));var FA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(FA||(FA={}));const we=st.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 we.undefined;case"string":return we.string;case"number":return Number.isNaN(t)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(t)?we.array:t===null?we.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?we.promise:typeof Map<"u"&&t instanceof Map?we.map:typeof Set<"u"&&t instanceof Set?we.set:typeof Date<"u"&&t instanceof Date?we.date:we.object;default:return we.unknown}},de=st.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 us 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,u=0;for(;u<l.path.length;){const f=l.path[u];u===l.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(n(l))):c[f]=c[f]||{_errors:[]},c=c[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof us))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.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()}}us.create=t=>new us(t);const Ex=(t,e)=>{let n;switch(t.code){case de.invalid_type:t.received===we.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case de.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,st.jsonStringifyReplacer)}`;break;case de.unrecognized_keys:n=`Unrecognized key(s) in object: ${st.joinValues(t.keys,", ")}`;break;case de.invalid_union:n="Invalid input";break;case de.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${st.joinValues(t.options)}`;break;case de.invalid_enum_value:n=`Invalid enum value. Expected ${st.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}"`:st.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,st.assertNever(t)}return{message:n}};let kK=Ex;function CK(){return kK}const EK=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 u=r.filter(f=>!!f).slice().reverse();for(const f of u)c=f(l,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function ye(t,e){const n=CK(),r=EK({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ex?void 0:Ex].filter(i=>!!i)});t.common.issues.push(r)}class wr{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 wr.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"}),cu=t=>({status:"dirty",value:t}),Yr=t=>({status:"valid",value:t}),qA=t=>t.status==="aborted",KA=t=>t.status==="dirty",Pa=t=>t.status==="valid",$p=t=>typeof Promise<"u"&&t instanceof Promise;var Ee;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ee||(Ee={}));class ho{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 YA=(t,e)=>{if(Pa(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 us(t.common.issues);return this._error=n,this._error}}};function Ke(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:u}=t;return l.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},description:i}}class et{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 wr,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($p(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 YA(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 Pa(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=>Pa(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($p(i)?i:Promise.resolve(i));return YA(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(u=>u?!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 Fa({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 oo.create(this,this._def)}nullable(){return qa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ki.create(this)}promise(){return Yp.create(this,this._def)}or(e){return qp.create([this,e],this._def)}and(e){return Kp.create(this,e,this._def)}transform(e){return new Fa({...Ke(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Ax({...Ke(this._def),innerType:this,defaultValue:n,typeName:Be.ZodDefault})}brand(){return new WK({typeName:Be.ZodBranded,type:this,...Ke(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Mx({...Ke(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 yv.create(this,e)}readonly(){return Ox.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const TK=/^c[^\s-]{8,}$/i,AK=/^[0-9a-z]+$/,MK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OK=/^[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,_K=/^[a-z0-9_-]{21}$/i,DK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RK=/^[-+]?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)?)??$/,NK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ob;const LK=/^(?:(?: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])$/,jK=/^(?:(?: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])$/,IK=/^(([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]))$/,BK=/^(([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])$/,UK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,HK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,l2="((\\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])))",VK=new RegExp(`^${l2}$`);function a2(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 PK(t){return new RegExp(`^${a2(t)}$`)}function $K(t){let e=`${l2}T${a2(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 FK(t,e){return!!((e==="v4"||!e)&&LK.test(t)||(e==="v6"||!e)&&IK.test(t))}function qK(t,e){if(!DK.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 KK(t,e){return!!((e==="v4"||!e)&&jK.test(t)||(e==="v6"||!e)&&BK.test(t))}class Yo extends et{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==we.string){const s=this._getOrReturnCtx(e);return ye(s,{code:de.invalid_type,expected:we.string,received:s.parsedType}),Ie}const r=new wr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ye(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),ye(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?ye(i,{code:de.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&ye(i,{code:de.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")NK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"email",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")ob||(ob=new RegExp(zK,"u")),ob.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"emoji",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")OK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"uuid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")_K.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"nanoid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")TK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"cuid",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")AK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"cuid2",code:de.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")MK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(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),ye(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),ye(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),ye(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),ye(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),ye(i,{code:de.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?$K(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{code:de.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?VK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{code:de.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?PK(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{code:de.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?RK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"duration",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?FK(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"ip",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?qK(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"jwt",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?KK(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"cidr",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?UK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"base64",code:de.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?HK.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"base64url",code:de.invalid_string,message:s.message}),r.dirty()):st.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,...Ee.errToObj(r)})}_addCheck(e){return new Yo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ee.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ee.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ee.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ee.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ee.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ee.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ee.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ee.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ee.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ee.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ee.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ee.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ee.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,...Ee.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,...Ee.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ee.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ee.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ee.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ee.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ee.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ee.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ee.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ee.errToObj(n)})}nonempty(e){return this.min(1,Ee.errToObj(e))}trim(){return new Yo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yo({...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}}Yo.create=t=>new Yo({checks:[],typeName:Be.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ke(t)});function YK(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 od extends et{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)!==we.number){const s=this._getOrReturnCtx(e);return ye(s,{code:de.invalid_type,expected:we.number,received:s.parsedType}),Ie}let r;const i=new wr;for(const s of this._def.checks)s.kind==="int"?st.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ye(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),ye(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),ye(r,{code:de.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?YK(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ye(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),ye(r,{code:de.not_finite,message:s.message}),i.dirty()):st.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ee.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ee.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ee.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ee.toString(n))}setLimit(e,n,r,i){return new od({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ee.toString(i)}]})}_addCheck(e){return new od({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ee.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ee.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ee.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ee.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ee.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"&&st.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)}}od.create=t=>new od({checks:[],typeName:Be.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ke(t)});class ld extends et{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)!==we.bigint)return this._getInvalidInput(e);let r;const i=new wr;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),ye(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),ye(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),ye(r,{code:de.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):st.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ye(n,{code:de.invalid_type,expected:we.bigint,received:n.parsedType}),Ie}gte(e,n){return this.setLimit("min",e,!0,Ee.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ee.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ee.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ee.toString(n))}setLimit(e,n,r,i){return new ld({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ee.toString(i)}]})}_addCheck(e){return new ld({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ee.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ee.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}}ld.create=t=>new ld({checks:[],typeName:Be.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ke(t)});class WA extends et{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==we.boolean){const r=this._getOrReturnCtx(e);return ye(r,{code:de.invalid_type,expected:we.boolean,received:r.parsedType}),Ie}return Yr(e.data)}}WA.create=t=>new WA({typeName:Be.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ke(t)});class Fp extends et{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==we.date){const s=this._getOrReturnCtx(e);return ye(s,{code:de.invalid_type,expected:we.date,received:s.parsedType}),Ie}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return ye(s,{code:de.invalid_date}),Ie}const r=new wr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ye(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),ye(i,{code:de.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):st.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Fp({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ee.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ee.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}}Fp.create=t=>new Fp({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Be.ZodDate,...Ke(t)});class GA extends et{_parse(e){if(this._getType(e)!==we.symbol){const r=this._getOrReturnCtx(e);return ye(r,{code:de.invalid_type,expected:we.symbol,received:r.parsedType}),Ie}return Yr(e.data)}}GA.create=t=>new GA({typeName:Be.ZodSymbol,...Ke(t)});class ZA extends et{_parse(e){if(this._getType(e)!==we.undefined){const r=this._getOrReturnCtx(e);return ye(r,{code:de.invalid_type,expected:we.undefined,received:r.parsedType}),Ie}return Yr(e.data)}}ZA.create=t=>new ZA({typeName:Be.ZodUndefined,...Ke(t)});class JA extends et{_parse(e){if(this._getType(e)!==we.null){const r=this._getOrReturnCtx(e);return ye(r,{code:de.invalid_type,expected:we.null,received:r.parsedType}),Ie}return Yr(e.data)}}JA.create=t=>new JA({typeName:Be.ZodNull,...Ke(t)});class XA extends et{constructor(){super(...arguments),this._any=!0}_parse(e){return Yr(e.data)}}XA.create=t=>new XA({typeName:Be.ZodAny,...Ke(t)});class QA extends et{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Yr(e.data)}}QA.create=t=>new QA({typeName:Be.ZodUnknown,...Ke(t)});class po extends et{_parse(e){const n=this._getOrReturnCtx(e);return ye(n,{code:de.invalid_type,expected:we.never,received:n.parsedType}),Ie}}po.create=t=>new po({typeName:Be.ZodNever,...Ke(t)});class eM extends et{_parse(e){if(this._getType(e)!==we.undefined){const r=this._getOrReturnCtx(e);return ye(r,{code:de.invalid_type,expected:we.void,received:r.parsedType}),Ie}return Yr(e.data)}}eM.create=t=>new eM({typeName:Be.ZodVoid,...Ke(t)});class ki extends et{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==we.array)return ye(n,{code:de.invalid_type,expected:we.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)&&(ye(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&&(ye(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&&(ye(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 ho(n,l,n.path,c)))).then(l=>wr.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new ho(n,l,n.path,c)));return wr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new ki({...this._def,minLength:{value:e,message:Ee.toString(n)}})}max(e,n){return new ki({...this._def,maxLength:{value:e,message:Ee.toString(n)}})}length(e,n){return new ki({...this._def,exactLength:{value:e,message:Ee.toString(n)}})}nonempty(e){return this.min(1,e)}}ki.create=(t,e)=>new ki({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Be.ZodArray,...Ke(e)});function ha(t){if(t instanceof en){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=oo.create(ha(r))}return new en({...t._def,shape:()=>e})}else return t instanceof ki?new ki({...t._def,type:ha(t.element)}):t instanceof oo?oo.create(ha(t.unwrap())):t instanceof qa?qa.create(ha(t.unwrap())):t instanceof pl?pl.create(t.items.map(e=>ha(e))):t}class en extends et{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=st.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==we.object){const f=this._getOrReturnCtx(e);return ye(f,{code:de.invalid_type,expected:we.object,received:f.parsedType}),Ie}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof po&&this._def.unknownKeys==="strip"))for(const f in i.data)l.includes(f)||c.push(f);const u=[];for(const f of l){const h=s[f],m=i.data[f];u.push({key:{status:"valid",value:f},value:h._parse(new ho(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof po){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of c)u.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(f==="strict")c.length>0&&(ye(i,{code:de.unrecognized_keys,keys:c}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const h of c){const m=i.data[h];u.push({key:{status:"valid",value:h},value:f._parse(new ho(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of u){const m=await h.key,g=await h.value;f.push({key:m,value:g,alwaysSet:h.alwaysSet})}return f}).then(f=>wr.mergeObjectSync(r,f)):wr.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return Ee.errToObj,new en({...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:Ee.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new en({...this._def,unknownKeys:"strip"})}passthrough(){return new en({...this._def,unknownKeys:"passthrough"})}extend(e){return new en({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new en({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 en({...this._def,catchall:e})}pick(e){const n={};for(const r of st.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new en({...this._def,shape:()=>n})}omit(e){const n={};for(const r of st.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new en({...this._def,shape:()=>n})}deepPartial(){return ha(this)}partial(e){const n={};for(const r of st.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new en({...this._def,shape:()=>n})}required(e){const n={};for(const r of st.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof oo;)s=s._def.innerType;n[r]=s}return new en({...this._def,shape:()=>n})}keyof(){return c2(st.objectKeys(this.shape))}}en.create=(t,e)=>new en({shape:()=>t,unknownKeys:"strip",catchall:po.create(),typeName:Be.ZodObject,...Ke(e)});en.strictCreate=(t,e)=>new en({shape:()=>t,unknownKeys:"strict",catchall:po.create(),typeName:Be.ZodObject,...Ke(e)});en.lazycreate=(t,e)=>new en({shape:t,unknownKeys:"strip",catchall:po.create(),typeName:Be.ZodObject,...Ke(e)});class qp extends et{_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 us(c.ctx.common.issues));return ye(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 u of r){const f={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(u=>new us(u));return ye(n,{code:de.invalid_union,unionErrors:c}),Ie}}get options(){return this._def.options}}qp.create=(t,e)=>new qp({options:t,typeName:Be.ZodUnion,...Ke(e)});function Tx(t,e){const n=Ys(t),r=Ys(e);if(t===e)return{valid:!0,data:t};if(n===we.object&&r===we.object){const i=st.objectKeys(e),s=st.objectKeys(t).filter(c=>i.indexOf(c)!==-1),l={...t,...e};for(const c of s){const u=Tx(t[c],e[c]);if(!u.valid)return{valid:!1};l[c]=u.data}return{valid:!0,data:l}}else if(n===we.array&&r===we.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],u=Tx(l,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===we.date&&r===we.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Kp extends et{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,l)=>{if(qA(s)||qA(l))return Ie;const c=Tx(s.value,l.value);return c.valid?((KA(s)||KA(l))&&n.dirty(),{status:n.value,value:c.data}):(ye(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}))}}Kp.create=(t,e,n)=>new Kp({left:t,right:e,typeName:Be.ZodIntersection,...Ke(n)});class pl extends et{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==we.array)return ye(r,{code:de.invalid_type,expected:we.array,received:r.parsedType}),Ie;if(r.data.length<this._def.items.length)return ye(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&&(ye(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 u=this._def.items[c]||this._def.rest;return u?u._parse(new ho(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>wr.mergeArray(n,l)):wr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new pl({...this._def,rest:e})}}pl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pl({items:t,typeName:Be.ZodTuple,rest:null,...Ke(e)})};class tM extends et{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!==we.map)return ye(r,{code:de.invalid_type,expected:we.map,received:r.parsedType}),Ie;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,u],f)=>({key:i._parse(new ho(r,c,r.path,[f,"key"])),value:s._parse(new ho(r,u,r.path,[f,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of l){const f=await u.key,h=await u.value;if(f.status==="aborted"||h.status==="aborted")return Ie;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const u of l){const f=u.key,h=u.value;if(f.status==="aborted"||h.status==="aborted")return Ie;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}}}}tM.create=(t,e,n)=>new tM({valueType:e,keyType:t,typeName:Be.ZodMap,...Ke(n)});class ad extends et{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==we.set)return ye(r,{code:de.invalid_type,expected:we.set,received:r.parsedType}),Ie;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ye(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&&(ye(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(u){const f=new Set;for(const h of u){if(h.status==="aborted")return Ie;h.status==="dirty"&&n.dirty(),f.add(h.value)}return{status:n.value,value:f}}const c=[...r.data.values()].map((u,f)=>s._parse(new ho(r,u,r.path,f)));return r.common.async?Promise.all(c).then(u=>l(u)):l(c)}min(e,n){return new ad({...this._def,minSize:{value:e,message:Ee.toString(n)}})}max(e,n){return new ad({...this._def,maxSize:{value:e,message:Ee.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ad.create=(t,e)=>new ad({valueType:t,minSize:null,maxSize:null,typeName:Be.ZodSet,...Ke(e)});class nM extends et{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})}}nM.create=(t,e)=>new nM({getter:t,typeName:Be.ZodLazy,...Ke(e)});class rM extends et{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ye(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}}rM.create=(t,e)=>new rM({value:t,typeName:Be.ZodLiteral,...Ke(e)});function c2(t,e){return new $a({values:t,typeName:Be.ZodEnum,...Ke(e)})}class $a extends et{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ye(n,{expected:st.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 ye(n,{received:n.data,code:de.invalid_enum_value,options:r}),Ie}return Yr(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=c2;class iM extends et{_parse(e){const n=st.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==we.string&&r.parsedType!==we.number){const i=st.objectValues(n);return ye(r,{expected:st.joinValues(i),received:r.parsedType,code:de.invalid_type}),Ie}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=st.objectValues(n);return ye(r,{received:r.data,code:de.invalid_enum_value,options:i}),Ie}return Yr(e.data)}get enum(){return this._def.values}}iM.create=(t,e)=>new iM({values:t,typeName:Be.ZodNativeEnum,...Ke(e)});class Yp extends et{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==we.promise&&n.common.async===!1)return ye(n,{code:de.invalid_type,expected:we.promise,received:n.parsedType}),Ie;const r=n.parsedType===we.promise?n.data:Promise.resolve(n.data);return Yr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Yp.create=(t,e)=>new Yp({type:t,typeName:Be.ZodPromise,...Ke(e)});class Fa extends et{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=>{ye(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 u=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return u.status==="aborted"?Ie:u.status==="dirty"||n.value==="dirty"?cu(u.value):u});{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"?cu(c.value):c}}if(i.type==="refinement"){const l=c=>{const u=i.refinement(c,s);if(r.common.async)return Promise.resolve(u);if(u 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(!Pa(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=>Pa(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):Ie);st.assertNever(i)}}Fa.create=(t,e,n)=>new Fa({schema:t,typeName:Be.ZodEffects,effect:e,...Ke(n)});Fa.createWithPreprocess=(t,e,n)=>new Fa({schema:e,effect:{type:"preprocess",transform:t},typeName:Be.ZodEffects,...Ke(n)});class oo extends et{_parse(e){return this._getType(e)===we.undefined?Yr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}oo.create=(t,e)=>new oo({innerType:t,typeName:Be.ZodOptional,...Ke(e)});class qa extends et{_parse(e){return this._getType(e)===we.null?Yr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}qa.create=(t,e)=>new qa({innerType:t,typeName:Be.ZodNullable,...Ke(e)});class Ax extends et{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===we.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ax.create=(t,e)=>new Ax({innerType:t,typeName:Be.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ke(e)});class Mx extends et{_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 $p(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new us(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new us(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Mx.create=(t,e)=>new Mx({innerType:t,typeName:Be.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ke(e)});class sM extends et{_parse(e){if(this._getType(e)!==we.nan){const r=this._getOrReturnCtx(e);return ye(r,{code:de.invalid_type,expected:we.nan,received:r.parsedType}),Ie}return{status:"valid",value:e.data}}}sM.create=t=>new sM({typeName:Be.ZodNaN,...Ke(t)});class WK extends et{_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 yv extends et{_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(),cu(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 yv({in:e,out:n,typeName:Be.ZodPipeline})}}class Ox extends et{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Pa(i)&&(i.value=Object.freeze(i.value)),i);return $p(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Ox.create=(t,e)=>new Ox({innerType:t,typeName:Be.ZodReadonly,...Ke(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={}));po.create;ki.create;qp.create;Kp.create;pl.create;const li=$a.create;Yp.create;oo.create;qa.create;li(["highlight","comment","flag"]);li(["pending","accepted","dismissed"]);li(["yellow","green","blue","pink"]);li(["info","warning","error","success"]);const GK=li(["solo","tandem"]);li(["user","claude","import"]);li(["user","claude"]);li(["accept","dismiss"]);li(["markdown","json"]);li(["md","txt","html","docx"]);li(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);function ZK(t,e){const[n,r]=M.useState(()=>{try{const i=localStorage.getItem($f),s=GK.safeParse(i);return s.success?s.data:OC}catch(i){return console.warn(`[tandem] localStorage unavailable reading ${$f}:`,i),OC}});return M.useEffect(()=>{try{localStorage.setItem($f,n)}catch(i){console.warn(`[tandem] failed to persist ${$f}:`,i)}},[n]),M.useEffect(()=>{if(t)try{t.getMap(db).set(lL,n)}catch(i){console.warn("[tandem] failed to broadcast tandem mode to Y.Map:",i)}},[n,t]),M.useEffect(()=>{if(t)try{t.getMap(db).set(aL,e)}catch(i){console.warn("[tandem] failed to broadcast dwell ms to Y.Map:",i)}},[e,t]),{tandemMode:n,setTandemMode:r}}const JK={s:14,m:16,l:18};function oM(){try{return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}const jr={layout:"three-panel",primaryTab:"chat",panelOrder:"chat-editor-annotations",editorWidthPercent:50,selectionDwellMs:vM,showAuthorship:!0,reduceMotion:!1,textSize:"m",theme:"system",accentHue:239,editorFont:"sans",density:"cozy",defaultMode:"tandem",highContrast:!1,annotationPatterns:!1,selectionToolbar:!0};function XK(){let t;try{t=localStorage.getItem(bM)}catch{t=null}if(t)try{const e=JSON.parse(t);return{layout:e.layout==="three-panel"||e.layout==="tabbed"||e.layout==="tabbed-left"?e.layout:jr.layout,primaryTab:e.primaryTab==="annotations"?"annotations":"chat",panelOrder:e.panelOrder==="annotations-editor-chat"?"annotations-editor-chat":"chat-editor-annotations",editorWidthPercent:Math.max(40,Math.min(100,Number(e.editorWidthPercent)||jr.editorWidthPercent)),selectionDwellMs:Math.max(Lh,Math.min(jh,Number(e.selectionDwellMs)||vM)),showAuthorship:e.showAuthorship===!1?!1:jr.showAuthorship,reduceMotion:typeof e.reduceMotion=="boolean"?e.reduceMotion:oM(),textSize:e.textSize==="s"||e.textSize==="m"||e.textSize==="l"?e.textSize:jr.textSize,theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:jr.theme,accentHue:typeof e.accentHue=="number"&&e.accentHue>=0&&e.accentHue<=360?e.accentHue:jr.accentHue,editorFont:e.editorFont==="serif"||e.editorFont==="sans"||e.editorFont==="mono"?e.editorFont:jr.editorFont,density:e.density==="compact"||e.density==="cozy"||e.density==="spacious"?e.density:jr.density,defaultMode:e.defaultMode==="solo"||e.defaultMode==="tandem"?e.defaultMode:jr.defaultMode,highContrast:e.highContrast===!0,annotationPatterns:e.annotationPatterns===!0,selectionToolbar:e.selectionToolbar===!1?!1:jr.selectionToolbar}}catch(e){console.warn("[tandem] settings JSON is corrupt, resetting to defaults:",e)}return{...jr,reduceMotion:oM()}}function QK(t,e){const n={...t,...e};return{...n,editorWidthPercent:Math.max(40,Math.min(100,n.editorWidthPercent)),selectionDwellMs:Math.max(Lh,Math.min(jh,n.selectionDwellMs)),accentHue:Number.isFinite(n.accentHue)?Math.max(0,Math.min(360,n.accentHue)):jr.accentHue}}function eY(){const[t,e]=M.useState(XK),n=M.useCallback(r=>{e(i=>{const s=QK(i,r);try{localStorage.setItem(bM,JSON.stringify(s)),localStorage.setItem(wM,String(s.showAuthorship))}catch{}return s})},[]);return{settings:t,updateSettings:n}}function u2(){try{return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function tY(t){return t==="system"?u2():t}function nY(t){const e=document.documentElement;if(e.setAttribute("data-theme",tY(t)),t!=="system")return()=>e.removeAttribute("data-theme");const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e.setAttribute("data-theme",u2());return n.addEventListener("change",r),()=>{n.removeEventListener("change",r),e.removeAttribute("data-theme")}}function rY(t){M.useEffect(()=>nY(t),[t])}function iY(){try{return localStorage.getItem(EM)==="true"}catch{return!1}}function lM(){try{localStorage.setItem(EM,"true")}catch{}}function sY(t,e,n){const[r,i]=M.useState(iY),[s,l]=M.useState(0),c=M.useRef(0),f=!r&&n==="welcome.md",h=hd(),{status:m,error:g}=RM(h&&f),[b]=M.useState(OM),v=!h||m!==null||g!==null,k=h&&MM(m,b),C=v?k?4:3:1/0;M.useEffect(()=>{if(!f||s!==0)return;const q=t.filter(R=>R.id.startsWith(fL));if(q.length===0)return;q.some(R=>R.status!=="pending")&&(c.current=Date.now(),l(1))},[f,s,t]),M.useEffect(()=>{if(!f||s!==1)return;t.some(H=>H.author==="user")&&(c.current=Date.now(),l(2))},[f,s,t]);const E=e.current;M.useEffect(()=>{if(!f||s!==2||!isFinite(C)||!E)return;const q=()=>{Date.now()-c.current<2e3||E.isFocused&&(c.current=Date.now(),l(3))};return E.on("update",q),()=>{E.off("update",q)}},[f,s,C,E]),M.useEffect(()=>{if(!f||!isFinite(C)||s!==C)return;const q=setTimeout(()=>{lM(),i(!0)},3e3);return()=>clearTimeout(q)},[f,s,C]),M.useEffect(()=>{isFinite(C)&&l(q=>Math.min(q,C))},[C]);const j=M.useCallback(()=>{lM(),i(!0)},[]),N=M.useCallback(()=>{c.current=Date.now(),l(q=>Math.min(q+1,C))},[C]);return{tutorialActive:f,currentStep:s,dismissTutorial:j,nextStep:N,coworkStatus:m}}function oY(){M.useEffect(()=>{let t=!1,e;return Ux(async()=>{const{getCurrentWebview:n}=await import("./webview-BQBJMQvJ.js");return{getCurrentWebview:n}},__vite__mapDeps([0,1])).then(({getCurrentWebview:n})=>{if(t)return;const r=n();let i=Jc;try{const f=localStorage.getItem(zC);if(f!==null){const h=Number(f);Number.isFinite(h)?i=Math.max(LC,Math.min(jC,h)):console.warn(`[tandem] ignoring invalid stored zoom: ${f}`)}}catch{}i!==Jc&&r.setZoom(i).catch(f=>{console.warn("[tandem] failed to restore zoom level:",f)});function s(f){try{localStorage.setItem(zC,String(f))}catch{}}const l=f=>{!(f.metaKey||f.ctrlKey)||f.key!=="0"||(f.preventDefault(),f.stopPropagation(),i=Jc,r.setZoom(Jc).catch(m=>{console.warn("[tandem] failed to reset zoom:",m)}),s(Jc))},c=.1,u=f=>{if(!(f.metaKey||f.ctrlKey))return;const m=f.key==="+"||f.key==="=",g=f.key==="-"||f.key==="_";if(!m&&!g)return;const b=m?i+c:i-c;i=Math.max(LC,Math.min(jC,Math.round(b*100)/100)),s(i)};window.addEventListener("keydown",l,{capture:!0}),window.addEventListener("keydown",u,{capture:!0}),e=()=>{window.removeEventListener("keydown",l,{capture:!0}),window.removeEventListener("keydown",u,{capture:!0})}}).catch(()=>{}),()=>{t=!0,e==null||e()}},[])}const lY=Math.floor,aY=(t,e)=>t<e?t:e,cY=(t,e)=>t>e?t:e,d2=128,Nh=127,uY=Number.MAX_SAFE_INTEGER,dY=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},cd=typeof TextEncoder<"u"?new TextEncoder:null,fY=t=>cd.encode(t),hY=cd?fY:dY;let Au=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Au&&Au.decode(new Uint8Array).length===1&&(Au=null);const Wp=(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},Rm=(t,e)=>{for(;e>Nh;)Wp(t,d2|Nh&e),e=lY(e/128);Wp(t,Nh&e)},_x=new Uint8Array(3e4),pY=_x.length/3,mY=(t,e)=>{if(e.length<pY){const n=cd.encodeInto(e,_x).written||0;Rm(t,n);for(let r=0;r<n;r++)Wp(t,_x[r])}else xY(t,hY(e))},gY=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Rm(t,r);for(let i=0;i<r;i++)Wp(t,n.codePointAt(i))},yY=cd&&cd.encodeInto?mY:gY,bY=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=aY(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(cY(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},xY=(t,e)=>{Rm(t,e.byteLength),bY(t,e)},f2=t=>new Error(t),vY=f2("Unexpected end of array"),SY=f2("Integer out of Range"),wY=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},kY=t=>wY(t,bv(t)),aM=t=>t.arr[t.pos++],bv=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&Nh)*n,n*=128,i<d2)return e;if(e>uY)throw SY}throw vY},CY=t=>{let e=bv(t);if(e===0)return"";{let n=String.fromCodePoint(aM(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(aM(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))}},EY=t=>Au.decode(kY(t)),cM=Au?EY:CY;var Ma;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(Ma||(Ma={}));const TY=(t,e)=>{Rm(t,Ma.Token),yY(t,e)},AY=(t,e,n,r)=>{switch(bv(t)){case Ma.Token:{e();break}case Ma.PermissionDenied:{n(cM(t));break}case Ma.Authenticated:{r(cM(t));break}}},uM=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var Dx;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(Dx||(Dx={}));function MY(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 lb(t){return new Promise(e=>setTimeout(e,t))}function OY(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 _Y(t,e){const n=MY(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const u=n[c];if(!Number.isInteger(u)||u<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||OY;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const u=new Error("Attempt aborted");throw u.code="ATTEMPT_ABORTED",u}const c=async u=>{if(n.handleError&&await n.handleError(u,r,n),r.aborted||r.attemptsRemaining===0)throw u;r.attemptNum++;const f=i(r,n);return f&&await lb(f),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((u,f)=>{const h=setTimeout(()=>{if(n.handleTimeout)try{u(n.handleTimeout(r,n))}catch(m){f(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",f(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(h),u(m)}).catch(m=>{clearTimeout(h),c(m).then(u).catch(f)})}):t(r,n).catch(c)}const l=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(l&&await lb(l),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await lb(c)}return s()}const h2=Math.floor,DY=(t,e)=>t<e?t:e,RY=(t,e)=>t>e?t:e,NY=64,Gp=128,zY=63,Mu=127,p2=Number.MAX_SAFE_INTEGER,LY=()=>new Set,jY=Array.from,IY=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},ud=typeof TextEncoder<"u"?new TextEncoder:null,BY=t=>ud.encode(t),UY=ud?BY:IY;let Ou=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ou&&Ou.decode(new Uint8Array).length===1&&(Ou=null);class HY{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const xv=()=>new HY,m2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},vv=t=>{const e=new Uint8Array(m2(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},Zp=(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},_n=(t,e)=>{for(;e>Mu;)Zp(t,Gp|Mu&e),e=h2(e/128);Zp(t,Mu&e)},Rx=new Uint8Array(3e4),VY=Rx.length/3,PY=(t,e)=>{if(e.length<VY){const n=ud.encodeInto(e,Rx).written||0;_n(t,n);for(let r=0;r<n;r++)Zp(t,Rx[r])}else rc(t,UY(e))},$Y=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;_n(t,r);for(let i=0;i<r;i++)Zp(t,n.codePointAt(i))},ds=ud&&ud.encodeInto?PY:$Y,FY=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=DY(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(RY(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},rc=(t,e)=>{_n(t,e.byteLength),FY(t,e)},g2=t=>new Error(t),y2=g2("Unexpected end of array"),b2=g2("Integer out of Range");class qY{constructor(e){this.arr=e,this.pos=0}}const x2=t=>new qY(t),KY=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Nm=t=>KY(t,tl(t)),dM=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&Mu)*n,n*=128,i<Gp)return e;if(e>p2)throw b2}throw y2},YY=t=>{let e=t.arr[t.pos++],n=e&zY,r=64;const i=(e&NY)>0?-1:1;if((e&Gp)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Mu)*r,r*=128,e<Gp)return i*n;if(n>p2)throw b2}throw y2},WY=t=>{let e=tl(t);if(e===0)return"";{let n=String.fromCodePoint(dM(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(dM(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))}},GY=t=>Ou.decode(Nm(t)),dd=Ou?GY:WY,ZY=t=>{const e=t.pos,n=dd(t);return t.pos=e,n},Ka=Date.now,ab=()=>new Map,JY=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class XY{constructor(){this._observers=ab()}on(e,n){JY(this._observers,e,LY).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 jY((this._observers.get(e)||ab()).values()).forEach(r=>r(...n))}destroy(){this._observers=ab()}}const QY=Object.keys,fM=t=>QY(t).length,eW=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),tW=(t,e)=>t===e,_u=(t,e)=>{if(t==null||e==null)return tW(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)||!_u(t.get(n),e.get(n)))return!1;break}case Object:if(fM(t)!==fM(e))return!1;for(const n in t)if(!eW(t,n)||!_u(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(!_u(t[n],e[n]))return!1;break;default:return!1}return!0},cb=3e4;class nW extends XY{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Ka();this.getLocalState()!==null&&cb/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&cb<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&zh(this,r,"timeout")},h2(cb/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:Ka()});const l=[],c=[],u=[],f=[];e===null?f.push(n):s==null?e!=null&&l.push(n):(c.push(n),_u(s,e)||u.push(n)),(l.length>0||u.length>0||f.length>0)&&this.emit("change",[{added:l,updated:u,removed:f},"local"]),this.emit("update",[{added:l,updated:c,removed:f},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const zh=(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:Ka()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},Nx=(t,e,n=t.states)=>{const r=e.length,i=xv();_n(i,r);for(let s=0;s<r;s++){const l=e[s],c=n.get(l)||null,u=t.meta.get(l).clock;_n(i,l),_n(i,u),ds(i,JSON.stringify(c))}return vv(i)},rW=(t,e,n)=>{const r=x2(e),i=Ka(),s=[],l=[],c=[],u=[],f=tl(r);for(let h=0;h<f;h++){const m=tl(r);let g=tl(r);const b=JSON.parse(dd(r)),v=t.meta.get(m),k=t.states.get(m),C=v===void 0?0:v.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}),v===void 0&&b!==null?s.push(m):v!==void 0&&b===null?u.push(m):b!==null&&(_u(b,k)||c.push(m),l.push(m)))}(s.length>0||c.length>0||u.length>0)&&t.emit("change",[{added:s,updated:c,removed:u},n]),(s.length>0||l.length>0||u.length>0)&&t.emit("update",[{added:s,updated:l,removed:u},n])};class v2{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 zx{constructor(e){this.data=e,this.encoder=xv(),this.decoder=x2(new Uint8Array(this.data))}peekVarString(){return ZY(this.decoder)}readVarUint(){return tl(this.decoder)}readVarString(){return dd(this.decoder)}readVarUint8Array(){return Nm(this.decoder)}writeVarUint(e){return _n(this.encoder,e)}writeVarString(e){return ds(this.encoder,e)}writeVarUint8Array(e){return rc(this.encoder,e)}length(){return m2(this.encoder)}}var kn;(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"})(kn||(kn={}));var Hn;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(Hn||(Hn={}));class bl{constructor(){this.encoder=xv()}get(e){return e.encoder}toUint8Array(){return vv(this.encoder)}}class iW extends bl{constructor(){super(...arguments),this.type=kn.CLOSE,this.description="Ask the server to close the connection"}get(e){return ds(this.encoder,e.documentName),_n(this.encoder,this.type),this.encoder}}class sW extends v2{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=Hn.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=Hn.Connected,this.emit("status",{status:Hn.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===Hn.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===Hn.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(iW,{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===Hn.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:_Y(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=f=>this.emit("message",f),s=f=>this.emit("close",{event:f}),l=f=>this.emit("open",f),c=f=>{n(f)};this.webSocketHandlers[r]={message:i,close:s,open:l,error:c};const u=this.webSocketHandlers[e.identifier];Object.keys(u).forEach(f=>{e.addEventListener(f,u[f])})}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=Hn.Connecting,this.emit("status",{status:Hn.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=Ka();const i=new zx(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=Hn.Connected,this.emit("status",{status:Hn.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===Hn.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=Ka()-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)===Dx.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=Hn.Disconnected,this.emit("status",{status:Hn.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 S2=0,Sv=1,w2=2,oW=(t,e)=>{_n(t,S2);const n=f5(e);rc(t,n)},lW=(t,e,n)=>{_n(t,Sv),rc(t,a5(e,n))},aW=(t,e,n)=>lW(e,n,Nm(t)),k2=(t,e,n)=>{try{s5(e,Nm(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},cW=(t,e)=>{_n(t,w2),rc(t,e)},uW=k2,dW=(t,e,n,r)=>{const i=tl(t);switch(i){case S2:aW(t,e,n);break;case Sv:k2(t,n,r);break;case w2:uW(t,n,r);break;default:throw new Error("Unknown message type")}return i};class fW{constructor(e){this.message=e}apply(e,n){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case kn.Sync:this.applySyncMessage(e,n);break;case kn.Awareness:this.applyAwarenessMessage(e);break;case kn.Auth:this.applyAuthMessage(e);break;case kn.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case kn.Stateless:e.receiveStateless(dd(r.decoder));break;case kn.SyncStatus:this.applySyncStatusMessage(e,YY(r.decoder)===1);break;case kn.CLOSE:const l={code:1e3,reason:dd(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(bl,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(kn.Sync);const i=dW(r.decoder,r.encoder,e.document,e);n&&i===Sv&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;rW(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;AY(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(kn.Awareness),n.writeVarUint8Array(Nx(e.awareness,Array.from(e.awareness.getStates().keys())))}}class hW{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return vv(this.encoder)}send(e){e==null||e.send(this.create())}}class pW extends bl{constructor(){super(...arguments),this.type=kn.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return ds(this.encoder,e.documentName),_n(this.encoder,this.type),TY(this.encoder,e.token),this.encoder}}class hM extends bl{constructor(){super(...arguments),this.type=kn.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");ds(this.encoder,e.documentName),_n(this.encoder,this.type);let n;return e.states===void 0?n=Nx(e.awareness,e.clients):n=Nx(e.awareness,e.clients,e.states),rc(this.encoder,n),this.encoder}}class mW extends bl{constructor(){super(...arguments),this.type=kn.Stateless,this.description="A stateless message"}get(e){var n;return ds(this.encoder,e.documentName),_n(this.encoder,this.type),ds(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class pM extends bl{constructor(){super(...arguments),this.type=kn.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 ds(this.encoder,e.documentName),_n(this.encoder,this.type),oW(this.encoder,e.document),this.encoder}}class gW extends bl{constructor(){super(...arguments),this.type=kn.Sync,this.description="A document update"}get(e){return ds(this.encoder,e.documentName),_n(this.encoder,this.type),cW(this.encoder,e.update),this.encoder}}class yW extends Error{constructor(){super(...arguments),this.code=1001}}class mM extends v2{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 Ti,this.configuration.awareness=e.awareness!==void 0?e.awareness:new nW(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:uM(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:uM(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 sW(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(pM,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&zh(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(mW,{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(pW,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(gW,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(hM,{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(pM,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(hM,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new hW(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new zx(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new zx(e.data)}),new fW(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&zh(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&&(zh(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 yW(`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 bW(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function xW(){var O;const[t,e]=M.useState([]),[n,r]=M.useState(null),[i,s]=M.useState(!1),[l,c]=M.useState("connecting"),[u,f]=M.useState(0),[h,m]=M.useState(null),[g,b]=M.useState([]),[v,k]=M.useState(null),[C,E]=M.useState(!1),[j,N]=M.useState(!1),[q,H]=M.useState(!1),[R,I]=M.useState(!1),Q=M.useRef(null),W=M.useRef(!1),oe=M.useRef(null),ne=M.useRef(null),se=M.useRef([]);se.current=t;const be=M.useRef(new Set),ae=M.useRef(new Map);for(const _ of t)be.current.delete(_.id),ae.current.delete(_.id);const V=M.useRef(new Map),z=M.useRef(new Map),Y=M.useRef(void 0),pe=M.useCallback(_=>{const{ydoc:B}=_,A=B.getMap(Oa),re=()=>{const Ot=[];A.forEach(pt=>{Ot.push(qu(pt))}),b(Ot)};A.observe(re),re();const Z=B.getMap(SM);let ie=null,me=!1;const Ae=()=>{const Ot=Z.get("claude"),pt=(Ot==null?void 0:Ot.status)??null,jn=(Ot==null?void 0:Ot.active)??!1;pt!==ie&&(ie=pt,k(pt)),jn!==me&&(me=jn,E(jn))};Z.observe(Ae),Ae();const ge=B.getMap(yh);let Le=!1;const ke=Ot=>{if(!Ot.keysChanged.has("readOnly"))return;const pt=ge.get("readOnly")===!0;pt!==Le&&(Le=pt,N(pt))};ge.observe(ke);const xt=ge.get("readOnly")===!0;return xt!==Le&&(Le=xt,N(xt)),()=>{A.unobserve(re),Z.unobserve(Ae),ge.unobserve(ke)}},[]);Y.current=(_,B)=>{var ge,Le;const A=se.current,re=new Set(A.map(ke=>ke.id)),Z=new Set(_.map(ke=>ke.id));for(const[ke,xt]of ae.current)Z.has(ke)||((ge=z.current.get(ke))==null||ge(),z.current.delete(ke),xt.provider.destroy(),xt.ydoc.destroy(),ae.current.delete(ke),be.current.delete(ke));const ie=bW(_,re,be.current),me=[];for(const ke of ie){be.current.add(ke.id);const xt=new Ti,Ot=new mM({url:`ws://localhost:${MC}`,name:ke.id,document:xt});ae.current.set(ke.id,{ydoc:xt,provider:Ot});const pt=xt.getMap(yh),jn=kr=>{var or;if(!kr.keysChanged.has("openDocuments")&&!kr.keysChanged.has("activeDocumentId"))return;const In=pt.get("openDocuments"),hs=pt.get("activeDocumentId");In&&((or=Y.current)==null||or.call(Y,In,hs??null))};pt.observe(jn),z.current.set(ke.id,()=>pt.unobserve(jn)),me.push({...ke,ydoc:xt,provider:Ot})}const Ae=A.filter(ke=>!Z.has(ke.id));for(const ke of Ae){const xt=V.current.get(ke.id);xt&&(xt.cleanup(),V.current.delete(ke.id)),(Le=z.current.get(ke.id))==null||Le(),z.current.delete(ke.id),be.current.delete(ke.id),ae.current.delete(ke.id),ke.provider.destroy(),ke.ydoc.destroy()}e(ke=>[...ke.filter(Ot=>Z.has(Ot.id)),...me]),B!==null&&r(ke=>ke===null||!Z.has(ke)?B:Ae.length>0&&B===ke?ke:B)},M.useEffect(()=>{const _=new Ti,B=new mM({url:`ws://localhost:${MC}`,name:oL,document:_});return oe.current={ydoc:_,provider:B},B.on("status",({status:A})=>{s(A==="connected"),c(A),A==="connected"?(W.current=!0,f(0),m(null)):A==="disconnected"?m(re=>re??Date.now()):A==="connecting"&&(W.current&&f(re=>re+1),m(re=>re??Date.now()))}),H(!0),()=>{B.destroy(),_.destroy(),oe.current=null}},[]),M.useEffect(()=>{var ie;if(!oe.current)return;const _=oe.current.ydoc.getMap(yh),B=me=>{var Ae;if(me.keysChanged.has("generationId")){const ge=_.get("generationId");ge&&ne.current&&ge!==ne.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),I(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>I(!1),5e3)),ge&&(ne.current=ge)}if(me.keysChanged.has("openDocuments")||me.keysChanged.has("activeDocumentId")){const ge=_.get("openDocuments"),Le=_.get("activeDocumentId");ge&&((Ae=Y.current)==null||Ae.call(Y,ge,Le??null))}};_.observe(B);const A=_.get("generationId");A&&(ne.current=A);const re=_.get("openDocuments"),Z=_.get("activeDocumentId");return re&&((ie=Y.current)==null||ie.call(Y,re,Z??null)),()=>{_.unobserve(B),Q.current&&clearTimeout(Q.current)}},[]),M.useEffect(()=>{for(const B of V.current.values())B.cleanup();V.current.clear();const _=se.current.find(B=>B.id===n);if(_){const B=pe(_);V.current.set(_.id,{cleanup:B})}else b([]),k(null),E(!1),N(!1)},[n,pe]);const _e=M.useCallback(_=>{r(B=>{if(B!==_)return B;const A=se.current,re=A.findIndex(ie=>ie.id===_),Z=A.filter(ie=>ie.id!==_);return Z.length===0?null:Z[Math.min(re,Z.length-1)].id}),fetch(`http://localhost:${fd}/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:_e,connected:i,connectionStatus:l,reconnectAttempts:u,disconnectedSince:h,annotations:g,claudeStatus:v,claudeActive:C,readOnly:j,bootstrapYdoc:((O=oe.current)==null?void 0:O.ydoc)??null,ready:q,serverRestarted:R}}function vW({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return S.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:S.jsxs("div",{style:{background:"var(--tandem-surface)",borderRadius:"12px",padding:"32px 40px",maxWidth:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)",textAlign:"center"},onClick:s=>s.stopPropagation(),children:[S.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),S.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"var(--tandem-fg)"},children:"Review Complete"}),S.jsx("p",{style:{margin:"0 0 20px",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"All annotations have been resolved."}),S.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[S.jsxs("div",{children:[S.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-success)"},children:t}),S.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accepted"})]}),S.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),S.jsxs("div",{children:[S.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-error)"},children:e}),S.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Dismissed"})]}),S.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),S.jsxs("div",{children:[S.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-accent)"},children:[i,"%"]}),S.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accept rate"})]})]}),S.jsx("button",{onClick:r,style:{padding:"8px 24px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer"},children:"Done"})]})})}const SW=2e3;function wW({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:l,documentCount:c=0,saving:u=!1}){const{userName:f,setUserName:h}=$_(),[m,g]=M.useState(f),b=M.useRef(null),v=()=>{h(m)};M.useEffect(()=>{m!==f&&document.activeElement!==b.current&&g(f)},[f,m]);const[k,C]=M.useState(!1),[E,j]=M.useState(0),N=M.useRef(t);M.useEffect(()=>{const I=N.current;if(N.current=t,t&&!I){C(!0);const Q=setTimeout(()=>C(!1),SW);return()=>clearTimeout(Q)}},[t]),M.useEffect(()=>{if(r==null){j(0);return}j(Math.floor((Date.now()-r)/1e3));const I=setInterval(()=>{j(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(I)},[r]);const q=e==="connecting",H=t?"var(--tandem-success)":q?"var(--tandem-warning)":"var(--tandem-error)";let R;if(k)R="Reconnected";else if(e==="connected")R="Connected";else if(e==="connecting"){const I=["Reconnecting…"];if(n>0||E>0){const Q=[];n>0&&Q.push(`attempt ${n}`),E>0&&Q.push(`${E}s`),I.push(`(${Q.join(", ")})`)}R=I.join(" ")}else R="Disconnected — check that the server is running";return S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 16px",height:"28px",borderTop:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",fontSize:"12px",color:"var(--tandem-fg-muted)",userSelect:"none"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:H,display:"inline-block",animation:q?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),S.jsx("span",{children:R}),c>0&&S.jsxs("span",{style:{color:"var(--tandem-fg-subtle)"},children:[c," doc",c!==1?"s":""," open"]}),u&&S.jsx("span",{"data-testid":"save-indicator",style:{color:"var(--tandem-accent)",fontStyle:"italic"},children:"Saving..."})]}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[S.jsx("span",{children:"You:"}),S.jsx("input",{ref:b,"data-testid":"user-name-input",type:"text",value:m,onChange:I=>g(I.target.value),onBlur:v,onKeyDown:I=>{I.key==="Enter"&&I.currentTarget.blur(),I.key==="Escape"&&(g(f),I.currentTarget.blur())},"aria-label":"Display name",title:"Your display name",maxLength:CM,style:{background:"transparent",border:"none",borderBottom:"1px solid var(--tandem-border)",color:"var(--tandem-fg-muted)",fontSize:"11px",width:"80px",outline:"none",padding:"0 2px"}})]}),l&&S.jsx("span",{style:{padding:"1px 8px",fontSize:"11px",fontWeight:600,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",borderRadius:"9999px",border:"1px solid var(--tandem-warning-border)"},children:"Review Only"}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--tandem-author-claude)",opacity:s?1:.4,display:"inline-block",transition:"opacity 0.3s ease",animation:s?"tandem-status-pulse 1.5s ease-in-out infinite":"none"}}),S.jsx("span",{style:{transition:"color 0.3s ease",color:s?"var(--tandem-fg)":"var(--tandem-fg-subtle)"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),S.jsx("style",{children:`
217
+ @keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
218
+ @keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
219
+ `})]})}function C2(t,e,n=uL){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function E2(){try{const t=localStorage.getItem(Ix);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 T2(t){try{localStorage.setItem(Ix,JSON.stringify(t))}catch(e){console.warn("[tandem] failed to save recent files:",e)}}function kW(){try{localStorage.removeItem(Ix)}catch(t){console.warn("[tandem] failed to clear recent files:",t)}}function CW({onClose:t}){const[e,n]=M.useState("path"),[r,i]=M.useState(""),[s,l]=M.useState(null),[c,u]=M.useState(!1),[f,h]=M.useState(!1),m=M.useRef(null),[g,b]=M.useState(E2),v=M.useCallback(H=>{b(R=>{const I=C2(R,H);return T2(I),I})},[]),k=M.useCallback(()=>{kW(),b([])},[]),C=M.useCallback(async H=>{if(!c){l(null),u(!0);try{const R=await fetch(`${cs}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:H})}),I=await R.json();if(!R.ok){l(I.message??"Failed to open file");return}v(H),t()}catch(R){console.error("FileOpenDialog: path open failed",R),R instanceof SyntaxError?l("Server returned an unexpected response"):R instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{u(!1)}}},[c,t,v]),E=M.useCallback(()=>{r.trim()&&C(r.trim())},[r,C]),j=M.useCallback(async H=>{if(!c){l(null),u(!0);try{const R=await H_(H),I=await fetch(`${cs}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:H.name,content:R})}),Q=await I.json();if(!I.ok){l(Q.message??"Failed to upload file");return}t()}catch(R){console.error("FileOpenDialog: upload failed",R),R instanceof SyntaxError?l("Server returned an unexpected response"):R instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{u(!1)}}},[c,t]),N=M.useCallback(H=>{H.preventDefault(),h(!1);const R=H.dataTransfer.files[0];R&&j(R)},[j]),q=M.useCallback(H=>{var I;const R=(I=H.target.files)==null?void 0:I[0];R&&j(R)},[j]);return S.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:H=>{H.target===H.currentTarget&&t()},onKeyDown:H=>{H.key==="Escape"&&t()},children:S.jsxs("div",{style:{background:"var(--tandem-surface)",borderRadius:"8px",boxShadow:"0 8px 30px rgba(0,0,0,0.15)",width:"440px",padding:"20px"},"data-testid":"file-open-dialog",children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[S.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"var(--tandem-fg)"},children:"Open File"}),S.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"var(--tandem-fg-subtle)"},children:"×"})]}),S.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[S.jsx("button",{onClick:()=>n("path"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"4px",cursor:"pointer",background:e==="path"?"var(--tandem-accent)":"var(--tandem-surface)",color:e==="path"?"var(--tandem-accent-fg)":"var(--tandem-fg)"},children:"File Path"}),S.jsx("button",{onClick:()=>n("upload"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"4px",cursor:"pointer",background:e==="upload"?"var(--tandem-accent)":"var(--tandem-surface)",color:e==="upload"?"var(--tandem-accent-fg)":"var(--tandem-fg)"},children:"Upload"})]}),e==="path"?S.jsxs("div",{children:[S.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:H=>i(H.target.value),onKeyDown:H=>{H.key==="Enter"&&E()},style:{width:"100%",padding:"8px 10px",fontSize:"13px",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",boxSizing:"border-box",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},"data-testid":"file-path-input"}),S.jsx("button",{onClick:E,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?"var(--tandem-fg-subtle)":"var(--tandem-accent)",color:"var(--tandem-accent-fg)",opacity:r.trim()?1:.5},"data-testid":"file-open-submit",children:c?"Opening...":"Open"}),g.length>0&&S.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[S.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),S.jsx("button",{"data-testid":"clear-recent-files",onClick:k,type:"button",style:{background:"none",border:"none",color:"var(--tandem-fg-subtle)",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),S.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:g.map((H,R)=>{const I=H.split(/[/\\]/),Q=I.pop()??H,W=I.join("/")||"/";return S.jsxs("button",{type:"button","data-testid":`recent-file-${R}`,onClick:()=>{i(H),C(H)},style:{background:"none",border:"none",padding:"6px 8px",borderRadius:"4px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"1px"},onMouseEnter:oe=>{oe.currentTarget.style.background="var(--tandem-surface-muted)"},onMouseLeave:oe=>{oe.currentTarget.style.background="transparent"},children:[S.jsx("span",{style:{fontSize:"13px",color:"var(--tandem-fg)"},children:Q}),S.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:W})]},H)})})]})]}):S.jsxs("div",{onDragOver:H=>{H.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:N,onClick:()=>{var H;return(H=m.current)==null?void 0:H.click()},style:{border:`2px dashed ${f?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"6px",padding:"32px 16px",textAlign:"center",cursor:c?"wait":"pointer",background:f?"var(--tandem-accent-bg)":"var(--tandem-surface-muted)",transition:"border-color 0.15s, background 0.15s"},"data-testid":"file-upload-zone",children:[S.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:q,style:{display:"none"}}),S.jsx("div",{style:{fontSize:"13px",color:"var(--tandem-fg-muted)"},children:c?"Uploading...":"Drop a file here or click to browse"}),S.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&S.jsx("div",{style:{marginTop:"10px",padding:"8px 10px",fontSize:"12px",color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",borderRadius:"4px",border:"1px solid var(--tandem-error-border)"},"data-testid":"file-open-error",children:s})]})})}function EW(t){const[e,n]=M.useState(!1),r=M.useRef(0),i=M.useRef(null);return M.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,l=s.getXmlFragment("default"),c=s.getMap(yh);let u=!1;const f=setTimeout(()=>{u=!0,i.current=c.get(DC)??0,r.current=0,n(!1)},500),h=()=>{u&&(r.current++,n(!0))};l.observeDeep(h);const m=()=>{if(!u)return;const g=c.get(DC);g!==void 0&&g!==i.current&&(i.current=g,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(f),l.unobserveDeep(h),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const TW={md:"M",txt:"T",html:"H",docx:"W"};function AW({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:l,onDrop:c,onDragEnd:u,onDragLeave:f,dropIndicator:h,onKeyDown:m}){const g=EW(t);return S.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:u,onDragLeave:f,onKeyDown:b=>m(b,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"var(--tandem-surface)":"transparent",color:e?"var(--tandem-fg)":"var(--tandem-fg-muted)",borderTop:e?"2px solid var(--tandem-accent)":"2px solid transparent",borderBottom:e?"1px solid var(--tandem-surface)":"1px solid transparent",borderLeft:h==="left"?"2px solid var(--tandem-accent)":"2px solid transparent",borderRight:h==="right"?"2px solid var(--tandem-accent)":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[g&&S.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"var(--tandem-warning)",fontSize:"10px"},children:"●"}),S.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"var(--tandem-accent)":"var(--tandem-fg-subtle)",width:"14px",textAlign:"center"},children:TW[t.format]||"?"}),S.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&&S.jsx("span",{style:{fontSize:"9px",color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",padding:"0 3px",borderRadius:"2px"},children:"RO"}),S.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:"var(--tandem-fg-subtle)",padding:"0 2px",borderRadius:"2px"},onMouseEnter:b=>b.currentTarget.style.color="var(--tandem-error)",onMouseLeave:b=>b.currentTarget.style.color="var(--tandem-fg-subtle)",title:"Close document",children:"×"})]})}const Lx="tandem-tab-scroll-hide";function MW(){return S.jsx("style",{children:`
220
+ .${Lx} {
221
+ scrollbar-width: none;
222
+ -ms-overflow-style: none;
223
+ }
224
+ .${Lx}::-webkit-scrollbar {
225
+ display: none;
226
+ }
227
+ `})}const A2={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",minWidth:"28px",background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",border:"none",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg-muted)",padding:0,zIndex:1},OW={...A2,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)"};function _W({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i,reduceMotion:s}){const l=s?"auto":"smooth",[c,u]=M.useState(!1),f=M.useRef(new Set);M.useEffect(()=>{const V=new Set(t.map(z=>z.id));for(const z of f.current)V.has(z)||f.current.delete(z)},[t]);const h=M.useCallback(V=>{f.current.has(V)||(f.current.add(V),r(V))},[r]),m=M.useRef(null),[g,b]=M.useState(!1),[v,k]=M.useState(!1),[C,E]=M.useState(null),[j,N]=M.useState(null);function q(){E(null),N(null)}const H=M.useCallback(()=>{const V=m.current;V&&(b(V.scrollLeft>0),k(V.scrollLeft+V.clientWidth<V.scrollWidth-1))},[]);M.useEffect(()=>{const V=m.current;if(!V)return;H(),V.addEventListener("scroll",H,{passive:!0});const z=new ResizeObserver(H);return z.observe(V),()=>{V.removeEventListener("scroll",H),z.disconnect()}},[H]),M.useEffect(()=>{H()},[t.length,H]),M.useEffect(()=>{if(!e||!m.current)return;const V=m.current.querySelector(`[data-testid="tab-${e}"]`);V&&V.scrollIntoView({inline:"nearest",block:"nearest",behavior:l})},[e,l]),M.useEffect(()=>{q()},[t.length]);const R=M.useCallback((V,z)=>{E(z),V.dataTransfer.setData("text/plain",z),V.dataTransfer.effectAllowed="move"},[]),I=M.useCallback((V,z)=>{if(V.preventDefault(),!C||C===z){N(null);return}const Y=V.currentTarget.getBoundingClientRect(),pe=Y.left+Y.width/2,_e=V.clientX<pe?"left":"right";N({id:z,side:_e})},[C]),Q=M.useCallback((V,z)=>{V.preventDefault();const Y=V.dataTransfer.getData("text/plain");if(Y&&Y!==z&&i){const pe=V.currentTarget.getBoundingClientRect(),_e=pe.left+pe.width/2,O=V.clientX<_e?"left":"right";i(Y,z,O)}q()},[i]),W=M.useCallback(()=>{q()},[]),oe=M.useCallback(()=>{N(null)},[]),ne=M.useCallback((V,z)=>{if(!V.altKey||!i||V.key!=="ArrowLeft"&&V.key!=="ArrowRight")return;V.preventDefault();const Y=t.findIndex(pe=>pe.id===z);Y!==-1&&(V.key==="ArrowLeft"&&Y>0?i(z,t[Y-1].id):V.key==="ArrowRight"&&Y<t.length-1&&i(t[Y+1].id,z))},[t,i]),se=M.useCallback(()=>{var V;(V=m.current)==null||V.scrollBy({left:-150,behavior:l})},[l]),be=M.useCallback(()=>{var V;(V=m.current)==null||V.scrollBy({left:150,behavior:l})},[l]),ae=t.length<=1;return S.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"var(--tandem-surface-muted)",borderBottom:"1px solid var(--tandem-border)",minHeight:"32px"},children:[S.jsx(MW,{}),g&&S.jsx("button",{"data-testid":"tab-scroll-left",onClick:se,style:{...A2,background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs left",children:"◀"}),S.jsx("div",{ref:m,"data-testid":"tab-scroll-container",className:Lx,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",overflowY:"hidden",padding:"0 4px"},children:t.map(V=>S.jsx(AW,{tab:V,isActive:V.id===e,onSwitch:n,onClose:h,draggable:!ae,onDragStart:R,onDragOver:I,onDrop:Q,onDragEnd:W,onDragLeave:oe,dropIndicator:(j==null?void 0:j.id)===V.id?j.side:null,onKeyDown:ne},V.id))}),v&&S.jsx("button",{"data-testid":"tab-scroll-right",onClick:be,style:{...OW,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs right",children:"▶"}),S.jsx("button",{onClick:()=>u(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"var(--tandem-fg-muted)",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:V=>{V.currentTarget.style.color="var(--tandem-accent)",V.currentTarget.style.borderColor="var(--tandem-accent)"},onMouseLeave:V=>{V.currentTarget.style.color="var(--tandem-fg-muted)",V.currentTarget.style.borderColor="var(--tandem-border-strong)"},children:"+"}),c&&S.jsx(CW,{onClose:()=>u(!1)})]})}function mh({side:t,onMouseDown:e,testId:n}){const r=n??`${t}-panel-resize-handle`,i=t==="left"?"Resize left panel":"Resize right panel";return S.jsx("div",{"data-testid":r,role:"separator","aria-orientation":"vertical","aria-label":i,tabIndex:0,onMouseDown:e,style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:s=>{s.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"}})}function gM({width:t,borderSide:e,showChat:n,pendingAnnotationBadge:r,onShowAnnotations:i,onShowChat:s,onChatMouseDown:l,chatPanelProps:c,sidePanelProps:u}){const f=e==="left"?{borderRight:"1px solid var(--tandem-border)"}:{borderLeft:"1px solid var(--tandem-border)"};return S.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${t}px`,...f},children:[S.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)"},children:[S.jsxs("button",{"data-testid":"annotations-tab",onClick:i,style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:n?400:600,border:"none",borderBottom:n?"none":"2px solid var(--tandem-accent)",background:"transparent",cursor:"pointer",color:n?"var(--tandem-fg-muted)":"var(--tandem-accent)",position:"relative"},children:["Annotations",n&&r>0&&S.jsx("span",{style:{position:"absolute",top:"2px",right:"6px",background:"var(--tandem-error)",color:"var(--tandem-error-fg)",fontSize:"9px",width:"16px",height:"16px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700},children:r>9?"9+":r})]}),S.jsx("button",{"data-testid":"chat-tab",onMouseDown:l,onClick:s,style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:n?600:400,border:"none",borderBottom:n?"2px solid var(--tandem-accent)":"none",background:"transparent",cursor:"pointer",color:n?"var(--tandem-accent)":"var(--tandem-fg-muted)",position:"relative"},children:"Chat"})]}),S.jsx(jb,{...c,visible:n}),S.jsx(Ib,{...u,visible:!n})]})}function DW(){oY();const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,annotations:u,claudeStatus:f,claudeActive:h,readOnly:m,bootstrapYdoc:g,ready:b,serverRestarted:v}=xW(),{orderedTabs:k,reorder:C}=wK(t);vK(k,e,n),M.useEffect(()=>{if(t.length!==0)try{const ve=E2();let mt=ve;for(const gn of t)Qz(gn.filePath)||(mt=C2(mt,gn.filePath));(mt.length!==ve.length||mt.some((gn,Gr)=>gn!==ve[Gr]))&&T2(mt)}catch(ve){console.warn("[tandem] failed to sync recent files:",ve)}},[t.length]);const{settings:E,updateSettings:j}=eY(),{tandemMode:N,setTandemMode:q}=ZK(g,E.selectionDwellMs),{visibleAnnotations:H,heldCount:R}=hK(u,N),{showBanner:I,dismiss:Q}=cK(c),W=M.useMemo(()=>t.map(ve=>({id:ve.id,fileName:ve.fileName})),[t]),{saving:oe}=gK(e),{toasts:ne,dismiss:se}=pK(),{fileDragOver:be,handleEditorDragOver:ae,handleEditorDragLeave:V,handleEditorDrop:z}=dK(),{showReviewSummary:Y,reviewSummaryData:pe,dismissReviewSummary:_e}=mK(u),[O,_]=M.useState(!1),B=M.useRef(null),A=M.useCallback(()=>{_(!0)},[]),re=M.useRef(O);re.current=O;const Z=M.useCallback(()=>{if(re.current){_(!1);return}A()},[A]);bK(Z),M.useEffect(()=>{const ve=In.current;if(!ve)return;const mt=ve.state.tr.setMeta(fa,{type:"toggle",visible:E.showAuthorship});ve.view.dispatch(mt)},[E.showAuthorship]),M.useEffect(()=>(document.body.classList.toggle("tandem-reduce-motion",E.reduceMotion),()=>document.body.classList.remove("tandem-reduce-motion")),[E.reduceMotion]),rY(E.theme),M.useEffect(()=>{const ve=JK[E.textSize];return document.documentElement.style.setProperty("--tandem-editor-font-size",`${ve}px`),()=>{document.documentElement.style.removeProperty("--tandem-editor-font-size")}},[E.textSize]);const[ie,me]=M.useState(!1),[Ae,ge]=M.useState(()=>E.primaryTab==="chat"),Le=M.useMemo(()=>Ae?H.filter(ve=>ve.status==="pending").length:0,[H,Ae]),[ke,xt]=M.useState(null),[Ot,pt]=M.useState(!1),[jn,kr]=M.useState(null),In=M.useRef(null),hs=M.useRef(null),or=M.useCallback(ve=>{In.current=ve},[]),ai=M.useCallback(ve=>{ge(!1),xt(ve)},[]),[lr,xl]=M.useState(()=>E.layout==="three-panel"?{kind:"three-panel",left:Ps("left"),right:Ps("right")}:E.layout==="tabbed-left"?{kind:"tabbed-left",left:Ps("left")}:{kind:"tabbed",right:Ps("right")});M.useEffect(()=>{xl(ve=>{if(E.layout==="three-panel"){if(ve.kind==="three-panel")return ve;const gn="right"in ve?ve.right:Ps("right");return{kind:"three-panel",left:"left"in ve?ve.left:Ps("left"),right:gn}}return E.layout==="tabbed-left"?ve.kind==="tabbed-left"?ve:{kind:"tabbed-left",left:"left"in ve?ve.left:Ps("left")}:ve.kind==="tabbed"?ve:{kind:"tabbed",right:"right"in ve?ve.right:Ps("right")}})},[E.layout]);const xo=E.editorWidthPercent<100?`${E.editorWidthPercent}%`:void 0,Jt=E.editorWidthPercent<100?"0 auto":void 0,{handleResizeStart:ps}=uK({panelLayout:lr,setPanelLayout:xl}),J=M.useCallback(()=>{me(ve=>!ve)},[]),fe=M.useCallback(()=>{me(!1)},[]),De=M.useCallback(()=>{if(Ae)return;const ve=In.current;if(!ve)return;const{from:mt,to:gn}=ve.state.selection;if(mt===gn)return;const Gr=U_(ve.state.doc,{from:Sr(mt),to:Sr(gn)}),ms=ve.state.doc.textBetween(mt,gn,`
228
+ `);kr({...Gr,textSnapshot:ms.length>200?ms.slice(0,197)+"...":ms})},[Ae]);M.useEffect(()=>{const ve=mt=>{if(mt.key!=="?")return;const gn=mt.target;gn.tagName==="INPUT"||gn.tagName==="TEXTAREA"||gn.isContentEditable||pt(Gr=>!Gr)};return window.addEventListener("keydown",ve),()=>window.removeEventListener("keydown",ve)},[]);const ce=t.find(ve=>ve.id===e),{tutorialActive:tt,currentStep:Bn,dismissTutorial:Wr,nextStep:mn,coworkStatus:Bt}=sY(u,In,ce==null?void 0:ce.fileName),Xt={annotations:H,editor:In.current,ydoc:(ce==null?void 0:ce.ydoc)??null,heldCount:R,tandemMode:N,onModeChange:q,activeDocFormat:ce==null?void 0:ce.format,documentId:ce==null?void 0:ce.id,reviewMode:ie,onToggleReviewMode:J,onExitReviewMode:fe,activeAnnotationId:ke,onActiveAnnotationChange:xt,reduceMotion:E.reduceMotion},nt={ctrlYdoc:g,editor:In.current,activeDocId:e,openDocs:W,claudeActive:h,claudeStatus:f,capturedAnchor:jn,onCapturedAnchorChange:kr,inputRef:hs,reduceMotion:E.reduceMotion};return b?S.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[v&&S.jsx("div",{style:{padding:"8px 16px",background:"var(--tandem-warning-bg)",borderBottom:"1px solid var(--tandem-warning-border)",fontSize:"13px",color:"var(--tandem-warning-fg-strong)",textAlign:"center"},children:"Server restarted — refreshing documents"}),I&&S.jsx(eL,{onDismiss:Q}),S.jsx(aK,{editor:In.current,ydoc:(ce==null?void 0:ce.ydoc)??null,onSettingsOpen:Z,settingsBtnRef:B,tandemMode:N,onModeChange:q,heldCount:R}),S.jsx(_W,{tabs:k,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:C,reduceMotion:E.reduceMotion}),lr.kind==="three-panel"?S.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[S.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${lr.left}px`,borderRight:"1px solid var(--tandem-border)"},children:[S.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"var(--tandem-fg-muted)",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:E.panelOrder==="chat-editor-annotations"?"Chat":"Annotations"}),S.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:E.panelOrder==="chat-editor-annotations"?S.jsx(jb,{...nt,visible:!0}):S.jsx(Ib,{...Xt})})]}),S.jsx(mh,{side:"left",onMouseDown:ve=>ps(ve,"left")}),S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:be?"2px dashed var(--tandem-accent)":"2px solid transparent",background:be?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ae,onDragLeave:V,onDrop:z,children:[S.jsx(A0,{visible:(ce==null?void 0:ce.readOnly)===!0&&(ce==null?void 0:ce.format)==="docx",documentId:ce==null?void 0:ce.id}),S.jsx("div",{style:{maxWidth:xo,margin:Jt},children:ce?S.jsx(sb,{ydoc:ce.ydoc,provider:ce.provider,readOnly:m,reviewMode:ie,activeAnnotationId:ke,onEditorReady:or,onAnnotationClick:ai},ce.id):S.jsx(Xy,{connected:i,claudeActive:h})})]}),S.jsx(mh,{side:"right",onMouseDown:ve=>ps(ve,"right")}),S.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Cx(lr)}px`,borderLeft:"1px solid var(--tandem-border)"},children:[S.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"var(--tandem-fg-muted)",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:E.panelOrder==="chat-editor-annotations"?"Annotations":"Chat"}),S.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:E.panelOrder==="chat-editor-annotations"?S.jsx(Ib,{...Xt}):S.jsx(jb,{...nt,visible:!0})})]})]}):lr.kind==="tabbed-left"?S.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[S.jsx(gM,{width:lr.left,borderSide:"left",showChat:Ae,pendingAnnotationBadge:Le,onShowAnnotations:()=>ge(!1),onShowChat:()=>ge(!0),onChatMouseDown:De,chatPanelProps:nt,sidePanelProps:Xt}),S.jsx(mh,{side:"left",onMouseDown:ve=>ps(ve,"left")}),S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:be?"2px dashed var(--tandem-accent)":"2px solid transparent",background:be?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ae,onDragLeave:V,onDrop:z,children:[S.jsx(A0,{visible:(ce==null?void 0:ce.readOnly)===!0&&(ce==null?void 0:ce.format)==="docx",documentId:ce==null?void 0:ce.id}),S.jsx("div",{style:{maxWidth:xo,margin:Jt},children:ce?S.jsx(sb,{ydoc:ce.ydoc,provider:ce.provider,readOnly:m,reviewMode:ie,activeAnnotationId:ke,onEditorReady:or,onAnnotationClick:ai},ce.id):S.jsx(Xy,{connected:i,claudeActive:h})})]})]}):S.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[S.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:be?"2px dashed var(--tandem-accent)":"2px solid transparent",background:be?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ae,onDragLeave:V,onDrop:z,children:[S.jsx(A0,{visible:(ce==null?void 0:ce.readOnly)===!0&&(ce==null?void 0:ce.format)==="docx",documentId:ce==null?void 0:ce.id}),S.jsx("div",{style:{maxWidth:xo,margin:Jt},children:ce?S.jsx(sb,{ydoc:ce.ydoc,provider:ce.provider,readOnly:m,reviewMode:ie,activeAnnotationId:ke,onEditorReady:or,onAnnotationClick:ai},ce.id):S.jsx(Xy,{connected:i,claudeActive:h})})]}),S.jsx(mh,{side:"right",onMouseDown:ve=>ps(ve,"right"),testId:"panel-resize-handle"}),S.jsx(gM,{width:Cx(lr),borderSide:"right",showChat:Ae,pendingAnnotationBadge:Le,onShowAnnotations:()=>ge(!1),onShowChat:()=>ge(!0),onChatMouseDown:De,chatPanelProps:nt,sidePanelProps:Xt})]}),S.jsx(wW,{connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,claudeStatus:f,claudeActive:h,readOnly:m,documentCount:t.length,saving:oe}),Y&&pe&&S.jsx(vW,{accepted:pe.accepted,dismissed:pe.dismissed,total:pe.total,onDismiss:_e}),S.jsx(YU,{open:O,onClose:()=>_(!1),settings:E,onUpdate:j,returnFocusRef:B,anchorRef:B}),S.jsx(CL,{open:Ot,onClose:()=>pt(!1)}),S.jsx(JU,{toasts:ne,onDismiss:se}),hd()&&S.jsx(wL,{}),tt&&S.jsx(AL,{currentStep:Bn,onNext:mn,onDismiss:Wr,coworkStatus:Bt})]}):S.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"var(--tandem-fg-subtle)"},children:"Connecting..."})}class RW extends on.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?S.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif",color:"var(--tandem-fg)"},children:[S.jsx("h2",{children:"Something went wrong"}),S.jsx("p",{style:{color:"var(--tandem-fg-muted)"},children:"The editor encountered an unexpected error. Reload the page to continue."}),S.jsx("pre",{style:{background:"var(--tandem-surface-muted)",padding:"1rem",borderRadius:"4px",fontSize:"12px",overflow:"auto",maxHeight:"200px",color:"var(--tandem-fg)",border:"1px solid var(--tandem-border)"},children:(e=this.state.error)==null?void 0:e.message}),S.jsx("button",{onClick:()=>window.location.reload(),style:{marginTop:"1rem",padding:"8px 16px",cursor:"pointer",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},children:"Reload"})]}):this.props.children}}const NW=Jz.createRoot(document.getElementById("root"));NW.render(S.jsx(on.StrictMode,{children:S.jsx(RW,{children:S.jsx(DW,{})})}));export{LW as C,VW as a,PW as b,DM as c,jW as d,UW as e,AM as f,IW as g,S as j,Hx as l,HW as m,M as r,RM as u,BW as w};