tandem-editor 0.2.12 → 0.3.1

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.
@@ -1,297 +0,0 @@
1
- var jN=Object.defineProperty;var UN=(t,e,n)=>e in t?jN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Md=(t,e,n)=>UN(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 o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).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 Lp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var My={exports:{}},jc={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Uk;function HN(){if(Uk)return jc;Uk=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+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:o,ref:i!==void 0?i:null,props:s}}return jc.Fragment=e,jc.jsx=n,jc.jsxs=n,jc}var Hk;function VN(){return Hk||(Hk=1,My.exports=HN()),My.exports}var T=VN(),Oy={exports:{}},ze={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Vk;function PN(){if(Vk)return ze;Vk=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"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(_){return _===null||typeof _!="object"?null:(_=y&&_[y]||_["@@iterator"],typeof _=="function"?_:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function C(_,H,A){this.props=_,this.context=H,this.refs=k,this.updater=A||S}C.prototype.isReactComponent={},C.prototype.setState=function(_,H){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,_,H,"setState")},C.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function U(){}U.prototype=C.prototype;function z(_,H,A){this.props=_,this.context=H,this.refs=k,this.updater=A||S}var re=z.prototype=new U;re.constructor=z,v(re,C.prototype),re.isPureReactComponent=!0;var F=Array.isArray;function O(){}var L={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function ce(_,H,A){var te=A.ref;return{$$typeof:t,type:_,key:H,ref:te!==void 0?te:null,props:A}}function ie(_,H){return ce(_.type,H,_.props)}function ue(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function G(_){var H={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(A){return H[A]})}var ee=/\/+/g;function ne(_,H){return typeof _=="object"&&_!==null&&_.key!=null?G(""+_.key):H.toString(36)}function Z(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(O,O):(_.status="pending",_.then(function(H){_.status==="pending"&&(_.status="fulfilled",_.value=H)},function(H){_.status==="pending"&&(_.status="rejected",_.reason=H)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function I(_,H,A,te,pe){var ge=typeof _;(ge==="undefined"||ge==="boolean")&&(_=null);var _e=!1;if(_===null)_e=!0;else switch(ge){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(_.$$typeof){case t:case e:_e=!0;break;case p:return _e=_._init,I(_e(_._payload),H,A,te,pe)}}if(_e)return pe=pe(_),_e=te===""?"."+ne(_,0):te,F(pe)?(A="",_e!=null&&(A=_e.replace(ee,"$&/")+"/"),I(pe,H,A,"",function(dt){return dt})):pe!=null&&(ue(pe)&&(pe=ie(pe,A+(pe.key==null||_&&_.key===pe.key?"":(""+pe.key).replace(ee,"$&/")+"/")+_e)),H.push(pe)),1;_e=0;var Ge=te===""?".":te+":";if(F(_))for(var qe=0;qe<_.length;qe++)te=_[qe],ge=Ge+ne(te,qe),_e+=I(te,H,A,ge,pe);else if(qe=b(_),typeof qe=="function")for(_=qe.call(_),qe=0;!(te=_.next()).done;)te=te.value,ge=Ge+ne(te,qe++),_e+=I(te,H,A,ge,pe);else if(ge==="object"){if(typeof _.then=="function")return I(Z(_),H,A,te,pe);throw H=String(_),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return _e}function Y(_,H,A){if(_==null)return _;var te=[],pe=0;return I(_,te,"","",function(ge){return H.call(A,ge,pe++)}),te}function me(_){if(_._status===-1){var H=_._result;H=H(),H.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=H)}if(_._status===1)return _._result.default;throw _._result}var de=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},M={map:Y,forEach:function(_,H,A){Y(_,function(){H.apply(this,arguments)},A)},count:function(_){var H=0;return Y(_,function(){H++}),H},toArray:function(_){return Y(_,function(H){return H})||[]},only:function(_){if(!ue(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return ze.Activity=m,ze.Children=M,ze.Component=C,ze.Fragment=n,ze.Profiler=i,ze.PureComponent=z,ze.StrictMode=r,ze.Suspense=f,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,ze.__COMPILER_RUNTIME={__proto__:null,c:function(_){return L.H.useMemoCache(_)}},ze.cache=function(_){return function(){return _.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(_,H,A){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var te=v({},_.props),pe=_.key;if(H!=null)for(ge in H.key!==void 0&&(pe=""+H.key),H)!J.call(H,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&H.ref===void 0||(te[ge]=H[ge]);var ge=arguments.length-2;if(ge===1)te.children=A;else if(1<ge){for(var _e=Array(ge),Ge=0;Ge<ge;Ge++)_e[Ge]=arguments[Ge+2];te.children=_e}return ce(_.type,pe,te)},ze.createContext=function(_){return _={$$typeof:o,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:s,_context:_},_},ze.createElement=function(_,H,A){var te,pe={},ge=null;if(H!=null)for(te in H.key!==void 0&&(ge=""+H.key),H)J.call(H,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(pe[te]=H[te]);var _e=arguments.length-2;if(_e===1)pe.children=A;else if(1<_e){for(var Ge=Array(_e),qe=0;qe<_e;qe++)Ge[qe]=arguments[qe+2];pe.children=Ge}if(_&&_.defaultProps)for(te in _e=_.defaultProps,_e)pe[te]===void 0&&(pe[te]=_e[te]);return ce(_,ge,pe)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(_){return{$$typeof:c,render:_}},ze.isValidElement=ue,ze.lazy=function(_){return{$$typeof:p,_payload:{_status:-1,_result:_},_init:me}},ze.memo=function(_,H){return{$$typeof:d,type:_,compare:H===void 0?null:H}},ze.startTransition=function(_){var H=L.T,A={};L.T=A;try{var te=_(),pe=L.S;pe!==null&&pe(A,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(O,de)}catch(ge){de(ge)}finally{H!==null&&A.types!==null&&(H.types=A.types),L.T=H}},ze.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},ze.use=function(_){return L.H.use(_)},ze.useActionState=function(_,H,A){return L.H.useActionState(_,H,A)},ze.useCallback=function(_,H){return L.H.useCallback(_,H)},ze.useContext=function(_){return L.H.useContext(_)},ze.useDebugValue=function(){},ze.useDeferredValue=function(_,H){return L.H.useDeferredValue(_,H)},ze.useEffect=function(_,H){return L.H.useEffect(_,H)},ze.useEffectEvent=function(_){return L.H.useEffectEvent(_)},ze.useId=function(){return L.H.useId()},ze.useImperativeHandle=function(_,H,A){return L.H.useImperativeHandle(_,H,A)},ze.useInsertionEffect=function(_,H){return L.H.useInsertionEffect(_,H)},ze.useLayoutEffect=function(_,H){return L.H.useLayoutEffect(_,H)},ze.useMemo=function(_,H){return L.H.useMemo(_,H)},ze.useOptimistic=function(_,H){return L.H.useOptimistic(_,H)},ze.useReducer=function(_,H,A){return L.H.useReducer(_,H,A)},ze.useRef=function(_){return L.H.useRef(_)},ze.useState=function(_){return L.H.useState(_)},ze.useSyncExternalStore=function(_,H,A){return L.H.useSyncExternalStore(_,H,A)},ze.useTransition=function(){return L.H.useTransition()},ze.version="19.2.4",ze}var Pk;function a1(){return Pk||(Pk=1,Oy.exports=PN()),Oy.exports}var R=a1();const an=Lp(R);var _y={exports:{}},Uc={},Dy={exports:{}},Ry={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var Fk;function FN(){return Fk||(Fk=1,(function(t){function e(I,Y){var me=I.length;I.push(Y);e:for(;0<me;){var de=me-1>>>1,M=I[de];if(0<i(M,Y))I[de]=Y,I[me]=M,me=de;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var Y=I[0],me=I.pop();if(me!==Y){I[0]=me;e:for(var de=0,M=I.length,_=M>>>1;de<_;){var H=2*(de+1)-1,A=I[H],te=H+1,pe=I[te];if(0>i(A,me))te<M&&0>i(pe,A)?(I[de]=pe,I[te]=me,de=te):(I[de]=A,I[H]=me,de=H);else if(te<M&&0>i(pe,me))I[de]=pe,I[te]=me,de=te;else break e}}return Y}function i(I,Y){var me=I.sortIndex-Y.sortIndex;return me!==0?me:I.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 o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var f=[],d=[],p=1,m=null,y=3,b=!1,S=!1,v=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function re(I){for(var Y=n(d);Y!==null;){if(Y.callback===null)r(d);else if(Y.startTime<=I)r(d),Y.sortIndex=Y.expirationTime,e(f,Y);else break;Y=n(d)}}function F(I){if(v=!1,re(I),!S)if(n(f)!==null)S=!0,O||(O=!0,G());else{var Y=n(d);Y!==null&&Z(F,Y.startTime-I)}}var O=!1,L=-1,J=5,ce=-1;function ie(){return k?!0:!(t.unstable_now()-ce<J)}function ue(){if(k=!1,O){var I=t.unstable_now();ce=I;var Y=!0;try{e:{S=!1,v&&(v=!1,U(L),L=-1),b=!0;var me=y;try{t:{for(re(I),m=n(f);m!==null&&!(m.expirationTime>I&&ie());){var de=m.callback;if(typeof de=="function"){m.callback=null,y=m.priorityLevel;var M=de(m.expirationTime<=I);if(I=t.unstable_now(),typeof M=="function"){m.callback=M,re(I),Y=!0;break t}m===n(f)&&r(f),re(I)}else r(f);m=n(f)}if(m!==null)Y=!0;else{var _=n(d);_!==null&&Z(F,_.startTime-I),Y=!1}}break e}finally{m=null,y=me,b=!1}Y=void 0}}finally{Y?G():O=!1}}}var G;if(typeof z=="function")G=function(){z(ue)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,ne=ee.port2;ee.port1.onmessage=ue,G=function(){ne.postMessage(null)}}else G=function(){C(ue,0)};function Z(I,Y){L=C(function(){I(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(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(I){switch(y){case 1:case 2:case 3:var Y=3;break;default:Y=y}var me=y;y=Y;try{return I()}finally{y=me}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(I,Y){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var me=y;y=I;try{return Y()}finally{y=me}},t.unstable_scheduleCallback=function(I,Y,me){var de=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?de+me:de):me=de,I){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=me+M,I={id:p++,callback:Y,priorityLevel:I,startTime:me,expirationTime:M,sortIndex:-1},me>de?(I.sortIndex=me,e(d,I),n(f)===null&&I===n(d)&&(v?(U(L),L=-1):v=!0,Z(F,me-de))):(I.sortIndex=M,e(f,I),S||b||(S=!0,O||(O=!0,G()))),I},t.unstable_shouldYield=ie,t.unstable_wrapCallback=function(I){var Y=y;return function(){var me=y;y=Y;try{return I.apply(this,arguments)}finally{y=me}}}})(Ry)),Ry}var $k;function $N(){return $k||($k=1,Dy.exports=FN()),Dy.exports}var Ny={exports:{}},_n={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var qk;function qN(){if(qk)return _n;qk=1;var t=a1();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,d,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:f,containerInfo:d,implementation:p}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return _n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,_n.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return s(f,d,null,p)},_n.flushSync=function(f){var d=o.T,p=r.p;try{if(o.T=null,r.p=2,f)return f()}finally{o.T=d,r.p=p,r.d.f()}},_n.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},_n.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},_n.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,m=c(p,d.crossOrigin),y=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):p==="script"&&r.d.X(f,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},_n.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},_n.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,m=c(p,d.crossOrigin);r.d.L(f,p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},_n.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=c(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},_n.requestFormReset=function(f){r.d.r(f)},_n.unstable_batchedUpdates=function(f,d){return f(d)},_n.useFormState=function(f,d,p){return o.H.useFormState(f,d,p)},_n.useFormStatus=function(){return o.H.useHostTransitionStatus()},_n.version="19.2.4",_n}var Yk;function IA(){if(Yk)return Ny.exports;Yk=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(),Ny.exports=qN(),Ny.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var Kk;function YN(){if(Kk)return Uc;Kk=1;var t=$N(),e=a1(),n=IA();function r(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function s(l){var a=l,u=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(u=a.return),l=a.return;while(l)}return a.tag===3?u:null}function o(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function c(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function f(l){if(s(l)!==l)throw Error(r(188))}function d(l){var a=l.alternate;if(!a){if(a=s(l),a===null)throw Error(r(188));return a!==l?null:l}for(var u=l,h=a;;){var g=u.return;if(g===null)break;var x=g.alternate;if(x===null){if(h=g.return,h!==null){u=h;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===u)return f(g),l;if(x===h)return f(g),a;x=x.sibling}throw Error(r(188))}if(u.return!==h.return)u=g,h=x;else{for(var w=!1,E=g.child;E;){if(E===u){w=!0,u=g,h=x;break}if(E===h){w=!0,h=g,u=x;break}E=E.sibling}if(!w){for(E=x.child;E;){if(E===u){w=!0,u=x,h=g;break}if(E===h){w=!0,h=x,u=g;break}E=E.sibling}if(!w)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?l:a}function p(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=p(l),a!==null)return a;l=l.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),z=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function G(l){return l===null||typeof l!="object"?null:(l=ue&&l[ue]||l["@@iterator"],typeof l=="function"?l:null)}var ee=Symbol.for("react.client.reference");function ne(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===ee?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case v:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case F:return"Suspense";case O:return"SuspenseList";case ce:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case S:return"Portal";case z:return l.displayName||"Context";case U:return(l._context.displayName||"Context")+".Consumer";case re:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case L:return a=l.displayName||null,a!==null?a:ne(l.type)||"Memo";case J:a=l._payload,l=l._init;try{return ne(l(a))}catch{}}return null}var Z=Array.isArray,I=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,me={pending:!1,data:null,method:null,action:null},de=[],M=-1;function _(l){return{current:l}}function H(l){0>M||(l.current=de[M],de[M]=null,M--)}function A(l,a){M++,de[M]=l.current,l.current=a}var te=_(null),pe=_(null),ge=_(null),_e=_(null);function Ge(l,a){switch(A(ge,a),A(pe,l),A(te,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?ak(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=ak(a),l=ck(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}H(te),A(te,l)}function qe(){H(te),H(pe),H(ge)}function dt(l){l.memoizedState!==null&&A(_e,l);var a=te.current,u=ck(a,l.type);a!==u&&(A(pe,l),A(te,u))}function Me(l){pe.current===l&&(H(te),H(pe)),_e.current===l&&(H(_e),zc._currentValue=me)}var Ze,Mt;function zt(l){if(Ze===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Ze=a&&a[1]||"",Mt=-1<u.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Ze+l+Mt}var Mn=!1;function Kn(l,a){if(!l||Mn)return"";Mn=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(q){var $=q}Reflect.construct(l,[],X)}else{try{X.call()}catch(q){$=q}l.call(X.prototype)}}else{try{throw Error()}catch(q){$=q}(X=l())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(q){if(q&&$&&typeof q.stack=="string")return[q.stack,$.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=h.DetermineComponentFrameRoot(),w=x[0],E=x[1];if(w&&E){var D=w.split(`
44
- `),P=E.split(`
45
- `);for(g=h=0;h<D.length&&!D[h].includes("DetermineComponentFrameRoot");)h++;for(;g<P.length&&!P[g].includes("DetermineComponentFrameRoot");)g++;if(h===D.length||g===P.length)for(h=D.length-1,g=P.length-1;1<=h&&0<=g&&D[h]!==P[g];)g--;for(;1<=h&&0<=g;h--,g--)if(D[h]!==P[g]){if(h!==1||g!==1)do if(h--,g--,0>g||D[h]!==P[g]){var K=`
46
- `+D[h].replace(" at new "," at ");return l.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",l.displayName)),K}while(1<=h&&0<=g);break}}}finally{Mn=!1,Error.prepareStackTrace=u}return(u=l?l.displayName||l.name:"")?zt(u):""}function ar(l,a){switch(l.tag){case 26:case 27:case 5:return zt(l.type);case 16:return zt("Lazy");case 13:return l.child!==a&&a!==null?zt("Suspense Fallback"):zt("Suspense");case 19:return zt("SuspenseList");case 0:case 15:return Kn(l.type,!1);case 11:return Kn(l.type.render,!1);case 1:return Kn(l.type,!0);case 31:return zt("Activity");default:return""}}function Gr(l){try{var a="",u=null;do a+=ar(l,u),u=l,l=l.return;while(l);return a}catch(h){return`
47
- Error generating stack: `+h.message+`
48
- `+h.stack}}var Zr=Object.prototype.hasOwnProperty,Cr=t.unstable_scheduleCallback,Un=t.unstable_cancelCallback,le=t.unstable_shouldYield,je=t.unstable_requestPaint,Pe=t.unstable_now,St=t.unstable_getCurrentPriorityLevel,j=t.unstable_ImmediatePriority,se=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,Xe=t.unstable_IdlePriority,On=t.log,Ne=t.unstable_setDisableYieldValue,it=null,lt=null;function It(l){if(typeof On=="function"&&Ne(l),lt&&typeof lt.setStrictMode=="function")try{lt.setStrictMode(it,l)}catch{}}var nt=Math.clz32?Math.clz32:C2,Er=Math.log,cr=Math.LN2;function C2(l){return l>>>=0,l===0?32:31-(Er(l)/cr|0)|0}var df=256,hf=262144,pf=4194304;function hl(l){var a=l&42;if(a!==0)return a;switch(l&-l){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 l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function mf(l,a,u){var h=l.pendingLanes;if(h===0)return 0;var g=0,x=l.suspendedLanes,w=l.pingedLanes;l=l.warmLanes;var E=h&134217727;return E!==0?(h=E&~x,h!==0?g=hl(h):(w&=E,w!==0?g=hl(w):u||(u=E&~l,u!==0&&(g=hl(u))))):(E=h&~x,E!==0?g=hl(E):w!==0?g=hl(w):u||(u=h&~l,u!==0&&(g=hl(u)))),g===0?0:a!==0&&a!==g&&(a&x)===0&&(x=g&-g,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:g}function Ka(l,a){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&a)===0}function E2(l,a){switch(l){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 Fx(){var l=pf;return pf<<=1,(pf&62914560)===0&&(pf=4194304),l}function gm(l){for(var a=[],u=0;31>u;u++)a.push(l);return a}function Ga(l,a){l.pendingLanes|=a,a!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function T2(l,a,u,h,g,x){var w=l.pendingLanes;l.pendingLanes=u,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=u,l.entangledLanes&=u,l.errorRecoveryDisabledLanes&=u,l.shellSuspendCounter=0;var E=l.entanglements,D=l.expirationTimes,P=l.hiddenUpdates;for(u=w&~u;0<u;){var K=31-nt(u),X=1<<K;E[K]=0,D[K]=-1;var $=P[K];if($!==null)for(P[K]=null,K=0;K<$.length;K++){var q=$[K];q!==null&&(q.lane&=-536870913)}u&=~X}h!==0&&$x(l,h,0),x!==0&&g===0&&l.tag!==0&&(l.suspendedLanes|=x&~(w&~a))}function $x(l,a,u){l.pendingLanes|=a,l.suspendedLanes&=~a;var h=31-nt(a);l.entangledLanes|=a,l.entanglements[h]=l.entanglements[h]|1073741824|u&261930}function qx(l,a){var u=l.entangledLanes|=a;for(l=l.entanglements;u;){var h=31-nt(u),g=1<<h;g&a|l[h]&a&&(l[h]|=a),u&=~g}}function Yx(l,a){var u=a&-a;return u=(u&42)!==0?1:ym(u),(u&(l.suspendedLanes|a))!==0?0:u}function ym(l){switch(l){case 2:l=1;break;case 8:l=4;break;case 32:l=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:l=128;break;case 268435456:l=134217728;break;default:l=0}return l}function bm(l){return l&=-l,2<l?8<l?(l&134217727)!==0?32:268435456:8:2}function Kx(){var l=Y.p;return l!==0?l:(l=window.event,l===void 0?32:Rk(l.type))}function Gx(l,a){var u=Y.p;try{return Y.p=l,a()}finally{Y.p=u}}var fs=Math.random().toString(36).slice(2),gn="__reactFiber$"+fs,Gn="__reactProps$"+fs,uo="__reactContainer$"+fs,xm="__reactEvents$"+fs,A2="__reactListeners$"+fs,M2="__reactHandles$"+fs,Zx="__reactResources$"+fs,Za="__reactMarker$"+fs;function Sm(l){delete l[gn],delete l[Gn],delete l[xm],delete l[A2],delete l[M2]}function fo(l){var a=l[gn];if(a)return a;for(var u=l.parentNode;u;){if(a=u[uo]||u[gn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(l=gk(l);l!==null;){if(u=l[gn])return u;l=gk(l)}return a}l=u,u=l.parentNode}return null}function ho(l){if(l=l[gn]||l[uo]){var a=l.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return l}return null}function Wa(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l.stateNode;throw Error(r(33))}function po(l){var a=l[Zx];return a||(a=l[Zx]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function sn(l){l[Za]=!0}var Wx=new Set,Jx={};function pl(l,a){mo(l,a),mo(l+"Capture",a)}function mo(l,a){for(Jx[l]=a,l=0;l<a.length;l++)Wx.add(a[l])}var O2=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]*$"),Xx={},Qx={};function _2(l){return Zr.call(Qx,l)?!0:Zr.call(Xx,l)?!1:O2.test(l)?Qx[l]=!0:(Xx[l]=!0,!1)}function gf(l,a,u){if(_2(a))if(u===null)l.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":l.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){l.removeAttribute(a);return}}l.setAttribute(a,""+u)}}function yf(l,a,u){if(u===null)l.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(a);return}l.setAttribute(a,""+u)}}function _i(l,a,u,h){if(h===null)l.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(u);return}l.setAttributeNS(a,u,""+h)}}function Tr(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function eS(l){var a=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function D2(l,a,u){var h=Object.getOwnPropertyDescriptor(l.constructor.prototype,a);if(!l.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var g=h.get,x=h.set;return Object.defineProperty(l,a,{configurable:!0,get:function(){return g.call(this)},set:function(w){u=""+w,x.call(this,w)}}),Object.defineProperty(l,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){l._valueTracker=null,delete l[a]}}}}function wm(l){if(!l._valueTracker){var a=eS(l)?"checked":"value";l._valueTracker=D2(l,a,""+l[a])}}function tS(l){if(!l)return!1;var a=l._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return l&&(h=eS(l)?l.checked?"true":"false":l.value),l=h,l!==u?(a.setValue(l),!0):!1}function bf(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var R2=/[\n"\\]/g;function Ar(l){return l.replace(R2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function vm(l,a,u,h,g,x,w,E){l.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?l.type=w:l.removeAttribute("type"),a!=null?w==="number"?(a===0&&l.value===""||l.value!=a)&&(l.value=""+Tr(a)):l.value!==""+Tr(a)&&(l.value=""+Tr(a)):w!=="submit"&&w!=="reset"||l.removeAttribute("value"),a!=null?km(l,w,Tr(a)):u!=null?km(l,w,Tr(u)):h!=null&&l.removeAttribute("value"),g==null&&x!=null&&(l.defaultChecked=!!x),g!=null&&(l.checked=g&&typeof g!="function"&&typeof g!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?l.name=""+Tr(E):l.removeAttribute("name")}function nS(l,a,u,h,g,x,w,E){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(l.type=x),a!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){wm(l);return}u=u!=null?""+Tr(u):"",a=a!=null?""+Tr(a):u,E||a===l.value||(l.value=a),l.defaultValue=a}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,l.checked=E?l.checked:!!h,l.defaultChecked=!!h,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(l.name=w),wm(l)}function km(l,a,u){a==="number"&&bf(l.ownerDocument)===l||l.defaultValue===""+u||(l.defaultValue=""+u)}function go(l,a,u,h){if(l=l.options,a){a={};for(var g=0;g<u.length;g++)a["$"+u[g]]=!0;for(u=0;u<l.length;u++)g=a.hasOwnProperty("$"+l[u].value),l[u].selected!==g&&(l[u].selected=g),g&&h&&(l[u].defaultSelected=!0)}else{for(u=""+Tr(u),a=null,g=0;g<l.length;g++){if(l[g].value===u){l[g].selected=!0,h&&(l[g].defaultSelected=!0);return}a!==null||l[g].disabled||(a=l[g])}a!==null&&(a.selected=!0)}}function rS(l,a,u){if(a!=null&&(a=""+Tr(a),a!==l.value&&(l.value=a),u==null)){l.defaultValue!==a&&(l.defaultValue=a);return}l.defaultValue=u!=null?""+Tr(u):""}function iS(l,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(Z(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Tr(a),l.defaultValue=u,h=l.textContent,h===u&&h!==""&&h!==null&&(l.value=h),wm(l)}function yo(l,a){if(a){var u=l.firstChild;if(u&&u===l.lastChild&&u.nodeType===3){u.nodeValue=a;return}}l.textContent=a}var N2=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 sS(l,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?l.setProperty(a,""):a==="float"?l.cssFloat="":l[a]="":h?l.setProperty(a,u):typeof u!="number"||u===0||N2.has(a)?a==="float"?l.cssFloat=u:l[a]=(""+u).trim():l[a]=u+"px"}function lS(l,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(l=l.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?l.setProperty(h,""):h==="float"?l.cssFloat="":l[h]="");for(var g in a)h=a[g],a.hasOwnProperty(g)&&u[g]!==h&&sS(l,g,h)}else for(var x in a)a.hasOwnProperty(x)&&sS(l,x,a[x])}function Cm(l){if(l.indexOf("-")===-1)return!1;switch(l){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 z2=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"]]),L2=/^[\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 xf(l){return L2.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}function Di(){}var Em=null;function Tm(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var bo=null,xo=null;function oS(l){var a=ho(l);if(a&&(l=a.stateNode)){var u=l[Gn]||null;e:switch(l=a.stateNode,a.type){case"input":if(vm(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=l;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ar(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==l&&h.form===l.form){var g=h[Gn]||null;if(!g)throw Error(r(90));vm(h,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===l.form&&tS(h)}break e;case"textarea":rS(l,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&go(l,!!u.multiple,a,!1)}}}var Am=!1;function aS(l,a,u){if(Am)return l(a,u);Am=!0;try{var h=l(a);return h}finally{if(Am=!1,(bo!==null||xo!==null)&&(ld(),bo&&(a=bo,l=xo,xo=bo=null,oS(a),l)))for(a=0;a<l.length;a++)oS(l[a])}}function Ja(l,a){var u=l.stateNode;if(u===null)return null;var h=u[Gn]||null;if(h===null)return null;u=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(l=l.type,h=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!h;break e;default:l=!1}if(l)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Ri=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mm=!1;if(Ri)try{var Xa={};Object.defineProperty(Xa,"passive",{get:function(){Mm=!0}}),window.addEventListener("test",Xa,Xa),window.removeEventListener("test",Xa,Xa)}catch{Mm=!1}var ds=null,Om=null,Sf=null;function cS(){if(Sf)return Sf;var l,a=Om,u=a.length,h,g="value"in ds?ds.value:ds.textContent,x=g.length;for(l=0;l<u&&a[l]===g[l];l++);var w=u-l;for(h=1;h<=w&&a[u-h]===g[x-h];h++);return Sf=g.slice(l,1<h?1-h:void 0)}function wf(l){var a=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&a===13&&(l=13)):l=a,l===10&&(l=13),32<=l||l===13?l:0}function vf(){return!0}function uS(){return!1}function Zn(l){function a(u,h,g,x,w){this._reactName=u,this._targetInst=g,this.type=h,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var E in l)l.hasOwnProperty(E)&&(u=l[E],this[E]=u?u(x):x[E]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?vf:uS,this.isPropagationStopped=uS,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=vf)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=vf)},persist:function(){},isPersistent:vf}),a}var ml={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kf=Zn(ml),Qa=m({},ml,{view:0,detail:0}),I2=Zn(Qa),_m,Dm,ec,Cf=m({},Qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nm,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==ec&&(ec&&l.type==="mousemove"?(_m=l.screenX-ec.screenX,Dm=l.screenY-ec.screenY):Dm=_m=0,ec=l),_m)},movementY:function(l){return"movementY"in l?l.movementY:Dm}}),fS=Zn(Cf),B2=m({},Cf,{dataTransfer:0}),j2=Zn(B2),U2=m({},Qa,{relatedTarget:0}),Rm=Zn(U2),H2=m({},ml,{animationName:0,elapsedTime:0,pseudoElement:0}),V2=Zn(H2),P2=m({},ml,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),F2=Zn(P2),$2=m({},ml,{data:0}),dS=Zn($2),q2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Y2={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"},K2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function G2(l){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(l):(l=K2[l])?!!a[l]:!1}function Nm(){return G2}var Z2=m({},Qa,{key:function(l){if(l.key){var a=q2[l.key]||l.key;if(a!=="Unidentified")return a}return l.type==="keypress"?(l=wf(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?Y2[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nm,charCode:function(l){return l.type==="keypress"?wf(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?wf(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),W2=Zn(Z2),J2=m({},Cf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hS=Zn(J2),X2=m({},Qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nm}),Q2=Zn(X2),eR=m({},ml,{propertyName:0,elapsedTime:0,pseudoElement:0}),tR=Zn(eR),nR=m({},Cf,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),rR=Zn(nR),iR=m({},ml,{newState:0,oldState:0}),sR=Zn(iR),lR=[9,13,27,32],zm=Ri&&"CompositionEvent"in window,tc=null;Ri&&"documentMode"in document&&(tc=document.documentMode);var oR=Ri&&"TextEvent"in window&&!tc,pS=Ri&&(!zm||tc&&8<tc&&11>=tc),mS=" ",gS=!1;function yS(l,a){switch(l){case"keyup":return lR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bS(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var So=!1;function aR(l,a){switch(l){case"compositionend":return bS(a);case"keypress":return a.which!==32?null:(gS=!0,mS);case"textInput":return l=a.data,l===mS&&gS?null:l;default:return null}}function cR(l,a){if(So)return l==="compositionend"||!zm&&yS(l,a)?(l=cS(),Sf=Om=ds=null,So=!1,l):null;switch(l){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 pS&&a.locale!=="ko"?null:a.data;default:return null}}var uR={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 xS(l){var a=l&&l.nodeName&&l.nodeName.toLowerCase();return a==="input"?!!uR[l.type]:a==="textarea"}function SS(l,a,u,h){bo?xo?xo.push(h):xo=[h]:bo=h,a=hd(a,"onChange"),0<a.length&&(u=new kf("onChange","change",null,u,h),l.push({event:u,listeners:a}))}var nc=null,rc=null;function fR(l){nk(l,0)}function Ef(l){var a=Wa(l);if(tS(a))return l}function wS(l,a){if(l==="change")return a}var vS=!1;if(Ri){var Lm;if(Ri){var Im="oninput"in document;if(!Im){var kS=document.createElement("div");kS.setAttribute("oninput","return;"),Im=typeof kS.oninput=="function"}Lm=Im}else Lm=!1;vS=Lm&&(!document.documentMode||9<document.documentMode)}function CS(){nc&&(nc.detachEvent("onpropertychange",ES),rc=nc=null)}function ES(l){if(l.propertyName==="value"&&Ef(rc)){var a=[];SS(a,rc,l,Tm(l)),aS(fR,a)}}function dR(l,a,u){l==="focusin"?(CS(),nc=a,rc=u,nc.attachEvent("onpropertychange",ES)):l==="focusout"&&CS()}function hR(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return Ef(rc)}function pR(l,a){if(l==="click")return Ef(a)}function mR(l,a){if(l==="input"||l==="change")return Ef(a)}function gR(l,a){return l===a&&(l!==0||1/l===1/a)||l!==l&&a!==a}var ur=typeof Object.is=="function"?Object.is:gR;function ic(l,a){if(ur(l,a))return!0;if(typeof l!="object"||l===null||typeof a!="object"||a===null)return!1;var u=Object.keys(l),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var g=u[h];if(!Zr.call(a,g)||!ur(l[g],a[g]))return!1}return!0}function TS(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function AS(l,a){var u=TS(l);l=0;for(var h;u;){if(u.nodeType===3){if(h=l+u.textContent.length,l<=a&&h>=a)return{node:u,offset:a-l};l=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=TS(u)}}function MS(l,a){return l&&a?l===a?!0:l&&l.nodeType===3?!1:a&&a.nodeType===3?MS(l,a.parentNode):"contains"in l?l.contains(a):l.compareDocumentPosition?!!(l.compareDocumentPosition(a)&16):!1:!1}function OS(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var a=bf(l.document);a instanceof l.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)l=a.contentWindow;else break;a=bf(l.document)}return a}function Bm(l){var a=l&&l.nodeName&&l.nodeName.toLowerCase();return a&&(a==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||a==="textarea"||l.contentEditable==="true")}var yR=Ri&&"documentMode"in document&&11>=document.documentMode,wo=null,jm=null,sc=null,Um=!1;function _S(l,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Um||wo==null||wo!==bf(h)||(h=wo,"selectionStart"in h&&Bm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),sc&&ic(sc,h)||(sc=h,h=hd(jm,"onSelect"),0<h.length&&(a=new kf("onSelect","select",null,a,u),l.push({event:a,listeners:h}),a.target=wo)))}function gl(l,a){var u={};return u[l.toLowerCase()]=a.toLowerCase(),u["Webkit"+l]="webkit"+a,u["Moz"+l]="moz"+a,u}var vo={animationend:gl("Animation","AnimationEnd"),animationiteration:gl("Animation","AnimationIteration"),animationstart:gl("Animation","AnimationStart"),transitionrun:gl("Transition","TransitionRun"),transitionstart:gl("Transition","TransitionStart"),transitioncancel:gl("Transition","TransitionCancel"),transitionend:gl("Transition","TransitionEnd")},Hm={},DS={};Ri&&(DS=document.createElement("div").style,"AnimationEvent"in window||(delete vo.animationend.animation,delete vo.animationiteration.animation,delete vo.animationstart.animation),"TransitionEvent"in window||delete vo.transitionend.transition);function yl(l){if(Hm[l])return Hm[l];if(!vo[l])return l;var a=vo[l],u;for(u in a)if(a.hasOwnProperty(u)&&u in DS)return Hm[l]=a[u];return l}var RS=yl("animationend"),NS=yl("animationiteration"),zS=yl("animationstart"),bR=yl("transitionrun"),xR=yl("transitionstart"),SR=yl("transitioncancel"),LS=yl("transitionend"),IS=new Map,Vm="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(" ");Vm.push("scrollEnd");function Wr(l,a){IS.set(l,a),pl(a,[l])}var Tf=typeof reportError=="function"?reportError:function(l){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof l=="object"&&l!==null&&typeof l.message=="string"?String(l.message):String(l),error:l});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",l);return}console.error(l)},Mr=[],ko=0,Pm=0;function Af(){for(var l=ko,a=Pm=ko=0;a<l;){var u=Mr[a];Mr[a++]=null;var h=Mr[a];Mr[a++]=null;var g=Mr[a];Mr[a++]=null;var x=Mr[a];if(Mr[a++]=null,h!==null&&g!==null){var w=h.pending;w===null?g.next=g:(g.next=w.next,w.next=g),h.pending=g}x!==0&&BS(u,g,x)}}function Mf(l,a,u,h){Mr[ko++]=l,Mr[ko++]=a,Mr[ko++]=u,Mr[ko++]=h,Pm|=h,l.lanes|=h,l=l.alternate,l!==null&&(l.lanes|=h)}function Fm(l,a,u,h){return Mf(l,a,u,h),Of(l)}function bl(l,a){return Mf(l,null,null,a),Of(l)}function BS(l,a,u){l.lanes|=u;var h=l.alternate;h!==null&&(h.lanes|=u);for(var g=!1,x=l.return;x!==null;)x.childLanes|=u,h=x.alternate,h!==null&&(h.childLanes|=u),x.tag===22&&(l=x.stateNode,l===null||l._visibility&1||(g=!0)),l=x,x=x.return;return l.tag===3?(x=l.stateNode,g&&a!==null&&(g=31-nt(u),l=x.hiddenUpdates,h=l[g],h===null?l[g]=[a]:h.push(a),a.lane=u|536870912),x):null}function Of(l){if(50<Ac)throw Ac=0,Xg=null,Error(r(185));for(var a=l.return;a!==null;)l=a,a=l.return;return l.tag===3?l.stateNode:null}var Co={};function wR(l,a,u,h){this.tag=l,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fr(l,a,u,h){return new wR(l,a,u,h)}function $m(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Ni(l,a){var u=l.alternate;return u===null?(u=fr(l.tag,a,l.key,l.mode),u.elementType=l.elementType,u.type=l.type,u.stateNode=l.stateNode,u.alternate=l,l.alternate=u):(u.pendingProps=a,u.type=l.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=l.flags&65011712,u.childLanes=l.childLanes,u.lanes=l.lanes,u.child=l.child,u.memoizedProps=l.memoizedProps,u.memoizedState=l.memoizedState,u.updateQueue=l.updateQueue,a=l.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=l.sibling,u.index=l.index,u.ref=l.ref,u.refCleanup=l.refCleanup,u}function jS(l,a){l.flags&=65011714;var u=l.alternate;return u===null?(l.childLanes=0,l.lanes=a,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=u.childLanes,l.lanes=u.lanes,l.child=u.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=u.memoizedProps,l.memoizedState=u.memoizedState,l.updateQueue=u.updateQueue,l.type=u.type,a=u.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),l}function _f(l,a,u,h,g,x){var w=0;if(h=l,typeof l=="function")$m(l)&&(w=1);else if(typeof l=="string")w=TN(l,u,te.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case ce:return l=fr(31,u,a,g),l.elementType=ce,l.lanes=x,l;case v:return xl(u.children,g,x,a);case k:w=8,g|=24;break;case C:return l=fr(12,u,a,g|2),l.elementType=C,l.lanes=x,l;case F:return l=fr(13,u,a,g),l.elementType=F,l.lanes=x,l;case O:return l=fr(19,u,a,g),l.elementType=O,l.lanes=x,l;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case z:w=10;break e;case U:w=9;break e;case re:w=11;break e;case L:w=14;break e;case J:w=16,h=null;break e}w=29,u=Error(r(130,l===null?"null":typeof l,"")),h=null}return a=fr(w,u,a,g),a.elementType=l,a.type=h,a.lanes=x,a}function xl(l,a,u,h){return l=fr(7,l,h,a),l.lanes=u,l}function qm(l,a,u){return l=fr(6,l,null,a),l.lanes=u,l}function US(l){var a=fr(18,null,null,0);return a.stateNode=l,a}function Ym(l,a,u){return a=fr(4,l.children!==null?l.children:[],l.key,a),a.lanes=u,a.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},a}var HS=new WeakMap;function Or(l,a){if(typeof l=="object"&&l!==null){var u=HS.get(l);return u!==void 0?u:(a={value:l,source:a,stack:Gr(a)},HS.set(l,a),a)}return{value:l,source:a,stack:Gr(a)}}var Eo=[],To=0,Df=null,lc=0,_r=[],Dr=0,hs=null,ai=1,ci="";function zi(l,a){Eo[To++]=lc,Eo[To++]=Df,Df=l,lc=a}function VS(l,a,u){_r[Dr++]=ai,_r[Dr++]=ci,_r[Dr++]=hs,hs=l;var h=ai;l=ci;var g=32-nt(h)-1;h&=~(1<<g),u+=1;var x=32-nt(a)+g;if(30<x){var w=g-g%5;x=(h&(1<<w)-1).toString(32),h>>=w,g-=w,ai=1<<32-nt(a)+g|u<<g|h,ci=x+l}else ai=1<<x|u<<g|h,ci=l}function Km(l){l.return!==null&&(zi(l,1),VS(l,1,0))}function Gm(l){for(;l===Df;)Df=Eo[--To],Eo[To]=null,lc=Eo[--To],Eo[To]=null;for(;l===hs;)hs=_r[--Dr],_r[Dr]=null,ci=_r[--Dr],_r[Dr]=null,ai=_r[--Dr],_r[Dr]=null}function PS(l,a){_r[Dr++]=ai,_r[Dr++]=ci,_r[Dr++]=hs,ai=a.id,ci=a.overflow,hs=l}var yn=null,Ot=null,rt=!1,ps=null,Rr=!1,Zm=Error(r(519));function ms(l){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw oc(Or(a,l)),Zm}function FS(l){var a=l.stateNode,u=l.type,h=l.memoizedProps;switch(a[gn]=l,a[Gn]=h,u){case"dialog":Je("cancel",a),Je("close",a);break;case"iframe":case"object":case"embed":Je("load",a);break;case"video":case"audio":for(u=0;u<Oc.length;u++)Je(Oc[u],a);break;case"source":Je("error",a);break;case"img":case"image":case"link":Je("error",a),Je("load",a);break;case"details":Je("toggle",a);break;case"input":Je("invalid",a),nS(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Je("invalid",a);break;case"textarea":Je("invalid",a),iS(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||lk(a.textContent,u)?(h.popover!=null&&(Je("beforetoggle",a),Je("toggle",a)),h.onScroll!=null&&Je("scroll",a),h.onScrollEnd!=null&&Je("scrollend",a),h.onClick!=null&&(a.onclick=Di),a=!0):a=!1,a||ms(l,!0)}function $S(l){for(yn=l.return;yn;)switch(yn.tag){case 5:case 31:case 13:Rr=!1;return;case 27:case 3:Rr=!0;return;default:yn=yn.return}}function Ao(l){if(l!==yn)return!1;if(!rt)return $S(l),rt=!0,!1;var a=l.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=l.type,u=!(u!=="form"&&u!=="button")||hy(l.type,l.memoizedProps)),u=!u),u&&Ot&&ms(l),$S(l),a===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(317));Ot=mk(l)}else if(a===31){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(317));Ot=mk(l)}else a===27?(a=Ot,Os(l.type)?(l=by,by=null,Ot=l):Ot=a):Ot=yn?zr(l.stateNode.nextSibling):null;return!0}function Sl(){Ot=yn=null,rt=!1}function Wm(){var l=ps;return l!==null&&(Qn===null?Qn=l:Qn.push.apply(Qn,l),ps=null),l}function oc(l){ps===null?ps=[l]:ps.push(l)}var Jm=_(null),wl=null,Li=null;function gs(l,a,u){A(Jm,a._currentValue),a._currentValue=u}function Ii(l){l._currentValue=Jm.current,H(Jm)}function Xm(l,a,u){for(;l!==null;){var h=l.alternate;if((l.childLanes&a)!==a?(l.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),l===u)break;l=l.return}}function Qm(l,a,u,h){var g=l.child;for(g!==null&&(g.return=l);g!==null;){var x=g.dependencies;if(x!==null){var w=g.child;x=x.firstContext;e:for(;x!==null;){var E=x;x=g;for(var D=0;D<a.length;D++)if(E.context===a[D]){x.lanes|=u,E=x.alternate,E!==null&&(E.lanes|=u),Xm(x.return,u,l),h||(w=null);break e}x=E.next}}else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=u,x=w.alternate,x!==null&&(x.lanes|=u),Xm(w,u,l),w=null}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===l){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}}function Mo(l,a,u,h){l=null;for(var g=a,x=!1;g!==null;){if(!x){if((g.flags&524288)!==0)x=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var w=g.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var E=g.type;ur(g.pendingProps.value,w.value)||(l!==null?l.push(E):l=[E])}}else if(g===_e.current){if(w=g.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(l!==null?l.push(zc):l=[zc])}g=g.return}l!==null&&Qm(a,l,u,h),a.flags|=262144}function Rf(l){for(l=l.firstContext;l!==null;){if(!ur(l.context._currentValue,l.memoizedValue))return!0;l=l.next}return!1}function vl(l){wl=l,Li=null,l=l.dependencies,l!==null&&(l.firstContext=null)}function bn(l){return qS(wl,l)}function Nf(l,a){return wl===null&&vl(l),qS(l,a)}function qS(l,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Li===null){if(l===null)throw Error(r(308));Li=a,l.dependencies={lanes:0,firstContext:a},l.flags|=524288}else Li=Li.next=a;return u}var vR=typeof AbortController<"u"?AbortController:function(){var l=[],a=this.signal={aborted:!1,addEventListener:function(u,h){l.push(h)}};this.abort=function(){a.aborted=!0,l.forEach(function(u){return u()})}},kR=t.unstable_scheduleCallback,CR=t.unstable_NormalPriority,Yt={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function eg(){return{controller:new vR,data:new Map,refCount:0}}function ac(l){l.refCount--,l.refCount===0&&kR(CR,function(){l.controller.abort()})}var cc=null,tg=0,Oo=0,_o=null;function ER(l,a){if(cc===null){var u=cc=[];tg=0,Oo=iy(),_o={status:"pending",value:void 0,then:function(h){u.push(h)}}}return tg++,a.then(YS,YS),a}function YS(){if(--tg===0&&cc!==null){_o!==null&&(_o.status="fulfilled");var l=cc;cc=null,Oo=0,_o=null;for(var a=0;a<l.length;a++)(0,l[a])()}}function TR(l,a){var u=[],h={status:"pending",value:null,reason:null,then:function(g){u.push(g)}};return l.then(function(){h.status="fulfilled",h.value=a;for(var g=0;g<u.length;g++)(0,u[g])(a)},function(g){for(h.status="rejected",h.reason=g,g=0;g<u.length;g++)(0,u[g])(void 0)}),h}var KS=I.S;I.S=function(l,a){_v=Pe(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&ER(l,a),KS!==null&&KS(l,a)};var kl=_(null);function ng(){var l=kl.current;return l!==null?l:wt.pooledCache}function zf(l,a){a===null?A(kl,kl.current):A(kl,a.pool)}function GS(){var l=ng();return l===null?null:{parent:Yt._currentValue,pool:l}}var Do=Error(r(460)),rg=Error(r(474)),Lf=Error(r(542)),If={then:function(){}};function ZS(l){return l=l.status,l==="fulfilled"||l==="rejected"}function WS(l,a,u){switch(u=l[u],u===void 0?l.push(a):u!==a&&(a.then(Di,Di),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw l=a.reason,XS(l),l;default:if(typeof a.status=="string")a.then(Di,Di);else{if(l=wt,l!==null&&100<l.shellSuspendCounter)throw Error(r(482));l=a,l.status="pending",l.then(function(h){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=h}},function(h){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw l=a.reason,XS(l),l}throw El=a,Do}}function Cl(l){try{var a=l._init;return a(l._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(El=u,Do):u}}var El=null;function JS(){if(El===null)throw Error(r(459));var l=El;return El=null,l}function XS(l){if(l===Do||l===Lf)throw Error(r(483))}var Ro=null,uc=0;function Bf(l){var a=uc;return uc+=1,Ro===null&&(Ro=[]),WS(Ro,l,a)}function fc(l,a){a=a.props.ref,l.ref=a!==void 0?a:null}function jf(l,a){throw a.$$typeof===y?Error(r(525)):(l=Object.prototype.toString.call(a),Error(r(31,l==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":l)))}function QS(l){function a(B,N){if(l){var V=B.deletions;V===null?(B.deletions=[N],B.flags|=16):V.push(N)}}function u(B,N){if(!l)return null;for(;N!==null;)a(B,N),N=N.sibling;return null}function h(B){for(var N=new Map;B!==null;)B.key!==null?N.set(B.key,B):N.set(B.index,B),B=B.sibling;return N}function g(B,N){return B=Ni(B,N),B.index=0,B.sibling=null,B}function x(B,N,V){return B.index=V,l?(V=B.alternate,V!==null?(V=V.index,V<N?(B.flags|=67108866,N):V):(B.flags|=67108866,N)):(B.flags|=1048576,N)}function w(B){return l&&B.alternate===null&&(B.flags|=67108866),B}function E(B,N,V,W){return N===null||N.tag!==6?(N=qm(V,B.mode,W),N.return=B,N):(N=g(N,V),N.return=B,N)}function D(B,N,V,W){var Ee=V.type;return Ee===v?K(B,N,V.props.children,W,V.key):N!==null&&(N.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===J&&Cl(Ee)===N.type)?(N=g(N,V.props),fc(N,V),N.return=B,N):(N=_f(V.type,V.key,V.props,null,B.mode,W),fc(N,V),N.return=B,N)}function P(B,N,V,W){return N===null||N.tag!==4||N.stateNode.containerInfo!==V.containerInfo||N.stateNode.implementation!==V.implementation?(N=Ym(V,B.mode,W),N.return=B,N):(N=g(N,V.children||[]),N.return=B,N)}function K(B,N,V,W,Ee){return N===null||N.tag!==7?(N=xl(V,B.mode,W,Ee),N.return=B,N):(N=g(N,V),N.return=B,N)}function X(B,N,V){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=qm(""+N,B.mode,V),N.return=B,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case b:return V=_f(N.type,N.key,N.props,null,B.mode,V),fc(V,N),V.return=B,V;case S:return N=Ym(N,B.mode,V),N.return=B,N;case J:return N=Cl(N),X(B,N,V)}if(Z(N)||G(N))return N=xl(N,B.mode,V,null),N.return=B,N;if(typeof N.then=="function")return X(B,Bf(N),V);if(N.$$typeof===z)return X(B,Nf(B,N),V);jf(B,N)}return null}function $(B,N,V,W){var Ee=N!==null?N.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Ee!==null?null:E(B,N,""+V,W);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return V.key===Ee?D(B,N,V,W):null;case S:return V.key===Ee?P(B,N,V,W):null;case J:return V=Cl(V),$(B,N,V,W)}if(Z(V)||G(V))return Ee!==null?null:K(B,N,V,W,null);if(typeof V.then=="function")return $(B,N,Bf(V),W);if(V.$$typeof===z)return $(B,N,Nf(B,V),W);jf(B,V)}return null}function q(B,N,V,W,Ee){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return B=B.get(V)||null,E(N,B,""+W,Ee);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case b:return B=B.get(W.key===null?V:W.key)||null,D(N,B,W,Ee);case S:return B=B.get(W.key===null?V:W.key)||null,P(N,B,W,Ee);case J:return W=Cl(W),q(B,N,V,W,Ee)}if(Z(W)||G(W))return B=B.get(V)||null,K(N,B,W,Ee,null);if(typeof W.then=="function")return q(B,N,V,Bf(W),Ee);if(W.$$typeof===z)return q(B,N,V,Nf(N,W),Ee);jf(N,W)}return null}function be(B,N,V,W){for(var Ee=null,ot=null,we=N,He=N=0,et=null;we!==null&&He<V.length;He++){we.index>He?(et=we,we=null):et=we.sibling;var at=$(B,we,V[He],W);if(at===null){we===null&&(we=et);break}l&&we&&at.alternate===null&&a(B,we),N=x(at,N,He),ot===null?Ee=at:ot.sibling=at,ot=at,we=et}if(He===V.length)return u(B,we),rt&&zi(B,He),Ee;if(we===null){for(;He<V.length;He++)we=X(B,V[He],W),we!==null&&(N=x(we,N,He),ot===null?Ee=we:ot.sibling=we,ot=we);return rt&&zi(B,He),Ee}for(we=h(we);He<V.length;He++)et=q(we,B,He,V[He],W),et!==null&&(l&&et.alternate!==null&&we.delete(et.key===null?He:et.key),N=x(et,N,He),ot===null?Ee=et:ot.sibling=et,ot=et);return l&&we.forEach(function(zs){return a(B,zs)}),rt&&zi(B,He),Ee}function Oe(B,N,V,W){if(V==null)throw Error(r(151));for(var Ee=null,ot=null,we=N,He=N=0,et=null,at=V.next();we!==null&&!at.done;He++,at=V.next()){we.index>He?(et=we,we=null):et=we.sibling;var zs=$(B,we,at.value,W);if(zs===null){we===null&&(we=et);break}l&&we&&zs.alternate===null&&a(B,we),N=x(zs,N,He),ot===null?Ee=zs:ot.sibling=zs,ot=zs,we=et}if(at.done)return u(B,we),rt&&zi(B,He),Ee;if(we===null){for(;!at.done;He++,at=V.next())at=X(B,at.value,W),at!==null&&(N=x(at,N,He),ot===null?Ee=at:ot.sibling=at,ot=at);return rt&&zi(B,He),Ee}for(we=h(we);!at.done;He++,at=V.next())at=q(we,B,He,at.value,W),at!==null&&(l&&at.alternate!==null&&we.delete(at.key===null?He:at.key),N=x(at,N,He),ot===null?Ee=at:ot.sibling=at,ot=at);return l&&we.forEach(function(BN){return a(B,BN)}),rt&&zi(B,He),Ee}function bt(B,N,V,W){if(typeof V=="object"&&V!==null&&V.type===v&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case b:e:{for(var Ee=V.key;N!==null;){if(N.key===Ee){if(Ee=V.type,Ee===v){if(N.tag===7){u(B,N.sibling),W=g(N,V.props.children),W.return=B,B=W;break e}}else if(N.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===J&&Cl(Ee)===N.type){u(B,N.sibling),W=g(N,V.props),fc(W,V),W.return=B,B=W;break e}u(B,N);break}else a(B,N);N=N.sibling}V.type===v?(W=xl(V.props.children,B.mode,W,V.key),W.return=B,B=W):(W=_f(V.type,V.key,V.props,null,B.mode,W),fc(W,V),W.return=B,B=W)}return w(B);case S:e:{for(Ee=V.key;N!==null;){if(N.key===Ee)if(N.tag===4&&N.stateNode.containerInfo===V.containerInfo&&N.stateNode.implementation===V.implementation){u(B,N.sibling),W=g(N,V.children||[]),W.return=B,B=W;break e}else{u(B,N);break}else a(B,N);N=N.sibling}W=Ym(V,B.mode,W),W.return=B,B=W}return w(B);case J:return V=Cl(V),bt(B,N,V,W)}if(Z(V))return be(B,N,V,W);if(G(V)){if(Ee=G(V),typeof Ee!="function")throw Error(r(150));return V=Ee.call(V),Oe(B,N,V,W)}if(typeof V.then=="function")return bt(B,N,Bf(V),W);if(V.$$typeof===z)return bt(B,N,Nf(B,V),W);jf(B,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,N!==null&&N.tag===6?(u(B,N.sibling),W=g(N,V),W.return=B,B=W):(u(B,N),W=qm(V,B.mode,W),W.return=B,B=W),w(B)):u(B,N)}return function(B,N,V,W){try{uc=0;var Ee=bt(B,N,V,W);return Ro=null,Ee}catch(we){if(we===Do||we===Lf)throw we;var ot=fr(29,we,null,B.mode);return ot.lanes=W,ot.return=B,ot}finally{}}}var Tl=QS(!0),ew=QS(!1),ys=!1;function ig(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sg(l,a){l=l.updateQueue,a.updateQueue===l&&(a.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function bs(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function xs(l,a,u){var h=l.updateQueue;if(h===null)return null;if(h=h.shared,(ut&2)!==0){var g=h.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),h.pending=a,a=Of(l),BS(l,null,u),a}return Mf(l,h,a,u),Of(l)}function dc(l,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=l.pendingLanes,u|=h,a.lanes=u,qx(l,u)}}function lg(l,a){var u=l.updateQueue,h=l.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var g=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var w={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?g=x=w:x=x.next=w,u=u.next}while(u!==null);x===null?g=x=a:x=x.next=a}else g=x=a;u={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},l.updateQueue=u;return}l=u.lastBaseUpdate,l===null?u.firstBaseUpdate=a:l.next=a,u.lastBaseUpdate=a}var og=!1;function hc(){if(og){var l=_o;if(l!==null)throw l}}function pc(l,a,u,h){og=!1;var g=l.updateQueue;ys=!1;var x=g.firstBaseUpdate,w=g.lastBaseUpdate,E=g.shared.pending;if(E!==null){g.shared.pending=null;var D=E,P=D.next;D.next=null,w===null?x=P:w.next=P,w=D;var K=l.alternate;K!==null&&(K=K.updateQueue,E=K.lastBaseUpdate,E!==w&&(E===null?K.firstBaseUpdate=P:E.next=P,K.lastBaseUpdate=D))}if(x!==null){var X=g.baseState;w=0,K=P=D=null,E=x;do{var $=E.lane&-536870913,q=$!==E.lane;if(q?(Qe&$)===$:(h&$)===$){$!==0&&$===Oo&&(og=!0),K!==null&&(K=K.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var be=l,Oe=E;$=a;var bt=u;switch(Oe.tag){case 1:if(be=Oe.payload,typeof be=="function"){X=be.call(bt,X,$);break e}X=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Oe.payload,$=typeof be=="function"?be.call(bt,X,$):be,$==null)break e;X=m({},X,$);break e;case 2:ys=!0}}$=E.callback,$!==null&&(l.flags|=64,q&&(l.flags|=8192),q=g.callbacks,q===null?g.callbacks=[$]:q.push($))}else q={lane:$,tag:E.tag,payload:E.payload,callback:E.callback,next:null},K===null?(P=K=q,D=X):K=K.next=q,w|=$;if(E=E.next,E===null){if(E=g.shared.pending,E===null)break;q=E,E=q.next,q.next=null,g.lastBaseUpdate=q,g.shared.pending=null}}while(!0);K===null&&(D=X),g.baseState=D,g.firstBaseUpdate=P,g.lastBaseUpdate=K,x===null&&(g.shared.lanes=0),Cs|=w,l.lanes=w,l.memoizedState=X}}function tw(l,a){if(typeof l!="function")throw Error(r(191,l));l.call(a)}function nw(l,a){var u=l.callbacks;if(u!==null)for(l.callbacks=null,l=0;l<u.length;l++)tw(u[l],a)}var No=_(null),Uf=_(0);function rw(l,a){l=qi,A(Uf,l),A(No,a),qi=l|a.baseLanes}function ag(){A(Uf,qi),A(No,No.current)}function cg(){qi=Uf.current,H(No),H(Uf)}var dr=_(null),Nr=null;function Ss(l){var a=l.alternate;A(Ft,Ft.current&1),A(dr,l),Nr===null&&(a===null||No.current!==null||a.memoizedState!==null)&&(Nr=l)}function ug(l){A(Ft,Ft.current),A(dr,l),Nr===null&&(Nr=l)}function iw(l){l.tag===22?(A(Ft,Ft.current),A(dr,l),Nr===null&&(Nr=l)):ws()}function ws(){A(Ft,Ft.current),A(dr,dr.current)}function hr(l){H(dr),Nr===l&&(Nr=null),H(Ft)}var Ft=_(0);function Hf(l){for(var a=l;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||gy(u)||yy(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break;for(;a.sibling===null;){if(a.return===null||a.return===l)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Bi=0,Ue=null,gt=null,Kt=null,Vf=!1,zo=!1,Al=!1,Pf=0,mc=0,Lo=null,AR=0;function Bt(){throw Error(r(321))}function fg(l,a){if(a===null)return!1;for(var u=0;u<a.length&&u<l.length;u++)if(!ur(l[u],a[u]))return!1;return!0}function dg(l,a,u,h,g,x){return Bi=x,Ue=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=l===null||l.memoizedState===null?Vw:Ag,Al=!1,x=u(h,g),Al=!1,zo&&(x=lw(a,u,h,g)),sw(l),x}function sw(l){I.H=bc;var a=gt!==null&&gt.next!==null;if(Bi=0,Kt=gt=Ue=null,Vf=!1,mc=0,Lo=null,a)throw Error(r(300));l===null||Gt||(l=l.dependencies,l!==null&&Rf(l)&&(Gt=!0))}function lw(l,a,u,h){Ue=l;var g=0;do{if(zo&&(Lo=null),mc=0,zo=!1,25<=g)throw Error(r(301));if(g+=1,Kt=gt=null,l.updateQueue!=null){var x=l.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}I.H=Pw,x=a(u,h)}while(zo);return x}function MR(){var l=I.H,a=l.useState()[0];return a=typeof a.then=="function"?gc(a):a,l=l.useState()[0],(gt!==null?gt.memoizedState:null)!==l&&(Ue.flags|=1024),a}function hg(){var l=Pf!==0;return Pf=0,l}function pg(l,a,u){a.updateQueue=l.updateQueue,a.flags&=-2053,l.lanes&=~u}function mg(l){if(Vf){for(l=l.memoizedState;l!==null;){var a=l.queue;a!==null&&(a.pending=null),l=l.next}Vf=!1}Bi=0,Kt=gt=Ue=null,zo=!1,mc=Pf=0,Lo=null}function Hn(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?Ue.memoizedState=Kt=l:Kt=Kt.next=l,Kt}function $t(){if(gt===null){var l=Ue.alternate;l=l!==null?l.memoizedState:null}else l=gt.next;var a=Kt===null?Ue.memoizedState:Kt.next;if(a!==null)Kt=a,gt=l;else{if(l===null)throw Ue.alternate===null?Error(r(467)):Error(r(310));gt=l,l={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Kt===null?Ue.memoizedState=Kt=l:Kt=Kt.next=l}return Kt}function Ff(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function gc(l){var a=mc;return mc+=1,Lo===null&&(Lo=[]),l=WS(Lo,l,a),a=Ue,(Kt===null?a.memoizedState:Kt.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?Vw:Ag),l}function $f(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return gc(l);if(l.$$typeof===z)return bn(l)}throw Error(r(438,String(l)))}function gg(l){var a=null,u=Ue.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=Ue.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=Ff(),Ue.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(l),h=0;h<l;h++)u[h]=ie;return a.index++,u}function ji(l,a){return typeof a=="function"?a(l):a}function qf(l){var a=$t();return yg(a,gt,l)}function yg(l,a,u){var h=l.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var g=l.baseQueue,x=h.pending;if(x!==null){if(g!==null){var w=g.next;g.next=x.next,x.next=w}a.baseQueue=g=x,h.pending=null}if(x=l.baseState,g===null)l.memoizedState=x;else{a=g.next;var E=w=null,D=null,P=a,K=!1;do{var X=P.lane&-536870913;if(X!==P.lane?(Qe&X)===X:(Bi&X)===X){var $=P.revertLane;if($===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),X===Oo&&(K=!0);else if((Bi&$)===$){P=P.next,$===Oo&&(K=!0);continue}else X={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(E=D=X,w=x):D=D.next=X,Ue.lanes|=$,Cs|=$;X=P.action,Al&&u(x,X),x=P.hasEagerState?P.eagerState:u(x,X)}else $={lane:X,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(E=D=$,w=x):D=D.next=$,Ue.lanes|=X,Cs|=X;P=P.next}while(P!==null&&P!==a);if(D===null?w=x:D.next=E,!ur(x,l.memoizedState)&&(Gt=!0,K&&(u=_o,u!==null)))throw u;l.memoizedState=x,l.baseState=w,l.baseQueue=D,h.lastRenderedState=x}return g===null&&(h.lanes=0),[l.memoizedState,h.dispatch]}function bg(l){var a=$t(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=l;var h=u.dispatch,g=u.pending,x=a.memoizedState;if(g!==null){u.pending=null;var w=g=g.next;do x=l(x,w.action),w=w.next;while(w!==g);ur(x,a.memoizedState)||(Gt=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,h]}function ow(l,a,u){var h=Ue,g=$t(),x=rt;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var w=!ur((gt||g).memoizedState,u);if(w&&(g.memoizedState=u,Gt=!0),g=g.queue,wg(uw.bind(null,h,g,l),[l]),g.getSnapshot!==a||w||Kt!==null&&Kt.memoizedState.tag&1){if(h.flags|=2048,Io(9,{destroy:void 0},cw.bind(null,h,g,u,a),null),wt===null)throw Error(r(349));x||(Bi&127)!==0||aw(h,a,u)}return u}function aw(l,a,u){l.flags|=16384,l={getSnapshot:a,value:u},a=Ue.updateQueue,a===null?(a=Ff(),Ue.updateQueue=a,a.stores=[l]):(u=a.stores,u===null?a.stores=[l]:u.push(l))}function cw(l,a,u,h){a.value=u,a.getSnapshot=h,fw(a)&&dw(l)}function uw(l,a,u){return u(function(){fw(a)&&dw(l)})}function fw(l){var a=l.getSnapshot;l=l.value;try{var u=a();return!ur(l,u)}catch{return!0}}function dw(l){var a=bl(l,2);a!==null&&er(a,l,2)}function xg(l){var a=Hn();if(typeof l=="function"){var u=l;if(l=u(),Al){It(!0);try{u()}finally{It(!1)}}}return a.memoizedState=a.baseState=l,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ji,lastRenderedState:l},a}function hw(l,a,u,h){return l.baseState=u,yg(l,gt,typeof h=="function"?h:ji)}function OR(l,a,u,h,g){if(Gf(l))throw Error(r(485));if(l=a.action,l!==null){var x={payload:g,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};I.T!==null?u(!0):x.isTransition=!1,h(x),u=a.pending,u===null?(x.next=a.pending=x,pw(a,x)):(x.next=u.next,a.pending=u.next=x)}}function pw(l,a){var u=a.action,h=a.payload,g=l.state;if(a.isTransition){var x=I.T,w={};I.T=w;try{var E=u(g,h),D=I.S;D!==null&&D(w,E),mw(l,a,E)}catch(P){Sg(l,a,P)}finally{x!==null&&w.types!==null&&(x.types=w.types),I.T=x}}else try{x=u(g,h),mw(l,a,x)}catch(P){Sg(l,a,P)}}function mw(l,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){gw(l,a,h)},function(h){return Sg(l,a,h)}):gw(l,a,u)}function gw(l,a,u){a.status="fulfilled",a.value=u,yw(a),l.state=u,a=l.pending,a!==null&&(u=a.next,u===a?l.pending=null:(u=u.next,a.next=u,pw(l,u)))}function Sg(l,a,u){var h=l.pending;if(l.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,yw(a),a=a.next;while(a!==h)}l.action=null}function yw(l){l=l.listeners;for(var a=0;a<l.length;a++)(0,l[a])()}function bw(l,a){return a}function xw(l,a){if(rt){var u=wt.formState;if(u!==null){e:{var h=Ue;if(rt){if(Ot){t:{for(var g=Ot,x=Rr;g.nodeType!==8;){if(!x){g=null;break t}if(g=zr(g.nextSibling),g===null){g=null;break t}}x=g.data,g=x==="F!"||x==="F"?g:null}if(g){Ot=zr(g.nextSibling),h=g.data==="F!";break e}}ms(h)}h=!1}h&&(a=u[0])}}return u=Hn(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bw,lastRenderedState:a},u.queue=h,u=jw.bind(null,Ue,h),h.dispatch=u,h=xg(!1),x=Tg.bind(null,Ue,!1,h.queue),h=Hn(),g={state:a,dispatch:null,action:l,pending:null},h.queue=g,u=OR.bind(null,Ue,g,x,u),g.dispatch=u,h.memoizedState=l,[a,u,!1]}function Sw(l){var a=$t();return ww(a,gt,l)}function ww(l,a,u){if(a=yg(l,a,bw)[0],l=qf(ji)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=gc(a)}catch(w){throw w===Do?Lf:w}else h=a;a=$t();var g=a.queue,x=g.dispatch;return u!==a.memoizedState&&(Ue.flags|=2048,Io(9,{destroy:void 0},_R.bind(null,g,u),null)),[h,x,l]}function _R(l,a){l.action=a}function vw(l){var a=$t(),u=gt;if(u!==null)return ww(a,u,l);$t(),a=a.memoizedState,u=$t();var h=u.queue.dispatch;return u.memoizedState=l,[a,h,!1]}function Io(l,a,u,h){return l={tag:l,create:u,deps:h,inst:a,next:null},a=Ue.updateQueue,a===null&&(a=Ff(),Ue.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=l.next=l:(h=u.next,u.next=l,l.next=h,a.lastEffect=l),l}function kw(){return $t().memoizedState}function Yf(l,a,u,h){var g=Hn();Ue.flags|=l,g.memoizedState=Io(1|a,{destroy:void 0},u,h===void 0?null:h)}function Kf(l,a,u,h){var g=$t();h=h===void 0?null:h;var x=g.memoizedState.inst;gt!==null&&h!==null&&fg(h,gt.memoizedState.deps)?g.memoizedState=Io(a,x,u,h):(Ue.flags|=l,g.memoizedState=Io(1|a,x,u,h))}function Cw(l,a){Yf(8390656,8,l,a)}function wg(l,a){Kf(2048,8,l,a)}function DR(l){Ue.flags|=4;var a=Ue.updateQueue;if(a===null)a=Ff(),Ue.updateQueue=a,a.events=[l];else{var u=a.events;u===null?a.events=[l]:u.push(l)}}function Ew(l){var a=$t().memoizedState;return DR({ref:a,nextImpl:l}),function(){if((ut&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Tw(l,a){return Kf(4,2,l,a)}function Aw(l,a){return Kf(4,4,l,a)}function Mw(l,a){if(typeof a=="function"){l=l();var u=a(l);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return l=l(),a.current=l,function(){a.current=null}}function Ow(l,a,u){u=u!=null?u.concat([l]):null,Kf(4,4,Mw.bind(null,a,l),u)}function vg(){}function _w(l,a){var u=$t();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&fg(a,h[1])?h[0]:(u.memoizedState=[l,a],l)}function Dw(l,a){var u=$t();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&fg(a,h[1]))return h[0];if(h=l(),Al){It(!0);try{l()}finally{It(!1)}}return u.memoizedState=[h,a],h}function kg(l,a,u){return u===void 0||(Bi&1073741824)!==0&&(Qe&261930)===0?l.memoizedState=a:(l.memoizedState=u,l=Rv(),Ue.lanes|=l,Cs|=l,u)}function Rw(l,a,u,h){return ur(u,a)?u:No.current!==null?(l=kg(l,u,h),ur(l,a)||(Gt=!0),l):(Bi&42)===0||(Bi&1073741824)!==0&&(Qe&261930)===0?(Gt=!0,l.memoizedState=u):(l=Rv(),Ue.lanes|=l,Cs|=l,a)}function Nw(l,a,u,h,g){var x=Y.p;Y.p=x!==0&&8>x?x:8;var w=I.T,E={};I.T=E,Tg(l,!1,a,u);try{var D=g(),P=I.S;if(P!==null&&P(E,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var K=TR(D,h);yc(l,a,K,gr(l))}else yc(l,a,h,gr(l))}catch(X){yc(l,a,{then:function(){},status:"rejected",reason:X},gr())}finally{Y.p=x,w!==null&&E.types!==null&&(w.types=E.types),I.T=w}}function RR(){}function Cg(l,a,u,h){if(l.tag!==5)throw Error(r(476));var g=zw(l).queue;Nw(l,g,a,me,u===null?RR:function(){return Lw(l),u(h)})}function zw(l){var a=l.memoizedState;if(a!==null)return a;a={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ji,lastRenderedState:me},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ji,lastRenderedState:u},next:null},l.memoizedState=a,l=l.alternate,l!==null&&(l.memoizedState=a),a}function Lw(l){var a=zw(l);a.next===null&&(a=l.alternate.memoizedState),yc(l,a.next.queue,{},gr())}function Eg(){return bn(zc)}function Iw(){return $t().memoizedState}function Bw(){return $t().memoizedState}function NR(l){for(var a=l.return;a!==null;){switch(a.tag){case 24:case 3:var u=gr();l=bs(u);var h=xs(a,l,u);h!==null&&(er(h,a,u),dc(h,a,u)),a={cache:eg()},l.payload=a;return}a=a.return}}function zR(l,a,u){var h=gr();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Gf(l)?Uw(a,u):(u=Fm(l,a,u,h),u!==null&&(er(u,l,h),Hw(u,a,h)))}function jw(l,a,u){var h=gr();yc(l,a,u,h)}function yc(l,a,u,h){var g={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Gf(l))Uw(a,g);else{var x=l.alternate;if(l.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,E=x(w,u);if(g.hasEagerState=!0,g.eagerState=E,ur(E,w))return Mf(l,a,g,0),wt===null&&Af(),!1}catch{}finally{}if(u=Fm(l,a,g,h),u!==null)return er(u,l,h),Hw(u,a,h),!0}return!1}function Tg(l,a,u,h){if(h={lane:2,revertLane:iy(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Gf(l)){if(a)throw Error(r(479))}else a=Fm(l,u,h,2),a!==null&&er(a,l,2)}function Gf(l){var a=l.alternate;return l===Ue||a!==null&&a===Ue}function Uw(l,a){zo=Vf=!0;var u=l.pending;u===null?a.next=a:(a.next=u.next,u.next=a),l.pending=a}function Hw(l,a,u){if((u&4194048)!==0){var h=a.lanes;h&=l.pendingLanes,u|=h,a.lanes=u,qx(l,u)}}var bc={readContext:bn,use:$f,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};bc.useEffectEvent=Bt;var Vw={readContext:bn,use:$f,useCallback:function(l,a){return Hn().memoizedState=[l,a===void 0?null:a],l},useContext:bn,useEffect:Cw,useImperativeHandle:function(l,a,u){u=u!=null?u.concat([l]):null,Yf(4194308,4,Mw.bind(null,a,l),u)},useLayoutEffect:function(l,a){return Yf(4194308,4,l,a)},useInsertionEffect:function(l,a){Yf(4,2,l,a)},useMemo:function(l,a){var u=Hn();a=a===void 0?null:a;var h=l();if(Al){It(!0);try{l()}finally{It(!1)}}return u.memoizedState=[h,a],h},useReducer:function(l,a,u){var h=Hn();if(u!==void 0){var g=u(a);if(Al){It(!0);try{u(a)}finally{It(!1)}}}else g=a;return h.memoizedState=h.baseState=g,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:g},h.queue=l,l=l.dispatch=zR.bind(null,Ue,l),[h.memoizedState,l]},useRef:function(l){var a=Hn();return l={current:l},a.memoizedState=l},useState:function(l){l=xg(l);var a=l.queue,u=jw.bind(null,Ue,a);return a.dispatch=u,[l.memoizedState,u]},useDebugValue:vg,useDeferredValue:function(l,a){var u=Hn();return kg(u,l,a)},useTransition:function(){var l=xg(!1);return l=Nw.bind(null,Ue,l.queue,!0,!1),Hn().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,a,u){var h=Ue,g=Hn();if(rt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),wt===null)throw Error(r(349));(Qe&127)!==0||aw(h,a,u)}g.memoizedState=u;var x={value:u,getSnapshot:a};return g.queue=x,Cw(uw.bind(null,h,x,l),[l]),h.flags|=2048,Io(9,{destroy:void 0},cw.bind(null,h,x,u,a),null),u},useId:function(){var l=Hn(),a=wt.identifierPrefix;if(rt){var u=ci,h=ai;u=(h&~(1<<32-nt(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Pf++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=AR++,a="_"+a+"r_"+u.toString(32)+"_";return l.memoizedState=a},useHostTransitionStatus:Eg,useFormState:xw,useActionState:xw,useOptimistic:function(l){var a=Hn();a.memoizedState=a.baseState=l;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Tg.bind(null,Ue,!0,u),u.dispatch=a,[l,a]},useMemoCache:gg,useCacheRefresh:function(){return Hn().memoizedState=NR.bind(null,Ue)},useEffectEvent:function(l){var a=Hn(),u={impl:l};return a.memoizedState=u,function(){if((ut&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},Ag={readContext:bn,use:$f,useCallback:_w,useContext:bn,useEffect:wg,useImperativeHandle:Ow,useInsertionEffect:Tw,useLayoutEffect:Aw,useMemo:Dw,useReducer:qf,useRef:kw,useState:function(){return qf(ji)},useDebugValue:vg,useDeferredValue:function(l,a){var u=$t();return Rw(u,gt.memoizedState,l,a)},useTransition:function(){var l=qf(ji)[0],a=$t().memoizedState;return[typeof l=="boolean"?l:gc(l),a]},useSyncExternalStore:ow,useId:Iw,useHostTransitionStatus:Eg,useFormState:Sw,useActionState:Sw,useOptimistic:function(l,a){var u=$t();return hw(u,gt,l,a)},useMemoCache:gg,useCacheRefresh:Bw};Ag.useEffectEvent=Ew;var Pw={readContext:bn,use:$f,useCallback:_w,useContext:bn,useEffect:wg,useImperativeHandle:Ow,useInsertionEffect:Tw,useLayoutEffect:Aw,useMemo:Dw,useReducer:bg,useRef:kw,useState:function(){return bg(ji)},useDebugValue:vg,useDeferredValue:function(l,a){var u=$t();return gt===null?kg(u,l,a):Rw(u,gt.memoizedState,l,a)},useTransition:function(){var l=bg(ji)[0],a=$t().memoizedState;return[typeof l=="boolean"?l:gc(l),a]},useSyncExternalStore:ow,useId:Iw,useHostTransitionStatus:Eg,useFormState:vw,useActionState:vw,useOptimistic:function(l,a){var u=$t();return gt!==null?hw(u,gt,l,a):(u.baseState=l,[l,u.queue.dispatch])},useMemoCache:gg,useCacheRefresh:Bw};Pw.useEffectEvent=Ew;function Mg(l,a,u,h){a=l.memoizedState,u=u(h,a),u=u==null?a:m({},a,u),l.memoizedState=u,l.lanes===0&&(l.updateQueue.baseState=u)}var Og={enqueueSetState:function(l,a,u){l=l._reactInternals;var h=gr(),g=bs(h);g.payload=a,u!=null&&(g.callback=u),a=xs(l,g,h),a!==null&&(er(a,l,h),dc(a,l,h))},enqueueReplaceState:function(l,a,u){l=l._reactInternals;var h=gr(),g=bs(h);g.tag=1,g.payload=a,u!=null&&(g.callback=u),a=xs(l,g,h),a!==null&&(er(a,l,h),dc(a,l,h))},enqueueForceUpdate:function(l,a){l=l._reactInternals;var u=gr(),h=bs(u);h.tag=2,a!=null&&(h.callback=a),a=xs(l,h,u),a!==null&&(er(a,l,u),dc(a,l,u))}};function Fw(l,a,u,h,g,x,w){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(h,x,w):a.prototype&&a.prototype.isPureReactComponent?!ic(u,h)||!ic(g,x):!0}function $w(l,a,u,h){l=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==l&&Og.enqueueReplaceState(a,a.state,null)}function Ml(l,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(l=l.defaultProps){u===a&&(u=m({},u));for(var g in l)u[g]===void 0&&(u[g]=l[g])}return u}function qw(l){Tf(l)}function Yw(l){console.error(l)}function Kw(l){Tf(l)}function Zf(l,a){try{var u=l.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function Gw(l,a,u){try{var h=l.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function _g(l,a,u){return u=bs(u),u.tag=3,u.payload={element:null},u.callback=function(){Zf(l,a)},u}function Zw(l){return l=bs(l),l.tag=3,l}function Ww(l,a,u,h){var g=u.type.getDerivedStateFromError;if(typeof g=="function"){var x=h.value;l.payload=function(){return g(x)},l.callback=function(){Gw(a,u,h)}}var w=u.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(l.callback=function(){Gw(a,u,h),typeof g!="function"&&(Es===null?Es=new Set([this]):Es.add(this));var E=h.stack;this.componentDidCatch(h.value,{componentStack:E!==null?E:""})})}function LR(l,a,u,h,g){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Mo(a,u,g,!0),u=dr.current,u!==null){switch(u.tag){case 31:case 13:return Nr===null?od():u.alternate===null&&jt===0&&(jt=3),u.flags&=-257,u.flags|=65536,u.lanes=g,h===If?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),ty(l,h,g)),!1;case 22:return u.flags|=65536,h===If?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),ty(l,h,g)),!1}throw Error(r(435,u.tag))}return ty(l,h,g),od(),!1}if(rt)return a=dr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,h!==Zm&&(l=Error(r(422),{cause:h}),oc(Or(l,u)))):(h!==Zm&&(a=Error(r(423),{cause:h}),oc(Or(a,u))),l=l.current.alternate,l.flags|=65536,g&=-g,l.lanes|=g,h=Or(h,u),g=_g(l.stateNode,h,g),lg(l,g),jt!==4&&(jt=2)),!1;var x=Error(r(520),{cause:h});if(x=Or(x,u),Tc===null?Tc=[x]:Tc.push(x),jt!==4&&(jt=2),a===null)return!0;h=Or(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,l=g&-g,u.lanes|=l,l=_g(u.stateNode,h,l),lg(u,l),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Es===null||!Es.has(x))))return u.flags|=65536,g&=-g,u.lanes|=g,g=Zw(g),Ww(g,l,u,h),lg(u,g),!1}u=u.return}while(u!==null);return!1}var Dg=Error(r(461)),Gt=!1;function xn(l,a,u,h){a.child=l===null?ew(a,null,u,h):Tl(a,l.child,u,h)}function Jw(l,a,u,h,g){u=u.render;var x=a.ref;if("ref"in h){var w={};for(var E in h)E!=="ref"&&(w[E]=h[E])}else w=h;return vl(a),h=dg(l,a,u,w,x,g),E=hg(),l!==null&&!Gt?(pg(l,a,g),Ui(l,a,g)):(rt&&E&&Km(a),a.flags|=1,xn(l,a,h,g),a.child)}function Xw(l,a,u,h,g){if(l===null){var x=u.type;return typeof x=="function"&&!$m(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,Qw(l,a,x,h,g)):(l=_f(u.type,null,h,a,a.mode,g),l.ref=a.ref,l.return=a,a.child=l)}if(x=l.child,!Ug(l,g)){var w=x.memoizedProps;if(u=u.compare,u=u!==null?u:ic,u(w,h)&&l.ref===a.ref)return Ui(l,a,g)}return a.flags|=1,l=Ni(x,h),l.ref=a.ref,l.return=a,a.child=l}function Qw(l,a,u,h,g){if(l!==null){var x=l.memoizedProps;if(ic(x,h)&&l.ref===a.ref)if(Gt=!1,a.pendingProps=h=x,Ug(l,g))(l.flags&131072)!==0&&(Gt=!0);else return a.lanes=l.lanes,Ui(l,a,g)}return Rg(l,a,u,h,g)}function ev(l,a,u,h){var g=h.children,x=l!==null?l.memoizedState:null;if(l===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,l!==null){for(h=a.child=l.child,g=0;h!==null;)g=g|h.lanes|h.childLanes,h=h.sibling;h=g&~x}else h=0,a.child=null;return tv(l,a,x,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},l!==null&&zf(a,x!==null?x.cachePool:null),x!==null?rw(a,x):ag(),iw(a);else return h=a.lanes=536870912,tv(l,a,x!==null?x.baseLanes|u:u,u,h)}else x!==null?(zf(a,x.cachePool),rw(a,x),ws(),a.memoizedState=null):(l!==null&&zf(a,null),ag(),ws());return xn(l,a,g,u),a.child}function xc(l,a){return l!==null&&l.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function tv(l,a,u,h,g){var x=ng();return x=x===null?null:{parent:Yt._currentValue,pool:x},a.memoizedState={baseLanes:u,cachePool:x},l!==null&&zf(a,null),ag(),iw(a),l!==null&&Mo(l,a,h,!0),a.childLanes=g,null}function Wf(l,a){return a=Xf({mode:a.mode,children:a.children},l.mode),a.ref=l.ref,l.child=a,a.return=l,a}function nv(l,a,u){return Tl(a,l.child,null,u),l=Wf(a,a.pendingProps),l.flags|=2,hr(a),a.memoizedState=null,l}function IR(l,a,u){var h=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,l===null){if(rt){if(h.mode==="hidden")return l=Wf(a,h),a.lanes=536870912,xc(null,l);if(ug(a),(l=Ot)?(l=pk(l,Rr),l=l!==null&&l.data==="&"?l:null,l!==null&&(a.memoizedState={dehydrated:l,treeContext:hs!==null?{id:ai,overflow:ci}:null,retryLane:536870912,hydrationErrors:null},u=US(l),u.return=a,a.child=u,yn=a,Ot=null)):l=null,l===null)throw ms(a);return a.lanes=536870912,null}return Wf(a,h)}var x=l.memoizedState;if(x!==null){var w=x.dehydrated;if(ug(a),g)if(a.flags&256)a.flags&=-257,a=nv(l,a,u);else if(a.memoizedState!==null)a.child=l.child,a.flags|=128,a=null;else throw Error(r(558));else if(Gt||Mo(l,a,u,!1),g=(u&l.childLanes)!==0,Gt||g){if(h=wt,h!==null&&(w=Yx(h,u),w!==0&&w!==x.retryLane))throw x.retryLane=w,bl(l,w),er(h,l,w),Dg;od(),a=nv(l,a,u)}else l=x.treeContext,Ot=zr(w.nextSibling),yn=a,rt=!0,ps=null,Rr=!1,l!==null&&PS(a,l),a=Wf(a,h),a.flags|=4096;return a}return l=Ni(l.child,{mode:h.mode,children:h.children}),l.ref=a.ref,a.child=l,l.return=a,l}function Jf(l,a){var u=a.ref;if(u===null)l!==null&&l.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(l===null||l.ref!==u)&&(a.flags|=4194816)}}function Rg(l,a,u,h,g){return vl(a),u=dg(l,a,u,h,void 0,g),h=hg(),l!==null&&!Gt?(pg(l,a,g),Ui(l,a,g)):(rt&&h&&Km(a),a.flags|=1,xn(l,a,u,g),a.child)}function rv(l,a,u,h,g,x){return vl(a),a.updateQueue=null,u=lw(a,h,u,g),sw(l),h=hg(),l!==null&&!Gt?(pg(l,a,x),Ui(l,a,x)):(rt&&h&&Km(a),a.flags|=1,xn(l,a,u,x),a.child)}function iv(l,a,u,h,g){if(vl(a),a.stateNode===null){var x=Co,w=u.contextType;typeof w=="object"&&w!==null&&(x=bn(w)),x=new u(h,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Og,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=h,x.state=a.memoizedState,x.refs={},ig(a),w=u.contextType,x.context=typeof w=="object"&&w!==null?bn(w):Co,x.state=a.memoizedState,w=u.getDerivedStateFromProps,typeof w=="function"&&(Mg(a,u,w,h),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Og.enqueueReplaceState(x,x.state,null),pc(a,h,x,g),hc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(l===null){x=a.stateNode;var E=a.memoizedProps,D=Ml(u,E);x.props=D;var P=x.context,K=u.contextType;w=Co,typeof K=="object"&&K!==null&&(w=bn(K));var X=u.getDerivedStateFromProps;K=typeof X=="function"||typeof x.getSnapshotBeforeUpdate=="function",E=a.pendingProps!==E,K||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E||P!==w)&&$w(a,x,h,w),ys=!1;var $=a.memoizedState;x.state=$,pc(a,h,x,g),hc(),P=a.memoizedState,E||$!==P||ys?(typeof X=="function"&&(Mg(a,u,X,h),P=a.memoizedState),(D=ys||Fw(a,u,D,h,$,P,w))?(K||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=P),x.props=h,x.state=P,x.context=w,h=D):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{x=a.stateNode,sg(l,a),w=a.memoizedProps,K=Ml(u,w),x.props=K,X=a.pendingProps,$=x.context,P=u.contextType,D=Co,typeof P=="object"&&P!==null&&(D=bn(P)),E=u.getDerivedStateFromProps,(P=typeof E=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==X||$!==D)&&$w(a,x,h,D),ys=!1,$=a.memoizedState,x.state=$,pc(a,h,x,g),hc();var q=a.memoizedState;w!==X||$!==q||ys||l!==null&&l.dependencies!==null&&Rf(l.dependencies)?(typeof E=="function"&&(Mg(a,u,E,h),q=a.memoizedState),(K=ys||Fw(a,u,K,h,$,q,D)||l!==null&&l.dependencies!==null&&Rf(l.dependencies))?(P||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(h,q,D),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(h,q,D)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===l.memoizedProps&&$===l.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===l.memoizedProps&&$===l.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=q),x.props=h,x.state=q,x.context=D,h=K):(typeof x.componentDidUpdate!="function"||w===l.memoizedProps&&$===l.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===l.memoizedProps&&$===l.memoizedState||(a.flags|=1024),h=!1)}return x=h,Jf(l,a),h=(a.flags&128)!==0,x||h?(x=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,l!==null&&h?(a.child=Tl(a,l.child,null,g),a.child=Tl(a,null,u,g)):xn(l,a,u,g),a.memoizedState=x.state,l=a.child):l=Ui(l,a,g),l}function sv(l,a,u,h){return Sl(),a.flags|=256,xn(l,a,u,h),a.child}var Ng={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zg(l){return{baseLanes:l,cachePool:GS()}}function Lg(l,a,u){return l=l!==null?l.childLanes&~u:0,a&&(l|=mr),l}function lv(l,a,u){var h=a.pendingProps,g=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=l!==null&&l.memoizedState===null?!1:(Ft.current&2)!==0),w&&(g=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,l===null){if(rt){if(g?Ss(a):ws(),(l=Ot)?(l=pk(l,Rr),l=l!==null&&l.data!=="&"?l:null,l!==null&&(a.memoizedState={dehydrated:l,treeContext:hs!==null?{id:ai,overflow:ci}:null,retryLane:536870912,hydrationErrors:null},u=US(l),u.return=a,a.child=u,yn=a,Ot=null)):l=null,l===null)throw ms(a);return yy(l)?a.lanes=32:a.lanes=536870912,null}var E=h.children;return h=h.fallback,g?(ws(),g=a.mode,E=Xf({mode:"hidden",children:E},g),h=xl(h,g,u,null),E.return=a,h.return=a,E.sibling=h,a.child=E,h=a.child,h.memoizedState=zg(u),h.childLanes=Lg(l,w,u),a.memoizedState=Ng,xc(null,h)):(Ss(a),Ig(a,E))}var D=l.memoizedState;if(D!==null&&(E=D.dehydrated,E!==null)){if(x)a.flags&256?(Ss(a),a.flags&=-257,a=Bg(l,a,u)):a.memoizedState!==null?(ws(),a.child=l.child,a.flags|=128,a=null):(ws(),E=h.fallback,g=a.mode,h=Xf({mode:"visible",children:h.children},g),E=xl(E,g,u,null),E.flags|=2,h.return=a,E.return=a,h.sibling=E,a.child=h,Tl(a,l.child,null,u),h=a.child,h.memoizedState=zg(u),h.childLanes=Lg(l,w,u),a.memoizedState=Ng,a=xc(null,h));else if(Ss(a),yy(E)){if(w=E.nextSibling&&E.nextSibling.dataset,w)var P=w.dgst;w=P,h=Error(r(419)),h.stack="",h.digest=w,oc({value:h,source:null,stack:null}),a=Bg(l,a,u)}else if(Gt||Mo(l,a,u,!1),w=(u&l.childLanes)!==0,Gt||w){if(w=wt,w!==null&&(h=Yx(w,u),h!==0&&h!==D.retryLane))throw D.retryLane=h,bl(l,h),er(w,l,h),Dg;gy(E)||od(),a=Bg(l,a,u)}else gy(E)?(a.flags|=192,a.child=l.child,a=null):(l=D.treeContext,Ot=zr(E.nextSibling),yn=a,rt=!0,ps=null,Rr=!1,l!==null&&PS(a,l),a=Ig(a,h.children),a.flags|=4096);return a}return g?(ws(),E=h.fallback,g=a.mode,D=l.child,P=D.sibling,h=Ni(D,{mode:"hidden",children:h.children}),h.subtreeFlags=D.subtreeFlags&65011712,P!==null?E=Ni(P,E):(E=xl(E,g,u,null),E.flags|=2),E.return=a,h.return=a,h.sibling=E,a.child=h,xc(null,h),h=a.child,E=l.child.memoizedState,E===null?E=zg(u):(g=E.cachePool,g!==null?(D=Yt._currentValue,g=g.parent!==D?{parent:D,pool:D}:g):g=GS(),E={baseLanes:E.baseLanes|u,cachePool:g}),h.memoizedState=E,h.childLanes=Lg(l,w,u),a.memoizedState=Ng,xc(l.child,h)):(Ss(a),u=l.child,l=u.sibling,u=Ni(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,l!==null&&(w=a.deletions,w===null?(a.deletions=[l],a.flags|=16):w.push(l)),a.child=u,a.memoizedState=null,u)}function Ig(l,a){return a=Xf({mode:"visible",children:a},l.mode),a.return=l,l.child=a}function Xf(l,a){return l=fr(22,l,null,a),l.lanes=0,l}function Bg(l,a,u){return Tl(a,l.child,null,u),l=Ig(a,a.pendingProps.children),l.flags|=2,a.memoizedState=null,l}function ov(l,a,u){l.lanes|=a;var h=l.alternate;h!==null&&(h.lanes|=a),Xm(l.return,a,u)}function jg(l,a,u,h,g,x){var w=l.memoizedState;w===null?l.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:g,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=h,w.tail=u,w.tailMode=g,w.treeForkCount=x)}function av(l,a,u){var h=a.pendingProps,g=h.revealOrder,x=h.tail;h=h.children;var w=Ft.current,E=(w&2)!==0;if(E?(w=w&1|2,a.flags|=128):w&=1,A(Ft,w),xn(l,a,h,u),h=rt?lc:0,!E&&l!==null&&(l.flags&128)!==0)e:for(l=a.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&ov(l,u,a);else if(l.tag===19)ov(l,u,a);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break e;for(;l.sibling===null;){if(l.return===null||l.return===a)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(g){case"forwards":for(u=a.child,g=null;u!==null;)l=u.alternate,l!==null&&Hf(l)===null&&(g=u),u=u.sibling;u=g,u===null?(g=a.child,a.child=null):(g=u.sibling,u.sibling=null),jg(a,!1,g,u,x,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,g=a.child,a.child=null;g!==null;){if(l=g.alternate,l!==null&&Hf(l)===null){a.child=g;break}l=g.sibling,g.sibling=u,u=g,g=l}jg(a,!0,u,null,x,h);break;case"together":jg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Ui(l,a,u){if(l!==null&&(a.dependencies=l.dependencies),Cs|=a.lanes,(u&a.childLanes)===0)if(l!==null){if(Mo(l,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(l!==null&&a.child!==l.child)throw Error(r(153));if(a.child!==null){for(l=a.child,u=Ni(l,l.pendingProps),a.child=u,u.return=a;l.sibling!==null;)l=l.sibling,u=u.sibling=Ni(l,l.pendingProps),u.return=a;u.sibling=null}return a.child}function Ug(l,a){return(l.lanes&a)!==0?!0:(l=l.dependencies,!!(l!==null&&Rf(l)))}function BR(l,a,u){switch(a.tag){case 3:Ge(a,a.stateNode.containerInfo),gs(a,Yt,l.memoizedState.cache),Sl();break;case 27:case 5:dt(a);break;case 4:Ge(a,a.stateNode.containerInfo);break;case 10:gs(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,ug(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Ss(a),a.flags|=128,null):(u&a.child.childLanes)!==0?lv(l,a,u):(Ss(a),l=Ui(l,a,u),l!==null?l.sibling:null);Ss(a);break;case 19:var g=(l.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Mo(l,a,u,!1),h=(u&a.childLanes)!==0),g){if(h)return av(l,a,u);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),A(Ft,Ft.current),h)break;return null;case 22:return a.lanes=0,ev(l,a,u,a.pendingProps);case 24:gs(a,Yt,l.memoizedState.cache)}return Ui(l,a,u)}function cv(l,a,u){if(l!==null)if(l.memoizedProps!==a.pendingProps)Gt=!0;else{if(!Ug(l,u)&&(a.flags&128)===0)return Gt=!1,BR(l,a,u);Gt=(l.flags&131072)!==0}else Gt=!1,rt&&(a.flags&1048576)!==0&&VS(a,lc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(l=Cl(a.elementType),a.type=l,typeof l=="function")$m(l)?(h=Ml(l,h),a.tag=1,a=iv(null,a,l,h,u)):(a.tag=0,a=Rg(null,a,l,h,u));else{if(l!=null){var g=l.$$typeof;if(g===re){a.tag=11,a=Jw(null,a,l,h,u);break e}else if(g===L){a.tag=14,a=Xw(null,a,l,h,u);break e}}throw a=ne(l)||l,Error(r(306,a,""))}}return a;case 0:return Rg(l,a,a.type,a.pendingProps,u);case 1:return h=a.type,g=Ml(h,a.pendingProps),iv(l,a,h,g,u);case 3:e:{if(Ge(a,a.stateNode.containerInfo),l===null)throw Error(r(387));h=a.pendingProps;var x=a.memoizedState;g=x.element,sg(l,a),pc(a,h,null,u);var w=a.memoizedState;if(h=w.cache,gs(a,Yt,h),h!==x.cache&&Qm(a,[Yt],u,!0),hc(),h=w.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=sv(l,a,h,u);break e}else if(h!==g){g=Or(Error(r(424)),a),oc(g),a=sv(l,a,h,u);break e}else{switch(l=a.stateNode.containerInfo,l.nodeType){case 9:l=l.body;break;default:l=l.nodeName==="HTML"?l.ownerDocument.body:l}for(Ot=zr(l.firstChild),yn=a,rt=!0,ps=null,Rr=!0,u=ew(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Sl(),h===g){a=Ui(l,a,u);break e}xn(l,a,h,u)}a=a.child}return a;case 26:return Jf(l,a),l===null?(u=Sk(a.type,null,a.pendingProps,null))?a.memoizedState=u:rt||(u=a.type,l=a.pendingProps,h=pd(ge.current).createElement(u),h[gn]=a,h[Gn]=l,Sn(h,u,l),sn(h),a.stateNode=h):a.memoizedState=Sk(a.type,l.memoizedProps,a.pendingProps,l.memoizedState),null;case 27:return dt(a),l===null&&rt&&(h=a.stateNode=yk(a.type,a.pendingProps,ge.current),yn=a,Rr=!0,g=Ot,Os(a.type)?(by=g,Ot=zr(h.firstChild)):Ot=g),xn(l,a,a.pendingProps.children,u),Jf(l,a),l===null&&(a.flags|=4194304),a.child;case 5:return l===null&&rt&&((g=h=Ot)&&(h=hN(h,a.type,a.pendingProps,Rr),h!==null?(a.stateNode=h,yn=a,Ot=zr(h.firstChild),Rr=!1,g=!0):g=!1),g||ms(a)),dt(a),g=a.type,x=a.pendingProps,w=l!==null?l.memoizedProps:null,h=x.children,hy(g,x)?h=null:w!==null&&hy(g,w)&&(a.flags|=32),a.memoizedState!==null&&(g=dg(l,a,MR,null,null,u),zc._currentValue=g),Jf(l,a),xn(l,a,h,u),a.child;case 6:return l===null&&rt&&((l=u=Ot)&&(u=pN(u,a.pendingProps,Rr),u!==null?(a.stateNode=u,yn=a,Ot=null,l=!0):l=!1),l||ms(a)),null;case 13:return lv(l,a,u);case 4:return Ge(a,a.stateNode.containerInfo),h=a.pendingProps,l===null?a.child=Tl(a,null,h,u):xn(l,a,h,u),a.child;case 11:return Jw(l,a,a.type,a.pendingProps,u);case 7:return xn(l,a,a.pendingProps,u),a.child;case 8:return xn(l,a,a.pendingProps.children,u),a.child;case 12:return xn(l,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,gs(a,a.type,h.value),xn(l,a,h.children,u),a.child;case 9:return g=a.type._context,h=a.pendingProps.children,vl(a),g=bn(g),h=h(g),a.flags|=1,xn(l,a,h,u),a.child;case 14:return Xw(l,a,a.type,a.pendingProps,u);case 15:return Qw(l,a,a.type,a.pendingProps,u);case 19:return av(l,a,u);case 31:return IR(l,a,u);case 22:return ev(l,a,u,a.pendingProps);case 24:return vl(a),h=bn(Yt),l===null?(g=ng(),g===null&&(g=wt,x=eg(),g.pooledCache=x,x.refCount++,x!==null&&(g.pooledCacheLanes|=u),g=x),a.memoizedState={parent:h,cache:g},ig(a),gs(a,Yt,g)):((l.lanes&u)!==0&&(sg(l,a),pc(a,null,null,u),hc()),g=l.memoizedState,x=a.memoizedState,g.parent!==h?(g={parent:h,cache:h},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),gs(a,Yt,h)):(h=x.cache,gs(a,Yt,h),h!==g.cache&&Qm(a,[Yt],u,!0))),xn(l,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Hi(l){l.flags|=4}function Hg(l,a,u,h,g){if((a=(l.mode&32)!==0)&&(a=!1),a){if(l.flags|=16777216,(g&335544128)===g)if(l.stateNode.complete)l.flags|=8192;else if(Iv())l.flags|=8192;else throw El=If,rg}else l.flags&=-16777217}function uv(l,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)l.flags&=-16777217;else if(l.flags|=16777216,!Ek(a))if(Iv())l.flags|=8192;else throw El=If,rg}function Qf(l,a){a!==null&&(l.flags|=4),l.flags&16384&&(a=l.tag!==22?Fx():536870912,l.lanes|=a,Ho|=a)}function Sc(l,a){if(!rt)switch(l.tailMode){case"hidden":a=l.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?l.tail=null:u.sibling=null;break;case"collapsed":u=l.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||l.tail===null?l.tail=null:l.tail.sibling=null:h.sibling=null}}function _t(l){var a=l.alternate!==null&&l.alternate.child===l.child,u=0,h=0;if(a)for(var g=l.child;g!==null;)u|=g.lanes|g.childLanes,h|=g.subtreeFlags&65011712,h|=g.flags&65011712,g.return=l,g=g.sibling;else for(g=l.child;g!==null;)u|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=l,g=g.sibling;return l.subtreeFlags|=h,l.childLanes=u,a}function jR(l,a,u){var h=a.pendingProps;switch(Gm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(a),null;case 1:return _t(a),null;case 3:return u=a.stateNode,h=null,l!==null&&(h=l.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Ii(Yt),qe(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(l===null||l.child===null)&&(Ao(a)?Hi(a):l===null||l.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Wm())),_t(a),null;case 26:var g=a.type,x=a.memoizedState;return l===null?(Hi(a),x!==null?(_t(a),uv(a,x)):(_t(a),Hg(a,g,null,h,u))):x?x!==l.memoizedState?(Hi(a),_t(a),uv(a,x)):(_t(a),a.flags&=-16777217):(l=l.memoizedProps,l!==h&&Hi(a),_t(a),Hg(a,g,l,h,u)),null;case 27:if(Me(a),u=ge.current,g=a.type,l!==null&&a.stateNode!=null)l.memoizedProps!==h&&Hi(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return _t(a),null}l=te.current,Ao(a)?FS(a):(l=yk(g,h,u),a.stateNode=l,Hi(a))}return _t(a),null;case 5:if(Me(a),g=a.type,l!==null&&a.stateNode!=null)l.memoizedProps!==h&&Hi(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return _t(a),null}if(x=te.current,Ao(a))FS(a);else{var w=pd(ge.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?w.createElement("select",{is:h.is}):w.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?w.createElement(g,{is:h.is}):w.createElement(g)}}x[gn]=a,x[Gn]=h;e:for(w=a.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=x;e:switch(Sn(x,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Hi(a)}}return _t(a),Hg(a,a.type,l===null?null:l.memoizedProps,a.pendingProps,u),null;case 6:if(l&&a.stateNode!=null)l.memoizedProps!==h&&Hi(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(l=ge.current,Ao(a)){if(l=a.stateNode,u=a.memoizedProps,h=null,g=yn,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}l[gn]=a,l=!!(l.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||lk(l.nodeValue,u)),l||ms(a,!0)}else l=pd(l).createTextNode(h),l[gn]=a,a.stateNode=l}return _t(a),null;case 31:if(u=a.memoizedState,l===null||l.memoizedState!==null){if(h=Ao(a),u!==null){if(l===null){if(!h)throw Error(r(318));if(l=a.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(557));l[gn]=a}else Sl(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),l=!1}else u=Wm(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=u),l=!0;if(!l)return a.flags&256?(hr(a),a):(hr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return _t(a),null;case 13:if(h=a.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(g=Ao(a),h!==null&&h.dehydrated!==null){if(l===null){if(!g)throw Error(r(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[gn]=a}else Sl(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),g=!1}else g=Wm(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(hr(a),a):(hr(a),null)}return hr(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,l=l!==null&&l.memoizedState!==null,u&&(h=a.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==g&&(h.flags|=2048)),u!==l&&u&&(a.child.flags|=8192),Qf(a,a.updateQueue),_t(a),null);case 4:return qe(),l===null&&ay(a.stateNode.containerInfo),_t(a),null;case 10:return Ii(a.type),_t(a),null;case 19:if(H(Ft),h=a.memoizedState,h===null)return _t(a),null;if(g=(a.flags&128)!==0,x=h.rendering,x===null)if(g)Sc(h,!1);else{if(jt!==0||l!==null&&(l.flags&128)!==0)for(l=a.child;l!==null;){if(x=Hf(l),x!==null){for(a.flags|=128,Sc(h,!1),l=x.updateQueue,a.updateQueue=l,Qf(a,l),a.subtreeFlags=0,l=u,u=a.child;u!==null;)jS(u,l),u=u.sibling;return A(Ft,Ft.current&1|2),rt&&zi(a,h.treeForkCount),a.child}l=l.sibling}h.tail!==null&&Pe()>id&&(a.flags|=128,g=!0,Sc(h,!1),a.lanes=4194304)}else{if(!g)if(l=Hf(x),l!==null){if(a.flags|=128,g=!0,l=l.updateQueue,a.updateQueue=l,Qf(a,l),Sc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!x.alternate&&!rt)return _t(a),null}else 2*Pe()-h.renderingStartTime>id&&u!==536870912&&(a.flags|=128,g=!0,Sc(h,!1),a.lanes=4194304);h.isBackwards?(x.sibling=a.child,a.child=x):(l=h.last,l!==null?l.sibling=x:a.child=x,h.last=x)}return h.tail!==null?(l=h.tail,h.rendering=l,h.tail=l.sibling,h.renderingStartTime=Pe(),l.sibling=null,u=Ft.current,A(Ft,g?u&1|2:u&1),rt&&zi(a,h.treeForkCount),l):(_t(a),null);case 22:case 23:return hr(a),cg(),h=a.memoizedState!==null,l!==null?l.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(_t(a),a.subtreeFlags&6&&(a.flags|=8192)):_t(a),u=a.updateQueue,u!==null&&Qf(a,u.retryQueue),u=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),l!==null&&H(kl),null;case 24:return u=null,l!==null&&(u=l.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Ii(Yt),_t(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function UR(l,a){switch(Gm(a),a.tag){case 1:return l=a.flags,l&65536?(a.flags=l&-65537|128,a):null;case 3:return Ii(Yt),qe(),l=a.flags,(l&65536)!==0&&(l&128)===0?(a.flags=l&-65537|128,a):null;case 26:case 27:case 5:return Me(a),null;case 31:if(a.memoizedState!==null){if(hr(a),a.alternate===null)throw Error(r(340));Sl()}return l=a.flags,l&65536?(a.flags=l&-65537|128,a):null;case 13:if(hr(a),l=a.memoizedState,l!==null&&l.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Sl()}return l=a.flags,l&65536?(a.flags=l&-65537|128,a):null;case 19:return H(Ft),null;case 4:return qe(),null;case 10:return Ii(a.type),null;case 22:case 23:return hr(a),cg(),l!==null&&H(kl),l=a.flags,l&65536?(a.flags=l&-65537|128,a):null;case 24:return Ii(Yt),null;case 25:return null;default:return null}}function fv(l,a){switch(Gm(a),a.tag){case 3:Ii(Yt),qe();break;case 26:case 27:case 5:Me(a);break;case 4:qe();break;case 31:a.memoizedState!==null&&hr(a);break;case 13:hr(a);break;case 19:H(Ft);break;case 10:Ii(a.type);break;case 22:case 23:hr(a),cg(),l!==null&&H(kl);break;case 24:Ii(Yt)}}function wc(l,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var g=h.next;u=g;do{if((u.tag&l)===l){h=void 0;var x=u.create,w=u.inst;h=x(),w.destroy=h}u=u.next}while(u!==g)}}catch(E){pt(a,a.return,E)}}function vs(l,a,u){try{var h=a.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var x=g.next;h=x;do{if((h.tag&l)===l){var w=h.inst,E=w.destroy;if(E!==void 0){w.destroy=void 0,g=a;var D=u,P=E;try{P()}catch(K){pt(g,D,K)}}}h=h.next}while(h!==x)}}catch(K){pt(a,a.return,K)}}function dv(l){var a=l.updateQueue;if(a!==null){var u=l.stateNode;try{nw(a,u)}catch(h){pt(l,l.return,h)}}}function hv(l,a,u){u.props=Ml(l.type,l.memoizedProps),u.state=l.memoizedState;try{u.componentWillUnmount()}catch(h){pt(l,a,h)}}function vc(l,a){try{var u=l.ref;if(u!==null){switch(l.tag){case 26:case 27:case 5:var h=l.stateNode;break;case 30:h=l.stateNode;break;default:h=l.stateNode}typeof u=="function"?l.refCleanup=u(h):u.current=h}}catch(g){pt(l,a,g)}}function ui(l,a){var u=l.ref,h=l.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(g){pt(l,a,g)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(g){pt(l,a,g)}else u.current=null}function pv(l){var a=l.type,u=l.memoizedProps,h=l.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(g){pt(l,l.return,g)}}function Vg(l,a,u){try{var h=l.stateNode;oN(h,l.type,u,a),h[Gn]=a}catch(g){pt(l,l.return,g)}}function mv(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&Os(l.type)||l.tag===4}function Pg(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||mv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&Os(l.type)||l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Fg(l,a,u){var h=l.tag;if(h===5||h===6)l=l.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(l,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(l),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Di));else if(h!==4&&(h===27&&Os(l.type)&&(u=l.stateNode,a=null),l=l.child,l!==null))for(Fg(l,a,u),l=l.sibling;l!==null;)Fg(l,a,u),l=l.sibling}function ed(l,a,u){var h=l.tag;if(h===5||h===6)l=l.stateNode,a?u.insertBefore(l,a):u.appendChild(l);else if(h!==4&&(h===27&&Os(l.type)&&(u=l.stateNode),l=l.child,l!==null))for(ed(l,a,u),l=l.sibling;l!==null;)ed(l,a,u),l=l.sibling}function gv(l){var a=l.stateNode,u=l.memoizedProps;try{for(var h=l.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);Sn(a,h,u),a[gn]=l,a[Gn]=u}catch(x){pt(l,l.return,x)}}var Vi=!1,Zt=!1,$g=!1,yv=typeof WeakSet=="function"?WeakSet:Set,ln=null;function HR(l,a){if(l=l.containerInfo,fy=wd,l=OS(l),Bm(l)){if("selectionStart"in l)var u={start:l.selectionStart,end:l.selectionEnd};else e:{u=(u=l.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var g=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var w=0,E=-1,D=-1,P=0,K=0,X=l,$=null;t:for(;;){for(var q;X!==u||g!==0&&X.nodeType!==3||(E=w+g),X!==x||h!==0&&X.nodeType!==3||(D=w+h),X.nodeType===3&&(w+=X.nodeValue.length),(q=X.firstChild)!==null;)$=X,X=q;for(;;){if(X===l)break t;if($===u&&++P===g&&(E=w),$===x&&++K===h&&(D=w),(q=X.nextSibling)!==null)break;X=$,$=X.parentNode}X=q}u=E===-1||D===-1?null:{start:E,end:D}}else u=null}u=u||{start:0,end:0}}else u=null;for(dy={focusedElem:l,selectionRange:u},wd=!1,ln=a;ln!==null;)if(a=ln,l=a.child,(a.subtreeFlags&1028)!==0&&l!==null)l.return=a,ln=l;else for(;ln!==null;){switch(a=ln,x=a.alternate,l=a.flags,a.tag){case 0:if((l&4)!==0&&(l=a.updateQueue,l=l!==null?l.events:null,l!==null))for(u=0;u<l.length;u++)g=l[u],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((l&1024)!==0&&x!==null){l=void 0,u=a,g=x.memoizedProps,x=x.memoizedState,h=u.stateNode;try{var be=Ml(u.type,g);l=h.getSnapshotBeforeUpdate(be,x),h.__reactInternalSnapshotBeforeUpdate=l}catch(Oe){pt(u,u.return,Oe)}}break;case 3:if((l&1024)!==0){if(l=a.stateNode.containerInfo,u=l.nodeType,u===9)my(l);else if(u===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":my(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((l&1024)!==0)throw Error(r(163))}if(l=a.sibling,l!==null){l.return=a.return,ln=l;break}ln=a.return}}function bv(l,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:Fi(l,u),h&4&&wc(5,u);break;case 1:if(Fi(l,u),h&4)if(l=u.stateNode,a===null)try{l.componentDidMount()}catch(w){pt(u,u.return,w)}else{var g=Ml(u.type,a.memoizedProps);a=a.memoizedState;try{l.componentDidUpdate(g,a,l.__reactInternalSnapshotBeforeUpdate)}catch(w){pt(u,u.return,w)}}h&64&&dv(u),h&512&&vc(u,u.return);break;case 3:if(Fi(l,u),h&64&&(l=u.updateQueue,l!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{nw(l,a)}catch(w){pt(u,u.return,w)}}break;case 27:a===null&&h&4&&gv(u);case 26:case 5:Fi(l,u),a===null&&h&4&&pv(u),h&512&&vc(u,u.return);break;case 12:Fi(l,u);break;case 31:Fi(l,u),h&4&&wv(l,u);break;case 13:Fi(l,u),h&4&&vv(l,u),h&64&&(l=u.memoizedState,l!==null&&(l=l.dehydrated,l!==null&&(u=ZR.bind(null,u),mN(l,u))));break;case 22:if(h=u.memoizedState!==null||Vi,!h){a=a!==null&&a.memoizedState!==null||Zt,g=Vi;var x=Zt;Vi=h,(Zt=a)&&!x?$i(l,u,(u.subtreeFlags&8772)!==0):Fi(l,u),Vi=g,Zt=x}break;case 30:break;default:Fi(l,u)}}function xv(l){var a=l.alternate;a!==null&&(l.alternate=null,xv(a)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(a=l.stateNode,a!==null&&Sm(a)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}var Rt=null,Wn=!1;function Pi(l,a,u){for(u=u.child;u!==null;)Sv(l,a,u),u=u.sibling}function Sv(l,a,u){if(lt&&typeof lt.onCommitFiberUnmount=="function")try{lt.onCommitFiberUnmount(it,u)}catch{}switch(u.tag){case 26:Zt||ui(u,a),Pi(l,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Zt||ui(u,a);var h=Rt,g=Wn;Os(u.type)&&(Rt=u.stateNode,Wn=!1),Pi(l,a,u),Dc(u.stateNode),Rt=h,Wn=g;break;case 5:Zt||ui(u,a);case 6:if(h=Rt,g=Wn,Rt=null,Pi(l,a,u),Rt=h,Wn=g,Rt!==null)if(Wn)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(u.stateNode)}catch(x){pt(u,a,x)}else try{Rt.removeChild(u.stateNode)}catch(x){pt(u,a,x)}break;case 18:Rt!==null&&(Wn?(l=Rt,dk(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,u.stateNode),Go(l)):dk(Rt,u.stateNode));break;case 4:h=Rt,g=Wn,Rt=u.stateNode.containerInfo,Wn=!0,Pi(l,a,u),Rt=h,Wn=g;break;case 0:case 11:case 14:case 15:vs(2,u,a),Zt||vs(4,u,a),Pi(l,a,u);break;case 1:Zt||(ui(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&hv(u,a,h)),Pi(l,a,u);break;case 21:Pi(l,a,u);break;case 22:Zt=(h=Zt)||u.memoizedState!==null,Pi(l,a,u),Zt=h;break;default:Pi(l,a,u)}}function wv(l,a){if(a.memoizedState===null&&(l=a.alternate,l!==null&&(l=l.memoizedState,l!==null))){l=l.dehydrated;try{Go(l)}catch(u){pt(a,a.return,u)}}}function vv(l,a){if(a.memoizedState===null&&(l=a.alternate,l!==null&&(l=l.memoizedState,l!==null&&(l=l.dehydrated,l!==null))))try{Go(l)}catch(u){pt(a,a.return,u)}}function VR(l){switch(l.tag){case 31:case 13:case 19:var a=l.stateNode;return a===null&&(a=l.stateNode=new yv),a;case 22:return l=l.stateNode,a=l._retryCache,a===null&&(a=l._retryCache=new yv),a;default:throw Error(r(435,l.tag))}}function td(l,a){var u=VR(l);a.forEach(function(h){if(!u.has(h)){u.add(h);var g=WR.bind(null,l,h);h.then(g,g)}})}function Jn(l,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var g=u[h],x=l,w=a,E=w;e:for(;E!==null;){switch(E.tag){case 27:if(Os(E.type)){Rt=E.stateNode,Wn=!1;break e}break;case 5:Rt=E.stateNode,Wn=!1;break e;case 3:case 4:Rt=E.stateNode.containerInfo,Wn=!0;break e}E=E.return}if(Rt===null)throw Error(r(160));Sv(x,w,g),Rt=null,Wn=!1,x=g.alternate,x!==null&&(x.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)kv(a,l),a=a.sibling}var Jr=null;function kv(l,a){var u=l.alternate,h=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:Jn(a,l),Xn(l),h&4&&(vs(3,l,l.return),wc(3,l),vs(5,l,l.return));break;case 1:Jn(a,l),Xn(l),h&512&&(Zt||u===null||ui(u,u.return)),h&64&&Vi&&(l=l.updateQueue,l!==null&&(h=l.callbacks,h!==null&&(u=l.shared.hiddenCallbacks,l.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var g=Jr;if(Jn(a,l),Xn(l),h&512&&(Zt||u===null||ui(u,u.return)),h&4){var x=u!==null?u.memoizedState:null;if(h=l.memoizedState,u===null)if(h===null)if(l.stateNode===null){e:{h=l.type,u=l.memoizedProps,g=g.ownerDocument||g;t:switch(h){case"title":x=g.getElementsByTagName("title")[0],(!x||x[Za]||x[gn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=g.createElement(h),g.head.insertBefore(x,g.querySelector("head > title"))),Sn(x,h,u),x[gn]=l,sn(x),h=x;break e;case"link":var w=kk("link","href",g).get(h+(u.href||""));if(w){for(var E=0;E<w.length;E++)if(x=w[E],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){w.splice(E,1);break t}}x=g.createElement(h),Sn(x,h,u),g.head.appendChild(x);break;case"meta":if(w=kk("meta","content",g).get(h+(u.content||""))){for(E=0;E<w.length;E++)if(x=w[E],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){w.splice(E,1);break t}}x=g.createElement(h),Sn(x,h,u),g.head.appendChild(x);break;default:throw Error(r(468,h))}x[gn]=l,sn(x),h=x}l.stateNode=h}else Ck(g,l.type,l.stateNode);else l.stateNode=vk(g,h,l.memoizedProps);else x!==h?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,h===null?Ck(g,l.type,l.stateNode):vk(g,h,l.memoizedProps)):h===null&&l.stateNode!==null&&Vg(l,l.memoizedProps,u.memoizedProps)}break;case 27:Jn(a,l),Xn(l),h&512&&(Zt||u===null||ui(u,u.return)),u!==null&&h&4&&Vg(l,l.memoizedProps,u.memoizedProps);break;case 5:if(Jn(a,l),Xn(l),h&512&&(Zt||u===null||ui(u,u.return)),l.flags&32){g=l.stateNode;try{yo(g,"")}catch(be){pt(l,l.return,be)}}h&4&&l.stateNode!=null&&(g=l.memoizedProps,Vg(l,g,u!==null?u.memoizedProps:g)),h&1024&&($g=!0);break;case 6:if(Jn(a,l),Xn(l),h&4){if(l.stateNode===null)throw Error(r(162));h=l.memoizedProps,u=l.stateNode;try{u.nodeValue=h}catch(be){pt(l,l.return,be)}}break;case 3:if(yd=null,g=Jr,Jr=md(a.containerInfo),Jn(a,l),Jr=g,Xn(l),h&4&&u!==null&&u.memoizedState.isDehydrated)try{Go(a.containerInfo)}catch(be){pt(l,l.return,be)}$g&&($g=!1,Cv(l));break;case 4:h=Jr,Jr=md(l.stateNode.containerInfo),Jn(a,l),Xn(l),Jr=h;break;case 12:Jn(a,l),Xn(l);break;case 31:Jn(a,l),Xn(l),h&4&&(h=l.updateQueue,h!==null&&(l.updateQueue=null,td(l,h)));break;case 13:Jn(a,l),Xn(l),l.child.flags&8192&&l.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(rd=Pe()),h&4&&(h=l.updateQueue,h!==null&&(l.updateQueue=null,td(l,h)));break;case 22:g=l.memoizedState!==null;var D=u!==null&&u.memoizedState!==null,P=Vi,K=Zt;if(Vi=P||g,Zt=K||D,Jn(a,l),Zt=K,Vi=P,Xn(l),h&8192)e:for(a=l.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(u===null||D||Vi||Zt||Ol(l)),u=null,a=l;;){if(a.tag===5||a.tag===26){if(u===null){D=u=a;try{if(x=D.stateNode,g)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{E=D.stateNode;var X=D.memoizedProps.style,$=X!=null&&X.hasOwnProperty("display")?X.display:null;E.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(be){pt(D,D.return,be)}}}else if(a.tag===6){if(u===null){D=a;try{D.stateNode.nodeValue=g?"":D.memoizedProps}catch(be){pt(D,D.return,be)}}}else if(a.tag===18){if(u===null){D=a;try{var q=D.stateNode;g?hk(q,!0):hk(D.stateNode,!1)}catch(be){pt(D,D.return,be)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===l)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=l.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,td(l,u))));break;case 19:Jn(a,l),Xn(l),h&4&&(h=l.updateQueue,h!==null&&(l.updateQueue=null,td(l,h)));break;case 30:break;case 21:break;default:Jn(a,l),Xn(l)}}function Xn(l){var a=l.flags;if(a&2){try{for(var u,h=l.return;h!==null;){if(mv(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var g=u.stateNode,x=Pg(l);ed(l,x,g);break;case 5:var w=u.stateNode;u.flags&32&&(yo(w,""),u.flags&=-33);var E=Pg(l);ed(l,E,w);break;case 3:case 4:var D=u.stateNode.containerInfo,P=Pg(l);Fg(l,P,D);break;default:throw Error(r(161))}}catch(K){pt(l,l.return,K)}l.flags&=-3}a&4096&&(l.flags&=-4097)}function Cv(l){if(l.subtreeFlags&1024)for(l=l.child;l!==null;){var a=l;Cv(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),l=l.sibling}}function Fi(l,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)bv(l,a.alternate,a),a=a.sibling}function Ol(l){for(l=l.child;l!==null;){var a=l;switch(a.tag){case 0:case 11:case 14:case 15:vs(4,a,a.return),Ol(a);break;case 1:ui(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&hv(a,a.return,u),Ol(a);break;case 27:Dc(a.stateNode);case 26:case 5:ui(a,a.return),Ol(a);break;case 22:a.memoizedState===null&&Ol(a);break;case 30:Ol(a);break;default:Ol(a)}l=l.sibling}}function $i(l,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,g=l,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:$i(g,x,u),wc(4,x);break;case 1:if($i(g,x,u),h=x,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(P){pt(h,h.return,P)}if(h=x,g=h.updateQueue,g!==null){var E=h.stateNode;try{var D=g.shared.hiddenCallbacks;if(D!==null)for(g.shared.hiddenCallbacks=null,g=0;g<D.length;g++)tw(D[g],E)}catch(P){pt(h,h.return,P)}}u&&w&64&&dv(x),vc(x,x.return);break;case 27:gv(x);case 26:case 5:$i(g,x,u),u&&h===null&&w&4&&pv(x),vc(x,x.return);break;case 12:$i(g,x,u);break;case 31:$i(g,x,u),u&&w&4&&wv(g,x);break;case 13:$i(g,x,u),u&&w&4&&vv(g,x);break;case 22:x.memoizedState===null&&$i(g,x,u),vc(x,x.return);break;case 30:break;default:$i(g,x,u)}a=a.sibling}}function qg(l,a){var u=null;l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),l=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==u&&(l!=null&&l.refCount++,u!=null&&ac(u))}function Yg(l,a){l=null,a.alternate!==null&&(l=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==l&&(a.refCount++,l!=null&&ac(l))}function Xr(l,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Ev(l,a,u,h),a=a.sibling}function Ev(l,a,u,h){var g=a.flags;switch(a.tag){case 0:case 11:case 15:Xr(l,a,u,h),g&2048&&wc(9,a);break;case 1:Xr(l,a,u,h);break;case 3:Xr(l,a,u,h),g&2048&&(l=null,a.alternate!==null&&(l=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==l&&(a.refCount++,l!=null&&ac(l)));break;case 12:if(g&2048){Xr(l,a,u,h),l=a.stateNode;try{var x=a.memoizedProps,w=x.id,E=x.onPostCommit;typeof E=="function"&&E(w,a.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(D){pt(a,a.return,D)}}else Xr(l,a,u,h);break;case 31:Xr(l,a,u,h);break;case 13:Xr(l,a,u,h);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?Xr(l,a,u,h):kc(l,a):x._visibility&2?Xr(l,a,u,h):(x._visibility|=2,Bo(l,a,u,h,(a.subtreeFlags&10256)!==0||!1)),g&2048&&qg(w,a);break;case 24:Xr(l,a,u,h),g&2048&&Yg(a.alternate,a);break;default:Xr(l,a,u,h)}}function Bo(l,a,u,h,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=l,w=a,E=u,D=h,P=w.flags;switch(w.tag){case 0:case 11:case 15:Bo(x,w,E,D,g),wc(8,w);break;case 23:break;case 22:var K=w.stateNode;w.memoizedState!==null?K._visibility&2?Bo(x,w,E,D,g):kc(x,w):(K._visibility|=2,Bo(x,w,E,D,g)),g&&P&2048&&qg(w.alternate,w);break;case 24:Bo(x,w,E,D,g),g&&P&2048&&Yg(w.alternate,w);break;default:Bo(x,w,E,D,g)}a=a.sibling}}function kc(l,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=l,h=a,g=h.flags;switch(h.tag){case 22:kc(u,h),g&2048&&qg(h.alternate,h);break;case 24:kc(u,h),g&2048&&Yg(h.alternate,h);break;default:kc(u,h)}a=a.sibling}}var Cc=8192;function jo(l,a,u){if(l.subtreeFlags&Cc)for(l=l.child;l!==null;)Tv(l,a,u),l=l.sibling}function Tv(l,a,u){switch(l.tag){case 26:jo(l,a,u),l.flags&Cc&&l.memoizedState!==null&&AN(u,Jr,l.memoizedState,l.memoizedProps);break;case 5:jo(l,a,u);break;case 3:case 4:var h=Jr;Jr=md(l.stateNode.containerInfo),jo(l,a,u),Jr=h;break;case 22:l.memoizedState===null&&(h=l.alternate,h!==null&&h.memoizedState!==null?(h=Cc,Cc=16777216,jo(l,a,u),Cc=h):jo(l,a,u));break;default:jo(l,a,u)}}function Av(l){var a=l.alternate;if(a!==null&&(l=a.child,l!==null)){a.child=null;do a=l.sibling,l.sibling=null,l=a;while(l!==null)}}function Ec(l){var a=l.deletions;if((l.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];ln=h,Ov(h,l)}Av(l)}if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Mv(l),l=l.sibling}function Mv(l){switch(l.tag){case 0:case 11:case 15:Ec(l),l.flags&2048&&vs(9,l,l.return);break;case 3:Ec(l);break;case 12:Ec(l);break;case 22:var a=l.stateNode;l.memoizedState!==null&&a._visibility&2&&(l.return===null||l.return.tag!==13)?(a._visibility&=-3,nd(l)):Ec(l);break;default:Ec(l)}}function nd(l){var a=l.deletions;if((l.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];ln=h,Ov(h,l)}Av(l)}for(l=l.child;l!==null;){switch(a=l,a.tag){case 0:case 11:case 15:vs(8,a,a.return),nd(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,nd(a));break;default:nd(a)}l=l.sibling}}function Ov(l,a){for(;ln!==null;){var u=ln;switch(u.tag){case 0:case 11:case 15:vs(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:ac(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,ln=h;else e:for(u=l;ln!==null;){h=ln;var g=h.sibling,x=h.return;if(xv(h),h===u){ln=null;break e}if(g!==null){g.return=x,ln=g;break e}ln=x}}}var PR={getCacheForType:function(l){var a=bn(Yt),u=a.data.get(l);return u===void 0&&(u=l(),a.data.set(l,u)),u},cacheSignal:function(){return bn(Yt).controller.signal}},FR=typeof WeakMap=="function"?WeakMap:Map,ut=0,wt=null,We=null,Qe=0,ht=0,pr=null,ks=!1,Uo=!1,Kg=!1,qi=0,jt=0,Cs=0,_l=0,Gg=0,mr=0,Ho=0,Tc=null,Qn=null,Zg=!1,rd=0,_v=0,id=1/0,sd=null,Es=null,nn=0,Ts=null,Vo=null,Yi=0,Wg=0,Jg=null,Dv=null,Ac=0,Xg=null;function gr(){return(ut&2)!==0&&Qe!==0?Qe&-Qe:I.T!==null?iy():Kx()}function Rv(){if(mr===0)if((Qe&536870912)===0||rt){var l=hf;hf<<=1,(hf&3932160)===0&&(hf=262144),mr=l}else mr=536870912;return l=dr.current,l!==null&&(l.flags|=32),mr}function er(l,a,u){(l===wt&&(ht===2||ht===9)||l.cancelPendingCommit!==null)&&(Po(l,0),As(l,Qe,mr,!1)),Ga(l,u),((ut&2)===0||l!==wt)&&(l===wt&&((ut&2)===0&&(_l|=u),jt===4&&As(l,Qe,mr,!1)),fi(l))}function Nv(l,a,u){if((ut&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&l.expiredLanes)===0||Ka(l,a),g=h?YR(l,a):ey(l,a,!0),x=h;do{if(g===0){Uo&&!h&&As(l,a,0,!1);break}else{if(u=l.current.alternate,x&&!$R(u)){g=ey(l,a,!1),x=!1;continue}if(g===2){if(x=a,l.errorRecoveryDisabledLanes&x)var w=0;else w=l.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var E=l;g=Tc;var D=E.current.memoizedState.isDehydrated;if(D&&(Po(E,w).flags|=256),w=ey(E,w,!1),w!==2){if(Kg&&!D){E.errorRecoveryDisabledLanes|=x,_l|=x,g=4;break e}x=Qn,Qn=g,x!==null&&(Qn===null?Qn=x:Qn.push.apply(Qn,x))}g=w}if(x=!1,g!==2)continue}}if(g===1){Po(l,0),As(l,a,0,!0);break}e:{switch(h=l,x=g,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:As(h,a,mr,!ks);break e;case 2:Qn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(g=rd+300-Pe(),10<g)){if(As(h,a,mr,!ks),mf(h,0,!0)!==0)break e;Yi=a,h.timeoutHandle=uk(zv.bind(null,h,u,Qn,sd,Zg,a,mr,_l,Ho,ks,x,"Throttled",-0,0),g);break e}zv(h,u,Qn,sd,Zg,a,mr,_l,Ho,ks,x,null,-0,0)}}break}while(!0);fi(l)}function zv(l,a,u,h,g,x,w,E,D,P,K,X,$,q){if(l.timeoutHandle=-1,X=a.subtreeFlags,X&8192||(X&16785408)===16785408){X={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Di},Tv(a,x,X);var be=(x&62914560)===x?rd-Pe():(x&4194048)===x?_v-Pe():0;if(be=MN(X,be),be!==null){Yi=x,l.cancelPendingCommit=be(Pv.bind(null,l,a,x,u,h,g,w,E,D,K,X,null,$,q)),As(l,x,w,!P);return}}Pv(l,a,x,u,h,g,w,E,D)}function $R(l){for(var a=l;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var g=u[h],x=g.getSnapshot;g=g.value;try{if(!ur(x(),g))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===l)break;for(;a.sibling===null;){if(a.return===null||a.return===l)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function As(l,a,u,h){a&=~Gg,a&=~_l,l.suspendedLanes|=a,l.pingedLanes&=~a,h&&(l.warmLanes|=a),h=l.expirationTimes;for(var g=a;0<g;){var x=31-nt(g),w=1<<x;h[x]=-1,g&=~w}u!==0&&$x(l,u,a)}function ld(){return(ut&6)===0?(Mc(0),!1):!0}function Qg(){if(We!==null){if(ht===0)var l=We.return;else l=We,Li=wl=null,mg(l),Ro=null,uc=0,l=We;for(;l!==null;)fv(l.alternate,l),l=l.return;We=null}}function Po(l,a){var u=l.timeoutHandle;u!==-1&&(l.timeoutHandle=-1,uN(u)),u=l.cancelPendingCommit,u!==null&&(l.cancelPendingCommit=null,u()),Yi=0,Qg(),wt=l,We=u=Ni(l.current,null),Qe=a,ht=0,pr=null,ks=!1,Uo=Ka(l,a),Kg=!1,Ho=mr=Gg=_l=Cs=jt=0,Qn=Tc=null,Zg=!1,(a&8)!==0&&(a|=a&32);var h=l.entangledLanes;if(h!==0)for(l=l.entanglements,h&=a;0<h;){var g=31-nt(h),x=1<<g;a|=l[g],h&=~x}return qi=a,Af(),u}function Lv(l,a){Ue=null,I.H=bc,a===Do||a===Lf?(a=JS(),ht=3):a===rg?(a=JS(),ht=4):ht=a===Dg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,pr=a,We===null&&(jt=1,Zf(l,Or(a,l.current)))}function Iv(){var l=dr.current;return l===null?!0:(Qe&4194048)===Qe?Nr===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?l===Nr:!1}function Bv(){var l=I.H;return I.H=bc,l===null?bc:l}function jv(){var l=I.A;return I.A=PR,l}function od(){jt=4,ks||(Qe&4194048)!==Qe&&dr.current!==null||(Uo=!0),(Cs&134217727)===0&&(_l&134217727)===0||wt===null||As(wt,Qe,mr,!1)}function ey(l,a,u){var h=ut;ut|=2;var g=Bv(),x=jv();(wt!==l||Qe!==a)&&(sd=null,Po(l,a)),a=!1;var w=jt;e:do try{if(ht!==0&&We!==null){var E=We,D=pr;switch(ht){case 8:Qg(),w=6;break e;case 3:case 2:case 9:case 6:dr.current===null&&(a=!0);var P=ht;if(ht=0,pr=null,Fo(l,E,D,P),u&&Uo){w=0;break e}break;default:P=ht,ht=0,pr=null,Fo(l,E,D,P)}}qR(),w=jt;break}catch(K){Lv(l,K)}while(!0);return a&&l.shellSuspendCounter++,Li=wl=null,ut=h,I.H=g,I.A=x,We===null&&(wt=null,Qe=0,Af()),w}function qR(){for(;We!==null;)Uv(We)}function YR(l,a){var u=ut;ut|=2;var h=Bv(),g=jv();wt!==l||Qe!==a?(sd=null,id=Pe()+500,Po(l,a)):Uo=Ka(l,a);e:do try{if(ht!==0&&We!==null){a=We;var x=pr;t:switch(ht){case 1:ht=0,pr=null,Fo(l,a,x,1);break;case 2:case 9:if(ZS(x)){ht=0,pr=null,Hv(a);break}a=function(){ht!==2&&ht!==9||wt!==l||(ht=7),fi(l)},x.then(a,a);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:ZS(x)?(ht=0,pr=null,Hv(a)):(ht=0,pr=null,Fo(l,a,x,7));break;case 5:var w=null;switch(We.tag){case 26:w=We.memoizedState;case 5:case 27:var E=We;if(w?Ek(w):E.stateNode.complete){ht=0,pr=null;var D=E.sibling;if(D!==null)We=D;else{var P=E.return;P!==null?(We=P,ad(P)):We=null}break t}}ht=0,pr=null,Fo(l,a,x,5);break;case 6:ht=0,pr=null,Fo(l,a,x,6);break;case 8:Qg(),jt=6;break e;default:throw Error(r(462))}}KR();break}catch(K){Lv(l,K)}while(!0);return Li=wl=null,I.H=h,I.A=g,ut=u,We!==null?0:(wt=null,Qe=0,Af(),jt)}function KR(){for(;We!==null&&!le();)Uv(We)}function Uv(l){var a=cv(l.alternate,l,qi);l.memoizedProps=l.pendingProps,a===null?ad(l):We=a}function Hv(l){var a=l,u=a.alternate;switch(a.tag){case 15:case 0:a=rv(u,a,a.pendingProps,a.type,void 0,Qe);break;case 11:a=rv(u,a,a.pendingProps,a.type.render,a.ref,Qe);break;case 5:mg(a);default:fv(u,a),a=We=jS(a,qi),a=cv(u,a,qi)}l.memoizedProps=l.pendingProps,a===null?ad(l):We=a}function Fo(l,a,u,h){Li=wl=null,mg(a),Ro=null,uc=0;var g=a.return;try{if(LR(l,g,a,u,Qe)){jt=1,Zf(l,Or(u,l.current)),We=null;return}}catch(x){if(g!==null)throw We=g,x;jt=1,Zf(l,Or(u,l.current)),We=null;return}a.flags&32768?(rt||h===1?l=!0:Uo||(Qe&536870912)!==0?l=!1:(ks=l=!0,(h===2||h===9||h===3||h===6)&&(h=dr.current,h!==null&&h.tag===13&&(h.flags|=16384))),Vv(a,l)):ad(a)}function ad(l){var a=l;do{if((a.flags&32768)!==0){Vv(a,ks);return}l=a.return;var u=jR(a.alternate,a,qi);if(u!==null){We=u;return}if(a=a.sibling,a!==null){We=a;return}We=a=l}while(a!==null);jt===0&&(jt=5)}function Vv(l,a){do{var u=UR(l.alternate,l);if(u!==null){u.flags&=32767,We=u;return}if(u=l.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(l=l.sibling,l!==null)){We=l;return}We=l=u}while(l!==null);jt=6,We=null}function Pv(l,a,u,h,g,x,w,E,D){l.cancelPendingCommit=null;do cd();while(nn!==0);if((ut&6)!==0)throw Error(r(327));if(a!==null){if(a===l.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=Pm,T2(l,u,x,w,E,D),l===wt&&(We=wt=null,Qe=0),Vo=a,Ts=l,Yi=u,Wg=x,Jg=g,Dv=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(l.callbackNode=null,l.callbackPriority=0,JR(ve,function(){return Kv(),null})):(l.callbackNode=null,l.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=I.T,I.T=null,g=Y.p,Y.p=2,w=ut,ut|=4;try{HR(l,a,u)}finally{ut=w,Y.p=g,I.T=h}}nn=1,Fv(),$v(),qv()}}function Fv(){if(nn===1){nn=0;var l=Ts,a=Vo,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=I.T,I.T=null;var h=Y.p;Y.p=2;var g=ut;ut|=4;try{kv(a,l);var x=dy,w=OS(l.containerInfo),E=x.focusedElem,D=x.selectionRange;if(w!==E&&E&&E.ownerDocument&&MS(E.ownerDocument.documentElement,E)){if(D!==null&&Bm(E)){var P=D.start,K=D.end;if(K===void 0&&(K=P),"selectionStart"in E)E.selectionStart=P,E.selectionEnd=Math.min(K,E.value.length);else{var X=E.ownerDocument||document,$=X&&X.defaultView||window;if($.getSelection){var q=$.getSelection(),be=E.textContent.length,Oe=Math.min(D.start,be),bt=D.end===void 0?Oe:Math.min(D.end,be);!q.extend&&Oe>bt&&(w=bt,bt=Oe,Oe=w);var B=AS(E,Oe),N=AS(E,bt);if(B&&N&&(q.rangeCount!==1||q.anchorNode!==B.node||q.anchorOffset!==B.offset||q.focusNode!==N.node||q.focusOffset!==N.offset)){var V=X.createRange();V.setStart(B.node,B.offset),q.removeAllRanges(),Oe>bt?(q.addRange(V),q.extend(N.node,N.offset)):(V.setEnd(N.node,N.offset),q.addRange(V))}}}}for(X=[],q=E;q=q.parentNode;)q.nodeType===1&&X.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<X.length;E++){var W=X[E];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}wd=!!fy,dy=fy=null}finally{ut=g,Y.p=h,I.T=u}}l.current=a,nn=2}}function $v(){if(nn===2){nn=0;var l=Ts,a=Vo,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=I.T,I.T=null;var h=Y.p;Y.p=2;var g=ut;ut|=4;try{bv(l,a.alternate,a)}finally{ut=g,Y.p=h,I.T=u}}nn=3}}function qv(){if(nn===4||nn===3){nn=0,je();var l=Ts,a=Vo,u=Yi,h=Dv;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?nn=5:(nn=0,Vo=Ts=null,Yv(l,l.pendingLanes));var g=l.pendingLanes;if(g===0&&(Es=null),bm(u),a=a.stateNode,lt&&typeof lt.onCommitFiberRoot=="function")try{lt.onCommitFiberRoot(it,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=I.T,g=Y.p,Y.p=2,I.T=null;try{for(var x=l.onRecoverableError,w=0;w<h.length;w++){var E=h[w];x(E.value,{componentStack:E.stack})}}finally{I.T=a,Y.p=g}}(Yi&3)!==0&&cd(),fi(l),g=l.pendingLanes,(u&261930)!==0&&(g&42)!==0?l===Xg?Ac++:(Ac=0,Xg=l):Ac=0,Mc(0)}}function Yv(l,a){(l.pooledCacheLanes&=a)===0&&(a=l.pooledCache,a!=null&&(l.pooledCache=null,ac(a)))}function cd(){return Fv(),$v(),qv(),Kv()}function Kv(){if(nn!==5)return!1;var l=Ts,a=Wg;Wg=0;var u=bm(Yi),h=I.T,g=Y.p;try{Y.p=32>u?32:u,I.T=null,u=Jg,Jg=null;var x=Ts,w=Yi;if(nn=0,Vo=Ts=null,Yi=0,(ut&6)!==0)throw Error(r(331));var E=ut;if(ut|=4,Mv(x.current),Ev(x,x.current,w,u),ut=E,Mc(0,!1),lt&&typeof lt.onPostCommitFiberRoot=="function")try{lt.onPostCommitFiberRoot(it,x)}catch{}return!0}finally{Y.p=g,I.T=h,Yv(l,a)}}function Gv(l,a,u){a=Or(u,a),a=_g(l.stateNode,a,2),l=xs(l,a,2),l!==null&&(Ga(l,2),fi(l))}function pt(l,a,u){if(l.tag===3)Gv(l,l,u);else for(;a!==null;){if(a.tag===3){Gv(a,l,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Es===null||!Es.has(h))){l=Or(u,l),u=Zw(2),h=xs(a,u,2),h!==null&&(Ww(u,h,a,l),Ga(h,2),fi(h));break}}a=a.return}}function ty(l,a,u){var h=l.pingCache;if(h===null){h=l.pingCache=new FR;var g=new Set;h.set(a,g)}else g=h.get(a),g===void 0&&(g=new Set,h.set(a,g));g.has(u)||(Kg=!0,g.add(u),l=GR.bind(null,l,a,u),a.then(l,l))}function GR(l,a,u){var h=l.pingCache;h!==null&&h.delete(a),l.pingedLanes|=l.suspendedLanes&u,l.warmLanes&=~u,wt===l&&(Qe&u)===u&&(jt===4||jt===3&&(Qe&62914560)===Qe&&300>Pe()-rd?(ut&2)===0&&Po(l,0):Gg|=u,Ho===Qe&&(Ho=0)),fi(l)}function Zv(l,a){a===0&&(a=Fx()),l=bl(l,a),l!==null&&(Ga(l,a),fi(l))}function ZR(l){var a=l.memoizedState,u=0;a!==null&&(u=a.retryLane),Zv(l,u)}function WR(l,a){var u=0;switch(l.tag){case 31:case 13:var h=l.stateNode,g=l.memoizedState;g!==null&&(u=g.retryLane);break;case 19:h=l.stateNode;break;case 22:h=l.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),Zv(l,u)}function JR(l,a){return Cr(l,a)}var ud=null,$o=null,ny=!1,fd=!1,ry=!1,Ms=0;function fi(l){l!==$o&&l.next===null&&($o===null?ud=$o=l:$o=$o.next=l),fd=!0,ny||(ny=!0,QR())}function Mc(l,a){if(!ry&&fd){ry=!0;do for(var u=!1,h=ud;h!==null;){if(l!==0){var g=h.pendingLanes;if(g===0)var x=0;else{var w=h.suspendedLanes,E=h.pingedLanes;x=(1<<31-nt(42|l)+1)-1,x&=g&~(w&~E),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,Qv(h,x))}else x=Qe,x=mf(h,h===wt?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||Ka(h,x)||(u=!0,Qv(h,x));h=h.next}while(u);ry=!1}}function XR(){Wv()}function Wv(){fd=ny=!1;var l=0;Ms!==0&&cN()&&(l=Ms);for(var a=Pe(),u=null,h=ud;h!==null;){var g=h.next,x=Jv(h,a);x===0?(h.next=null,u===null?ud=g:u.next=g,g===null&&($o=u)):(u=h,(l!==0||(x&3)!==0)&&(fd=!0)),h=g}nn!==0&&nn!==5||Mc(l),Ms!==0&&(Ms=0)}function Jv(l,a){for(var u=l.suspendedLanes,h=l.pingedLanes,g=l.expirationTimes,x=l.pendingLanes&-62914561;0<x;){var w=31-nt(x),E=1<<w,D=g[w];D===-1?((E&u)===0||(E&h)!==0)&&(g[w]=E2(E,a)):D<=a&&(l.expiredLanes|=E),x&=~E}if(a=wt,u=Qe,u=mf(l,l===a?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),h=l.callbackNode,u===0||l===a&&(ht===2||ht===9)||l.cancelPendingCommit!==null)return h!==null&&h!==null&&Un(h),l.callbackNode=null,l.callbackPriority=0;if((u&3)===0||Ka(l,u)){if(a=u&-u,a===l.callbackPriority)return a;switch(h!==null&&Un(h),bm(u)){case 2:case 8:u=se;break;case 32:u=ve;break;case 268435456:u=Xe;break;default:u=ve}return h=Xv.bind(null,l),u=Cr(u,h),l.callbackPriority=a,l.callbackNode=u,a}return h!==null&&h!==null&&Un(h),l.callbackPriority=2,l.callbackNode=null,2}function Xv(l,a){if(nn!==0&&nn!==5)return l.callbackNode=null,l.callbackPriority=0,null;var u=l.callbackNode;if(cd()&&l.callbackNode!==u)return null;var h=Qe;return h=mf(l,l===wt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),h===0?null:(Nv(l,h,a),Jv(l,Pe()),l.callbackNode!=null&&l.callbackNode===u?Xv.bind(null,l):null)}function Qv(l,a){if(cd())return null;Nv(l,a,!0)}function QR(){fN(function(){(ut&6)!==0?Cr(j,XR):Wv()})}function iy(){if(Ms===0){var l=Oo;l===0&&(l=df,df<<=1,(df&261888)===0&&(df=256)),Ms=l}return Ms}function ek(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:xf(""+l)}function tk(l,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,l.id&&u.setAttribute("form",l.id),a.parentNode.insertBefore(u,a),l=new FormData(l),u.parentNode.removeChild(u),l}function eN(l,a,u,h,g){if(a==="submit"&&u&&u.stateNode===g){var x=ek((g[Gn]||null).action),w=h.submitter;w&&(a=(a=w[Gn]||null)?ek(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var E=new kf("action","action",null,h,g);l.push({event:E,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Ms!==0){var D=w?tk(g,w):new FormData(g);Cg(u,{pending:!0,data:D,method:g.method,action:x},null,D)}}else typeof x=="function"&&(E.preventDefault(),D=w?tk(g,w):new FormData(g),Cg(u,{pending:!0,data:D,method:g.method,action:x},x,D))},currentTarget:g}]})}}for(var sy=0;sy<Vm.length;sy++){var ly=Vm[sy],tN=ly.toLowerCase(),nN=ly[0].toUpperCase()+ly.slice(1);Wr(tN,"on"+nN)}Wr(RS,"onAnimationEnd"),Wr(NS,"onAnimationIteration"),Wr(zS,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(bR,"onTransitionRun"),Wr(xR,"onTransitionStart"),Wr(SR,"onTransitionCancel"),Wr(LS,"onTransitionEnd"),mo("onMouseEnter",["mouseout","mouseover"]),mo("onMouseLeave",["mouseout","mouseover"]),mo("onPointerEnter",["pointerout","pointerover"]),mo("onPointerLeave",["pointerout","pointerover"]),pl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pl("onBeforeInput",["compositionend","keypress","textInput","paste"]),pl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oc="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(" "),rN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oc));function nk(l,a){a=(a&4)!==0;for(var u=0;u<l.length;u++){var h=l[u],g=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var w=h.length-1;0<=w;w--){var E=h[w],D=E.instance,P=E.currentTarget;if(E=E.listener,D!==x&&g.isPropagationStopped())break e;x=E,g.currentTarget=P;try{x(g)}catch(K){Tf(K)}g.currentTarget=null,x=D}else for(w=0;w<h.length;w++){if(E=h[w],D=E.instance,P=E.currentTarget,E=E.listener,D!==x&&g.isPropagationStopped())break e;x=E,g.currentTarget=P;try{x(g)}catch(K){Tf(K)}g.currentTarget=null,x=D}}}}function Je(l,a){var u=a[xm];u===void 0&&(u=a[xm]=new Set);var h=l+"__bubble";u.has(h)||(rk(a,l,2,!1),u.add(h))}function oy(l,a,u){var h=0;a&&(h|=4),rk(u,l,h,a)}var dd="_reactListening"+Math.random().toString(36).slice(2);function ay(l){if(!l[dd]){l[dd]=!0,Wx.forEach(function(u){u!=="selectionchange"&&(rN.has(u)||oy(u,!1,l),oy(u,!0,l))});var a=l.nodeType===9?l:l.ownerDocument;a===null||a[dd]||(a[dd]=!0,oy("selectionchange",!1,a))}}function rk(l,a,u,h){switch(Rk(a)){case 2:var g=DN;break;case 8:g=RN;break;default:g=ky}u=g.bind(null,a,u,l),g=void 0,!Mm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),h?g!==void 0?l.addEventListener(a,u,{capture:!0,passive:g}):l.addEventListener(a,u,!0):g!==void 0?l.addEventListener(a,u,{passive:g}):l.addEventListener(a,u,!1)}function cy(l,a,u,h,g){var x=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var w=h.tag;if(w===3||w===4){var E=h.stateNode.containerInfo;if(E===g)break;if(w===4)for(w=h.return;w!==null;){var D=w.tag;if((D===3||D===4)&&w.stateNode.containerInfo===g)return;w=w.return}for(;E!==null;){if(w=fo(E),w===null)return;if(D=w.tag,D===5||D===6||D===26||D===27){h=x=w;continue e}E=E.parentNode}}h=h.return}aS(function(){var P=x,K=Tm(u),X=[];e:{var $=IS.get(l);if($!==void 0){var q=kf,be=l;switch(l){case"keypress":if(wf(u)===0)break e;case"keydown":case"keyup":q=W2;break;case"focusin":be="focus",q=Rm;break;case"focusout":be="blur",q=Rm;break;case"beforeblur":case"afterblur":q=Rm;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=fS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=j2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=Q2;break;case RS:case NS:case zS:q=V2;break;case LS:q=tR;break;case"scroll":case"scrollend":q=I2;break;case"wheel":q=rR;break;case"copy":case"cut":case"paste":q=F2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=hS;break;case"toggle":case"beforetoggle":q=sR}var Oe=(a&4)!==0,bt=!Oe&&(l==="scroll"||l==="scrollend"),B=Oe?$!==null?$+"Capture":null:$;Oe=[];for(var N=P,V;N!==null;){var W=N;if(V=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||V===null||B===null||(W=Ja(N,B),W!=null&&Oe.push(_c(N,W,V))),bt)break;N=N.return}0<Oe.length&&($=new q($,be,null,u,K),X.push({event:$,listeners:Oe}))}}if((a&7)===0){e:{if($=l==="mouseover"||l==="pointerover",q=l==="mouseout"||l==="pointerout",$&&u!==Em&&(be=u.relatedTarget||u.fromElement)&&(fo(be)||be[uo]))break e;if((q||$)&&($=K.window===K?K:($=K.ownerDocument)?$.defaultView||$.parentWindow:window,q?(be=u.relatedTarget||u.toElement,q=P,be=be?fo(be):null,be!==null&&(bt=s(be),Oe=be.tag,be!==bt||Oe!==5&&Oe!==27&&Oe!==6)&&(be=null)):(q=null,be=P),q!==be)){if(Oe=fS,W="onMouseLeave",B="onMouseEnter",N="mouse",(l==="pointerout"||l==="pointerover")&&(Oe=hS,W="onPointerLeave",B="onPointerEnter",N="pointer"),bt=q==null?$:Wa(q),V=be==null?$:Wa(be),$=new Oe(W,N+"leave",q,u,K),$.target=bt,$.relatedTarget=V,W=null,fo(K)===P&&(Oe=new Oe(B,N+"enter",be,u,K),Oe.target=V,Oe.relatedTarget=bt,W=Oe),bt=W,q&&be)t:{for(Oe=iN,B=q,N=be,V=0,W=B;W;W=Oe(W))V++;W=0;for(var Ee=N;Ee;Ee=Oe(Ee))W++;for(;0<V-W;)B=Oe(B),V--;for(;0<W-V;)N=Oe(N),W--;for(;V--;){if(B===N||N!==null&&B===N.alternate){Oe=B;break t}B=Oe(B),N=Oe(N)}Oe=null}else Oe=null;q!==null&&ik(X,$,q,Oe,!1),be!==null&&bt!==null&&ik(X,bt,be,Oe,!0)}}e:{if($=P?Wa(P):window,q=$.nodeName&&$.nodeName.toLowerCase(),q==="select"||q==="input"&&$.type==="file")var ot=wS;else if(xS($))if(vS)ot=mR;else{ot=hR;var we=dR}else q=$.nodeName,!q||q.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?P&&Cm(P.elementType)&&(ot=wS):ot=pR;if(ot&&(ot=ot(l,P))){SS(X,ot,u,K);break e}we&&we(l,$,P),l==="focusout"&&P&&$.type==="number"&&P.memoizedProps.value!=null&&km($,"number",$.value)}switch(we=P?Wa(P):window,l){case"focusin":(xS(we)||we.contentEditable==="true")&&(wo=we,jm=P,sc=null);break;case"focusout":sc=jm=wo=null;break;case"mousedown":Um=!0;break;case"contextmenu":case"mouseup":case"dragend":Um=!1,_S(X,u,K);break;case"selectionchange":if(yR)break;case"keydown":case"keyup":_S(X,u,K)}var He;if(zm)e:{switch(l){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else So?yS(l,u)&&(et="onCompositionEnd"):l==="keydown"&&u.keyCode===229&&(et="onCompositionStart");et&&(pS&&u.locale!=="ko"&&(So||et!=="onCompositionStart"?et==="onCompositionEnd"&&So&&(He=cS()):(ds=K,Om="value"in ds?ds.value:ds.textContent,So=!0)),we=hd(P,et),0<we.length&&(et=new dS(et,l,null,u,K),X.push({event:et,listeners:we}),He?et.data=He:(He=bS(u),He!==null&&(et.data=He)))),(He=oR?aR(l,u):cR(l,u))&&(et=hd(P,"onBeforeInput"),0<et.length&&(we=new dS("onBeforeInput","beforeinput",null,u,K),X.push({event:we,listeners:et}),we.data=He)),eN(X,l,P,u,K)}nk(X,a)})}function _c(l,a,u){return{instance:l,listener:a,currentTarget:u}}function hd(l,a){for(var u=a+"Capture",h=[];l!==null;){var g=l,x=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||x===null||(g=Ja(l,u),g!=null&&h.unshift(_c(l,g,x)),g=Ja(l,a),g!=null&&h.push(_c(l,g,x))),l.tag===3)return h;l=l.return}return[]}function iN(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5&&l.tag!==27);return l||null}function ik(l,a,u,h,g){for(var x=a._reactName,w=[];u!==null&&u!==h;){var E=u,D=E.alternate,P=E.stateNode;if(E=E.tag,D!==null&&D===h)break;E!==5&&E!==26&&E!==27||P===null||(D=P,g?(P=Ja(u,x),P!=null&&w.unshift(_c(u,P,D))):g||(P=Ja(u,x),P!=null&&w.push(_c(u,P,D)))),u=u.return}w.length!==0&&l.push({event:a,listeners:w})}var sN=/\r\n?/g,lN=/\u0000|\uFFFD/g;function sk(l){return(typeof l=="string"?l:""+l).replace(sN,`
49
- `).replace(lN,"")}function lk(l,a){return a=sk(a),sk(l)===a}function yt(l,a,u,h,g,x){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||yo(l,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&yo(l,""+h);break;case"className":yf(l,"class",h);break;case"tabIndex":yf(l,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":yf(l,u,h);break;case"style":lS(l,h,x);break;case"data":if(a!=="object"){yf(l,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){l.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){l.removeAttribute(u);break}h=xf(""+h),l.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){l.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(u==="formAction"?(a!=="input"&&yt(l,a,"name",g.name,g,null),yt(l,a,"formEncType",g.formEncType,g,null),yt(l,a,"formMethod",g.formMethod,g,null),yt(l,a,"formTarget",g.formTarget,g,null)):(yt(l,a,"encType",g.encType,g,null),yt(l,a,"method",g.method,g,null),yt(l,a,"target",g.target,g,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){l.removeAttribute(u);break}h=xf(""+h),l.setAttribute(u,h);break;case"onClick":h!=null&&(l.onclick=Di);break;case"onScroll":h!=null&&Je("scroll",l);break;case"onScrollEnd":h!=null&&Je("scrollend",l);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(g.children!=null)throw Error(r(60));l.innerHTML=u}}break;case"multiple":l.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":l.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){l.removeAttribute("xlink:href");break}u=xf(""+h),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?l.setAttribute(u,""+h):l.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?l.setAttribute(u,""):l.removeAttribute(u);break;case"capture":case"download":h===!0?l.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?l.setAttribute(u,h):l.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?l.setAttribute(u,h):l.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?l.removeAttribute(u):l.setAttribute(u,h);break;case"popover":Je("beforetoggle",l),Je("toggle",l),gf(l,"popover",h);break;case"xlinkActuate":_i(l,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":_i(l,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":_i(l,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":_i(l,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":_i(l,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":_i(l,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":_i(l,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":_i(l,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":_i(l,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":gf(l,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=z2.get(u)||u,gf(l,u,h))}}function uy(l,a,u,h,g,x){switch(u){case"style":lS(l,h,x);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(g.children!=null)throw Error(r(60));l.innerHTML=u}}break;case"children":typeof h=="string"?yo(l,h):(typeof h=="number"||typeof h=="bigint")&&yo(l,""+h);break;case"onScroll":h!=null&&Je("scroll",l);break;case"onScrollEnd":h!=null&&Je("scrollend",l);break;case"onClick":h!=null&&(l.onclick=Di);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jx.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(g=u.endsWith("Capture"),a=u.slice(2,g?u.length-7:void 0),x=l[Gn]||null,x=x!=null?x[u]:null,typeof x=="function"&&l.removeEventListener(a,x,g),typeof h=="function")){typeof x!="function"&&x!==null&&(u in l?l[u]=null:l.hasAttribute(u)&&l.removeAttribute(u)),l.addEventListener(a,h,g);break e}u in l?l[u]=h:h===!0?l.setAttribute(u,""):gf(l,u,h)}}}function Sn(l,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",l),Je("load",l);var h=!1,g=!1,x;for(x in u)if(u.hasOwnProperty(x)){var w=u[x];if(w!=null)switch(x){case"src":h=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(l,a,x,w,u,null)}}g&&yt(l,a,"srcSet",u.srcSet,u,null),h&&yt(l,a,"src",u.src,u,null);return;case"input":Je("invalid",l);var E=x=w=g=null,D=null,P=null;for(h in u)if(u.hasOwnProperty(h)){var K=u[h];if(K!=null)switch(h){case"name":g=K;break;case"type":w=K;break;case"checked":D=K;break;case"defaultChecked":P=K;break;case"value":x=K;break;case"defaultValue":E=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,a));break;default:yt(l,a,h,K,u,null)}}nS(l,x,E,D,P,w,g,!1);return;case"select":Je("invalid",l),h=w=x=null;for(g in u)if(u.hasOwnProperty(g)&&(E=u[g],E!=null))switch(g){case"value":x=E;break;case"defaultValue":w=E;break;case"multiple":h=E;default:yt(l,a,g,E,u,null)}a=x,u=w,l.multiple=!!h,a!=null?go(l,!!h,a,!1):u!=null&&go(l,!!h,u,!0);return;case"textarea":Je("invalid",l),x=g=h=null;for(w in u)if(u.hasOwnProperty(w)&&(E=u[w],E!=null))switch(w){case"value":h=E;break;case"defaultValue":g=E;break;case"children":x=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(r(91));break;default:yt(l,a,w,E,u,null)}iS(l,h,g,x);return;case"option":for(D in u)if(u.hasOwnProperty(D)&&(h=u[D],h!=null))switch(D){case"selected":l.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:yt(l,a,D,h,u,null)}return;case"dialog":Je("beforetoggle",l),Je("toggle",l),Je("cancel",l),Je("close",l);break;case"iframe":case"object":Je("load",l);break;case"video":case"audio":for(h=0;h<Oc.length;h++)Je(Oc[h],l);break;case"image":Je("error",l),Je("load",l);break;case"details":Je("toggle",l);break;case"embed":case"source":case"link":Je("error",l),Je("load",l);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in u)if(u.hasOwnProperty(P)&&(h=u[P],h!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(l,a,P,h,u,null)}return;default:if(Cm(a)){for(K in u)u.hasOwnProperty(K)&&(h=u[K],h!==void 0&&uy(l,a,K,h,u,void 0));return}}for(E in u)u.hasOwnProperty(E)&&(h=u[E],h!=null&&yt(l,a,E,h,u,null))}function oN(l,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,x=null,w=null,E=null,D=null,P=null,K=null;for(q in u){var X=u[q];if(u.hasOwnProperty(q)&&X!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":D=X;default:h.hasOwnProperty(q)||yt(l,a,q,null,h,X)}}for(var $ in h){var q=h[$];if(X=u[$],h.hasOwnProperty($)&&(q!=null||X!=null))switch($){case"type":x=q;break;case"name":g=q;break;case"checked":P=q;break;case"defaultChecked":K=q;break;case"value":w=q;break;case"defaultValue":E=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,a));break;default:q!==X&&yt(l,a,$,q,h,X)}}vm(l,w,E,D,P,K,x,g);return;case"select":q=w=E=$=null;for(x in u)if(D=u[x],u.hasOwnProperty(x)&&D!=null)switch(x){case"value":break;case"multiple":q=D;default:h.hasOwnProperty(x)||yt(l,a,x,null,h,D)}for(g in h)if(x=h[g],D=u[g],h.hasOwnProperty(g)&&(x!=null||D!=null))switch(g){case"value":$=x;break;case"defaultValue":E=x;break;case"multiple":w=x;default:x!==D&&yt(l,a,g,x,h,D)}a=E,u=w,h=q,$!=null?go(l,!!u,$,!1):!!h!=!!u&&(a!=null?go(l,!!u,a,!0):go(l,!!u,u?[]:"",!1));return;case"textarea":q=$=null;for(E in u)if(g=u[E],u.hasOwnProperty(E)&&g!=null&&!h.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:yt(l,a,E,null,h,g)}for(w in h)if(g=h[w],x=u[w],h.hasOwnProperty(w)&&(g!=null||x!=null))switch(w){case"value":$=g;break;case"defaultValue":q=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==x&&yt(l,a,w,g,h,x)}rS(l,$,q);return;case"option":for(var be in u)if($=u[be],u.hasOwnProperty(be)&&$!=null&&!h.hasOwnProperty(be))switch(be){case"selected":l.selected=!1;break;default:yt(l,a,be,null,h,$)}for(D in h)if($=h[D],q=u[D],h.hasOwnProperty(D)&&$!==q&&($!=null||q!=null))switch(D){case"selected":l.selected=$&&typeof $!="function"&&typeof $!="symbol";break;default:yt(l,a,D,$,h,q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Oe in u)$=u[Oe],u.hasOwnProperty(Oe)&&$!=null&&!h.hasOwnProperty(Oe)&&yt(l,a,Oe,null,h,$);for(P in h)if($=h[P],q=u[P],h.hasOwnProperty(P)&&$!==q&&($!=null||q!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,a));break;default:yt(l,a,P,$,h,q)}return;default:if(Cm(a)){for(var bt in u)$=u[bt],u.hasOwnProperty(bt)&&$!==void 0&&!h.hasOwnProperty(bt)&&uy(l,a,bt,void 0,h,$);for(K in h)$=h[K],q=u[K],!h.hasOwnProperty(K)||$===q||$===void 0&&q===void 0||uy(l,a,K,$,h,q);return}}for(var B in u)$=u[B],u.hasOwnProperty(B)&&$!=null&&!h.hasOwnProperty(B)&&yt(l,a,B,null,h,$);for(X in h)$=h[X],q=u[X],!h.hasOwnProperty(X)||$===q||$==null&&q==null||yt(l,a,X,$,h,q)}function ok(l){switch(l){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function aN(){if(typeof performance.getEntriesByType=="function"){for(var l=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var g=u[h],x=g.transferSize,w=g.initiatorType,E=g.duration;if(x&&E&&ok(w)){for(w=0,E=g.responseEnd,h+=1;h<u.length;h++){var D=u[h],P=D.startTime;if(P>E)break;var K=D.transferSize,X=D.initiatorType;K&&ok(X)&&(D=D.responseEnd,w+=K*(D<E?1:(E-P)/(D-P)))}if(--h,a+=8*(x+w)/(g.duration/1e3),l++,10<l)break}}if(0<l)return a/l/1e6}return navigator.connection&&(l=navigator.connection.downlink,typeof l=="number")?l:5}var fy=null,dy=null;function pd(l){return l.nodeType===9?l:l.ownerDocument}function ak(l){switch(l){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ck(l,a){if(l===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return l===1&&a==="foreignObject"?0:l}function hy(l,a){return l==="textarea"||l==="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 py=null;function cN(){var l=window.event;return l&&l.type==="popstate"?l===py?!1:(py=l,!0):(py=null,!1)}var uk=typeof setTimeout=="function"?setTimeout:void 0,uN=typeof clearTimeout=="function"?clearTimeout:void 0,fk=typeof Promise=="function"?Promise:void 0,fN=typeof queueMicrotask=="function"?queueMicrotask:typeof fk<"u"?function(l){return fk.resolve(null).then(l).catch(dN)}:uk;function dN(l){setTimeout(function(){throw l})}function Os(l){return l==="head"}function dk(l,a){var u=a,h=0;do{var g=u.nextSibling;if(l.removeChild(u),g&&g.nodeType===8)if(u=g.data,u==="/$"||u==="/&"){if(h===0){l.removeChild(g),Go(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Dc(l.ownerDocument.documentElement);else if(u==="head"){u=l.ownerDocument.head,Dc(u);for(var x=u.firstChild;x;){var w=x.nextSibling,E=x.nodeName;x[Za]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=w}}else u==="body"&&Dc(l.ownerDocument.body);u=g}while(u);Go(a)}function hk(l,a){var u=l;l=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(l===0)break;l--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||l++;u=h}while(u)}function my(l){var a=l.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":my(u),Sm(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}l.removeChild(u)}}function hN(l,a,u,h){for(;l.nodeType===1;){var g=u;if(l.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(l.nodeName!=="INPUT"||l.type!=="hidden"))break}else if(h){if(!l[Za])switch(a){case"meta":if(!l.hasAttribute("itemprop"))break;return l;case"link":if(x=l.getAttribute("rel"),x==="stylesheet"&&l.hasAttribute("data-precedence"))break;if(x!==g.rel||l.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||l.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||l.getAttribute("title")!==(g.title==null?null:g.title))break;return l;case"style":if(l.hasAttribute("data-precedence"))break;return l;case"script":if(x=l.getAttribute("src"),(x!==(g.src==null?null:g.src)||l.getAttribute("type")!==(g.type==null?null:g.type)||l.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&x&&l.hasAttribute("async")&&!l.hasAttribute("itemprop"))break;return l;default:return l}}else if(a==="input"&&l.type==="hidden"){var x=g.name==null?null:""+g.name;if(g.type==="hidden"&&l.getAttribute("name")===x)return l}else return l;if(l=zr(l.nextSibling),l===null)break}return null}function pN(l,a,u){if(a==="")return null;for(;l.nodeType!==3;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!u||(l=zr(l.nextSibling),l===null))return null;return l}function pk(l,a){for(;l.nodeType!==8;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!a||(l=zr(l.nextSibling),l===null))return null;return l}function gy(l){return l.data==="$?"||l.data==="$~"}function yy(l){return l.data==="$!"||l.data==="$?"&&l.ownerDocument.readyState!=="loading"}function mN(l,a){var u=l.ownerDocument;if(l.data==="$~")l._reactRetry=a;else if(l.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),l._reactRetry=h}}function zr(l){for(;l!=null;l=l.nextSibling){var a=l.nodeType;if(a===1||a===3)break;if(a===8){if(a=l.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return l}var by=null;function mk(l){l=l.nextSibling;for(var a=0;l;){if(l.nodeType===8){var u=l.data;if(u==="/$"||u==="/&"){if(a===0)return zr(l.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}l=l.nextSibling}return null}function gk(l){l=l.previousSibling;for(var a=0;l;){if(l.nodeType===8){var u=l.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return l;a--}else u!=="/$"&&u!=="/&"||a++}l=l.previousSibling}return null}function yk(l,a,u){switch(a=pd(u),l){case"html":if(l=a.documentElement,!l)throw Error(r(452));return l;case"head":if(l=a.head,!l)throw Error(r(453));return l;case"body":if(l=a.body,!l)throw Error(r(454));return l;default:throw Error(r(451))}}function Dc(l){for(var a=l.attributes;a.length;)l.removeAttributeNode(a[0]);Sm(l)}var Lr=new Map,bk=new Set;function md(l){return typeof l.getRootNode=="function"?l.getRootNode():l.nodeType===9?l:l.ownerDocument}var Ki=Y.d;Y.d={f:gN,r:yN,D:bN,C:xN,L:SN,m:wN,X:kN,S:vN,M:CN};function gN(){var l=Ki.f(),a=ld();return l||a}function yN(l){var a=ho(l);a!==null&&a.tag===5&&a.type==="form"?Lw(a):Ki.r(l)}var qo=typeof document>"u"?null:document;function xk(l,a,u){var h=qo;if(h&&typeof a=="string"&&a){var g=Ar(a);g='link[rel="'+l+'"][href="'+g+'"]',typeof u=="string"&&(g+='[crossorigin="'+u+'"]'),bk.has(g)||(bk.add(g),l={rel:l,crossOrigin:u,href:a},h.querySelector(g)===null&&(a=h.createElement("link"),Sn(a,"link",l),sn(a),h.head.appendChild(a)))}}function bN(l){Ki.D(l),xk("dns-prefetch",l,null)}function xN(l,a){Ki.C(l,a),xk("preconnect",l,a)}function SN(l,a,u){Ki.L(l,a,u);var h=qo;if(h&&l&&a){var g='link[rel="preload"][as="'+Ar(a)+'"]';a==="image"&&u&&u.imageSrcSet?(g+='[imagesrcset="'+Ar(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(g+='[imagesizes="'+Ar(u.imageSizes)+'"]')):g+='[href="'+Ar(l)+'"]';var x=g;switch(a){case"style":x=Yo(l);break;case"script":x=Ko(l)}Lr.has(x)||(l=m({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:l,as:a},u),Lr.set(x,l),h.querySelector(g)!==null||a==="style"&&h.querySelector(Rc(x))||a==="script"&&h.querySelector(Nc(x))||(a=h.createElement("link"),Sn(a,"link",l),sn(a),h.head.appendChild(a)))}}function wN(l,a){Ki.m(l,a);var u=qo;if(u&&l){var h=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+Ar(h)+'"][href="'+Ar(l)+'"]',x=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ko(l)}if(!Lr.has(x)&&(l=m({rel:"modulepreload",href:l},a),Lr.set(x,l),u.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Nc(x)))return}h=u.createElement("link"),Sn(h,"link",l),sn(h),u.head.appendChild(h)}}}function vN(l,a,u){Ki.S(l,a,u);var h=qo;if(h&&l){var g=po(h).hoistableStyles,x=Yo(l);a=a||"default";var w=g.get(x);if(!w){var E={loading:0,preload:null};if(w=h.querySelector(Rc(x)))E.loading=5;else{l=m({rel:"stylesheet",href:l,"data-precedence":a},u),(u=Lr.get(x))&&xy(l,u);var D=w=h.createElement("link");sn(D),Sn(D,"link",l),D._p=new Promise(function(P,K){D.onload=P,D.onerror=K}),D.addEventListener("load",function(){E.loading|=1}),D.addEventListener("error",function(){E.loading|=2}),E.loading|=4,gd(w,a,h)}w={type:"stylesheet",instance:w,count:1,state:E},g.set(x,w)}}}function kN(l,a){Ki.X(l,a);var u=qo;if(u&&l){var h=po(u).hoistableScripts,g=Ko(l),x=h.get(g);x||(x=u.querySelector(Nc(g)),x||(l=m({src:l,async:!0},a),(a=Lr.get(g))&&Sy(l,a),x=u.createElement("script"),sn(x),Sn(x,"link",l),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(g,x))}}function CN(l,a){Ki.M(l,a);var u=qo;if(u&&l){var h=po(u).hoistableScripts,g=Ko(l),x=h.get(g);x||(x=u.querySelector(Nc(g)),x||(l=m({src:l,async:!0,type:"module"},a),(a=Lr.get(g))&&Sy(l,a),x=u.createElement("script"),sn(x),Sn(x,"link",l),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(g,x))}}function Sk(l,a,u,h){var g=(g=ge.current)?md(g):null;if(!g)throw Error(r(446));switch(l){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Yo(u.href),u=po(g).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){l=Yo(u.href);var x=po(g).hoistableStyles,w=x.get(l);if(w||(g=g.ownerDocument||g,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(l,w),(x=g.querySelector(Rc(l)))&&!x._p&&(w.instance=x,w.state.loading=5),Lr.has(l)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Lr.set(l,u),x||EN(g,l,u,w.state))),a&&h===null)throw Error(r(528,""));return w}if(a&&h!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ko(u),u=po(g).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,l))}}function Yo(l){return'href="'+Ar(l)+'"'}function Rc(l){return'link[rel="stylesheet"]['+l+"]"}function wk(l){return m({},l,{"data-precedence":l.precedence,precedence:null})}function EN(l,a,u,h){l.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=l.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),Sn(a,"link",u),sn(a),l.head.appendChild(a))}function Ko(l){return'[src="'+Ar(l)+'"]'}function Nc(l){return"script[async]"+l}function vk(l,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=l.querySelector('style[data-href~="'+Ar(u.href)+'"]');if(h)return a.instance=h,sn(h),h;var g=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(l.ownerDocument||l).createElement("style"),sn(h),Sn(h,"style",g),gd(h,u.precedence,l),a.instance=h;case"stylesheet":g=Yo(u.href);var x=l.querySelector(Rc(g));if(x)return a.state.loading|=4,a.instance=x,sn(x),x;h=wk(u),(g=Lr.get(g))&&xy(h,g),x=(l.ownerDocument||l).createElement("link"),sn(x);var w=x;return w._p=new Promise(function(E,D){w.onload=E,w.onerror=D}),Sn(x,"link",h),a.state.loading|=4,gd(x,u.precedence,l),a.instance=x;case"script":return x=Ko(u.src),(g=l.querySelector(Nc(x)))?(a.instance=g,sn(g),g):(h=u,(g=Lr.get(x))&&(h=m({},u),Sy(h,g)),l=l.ownerDocument||l,g=l.createElement("script"),sn(g),Sn(g,"link",h),l.head.appendChild(g),a.instance=g);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,gd(h,u.precedence,l));return a.instance}function gd(l,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,x=g,w=0;w<h.length;w++){var E=h[w];if(E.dataset.precedence===a)x=E;else if(x!==g)break}x?x.parentNode.insertBefore(l,x.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(l,a.firstChild))}function xy(l,a){l.crossOrigin==null&&(l.crossOrigin=a.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=a.referrerPolicy),l.title==null&&(l.title=a.title)}function Sy(l,a){l.crossOrigin==null&&(l.crossOrigin=a.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=a.referrerPolicy),l.integrity==null&&(l.integrity=a.integrity)}var yd=null;function kk(l,a,u){if(yd===null){var h=new Map,g=yd=new Map;g.set(u,h)}else g=yd,h=g.get(u),h||(h=new Map,g.set(u,h));if(h.has(l))return h;for(h.set(l,null),u=u.getElementsByTagName(l),g=0;g<u.length;g++){var x=u[g];if(!(x[Za]||x[gn]||l==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=l+w;var E=h.get(w);E?E.push(x):h.set(w,[x])}}return h}function Ck(l,a,u){l=l.ownerDocument||l,l.head.insertBefore(u,a==="title"?l.querySelector("head > title"):null)}function TN(l,a,u){if(u===1||a.itemProp!=null)return!1;switch(l){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 l=a.disabled,typeof a.precedence=="string"&&l==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 Ek(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function AN(l,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var g=Yo(h.href),x=a.querySelector(Rc(g));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(l.count++,l=bd.bind(l),a.then(l,l)),u.state.loading|=4,u.instance=x,sn(x);return}x=a.ownerDocument||a,h=wk(h),(g=Lr.get(g))&&xy(h,g),x=x.createElement("link"),sn(x);var w=x;w._p=new Promise(function(E,D){w.onload=E,w.onerror=D}),Sn(x,"link",h),u.instance=x}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(l.count++,u=bd.bind(l),a.addEventListener("load",u),a.addEventListener("error",u))}}var wy=0;function MN(l,a){return l.stylesheets&&l.count===0&&Sd(l,l.stylesheets),0<l.count||0<l.imgCount?function(u){var h=setTimeout(function(){if(l.stylesheets&&Sd(l,l.stylesheets),l.unsuspend){var x=l.unsuspend;l.unsuspend=null,x()}},6e4+a);0<l.imgBytes&&wy===0&&(wy=62500*aN());var g=setTimeout(function(){if(l.waitingForImages=!1,l.count===0&&(l.stylesheets&&Sd(l,l.stylesheets),l.unsuspend)){var x=l.unsuspend;l.unsuspend=null,x()}},(l.imgBytes>wy?50:800)+a);return l.unsuspend=u,function(){l.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function bd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sd(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var xd=null;function Sd(l,a){l.stylesheets=null,l.unsuspend!==null&&(l.count++,xd=new Map,a.forEach(ON,l),xd=null,bd.call(l))}function ON(l,a){if(!(a.state.loading&4)){var u=xd.get(l);if(u)var h=u.get(null);else{u=new Map,xd.set(l,u);for(var g=l.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<g.length;x++){var w=g[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(u.set(w.dataset.precedence,w),h=w)}h&&u.set(null,h)}g=a.instance,w=g.getAttribute("data-precedence"),x=u.get(w)||h,x===h&&u.set(null,g),u.set(w,g),this.count++,h=bd.bind(this),g.addEventListener("load",h),g.addEventListener("error",h),x?x.parentNode.insertBefore(g,x.nextSibling):(l=l.nodeType===9?l.head:l,l.insertBefore(g,l.firstChild)),a.state.loading|=4}}var zc={$$typeof:z,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function _N(l,a,u,h,g,x,w,E,D){this.tag=1,this.containerInfo=l,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=gm(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gm(0),this.hiddenUpdates=gm(null),this.identifierPrefix=h,this.onUncaughtError=g,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Tk(l,a,u,h,g,x,w,E,D,P,K,X){return l=new _N(l,a,u,w,D,P,K,X,E),a=1,x===!0&&(a|=24),x=fr(3,null,null,a),l.current=x,x.stateNode=l,a=eg(),a.refCount++,l.pooledCache=a,a.refCount++,x.memoizedState={element:h,isDehydrated:u,cache:a},ig(x),l}function Ak(l){return l?(l=Co,l):Co}function Mk(l,a,u,h,g,x){g=Ak(g),h.context===null?h.context=g:h.pendingContext=g,h=bs(a),h.payload={element:u},x=x===void 0?null:x,x!==null&&(h.callback=x),u=xs(l,h,a),u!==null&&(er(u,l,a),dc(u,l,a))}function Ok(l,a){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var u=l.retryLane;l.retryLane=u!==0&&u<a?u:a}}function vy(l,a){Ok(l,a),(l=l.alternate)&&Ok(l,a)}function _k(l){if(l.tag===13||l.tag===31){var a=bl(l,67108864);a!==null&&er(a,l,67108864),vy(l,67108864)}}function Dk(l){if(l.tag===13||l.tag===31){var a=gr();a=ym(a);var u=bl(l,a);u!==null&&er(u,l,a),vy(l,a)}}var wd=!0;function DN(l,a,u,h){var g=I.T;I.T=null;var x=Y.p;try{Y.p=2,ky(l,a,u,h)}finally{Y.p=x,I.T=g}}function RN(l,a,u,h){var g=I.T;I.T=null;var x=Y.p;try{Y.p=8,ky(l,a,u,h)}finally{Y.p=x,I.T=g}}function ky(l,a,u,h){if(wd){var g=Cy(h);if(g===null)cy(l,a,h,vd,u),Nk(l,h);else if(zN(g,l,a,u,h))h.stopPropagation();else if(Nk(l,h),a&4&&-1<NN.indexOf(l)){for(;g!==null;){var x=ho(g);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=hl(x.pendingLanes);if(w!==0){var E=x;for(E.pendingLanes|=2,E.entangledLanes|=2;w;){var D=1<<31-nt(w);E.entanglements[1]|=D,w&=~D}fi(x),(ut&6)===0&&(id=Pe()+500,Mc(0))}}break;case 31:case 13:E=bl(x,2),E!==null&&er(E,x,2),ld(),vy(x,2)}if(x=Cy(h),x===null&&cy(l,a,h,vd,u),x===g)break;g=x}g!==null&&h.stopPropagation()}else cy(l,a,h,null,u)}}function Cy(l){return l=Tm(l),Ey(l)}var vd=null;function Ey(l){if(vd=null,l=fo(l),l!==null){var a=s(l);if(a===null)l=null;else{var u=a.tag;if(u===13){if(l=o(a),l!==null)return l;l=null}else if(u===31){if(l=c(a),l!==null)return l;l=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;l=null}else a!==l&&(l=null)}}return vd=l,null}function Rk(l){switch(l){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(St()){case j:return 2;case se:return 8;case ve:case Ae:return 32;case Xe:return 268435456;default:return 32}default:return 32}}var Ty=!1,_s=null,Ds=null,Rs=null,Lc=new Map,Ic=new Map,Ns=[],NN="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 Nk(l,a){switch(l){case"focusin":case"focusout":_s=null;break;case"dragenter":case"dragleave":Ds=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":Lc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ic.delete(a.pointerId)}}function Bc(l,a,u,h,g,x){return l===null||l.nativeEvent!==x?(l={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:x,targetContainers:[g]},a!==null&&(a=ho(a),a!==null&&_k(a)),l):(l.eventSystemFlags|=h,a=l.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),l)}function zN(l,a,u,h,g){switch(a){case"focusin":return _s=Bc(_s,l,a,u,h,g),!0;case"dragenter":return Ds=Bc(Ds,l,a,u,h,g),!0;case"mouseover":return Rs=Bc(Rs,l,a,u,h,g),!0;case"pointerover":var x=g.pointerId;return Lc.set(x,Bc(Lc.get(x)||null,l,a,u,h,g)),!0;case"gotpointercapture":return x=g.pointerId,Ic.set(x,Bc(Ic.get(x)||null,l,a,u,h,g)),!0}return!1}function zk(l){var a=fo(l.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=o(u),a!==null){l.blockedOn=a,Gx(l.priority,function(){Dk(u)});return}}else if(a===31){if(a=c(u),a!==null){l.blockedOn=a,Gx(l.priority,function(){Dk(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){l.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}l.blockedOn=null}function kd(l){if(l.blockedOn!==null)return!1;for(var a=l.targetContainers;0<a.length;){var u=Cy(l.nativeEvent);if(u===null){u=l.nativeEvent;var h=new u.constructor(u.type,u);Em=h,u.target.dispatchEvent(h),Em=null}else return a=ho(u),a!==null&&_k(a),l.blockedOn=u,!1;a.shift()}return!0}function Lk(l,a,u){kd(l)&&u.delete(a)}function LN(){Ty=!1,_s!==null&&kd(_s)&&(_s=null),Ds!==null&&kd(Ds)&&(Ds=null),Rs!==null&&kd(Rs)&&(Rs=null),Lc.forEach(Lk),Ic.forEach(Lk)}function Cd(l,a){l.blockedOn===a&&(l.blockedOn=null,Ty||(Ty=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,LN)))}var Ed=null;function Ik(l){Ed!==l&&(Ed=l,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ed===l&&(Ed=null);for(var a=0;a<l.length;a+=3){var u=l[a],h=l[a+1],g=l[a+2];if(typeof h!="function"){if(Ey(h||u)===null)continue;break}var x=ho(u);x!==null&&(l.splice(a,3),a-=3,Cg(x,{pending:!0,data:g,method:u.method,action:h},h,g))}}))}function Go(l){function a(D){return Cd(D,l)}_s!==null&&Cd(_s,l),Ds!==null&&Cd(Ds,l),Rs!==null&&Cd(Rs,l),Lc.forEach(a),Ic.forEach(a);for(var u=0;u<Ns.length;u++){var h=Ns[u];h.blockedOn===l&&(h.blockedOn=null)}for(;0<Ns.length&&(u=Ns[0],u.blockedOn===null);)zk(u),u.blockedOn===null&&Ns.shift();if(u=(l.ownerDocument||l).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var g=u[h],x=u[h+1],w=g[Gn]||null;if(typeof x=="function")w||Ik(u);else if(w){var E=null;if(x&&x.hasAttribute("formAction")){if(g=x,w=x[Gn]||null)E=w.formAction;else if(Ey(g)!==null)continue}else E=w.action;typeof E=="function"?u[h+1]=E:(u.splice(h,3),h-=3),Ik(u)}}}function Bk(){function l(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return g=w})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,g=null;return navigation.addEventListener("navigate",l),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",l),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),g!==null&&(g(),g=null)}}}function Ay(l){this._internalRoot=l}Td.prototype.render=Ay.prototype.render=function(l){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=gr();Mk(u,h,l,a,null,null)},Td.prototype.unmount=Ay.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var a=l.containerInfo;Mk(l.current,2,null,l,null,null),ld(),a[uo]=null}};function Td(l){this._internalRoot=l}Td.prototype.unstable_scheduleHydration=function(l){if(l){var a=Kx();l={blockedOn:null,target:l,priority:a};for(var u=0;u<Ns.length&&a!==0&&a<Ns[u].priority;u++);Ns.splice(u,0,l),u===0&&zk(l)}};var jk=e.version;if(jk!=="19.2.4")throw Error(r(527,jk,"19.2.4"));Y.findDOMNode=function(l){var a=l._reactInternals;if(a===void 0)throw typeof l.render=="function"?Error(r(188)):(l=Object.keys(l).join(","),Error(r(268,l)));return l=d(a),l=l!==null?p(l):null,l=l===null?null:l.stateNode,l};var IN={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ad=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ad.isDisabled&&Ad.supportsFiber)try{it=Ad.inject(IN),lt=Ad}catch{}}return Uc.createRoot=function(l,a){if(!i(l))throw Error(r(299));var u=!1,h="",g=qw,x=Yw,w=Kw;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=Tk(l,1,!1,null,null,u,h,null,g,x,w,Bk),l[uo]=a.current,ay(l),new Ay(a)},Uc.hydrateRoot=function(l,a,u){if(!i(l))throw Error(r(299));var h=!1,g="",x=qw,w=Yw,E=Kw,D=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(w=u.onCaughtError),u.onRecoverableError!==void 0&&(E=u.onRecoverableError),u.formState!==void 0&&(D=u.formState)),a=Tk(l,1,!0,a,u??null,h,g,D,x,w,E,Bk),a.context=Ak(null),u=a.current,h=gr(),h=ym(h),g=bs(h),g.callback=null,xs(u,g,h),u=h,a.current.lanes=u,Ga(a,u),fi(a),l[uo]=a.current,ay(l),new Td(a)},Uc.version="19.2.4",Uc}var Gk;function KN(){if(Gk)return _y.exports;Gk=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(),_y.exports=YN(),_y.exports}var GN=KN();class ZN extends an.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?T.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[T.jsx("h2",{children:"Something went wrong"}),T.jsx("p",{style:{color:"#666"},children:"The editor encountered an unexpected error. Reload the page to continue."}),T.jsx("pre",{style:{background:"#f5f5f5",padding:"1rem",borderRadius:"4px",fontSize:"12px",overflow:"auto",maxHeight:"200px"},children:(e=this.state.error)==null?void 0:e.message}),T.jsx("button",{onClick:()=>window.location.reload(),style:{marginTop:"1rem",padding:"8px 16px",cursor:"pointer",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff"},children:"Reload"})]}):this.props.children}}const Zk=3478,c1=3479,WN=3e3,JN=3e3,XN=3e4,QN=5,bu={yellow:"rgba(255, 235, 59, 0.3)",red:"rgba(244, 67, 54, 0.3)",green:"rgba(76, 175, 80, 0.3)",blue:"rgba(33, 150, 243, 0.3)",purple:"rgba(156, 39, 176, 0.3)"},Wk="all",Jk="tandem:interruptionMode",u1="#6366f1",ez="__tandem_ctrl__",oa="annotations",BA="awareness",jA="userAwareness",Xk="chat",th="documentMeta",Qk="savedAtVersion",f1="tandem:recentFiles",tz=20,P0="tandem:userName",Jc="You",eC={error:8e3,warning:6e3,info:4e3},nz=5,UA="tandem:tutorialCompleted",rz="tutorial-",tC="tandem:editorWidthMode";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 HA(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 o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=HA(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function VA(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 o=t.child(--i),c=e.child(--s),f=o.nodeSize;if(o==c){n-=f,r-=f;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let d=0,p=Math.min(o.text.length,c.text.length);for(;d<p&&o.text[o.text.length-d-1]==c.text[c.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(o.content.size||c.content.size){let d=VA(o.content,c.content,n-1,r-1);if(d)return d}n-=f,r-=f}}class Q{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 o=0,c=0;c<n;o++){let f=this.content[o],d=c+f.nodeSize;if(d>e&&r(f,i+c,s||null,o)!==!1&&f.content.size){let p=c+1;f.nodesBetween(Math.max(0,e-p),Math.min(f.content.size,n-p),r,i+p)}c=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(c,f)=>{let d=c.isText?c.text.slice(Math.max(e,f)-f,n-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&d||c.isTextblock)&&r&&(o?o=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new Q(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,o=0;o<n;s++){let c=this.content[s],f=o+c.nodeSize;f>e&&((o<e||f>n)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),i+=c.nodeSize),o=f}return new Q(r,i)}cutByIndex(e,n){return e==n?Q.empty:e==0&&n==this.content.length?this:new Q(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 Q(i,s)}addToStart(e){return new Q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Q(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 HA(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return VA(this,e,n,r)}findIndex(e){if(e==0)return Od(0,e);if(e==this.size)return Od(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?Od(n+1,s):Od(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 Q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Q(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Q.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 Q(n||e,r)}static from(e){if(!e)return Q.empty;if(e instanceof Q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Q.empty=new Q([],0);const zy={index:0,offset:0};function Od(t,e){return zy.index=t,zy.offset=e,zy}function bh(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!bh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!bh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let kt=class F0{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&bh(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return F0.none;if(e instanceof F0)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};kt.none=[];class xh 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=FA(this.content,e+this.openStart,n);return r&&new he(r,this.openStart,this.openEnd)}removeBetween(e,n){return new he(PA(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(Q.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(Q.empty,0,0);function PA(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(i==e||s.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(PA(s.content,e-i-1,n-i-1)))}function FA(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=FA(o.content,e-s-1,n,o);return c&&t.replaceChild(i,o.copy(c))}function iz(t,e,n){if(n.openStart>t.depth)throw new xh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new xh("Inconsistent open depths");return $A(t,e,n,0)}function $A(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=$A(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,c=o.content;return Vl(o,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:o,end:c}=sz(n,t);return Vl(s,YA(t,o,c,e,r))}else return Vl(s,Sh(t,e,r))}function qA(t,e){if(!e.type.compatibleContent(t.type))throw new xh("Cannot join "+e.type.name+" onto "+t.type.name)}function $0(t,e,n){let r=t.node(n);return qA(r,e.node(n)),r}function Hl(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 Xc(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Hl(t.nodeAfter,r),s++));for(let c=s;c<o;c++)Hl(i.child(c),r);e&&e.depth==n&&e.textOffset&&Hl(e.nodeBefore,r)}function Vl(t,e){return t.type.checkContent(e),t.copy(e)}function YA(t,e,n,r,i){let s=t.depth>i&&$0(t,e,i+1),o=r.depth>i&&$0(n,r,i+1),c=[];return Xc(null,t,i,c),s&&o&&e.index(i)==n.index(i)?(qA(s,o),Hl(Vl(s,YA(t,e,n,r,i+1)),c)):(s&&Hl(Vl(s,Sh(t,e,i+1)),c),Xc(e,n,i,c),o&&Hl(Vl(o,Sh(n,r,i+1)),c)),Xc(r,null,i,c),new Q(c)}function Sh(t,e,n){let r=[];if(Xc(null,t,n,r),t.depth>n){let i=$0(t,e,n+1);Hl(Vl(i,Sh(t,e,n+1)),r)}return Xc(e,null,n,r),new Q(r)}function sz(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(Q.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class xu{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 kt.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 o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].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 wh(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 o=e;;){let{index:c,offset:f}=o.content.findIndex(s),d=s-f;if(r.push(o,c,i+f),!d||(o=o.child(c),o.isText))break;s=d-1,i+=f+1}return new xu(n,r,s)}static resolveCached(e,n){let r=nC.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else nC.set(e,r=new lz);let i=r.elts[r.i]=xu.resolve(e,n);return r.i=(r.i+1)%oz,i}}class lz{constructor(){this.elts=[],this.i=0}}const oz=12,nC=new WeakMap;class wh{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 az=Object.create(null);let Js=class q0{constructor(e,n,r,i=kt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||Q.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&bh(this.attrs,n||e.defaultAttrs||az)&&kt.sameSet(this.marks,r||kt.none)}copy(e=null){return e==this.content?this:new q0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new q0(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),o=r?0:i.sharedDepth(n),c=i.start(o),d=i.node(o).content.cut(i.pos-c,s.pos-c);return new he(d,i.depth-o,s.depth-o)}replace(e,n,r){return iz(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 xu.resolveCached(this,e)}resolveNoCache(e){return xu.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()+")"),KA(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=Q.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.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=kt.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(!kt.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=Q.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Js.prototype.text=void 0;class vh extends Js{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):KA(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 vh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new vh(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 KA(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Gl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new cz(e,n);if(r.next==null)return Gl.empty;let i=GA(r);r.next&&r.err("Unexpected trailing text");let s=gz(mz(i));return yz(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(o,c){let f=o.matchFragment(e,r);if(f&&(!n||f.validEnd))return Q.from(c.map(d=>d.createAndFill()));for(let d=0;d<o.next.length;d++){let{type:p,next:m}=o.next[d];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let y=s(m,c.concat(p));if(y)return y}}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 o=[];for(let c=i;c.type;c=c.via)o.push(c.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:c,next:f}=s.next[o];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
50
- `)}}Gl.empty=new Gl(!0);class cz{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 GA(t){let e=[];do e.push(uz(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function uz(t){let e=[];do e.push(fz(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function fz(t){let e=pz(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=dz(t,e);else break;return e}function rC(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function dz(t,e){let n=rC(t),r=n;return t.eat(",")&&(t.next!="}"?r=rC(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function hz(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function pz(t){if(t.eat("(")){let e=GA(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=hz(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 mz(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,f){let d={term:f,to:c};return e[o].push(d),d}function i(o,c){o.forEach(f=>f.to=c)}function s(o,c){if(o.type=="choice")return o.exprs.reduce((f,d)=>f.concat(s(d,c)),[]);if(o.type=="seq")for(let f=0;;f++){let d=s(o.exprs[f],c);if(f==o.exprs.length-1)return d;i(d,c=n())}else if(o.type=="star"){let f=n();return r(c,f),i(s(o.expr,f),f),[r(f)]}else if(o.type=="plus"){let f=n();return i(s(o.expr,c),f),i(s(o.expr,f),f),[r(f)]}else{if(o.type=="opt")return[r(c)].concat(s(o.expr,c));if(o.type=="range"){let f=c;for(let d=0;d<o.min;d++){let p=n();i(s(o.expr,f),p),f=p}if(o.max==-1)i(s(o.expr,f),f);else for(let d=o.min;d<o.max;d++){let p=n();r(f,p),i(s(o.expr,f),p),f=p}return[r(f)]}else{if(o.type=="name")return[r(c,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ZA(t,e){return e-t}function iC(t,e){let n=[];return r(e),n.sort(ZA);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:c,to:f}=s[o];!c&&n.indexOf(f)==-1&&r(f)}}}function gz(t){let e=Object.create(null);return n(iC(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:c,to:f})=>{if(!c)return;let d;for(let p=0;p<i.length;p++)i[p][0]==c&&(d=i[p][1]);iC(t,f).forEach(p=>{d||i.push([c,d=[]]),d.indexOf(p)==-1&&d.push(p)})})});let s=e[r.join(",")]=new Gl(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let c=i[o][1].sort(ZA);s.next.push({type:i[o][0],next:e[c.join(",")]||n(c)})}return s}}function yz(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let c=0;c<i.next.length;c++){let{type:f,next:d}=i.next[c];o.push(f.name),s&&!(f.isText||f.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function WA(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 JA(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 XA(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 QA(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new xz(t,r,e[r]);return n}let sC=class eM{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=QA(e,r.attrs),this.defaultAttrs=WA(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==Gl.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:JA(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Js(this,this.computeAttrs(e),Q.from(n),kt.setFrom(r))}createChecked(e=null,n,r){return n=Q.from(n),this.checkContent(n),new Js(this,this.computeAttrs(e),n,kt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Q.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(Q.empty,!0);return s?new Js(this,e,n.append(s),kt.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){XA(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:kt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new eM(s,n,o));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 bz(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 xz{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?bz(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ip{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=QA(e,i.attrs),this.excluded=null;let s=WA(this.attrs);this.instance=s?new kt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new kt(this,JA(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Ip(s,i++,n,o)),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){XA(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let tM=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=wn.from(e.nodes),n.marks=wn.from(e.marks||{}),this.nodes=sC.compile(this.spec.nodes,this),this.marks=Ip.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],o=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Gl.parse(o,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?lC(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:lC(this,o.split(" "))}this.nodeFromJSON=i=>Js.fromJSON(this,i),this.markFromJSON=i=>kt.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 sC){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 vh(r,r.defaultAttrs,e,kt.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 lC(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let c in t.marks){let f=t.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=f)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Sz(t){return t.tag!=null}function wz(t){return t.style!=null}let Qc=class Y0{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Sz(i))this.tags.push(i);else if(wz(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 aC(this,n,!1);return r.addAll(e,kt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new aC(this,n,!0);return r.addAll(e,kt.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(Cz(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||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 o=this.styles[s],c=o.style;if(!(c.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let f=o.getAttrs(n);if(f===!1)continue;o.attrs=f||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let c=n[o];if((c.priority==null?50:c.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cC(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cC(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Y0(e,Y0.schemaRules(e)))}};const nM={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},vz={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rM={ol:!0,ul:!0},Su=1,K0=2,eu=4;function oC(t,e,n){return e!=null?(e?Su:0)|(e==="full"?K0:0):t&&t.whitespace=="pre"?Su|K0:n&~eu}class _d{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=kt.none,this.match=s||(o&eu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Q.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&Su)){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=Q.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Q.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&&!nM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class aC{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=oC(null,n.preserveWhitespace,0)|(r?eu:0);i?s=new _d(i.type,i.attrs,kt.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new _d(null,null,kt.none,!0,null,o):s=new _d(e.schema.topNodeType,null,kt.none,!0,null,o),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&K0?"full":this.localPreserveWS||(i.options&Su)>0,{schema:o}=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,`
51
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let f=0;f<c.length;f++)f&&this.insertNode(o.linebreakReplacement.create(),n,!0),c[f]&&this.insertNode(o.text(c[f]),n,!/\S/.test(c[f]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],f=e.previousSibling;(!c||f&&f.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(o.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 o=e.nodeName.toLowerCase(),c;rM.hasOwnProperty(o)&&this.parser.normalizeLists&&kz(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(f?f.ignore:vz.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let d,p=this.needsBlock;if(nM.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=f&&f.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),d&&this.sync(s),this.needsBlock=p}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,f,d,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
52
- `),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],o=r.getPropertyValue(s);if(o)for(let c=void 0;;){let f=this.parser.matchStyle(s,o,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(d=>!f.clearMark(d)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let f=this.enter(o,n.attrs||null,r,n.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r,!1));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];o!=c;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,c=0;o>=0;o--){let f=this.nodes[o],d=f.findWrapping(e);if(d&&(!i||i.length>d.length+c)&&(i=d,s=f,!d.length))break;if(f.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],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 o=kt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):uC(c.type,e.type))&&(o=c.addToSet(o));return s.content.push(e.mark(o)),!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 o=this.top;o.match=o.match&&o.match.matchType(e);let c=oC(e,s,o.options);o.options&eu&&o.content.length==0&&(c|=eu);let f=kt.none;return r=r.filter(d=>(o.type?o.type.allowsMarkType(d.type):uC(d.type,e))?(f=d.addToSet(f),!1):!0),this.nodes.push(new _d(e,n,f,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Su)}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),o=(c,f)=>{for(;c>=0;c--){let d=n[c];if(d==""){if(c==n.length-1||c==0)continue;for(;f>=s;f--)if(o(c-1,f))return!0;return!1}else{let p=f>0||f==0&&i?this.nodes[f].type:r&&f>=s?r.node(f-s).type:null;if(!p||p.name!=d&&!p.isInGroup(d))return!1;f--}}return!0};return o(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 kz(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&rM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Cz(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cC(t){let e={};for(let n in t)e[n]=t[n];return e}function uC(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=c=>{s.push(c);for(let f=0;f<c.edgeCount;f++){let{type:d,next:p}=c.edge(f);if(d==e||s.indexOf(p)<0&&o(p))return!0}};if(o(i.contentMatch))return!0}}class lo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ly(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let c=0,f=0;for(;c<s.length&&f<o.marks.length;){let d=o.marks[f];if(!this.marks[d.type.name]){f++;continue}if(!d.eq(s[c][0])||d.type.spec.spanning===!1)break;c++,f++}for(;c<s.length;)i=s.pop()[1];for(;f<o.marks.length;){let d=o.marks[f++],p=this.serializeMark(d,o.isInline,n);p&&(s.push([d,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=nh(Ly(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&&nh(Ly(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return nh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new lo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=fC(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return fC(e.marks)}}function fC(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ly(t){return t.document||window.document}const dC=new WeakMap;function Ez(t){let e=dC.get(t);return e===void 0&&dC.set(t,e=Tz(t)),e}function Tz(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 nh(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=Ez(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 o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let c,f=n?t.createElementNS(n,i):t.createElement(i),d=e[1],p=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){p=2;for(let m in d)if(d[m]!=null){let y=m.indexOf(" ");y>0?f.setAttributeNS(m.slice(0,y),m.slice(y+1),d[m]):m=="style"&&f.style?f.style.cssText=d[m]:f.setAttribute(m,d[m])}}for(let m=p;m<e.length;m++){let y=e[m];if(y===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:S}=nh(t,y,n,r);if(f.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:f,contentDOM:c}}const iM=65535,sM=Math.pow(2,16);function Az(t,e){return t+e*sM}function hC(t){return t&iM}function Mz(t){return(t-(t&iM))/sM}const lM=1,oM=2,rh=4,aM=8;class G0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&aM)>0}get deletedBefore(){return(this.delInfo&(lM|rh))>0}get deletedAfter(){return(this.delInfo&(oM|rh))>0}get deletedAcross(){return(this.delInfo&rh)>0}}class Sr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Sr.empty)return Sr.empty}recover(e){let n=0,r=hC(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+Mz(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,o=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>e)break;let d=this.ranges[c+s],p=this.ranges[c+o],m=f+d;if(e<=m){let y=d?e==f?-1:e==m?1:n:n,b=f+i+(y<0?0:p);if(r)return b;let S=e==(n<0?f:m)?null:Az(c/3,e-f),v=e==f?oM:e==m?lM:rh;return(n<0?e!=f:e!=m)&&(v|=aM),new G0(b,v,S)}i+=p-d}return r?e+i:new G0(e+i,0,null)}touches(e,n){let r=0,i=hC(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>e)break;let d=this.ranges[c+s],p=f+d;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+o]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],c=o-(this.inverted?s:0),f=o+(this.inverted?0:s),d=this.ranges[i+n],p=this.ranges[i+r];e(c,c+d,f,f+p),s+=p-d}}invert(){return new Sr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Sr.empty:new Sr(e<0?[0,-e,0]:[0,0,e])}}Sr.empty=new Sr([]);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 o=this._maps[s],c=o.mapResult(e,n);if(c.recover!=null){let f=this.getMirror(s);if(f!=null&&f>s&&f<this.to){s=f,e=this._maps[f].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new G0(e,i,null)}}const Iy=Object.create(null);class Bn{getMap(){return Sr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Iy[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 Iy)throw new RangeError("Duplicate use of step JSON ID "+e);return Iy[e]=n,n.prototype.jsonID=e,n}}class Jt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Jt(e,null)}static fail(e){return new Jt(null,e)}static fromReplace(e,n,r,i){try{return Jt.ok(e.replace(n,r,i))}catch(s){if(s instanceof xh)return Jt.fail(s.message);throw s}}}function d1(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(d1(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Q.fromArray(r)}class Ks extends Bn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new he(d1(n.content,(o,c)=>!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Jt.fromReplace(e,this.from,this.to,s)}invert(){return new yi(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 Ks(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ks&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ks(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 Ks(n.from,n.to,e.markFromJSON(n.mark))}}Bn.jsonID("addMark",Ks);class yi extends Bn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new he(d1(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Jt.fromReplace(e,this.from,this.to,r)}invert(){return new Ks(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 yi(n.pos,r.pos,this.mark)}merge(e){return e instanceof yi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yi(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 yi(n.from,n.to,e.markFromJSON(n.mark))}}Bn.jsonID("removeMark",yi);class Gs extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Jt.fromReplace(e,this.pos,this.pos+1,new he(Q.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 Gs(this.pos,n.marks[i]);return new Gs(this.pos,this.mark)}}return new Zl(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Gs(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 Gs(n.pos,e.markFromJSON(n.mark))}}Bn.jsonID("addNodeMark",Gs);class Zl extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Jt.fromReplace(e,this.pos,this.pos+1,new he(Q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Gs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zl(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 Zl(n.pos,e.markFromJSON(n.mark))}}Bn.jsonID("removeNodeMark",Zl);class cn extends Bn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Z0(e,this.from,this.to)?Jt.fail("Structure replace would overwrite content"):Jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Sr([this.from,this.to-this.from,this.slice.size])}invert(e){return new cn(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 cn(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof cn)||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 cn(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 cn(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 cn(n.from,n.to,he.fromJSON(e,n.slice),!!n.structure)}}Bn.jsonID("replace",cn);class un extends Bn{constructor(e,n,r,i,s,o,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=c}apply(e){if(this.structure&&(Z0(e,this.from,this.gapFrom)||Z0(e,this.gapTo,this.to)))return Jt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Jt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Jt.fromReplace(e,this.from,this.to,r):Jt.fail("Content does not fit in gap")}getMap(){return new Sr([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)}}Bn.jsonID("replaceAround",un);function Z0(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 o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Oz(t,e,n,r){let i=[],s=[],o,c;t.doc.nodesBetween(e,n,(f,d,p)=>{if(!f.isInline)return;let m=f.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let y=Math.max(d,e),b=Math.min(d+f.nodeSize,n),S=r.addToSet(m);for(let v=0;v<m.length;v++)m[v].isInSet(S)||(o&&o.to==y&&o.mark.eq(m[v])?o.to=b:i.push(o=new yi(y,b,m[v])));c&&c.to==y?c.to=b:s.push(c=new Ks(y,b,r))}}),i.forEach(f=>t.step(f)),s.forEach(f=>t.step(f))}function _z(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;s++;let f=null;if(r instanceof Ip){let d=o.marks,p;for(;p=r.isInSet(d);)(f||(f=[])).push(p),d=p.removeFromSet(d)}else r?r.isInSet(o.marks)&&(f=[r]):f=o.marks;if(f&&f.length){let d=Math.min(c+o.nodeSize,n);for(let p=0;p<f.length;p++){let m=f[p],y;for(let b=0;b<i.length;b++){let S=i[b];S.step==s-1&&m.eq(i[b].style)&&(y=S)}y?(y.to=d,y.step=s):i.push({style:m,from:Math.max(c,e),to:d,step:s})}}}),i.forEach(o=>t.step(new yi(o.from,o.to,o.style)))}function h1(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],c=e+1;for(let f=0;f<s.childCount;f++){let d=s.child(f),p=c+d.nodeSize,m=r.matchType(d.type);if(!m)o.push(new cn(c,p,he.empty));else{r=m;for(let y=0;y<d.marks.length;y++)n.allowsMarkType(d.marks[y].type)||t.step(new yi(c,p,d.marks[y]));if(i&&d.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,S;for(;y=b.exec(d.text);)S||(S=new he(Q.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),o.push(new cn(c+y.index,c+y.index+y[0].length,S))}}c=p}if(!r.validEnd){let f=r.fillBefore(Q.empty,!0);t.replace(c,c,new he(f,0,0))}for(let f=o.length-1;f>=0;f--)t.step(o[f])}function Dz(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ia(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+i,f=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(c,f,n))return r;if(r==0||o.type.spec.isolating||!Dz(o,c,f))break;c&&(i=1),f<o.childCount&&(s=1)}return null}function Rz(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),c=i.after(s+1),f=o,d=c,p=Q.empty,m=0;for(let S=s,v=!1;S>n;S--)v||r.index(S)>0?(v=!0,p=Q.from(r.node(S).copy(p)),m++):f--;let y=Q.empty,b=0;for(let S=s,v=!1;S>n;S--)v||i.after(S+1)<i.end(S)?(v=!0,y=Q.from(i.node(S).copy(y)),b++):d++;t.step(new un(f,d,o,c,new he(p.append(y),m,b),p.size-m,!0))}function p1(t,e,n=null,r=t){let i=Nz(t,e),s=i&&zz(r,e);return s?i.map(pC).concat({type:e,attrs:n}).concat(s.map(pC)):null}function pC(t){return{type:t,attrs:null}}function Nz(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function zz(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let f=(o.length?o[o.length-1]:e).contentMatch;for(let d=r;f&&d<i;d++)f=f.matchType(n.child(d).type);return!f||!f.validEnd?null:o}function Lz(t,e,n){let r=Q.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let c=n[o].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=Q.from(n[o].type.create(n[o].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 Iz(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,(o,c)=>{let f=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,f)&&Bz(t.doc,t.mapping.slice(s).map(c),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?d=!1:!b&&S&&(d=!0)}d===!1&&uM(t,o,c,s),h1(t,t.mapping.slice(s).map(c,1),r,void 0,d===null);let p=t.mapping.slice(s),m=p.map(c,1),y=p.map(c+o.nodeSize,1);return t.step(new un(m,y,m+1,y-1,new he(Q.from(r.create(f,null,o.marks)),0,0),1,!0)),d===!0&&cM(t,o,c,s),!1}})}function cM(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(i.text);){let f=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function uM(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
53
- `))}})}function Bz(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function jz(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 o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);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(Q.from(o),0,0),1,!0))}function rs(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,p=n-2;d>s;d--,p--){let m=i.node(d),y=i.index(d);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(y,m.childCount),S=r&&r[p+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let v=r&&r[p]||m;if(!m.canReplace(y+1,m.childCount)||!v.type.validContent(b))return!1}let c=i.indexAfter(s),f=r&&r[0];return i.node(s).canReplaceWith(c,c,f?f.type:i.node(s+1).type)}function Uz(t,e,n=1,r){let i=t.doc.resolve(e),s=Q.empty,o=Q.empty;for(let c=i.depth,f=i.depth-n,d=n-1;c>f;c--,d--){s=Q.from(i.node(c).copy(s));let p=r&&r[d];o=Q.from(p?p.type.create(p.attrs,o):i.node(c).copy(o))}t.step(new cn(e,e,new he(s.append(o),n,n),!0))}function cl(t,e){let n=t.resolve(e),r=n.index();return fM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Hz(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),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function fM(t,e){return!!(t&&e&&!t.isLeaf&&Hz(t,e))}function Bp(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),c++,o=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),o=r.node(i+1)),s&&!s.isTextblock&&fM(s,o)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Vz(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let p=o.whitespace=="pre",m=!!o.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);uM(t,p.node(),p.before(),c)}o.inlineContent&&h1(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let f=t.mapping.slice(c),d=f.map(e-n);if(t.step(new cn(d,f.map(e+n,-1),he.empty,!0)),r===!0){let p=t.doc.resolve(d);cM(t,p.node(),p.before(),t.steps.length)}return t}function Pz(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 dM(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 o=r.depth;o>=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,f=r.index(o)+(c>0?1:0),d=r.node(o),p=!1;if(s==1)p=d.canReplace(f,f,i);else{let m=d.contentMatchAt(f).findWrapping(i.firstChild.type);p=m&&d.canReplaceWith(f,f,m[0])}if(p)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function jp(t,e,n=e,r=he.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return hM(i,s,r)?new cn(e,n,r):new Fz(i,s,r).fit()}function hM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Fz{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Q.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=Q.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,c=i.depth;for(;o&&c&&s.childCount==1;)s=s.firstChild.content,o--,c--;let f=new he(s,o,c);return e>-1?new un(r.pos,e,this.$to.pos,this.$to.end(),f,n):f.size||r.pos!=this.$to.pos?new cn(r.pos,i.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=By(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:d}=this.frontier[c],p,m=null;if(n==1&&(o?d.matchType(o.type)||(m=d.fillBefore(Q.from(o),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&o&&(p=d.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=By(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=By(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new he(Yc(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new he(Yc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let v=0;v<s.length;v++)this.openFrontierNode(s[v]);let o=this.unplaced,c=r?r.content:o.content,f=o.openStart-e,d=0,p=[],{match:m,type:y}=this.frontier[n];if(i){for(let v=0;v<i.childCount;v++)p.push(i.child(v));m=m.matchFragment(i)}let b=c.size+e-(o.content.size-o.openEnd);for(;d<c.childCount;){let v=c.child(d),k=m.matchType(v.type);if(!k)break;d++,(d>1||f==0||v.content.size)&&(m=k,p.push(pM(v.mark(y.allowedMarks(v.marks)),d==1?f:0,d==c.childCount?b:-1)))}let S=d==c.childCount;S||(b=-1),this.placed=Kc(this.placed,n,Q.from(p)),this.frontier[n].match=m,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,k=c;v<b;v++){let C=k.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),k=C.content}this.unplaced=S?e==0?he.empty:new he(Yc(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new he(Yc(o.content,e,d),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!jy(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)),o=jy(e,n,i,r,s);if(o){for(let c=n-1;c>=0;c--){let{match:f,type:d}=this.frontier[c],p=jy(e,c,d,f,!0);if(!p||p.childCount)continue e}return{depth:n,fit:o,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=Kc(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=Kc(this.placed,this.depth,Q.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Q.empty,!0);n.childCount&&(this.placed=Kc(this.placed,this.frontier.length,n))}}function Yc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Yc(t.firstChild.content,e-1,n)))}function Kc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Kc(t.lastChild.content,e-1,n)))}function By(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function pM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,pM(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(Q.empty,!0)))),t.copy(r)}function jy(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,o);return c&&!$z(n,s.content,o)?c:null}function $z(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function qz(t){return t.spec.defining||t.spec.definingForContent}function Yz(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(hM(i,s,r))return t.step(new cn(e,n,r));let o=gM(i,s);o[o.length-1]==0&&o.pop();let c=-(i.depth+1);o.unshift(c);for(let y=i.depth,b=i.pos-1;y>0;y--,b--){let S=i.node(y).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;o.indexOf(y)>-1?c=y:i.before(y)==b&&o.splice(1,0,-y)}let f=o.indexOf(c),d=[],p=r.openStart;for(let y=r.content,b=0;;b++){let S=y.firstChild;if(d.push(S),b==r.openStart)break;y=S.content}for(let y=p-1;y>=0;y--){let b=d[y],S=qz(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))p=y;else if(S||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+p+1)%(r.openStart+1),S=d[b];if(S)for(let v=0;v<o.length;v++){let k=o[(v+f)%o.length],C=!0;k<0&&(C=!1,k=-k);let U=i.node(k-1),z=i.index(k-1);if(U.canReplaceWith(z,z,S.type,S.marks))return t.replace(i.before(k),C?s.after(k):n,new he(mM(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>m));y--){let b=o[y];b<0||(e=i.before(b),n=s.after(b))}}function mM(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(mM(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(Q.empty,!0))}return t}function Kz(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Pz(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new he(Q.from(r),0,0))}function Gz(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=gM(r,i);for(let o=0;o<s.length;o++){let c=s[o],f=o==s.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function gM(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 aa extends Bn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jt.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 Jt.fromReplace(e,this.pos,this.pos+1,new he(Q.from(i),0,n.isLeaf?0:1))}getMap(){return Sr.empty}invert(e){return new aa(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 aa(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 aa(n.pos,n.attr,n.value)}}Bn.jsonID("attr",aa);class vu extends Bn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Jt.ok(r)}getMap(){return Sr.empty}invert(e){return new vu(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 vu(n.attr,n.value)}}Bn.jsonID("docAttr",vu);let Sa=class extends Error{};Sa=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Sa.prototype=Object.create(Error.prototype);Sa.prototype.constructor=Sa;Sa.prototype.name="TransformError";class m1{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 Sa(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,o,c,f)=>{e=Math.min(e,c),n=Math.max(n,f)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=he.empty){let i=jp(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new he(Q.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 Yz(this,e,n,r),this}replaceRangeWith(e,n,r){return Kz(this,e,n,r),this}deleteRange(e,n){return Gz(this,e,n),this}lift(e,n){return Rz(this,e,n),this}join(e,n=1){return Vz(this,e,n),this}wrap(e,n){return Lz(this,e,n),this}setBlockType(e,n=e,r,i=null){return Iz(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return jz(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new aa(e,n,r)),this}setDocAttribute(e,n){return this.step(new vu(e,n)),this}addNodeMark(e,n){return this.step(new Gs(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 kt)n.isInSet(r.marks)&&this.step(new Zl(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Zl(e,s)),i=s.removeFromSet(i);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return Uz(this,e,n,r),this}addMark(e,n,r){return Oz(this,e,n,r),this}removeMark(e,n,r){return _z(this,e,n,r),this}clearIncompatible(e,n,r){return h1(this,e,n,r),this}}const Uy=Object.create(null);class De{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new yM(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,o=this.ranges;for(let c=0;c<o.length;c++){let{$from:f,$to:d}=o[c],p=e.mapping.slice(s);e.replaceRange(p.map(f.pos),p.map(d.pos),c?he.empty:n),c==0&&yC(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:o,$to:c}=i[s],f=e.mapping.slice(r),d=f.map(o.pos),p=f.map(c.pos);s?e.deleteRange(d,p):(e.replaceRangeWith(d,p,n),yC(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Te(e):ea(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 o=n<0?ea(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):ea(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ir(e.node(0))}static atStart(e){return ea(e,e,0,0,1)||new ir(e)}static atEnd(e){return ea(e,e,e.content.size,e.childCount,-1)||new ir(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Uy[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 Uy)throw new RangeError("Duplicate use of selection JSON ID "+e);return Uy[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Te.between(this.$anchor,this.$head).getBookmark()}}De.prototype.visible=!0;class yM{constructor(e,n){this.$from=e,this.$to=n}}let mC=!1;function gC(t){!mC&&!t.parent.inlineContent&&(mC=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Te extends De{constructor(e,n=e){gC(e),gC(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return De.near(r);let i=e.resolve(n.map(this.anchor));return new Te(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 Te&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Up(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 Te(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=De.findFrom(n,r,!0)||De.findFrom(n,-r,!0);if(s)n=s.$head;else return De.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(De.findFrom(e,-r,!0)||De.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Te(e,n)}}De.jsonID("text",Te);class Up{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Up(e.map(this.anchor),e.map(this.head))}resolve(e){return Te.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ce extends De{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?De.near(s):new Ce(s)}content(){return new he(Q.from(this.node),0,0)}eq(e){return e instanceof Ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new g1(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ce(e.resolve(n.anchor))}static create(e,n){return new Ce(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ce.prototype.visible=!1;De.jsonID("node",Ce);class g1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Up(r,r):new g1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ce.isSelectable(r)?new Ce(n):De.near(n)}}class ir extends De{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=De.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ir(e)}map(e){return new ir(e)}eq(e){return e instanceof ir}getBookmark(){return Zz}}De.jsonID("all",ir);const Zz={map(){return this},resolve(t){return new ir(t)}};function ea(t,e,n,r,i,s=!1){if(e.inlineContent)return Te.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let c=e.child(o);if(c.isAtom){if(!s&&Ce.isSelectable(c))return Ce.create(t,n-(i<0?c.nodeSize:0))}else{let f=ea(t,c,n+i,i<0?c.childCount:0,i,s);if(f)return f}n+=c.nodeSize*i}return null}function yC(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof cn||i instanceof un))return;let s=t.mapping.maps[r],o;s.forEach((c,f,d,p)=>{o==null&&(o=p)}),t.setSelection(De.near(t.doc.resolve(o),n))}const bC=1,Dd=2,xC=4;let Wz=class extends m1{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|bC)&~Dd,this.storedMarks=null,this}get selectionSet(){return(this.updated&bC)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Dd,this}ensureMarks(e){return kt.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&Dd)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Dd,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)||kt.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 o=this.doc.resolve(n);s=r==n?o.marks():o.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(De.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|=xC,this}get scrolledIntoView(){return(this.updated&xC)>0}};function SC(t,e){return!e||!t?t:t.bind(e)}class Gc{constructor(e,n,r){this.name=e,this.init=SC(n.init,r),this.apply=SC(n.apply,r)}}const Jz=[new Gc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Gc("selection",{init(t,e){return t.selection||De.atStart(e.doc)},apply(t){return t.selection}}),new Gc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Gc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Hy{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jz.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 Gc(r.key,r.spec.state,r))})}}class ia{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 o=0;o<this.config.plugins.length;o++){let c=this.config.plugins[o];if(c.spec.appendTransaction){let f=i?i[o].n:0,d=i?i[o].state:this,p=f<n.length&&c.spec.appendTransaction.call(c,f?n.slice(f):n,d,r);if(p&&r.filterTransaction(p,o)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<o?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[o]={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 ia(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 Wz(this)}static create(e){let n=new Hy(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ia(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 Hy(this.schema,e.plugins),r=n.fields,i=new ia(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]: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 Hy(e.schema,e.plugins),s=new ia(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Js.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=De.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let f=r[c],d=f.spec.state;if(f.key==o.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[o.name]=d.fromJSON.call(f,e,n[c],s);return}}s[o.name]=o.init(e,s)}}),s}}function bM(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=bM(i,e,{})),n[r]=i}return n}class Ct{constructor(e){this.spec=e,this.props={},e.props&&bM(e.props,this,this.props),this.key=e.key?e.key.key:xM("plugin")}getState(e){return e[this.key]}}const Vy=Object.create(null);function xM(t){return t in Vy?t+"$"+ ++Vy[t]:(Vy[t]=0,t+"$")}class Nt{constructor(e="key"){this.key=xM(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},wa=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let W0=null;const ts=function(t,e,n){let r=W0||(W0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Xz=function(){W0=null},Wl=function(t,e,n,r){return n&&(wC(t,e,n,r,-1)||wC(t,e,n,r,1))},Qz=/^(img|br|input|textarea|hr)$/i;function wC(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Hr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Qu(t)||Qz.test(t.nodeName)||t.contentEditable=="false")return!1;e=Cn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Hr(t):0}else return!1}}function Hr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function e3(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=Hr(t)}else if(t.parentNode&&!Qu(t))e=Cn(t),t=t.parentNode;else return null}}function t3(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&&!Qu(t))e=Cn(t)+1,t=t.parentNode;else return null}}function n3(t,e,n){for(let r=e==0,i=e==Hr(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==Hr(t)}}function Qu(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 Hp=function(t){return t.focusNode&&Wl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Rl(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function r3(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function i3(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Hr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Hr(r.startContainer),r.startOffset)}}}const vi=typeof navigator<"u"?navigator:null,vC=typeof document<"u"?document:null,ul=vi&&vi.userAgent||"",J0=/Edge\/(\d+)/.exec(ul),SM=/MSIE \d/.exec(ul),X0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ul),sr=!!(SM||X0||J0),Xs=SM?document.documentMode:X0?+X0[1]:J0?+J0[1]:0,Fr=!sr&&/gecko\/(\d+)/i.test(ul);Fr&&+(/Firefox\/(\d+)/.exec(ul)||[0,0])[1];const Q0=!sr&&/Chrome\/(\d+)/.exec(ul),Tn=!!Q0,wM=Q0?+Q0[1]:0,zn=!sr&&!!vi&&/Apple Computer/.test(vi.vendor),va=zn&&(/Mobile\/\w+/.test(ul)||!!vi&&vi.maxTouchPoints>2),jr=va||(vi?/Mac/.test(vi.platform):!1),vM=vi?/Win/.test(vi.platform):!1,ns=/Android \d/.test(ul),ef=!!vC&&"webkitFontSmoothing"in vC.documentElement.style,s3=ef?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function l3(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 Gi(t,e){return typeof t=="number"?t:t[e]}function o3(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 kC(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=wa(o);continue}let c=o,f=c==s.body,d=f?l3(s):o3(c),p=0,m=0;if(e.top<d.top+Gi(r,"top")?m=-(d.top-e.top+Gi(i,"top")):e.bottom>d.bottom-Gi(r,"bottom")&&(m=e.bottom-e.top>d.bottom-d.top?e.top+Gi(i,"top")-d.top:e.bottom-d.bottom+Gi(i,"bottom")),e.left<d.left+Gi(r,"left")?p=-(d.left-e.left+Gi(i,"left")):e.right>d.right-Gi(r,"right")&&(p=e.right-d.right+Gi(i,"right")),p||m)if(f)s.defaultView.scrollBy(p,m);else{let b=c.scrollLeft,S=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let v=c.scrollLeft-b,k=c.scrollTop-S;e={left:e.left-v,top:e.top-k,right:e.right-v,bottom:e.bottom-k}}let y=f?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:wa(o)}}function a3(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let c=t.root.elementFromPoint(s,o);if(!c||c==t.dom||!t.dom.contains(c))continue;let f=c.getBoundingClientRect();if(f.top>=n-20){r=c,i=f.top;break}}return{refDOM:r,refTop:i,stack:kM(t.dom)}}function kM(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=wa(r));return e}function c3({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;CM(n,r==0?0:r-e)}function CM(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 Zo=null;function u3(t){if(t.setActive)return t.setActive();if(Zo)return t.focus(Zo);let e=kM(t);t.focus(Zo==null?{get preventScroll(){return Zo={preventScroll:!0},!0}}:void 0),Zo||(Zo=!1,CM(e,0))}function EM(t,e){let n,r=2e8,i,s=0,o=e.top,c=e.top,f,d;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let y;if(p.nodeType==1)y=p.getClientRects();else if(p.nodeType==3)y=ts(p).getClientRects();else continue;for(let b=0;b<y.length;b++){let S=y[b];if(S.top<=o&&S.bottom>=c){o=Math.max(S.bottom,o),c=Math.min(S.top,c);let v=S.left>e.left?S.left-e.left:S.right<e.left?e.left-S.right:0;if(v<r){n=p,r=v,i=v&&n.nodeType==3?{left:S.right<e.left?S.right:S.left,top:e.top}:e,p.nodeType==1&&v&&(s=m+(e.left>=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!f&&S.left<=e.left&&S.right>=e.left&&(f=p,d={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(s=m+1)}}return!n&&f&&(n=f,i=d,r=0),n&&n.nodeType==3?f3(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:EM(n,i)}function f3(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 o=js(r,1);if(o.top!=o.bottom&&y1(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function y1(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function d3(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function h3(t,e,n){let{node:r,offset:i}=EM(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function p3(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),f;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((f=c.dom.getBoundingClientRect()).width||f.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&f.left>r.left||f.top>r.top?i=c.posBefore:(!o&&f.right<r.left||f.bottom<r.top)&&(i=c.posAfter),o=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(f.top+f.bottom)/2:r.left<(f.left+f.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function TM(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 o=t.childNodes[s];if(o.nodeType==1){let c=o.getClientRects();for(let f=0;f<c.length;f++){let d=c[f];if(y1(e,d))return TM(o,e,d)}}if((s=(s+1)%r)==i)break}return t}function m3(t,e){let n=t.dom.ownerDocument,r,i=0,s=i3(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let d=t.dom.getBoundingClientRect();if(!y1(e,d)||(o=TM(t.dom,e,d),!o))return null}if(zn)for(let d=o;r&&d;d=wa(d))d.draggable&&(r=void 0);if(o=d3(o,e),r){if(Fr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],m;p.nodeName=="IMG"&&(m=p.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let d;ef&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=p3(t,r,i,e))}c==null&&(c=h3(t,o,e));let f=t.docView.nearestDesc(o,!0);return{pos:c,inside:f?f.posAtStart-f.border:-1}}function CC(t){return t.top<t.bottom||t.left<t.right}function js(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(CC(r))return r}return Array.prototype.find.call(n,CC)||t.getBoundingClientRect()}const g3=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function AM(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=ef||Fr;if(r.nodeType==3)if(o&&(g3.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let f=js(ts(r,i,i),n);if(Fr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=js(ts(r,i-1,i-1),-1);if(d.top==f.top){let p=js(ts(r,i,i+1),-1);if(p.top!=f.top)return Hc(p,p.left<d.left)}}return f}else{let f=i,d=i,p=n<0?1:-1;return n<0&&!i?(d++,p=-1):n>=0&&i==r.nodeValue.length?(f--,p=1):n<0?f--:d++,Hc(js(ts(r,f,d),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Hr(r))){let f=r.childNodes[i-1];if(f.nodeType==1)return Py(f.getBoundingClientRect(),!1)}if(s==null&&i<Hr(r)){let f=r.childNodes[i];if(f.nodeType==1)return Py(f.getBoundingClientRect(),!0)}return Py(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Hr(r))){let f=r.childNodes[i-1],d=f.nodeType==3?ts(f,Hr(f)-(o?0:1)):f.nodeType==1&&(f.nodeName!="BR"||!f.nextSibling)?f:null;if(d)return Hc(js(d,1),!1)}if(s==null&&i<Hr(r)){let f=r.childNodes[i];for(;f.pmViewDesc&&f.pmViewDesc.ignoreForCoords;)f=f.nextSibling;let d=f?f.nodeType==3?ts(f,0,o?0:1):f.nodeType==1?f:null:null;if(d)return Hc(js(d,-1),!0)}return Hc(js(r.nodeType==3?ts(r):r,-n),n>=0)}function Hc(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 Py(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 MM(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 y3(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return MM(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 o=AM(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=ts(c,0,c.nodeValue.length).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.bottom>p.top+1&&(n=="up"?o.top-p.top>(p.bottom-o.top)*2:p.bottom-o.bottom>(o.bottom-p.top)*2))return!1}}return!0})}const b3=/[\u0590-\u08ac]/;function x3(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,c=t.domSelection();return c?!b3.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:o:MM(t,e,()=>{let{focusNode:f,focusOffset:d,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),y=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:S,focusOffset:v}=t.domSelectionRange(),k=S&&!b.contains(S.nodeType==1?S:S.parentNode)||f==S&&d==v;try{c.collapse(p,m),f&&(f!=p||d!=m)&&c.extend&&c.extend(f,d)}catch{}return y!=null&&(c.caretBidiLevel=y),k}):r.pos==r.start()||r.pos==r.end()}let EC=null,TC=null,AC=!1;function S3(t,e,n){return EC==e&&TC==n?AC:(EC=e,TC=n,AC=n=="up"||n=="down"?y3(t,e,n):x3(t,e,n))}const $r=0,MC=1,Ll=2,ki=3;class tf{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=$r,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,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):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),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==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 o=0;o<i.children.length;o++){let c=i.children[o];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 o=this.children[r],c=s+o.size;if(c>e||o instanceof _M){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 OM&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Cn(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!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 o=r,c=0;;c++){let f=this.children[c],d=o+f.size;if(i==-1&&e<=d){let p=o+f.border;if(e>=p&&n<=d-f.border&&f.node&&f.contentDOM&&this.contentDOM.contains(f.contentDOM))return f.parseRange(e,n,p);e=o;for(let m=c;m>0;m--){let y=this.children[m-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){i=Cn(y.dom)+1;break}e-=y.size}i==-1&&(i=0)}if(i>-1&&(d>n||c==this.children.length-1)){n=d;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Cn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=d}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let b=0,S=0;b<this.children.length;b++){let v=this.children[b],k=S+v.size;if(s>S&&o<k)return v.setSelection(e-S-v.border,n-S-v.border,r,i);S=k}let c=this.domFromPos(e,e?-1:1),f=n==e?c:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((Fr||zn)&&e==n){let{node:b,offset:S}=c;if(b.nodeType==3){if(m=!!(S&&b.nodeValue[S-1]==`
54
- `),m&&S==b.nodeValue.length)for(let v=b,k;v;v=v.parentNode){if(k=v.nextSibling){k.nodeName=="BR"&&(c=f={node:k.parentNode,offset:Cn(k)+1});break}let C=v.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let v=b.childNodes[S-1];m=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Fr&&p.focusNode&&p.focusNode!=f.node&&p.focusNode.nodeType==1){let b=p.focusNode.childNodes[p.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&zn)&&Wl(c.node,c.offset,p.anchorNode,p.anchorOffset)&&Wl(f.node,f.offset,p.focusNode,p.focusOffset))return;let y=!1;if((d.extend||e==n)&&!(m&&Fr)){d.collapse(c.node,c.offset);try{e!=n&&d.extend(f.node,f.offset),y=!0}catch{}}if(!y){if(e>n){let S=c;c=f,f=S}let b=document.createRange();b.setEnd(f.node,f.offset),b.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let c=r+s.border,f=o-s.border;if(e>=c&&n<=f){this.dirty=e==r||n==o?Ll:MC,e==c&&n==f&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ki:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ll:ki}r=o}this.dirty=Ll}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ll:MC;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class OM extends tf{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==$r&&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 w3 extends tf{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 Jl extends tf{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],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=lo.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Jl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ki||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ki&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=$r){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=$r}}slice(e,n,r){let i=Jl.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=tb(s,n,o,r)),e>0&&(s=tb(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 Qs extends tf{constructor(e,n,r,i,s,o,c,f,d){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,o){let c=s.nodeViews[n.type.name],f,d=c&&c(n,s,()=>{if(!f)return o;if(f.parent)return f.parent.posBeforeChild(f)},r,i),p=d&&d.dom,m=d&&d.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:m}=lo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let y=p;return p=NM(p,r,n),d?f=new v3(e,n,r,i,p,m||null,y,d,s,o+1):n.isText?new Vp(e,n,r,i,p,y,s):new Qs(e,n,r,i,p,m||null,y,s,o+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=()=>Q.empty)}return e}matchesNode(e,n,r){return this.dirty==$r&&e.eq(this.node)&&kh(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,o=s&&s.pos>-1?s:null,c=s&&s.pos<0,f=new C3(this,o&&o.node,e);A3(this.node,this.innerDeco,(d,p,m)=>{d.spec.marks?f.syncToMarks(d.spec.marks,r,e,p):d.type.side>=0&&!m&&f.syncToMarks(p==this.node.childCount?kt.none:this.node.child(p).marks,r,e,p),f.placeWidget(d,e,i)},(d,p,m,y)=>{f.syncToMarks(d.marks,r,e,y);let b;f.findNodeMatch(d,p,m,y)||c&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(b=f.findIndexWithChild(s.node))>-1&&f.updateNodeAt(d,p,m,b,e)||f.updateNextNode(d,p,m,e,y,i)||f.addNode(d,p,m,e,i),i+=d.nodeSize}),f.syncToMarks([],r,e,0),this.node.isTextblock&&f.addTextblockHacks(),f.destroyRest(),(f.changed||this.dirty==Ll)&&(o&&this.protectLocalComposition(e,o),DM(this.contentDOM,this.children,e),va&&M3(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Te)||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 o=s.nodeValue,c=O3(this.node.content,o,r-n,i-n);return c<0?null:{node:s,pos:c,text:o}}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 o=new w3(this,s,n,i);e.input.compositionNodes.push(o),this.children=tb(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==ki||!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=$r}updateOuterDeco(e){if(kh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=RM(this.dom,this.nodeDOM,eb(this.outerDeco,this.node,n),eb(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 OC(t,e,n,r,i){NM(r,e,t);let s=new Qs(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Vp extends Qs{constructor(e,n,r,i,s,o,c){super(e,n,r,i,s,null,o,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==ki||this.dirty!=$r&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=$r||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=$r,!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 Vp(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=ki)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _M extends tf{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==$r&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class v3 extends Qs{constructor(e,n,r,i,s,o,c,f,d,p){super(e,n,r,i,s,o,c,d,p),this.spec=f}update(e,n,r,i){if(this.dirty==ki)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 DM(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],c=o.dom;if(c.parentNode==t){for(;c!=r;)r=_C(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(o instanceof Jl){let f=r?r.previousSibling:t.lastChild;DM(o.contentDOM,o.children,n),r=f?f.nextSibling:t.firstChild}}for(;r;)r=_C(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const tu=function(t){t&&(this.nodeName=t)};tu.prototype=Object.create(null);const Il=[new tu];function eb(t,e,n){if(t.length==0)return Il;let r=n?Il[0]:new tu,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new tu(o.nodeName));for(let c in o){let f=o[c];f!=null&&(n&&i.length==1&&i.push(r=new tu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+f:c=="style"?r.style=(r.style?r.style+";":"")+f:c!="nodeName"&&(r[c]=f))}}}return i}function RM(t,e,n,r){if(n==Il&&r==Il)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],c=n[s];if(s){let f;c&&c.nodeName==o.nodeName&&i!=t&&(f=i.parentNode)&&f.nodeName.toLowerCase()==o.nodeName||(f=document.createElement(o.nodeName),f.pmIsDeco=!0,f.appendChild(i),c=Il[0]),i=f}k3(i,c||Il[0],o)}return i}function k3(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 NM(t,e,n){return RM(t,t,Il,eb(e,n,t.nodeType!=1))}function kh(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 _C(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class C3{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=E3(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,o=this.stack.length>>1,c=Math.min(o,e.length);for(;s<c&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=$r,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let f=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let p=this.index;p<d;p++){let m=this.top.children[p];if(m.matchesMark(e[o])&&!this.isLocked(m.dom)){f=p;break}}if(f>-1)f>this.index&&(this.changed=!0,this.destroyBetween(this.index,f)),this.top=this.top.children[this.index];else{let p=Jl.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let c=this.index,f=Math.min(this.top.children.length,c+5);c<f;c++){let d=this.top.children[c];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==ki&&o.dom==o.contentDOM&&(o.dirty=Ll),o.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,o){for(let c=this.index;c<this.top.children.length;c++){let f=this.top.children[c];if(f instanceof Qs){let d=this.preMatch.matched.get(f);if(d!=null&&d!=s)return!1;let p=f.dom,m,y=this.isLocked(p)&&!(e.isText&&f.node&&f.node.isText&&f.nodeDOM.nodeValue==e.text&&f.dirty!=ki&&kh(n,f.outerDeco));if(!y&&f.update(e,n,r,i))return this.destroyBetween(this.index,c),f.dom!=p&&(this.changed=!0),this.index++,!0;if(!y&&(m=this.recreateWrapper(f,e,n,r,i,o)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Ll,m.updateChildren(i,o+1),m.dirty=$r),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!kh(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=Qs.create(this.top,n,r,i,s,o);if(c.contentDOM){c.children=e.children,e.children=[];for(let f of c.children)f.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let o=Qs.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),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 OM(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 Jl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Vp)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((zn||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 _M(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 E3(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let c;for(;;)if(r){let d=n.children[r-1];if(d instanceof Jl)n=d,r=d.children.length;else{c=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let f=c.node;if(f){if(f!=t.child(i-1))break;--i,s.set(c,i),o.push(c)}}return{index:i,matched:s,matches:o.reverse()}}function T3(t,e){return t.type.side-e.type.side}function A3(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let d=0;d<t.childCount;d++){let p=t.child(d);r(p,i,e.forChild(s,p),d),s+=p.nodeSize}return}let o=0,c=[],f=null;for(let d=0;;){let p,m;for(;o<i.length&&i[o].to==s;){let k=i[o++];k.widget&&(p?(m||(m=[p])).push(k):p=k)}if(p)if(m){m.sort(T3);for(let k=0;k<m.length;k++)n(m[k],d,!!f)}else n(p,d,!!f);let y,b;if(f)b=-1,y=f,f=null;else if(d<t.childCount)b=d,y=t.child(d++);else break;for(let k=0;k<c.length;k++)c[k].to<=s&&c.splice(k--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)c.push(i[o++]);let S=s+y.nodeSize;if(y.isText){let k=S;o<i.length&&i[o].from<k&&(k=i[o].from);for(let C=0;C<c.length;C++)c[C].to<k&&(k=c[C].to);k<S&&(f=y.cut(k-s),y=y.cut(0,k-s),S=k,b=-1)}else for(;o<i.length&&i[o].to<S;)o++;let v=y.isInline&&!y.isLeaf?c.filter(k=>!k.inline):c.slice();r(y,v,e.forChild(s,y),b),s=S}}function M3(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 O3(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),c=s;if(s+=o.nodeSize,!o.isText)continue;let f=o.text;for(;i<t.childCount;){let d=t.child(i++);if(s+=d.nodeSize,!d.isText)break;f+=d.text}if(s>=n){if(s>=r&&f.slice(r-e.length-c,r-c)==e)return r-e.length;let d=c<r?f.lastIndexOf(e,r-c-1):-1;if(d>=0&&d+e.length+c>=n)return c+d;if(n==r&&f.length>=r+e.length-c&&f.slice(r-c,r-c+e.length)==e)return r}}return-1}function tb(t,e,n,r,i){let s=[];for(let o=0,c=0;o<t.length;o++){let f=t[o],d=c,p=c+=f.size;d>=n||p<=e?s.push(f):(d<e&&s.push(f.slice(0,e-d,r)),i&&(s.push(i),i=void 0),p>n&&s.push(f.slice(n-d,f.size,r)))}return s}function b1(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,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),f,d;if(Hp(n)){for(f=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ce.isSelectable(m)&&i.parent&&!(m.isInline&&n3(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;d=new Ce(o==y?c:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,y=o;for(let b=0;b<n.rangeCount;b++){let S=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(S.startContainer,S.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[f,o]=y==t.state.selection.anchor?[y,m]:[m,y],c=r.resolve(o)}else f=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(f<0)return null}let p=r.resolve(f);if(!d){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;d=x1(t,p,c,m)}return d}function zM(t){return t.editable?t.hasFocus():IM(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function is(t,e=!1){let n=t.state.selection;if(LM(t,n),!!zM(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Tn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Wl(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)D3(t);else{let{anchor:r,head:i}=n,s,o;DC&&!(n instanceof Te)&&(n.$from.parent.inlineContent||(s=RC(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=RC(t,n.to))),t.docView.setSelection(r,i,t,e),DC&&(s&&NC(s),o&&NC(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&_3(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const DC=zn||Tn&&wM<63;function RC(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(zn&&i&&i.contentEditable=="false")return Fy(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Fy(i);if(s)return Fy(s)}}function Fy(t){return t.contentEditable="true",zn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function NC(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function _3(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(()=>{(!zM(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function D3(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&&sr&&Xs<=11&&(n.disabled=!0,n.disabled=!1)}function LM(t,e){if(e instanceof Ce){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(zC(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else zC(t)}function zC(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function x1(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Te.between(e,n,r)}function LC(t){return t.editable&&!t.hasFocus()?!1:IM(t)}function IM(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 R3(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Wl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function nb(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&&De.findFrom(s,e)}function Us(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function IC(t,e,n){let r=t.state.selection;if(r instanceof Te)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 o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Us(t,new Te(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=nb(t.state,e);return i&&i instanceof Ce?Us(t,i):!1}else if(!(jr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let c=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ce.isSelectable(s)?Us(t,new Ce(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):ef?Us(t,new Te(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ce&&r.node.isInline)return Us(t,new Te(e>0?r.$to:r.$from));{let i=nb(t.state,e);return i?Us(t,i):!1}}}function Ch(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function nu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Wo(t,e){return e<0?N3(t):z3(t)}function N3(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Fr&&n.nodeType==1&&r<Ch(n)&&nu(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(nu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(BM(n))break;{let c=n.previousSibling;for(;c&&nu(c,-1);)i=n.parentNode,s=Cn(c),c=c.previousSibling;if(c)n=c,r=Ch(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?rb(t,n,r):i&&rb(t,i,s)}function z3(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ch(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(nu(c,1))s=n,o=++r;else break}else{if(BM(n))break;{let c=n.nextSibling;for(;c&&nu(c,1);)s=c.parentNode,o=Cn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Ch(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&rb(t,s,o)}function BM(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function L3(t,e){for(;t&&e==t.childNodes.length&&!Qu(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 I3(t,e){for(;t&&!e&&!Qu(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 rb(t,e,n){if(e.nodeType!=3){let s,o;(o=L3(e,n))?(e=o,n=0):(s=I3(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Hp(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&&is(t)},50)}function BC(t,e){let n=t.state.doc.resolve(e);if(!(Tn||vM)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<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),o=(s.top+s.bottom)/2;if(o>i.top&&o<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 jC(t,e,n){let r=t.state.selection;if(r instanceof Te&&!r.empty||n.indexOf("s")>-1||jr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=nb(t.state,e);if(o&&o instanceof Ce)return Us(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,c=r instanceof ir?De.near(o,e):De.findFrom(o,e);return c?Us(t,c):!1}return!1}function UC(t,e){if(!(t.state.selection instanceof Te))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 o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function HC(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function B3(t){if(!zn||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;HC(t,r,"true"),setTimeout(()=>HC(t,r,"false"),20)}return!1}function j3(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function U3(t,e){let n=e.keyCode,r=j3(e);if(n==8||jr&&n==72&&r=="c")return UC(t,-1)||Wo(t,-1);if(n==46&&!e.shiftKey||jr&&n==68&&r=="c")return UC(t,1)||Wo(t,1);if(n==13||n==27)return!0;if(n==37||jr&&n==66&&r=="c"){let i=n==37?BC(t,t.state.selection.from)=="ltr"?-1:1:-1;return IC(t,i,r)||Wo(t,i)}else if(n==39||jr&&n==70&&r=="c"){let i=n==39?BC(t,t.state.selection.from)=="ltr"?1:-1:1;return IC(t,i,r)||Wo(t,i)}else{if(n==38||jr&&n==80&&r=="c")return jC(t,-1,r)||Wo(t,-1);if(n==40||jr&&n==78&&r=="c")return B3(t)||jC(t,1,r)||Wo(t,1);if(r==(jr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function S1(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 o=t.someProp("clipboardSerializer")||lo.fromSchema(t.state.schema),c=FM(),f=c.createElement("div");f.appendChild(o.serializeFragment(r,{document:c}));let d=f.firstChild,p,m=0;for(;d&&d.nodeType==1&&(p=PM[d.nodeName.toLowerCase()]);){for(let b=p.length-1;b>=0;b--){let S=c.createElement(p[b]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),m++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
55
-
56
- `);return{dom:f,text:y,slice:e}}function jM(t,e,n,r,i){let s=i.parent.type.spec.code,o,c;if(!n&&!e)return null;let f=!!e&&(r||s||!n);if(f){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return c=new he(Q.from(t.state.schema.text(e.replace(/\r\n?/g,`
57
- `))),0,0),t.someProp("transformPasted",y=>{c=y(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",y=>y(e,i,r,t));if(m)c=m;else{let y=i.marks(),{schema:b}=t.state,S=lo.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let k=o.appendChild(document.createElement("p"));v&&k.appendChild(S.serializeNode(b.text(v,y)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=F3(n),ef&&$3(o);let d=o&&o.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Qc.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(f||p),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!H3.test(y.parentNode.nodeName)?{ignore:!0}:null}})),p)c=q3(VC(c,+p[1],+p[2]),p[4]);else if(c=he.maxOpen(V3(c.content,i),!0),c.openStart||c.openEnd){let m=0,y=0;for(let b=c.content.firstChild;m<c.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=c.content.lastChild;y<c.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);c=VC(c,m,y)}return t.someProp("transformPasted",m=>{c=m(c,t,f)}),c}const H3=/^(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 V3(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,o=[];if(t.forEach(c=>{if(!o)return;let f=i.findWrapping(c.type),d;if(!f)return o=null;if(d=o.length&&s.length&&HM(f,s,c,o[o.length-1],0))o[o.length-1]=d;else{o.length&&(o[o.length-1]=VM(o[o.length-1],s.length));let p=UM(c,f);o.push(p),i=i.matchType(p.type),s=f}}),o)return Q.from(o)}return t}function UM(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Q.from(t));return t}function HM(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=HM(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(Q.from(UM(n,t,i+1))))}}function VM(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,VM(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Q.empty,!0);return t.copy(n.append(r))}function ib(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,c=o.content;return t.childCount>1&&(s=0),i<r-1&&(c=ib(c,e,n,r,i+1,s)),i>=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function VC(t,e,n){return e<t.openStart&&(t=new he(ib(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new he(ib(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const PM={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 PC=null;function FM(){return PC||(PC=document.implementation.createHTMLDocument("title"))}let $y=null;function P3(t){let e=window.trustedTypes;return e?($y||($y=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),$y.createHTML(t)):t}function F3(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=FM().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&PM[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=P3(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function $3(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 q3(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:o}=t;for(let c=r.length-2;c>=0;c-=2){let f=n.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=Q.from(f.create(r[c+1],i)),s++,o++}return new he(i,s,o)}const $n={},qn={},Y3={touchstart:!0,touchmove:!0};class K3{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 G3(t){for(let e in $n){let n=$n[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{W3(t,r)&&!w1(t,r)&&(t.editable||!(r.type in qn))&&n(t,r)},Y3[e]?{passive:!0}:void 0)}zn&&t.dom.addEventListener("input",()=>null),sb(t)}function Zs(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Z3(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 sb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>w1(t,r))})}function w1(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function W3(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 J3(t,e){!w1(t,e)&&$n[e.type]&&(t.editable||!(e.type in qn))&&$n[e.type](t,e)}qn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!qM(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ns&&Tn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),va&&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,Rl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||U3(t,n)?n.preventDefault():Zs(t,"key")};qn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};qn.keypress=(t,e)=>{let n=e;if(qM(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||jr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Te)||!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",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Pp(t){return{left:t.clientX,top:t.clientY}}function X3(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function v1(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,c=>o>s.depth?c(t,n,s.nodeAfter,s.before(o),i,!0):c(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function ca(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 Q3(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ce.isSelectable(r)?(ca(t,new Ce(n)),!0):!1}function e4(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ce&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let c=o>s.depth?s.nodeAfter:s.node(o);if(Ce.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(ca(t,Ce.create(t.state.doc,i)),!0):!1}function t4(t,e,n,r,i){return v1(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?e4(t,n):Q3(t,n))}function n4(t,e,n,r){return v1(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function r4(t,e,n,r){return v1(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||i4(t,n,r)}function i4(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ca(t,Te.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(o.inlineContent)ca(t,Te.create(r,c+1,c+1+o.content.size));else if(Ce.isSelectable(o))ca(t,Ce.create(r,c));else continue;return!0}}function k1(t){return Eh(t)}const $M=jr?"metaKey":"ctrlKey";$n.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=k1(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&X3(n,t.input.lastClick)&&!n[$M]&&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 o=t.posAtCoords(Pp(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new s4(t,o,n,!!r)):(s=="doubleClick"?n4:r4)(t,o.pos,o.inside,n)?n.preventDefault():Zs(t,"pointer"))};class s4{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[$M],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let p=e.state.doc.resolve(n.pos);s=p.parent,o=p.depth?p.before():0}const c=i?null:r.target,f=c?e.docView.nearestDesc(c,!0):null;this.target=f&&f.nodeDOM.nodeType==1?f.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof Ce&&d.from<=o&&d.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fr&&!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)),Zs(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(()=>is(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(Pp(e))),this.updateAllowDefault(e),this.allowDefault||!n?Zs(this.view,"pointer"):t4(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||zn&&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)?(ca(this.view,De.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Zs(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zs(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(),k1(t),Zs(t,"pointer")};$n.touchmove=t=>{t.input.lastTouch=Date.now(),Zs(t,"pointer")};$n.contextmenu=t=>k1(t);function qM(t,e){return t.composing?!0:zn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const l4=ns?5e3:-1;qn.compositionstart=qn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Te&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Tn&&vM&&o4(t)))t.markCursor=t.state.storedMarks||n.marks(),Eh(t,!0),t.markCursor=null;else if(Eh(t,!e.selection.empty),Fr&&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 o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}YM(t,l4)};function o4(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}qn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,YM(t,20))};function YM(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Eh(t),e))}function KM(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=c4());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function a4(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=e3(e.focusNode,e.focusOffset),r=t3(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 o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function c4(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Eh(t,e=!1){if(!(ns&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),KM(t),e||t.docView&&t.docView.dirty){let n=b1(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 u4(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 ku=sr&&Xs<15||va&&s3<604;$n.copy=qn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=ku?null:n.clipboardData,o=r.content(),{dom:c,text:f}=S1(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",f)):u4(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function f4(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function d4(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?Cu(t,r.value,null,i,e):Cu(t,r.textContent,r.innerHTML,i,e)},50)}function Cu(t,e,n,r,i){let s=jM(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",f=>f(t,i,s||he.empty)))return!0;if(!s)return!1;let o=f4(s),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function GM(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}qn.paste=(t,e)=>{let n=e;if(t.composing&&!ns)return;let r=ku?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Cu(t,GM(r),r.getData("text/html"),i,n)?n.preventDefault():d4(t,n)};class ZM{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const h4=jr?"altKey":"ctrlKey";function WM(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[h4]}$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(Pp(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Ce?i.to-1:i.to))){if(r&&r.mightDrag)o=Ce.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&&(o=Ce.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:f,text:d,slice:p}=S1(t,c);(!n.dataTransfer.files.length||!Tn||wM>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ku?"Text":"text/html",f.innerHTML),n.dataTransfer.effectAllowed="copyMove",ku||n.dataTransfer.setData("text/plain",d),t.dragging=new ZM(p,WM(t,n),o)};$n.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};qn.dragover=qn.dragenter=(t,e)=>e.preventDefault();qn.drop=(t,e)=>{try{p4(t,e,t.dragging)}finally{t.dragging=null}};function p4(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Pp(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=jM(t,GM(e.dataTransfer),ku?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&WM(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||he.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?dM(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let f=t.state.tr;if(o){let{node:b}=n;b?b.replace(f):f.deleteSelection()}let d=f.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=f.doc;if(p?f.replaceRangeWith(d,d,s.content.firstChild):f.replaceRange(d,d,s),f.doc.eq(m))return;let y=f.doc.resolve(d);if(p&&Ce.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))f.setSelection(new Ce(y));else{let b=f.mapping.map(c);f.mapping.maps[f.mapping.maps.length-1].forEach((S,v,k,C)=>b=C),f.setSelection(x1(t,y,f.doc.resolve(b)))}t.focus(),t.dispatch(f.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())&&is(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&&ns&&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,Rl(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in qn)$n[t]=qn[t];function Eu(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 Th{constructor(e,n){this.toDOM=e,this.spec=n||Pl,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Xt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Th&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Eu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class el{constructor(e,n){this.attrs=e,this.spec=n||Pl}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Xt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof el&&Eu(this.attrs,e.attrs)&&Eu(this.spec,e.spec)}static is(e){return e.type instanceof el}destroy(){}}class C1{constructor(e,n){this.attrs=e,this.spec=n||Pl}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Xt(s.pos-r,o.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 C1&&Eu(this.attrs,e.attrs)&&Eu(this.spec,e.spec)}destroy(){}}class Xt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Xt(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 Xt(e,e,new Th(n,r))}static inline(e,n,r,i){return new Xt(e,n,new el(r,i))}static node(e,n,r,i){return new Xt(e,n,new C1(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof el}get widget(){return this.type instanceof Th}}const ta=[],Pl={};class xt{constructor(e,n){this.local=e.length?e:ta,this.children=n.length?n:ta}static create(e,n){return n.length?Ah(n,e,0,Pl):Dn}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 o=0;o<this.local.length;o++){let c=this.local[o];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==Dn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Pl)}mapInner(e,n,r,i,s){let o;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(e,r,i);f&&f.type.valid(n,f)?(o||(o=[])).push(f):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?m4(this.children,o||[],e,n,r,i,s):o?new xt(o.sort(Fl),ta):Dn}add(e,n){return n.length?this==Dn?xt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,f)=>{let d=f+r,p;if(p=XM(n,c,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<f;)s+=3;i[s]==f?i[s+2]=i[s+2].addInner(c,p,d+1):i.splice(s,0,f,f+c.nodeSize,Ah(p,c,d+1,Pl)),s+=3}});let o=JM(s?QM(n):n,-r);for(let c=0;c<o.length;c++)o[c].type.valid(e,o[c])||o.splice(c--,1);return new xt(o.length?this.local.concat(o).sort(Fl):this.local,i||this.children)}remove(e){return e.length==0||this==Dn?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 o,c=r[s]+n,f=r[s+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<f&&(e[p]=null,(o||(o=[])).push(m));if(!o)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(o,c+1);d!=Dn?r[s+2]=d:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let c=0;c<i.length;c++)i[c].eq(o,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 xt(i,r):Dn}forChild(e,n){if(this==Dn)return this;if(n.isLeaf)return xt.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,o=s+n.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<o&&f.to>s&&f.type instanceof el){let d=Math.max(s,f.from)-s,p=Math.min(o,f.to)-s;d<p&&(i||(i=[])).push(f.copy(d,p))}}if(i){let c=new xt(i.sort(Fl),ta);return r?new Fs([c,r]):c}return r||Dn}eq(e){if(this==e)return!0;if(!(e instanceof xt)||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 E1(this.localsInner(e))}localsInner(e){if(this==Dn)return ta;if(e.inlineContent||!this.local.some(el.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof el||n.push(this.local[r]);return n}forEachSet(e){e(this)}}xt.empty=new xt([],[]);xt.removeOverlap=E1;const Dn=xt.empty;class Fs{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Pl));return Fs.from(r)}forChild(e,n){if(n.isLeaf)return xt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Dn&&(s instanceof Fs?r=r.concat(s.members):r.push(s))}return Fs.from(r)}eq(e){if(!(e instanceof Fs)||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 o=0;o<s.length;o++)n.push(s[o])}}return n?E1(r?n:n.sort(Fl)):ta}static from(e){switch(e.length){case 0:return Dn;case 1:return e[0];default:return new Fs(e.every(n=>n instanceof xt)?e:e.reduce((n,r)=>n.concat(r instanceof xt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function m4(t,e,n,r,i,s,o){let c=t.slice();for(let d=0,p=s;d<n.maps.length;d++){let m=0;n.maps[d].forEach((y,b,S,v)=>{let k=v-S-(b-y);for(let C=0;C<c.length;C+=3){let U=c[C+1];if(U<0||y>U+p-m)continue;let z=c[C]+p-m;b>=z?c[C+1]=y<=z?-2:-1:y>=p&&k&&(c[C]+=k,c[C+1]+=k)}m+=k}),p=n.maps[d].map(p,-1)}let f=!1;for(let d=0;d<c.length;d+=3)if(c[d+1]<0){if(c[d+1]==-2){f=!0,c[d+1]=-1;continue}let p=n.map(t[d]+s),m=p-i;if(m<0||m>=r.content.size){f=!0;continue}let y=n.map(t[d+1]+s,-1),b=y-i,{index:S,offset:v}=r.content.findIndex(m),k=r.maybeChild(S);if(k&&v==m&&v+k.nodeSize==b){let C=c[d+2].mapInner(n,k,p+1,t[d]+s+1,o);C!=Dn?(c[d]=m,c[d+1]=b,c[d+2]=C):(c[d+1]=-2,f=!0)}else f=!0}if(f){let d=g4(c,t,e,n,i,s,o),p=Ah(d,r,0,o);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,y=0;m<p.children.length;m+=3){let b=p.children[m];for(;y<c.length&&c[y]<b;)y+=3;c.splice(y,0,p.children[m],p.children[m+1],p.children[m+2])}}return new xt(e.sort(Fl),c)}function JM(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 Xt(i.from+e,i.to+e,i.type))}return n}function g4(t,e,n,r,i,s,o){function c(f,d){for(let p=0;p<f.local.length;p++){let m=f.local[p].map(r,i,d);m?n.push(m):o.onRemove&&o.onRemove(f.local[p].spec)}for(let p=0;p<f.children.length;p+=3)c(f.children[p+2],f.children[p]+d+1)}for(let f=0;f<t.length;f+=3)t[f+1]==-1&&c(t[f+2],e[f]+s+1);return n}function XM(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function QM(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ah(t,e,n,r){let i=[],s=!1;e.forEach((c,f)=>{let d=XM(t,c,f+n);if(d){s=!0;let p=Ah(d,c,n+f+1,r);p!=Dn&&i.push(f,f+c.nodeSize,p)}});let o=JM(s?QM(t):t,-n).sort(Fl);for(let c=0;c<o.length;c++)o[c].type.valid(e,o[c])||(r.onRemove&&r.onRemove(o[c].spec),o.splice(c--,1));return o.length||i.length?new xt(o,i):Dn}function Fl(t,e){return t.from-e.from||t.to-e.to}function E1(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),FC(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),FC(e,i,r.copy(s.from,r.to)));break}}}return e}function FC(t,e,n){for(;e<t.length&&Fl(n,t[e])>0;)e++;t.splice(e,0,n)}function qy(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Dn&&e.push(r)}),t.cursorWrapper&&e.push(xt.create(t.state.doc,[t.cursorWrapper.deco])),Fs.from(e)}const y4={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},b4=sr&&Xs<=11;class x4{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 S4{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new x4,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]);sr&&Xs<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():zn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),b4&&(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,y4)),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(LC(this.view)){if(this.suppressingSelectionUpdates)return is(this.view);if(sr&&Xs<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Wl(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=wa(s))n.add(s);for(let s=e.anchorNode;s;s=wa(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)&&LC(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,c=!1,f=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],f);m&&(s=s<0?m.from:Math.min(m.from,s),o=o<0?m.to:Math.max(m.to,o),m.typeOver&&(c=!0))}if(f.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of f)if(p.nodeName=="BR"&&p.parentNode){let m=p.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){p.parentNode.removeChild(p);break}m=m.firstChild}}}else if(Fr&&f.length){let p=f.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,y]=p;m.parentNode&&m.parentNode.parentNode==y.parentNode?y.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let y of p){let b=y.parentNode;b&&b.nodeName=="LI"&&(!m||k4(e,m)!=b)&&y.remove()}}}let d=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Hp(r)&&(d=b1(e))&&d.eq(De.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,is(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),w4(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,C4(e,f)),this.handleDOMChange(s,o,c,f),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||is(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let m=e.addedNodes[p];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(sr&&Xs<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:y}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let o=i&&i.parentNode==e.target?Cn(i)+1:0,c=r.localPosFromDOM(e.target,o,-1),f=s&&s.parentNode==e.target?Cn(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,f,1);return{from:c,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let $C=new WeakMap,qC=!1;function w4(t){if(!$C.has(t)&&($C.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Fr,qC)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."),qC=!0}}function YC(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Wl(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function v4(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return YC(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?YC(t,n):null}function k4(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 C4(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 o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let c=o;for(;;){let f=c.firstChild;if(!f||f.nodeType!=1||f.contentEditable=="false"||/^(BR|IMG)$/.test(f.nodeName))break;c=f}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function E4(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:c}=t.docView.parseRange(e,n),f=t.domSelectionRange(),d,p=f.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(d=[{node:p,offset:f.anchorOffset}],Hp(f)||d.push({node:f.focusNode,offset:f.focusOffset})),Tn&&t.input.lastKeyCode===8)for(let k=s;k>i;k--){let C=r.childNodes[k-1],U=C.pmViewDesc;if(C.nodeName=="BR"&&!U){s=k;break}if(!U||U.size)break}let m=t.state.doc,y=t.someProp("domParser")||Qc.fromSchema(t.state.schema),b=m.resolve(o),S=null,v=y.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:T4,context:b});if(d&&d[0].pos!=null){let k=d[0].pos,C=d[1]&&d[1].pos;C==null&&(C=k),S={anchor:k+o,head:C+o}}return{doc:v,sel:S,from:o,to:c}}function T4(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(zn&&/^(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||zn&&/^(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 A4=/^(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 M4(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let L=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,J=b1(t,L);if(J&&!t.state.selection.eq(J)){if(Tn&&ns&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ie=>ie(t,Rl(13,"Enter"))))return;let ce=t.state.tr.setSelection(J);L=="pointer"?ce.setMeta("pointer",!0):L=="key"&&ce.scrollIntoView(),s&&ce.setMeta("composition",s),t.dispatch(ce)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let f=t.state.selection,d=E4(t,e,n),p=t.state.doc,m=p.slice(d.from,d.to),y,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,b="end"):(y=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let S=D4(m.content,d.doc.content,d.from,y,b);if(S&&t.input.domChangeCount++,(va&&t.input.lastIOSEnter>Date.now()-225||ns)&&i.some(L=>L.nodeType==1&&!A4.test(L.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",L=>L(t,Rl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(r&&f instanceof Te&&!f.empty&&f.$head.sameParent(f.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))S={start:f.from,endA:f.to,endB:f.to};else{if(d.sel){let L=KC(t,t.state.doc,d.sel);if(L&&!L.eq(t.state.selection)){let J=t.state.tr.setSelection(L);s&&J.setMeta("composition",s),t.dispatch(J)}}return}t.state.selection.from<t.state.selection.to&&S.start==S.endB&&t.state.selection instanceof Te&&(S.start>t.state.selection.from&&S.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?S.start=t.state.selection.from:S.endA<t.state.selection.to&&S.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),sr&&Xs<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>d.from&&d.doc.textBetween(S.start-d.from-1,S.start-d.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let v=d.doc.resolveNoCache(S.start-d.from),k=d.doc.resolveNoCache(S.endB-d.from),C=p.resolve(S.start),U=v.sameParent(k)&&v.parent.inlineContent&&C.end()>=S.endA;if((va&&t.input.lastIOSEnter>Date.now()-225&&(!U||i.some(L=>L.nodeName=="DIV"||L.nodeName=="P"))||!U&&v.pos<d.doc.content.size&&(!v.sameParent(k)||!v.parent.inlineContent)&&v.pos<k.pos&&!/\S/.test(d.doc.textBetween(v.pos,k.pos,"","")))&&t.someProp("handleKeyDown",L=>L(t,Rl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&_4(p,S.start,S.endA,v,k)&&t.someProp("handleKeyDown",L=>L(t,Rl(8,"Backspace")))){ns&&Tn&&t.domObserver.suppressSelectionUpdates();return}Tn&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),ns&&!U&&v.start()!=k.start()&&k.parentOffset==0&&v.depth==k.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==S.endA&&(S.endB-=2,k=d.doc.resolveNoCache(S.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(L){return L(t,Rl(13,"Enter"))})},20));let z=S.start,re=S.endA,F=L=>{let J=L||t.state.tr.replace(z,re,d.doc.slice(S.start-d.from,S.endB-d.from));if(d.sel){let ce=KC(t,J.doc,d.sel);ce&&!(Tn&&t.composing&&ce.empty&&(S.start!=S.endB||t.input.lastChromeDelete<Date.now()-100)&&(ce.head==z||ce.head==J.mapping.map(re)-1)||sr&&ce.empty&&ce.head==z)&&J.setSelection(ce)}return s&&J.setMeta("composition",s),J.scrollIntoView()},O;if(U)if(v.pos==k.pos){sr&&Xs<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>is(t),20));let L=F(t.state.tr.delete(z,re)),J=p.resolve(S.start).marksAcross(p.resolve(S.endA));J&&L.ensureMarks(J),t.dispatch(L)}else if(S.endA==S.endB&&(O=O4(v.parent.content.cut(v.parentOffset,k.parentOffset),C.parent.content.cut(C.parentOffset,S.endA-C.start())))){let L=F(t.state.tr);O.type=="add"?L.addMark(z,re,O.mark):L.removeMark(z,re,O.mark),t.dispatch(L)}else if(v.parent.child(v.index()).isText&&v.index()==k.index()-(k.textOffset?0:1)){let L=v.parent.textBetween(v.parentOffset,k.parentOffset),J=()=>F(t.state.tr.insertText(L,z,re));t.someProp("handleTextInput",ce=>ce(t,z,re,L,J))||t.dispatch(J())}else t.dispatch(F());else t.dispatch(F())}function KC(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:x1(t,e.resolve(n.anchor),e.resolve(n.head))}function O4(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,c,f;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],o="add",f=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],o="remove",f=p=>p.mark(c.removeFromSet(p.marks));else return null;let d=[];for(let p=0;p<e.childCount;p++)d.push(f(e.child(p)));if(Q.from(d).eq(t))return{mark:c,type:o}}function _4(t,e,n,r,i){if(n-e<=i.pos-r.pos||Yy(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 o=t.resolve(Yy(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Yy(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Yy(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 D4(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let f=Math.max(0,s-Math.min(o,c));r-=o+f-s}if(o<s&&t.size<e.size){let f=r<=s&&r>=o?s-r:0;s-=f,s&&s<e.size&&GC(e.textBetween(s-1,s+1))&&(s+=f?1:-1),c=s+(c-o),o=s}else if(c<s){let f=r<=s&&r>=c?s-r:0;s-=f,s&&s<t.size&&GC(t.textBetween(s-1,s+1))&&(s+=f?1:-1),o=s+(o-c),c=s}return{start:s,endA:o,endB:c}}function GC(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class eO{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new K3,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(QC),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=JC(this),WC(this),this.nodeViews=XC(this),this.docView=OC(this.state.doc,ZC(this),qy(this),this.dom,this),this.domObserver=new S4(this,(r,i,s,o)=>M4(this,r,i,s,o)),this.domObserver.start(),G3(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&&sb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(QC),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,o=!1;e.storedMarks&&this.composing&&(KM(this),o=!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=XC(this);N4(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&sb(this),this.editable=JC(this),WC(this);let f=qy(this),d=ZC(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,d,f);(m||!e.selection.eq(i.selection))&&(o=!0);let y=p=="preserve"&&o&&this.dom.style.overflowAnchor==null&&a3(this);if(o){this.domObserver.stop();let b=m&&(sr||Tn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&R4(i.selection,e.selection);if(m){let S=Tn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=a4(this)),(s||!this.docView.update(e.doc,d,f,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=OC(e.doc,d,f,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&R3(this))?is(this,b):(LM(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():y&&c3(y)}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 Ce){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&kC(this,n.getBoundingClientRect(),e)}else kC(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 ZM(e.slice,e.move,i<0?void 0:Ce.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 o=0;o<this.directPlugins.length;o++){let c=this.directPlugins[o].props[e];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let c=s[o].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(sr){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&&u3(this.dom),is(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 m3(this,e)}coordsAtPos(e,n=1){return AM(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 S3(this,n||this.state,e)}pasteHTML(e,n){return Cu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Cu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return S1(this,e)}destroy(){this.docView&&(Z3(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qy(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Xz())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return J3(this,e)}domSelectionRange(){let e=this.domSelection();return e?zn&&this.root.nodeType===11&&r3(this.dom.ownerDocument)==this.dom&&v4(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}eO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function ZC(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"),[Xt.node(0,t.state.doc.content.size,e)]}function WC(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:Xt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function JC(t){return!t.someProp("editable",e=>e(t.state)===!1)}function R4(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 XC(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 N4(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 QC(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 nl={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:"'"},Mh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},z4=typeof navigator<"u"&&/Mac/.test(navigator.platform),L4=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var En=0;En<10;En++)nl[48+En]=nl[96+En]=String(En);for(var En=1;En<=24;En++)nl[En+111]="F"+En;for(var En=65;En<=90;En++)nl[En]=String.fromCharCode(En+32),Mh[En]=String.fromCharCode(En);for(var Ky in nl)Mh.hasOwnProperty(Ky)||(Mh[Ky]=nl[Ky]);function I4(t){var e=z4&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||L4&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Mh:nl)[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 B4=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),j4=typeof navigator<"u"&&/Win/.test(navigator.platform);function U4(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let c=0;c<e.length-1;c++){let f=e[c];if(/^(cmd|meta|m)$/i.test(f))o=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))B4?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function H4(t){let e=Object.create(null);for(let n in t)e[U4(n)]=t[n];return e}function Gy(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 V4(t){return new Ct({props:{handleKeyDown:T1(t)}})}function T1(t){let e=H4(t);return function(n,r){let i=I4(r),s,o=e[Gy(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[Gy(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(j4&&r.ctrlKey&&r.altKey)&&(s=nl[r.keyCode])&&s!=i){let c=e[Gy(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const A1=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function tO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const nO=(t,e,n)=>{let r=tO(t,n);if(!r)return!1;let i=M1(r);if(!i){let o=r.blockRange(),c=o&&Ia(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(fO(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ka(s,"end")||Ce.isSelectable(s)))for(let o=r.depth;;o--){let c=jp(t.doc,r.before(o),r.after(o),he.empty);if(c&&c.slice.size<c.to-c.from){if(e){let f=t.tr.step(c);f.setSelection(ka(s,"end")?De.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Ce.create(f.doc,i.pos-s.nodeSize)),e(f.scrollIntoView())}return!0}if(o==1||r.node(o-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},P4=(t,e,n)=>{let r=tO(t,n);if(!r)return!1;let i=M1(r);return i?rO(t,i,e):!1},F4=(t,e,n)=>{let r=sO(t,n);if(!r)return!1;let i=O1(r);return i?rO(t,i,e):!1};function rO(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let o=e.nodeAfter,c=o,f=e.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let d=jp(t.doc,s,f,he.empty);if(!d||d.from!=s||d instanceof cn&&d.slice.size>=f-s)return!1;if(n){let p=t.tr.step(d);p.setSelection(Te.create(p.doc,s)),n(p.scrollIntoView())}return!0}function ka(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 iO=(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=M1(r)}let o=s&&s.nodeBefore;return!o||!Ce.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function M1(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 sO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const lO=(t,e,n)=>{let r=sO(t,n);if(!r)return!1;let i=O1(r);if(!i)return!1;let s=i.nodeAfter;if(fO(t,i,e,1))return!0;if(r.parent.content.size==0&&(ka(s,"start")||Ce.isSelectable(s))){let o=jp(t.doc,r.before(),r.after(),he.empty);if(o&&o.slice.size<o.to-o.from){if(e){let c=t.tr.step(o);c.setSelection(ka(s,"start")?De.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Ce.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},oO=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=O1(r)}let o=s&&s.nodeAfter;return!o||!Ce.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,s.pos)).scrollIntoView()),!0)};function O1(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 $4=(t,e)=>{let n=t.selection,r=n instanceof Ce,i;if(r){if(n.node.isTextblock||!cl(t.doc,n.from))return!1;i=n.from}else if(i=Bp(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Ce.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},q4=(t,e)=>{let n=t.selection,r;if(n instanceof Ce){if(n.node.isTextblock||!cl(t.doc,n.to))return!1;r=n.to}else if(r=Bp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Y4=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ia(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},aO=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
58
- `).scrollIntoView()),!0)};function _1(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 K4=(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),o=_1(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let c=n.after(),f=t.tr.replaceWith(c,c,o.createAndFill());f.setSelection(De.near(f.doc.resolve(c),1)),e(f.scrollIntoView())}return!0},cO=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ir||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=_1(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=t.tr.insert(o,s.createAndFill());c.setSelection(Te.create(c.doc,o+1)),e(c.scrollIntoView())}return!0},uO=(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(rs(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ia(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function G4(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ce&&e.selection.node.isBlock)return!r.parentOffset||!rs(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,c,f=!1,d=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),d=r.start(b)==r.pos-(r.depth-b),c=_1(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(f&&c?{type:c}:null),o=b;break}else{if(b==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof Te||e.selection instanceof ir)&&p.deleteSelection();let m=p.mapping.map(r.pos),y=rs(p.doc,m,s.length,s);if(y||(s[0]=c?{type:c}:null,y=rs(p.doc,m,s.length,s)),!y)return!1;if(p.split(m,s.length,s),!f&&d&&r.node(o).type!=c){let b=p.mapping.map(r.before(o)),S=p.doc.resolve(b);c&&r.node(o-1).canReplaceWith(S.index(),S.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(o)),c)}return n&&n(p.scrollIntoView()),!0}}const Z4=G4(),W4=(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(Ce.create(t.doc,i))),!0)};function J4(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||cl(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function fO(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,c,f=i.type.spec.isolating||s.type.spec.isolating;if(!f&&J4(t,e,n))return!0;let d=!f&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(o=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(o[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,S=Q.empty;for(let C=o.length-1;C>=0;C--)S=Q.from(o[C].create(null,S));S=Q.from(i.copy(S));let v=t.tr.step(new un(e.pos-1,b,e.pos,b,new he(S,1,0),o.length,!0)),k=v.doc.resolve(b+2*o.length);k.nodeAfter&&k.nodeAfter.type==i.type&&cl(v.doc,k.pos)&&v.join(k.pos),n(v.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&f?null:De.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),y=m&&Ia(m);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(m,y).scrollIntoView()),!0;if(d&&ka(s,"start",!0)&&ka(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let v=s,k=1;for(;!v.isTextblock;v=v.firstChild)k++;if(b.canReplace(b.childCount,b.childCount,v.content)){if(n){let C=Q.empty;for(let z=S.length-1;z>=0;z--)C=Q.from(S[z].copy(C));let U=t.tr.step(new un(e.pos-S.length,e.pos+s.nodeSize,e.pos+k,e.pos+s.nodeSize-k,new he(C,S.length,0),0,!0));n(U.scrollIntoView())}return!0}}return!1}function dO(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(Te.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const X4=dO(-1),Q4=dO(1);function eL(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),c=o&&p1(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function eE(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(o,c,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(t,e)))if(f.type==t)i=!0;else{let p=n.doc.resolve(d),m=p.index();i=p.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:c},$to:{pos:f}}=n.selection.ranges[o];s.setBlockType(c,f,t,e)}r(s.scrollIntoView())}return!0}}function D1(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}D1(A1,nO,iO);D1(A1,lO,oO);D1(aO,cO,uO,Z4);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function tL(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let c=r?n.tr:null;return nL(c,o,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function nL(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=o.resolve(e.start-2);s=new wh(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new wh(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=p1(s,n,r,e);return c?(t&&rL(t,e,c,i,n),!0):!1}function rL(t,e,n,r,i){let s=Q.empty;for(let p=n.length-1;p>=0;p--)s=Q.from(n[p].type.create(n[p].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 o=0;for(let p=0;p<n.length;p++)n[p].type==i&&(o=p+1);let c=n.length-o,f=e.start+n.length-(r?2:0),d=e.parent;for(let p=e.startIndex,m=e.endIndex,y=!0;p<m;p++,y=!1)!y&&rs(t.doc,f,c)&&(t.split(f,c),f+=2*c),f+=d.child(p).nodeSize;return t}function iL(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?sL(e,n,t,s):lL(e,n,s):!0:!1}}function sL(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new un(s-1,o,s,o,new he(Q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new wh(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const c=Ia(r);if(c==null)return!1;i.lift(r,c);let f=i.doc.resolve(i.mapping.map(s,-1)-1);return cl(i.doc,f.pos)&&f.nodeBefore.type==f.nodeAfter.type&&i.join(f.pos),e(i.scrollIntoView()),!0}function lL(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,S=n.endIndex-1,v=n.startIndex;S>v;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,f=n.endIndex==i.childCount,d=s.node(-1),p=s.index(-1);if(!d.canReplace(p+(c?0:1),p+1,o.content.append(f?Q.empty:Q.from(i))))return!1;let m=s.pos,y=m+o.nodeSize;return r.step(new un(m-(c?1:0),y+(f?1:0),m+1,y-1,new he((c?Q.empty:Q.from(i.copy(Q.empty))).append(f?Q.empty:Q.from(i.copy(Q.empty))),c?0:1,f?0:1),c?0:1)),e(r.scrollIntoView()),!0}function oL(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let c=s.parent,f=c.child(o-1);if(f.type!=t)return!1;if(n){let d=f.lastChild&&f.lastChild.type==c.type,p=Q.from(d?t.create():null),m=new he(Q.from(t.create(null,Q.from(c.type.create(null,p)))),d?3:1,0),y=s.start,b=s.end;n(e.tr.step(new un(y-(d?3:1),b,y,b,m,1,!0)).scrollIntoView())}return!0}}function Fp(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 $p{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,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...p)=>{const m=f(...p)(o);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:o}=i,c=[],f=!!e,d=e||s.tr,p=()=>(!f&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(d),c.every(y=>y===!0)),m={...Object.fromEntries(Object.entries(r).map(([y,b])=>[y,(...v)=>{const k=this.buildProps(d,n),C=b(...v)(k);return c.push(C),m}])),run:p};return m}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([f,d])=>[f,(...p)=>d(...p)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,c={tr:e,editor:i,view:o,state:Fp({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,d])=>[f,(...p)=>d(...p)(c)]))}};return c}}let aL=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 xe(t,e,n){return t.config[e]===void 0&&t.parent?xe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?xe(t.parent,e,n):null}):t.config[e]}function qp(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 hO(t){const e=[],{nodeExtensions:n,markExtensions:r}=qp(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const c={name:o.name,options:o.options,storage:o.storage,extensions:i},f=xe(o,"addGlobalAttributes",c);if(!f)return;f().forEach(p=>{p.types.forEach(m=>{Object.entries(p.attributes).forEach(([y,b])=>{e.push({type:m,name:y,attribute:{...s,...b}})})})})}),i.forEach(o=>{const c={name:o.name,options:o.options,storage:o.storage},f=xe(o,"addAttributes",c);if(!f)return;const d=f();Object.entries(d).forEach(([p,m])=>{const y={...s,...m};typeof(y==null?void 0:y.default)=="function"&&(y.default=y.default()),y!=null&&y.isRequired&&(y==null?void 0:y.default)===void 0&&delete y.default,e.push({type:o.name,name:p,attribute:y})})}),e}function hn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Pt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const c=s?String(s).split(" "):[],f=r[i]?r[i].split(" "):[],d=c.filter(p=>!f.includes(p));r[i]=[...f,...d].join(" ")}else if(i==="style"){const c=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],d=new Map;f.forEach(p=>{const[m,y]=p.split(":").map(b=>b.trim());d.set(m,y)}),c.forEach(p=>{const[m,y]=p.split(":").map(b=>b.trim());d.set(m,y)}),r[i]=Array.from(d.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=s}),r},{})}function lb(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Pt(n,r),{})}function pO(t){return typeof t=="function"}function $e(t,e=void 0,...n){return pO(t)?e?t.bind(e)(...n):t(...n):t}function cL(t={}){return Object.keys(t).length===0&&t.constructor===Object}function uL(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function tE(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,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):uL(n.getAttribute(o.name));return c==null?s:{...s,[o.name]:c}},{});return{...r,...i}}}}function nE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&cL(n)?!1:n!=null))}function fL(t,e){var n;const r=hO(t),{nodeExtensions:i,markExtensions:s}=qp(t),o=(n=i.find(d=>xe(d,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(d=>{const p=r.filter(C=>C.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},y=t.reduce((C,U)=>{const z=xe(U,"extendNodeSchema",m);return{...C,...z?z(d):{}}},{}),b=nE({...y,content:$e(xe(d,"content",m)),marks:$e(xe(d,"marks",m)),group:$e(xe(d,"group",m)),inline:$e(xe(d,"inline",m)),atom:$e(xe(d,"atom",m)),selectable:$e(xe(d,"selectable",m)),draggable:$e(xe(d,"draggable",m)),code:$e(xe(d,"code",m)),whitespace:$e(xe(d,"whitespace",m)),linebreakReplacement:$e(xe(d,"linebreakReplacement",m)),defining:$e(xe(d,"defining",m)),isolating:$e(xe(d,"isolating",m)),attrs:Object.fromEntries(p.map(C=>{var U;return[C.name,{default:(U=C==null?void 0:C.attribute)===null||U===void 0?void 0:U.default}]}))}),S=$e(xe(d,"parseHTML",m));S&&(b.parseDOM=S.map(C=>tE(C,p)));const v=xe(d,"renderHTML",m);v&&(b.toDOM=C=>v({node:C,HTMLAttributes:lb(C,p)}));const k=xe(d,"renderText",m);return k&&(b.toText=k),[d.name,b]})),f=Object.fromEntries(s.map(d=>{const p=r.filter(k=>k.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},y=t.reduce((k,C)=>{const U=xe(C,"extendMarkSchema",m);return{...k,...U?U(d):{}}},{}),b=nE({...y,inclusive:$e(xe(d,"inclusive",m)),excludes:$e(xe(d,"excludes",m)),group:$e(xe(d,"group",m)),spanning:$e(xe(d,"spanning",m)),code:$e(xe(d,"code",m)),attrs:Object.fromEntries(p.map(k=>{var C;return[k.name,{default:(C=k==null?void 0:k.attribute)===null||C===void 0?void 0:C.default}]}))}),S=$e(xe(d,"parseHTML",m));S&&(b.parseDOM=S.map(k=>tE(k,p)));const v=xe(d,"renderHTML",m);return v&&(b.toDOM=k=>v({mark:k,HTMLAttributes:lb(k,p)})),[d.name,b]}));return new tM({topNode:o,nodes:c,marks:f})}function Zy(t,e){return e.nodes[t]||e.marks[t]||null}function rE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function R1(t,e){const n=lo.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const dL=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,c)=>{var f,d;const p=((d=(f=i.type.spec).toText)===null||d===void 0?void 0:d.call(f,{node:i,pos:s,parent:o,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function N1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Yp{constructor(e){this.find=e.find,this.handler=e.handler}}const hL=(t,e)=>{if(N1(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 Rd(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:c}=t,{view:f}=n;if(f.composing)return!1;const d=f.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(y=>y.type.spec.code))return!1;let p=!1;const m=dL(d)+s;return o.forEach(y=>{if(p)return;const b=hL(m,y.find);if(!b)return;const S=f.state.tr,v=Fp({state:f.state,transaction:S}),k={from:r-(b[0].length-s.length),to:i},{commands:C,chain:U,can:z}=new $p({editor:n,state:v});y.handler({state:v,range:k,match:b,commands:C,chain:U,can:z})===null||!S.steps.length||(S.setMeta(c,{transform:S,from:r,to:i,text:s}),f.dispatch(S),p=!0)}),p}function pL(t){const{editor:e,rules:n}=t,r=new Ct({state:{init(){return null},apply(i,s,o){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:p}=f;typeof p=="string"?p=p:p=R1(Q.from(p),o.schema);const{from:m}=f,y=m+p.length;Rd({editor:e,from:m,to:y,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,c){return Rd({editor:e,from:s,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Rd({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:o}=i.state.selection;return o?Rd({editor:e,from:o.pos,to:o.pos,text:`
59
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function mL(t){return Object.prototype.toString.call(t).slice(8,-1)}function Nd(t){return mL(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Kp(t,e){const n={...t};return Nd(t)&&Nd(e)&&Object.keys(e).forEach(r=>{Nd(e[r])&&Nd(t[r])?n[r]=Kp(t[r],e[r]):n[r]=e[r]}),n}class Ci{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=$e(xe(this,"addOptions",{name:this.name}))),this.storage=$e(xe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ci(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Kp(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ci(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=$e(xe(n,"addOptions",{name:n.name})),n.storage=$e(xe(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 o=i.marks();if(!!!o.find(d=>(d==null?void 0:d.type.name)===n.name))return!1;const f=o.find(d=>(d==null?void 0:d.type.name)===n.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function gL(t){return typeof t=="number"}class yL{constructor(e){this.find=e.find,this.handler=e.handler}}const bL=(t,e,n)=>{if(N1(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 xL(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:c}=t,{commands:f,chain:d,can:p}=new $p({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const v=Math.max(r,S),k=Math.min(i,S+b.content.size),C=b.textBetween(v-S,k-S,void 0,"");bL(C,s.find,o).forEach(z=>{if(z.index===void 0)return;const re=v+z.index+1,F=re+z[0].length,O={from:n.tr.mapping.map(re),to:n.tr.mapping.map(F)},L=s.handler({state:n,range:O,match:z,commands:f,chain:d,can:p,pasteEvent:o,dropEvent:c});m.push(L)})}),m.every(b=>b!==null)}let zd=null;const SL=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 wL(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:p,from:m,to:y,rule:b,pasteEvt:S})=>{const v=p.tr,k=Fp({state:p,transaction:v});if(!(!xL({editor:e,state:k,from:Math.max(m-1,0),to:y.b-1,rule:b,pasteEvent:S,dropEvent:c})||!v.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return n.map(p=>new Ct({view(m){const y=S=>{var v;r=!((v=m.dom.parentElement)===null||v===void 0)&&v.contains(S.target)?m.dom.parentElement:null,r&&(zd=e)},b=()=>{zd&&(zd=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,y)=>{if(s=r===m.dom.parentElement,c=y,!s){const b=zd;b!=null&&b.isEditable&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,y)=>{var b;const S=(b=y.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return o=y,i=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(m,y,b)=>{const S=m[0],v=S.getMeta("uiEvent")==="paste"&&!i,k=S.getMeta("uiEvent")==="drop"&&!s,C=S.getMeta("applyPasteRules"),U=!!C;if(!v&&!k&&!U)return;if(U){let{text:F}=C;typeof F=="string"?F=F:F=R1(Q.from(F),b.schema);const{from:O}=C,L=O+F.length,J=SL(F);return f({rule:p,state:b,from:O,to:{b:L},pasteEvt:J})}const z=y.doc.content.findDiffStart(b.doc.content),re=y.doc.content.findDiffEnd(b.doc.content);if(!(!gL(z)||!re||z===re.b))return f({rule:p,state:b,from:z,to:re,pasteEvt:o})}}))}function vL(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class sa{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=sa.resolve(e),this.schema=fL(this.extensions,n),this.setupExtensions()}static resolve(e){const n=sa.sort(sa.flatten(e)),r=vL(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=xe(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=xe(r,"priority")||100,o=xe(i,"priority")||100;return s>o?-1:s<o?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:Zy(n.name,this.schema)},i=xe(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=sa.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const c={name:o.name,options:o.options,storage:o.storage,editor:e,type:Zy(o.name,this.schema)},f=[],d=xe(o,"addKeyboardShortcuts",c);let p={};if(o.type==="mark"&&xe(o,"exitable",c)&&(p.ArrowRight=()=>Ci.handleExit({editor:e,mark:o})),d){const v=Object.fromEntries(Object.entries(d()).map(([k,C])=>[k,()=>C({editor:e})]));p={...p,...v}}const m=V4(p);f.push(m);const y=xe(o,"addInputRules",c);rE(o,e.options.enableInputRules)&&y&&r.push(...y());const b=xe(o,"addPasteRules",c);rE(o,e.options.enablePasteRules)&&b&&i.push(...b());const S=xe(o,"addProseMirrorPlugins",c);if(S){const v=S();f.push(...v)}return f}).flat();return[pL({editor:e,rules:r}),...wL({editor:e,rules:i}),...s]}get attributes(){return hO(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=qp(this.extensions);return Object.fromEntries(n.filter(r=>!!xe(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:hn(r.name,this.schema)},o=xe(r,"addNodeView",s);if(!o)return[];const c=(f,d,p,m,y)=>{const b=lb(f,i);return o()({node:f,view:d,getPos:p,decorations:m,innerDecorations:y,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:Zy(e.name,this.schema)};e.type==="mark"&&(!((n=$e(xe(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=xe(e,"onBeforeCreate",r),s=xe(e,"onCreate",r),o=xe(e,"onUpdate",r),c=xe(e,"onSelectionUpdate",r),f=xe(e,"onTransaction",r),d=xe(e,"onFocus",r),p=xe(e,"onBlur",r),m=xe(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),f&&this.editor.on("transaction",f),d&&this.editor.on("focus",d),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}}class Qt{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=$e(xe(this,"addOptions",{name:this.name}))),this.storage=$e(xe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Qt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Kp(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Qt({...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=$e(xe(n,"addOptions",{name:n.name})),n.storage=$e(xe(n,"addStorage",{name:n.name,options:n.options})),n}}function mO(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
60
-
61
- `,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,i,(f,d,p,m)=>{var y;f.isBlock&&d>r&&(c+=s);const b=o==null?void 0:o[f.type.name];if(b)return p&&(c+=b({node:f,pos:d,parent:p,index:m,range:e})),!1;f.isText&&(c+=(y=f==null?void 0:f.text)===null||y===void 0?void 0:y.slice(Math.max(r,d)-d,i-d))}),c}function gO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const kL=Qt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ct({key:new Nt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(p=>p.$from.pos)),c=Math.max(...s.map(p=>p.$to.pos)),f=gO(n);return mO(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}}),CL=()=>({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),EL=(t=!1)=>({commands:e})=>e.setContent("",t),TL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(c,f)=>{if(c.type.isText)return;const{doc:d,mapping:p}=e,m=d.resolve(p.map(f)),y=d.resolve(p.map(f+c.nodeSize)),b=m.blockRange(y);if(!b)return;const S=Ia(b);if(c.type.isTextblock){const{defaultType:v}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,v)}(S||S===0)&&e.lift(b,S)})}),!0},AL=t=>e=>t(e),ML=()=>({state:t,dispatch:e})=>cO(t,e),OL=(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 o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new Te(r.doc.resolve(Math.max(o-1,0)))),!0},_L=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const c=i.before(s),f=i.after(s);t.delete(c,f).scrollIntoView()}return!0}return!1},DL=t=>({tr:e,state:n,dispatch:r})=>{const i=hn(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const f=s.before(o),d=s.after(o);e.delete(f,d).scrollIntoView()}return!0}return!1},RL=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},NL=()=>({state:t,dispatch:e})=>A1(t,e),zL=()=>({commands:t})=>t.keyboardShortcut("Enter"),LL=()=>({state:t,dispatch:e})=>K4(t,e);function Oh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:N1(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function yO(t,e,n={}){return t.find(r=>r.type===e&&Oh(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function iE(t,e,n={}){return!!yO(t,e,n)}function z1(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!yO([...i.node.marks],e,n)))return;let o=i.index,c=t.start()+i.offset,f=o+1,d=c+i.node.nodeSize;for(;o>0&&iE([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;f<t.parent.childCount&&iE([...t.parent.child(f).marks],e,n);)d+=t.parent.child(f).nodeSize,f+=1;return{from:c,to:d}}function fl(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 IL=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=fl(t,r.schema),{doc:o,selection:c}=n,{$from:f,from:d,to:p}=c;if(i){const m=z1(f,s,e);if(m&&m.from<=d&&m.to>=p){const y=Te.create(o,m.from,m.to);n.setSelection(y)}}return!0},BL=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 bO(t){return t instanceof Te}function Bl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function xO(t,e=null){if(!e)return null;const n=De.atStart(t),r=De.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Te.create(t,Bl(0,i,s),Bl(t.content.size,i,s)):Te.create(t,Bl(e,i,s),Bl(e,i,s))}function sE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function _h(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function jL(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const UL=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(_h()||sE())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),jL()&&!_h()&&!sE()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!bO(n.state.selection))return o(),!0;const c=xO(i.doc,t)||n.state.selection,f=n.state.selection.eq(c);return s&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},HL=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),VL=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),SO=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&&SO(r)}return t};function Ld(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return SO(n)}function Tu(t,e,n){if(t instanceof Js||t instanceof Q)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 Q.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}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),Tu("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,c="";const f=new tM({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(o=!0,c=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Qc.fromSchema(f).parseSlice(Ld(t),n.parseOptions):Qc.fromSchema(f).parse(Ld(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=Qc.fromSchema(e);return n.slice?s.parseSlice(Ld(t),n.parseOptions).content:s.parse(Ld(t),n.parseOptions)}return Tu("",e,n)}function PL(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof cn||i instanceof un))return;const s=t.mapping.maps[r];let o=0;s.forEach((c,f,d,p)=>{o===0&&(o=p)}),t.setSelection(De.near(t.doc.resolve(o),n))}const FL=t=>!("type"in t),$L=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const f=k=>{s.emit("contentError",{editor:s,error:k,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Tu(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(k){f(k)}try{c=Tu(e,s.schema,{parseOptions:d,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(k){return f(k),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},y=!0,b=!0;if((FL(c)?c:[c]).forEach(k=>{k.check(),y=y?k.isText&&k.marks.length===0:!1,b=b?k.isBlock:!1}),p===m&&b){const{parent:k}=r.doc.resolve(p);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(p-=1,m+=1)}let v;if(y){if(Array.isArray(e))v=e.map(k=>k.text||"").join("");else if(e instanceof Q){let k="";e.forEach(C=>{C.text&&(k+=C.text)}),v=k}else typeof e=="object"&&e&&e.text?v=e.text:v=e;r.insertText(v,p,m)}else v=c,r.replaceWith(p,m,v);n.updateSelection&&PL(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:v}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:v})}return!0},qL=()=>({state:t,dispatch:e})=>$4(t,e),YL=()=>({state:t,dispatch:e})=>q4(t,e),KL=()=>({state:t,dispatch:e})=>nO(t,e),GL=()=>({state:t,dispatch:e})=>lO(t,e),ZL=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Bp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},WL=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Bp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},JL=()=>({state:t,dispatch:e})=>P4(t,e),XL=()=>({state:t,dispatch:e})=>F4(t,e);function wO(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function QL(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let c=0;c<e.length-1;c+=1){const f=e[c];if(/^(cmd|meta|m)$/i.test(f))o=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))s=!0;else if(/^mod$/i.test(f))_h()||wO()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const e6=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=QL(t).split(/-(?!$)/),o=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,c))});return f==null||f.steps.forEach(d=>{const p=d.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Au(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?hn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,y)=>{if(m.isText)return;const b=Math.max(r,y),S=Math.min(i,y+m.nodeSize);c.push({node:m,from:b,to:S})});const f=i-r,d=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Oh(m.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((m,y)=>m+y.to-y.from,0)>=f}const t6=(t,e={})=>({state:n,dispatch:r})=>{const i=hn(t,n.schema);return Au(n,i,e)?Y4(n,r):!1},n6=()=>({state:t,dispatch:e})=>uO(t,e),r6=t=>({state:e,dispatch:n})=>{const r=hn(t,e.schema);return iL(r)(e,n)},i6=()=>({state:t,dispatch:e})=>aO(t,e);function Gp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function lE(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 s6=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const c=Gp(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=hn(t,r.schema)),c==="mark"&&(o=fl(t,r.schema)),i&&n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(d,p)=>{s&&s===d.type&&n.setNodeMarkup(p,void 0,lE(d.attrs,e)),o&&d.marks.length&&d.marks.forEach(m=>{o===m.type&&n.addMark(p,p+d.nodeSize,o.create(lE(m.attrs,e)))})})}),!0):!1},l6=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),o6=()=>({tr:t,dispatch:e})=>{if(e){const n=new ir(t.doc);t.setSelection(n)}return!0},a6=()=>({state:t,dispatch:e})=>iO(t,e),c6=()=>({state:t,dispatch:e})=>oO(t,e),u6=()=>({state:t,dispatch:e})=>W4(t,e),f6=()=>({state:t,dispatch:e})=>Q4(t,e),d6=()=>({state:t,dispatch:e})=>X4(t,e);function ob(t,e,n={},r={}){return Tu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const h6=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:c})=>{var f,d;const{doc:p}=s;if(n.preserveWhitespace!=="full"){const m=ob(t,i.schema,n,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return o&&s.replaceWith(0,p.content.size,m).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:p.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck})};function vO(t,e){const n=fl(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,f=>{o.push(...f.marks)});const c=o.find(f=>f.type.name===n.name);return c?{...c.attrs}:{}}function p6(t,e){const n=new m1(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function m6(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 g6(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function kO(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 L1(t){return e=>kO(e.$from,t)}function y6(t,e){const n={from:0,to:t.content.size};return mO(t,n,e)}function b6(t,e){const n=hn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,c=>{s.push(c)});const o=s.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function CO(t,e){const n=Gp(typeof e=="string"?e:e.name,t.schema);return n==="node"?b6(t,e):n==="mark"?vO(t,e):{}}function x6(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 S6(t){const e=x6(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==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 w6(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((c,f)=>{o.push({from:c,to:f})});else{const{from:c,to:f}=n[s];if(c===void 0||f===void 0)return;o.push({from:c,to:f})}o.forEach(({from:c,to:f})=>{const d=e.slice(s).map(c,-1),p=e.slice(s).map(f),m=e.invert().map(d,-1),y=e.invert().map(p);r.push({oldRange:{from:m,to:y},newRange:{from:d,to:p}})})}),S6(r)}function I1(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=z1(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ih(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 ab(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?fl(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Oh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(i.forEach(({$from:m,$to:y})=>{const b=m.pos,S=y.pos;t.doc.nodesBetween(b,S,(v,k)=>{if(!v.isText&&!v.marks.length)return;const C=Math.max(b,k),U=Math.min(S,k+v.nodeSize),z=U-C;o+=z,c.push(...v.marks.map(re=>({mark:re,from:C,to:U})))})}),o===0)return!1;const f=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Oh(m.mark.attrs,n,{strict:!1})).reduce((m,y)=>m+y.to-y.from,0),d=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,y)=>m+y.to-y.from,0);return(f>0?f+d:f)>=o}function v6(t,e,n={}){if(!e)return Au(t,null,n)||ab(t,null,n);const r=Gp(e,t.schema);return r==="node"?Au(t,e,n):r==="mark"?ab(t,e,n):!1}function oE(t,e){const{nodeExtensions:n}=qp(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=$e(xe(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Zp(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&&(Zp(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function k6(t){return t instanceof Ce}function C6(t,e,n){var r;const{selection:i}=e;let s=null;if(bO(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(f=>f.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:c,$to:f})=>{let d=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,f.pos,(p,m,y)=>{if(d)return!1;if(p.isInline){const b=!y||y.type.allowsMarkType(n),S=!!n.isInSet(p.marks)||!p.marks.some(v=>v.type.excludes(n));d=b&&S}return!d}),d})}const E6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:c}=s,f=fl(t,r.schema);if(i)if(o){const d=vO(r,f);n.addStoredMark(f.create({...d,...e}))}else c.forEach(d=>{const p=d.$from.pos,m=d.$to.pos;r.doc.nodesBetween(p,m,(y,b)=>{const S=Math.max(b,p),v=Math.min(b+y.nodeSize,m);y.marks.find(C=>C.type===f)?y.marks.forEach(C=>{f===C.type&&n.addMark(S,v,f.create({...C.attrs,...e}))}):n.addMark(S,v,f.create(e))})});return C6(r,n,f)},T6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),A6=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=hn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>eE(s,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>eE(s,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},M6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Bl(t,0,r.content.size),s=Ce.create(r,i);e.setSelection(s)}return!0},O6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=Te.atStart(r).from,c=Te.atEnd(r).to,f=Bl(i,o,c),d=Bl(s,o,c),p=Te.create(r,f,d);e.setSelection(p)}return!0},_6=t=>({state:e,dispatch:n})=>{const r=hn(t,e.schema);return oL(r)(e,n)};function aE(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 D6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:c,$to:f}=s,d=i.extensionManager.attributes,p=ih(d,c.node().type.name,c.node().attrs);if(s instanceof Ce&&s.node.isBlock)return!c.parentOffset||!rs(o,c.pos)?!1:(r&&(t&&aE(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=f.parentOffset===f.parent.content.size,y=c.depth===0?void 0:m6(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&y?[{type:y,attrs:p}]:void 0,S=rs(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&rs(e.doc,e.mapping.map(c.pos),1,y?[{type:y}]:void 0)&&(S=!0,b=y?[{type:y,attrs:p}]:void 0),r){if(S&&(s instanceof Te&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),y&&!m&&!c.parentOffset&&c.parent.type!==y)){const v=e.mapping.map(c.before()),k=e.doc.resolve(v);c.node(-1).canReplaceWith(k.index(),k.index()+1,y)&&e.setNodeMarkup(e.mapping.map(c.before()),y)}t&&aE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},R6=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const c=hn(t,r.schema),{$from:f,$to:d}=r.selection,p=r.selection.node;if(p&&p.isBlock||f.depth<2||!f.sameParent(d))return!1;const m=f.node(-1);if(m.type!==c)return!1;const y=s.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let C=Q.empty;const U=f.index(-1)?1:f.index(-2)?2:3;for(let J=f.depth-U;J>=f.depth-3;J-=1)C=Q.from(f.node(J).copy(C));const z=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,re={...ih(y,f.node().type.name,f.node().attrs),...e},F=((o=c.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(re))||void 0;C=C.append(Q.from(c.createAndFill(null,F)||void 0));const O=f.before(f.depth-(U-1));n.replace(O,f.after(-z),new he(C,4-U,0));let L=-1;n.doc.nodesBetween(O,n.doc.content.size,(J,ce)=>{if(L>-1)return!1;J.isTextblock&&J.content.size===0&&(L=ce+1)}),L>-1&&n.setSelection(Te.near(n.doc.resolve(L))),n.scrollIntoView()}return!0}const b=d.pos===f.end()?m.contentMatchAt(0).defaultType:null,S={...ih(y,m.type.name,m.attrs),...e},v={...ih(y,f.node().type.name,f.node().attrs),...e};n.delete(f.pos,d.pos);const k=b?[{type:c,attrs:S},{type:b,attrs:v}]:[{type:c,attrs:S}];if(!rs(n.doc,f.pos,2))return!1;if(i){const{selection:C,storedMarks:U}=r,{splittableMarks:z}=s.extensionManager,re=U||C.$to.parentOffset&&C.$from.marks();if(n.split(f.pos,2,k).scrollIntoView(),!re||!i)return!0;const F=re.filter(O=>z.includes(O.type.name));n.ensureMarks(F)}return!0},Wy=(t,e)=>{const n=L1(o=>o.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)&&cl(t.doc,n.pos)&&t.join(n.pos),!0},Jy=(t,e)=>{const n=L1(o=>o.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)&&cl(t.doc,r)&&t.join(r),!0},N6=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:c,chain:f,commands:d,can:p})=>{const{extensions:m,splittableMarks:y}=i.extensionManager,b=hn(t,o.schema),S=hn(e,o.schema),{selection:v,storedMarks:k}=o,{$from:C,$to:U}=v,z=C.blockRange(U),re=k||v.$to.parentOffset&&v.$from.marks();if(!z)return!1;const F=L1(O=>oE(O.type.name,m))(v);if(z.depth>=1&&F&&z.depth-F.depth<=1){if(F.node.type===b)return d.liftListItem(S);if(oE(F.node.type.name,m)&&b.validContent(F.node.content)&&c)return f().command(()=>(s.setNodeMarkup(F.pos,b),!0)).command(()=>Wy(s,b)).command(()=>Jy(s,b)).run()}return!n||!re||!c?f().command(()=>p().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>Wy(s,b)).command(()=>Jy(s,b)).run():f().command(()=>{const O=p().wrapInList(b,r),L=re.filter(J=>y.includes(J.type.name));return s.ensureMarks(L),O?!0:d.clearNodes()}).wrapInList(b,r).command(()=>Wy(s,b)).command(()=>Jy(s,b)).run()},z6=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=fl(t,r.schema);return ab(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},L6=(t,e,n={})=>({state:r,commands:i})=>{const s=hn(t,r.schema),o=hn(e,r.schema),c=Au(r,s,n);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(o,f):i.setNode(s,{...f,...n})},I6=(t,e={})=>({state:n,commands:r})=>{const i=hn(t,n.schema);return Au(n,i,e)?r.lift(i):r.wrapIn(i,e)},B6=()=>({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 o=t.tr,c=s.transform;for(let f=c.steps.length-1;f>=0;f-=1)o.step(c.steps[f].invert(c.docs[f]));if(s.text){const f=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,f))}else o.delete(s.from,s.to)}return!0}}return!1},j6=()=>({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},U6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,f=fl(t,r.schema),{$from:d,empty:p,ranges:m}=c;if(!i)return!0;if(p&&o){let{from:y,to:b}=c;const S=(s=d.marks().find(k=>k.type===f))===null||s===void 0?void 0:s.attrs,v=z1(d,f,S);v&&(y=v.from,b=v.to),n.removeMark(y,b,f)}else m.forEach(y=>{n.removeMark(y.$from.pos,y.$to.pos,f)});return n.removeStoredMark(f),!0},H6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const c=Gp(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=hn(t,r.schema)),c==="mark"&&(o=fl(t,r.schema)),i&&n.selection.ranges.forEach(f=>{const d=f.$from.pos,p=f.$to.pos;let m,y,b,S;n.selection.empty?r.doc.nodesBetween(d,p,(v,k)=>{s&&s===v.type&&(b=Math.max(k,d),S=Math.min(k+v.nodeSize,p),m=k,y=v)}):r.doc.nodesBetween(d,p,(v,k)=>{k<d&&s&&s===v.type&&(b=Math.max(k,d),S=Math.min(k+v.nodeSize,p),m=k,y=v),k>=d&&k<=p&&(s&&s===v.type&&n.setNodeMarkup(k,void 0,{...v.attrs,...e}),o&&v.marks.length&&v.marks.forEach(C=>{if(o===C.type){const U=Math.max(k,d),z=Math.min(k+v.nodeSize,p);n.addMark(U,z,o.create({...C.attrs,...e}))}}))}),y&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(v=>{o===v.type&&n.addMark(b,S,o.create({...v.attrs,...e}))}))}),!0):!1},V6=(t,e={})=>({state:n,dispatch:r})=>{const i=hn(t,n.schema);return eL(i,e)(n,r)},P6=(t,e={})=>({state:n,dispatch:r})=>{const i=hn(t,n.schema);return tL(i,e)(n,r)};var F6=Object.freeze({__proto__:null,blur:CL,clearContent:EL,clearNodes:TL,command:AL,createParagraphNear:ML,cut:OL,deleteCurrentNode:_L,deleteNode:DL,deleteRange:RL,deleteSelection:NL,enter:zL,exitCode:LL,extendMarkRange:IL,first:BL,focus:UL,forEach:HL,insertContent:VL,insertContentAt:$L,joinBackward:KL,joinDown:YL,joinForward:GL,joinItemBackward:ZL,joinItemForward:WL,joinTextblockBackward:JL,joinTextblockForward:XL,joinUp:qL,keyboardShortcut:e6,lift:t6,liftEmptyBlock:n6,liftListItem:r6,newlineInCode:i6,resetAttributes:s6,scrollIntoView:l6,selectAll:o6,selectNodeBackward:a6,selectNodeForward:c6,selectParentNode:u6,selectTextblockEnd:f6,selectTextblockStart:d6,setContent:h6,setMark:E6,setMeta:T6,setNode:A6,setNodeSelection:M6,setTextSelection:O6,sinkListItem:_6,splitBlock:D6,splitListItem:R6,toggleList:N6,toggleMark:z6,toggleNode:L6,toggleWrap:I6,undoInputRule:B6,unsetAllMarks:j6,unsetMark:U6,updateAttributes:H6,wrapIn:V6,wrapInList:P6});const $6=Qt.create({name:"commands",addCommands(){return{...F6}}}),q6=Qt.create({name:"drop",addProseMirrorPlugins(){return[new Ct({key:new Nt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Y6=Qt.create({name:"editable",addProseMirrorPlugins(){return[new Ct({key:new Nt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),K6=new Nt("focusEvents"),G6=Qt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ct({key:K6,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}}}})]}}),Z6=Qt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:f,doc:d}=c,{empty:p,$anchor:m}=f,{pos:y,parent:b}=m,S=m.parent.isTextblock&&y>0?c.doc.resolve(y-1):m,v=S.parent.type.spec.isolating,k=m.pos-m.parentOffset,C=v&&S.parent.childCount===1?k===m.pos:De.atStart(d).from===y;return!p||!b.type.isTextblock||b.textContent.length||!C||C&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.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 _h()||wO()?s:i},addProseMirrorPlugins(){return[new Ct({key:new Nt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(v=>v.getMeta("composition")))return;const r=t.some(v=>v.docChanged)&&!e.doc.eq(n.doc),i=t.some(v=>v.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:c}=e.selection,f=De.atStart(e.doc).from,d=De.atEnd(e.doc).to;if(s||!(o===f&&c===d)||!Zp(n.doc))return;const y=n.tr,b=Fp({state:n,transaction:y}),{commands:S}=new $p({editor:this.editor,state:b});if(S.clearNodes(),!!y.steps.length)return y}})]}}),W6=Qt.create({name:"paste",addProseMirrorPlugins(){return[new Ct({key:new Nt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),J6=Qt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ct({key:new Nt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Nl{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 Nl(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 Nl(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 Nl(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,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(o);if(!i&&c.depth<=this.depth)return;const f=new Nl(c,this.editor,i,i?n:null);i&&(f.actualDepth=this.depth+1),e.push(new Nl(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,o=Object.keys(n);for(let c=0;c<o.length;c+=1){const f=o[c];if(s[f]!==n[f])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(f=>n[f]===o.node.attrs[f])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.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 X6=`.ProseMirror {
62
- position: relative;
63
- }
64
-
65
- .ProseMirror {
66
- word-wrap: break-word;
67
- white-space: pre-wrap;
68
- white-space: break-spaces;
69
- -webkit-font-variant-ligatures: none;
70
- font-variant-ligatures: none;
71
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
72
- }
73
-
74
- .ProseMirror [contenteditable="false"] {
75
- white-space: normal;
76
- }
77
-
78
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
79
- white-space: pre-wrap;
80
- }
81
-
82
- .ProseMirror pre {
83
- white-space: pre-wrap;
84
- }
85
-
86
- img.ProseMirror-separator {
87
- display: inline !important;
88
- border: none !important;
89
- margin: 0 !important;
90
- width: 0 !important;
91
- height: 0 !important;
92
- }
93
-
94
- .ProseMirror-gapcursor {
95
- display: none;
96
- pointer-events: none;
97
- position: absolute;
98
- margin: 0;
99
- }
100
-
101
- .ProseMirror-gapcursor:after {
102
- content: "";
103
- display: block;
104
- position: absolute;
105
- top: -2px;
106
- width: 20px;
107
- border-top: 1px solid black;
108
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
109
- }
110
-
111
- @keyframes ProseMirror-cursor-blink {
112
- to {
113
- visibility: hidden;
114
- }
115
- }
116
-
117
- .ProseMirror-hideselection *::selection {
118
- background: transparent;
119
- }
120
-
121
- .ProseMirror-hideselection *::-moz-selection {
122
- background: transparent;
123
- }
124
-
125
- .ProseMirror-hideselection * {
126
- caret-color: transparent;
127
- }
128
-
129
- .ProseMirror-focused .ProseMirror-gapcursor {
130
- display: block;
131
- }
132
-
133
- .tippy-box[data-animation=fade][data-state=hidden] {
134
- opacity: 0
135
- }`;function Q6(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 eI=class extends aL{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=Q6(X6,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=pO(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 o=typeof s=="string"?`${s}$`:s.key;r=r.filter(c=>!c.key.startsWith(o))}),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?[Y6,kL.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),$6,G6,Z6,J6,q6,W6].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 sa(i,this)}createCommandManager(){this.commandManager=new $p({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=ob(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(c=>c.name!=="collaboration"),this.createExtensionManager()}}),n=ob(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=xO(n,this.options.autofocus);this.view=new eO(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:ia.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(o=>{var c;return(c=this.capturedTransaction)===null||c===void 0?void 0:c.step(o)});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 CO(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return v6(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return R1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
136
-
137
- `,textSerializers:r={}}=e||{};return y6(this.state.doc,{blockSeparator:n,textSerializers:{...gO(this.schema),...r}})}get isEmpty(){return Zp(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 Nl(n,this)}get $doc(){return this.$pos(0)}};function Xl(t){return new Yp({find:t.find,handler:({state:e,range:n,match:r})=>{const i=$e(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],c=r[0];if(o){const f=c.search(/\S/),d=n.from+c.indexOf(o),p=d+o.length;if(I1(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(v=>v===t.type&&v!==b.mark.type)).filter(b=>b.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+f,d);const y=n.from+f+o.length;s.addMark(n.from+f,y,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function tI(t){return new Yp({find:t.find,handler:({state:e,range:n,match:r})=>{const i=$e(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let c=n.to;const f=t.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let p=o+d;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,o+r[0].length-1),s.replaceWith(p,c,f)}else if(r[0]){const d=t.type.isInline?o:o-1;s.insert(d,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(c))}s.scrollIntoView()}})}function cb(t){return new Yp({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=$e(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 Mu(t){return new Yp({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=$e(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),f=o.doc.resolve(n.from).blockRange(),d=f&&p1(f,t.type,s);if(!d)return null;if(o.wrap(f,d),t.keepMarks&&t.editor){const{selection:m,storedMarks:y}=e,{splittableMarks:b}=t.editor.extensionManager,S=y||m.$to.parentOffset&&m.$from.marks();if(S){const v=S.filter(k=>b.includes(k.type.name));o.ensureMarks(v)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=o.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&cl(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&o.join(n.from-1)}})}class pn{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=$e(xe(this,"addOptions",{name:this.name}))),this.storage=$e(xe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new pn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Kp(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new pn(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=$e(xe(n,"addOptions",{name:n.name})),n.storage=$e(xe(n,"addStorage",{name:n.name,options:n.options})),n}}function rl(t){return new yL({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=$e(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,c=r[r.length-1],f=r[0];let d=n.to;if(c){const p=f.search(/\S/),m=n.from+f.indexOf(c),y=m+c.length;if(I1(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(k=>k===t.type&&k!==S.mark.type)).filter(S=>S.to>m).length)return null;y<n.to&&o.delete(y,n.to),m>n.from&&o.delete(n.from+p,m),d=n.from+p+c.length,o.addMark(n.from+p,d,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function nI(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ce){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var rI=IA();const iI=Lp(rI);function sI(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var EO={exports:{}},Xy={};/**
138
- * @license React
139
- * use-sync-external-store-shim.production.min.js
140
- *
141
- * Copyright (c) Facebook, Inc. and its affiliates.
142
- *
143
- * This source code is licensed under the MIT license found in the
144
- * LICENSE file in the root directory of this source tree.
145
- */var cE;function lI(){if(cE)return Xy;cE=1;var t=an;function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function c(m,y){var b=y(),S=r({inst:{value:b,getSnapshot:y}}),v=S[0].inst,k=S[1];return s(function(){v.value=b,v.getSnapshot=y,f(v)&&k({inst:v})},[m,b,y]),i(function(){return f(v)&&k({inst:v}),m(function(){f(v)&&k({inst:v})})},[m]),o(b),b}function f(m){var y=m.getSnapshot;m=m.value;try{var b=y();return!n(m,b)}catch{return!0}}function d(m,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return Xy.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Xy}EO.exports=lI();var B1=EO.exports;const oI=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},aI=({contentComponent:t})=>{const e=B1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return an.createElement(an.Fragment,null,Object.values(e))};function cI(){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]:iI.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 uI extends an.Component{constructor(e){var n;super(e),this.editorContentRef=an.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=cI(),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 an.createElement(an.Fragment,null,an.createElement("div",{ref:oI(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&an.createElement(aI,{contentComponent:e.contentComponent}))}}const fI=R.forwardRef((t,e)=>{const n=an.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return an.createElement(uI,{key:n,innerRef:e,...t})}),dI=an.memo(fI);var hI=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 o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},pI=sI(hI),TO={exports:{}},Qy={};/**
146
- * @license React
147
- * use-sync-external-store-shim/with-selector.production.min.js
148
- *
149
- * Copyright (c) Facebook, Inc. and its affiliates.
150
- *
151
- * This source code is licensed under the MIT license found in the
152
- * LICENSE file in the root directory of this source tree.
153
- */var uE;function mI(){if(uE)return Qy;uE=1;var t=an,e=B1;function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,c=t.useMemo,f=t.useDebugValue;return Qy.useSyncExternalStoreWithSelector=function(d,p,m,y,b){var S=s(null);if(S.current===null){var v={hasValue:!1,value:null};S.current=v}else v=S.current;S=c(function(){function C(O){if(!U){if(U=!0,z=O,O=y(O),b!==void 0&&v.hasValue){var L=v.value;if(b(L,O))return re=L}return re=O}if(L=re,r(z,O))return L;var J=y(O);return b!==void 0&&b(L,J)?L:(z=O,re=J)}var U=!1,z,re,F=m===void 0?null:m;return[function(){return C(p())},F===null?void 0:function(){return C(F())}]},[p,m,y,b]);var k=i(d,S[0],S[1]);return o(function(){v.hasValue=!0,v.value=k},[k]),f(k),k},Qy}TO.exports=mI();var gI=TO.exports;const yI=typeof window<"u"?R.useLayoutEffect:R.useEffect;class bI{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 xI(t){var e;const[n]=R.useState(()=>new bI(t.editor)),r=gI.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:pI);return yI(()=>n.watch(t.editor),[t.editor,n]),R.useDebugValue(r),r}const SI=!1,ub=typeof window>"u",wI=ub||!!(typeof window<"u"&&window.next);class j1{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?ub||wI?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 eI(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 o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?j1.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 vI(t={},e=[]){const n=R.useRef(t);n.current=t;const[r]=R.useState(()=>new j1(n)),i=B1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return R.useDebugValue(i),R.useEffect(r.onRender(e)),xI({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const kI=R.createContext({editor:null});kI.Consumer;const CI=R.createContext({onDragStart:void 0}),EI=()=>R.useContext(CI);an.forwardRef((t,e)=>{const{onDragStart:n}=EI(),r=t.as||"div";return an.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const TI=/^\s*>\s$/,AI=pn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Mu({find:TI,type:this.type})]}}),MI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,OI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_I=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,DI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,RI=Ci.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Xl({find:MI,type:this.type}),Xl({find:_I,type:this.type})]},addPasteRules(){return[rl({find:OI,type:this.type}),rl({find:DI,type:this.type})]}}),NI="listItem",fE="textStyle",dE=/^\s*([-+*])\s$/,zI=pn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(NI,this.editor.getAttributes(fE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Mu({find:dE,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Mu({find:dE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(fE),editor:this.editor})),[t]}}),LI=/(^|[^`])`([^`]+)`(?!`)/,II=/(^|[^`])`([^`]+)`(?!`)/g,BI=Ci.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Xl({find:LI,type:this.type})]},addPasteRules(){return[rl({find:II,type:this.type})]}}),jI=/^```([a-z]+)?[\s\n]$/,UI=/^~~~([a-z]+)?[\s\n]$/,HI=pn.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(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Pt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
154
-
155
- `);return!s||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:d})=>(d.setSelection(De.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[cb({find:jI,type:this.type,getAttributes:t=>({language:t[1]})}),cb({find:UI,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ct({key:new Nt("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:o,schema:c}=t.state,f=c.text(n.replace(/\r\n?/g,`
156
- `));return o.replaceSelectionWith(this.type.create({language:s},f)),o.selection.$from.parent.type!==this.type&&o.setSelection(Te.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),VI=pn.create({name:"doc",topNode:!0,content:"block+"});function PI(t={}){return new Ct({view(e){return new FI(e,t)}})}class FI{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=o=>{this[i](o)};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(),o=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let m=e.nodeBefore,y=e.nodeAfter;if(m||y){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let S=b.getBoundingClientRect(),v=m?S.bottom:S.top;m&&y&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*c;r={left:S.left,right:S.right,top:v-k,bottom:v+k}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),y=this.width/2*o;r={left:m.left-y,right:m.left+y,top:m.top,bottom:m.bottom}}let f=this.editorView.dom.offsetParent;this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let d,p;if(!f||f==document.body&&getComputedStyle(f).position=="static")d=-pageXOffset,p=-pageYOffset;else{let m=f.getBoundingClientRect(),y=m.width/f.offsetWidth,b=m.height/f.offsetHeight;d=m.left-f.scrollLeft*y,p=m.top-f.scrollTop*b}this.element.style.left=(r.left-d)/o+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/o+"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 o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=dM(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const $I=Qt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[PI(this.options)]}});class Ht extends De{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ht.valid(r)?new Ht(r):De.near(r)}content(){return he.empty}eq(e){return e instanceof Ht&&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 Ht(e.resolve(n.pos))}getBookmark(){return new U1(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!qI(e)||!YI(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&&Ht.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)<c.childCount:e.index(o)>0){s=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let f=e.doc.resolve(i);if(Ht.valid(f))return f}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!Ce.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let c=e.doc.resolve(i);if(Ht.valid(c))return c}return null}}}Ht.prototype.visible=!1;Ht.findFrom=Ht.findGapCursorFrom;De.jsonID("gapcursor",Ht);class U1{constructor(e){this.pos=e}map(e){return new U1(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ht.valid(n)?new Ht(n):De.near(n)}}function AO(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function qI(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||AO(i.type))return!0;if(i.inlineContent)return!1}}return!0}function YI(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||AO(i.type))return!0;if(i.inlineContent)return!1}}return!0}function KI(){return new Ct({props:{decorations:JI,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ht.valid(n)?new Ht(n):null},handleClick:ZI,handleKeyDown:GI,handleDOMEvents:{beforeinput:WI}}})}const GI=T1({ArrowLeft:Id("horiz",-1),ArrowRight:Id("horiz",1),ArrowUp:Id("vert",-1),ArrowDown:Id("vert",1)});function Id(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,c=e>0?o.$to:o.$from,f=o.empty;if(o instanceof Te){if(!s.endOfTextblock(n)||c.depth==0)return!1;f=!1,c=r.doc.resolve(e>0?c.after():c.before())}let d=Ht.findGapCursorFrom(c,e,f);return d?(i&&i(r.tr.setSelection(new Ht(d))),!0):!1}}function ZI(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ht.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ce.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ht(r))),!0)}function WI(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ht))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=Q.empty;for(let o=r.length-1;o>=0;o--)i=Q.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new he(i,0,0));return s.setSelection(Te.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function JI(t){if(!(t.selection instanceof Ht))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",xt.create(t.doc,[Xt.widget(t.selection.head,e,{key:"gapcursor"})])}const XI=Qt.create({name:"gapCursor",addProseMirrorPlugins(){return[KI()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=$e(xe(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),QI=pn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Pt(this.options.HTMLAttributes,t)]},renderText(){return`
157
- `},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:o}=this.options,{splittableMarks:c}=r.extensionManager,f=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:p})=>{if(p&&f&&o){const m=f.filter(y=>c.includes(y.type.name));d.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),eB=pn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Pt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>cb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Dh=200,fn=function(){};fn.prototype.append=function(e){return e.length?(e=fn.from(e),!this.length&&e||e.length<Dh&&this.leafAppend(e)||this.length<Dh&&e.leafPrepend(this)||this.appendInner(e)):this};fn.prototype.prepend=function(e){return e.length?fn.from(e).append(this):this};fn.prototype.appendInner=function(e){return new tB(this,e)};fn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?fn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};fn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};fn.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)};fn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};fn.from=function(e){return e instanceof fn?e:e&&e.length?new MO(e):fn.empty};var MO=(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,o,c){for(var f=s;f<o;f++)if(i(this.values[f],c+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,c){for(var f=s-1;f>=o;f--)if(i(this.values[f],c+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Dh)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Dh)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})(fn);fn.empty=new MO([]);var tB=(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,o){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),o)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,o+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,o)===!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})(fn);const nB=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 o=e.tr,c,f,d=[],p=[];return this.items.forEach((m,y)=>{if(!m.step){i||(i=this.remapping(r,y+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new Ls(m.map));let b=m.step.map(i.slice(s)),S;b&&o.maybeStep(b).doc&&(S=o.mapping.maps[o.mapping.maps.length-1],d.push(new Ls(S,void 0,void 0,d.length+p.length))),s--,S&&i.appendMap(S,s)}else o.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,f=new Qr(this.items.slice(0,r).append(p.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:o,selection:c}}addTransform(e,n,r,i){let s=[],o=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),y=new Ls(e.mapping.maps[p],m,n),b;(b=f&&f.merge(y))&&(y=b,p?s.pop():c=c.slice(0,c.length-1)),s.push(y),n&&(o++,n=void 0),i||(f=y)}let d=o-r.depth;return d>iB&&(c=rB(c,d),o-=d),new Qr(c.append(s),o)}remapping(e,n){let r=new wu;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Qr(this.items.append(e.map(n=>new Ls(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(y=>{y.selection&&c--},i);let f=n;this.items.forEach(y=>{let b=s.getMirror(--f);if(b==null)return;o=Math.min(o,b);let S=s.maps[b];if(y.step){let v=e.steps[b].invert(e.docs[b]),k=y.selection&&y.selection.map(s.slice(f+1,b));k&&c++,r.push(new Ls(S,v,k))}else r.push(new Ls(S))},i);let d=[];for(let y=n;y<o;y++)d.push(new Ls(s.maps[y]));let p=this.items.slice(0,i).append(d).append(r),m=new Qr(p,c);return m.emptyItemCount()>nB&&(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((o,c)=>{if(c>=e)i.push(o),o.selection&&s++;else if(o.step){let f=o.step.map(n.slice(r)),d=f&&f.getMap();if(r--,d&&n.appendMap(d,r),f){let p=o.selection&&o.selection.map(n.slice(r));p&&s++;let m=new Ls(d.invert(),f,p),y,b=i.length-1;(y=i.length&&i[b].merge(m))?i[b]=y:i.push(m)}}else o.map&&r--},this.items.length,0),new Qr(fn.from(i.reverse()),s)}}Qr.empty=new Qr(fn.empty,0);function rB(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}let Ls=class OO{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 OO(n.getMap().invert(),n,this.selection)}}};class Hs{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const iB=20;function sB(t,e,n,r){let i=n.getMeta($l),s;if(i)return i.historyState;n.getMeta(aB)&&(t=new Hs(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta($l))return o.getMeta($l).redo?new Hs(t.done.addTransform(n,void 0,r,sh(e)),t.undone,hE(n.mapping.maps),t.prevTime,t.prevComposition):new Hs(t.done,t.undone.addTransform(n,void 0,r,sh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),f=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!lB(n,t.prevRanges)),d=o?e0(t.prevRanges,n.mapping):hE(n.mapping.maps);return new Hs(t.done.addTransform(n,f?e.selection.getBookmark():void 0,r,sh(e)),Qr.empty,d,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Hs(t.done.rebased(n,s),t.undone.rebased(n,s),e0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Hs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),e0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function lB(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 hE(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function e0(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 oB(t,e,n){let r=sh(e),i=$l.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),f=new Hs(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(o).setMeta($l,{redo:n,historyState:f})}let t0=!1,pE=null;function sh(t){let e=t.plugins;if(pE!=e){t0=!1,pE=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){t0=!0;break}}return t0}const $l=new Nt("history"),aB=new Nt("closeHistory");function cB(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ct({key:$l,state:{init(){return new Hs(Qr.empty,Qr.empty,null,0,-1)},apply(e,n,r){return sB(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?DO:r=="historyRedo"?RO:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function _O(t,e){return(n,r)=>{let i=$l.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=oB(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const DO=_O(!1,!0),RO=_O(!0,!0),uB=Qt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>DO(t,e),redo:()=>({state:t,dispatch:e})=>RO(t,e)}},addProseMirrorPlugins(){return[cB(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()}}}),fB=pn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Pt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!nI(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}):k6(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:c})=>{var f;if(c){const{$to:d}=o.selection,p=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?o.setSelection(Te.create(o.doc,d.pos+1)):d.nodeAfter.isBlock?o.setSelection(Ce.create(o.doc,d.pos)):o.setSelection(Te.create(o.doc,d.pos));else{const m=(f=d.parent.type.contentMatch.defaultType)===null||f===void 0?void 0:f.create();m&&(o.insert(p,m),o.setSelection(Te.create(o.doc,p+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[tI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),dB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,hB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,pB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,mB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,gB=Ci.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Xl({find:dB,type:this.type}),Xl({find:pB,type:this.type})]},addPasteRules(){return[rl({find:hB,type:this.type}),rl({find:mB,type:this.type})]}}),yB=pn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Pt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),bB="listItem",mE="textStyle",gE=/^(\d+)\.\s$/,xB=pn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Pt(this.options.HTMLAttributes,n),0]:["ol",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bB,this.editor.getAttributes(mE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Mu({find:gE,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=Mu({find:gE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(mE)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),SB=pn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),wB=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vB=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kB=Ci.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Xl({find:wB,type:this.type})]},addPasteRules(){return[rl({find:vB,type:this.type})]}}),CB=pn.create({name:"text",group:"inline"}),EB=Qt.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(RI.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(AI.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(zI.configure(this.options.bulletList)),this.options.code!==!1&&t.push(BI.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(HI.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(VI.configure(this.options.document)),this.options.dropcursor!==!1&&t.push($I.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(XI.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(QI.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(eB.configure(this.options.heading)),this.options.history!==!1&&t.push(uB.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(fB.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(gB.configure(this.options.italic)),this.options.listItem!==!1&&t.push(yB.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(xB.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(SB.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(kB.configure(this.options.strike)),this.options.text!==!1&&t.push(CB.configure(this.options.text)),t}}),qr=()=>new Map,fb=t=>{const e=qr();return t.forEach((n,r)=>{e.set(r,n)}),e},Mi=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},TB=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},AB=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Ql=()=>new Set,n0=t=>t[t.length-1],MB=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},il=Array.from,H1=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},V1=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},OB=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ca=Array.isArray;class NO{constructor(){this._observers=qr()}on(e,n){return Mi(this._observers,e,Ql).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 il((this._observers.get(e)||qr()).values()).forEach(r=>r(...n))}destroy(){this._observers=qr()}}const ti=Math.floor,lh=Math.abs,ss=(t,e)=>t<e?t:e,ni=(t,e)=>t>e?t:e,zO=t=>t!==0?t<0:1/t<0,yE=1,bE=2,r0=4,i0=8,Ou=32,ls=64,Pn=128,_B=1<<29,Wp=31,db=63,ql=127,DB=2147483647,Rh=Number.MAX_SAFE_INTEGER,xE=Number.MIN_SAFE_INTEGER,RB=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ti(t)===t),LO=String.fromCharCode,NB=t=>t.toLowerCase(),zB=/^\s*/g,LB=t=>t.replace(zB,""),IB=/([A-Z])/g,SE=(t,e)=>LB(t.replace(IB,n=>`${e}${NB(n)}`)),BB=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},_u=typeof TextEncoder<"u"?new TextEncoder:null,jB=t=>_u.encode(t),UB=_u?jB:BB;let ru=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ru&&ru.decode(new Uint8Array).length===1&&(ru=null);const HB=(t,e)=>OB(e,()=>t).join("");let nf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const rf=()=>new nf,VB=t=>{const e=rf();return t(e),ei(e)},PB=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(PB(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},FB=(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)},on=(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},hb=on,tt=(t,e)=>{for(;e>ql;)on(t,Pn|ql&e),e=ti(e/128);on(t,ql&e)},P1=(t,e)=>{const n=zO(e);for(n&&(e=-e),on(t,(e>db?Pn:0)|(n?ls:0)|db&e),e=ti(e/64);e>0;)on(t,(e>ql?Pn:0)|ql&e),e=ti(e/128)},pb=new Uint8Array(3e4),$B=pb.length/3,qB=(t,e)=>{if(e.length<$B){const n=_u.encodeInto(e,pb).written||0;tt(t,n);for(let r=0;r<n;r++)on(t,pb[r])}else br(t,UB(e))},YB=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;tt(t,r);for(let i=0;i<r;i++)on(t,n.codePointAt(i))},ua=_u&&_u.encodeInto?qB:YB,Jp=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=ss(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)},br=(t,e)=>{tt(t,e.byteLength),Jp(t,e)},F1=(t,e)=>{FB(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},KB=(t,e)=>F1(t,4).setFloat32(0,e,!1),GB=(t,e)=>F1(t,8).setFloat64(0,e,!1),ZB=(t,e)=>F1(t,8).setBigInt64(0,e,!1),wE=new DataView(new ArrayBuffer(4)),WB=t=>(wE.setFloat32(0,t),wE.getFloat32(0)===t),Ea=(t,e)=>{switch(typeof e){case"string":on(t,119),ua(t,e);break;case"number":RB(e)&&lh(e)<=DB?(on(t,125),P1(t,e)):WB(e)?(on(t,124),KB(t,e)):(on(t,123),GB(t,e));break;case"bigint":on(t,122),ZB(t,e);break;case"object":if(e===null)on(t,126);else if(Ca(e)){on(t,117),tt(t,e.length);for(let n=0;n<e.length;n++)Ea(t,e[n])}else if(e instanceof Uint8Array)on(t,116),br(t,e);else{on(t,118);const n=Object.keys(e);tt(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];ua(t,i),Ea(t,e[i])}}break;case"boolean":on(t,e?120:121);break;default:on(t,127)}};class vE extends nf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&tt(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const kE=t=>{t.count>0&&(P1(t.encoder,t.count===1?t.s:-t.s),t.count>1&&tt(t.encoder,t.count-2))};class oh{constructor(){this.encoder=new nf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(kE(this),this.count=1,this.s=e)}toUint8Array(){return kE(this),ei(this.encoder)}}const CE=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);P1(t.encoder,e),t.count>1&&tt(t.encoder,t.count-2)}};class s0{constructor(){this.encoder=new nf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(CE(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return CE(this),ei(this.encoder)}}class JB{constructor(){this.sarr=[],this.s="",this.lensE=new oh}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 nf;return this.sarr.push(this.s),this.s="",ua(e,this.sarr.join("")),Jp(e,this.lensE.toUint8Array()),ei(e)}}const Ei=t=>new Error(t),Yr=()=>{throw Ei("Method unimplemented")},Ln=()=>{throw Ei("Unexpected case")},IO=Ei("Unexpected end of array"),BO=Ei("Integer out of Range");let Xp=class{constructor(e){this.arr=e,this.pos=0}};const Ba=t=>new Xp(t),XB=t=>t.pos!==t.arr.length,QB=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},xr=t=>QB(t,Ye(t)),Ta=t=>t.arr[t.pos++],Ye=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&ql)*n,n*=128,i<Pn)return e;if(e>Rh)throw BO}throw IO},$1=t=>{let e=t.arr[t.pos++],n=e&db,r=64;const i=(e&ls)>0?-1:1;if((e&Pn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&ql)*r,r*=128,e<Pn)return i*n;if(n>Rh)throw BO}throw IO},ej=t=>{let e=Ye(t);if(e===0)return"";{let n=String.fromCodePoint(Ta(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Ta(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))}},tj=t=>ru.decode(xr(t)),fa=ru?tj:ej,q1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},nj=t=>q1(t,4).getFloat32(0,!1),rj=t=>q1(t,8).getFloat64(0,!1),ij=t=>q1(t,8).getBigInt64(0,!1),sj=[t=>{},t=>null,$1,nj,rj,ij,t=>!1,t=>!0,fa,t=>{const e=Ye(t),n={};for(let r=0;r<e;r++){const i=fa(t);n[i]=Du(t)}return n},t=>{const e=Ye(t),n=[];for(let r=0;r<e;r++)n.push(Du(t));return n},xr],Du=t=>sj[127-Ta(t)](t);class EE extends Xp{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),XB(this)?this.count=Ye(this)+1:this.count=-1),this.count--,this.s}}class ah extends Xp{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=$1(this);const e=zO(this.s);this.count=1,e&&(this.s=-this.s,this.count=Ye(this)+2)}return this.count--,this.s}}class l0 extends Xp{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=$1(this),n=e&1;this.diff=ti(e/2),this.count=1,n&&(this.count=Ye(this)+2)}return this.s+=this.diff,this.count--,this.s}}class lj{constructor(e){this.decoder=new ah(e),this.str=fa(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 oj=crypto.getRandomValues.bind(crypto),aj=Math.random,jO=()=>oj(new Uint32Array(1))[0],cj=t=>t[ti(aj()*t.length)],uj="10000000-1000-4000-8000"+-1e11,fj=()=>uj.replace(/[018]/g,t=>(t^jO()&15>>t/4).toString(16)),dj=Date.now,TE=t=>new Promise(t);Promise.all.bind(Promise);const AE=t=>t===void 0?null:t;class hj{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let UO=new hj,pj=!0;try{typeof localStorage<"u"&&localStorage&&(UO=localStorage,pj=!1)}catch{}const mj=UO,Ru=Symbol("Equality"),HO=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[Ru])!=null&&n.call(t,e))||!1},gj=t=>typeof t=="object",yj=Object.assign,VO=Object.keys,bj=(t,e)=>{for(const n in t)e(t[n],n)},Nh=t=>VO(t).length,xj=t=>{for(const e in t)return!1;return!0},ja=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Y1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Sj=(t,e)=>t===e||Nh(t)===Nh(e)&&ja(t,(n,r)=>(n!==void 0||Y1(e,r))&&HO(e[r],n)),wj=Object.freeze,PO=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&PO(t[e])}return wj(t)},K1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&K1(t,e,n+1)}},vj=t=>t,ch=(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[Ru]!=null)return t[Ru](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)||!ch(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Nh(t)!==Nh(e))return!1;for(const n in t)if(!Y1(t,n)||!ch(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(!ch(t[n],e[n]))return!1;break;default:return!1}return!0},kj=(t,e)=>e.includes(t);var FO={};const Aa=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",$O=typeof window<"u"&&typeof document<"u"&&!Aa;let di;const Cj=()=>{if(di===void 0)if(Aa){di=qr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&di.set(e,""),e=r):e!==null&&(di.set(e,r),e=null)}e!==null&&di.set(e,"")}else typeof location=="object"?(di=qr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");di.set(`--${SE(e,"-")}`,n),di.set(`-${SE(e,"-")}`,n)}})):di=qr();return di},mb=t=>Cj().has(t),zh=t=>AE(Aa?FO[t.toUpperCase().replaceAll("-","_")]:mj.getItem(t)),qO=t=>mb("--"+t)||zh(t)!==null,Ej=qO("production"),Tj=Aa&&kj(FO.FORCE_COLOR,["true","1","2"]),Aj=Tj||!mb("--no-colors")&&!qO("no-color")&&(!Aa||process.stdout.isTTY)&&(!Aa||mb("--color")||zh("COLORTERM")!==null||(zh("TERM")||"").includes("color")),Mj=t=>new Uint8Array(t),Oj=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=LO(t[n]);return btoa(e)},_j=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),Dj=$O?Oj:_j,Rj=t=>{const e=Mj(t.byteLength);return e.set(t),e},Nj=t=>VB(e=>Ea(e,t));class zj{constructor(e,n){this.left=e,this.right=n}}const Zi=(t,e)=>new zj(t,e),ME=t=>t.next()>=.5,o0=(t,e,n)=>ti(t.next()*(n+1-e)+e),YO=(t,e,n)=>ti(t.next()*(n+1-e)+e),G1=(t,e,n)=>YO(t,e,n),Lj=t=>LO(G1(t,97,122)),Ij=(t,e=0,n=20)=>{const r=G1(t,e,n);let i="";for(let s=0;s<r;s++)i+=Lj(t);return i},a0=(t,e)=>e[G1(t,0,e.length-1)],Bj=Symbol("0schema");class jj{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(HB(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
158
- `)}}const gb=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Ru]?HO(t,e):Ca(t)?H1(t,n=>V1(e,r=>gb(n,r))):gj(t)?ja(t,(n,r)=>gb(n,e[r])):!1;var V0;let Yn=(V0=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),gb(n,r)}equals(e){return this.constructor===e.constructor&&ch(this.shape,e.shape)}[Bj](){return!0}[Ru](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Yr()}get nullable(){return Ua(this,rm)}get optional(){return new ZO(this)}cast(e){return OE(e,this),e}expect(e){return OE(e,this),e}},Md(V0,"_dilutes",!1),V0);class Z1 extends Yn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),r}}const tn=(t,e=null)=>new Z1(t,e);tn(Z1);class W1 extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&(n==null||n.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),r}}const mn=t=>new W1(t);tn(W1);class Qp extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&(n==null||n.extend(null,this.shape.join(" | "),e.toString())),r}}const em=(...t)=>new Qp(t),KO=tn(Qp),Uj=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),GO=t=>{if(Ma.check(t))return[Uj(t)];if(KO.check(t))return t.shape.map(e=>e+"");if(i_.check(t))return["[+-]?\\d+.?\\d*"];if(s_.check(t))return[".*"];if(Ih.check(t))return t.shape.map(GO).flat(1);Ln()};class Hj extends Yn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(GO).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}}tn(Hj);const Vj=Symbol("optional");class ZO extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&(n==null||n.extend(null,"undefined (optional)","()")),r}get[Vj](){return!0}}const Pj=tn(ZO);class Fj extends Yn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}tn(Fj);const zp=class zp extends Yn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new zp(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):ja(this.shape,(r,i)=>{const s=this._isPartial&&!Y1(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})}};Md(zp,"_dilutes",!0);let Lh=zp;const $j=t=>new Lh(t),qj=tn(Lh),Yj=mn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class WO extends Yn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&ja(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 JO=(t,e)=>new WO(t,e),Kj=tn(WO);class XO extends Yn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&ja(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const Gj=(...t)=>new XO(t);tn(XO);class QO extends Yn{constructor(e){super(),this.shape=e.length===1?e[0]:new tm(e)}check(e,n){const r=Ca(e)&&H1(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const e_=(...t)=>new QO(t),Zj=tn(QO),Wj=mn(t=>Ca(t));class t_ extends Yn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),r}}const Jj=(t,e=null)=>new t_(t,e);tn(t_);const Xj=Jj(Yn);class Qj extends Yn{constructor(e){super(),this.len=e.length-1,this.args=Gj(...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 e5=tn(Qj),t5=mn(t=>typeof t=="function");class n5 extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=H1(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}tn(n5,t=>t.shape.length>0);class tm extends Yn{constructor(e){super(),this.shape=e}check(e,n){const r=V1(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Md(tm,"_dilutes",!0);const Ua=(...t)=>t.findIndex(e=>Ih.check(e))>=0?Ua(...t.map(e=>Nu(e)).map(e=>Ih.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new tm(t),Ih=tn(tm),n_=()=>!0,Bh=mn(n_),r5=tn(W1,t=>t.shape===n_),J1=mn(t=>typeof t=="bigint"),i5=mn(t=>t===J1),r_=mn(t=>typeof t=="symbol");mn(t=>t===r_);const da=mn(t=>typeof t=="number"),i_=mn(t=>t===da),Ma=mn(t=>typeof t=="string"),s_=mn(t=>t===Ma),nm=mn(t=>typeof t=="boolean"),s5=mn(t=>t===nm),l_=em(void 0);tn(Qp,t=>t.shape.length===1&&t.shape[0]===void 0);em(void 0);const rm=em(null),l5=tn(Qp,t=>t.shape.length===1&&t.shape[0]===null);tn(Uint8Array);tn(Z1,t=>t.shape===Uint8Array);const o5=Ua(da,Ma,rm,l_,J1,nm,r_);(()=>{const t=e_(Bh),e=JO(Ma,Bh),n=Ua(da,Ma,rm,nm,t,e);return t.shape=n,e.shape.values=n,n})();const Nu=t=>{if(Xj.check(t))return t;if(Yj.check(t)){const e={};for(const n in t)e[n]=Nu(t[n]);return $j(e)}else{if(Wj.check(t))return Ua(...t.map(Nu));if(o5.check(t))return em(t);if(t5.check(t))return tn(t)}Ln()},OE=Ej?()=>{}:(t,e)=>{const n=new jj;if(!e.check(t,n))throw Ei(`Expected value to be of type ${e.constructor.name}.
159
- ${n.toString()}`)};class a5{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Nu(e),h:n}),this}else(e){return this.if(Bh,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 c5=t=>new a5(t),o_=c5(Bh).if(i_,(t,e)=>o0(e,xE,Rh)).if(s_,(t,e)=>Ij(e)).if(s5,(t,e)=>ME(e)).if(i5,(t,e)=>BigInt(o0(e,xE,Rh))).if(Ih,(t,e)=>Jo(e,a0(e,t.shape))).if(qj,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(Pj.check(i)){if(ME(e))continue;i=i.shape}n[r]=o_(i,e)}return n}).if(Zj,(t,e)=>{const n=[],r=YO(e,0,42);for(let i=0;i<r;i++)n.push(Jo(e,t.shape));return n}).if(KO,(t,e)=>a0(e,t.shape)).if(l5,(t,e)=>null).if(e5,(t,e)=>{const n=Jo(e,t.res);return()=>n}).if(r5,(t,e)=>Jo(e,a0(e,[da,Ma,rm,l_,J1,nm,e_(da),JO(Ua("a","b","c"),da)]))).if(Kj,(t,e)=>{const n={},r=o0(e,0,3);for(let i=0;i<r;i++){const s=Jo(e,t.shape.keys),o=Jo(e,t.shape.values);n[s]=o}return n}).done(),Jo=(t,e)=>o_(Nu(e),t),sf=typeof document<"u"?document:{};mn(t=>t.nodeType===p5);typeof DOMParser<"u"&&new DOMParser;mn(t=>t.nodeType===f5);mn(t=>t.nodeType===d5);const u5=t=>TB(t,(e,n)=>`${n}:${e};`).join(""),f5=sf.ELEMENT_NODE,d5=sf.TEXT_NODE,h5=sf.DOCUMENT_NODE,p5=sf.DOCUMENT_FRAGMENT_NODE;mn(t=>t.nodeType===h5);const m5=t=>class{constructor(n){this._=n}destroy(){t(this._)}},g5=m5(clearTimeout),X1=(t,e)=>new g5(setTimeout(e,t)),us=Symbol,a_=us(),c_=us(),y5=us(),b5=us(),x5=us(),u_=us(),S5=us(),Q1=us(),w5=us(),v5=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},k5={[a_]:Zi("font-weight","bold"),[c_]:Zi("font-weight","normal"),[y5]:Zi("color","blue"),[x5]:Zi("color","green"),[b5]:Zi("color","grey"),[u_]:Zi("color","red"),[S5]:Zi("color","purple"),[Q1]:Zi("color","orange"),[w5]:Zi("color","black")},C5=t=>{var o;t.length===1&&((o=t[0])==null?void 0:o.constructor)===Function&&(t=t[0]());const e=[],n=[],r=qr();let i=[],s=0;for(;s<t.length;s++){const c=t[s],f=k5[c];if(f!==void 0)r.set(f.left,f.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const d=u5(r);s>0||d.length>0?(e.push("%c"+c),n.push(d)):e.push(c)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const c=t[s];c instanceof Symbol||i.push(c)}return i},f_=Aj?C5:v5,E5=(...t)=>{console.log(...f_(t)),h_.forEach(e=>e.print(t))},d_=(...t)=>{console.warn(...f_(t)),t.unshift(Q1),h_.forEach(e=>e.print(t))},h_=Ql(),p_=t=>({[Symbol.iterator](){return this},next:t}),T5=(t,e)=>p_(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),c0=(t,e)=>p_(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class im{constructor(e,n){this.clock=e,this.len=n}}class Ha{constructor(){this.clients=new Map}}const sl=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],c=o.id.clock+o.length;for(let f=0,d=r[f];f<r.length&&d.clock<c;d=r[++f])M_(t,s,d.clock,d.len,n)}}),A5=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=ti((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},Va=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&A5(n,e.clock)!==null},ex=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 im(i.clock,ni(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},yb=t=>{const e=new Ha;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 o=n+1;o<t.length;o++)MB(s,t[o].clients.get(i)||[]);e.clients.set(i,s)}});return ex(e),e},zu=(t,e,n,r)=>{Mi(t.clients,e,()=>[]).push(new im(n,r))},m_=()=>new Ha,g_=t=>{const e=m_();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const c=o.id.clock;let f=o.length;if(s+1<n.length)for(let d=n[s+1];s+1<n.length&&d.deleted;d=n[++s+1])f+=d.length;i.push(new im(c,f))}}i.length>0&&e.clients.set(r,i)}),e},Pa=(t,e)=>{tt(t.restEncoder,e.clients.size),il(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),tt(t.restEncoder,n);const i=r.length;tt(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},tx=t=>{const e=new Ha,n=Ye(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=Ye(t.restDecoder),s=Ye(t.restDecoder);if(s>0){const o=Mi(e.clients,i,()=>[]);for(let c=0;c<s;c++)o.push(new im(t.readDsClock(),t.readDsLen()))}}return e},_E=(t,e,n)=>{const r=new Ha,i=Ye(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const o=Ye(t.restDecoder),c=Ye(t.restDecoder),f=n.clients.get(o)||[],d=qt(n,o);for(let p=0;p<c;p++){const m=t.readDsClock(),y=m+t.readDsLen();if(m<d){d<y&&zu(r,o,d,y-d);let b=ri(f,m),S=f[b];for(!S.deleted&&S.id.clock<m&&(f.splice(b+1,0,$h(e,S,m-S.id.clock)),b++);b<f.length&&(S=f[b++],S.id.clock<y);)S.deleted||(y<S.id.clock+S.length&&f.splice(b,0,$h(e,S,y-S.id.clock)),S.delete(e))}else zu(r,o,m,y-m)}}if(r.clients.size>0){const s=new eo;return tt(s.restEncoder,0),Pa(s,r),s.toUint8Array()}return null},y_=jO;class Ti extends NO{constructor({guid:e=fj(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:c=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=y_(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new T_,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=TE(d=>{this.on("load",()=>{this.isLoaded=!0,d(this)})});const f=()=>TE(d=>{const p=m=>{(m===void 0||m===!0)&&(this.off("sync",p),d())};this.on("sync",p)});this.on("sync",d=>{d===!1&&this.isSynced&&(this.whenSynced=f()),this.isSynced=d===void 0||d===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=f()}load(){const e=this._item;e!==null&&!this.shouldLoad&&vt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(il(this.subdocs).map(e=>e.guid))}transact(e,n=null){return vt(this,e,n)}get(e,n=dn){const r=Mi(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==dn&&i!==n)if(i===dn){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.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,ma)}getText(e=""){return this.get(e,ll)}getMap(e=""){return this.get(e,_a)}getXmlElement(e=""){return this.get(e,An)}getXmlFragment(e=""){return this.get(e,to)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,il(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,vt(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 b_{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Ye(this.restDecoder)}readDsLen(){return Ye(this.restDecoder)}}class x_ extends b_{readLeftID(){return Be(Ye(this.restDecoder),Ye(this.restDecoder))}readRightID(){return Be(Ye(this.restDecoder),Ye(this.restDecoder))}readClient(){return Ye(this.restDecoder)}readInfo(){return Ta(this.restDecoder)}readString(){return fa(this.restDecoder)}readParentInfo(){return Ye(this.restDecoder)===1}readTypeRef(){return Ye(this.restDecoder)}readLen(){return Ye(this.restDecoder)}readAny(){return Du(this.restDecoder)}readBuf(){return Rj(xr(this.restDecoder))}readJSON(){return JSON.parse(fa(this.restDecoder))}readKey(){return fa(this.restDecoder)}}class M5{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Ye(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Ye(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Oa extends M5{constructor(e){super(e),this.keys=[],Ye(e),this.keyClockDecoder=new l0(xr(e)),this.clientDecoder=new ah(xr(e)),this.leftClockDecoder=new l0(xr(e)),this.rightClockDecoder=new l0(xr(e)),this.infoDecoder=new EE(xr(e),Ta),this.stringDecoder=new lj(xr(e)),this.parentInfoDecoder=new EE(xr(e),Ta),this.typeRefDecoder=new ah(xr(e)),this.lenDecoder=new ah(xr(e))}readLeftID(){return new ha(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ha(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 Du(this.restDecoder)}readBuf(){return xr(this.restDecoder)}readJSON(){return Du(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 S_{constructor(){this.restEncoder=rf()}toUint8Array(){return ei(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){tt(this.restEncoder,e)}writeDsLen(e){tt(this.restEncoder,e)}}class lf extends S_{writeLeftID(e){tt(this.restEncoder,e.client),tt(this.restEncoder,e.clock)}writeRightID(e){tt(this.restEncoder,e.client),tt(this.restEncoder,e.clock)}writeClient(e){tt(this.restEncoder,e)}writeInfo(e){hb(this.restEncoder,e)}writeString(e){ua(this.restEncoder,e)}writeParentInfo(e){tt(this.restEncoder,e?1:0)}writeTypeRef(e){tt(this.restEncoder,e)}writeLen(e){tt(this.restEncoder,e)}writeAny(e){Ea(this.restEncoder,e)}writeBuf(e){br(this.restEncoder,e)}writeJSON(e){ua(this.restEncoder,JSON.stringify(e))}writeKey(e){ua(this.restEncoder,e)}}class w_{constructor(){this.restEncoder=rf(),this.dsCurrVal=0}toUint8Array(){return ei(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,tt(this.restEncoder,n)}writeDsLen(e){e===0&&Ln(),tt(this.restEncoder,e-1),this.dsCurrVal+=e}}class eo extends w_{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new s0,this.clientEncoder=new oh,this.leftClockEncoder=new s0,this.rightClockEncoder=new s0,this.infoEncoder=new vE(hb),this.stringEncoder=new JB,this.parentInfoEncoder=new vE(hb),this.typeRefEncoder=new oh,this.lenEncoder=new oh}toUint8Array(){const e=rf();return tt(e,0),br(e,this.keyClockEncoder.toUint8Array()),br(e,this.clientEncoder.toUint8Array()),br(e,this.leftClockEncoder.toUint8Array()),br(e,this.rightClockEncoder.toUint8Array()),br(e,ei(this.infoEncoder)),br(e,this.stringEncoder.toUint8Array()),br(e,ei(this.parentInfoEncoder)),br(e,this.typeRefEncoder.toUint8Array()),br(e,this.lenEncoder.toUint8Array()),Jp(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){Ea(this.restEncoder,e)}writeBuf(e){br(this.restEncoder,e)}writeJSON(e){Ea(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 O5=(t,e,n,r)=>{r=ni(r,e[0].id.clock);const i=ri(e,r);tt(t.restEncoder,e.length-i),t.writeClient(n),tt(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},nx=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{qt(e,s)>i&&r.set(s,i)}),of(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),tt(t.restEncoder,r.size),il(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{O5(t,e.clients.get(i),i,s)})},_5=(t,e)=>{const n=qr(),r=Ye(t.restDecoder);for(let i=0;i<r;i++){const s=Ye(t.restDecoder),o=new Array(s),c=t.readClient();let f=Ye(t.restDecoder);n.set(c,{i:0,refs:o});for(let d=0;d<s;d++){const p=t.readInfo();switch(Wp&p){case 0:{const m=t.readLen();o[d]=new Vr(Be(c,f),m),f+=m;break}case 10:{const m=Ye(t.restDecoder);o[d]=new Pr(Be(c,f),m),f+=m;break}default:{const m=(p&(ls|Pn))===0,y=new mt(Be(c,f),null,(p&Pn)===Pn?t.readLeftID():null,null,(p&ls)===ls?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(p&Ou)===Ou?t.readString():null,W_(t,p));o[d]=y,f+=y.length}}}}return n},D5=(t,e,n)=>{const r=[];let i=il(n.keys()).sort((b,S)=>b-S);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let b=n.get(i[i.length-1]);for(;b.refs.length===b.i;)if(i.pop(),i.length>0)b=n.get(i[i.length-1]);else return null;return b};let o=s();if(o===null)return null;const c=new T_,f=new Map,d=(b,S)=>{const v=f.get(b);(v==null||v>S)&&f.set(b,S)};let p=o.refs[o.i++];const m=new Map,y=()=>{for(const b of r){const S=b.id.client,v=n.get(S);v?(v.i--,c.clients.set(S,v.refs.slice(v.i)),n.delete(S),v.i=0,v.refs=[]):c.clients.set(S,[b]),i=i.filter(k=>k!==S)}r.length=0};for(;;){if(p.constructor!==Pr){const S=Mi(m,p.id.client,()=>qt(e,p.id.client))-p.id.clock;if(S<0)r.push(p),d(p.id.client,p.id.clock-1),y();else{const v=p.getMissing(t,e);if(v!==null){r.push(p);const k=n.get(v)||{refs:[],i:0};if(k.refs.length===k.i)d(v,qt(e,v)),y();else{p=k.refs[k.i++];continue}}else(S===0||S<p.length)&&(p.integrate(t,S),m.set(p.id.client,p.id.clock+p.length))}}if(r.length>0)p=r.pop();else if(o!==null&&o.i<o.refs.length)p=o.refs[o.i++];else{if(o=s(),o===null)break;p=o.refs[o.i++]}}if(c.clients.size>0){const b=new eo;return nx(b,c,new Map),tt(b.restEncoder,0),{missing:f,update:b.toUint8Array()}}return null},R5=(t,e)=>nx(t,e.doc.store,e.beforeState),N5=(t,e,n,r=new Oa(t))=>vt(e,i=>{i.local=!1;let s=!1;const o=i.doc,c=o.store,f=_5(r,o),d=D5(i,c,f),p=c.pendingStructs;if(p){for(const[y,b]of p.missing)if(b<qt(c,y)){s=!0;break}if(d){for(const[y,b]of d.missing){const S=p.missing.get(y);(S==null||S>b)&&p.missing.set(y,b)}p.update=Uh([p.update,d.update])}}else c.pendingStructs=d;const m=_E(r,i,c);if(c.pendingDs){const y=new Oa(Ba(c.pendingDs));Ye(y.restDecoder);const b=_E(y,i,c);m&&b?c.pendingDs=Uh([m,b]):c.pendingDs=m||b}else c.pendingDs=m;if(s){const y=c.pendingStructs.update;c.pendingStructs=null,jh(i.doc,y)}},n,!1),jh=(t,e,n,r=Oa)=>{const i=Ba(e);N5(i,t,n,new r(i))},z5=(t,e,n)=>jh(t,e,n,x_),L5=(t,e,n=new Map)=>{nx(t,e.store,n),Pa(t,g_(e.store))},I5=(t,e=new Uint8Array([0]),n=new eo)=>{const r=v_(e);L5(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(t8(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===lf)return Q5(i.map((s,o)=>o===0?s:r8(s)));if(n.constructor===eo)return Uh(i)}return i[0]},B5=(t,e)=>I5(t,e,new lf),j5=t=>{const e=new Map,n=Ye(t.restDecoder);for(let r=0;r<n;r++){const i=Ye(t.restDecoder),s=Ye(t.restDecoder);e.set(i,s)}return e},v_=t=>j5(new b_(Ba(t))),k_=(t,e)=>(tt(t.restEncoder,e.size),il(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{tt(t.restEncoder,n),tt(t.restEncoder,r)}),t),U5=(t,e)=>k_(t,of(e.store)),H5=(t,e=new w_)=>(t instanceof Map?k_(e,t):U5(e,t),e.toUint8Array()),V5=t=>H5(t,new S_);class P5{constructor(){this.l=[]}}const DE=()=>new P5,RE=(t,e)=>t.l.push(e),NE=(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.")},C_=(t,e,n)=>K1(t.l,[e,n]);class ha{constructor(e,n){this.client=e,this.clock=n}}const la=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Be=(t,e)=>new ha(t,e),Lu=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Ln()},Iu=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Bu{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const Yl=t=>new Bu(t.type==null?null:Be(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Be(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class F5{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const $5=(t,e,n=0)=>new F5(t,e,n),Bd=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Lu(t):r=Be(t._item.id.client,t._item.id.clock),new Bu(r,i,e,n)},u0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Bd(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Bd(t,Be(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Bd(t,r.lastId,n);r=r.right}return Bd(t,null,n)},q5=(t,e)=>{const n=pa(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},bb=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,o=t.tname,c=t.assoc;let f=null,d=0;if(i!==null){if(qt(r,i.client)<=i.clock)return null;const p=n?vb(r,i):q5(r,i),m=p.item;if(!(m instanceof mt))return null;if(f=m.parent,f._item===null||!f._item.deleted){d=m.deleted||!m.countable?0:p.diff+(c>=0?0:1);let y=m.left;for(;y!==null;)!y.deleted&&y.countable&&(d+=y.length),y=y.left}}else{if(o!==null)f=e.get(o);else if(s!==null){if(qt(r,s.client)<=s.clock)return null;const{item:p}=n?vb(r,s):{item:pa(r,s)};if(p instanceof mt&&p.content instanceof si)f=p.content.type;else return null}else throw Ln();c>=0?d=f._length:d=0}return $5(f,d,t.assoc)},zE=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&la(t.item,e.item)&&la(t.type,e.type)&&t.assoc===e.assoc;class rx{constructor(e,n){this.ds=e,this.sv=n}}const E_=(t,e)=>new rx(t,e),f0=t=>E_(g_(t.store),of(t.store)),zl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Va(e.ds,t.id),xb=(t,e)=>{const n=Mi(t.meta,xb,Ql),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<qt(r,s)&&rr(t,Be(s,i))}),sl(t,e.ds,i=>{}),n.add(e))};class T_{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const of=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},qt=(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 Ln()}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 o=ti(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=ti((n+r)/2)}throw Ln()},Y5=(t,e)=>{const n=t.clients.get(e.client);return n[ri(n,e.clock)]},pa=Y5,Sb=(t,e,n)=>{const r=ri(e,n),i=e[r];return i.id.clock<n&&i instanceof mt?(e.splice(r+1,0,$h(t,i,n-i.id.clock)),r+1):r},rr=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Sb(t,n,e.clock)]},LE=(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!==Vr&&r.splice(i+1,0,$h(t,s,n.clock-s.id.clock+1)),s},K5=(t,e,n)=>{const r=t.clients.get(e.id.client);r[ri(r,e.id.clock)]=n},M_=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=Sb(t,e,n),c;do c=e[o++],s<c.id.clock+c.length&&Sb(t,e,s),i(c);while(o<e.length&&e[o].id.clock<s)};class G5{constructor(e,n,r){this.doc=e,this.deleteSet=new Ha,this.beforeState=of(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 IE=(t,e)=>e.deleteSet.clients.size===0&&!AB(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(ex(e.deleteSet),R5(t,e),Pa(t,e.deleteSet),!0),BE=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Mi(t.changed,e,Ql).add(n)},uh=(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 mt&&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},Z5=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const c=i[o],f=c.clock+c.len;for(let d=ri(s,c.clock),p=s[d];d<s.length&&p.id.clock<f;p=s[++d]){const m=s[d];if(c.clock+c.len<=m.id.clock)break;m instanceof mt&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},W5=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],c=ss(i.length-1,1+ri(i,o.clock+o.len-1));for(let f=c,d=i[f];f>0&&d.id.clock>=o.clock;d=i[f])f-=1+uh(i,f)}})},O_=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{ex(s),n.afterState=of(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((f,d)=>c.push(()=>{(d._item===null||!d._item.deleted)&&d._callObserver(n,f)})),c.push(()=>{n.changedParentTypes.forEach((f,d)=>{d._dEH.l.length>0&&(d._item===null||!d._item.deleted)&&(f=f.filter(p=>p.target._item===null||!p.target._item.deleted),f.forEach(p=>{p.currentTarget=d,p._path=null}),f.sort((p,m)=>p.path.length-m.path.length),c.push(()=>{C_(d._dEH,f,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&y8(n)})}),K1(c,[])}finally{r.gc&&Z5(s,i,r.gcFilter),W5(s,i),n.afterState.forEach((p,m)=>{const y=n.beforeState.get(m)||0;if(y!==p){const b=i.clients.get(m),S=ni(ri(b,y),1);for(let v=b.length-1;v>=S;)v-=1+uh(b,v)}});for(let p=o.length-1;p>=0;p--){const{client:m,clock:y}=o[p].id,b=i.clients.get(m),S=ri(b,y);S+1<b.length&&uh(b,S+1)>1||S>0&&uh(b,S)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(E5(Q1,a_,"[yjs] ",c_,u_,"Changed the client-id because another client seems to be using it."),r.clientID=y_()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const p=new lf;IE(p,n)&&r.emit("update",[p.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const p=new eo;IE(p,n)&&r.emit("updateV2",[p.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:f,subdocsRemoved:d}=n;(c.size>0||d.size>0||f.size>0)&&(c.forEach(p=>{p.clientID=r.clientID,p.collectionid==null&&(p.collectionid=r.collectionid),r.subdocs.add(p)}),d.forEach(p=>r.subdocs.delete(p)),r.emit("subdocs",[{loaded:f,added:c,removed:d},r,n]),d.forEach(p=>p.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):O_(t,e+1)}}},vt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new G5(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const c=t._transaction===i[0];t._transaction=null,c&&O_(i,0)}}return o};class J5{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const jE=(t,e,n)=>{sl(t,n.deletions,r=>{r instanceof mt&&e.scope.some(i=>i===t.doc||Iu(i,r))&&fx(r,!1)})},UE=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;vt(i,c=>{for(;e.length>0&&t.currStackItem===null;){const f=i.store,d=e.pop(),p=new Set,m=[];let y=!1;sl(c,d.insertions,b=>{if(b instanceof mt){if(b.redone!==null){let{item:S,diff:v}=vb(f,b.id);v>0&&(S=rr(c,Be(S.id.client,S.id.clock+v))),b=S}!b.deleted&&s.some(S=>S===c.doc||Iu(S,b))&&m.push(b)}}),sl(c,d.deletions,b=>{b instanceof mt&&s.some(S=>S===c.doc||Iu(S,b))&&!Va(d.insertions,b.id)&&p.add(b)}),p.forEach(b=>{y=Z_(c,b,p,d.insertions,t.ignoreRemoteMapChanges,t)!==null||y});for(let b=m.length-1;b>=0;b--){const S=m[b];t.deleteFilter(S)&&(S.delete(c),y=!0)}t.currStackItem=y?d:null}c.changed.forEach((f,d)=>{f.has(null)&&d._searchMarker&&(d._searchMarker.length=0)}),r=c},t);const o=t.currStackItem;if(o!=null){const c=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return o};class __ extends NO{constructor(e,{captureTimeout:n=500,captureTransaction:r=f=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:c=Ca(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=o,this.captureTimeout=n,this.afterTransactionHandler=f=>{if(!this.captureTransaction(f)||!this.scope.some(k=>f.changedParentTypes.has(k)||k===this.doc)||!this.trackedOrigins.has(f.origin)&&(!f.origin||!this.trackedOrigins.has(f.origin.constructor)))return;const d=this.undoing,p=this.redoing,m=d?this.redoStack:this.undoStack;d?this.stopCapturing():p||this.clear(!1,!0);const y=new Ha;f.afterState.forEach((k,C)=>{const U=f.beforeState.get(C)||0,z=k-U;z>0&&zu(y,C,U,z)});const b=dj();let S=!1;if(this.lastChange>0&&b-this.lastChange<this.captureTimeout&&m.length>0&&!d&&!p){const k=m[m.length-1];k.deletions=yb([k.deletions,f.deleteSet]),k.insertions=yb([k.insertions,y])}else m.push(new J5(f.deleteSet,y)),S=!0;!d&&!p&&(this.lastChange=b),sl(f,f.deleteSet,k=>{k instanceof mt&&this.scope.some(C=>C===f.doc||Iu(C,k))&&fx(k,!0)});const v=[{stackItem:m[m.length-1],origin:f.origin,type:d?"redo":"undo",changedParentTypes:f.changedParentTypes},this];S?this.emit("stack-item-added",v):this.emit("stack-item-updated",v)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ca(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof dn?r.doc!==this.doc:r!==this.doc)&&d_("[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=>jE(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>jE(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=UE(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=UE(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*X5(t){const e=Ye(t.restDecoder);for(let n=0;n<e;n++){const r=Ye(t.restDecoder),i=t.readClient();let s=Ye(t.restDecoder);for(let o=0;o<r;o++){const c=t.readInfo();if(c===10){const f=Ye(t.restDecoder);yield new Pr(Be(i,s),f),s+=f}else if((Wp&c)!==0){const f=(c&(ls|Pn))===0,d=new mt(Be(i,s),null,(c&Pn)===Pn?t.readLeftID():null,null,(c&ls)===ls?t.readRightID():null,f?t.readParentInfo()?t.readString():t.readLeftID():null,f&&(c&Ou)===Ou?t.readString():null,W_(t,c));yield d,s+=d.length}else{const f=t.readLen();yield new Vr(Be(i,s),f),s+=f}}}}class ix{constructor(e,n){this.gen=X5(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===Pr);return this.curr}}class sx{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const Q5=t=>Uh(t,x_,lf),e8=(t,e)=>{if(t.constructor===Vr){const{client:n,clock:r}=t.id;return new Vr(Be(n,r+e),t.length-e)}else if(t.constructor===Pr){const{client:n,clock:r}=t.id;return new Pr(Be(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new mt(Be(r,i+e),null,Be(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Uh=(t,e=Oa,n=eo)=>{if(t.length===1)return t[0];const r=t.map(p=>new e(Ba(p)));let i=r.map(p=>new ix(p,!0)),s=null;const o=new n,c=new sx(o);for(;i=i.filter(y=>y.curr!==null),i.sort((y,b)=>{if(y.curr.id.client===b.curr.id.client){const S=y.curr.id.clock-b.curr.id.clock;return S===0?y.curr.constructor===b.curr.constructor?0:y.curr.constructor===Pr?1:-1:S}else return b.curr.id.client-y.curr.id.client}),i.length!==0;){const p=i[0],m=p.curr.id.client;if(s!==null){let y=p.curr,b=!1;for(;y!==null&&y.id.clock+y.length<=s.struct.id.clock+s.struct.length&&y.id.client>=s.struct.id.client;)y=p.next(),b=!0;if(y===null||y.id.client!==m||b&&y.id.clock>s.struct.id.clock+s.struct.length)continue;if(m!==s.struct.id.client)$s(c,s.struct,s.offset),s={struct:y,offset:0},p.next();else if(s.struct.id.clock+s.struct.length<y.id.clock)if(s.struct.constructor===Pr)s.struct.length=y.id.clock+y.length-s.struct.id.clock;else{$s(c,s.struct,s.offset);const S=y.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Pr(Be(m,s.struct.id.clock+s.struct.length),S),offset:0}}else{const S=s.struct.id.clock+s.struct.length-y.id.clock;S>0&&(s.struct.constructor===Pr?s.struct.length-=S:y=e8(y,S)),s.struct.mergeWith(y)||($s(c,s.struct,s.offset),s={struct:y,offset:0},p.next())}}else s={struct:p.curr,offset:0},p.next();for(let y=p.curr;y!==null&&y.id.client===m&&y.id.clock===s.struct.id.clock+s.struct.length&&y.constructor!==Pr;y=p.next())$s(c,s.struct,s.offset),s={struct:y,offset:0}}s!==null&&($s(c,s.struct,s.offset),s=null),lx(c);const f=r.map(p=>tx(p)),d=yb(f);return Pa(o,d),o.toUint8Array()},t8=(t,e,n=Oa,r=eo)=>{const i=v_(e),s=new r,o=new sx(s),c=new n(Ba(t)),f=new ix(c,!1);for(;f.curr;){const p=f.curr,m=p.id.client,y=i.get(m)||0;if(f.curr.constructor===Pr){f.next();continue}if(p.id.clock+p.length>y)for($s(o,p,ni(y-p.id.clock,0)),f.next();f.curr&&f.curr.id.client===m;)$s(o,f.curr,0),f.next();else for(;f.curr&&f.curr.id.client===m&&f.curr.id.clock+f.curr.length<=y;)f.next()}lx(o);const d=tx(c);return Pa(s,d),s.toUint8Array()},D_=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:ei(t.encoder.restEncoder)}),t.encoder.restEncoder=rf(),t.written=0)},$s=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&D_(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),tt(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},lx=t=>{D_(t);const e=t.encoder.restEncoder;tt(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];tt(e,r.written),Jp(e,r.restEncoder)}},n8=(t,e,n,r)=>{const i=new n(Ba(t)),s=new ix(i,!1),o=new r,c=new sx(o);for(let d=s.curr;d!==null;d=s.next())$s(c,e(d),0);lx(c);const f=tx(i);return Pa(o,f),o.toUint8Array()},r8=t=>n8(t,vj,Oa,lf),HE="You must not compute changes after the event-handler fired.";class sm{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=i8(this.currentTarget,this.target))}deletes(e){return Va(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ei(HE);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,c;if(this.adds(s)){let f=s.left;for(;f!==null&&this.adds(f);)f=f.left;if(this.deletes(s))if(f!==null&&this.deletes(f))o="delete",c=n0(f.content.getContent());else return;else f!==null&&this.deletes(f)?(o="update",c=n0(f.content.getContent())):(o="add",c=void 0)}else if(this.deletes(s))o="delete",c=n0(s.content.getContent());else return;e.set(i,{action:o,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(HE);const n=this.target,r=Ql(),i=Ql(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const f=()=>{c&&s.push(c)};for(let d=n._start;d!==null;d=d.right)d.deleted?this.deletes(d)&&!this.adds(d)&&((c===null||c.delete===void 0)&&(f(),c={delete:0}),c.delete+=d.length,i.add(d)):this.adds(d)?((c===null||c.insert===void 0)&&(f(),c={insert:[]}),c.insert=c.insert.concat(d.content.getContent()),r.add(d)):((c===null||c.retain===void 0)&&(f(),c={retain:0}),c.retain+=d.length);c!==null&&c.retain===void 0&&f()}this._changes=e}return e}}const i8=(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},Rn=()=>{d_("Invalid access: Add Yjs type to a document before reading data.")},R_=80;let ox=0;class s8{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=ox++}}const l8=t=>{t.timestamp=ox++},N_=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=ox++},o8=(t,e,n)=>{if(t.length>=R_){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return N_(r,e,n),r}else{const r=new s8(e,n);return t.push(r),r}},lm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>lh(e-s.index)<lh(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,l8(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&&lh(n.index-i)<r.parent.length/R_?(N_(n,r,i),n):o8(t._searchMarker,r,i)},ju=(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))}},om=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Mi(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;C_(r._eH,n,e)};class dn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=DE(),this._dEH=DE(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Yr()}clone(){throw Yr()}_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){RE(this._eH,e)}observeDeep(e){RE(this._dEH,e)}unobserve(e){NE(this._eH,e)}unobserveDeep(e){NE(this._dEH,e)}toJSON(){}}const z_=(t,e,n)=>{t.doc??Rn(),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 o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let c=e;c<o.length&&r>0;c++)i.push(o[c]),r--;e=0}}s=s.right}return i},L_=t=>{t.doc??Rn();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},I_=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&zl(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Uu=(t,e)=>{let n=0,r=t._start;for(t.doc??Rn();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 Uu(t,(r,i)=>{n.push(e(r,i,t))}),n},a8=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}}}},j_=(t,e)=>{t.doc??Rn();const n=lm(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}},Hh=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,c=s.store,f=n===null?e._start:n.right;let d=[];const p=()=>{d.length>0&&(i=new mt(Be(o,qt(c,o)),i,i&&i.lastId,f,f&&f.id,e,null,new no(d)),i.integrate(t,0),d=[])};r.forEach(m=>{if(m===null)d.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:d.push(m);break;default:switch(p(),m.constructor){case Uint8Array:case ArrayBuffer:i=new mt(Be(o,qt(c,o)),i,i&&i.lastId,f,f&&f.id,e,null,new af(new Uint8Array(m))),i.integrate(t,0);break;case Ti:i=new mt(Be(o,qt(c,o)),i,i&&i.lastId,f,f&&f.id,e,null,new cf(m)),i.integrate(t,0);break;default:if(m instanceof dn)i=new mt(Be(o,qt(c,o)),i,i&&i.lastId,f,f&&f.id,e,null,new si(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),p()},U_=()=>Ei("Length exceeded!"),H_=(t,e,n,r)=>{if(n>e._length)throw U_();if(n===0)return e._searchMarker&&ju(e._searchMarker,n,r.length),Hh(t,e,null,r);const i=n,s=lm(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&rr(t,Be(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&ju(e._searchMarker,i,r.length),Hh(t,e,o,r)},c8=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Hh(t,e,i,n)},V_=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=lm(e,n);let c=e._start;for(o!==null&&(c=o.p,n-=o.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&rr(t,Be(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&rr(t,Be(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw U_();e._searchMarker&&ju(e._searchMarker,i,-s+r)},Vh=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},ax=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let c;if(r==null)c=new no([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new no([r]);break;case Uint8Array:c=new af(r);break;case Ti:c=new cf(r);break;default:if(r instanceof dn)c=new si(r);else throw new Error("Unexpected content type")}new mt(Be(o,qt(s.store,o)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},cx=(t,e)=>{t.doc??Rn();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},P_=t=>{const e={};return t.doc??Rn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},F_=(t,e)=>{t.doc??Rn();const n=t._map.get(e);return n!==void 0&&!n.deleted},u8=(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&&zl(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},jd=t=>(t.doc??Rn(),T5(t._map.entries(),e=>!e[1].deleted));class f8 extends sm{}class ma extends dn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new ma;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ma}clone(){const e=new ma;return e.insert(0,this.toArray().map(n=>n instanceof dn?n.clone():n)),e}get length(){return this.doc??Rn(),this._length}_callObserver(e,n){super._callObserver(e,n),om(this,e,new f8(this,e))}insert(e,n){this.doc!==null?vt(this.doc,r=>{H_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?vt(this.doc,n=>{c8(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?vt(this.doc,r=>{V_(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return j_(this,e)}toArray(){return L_(this)}slice(e=0,n=this.length){return z_(this,e,n)}toJSON(){return this.map(e=>e instanceof dn?e.toJSON():e)}map(e){return B_(this,e)}forEach(e){Uu(this,e)}[Symbol.iterator](){return a8(this)}_write(e){e.writeTypeRef(I8)}}const d8=t=>new ma;class h8 extends sm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class _a extends dn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new _a}clone(){const e=new _a;return this.forEach((n,r)=>{e.set(r,n instanceof dn?n.clone():n)}),e}_callObserver(e,n){om(this,e,new h8(this,e,n))}toJSON(){this.doc??Rn();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof dn?i.toJSON():i}}),e}get size(){return[...jd(this)].length}keys(){return c0(jd(this),e=>e[0])}values(){return c0(jd(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return c0(jd(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Rn(),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?vt(this.doc,n=>{Vh(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?vt(this.doc,r=>{ax(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return cx(this,e)}has(e){return F_(this,e)}clear(){this.doc!==null?vt(this.doc,e=>{this.forEach(function(n,r,i){Vh(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(B8)}}const p8=t=>new _a,Ws=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&Sj(t,e);class wb{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Ln(),this.right.content.constructor){case en:this.right.deleted||Fa(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 VE=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case en:e.right.deleted||Fa(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&rr(t,Be(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},Ud=(t,e,n,r)=>{const i=new Map,s=r?lm(e,n):null;if(s){const o=new wb(s.p.left,s.p,s.index,i);return VE(t,o,n-s.index)}else{const o=new wb(null,e._start,0,i);return VE(t,o,n)}},$_=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===en&&Ws(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((o,c)=>{const f=n.left,d=n.right,p=new mt(Be(s,qt(i.store,s)),f,f&&f.lastId,d,d&&d.id,e,null,new en(c,o));p.integrate(t,0),n.right=p,n.forward()})},Fa=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},q_=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===en&&Ws(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},Y_=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const c in r){const f=r[c],d=n.currentAttributes.get(c)??null;if(!Ws(d,f)){o.set(c,d);const{left:p,right:m}=n;n.right=new mt(Be(s,qt(i.store,s)),p,p&&p.lastId,m,m&&m.id,e,null,new en(c,f)),n.right.integrate(t,0),n.forward()}}return o},d0=(t,e,n,r,i)=>{n.currentAttributes.forEach((y,b)=>{i[b]===void 0&&(i[b]=null)});const s=t.doc,o=s.clientID;q_(n,i);const c=Y_(t,e,n,i),f=r.constructor===String?new ii(r):r instanceof dn?new si(r):new oo(r);let{left:d,right:p,index:m}=n;e._searchMarker&&ju(e._searchMarker,n.index,f.getLength()),p=new mt(Be(o,qt(s.store,o)),d,d&&d.lastId,p,p&&p.id,e,null,f),p.integrate(t,0),n.right=p,n.index=m,n.forward(),$_(t,e,n,c)},PE=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;q_(n,i);const c=Y_(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===en));){if(!n.right.deleted)switch(n.right.content.constructor){case en:{const{key:f,value:d}=n.right.content,p=i[f];if(p!==void 0){if(Ws(p,d))c.delete(f);else{if(r===0)break e;c.set(f,d)}n.right.delete(t)}else n.currentAttributes.set(f,d);break}default:r<n.right.length&&rr(t,Be(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let f="";for(;r>0;r--)f+=`
160
- `;n.right=new mt(Be(o,qt(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ii(f)),n.right.integrate(t,0),n.forward()}$_(t,e,n,c)},K_=(t,e,n,r,i)=>{let s=e;const o=qr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===en){const d=s.content;o.set(d.key,d)}s=s.right}let c=0,f=!1;for(;e!==s;){if(n===e&&(f=!0),!e.deleted){const d=e.content;switch(d.constructor){case en:{const{key:p,value:m}=d,y=r.get(p)??null;(o.get(p)!==d||y===m)&&(e.delete(t),c++,!f&&(i.get(p)??null)===m&&y!==m&&(y===null?i.delete(p):i.set(p,y))),!f&&!e.deleted&&Fa(i,d);break}}}e=e.right}return c},m8=(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===en){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},g8=t=>{let e=0;return vt(t.doc,n=>{let r=t._start,i=t._start,s=qr();const o=fb(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case en:Fa(o,i.content);break;default:e+=K_(n,r,i,s,o),s=fb(o),r=i;break}i=i.right}}),e},y8=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&&M_(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===en&&o.constructor!==Vr&&e.add(o.parent)})}vt(n,r=>{sl(t,t.deleteSet,i=>{if(i instanceof Vr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===en?e.add(s):m8(r,i)});for(const i of e)g8(i)})},FE=(t,e,n)=>{const r=n,i=fb(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case si:case oo:case ii:n<e.right.length&&rr(t,Be(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&K_(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&ju(o._searchMarker,e.index,-r+n),e};class b8 extends sm{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=[];vt(e,r=>{const i=new Map,s=new Map;let o=this.target._start,c=null;const f={};let d="",p=0,m=0;const y=()=>{if(c!==null){let b=null;switch(c){case"delete":m>0&&(b={delete:m}),m=0;break;case"insert":(typeof d=="object"||d.length>0)&&(b={insert:d},i.size>0&&(b.attributes={},i.forEach((S,v)=>{S!==null&&(b.attributes[v]=S)}))),d="";break;case"retain":p>0&&(b={retain:p},xj(f)||(b.attributes=yj({},f))),p=0;break}b&&n.push(b),c=null}};for(;o!==null;){switch(o.content.constructor){case si:case oo:this.adds(o)?this.deletes(o)||(y(),c="insert",d=o.content.getContent()[0],y()):this.deletes(o)?(c!=="delete"&&(y(),c="delete"),m+=1):o.deleted||(c!=="retain"&&(y(),c="retain"),p+=1);break;case ii:this.adds(o)?this.deletes(o)||(c!=="insert"&&(y(),c="insert"),d+=o.content.str):this.deletes(o)?(c!=="delete"&&(y(),c="delete"),m+=o.length):o.deleted||(c!=="retain"&&(y(),c="retain"),p+=o.length);break;case en:{const{key:b,value:S}=o.content;if(this.adds(o)){if(!this.deletes(o)){const v=i.get(b)??null;Ws(v,S)?S!==null&&o.delete(r):(c==="retain"&&y(),Ws(S,s.get(b)??null)?delete f[b]:f[b]=S)}}else if(this.deletes(o)){s.set(b,S);const v=i.get(b)??null;Ws(v,S)||(c==="retain"&&y(),f[b]=v)}else if(!o.deleted){s.set(b,S);const v=f[b];v!==void 0&&(Ws(v,S)?v!==null&&o.delete(r):(c==="retain"&&y(),S===null?delete f[b]:f[b]=S))}o.deleted||(c==="insert"&&y(),Fa(i,o.content));break}}o=o.right}for(y();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 ll extends dn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Rn(),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 ll}clone(){const e=new ll;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new b8(this,e,n);om(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Rn();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?vt(this.doc,r=>{const i=new wb(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const c=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
161
- `?o.insert.slice(0,-1):o.insert;(typeof c!="string"||c.length>0)&&d0(r,this,i,c,o.attributes||{})}else o.retain!==void 0?PE(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&FE(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Rn();const i=[],s=new Map,o=this.doc;let c="",f=this._start;function d(){if(c.length>0){const m={};let y=!1;s.forEach((S,v)=>{y=!0,m[v]=S});const b={insert:c};y&&(b.attributes=m),i.push(b),c=""}}const p=()=>{for(;f!==null;){if(zl(f,e)||n!==void 0&&zl(f,n))switch(f.content.constructor){case ii:{const m=s.get("ychange");e!==void 0&&!zl(f,e)?(m===void 0||m.user!==f.id.client||m.type!=="removed")&&(d(),s.set("ychange",r?r("removed",f.id):{type:"removed"})):n!==void 0&&!zl(f,n)?(m===void 0||m.user!==f.id.client||m.type!=="added")&&(d(),s.set("ychange",r?r("added",f.id):{type:"added"})):m!==void 0&&(d(),s.delete("ychange")),c+=f.content.str;break}case si:case oo:{d();const m={insert:f.content.getContent()[0]};if(s.size>0){const y={};m.attributes=y,s.forEach((b,S)=>{y[S]=b})}i.push(m);break}case en:zl(f,e)&&(d(),Fa(s,f.content));break}f=f.right}d()};return e||n?vt(o,m=>{e&&xb(m,e),n&&xb(m,n),p()},"cleanup"):p(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?vt(i,s=>{const o=Ud(s,this,e,!r);r||(r={},o.currentAttributes.forEach((c,f)=>{r[f]=c})),d0(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?vt(i,s=>{const o=Ud(s,this,e,!r);d0(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?vt(r,i=>{FE(i,Ud(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?vt(i,s=>{const o=Ud(s,this,e,!1);o.right!==null&&PE(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?vt(this.doc,n=>{Vh(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?vt(this.doc,r=>{ax(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return cx(this,e)}getAttributes(){return P_(this)}_write(e){e.writeTypeRef(j8)}}const x8=t=>new ll;class h0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Rn()}[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===to)&&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 to extends dn{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 to}clone(){const e=new to;return e.insert(0,this.toArray().map(n=>n instanceof dn?n.clone():n)),e}get length(){return this.doc??Rn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new h0(this,e)}querySelector(e){e=e.toUpperCase();const r=new h0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),il(new h0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){om(this,e,new v8(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),Uu(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?vt(this.doc,r=>{H_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)vt(this.doc,r=>{const i=e&&e instanceof dn?e._item:e;Hh(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?vt(this.doc,r=>{V_(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return L_(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return j_(this,e)}slice(e=0,n=this.length){return z_(this,e,n)}forEach(e){Uu(this,e)}_write(e){e.writeTypeRef(H8)}}const S8=t=>new to;class An extends to{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 bj(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof dn?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const c in e)r.push(c);r.sort();const i=r.length;for(let c=0;c<i;c++){const f=r[c];n.push(f+'="'+e[f]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?vt(this.doc,n=>{Vh(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?vt(this.doc,r=>{ax(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return cx(this,e)}hasAttribute(e){return F_(this,e)}getAttributes(e){return e?u8(this,e):P_(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const c=s[o];typeof c=="string"&&i.setAttribute(o,c)}return Uu(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(U8),e.writeKey(this.nodeName)}}const w8=t=>new An(t.readKey());class v8 extends sm{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 Ph extends _a{constructor(e){super(),this.hookName=e}_copy(){return new Ph(this.hookName)}clone(){const e=new Ph(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(V8),e.writeKey(this.hookName)}}const k8=t=>new Ph(t.readKey());class Fn extends ll{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 Fn}clone(){const e=new Fn;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 o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,c)=>o.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 o=0;o<s.attrs.length;o++){const c=s.attrs[o];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(P8)}}const C8=t=>new Fn;class ux{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Yr()}mergeWith(e){return!1}write(e,n,r){throw Yr()}integrate(e,n){throw Yr()}}const E8=0;class Vr extends ux{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(E8),e.writeLen(this.length-n)}getMissing(e,n){return null}}class af{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new af(this.content)}splice(e){throw Yr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const T8=t=>new af(t.readBuf());class Hu{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Hu(this.len)}splice(e){const n=new Hu(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){zu(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const A8=t=>new Hu(t.readLen()),G_=(t,e)=>new Ti({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class cf{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 cf(G_(this.doc.guid,this.opts))}splice(e){throw Yr()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const M8=t=>new cf(G_(t.readString(),t.readAny()));class oo{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new oo(this.embed)}splice(e){throw Yr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const O8=t=>new oo(t.readJSON());class en{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new en(this.key,this.value)}splice(e){throw Yr()}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 _8=t=>new en(t.readKey(),t.readJSON());class Fh{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Fh(this.arr)}splice(e){const n=new Fh(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 D8=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 Fh(n)},R8=zh("node_env")==="development";class no{constructor(e){this.arr=e,R8&&PO(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new no(this.arr)}splice(e){const n=new no(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 N8=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new no(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 z8=t=>new ii(t.readString()),L8=[d8,p8,x8,w8,S8,k8,C8],I8=0,B8=1,j8=2,U8=3,H8=4,V8=5,P8=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 Yr()}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 F8=t=>new si(L8[t.readTypeRef()](t)),vb=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Be(n.client,n.clock+r)),i=pa(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof mt);return{item:i,diff:r}},fx=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},$h=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new mt(Be(r,i+n),e,Be(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=Be(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},$E=(t,e)=>V1(t,n=>Va(n.deletions,e)),Z_=(t,e,n,r,i,s)=>{const o=t.doc,c=o.store,f=o.clientID,d=e.redone;if(d!==null)return rr(t,d);let p=e.parent._item,m=null,y;if(p!==null&&p.deleted===!0){if(p.redone===null&&(!n.has(p)||Z_(t,p,n,r,i,s)===null))return null;for(;p.redone!==null;)p=rr(t,p.redone)}const b=p===null?e.parent:p.content.type;if(e.parentSub===null){for(m=e.left,y=e;m!==null;){let C=m;for(;C!==null&&C.parent._item!==p;)C=C.redone===null?null:rr(t,C.redone);if(C!==null&&C.parent._item===p){m=C;break}m=m.left}for(;y!==null;){let C=y;for(;C!==null&&C.parent._item!==p;)C=C.redone===null?null:rr(t,C.redone);if(C!==null&&C.parent._item===p){y=C;break}y=y.right}}else if(y=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||Va(r,m.right.id)||$E(s.undoStack,m.right.id)||$E(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=rr(t,m.redone);if(m&&m.right!==null)return null}else m=b._map.get(e.parentSub)||null;const S=qt(c,f),v=Be(f,S),k=new mt(v,m,m&&m.lastId,y,y&&y.id,b,e.parentSub,e.content.copy());return e.redone=v,fx(k,!0),k.integrate(t,0),k};class mt extends ux{constructor(e,n,r,i,s,o,c,f){super(e,f.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=c,this.redone=null,this.content=f,this.info=this.content.isCountable()?bE:0}set marker(e){(this.info&i0)>0!==e&&(this.info^=i0)}get marker(){return(this.info&i0)>0}get keep(){return(this.info&yE)>0}set keep(e){this.keep!==e&&(this.info^=yE)}get countable(){return(this.info&bE)>0}get deleted(){return(this.info&r0)>0}set deleted(e){this.deleted!==e&&(this.info^=r0)}markDeleted(){this.info|=r0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=qt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=qt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ha&&this.id.client!==this.parent.client&&this.parent.clock>=qt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=LE(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=rr(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Vr||this.right&&this.right.constructor===Vr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===mt?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===mt&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ha){const r=pa(n,this.parent);r.constructor===Vr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=LE(e,e.doc.store,Be(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,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),la(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(la(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(pa(e.doc.store,i.origin)))s.has(pa(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),BE(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Vr(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:Be(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&la(e.origin,this.lastId)&&this.right===e&&la(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),zu(e.deleteSet,this.id.client,this.id.clock,this.length),BE(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Ln();this.content.gc(e),n?K5(e,this,new Vr(this.id,this.length)):this.content=new Hu(this.length)}write(e,n){const r=n>0?Be(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Wp|(r===null?0:Pn)|(i===null?0:ls)|(s===null?0:Ou);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const c=this.parent;if(c._item!==void 0){const f=c._item;if(f===null){const d=Lu(c);e.writeParentInfo(!0),e.writeString(d)}else e.writeParentInfo(!1),e.writeLeftID(f.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===ha?(e.writeParentInfo(!1),e.writeLeftID(c)):Ln();s!==null&&e.writeString(s)}this.content.write(e,n)}}const W_=(t,e)=>$8[e&Wp](t),$8=[()=>{Ln()},A8,D8,T8,z8,O8,_8,F8,N8,M8,()=>{Ln()}],q8=10;class Pr extends ux{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Ln()}write(e,n){e.writeInfo(q8),tt(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const J_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},X_="__ $YJS$ __";J_[X_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");J_[X_]=!0;const Y8=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},K8=/[\uD800-\uDBFF]/,G8=/[\uDC00-\uDFFF]/,Z8=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&K8.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&&G8.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},W8=Z8,Lt=new Nt("y-sync"),bi=new Nt("y-undo"),Hd=new Nt("yjs-cursor"),xi=(t,e)=>t>>>e|t<<32-e,J8=t=>xi(t,2)^xi(t,13)^xi(t,22),X8=t=>xi(t,6)^xi(t,11)^xi(t,25),Q8=t=>xi(t,7)^xi(t,18)^t>>>3,eU=t=>xi(t,17)^xi(t,19)^t>>>10,tU=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]),nU=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class rU{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(nU),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=eU(n[m-2])+n[m-7]+Q8(n[m-15])+n[m-16];let r=e[0],i=e[1],s=e[2],o=e[3],c=e[4],f=e[5],d=e[6],p=e[7];for(let m=0,y,b;m<64;m++)y=p+X8(c)+(c&f^~c&d)+tU[m]+n[m]>>>0,b=J8(r)+(r&i^r&s^i&s)>>>0,p=d,d=f,f=c,c=o+y>>>0,o=s,s=i,i=r,r=y+b>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=p}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=Pn<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=Pn<<(3-n%4)*8),this._W[14]=e.byteLength/_B,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let c=0;c<4;c++)s[o*4+c]=this._H[o]>>>(3-c)*8;return s}}const iU=t=>new rU().digest(t),sU=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},lU=t=>Dj(sU(iU(Nj(t)))),qh=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Va(e.ds,t.id),oU=[{light:"#ecd44433",dark:"#ecd444"}],aU=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Ql();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,cj(e))}return t.get(n)},cU=(t,{colors:e=oU,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const c=new fU(t,s),f=new Ct({props:{editable:d=>{const p=Lt.getState(d);return p.snapshot==null&&p.prevSnapshot==null}},key:Lt,state:{init:(d,p)=>({type:t,doc:t.doc,binding:c,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(d,p)=>{const m=d.getMeta(Lt);if(m!==void 0){p=Object.assign({},p);for(const y in m)p[y]=m[y]}return p.addToHistory=d.getMeta("addToHistory")!==!1,p.isChangeOrigin=m!==void 0&&!!m.isChangeOrigin,p.isUndoRedoOperation=m!==void 0&&!!m.isChangeOrigin&&!!m.isUndoRedoOperation,c.prosemirrorView!==null&&m!==void 0&&(m.snapshot!=null||m.prevSnapshot!=null)&&X1(0,()=>{c.prosemirrorView!=null&&(m.restore==null?c._renderSnapshot(m.snapshot,m.prevSnapshot,p):(c._renderSnapshot(m.snapshot,m.snapshot,p),delete p.restore,delete p.snapshot,delete p.prevSnapshot,c.mux(()=>{c._prosemirrorChanged(c.prosemirrorView.state.doc)})))}),p}},view:d=>(c.initView(d),s==null&&c._forceRerender(),i(),{update:()=>{const p=f.getState(d.state);if(p.snapshot==null&&p.prevSnapshot==null&&(o||d.state.doc.content.findDiffStart(d.state.doc.type.createAndFill().content)!==null)){if(o=!0,p.addToHistory===!1&&!p.isChangeOrigin){const m=bi.getState(d.state),y=m&&m.undoManager;y&&y.stopCapturing()}c.mux(()=>{p.doc.transact(m=>{m.meta.set("addToHistory",p.addToHistory),c._prosemirrorChanged(d.state.doc)},Lt)})}},destroy:()=>{c.destroy()}})});return f},uU=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new ir(t.doc));else if(e.type==="node"){const r=ga(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Ce.create(t.doc,r))}else{const r=ga(n.doc,n.type,e.anchor,n.mapping),i=ga(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=Te.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},kb=(t,e)=>({type:e.selection.jsonID,anchor:Kh(e.selection.anchor,t.type,t.mapping),head:Kh(e.selection.head,t.type,t.mapping)});class fU{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=Y8(),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=kb(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()?($O&&this._domSelectionInView===null&&(X1(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=sf.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=E_(m_(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Lt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>fh(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(Q.from(e),0,0));n.setMeta(Lt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>fh(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(Q.from(n),0,0));if(e){const i=ss(ni(e.anchor,0),r.doc.content.size),s=ss(ni(e.head,0),r.doc.content.size);r.setSelection(Te.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Lt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=f0(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Ln(),i=new Ti({gc:!1}),jh(i,n),n=f0(i),jh(i,e),e=f0(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(c=>this.doc.share.get(c)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],c=ri(o,s._item.id.clock);s=o[c].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const c=r.permanentUserData;c&&c.dss.forEach(m=>{sl(o,m,y=>{})});const f=(m,y)=>{const b=m==="added"?c.getUserByClientId(y.client):c.getUserByDeletedId(y);return{user:b,type:m,color:aU(r.colorMapping,r.colors,b)}},d=I_(s,new rx(n.ds,e.sv)).map(m=>!m._item.deleted||qh(m._item,e)||qh(m._item,n)?fh(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,f):null).filter(m=>m!==null),p=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(Q.from(d),0,0));this.prosemirrorView.dispatch(p.setMeta(Lt,{isChangeOrigin:!0}))},Lt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Lt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(c,f)=>this.mapping.delete(f);sl(n,n.deleteSet,c=>{if(c.constructor===mt){const f=c.content.type;f&&this.mapping.delete(f)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>Q_(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new he(Q.from(s),0,0));uU(o,this.beforeTransactionSelection,this),o=o.setMeta(Lt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof __}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Eb(this.doc,this.type,e,this),this.beforeTransactionSelection=kb(this,this.prosemirrorView.state)},Lt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const Q_=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof An)return fh(t,e,n,r,i,s);throw Yr()}return o},fh=(t,e,n,r,i,s)=>{const o=[],c=f=>{var d,p;if(f instanceof An){const m=Q_(f,e,n,r,i,s);m!==null&&o.push(m)}else{const m=(p=(d=f._item.right)==null?void 0:d.content)==null?void 0:p.type;m instanceof ll&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(f.applyDelta([{retain:f.length},...m.toDelta()]),m.doc.transact(b=>{m._item.delete(b)}));const y=dU(f,e,n,r,i,s);y!==null&&y.forEach(b=>{b!==null&&o.push(b)})}};r===void 0||i===void 0?t.toArray().forEach(c):I_(t,new rx(i.ds,r.sv)).forEach(c);try{const f=t.getAttributes(r);r!==void 0&&(qh(t._item,r)?qh(t._item,i)||(f.ychange=s?s("added",t._item.id):{type:"added"}):f.ychange=s?s("removed",t._item.id):{type:"removed"});const d=e.node(t.nodeName,f,o);return n.mapping.set(t,d),d}catch{return t.doc.transact(d=>{t._item.delete(d)},Lt),n.mapping.delete(t),null}},dU=(t,e,n,r,i,s)=>{const o=[],c=t.toDelta(r,i,s);try{for(let f=0;f<c.length;f++){const d=c[f];o.push(e.text(d.insert,bU(d.attributes,e)))}}catch{return t.doc.transact(d=>{t._item.delete(d)},Lt),null}return o},hU=(t,e)=>{const n=new Fn,r=t.map(i=>({insert:i.text,attributes:tD(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},pU=(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,am(t).map(r=>Cb(r,e))),e.mapping.set(n,t),n},Cb=(t,e)=>t instanceof Array?hU(t,e):pU(t,e),qE=t=>typeof t=="object"&&t!==null,dx=(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],o=t[s],c=e[s];r=s==="ychange"||o===c||qE(o)&&qE(c)&&dx(o,c)}return r},am=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 o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},eD=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&VO(r.attributes||{}).length===e[i].marks.length&&ja(r.attributes,(s,o)=>{var d;const c=hx(o),f=e[i].marks;return dx(s,(d=f.find(p=>p.type.name===c))==null?void 0:d.attrs)}))},Vu=(t,e)=>{if(t instanceof An&&!(e instanceof Array)&&Tb(t,e)){const n=am(e);return t._length===n.length&&dx(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Vu(r,n[i]))}return t instanceof Fn&&e instanceof Array&&eD(t,e)},Yh=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),YE=(t,e,n)=>{const r=t.toArray(),i=am(e),s=i.length,o=r.length,c=ss(o,s);let f=0,d=0,p=!1;for(;f<c;f++){const m=r[f],y=i[f];if(Yh(n.mapping.get(m),y))p=!0;else if(!Vu(m,y))break}for(;f+d<c;d++){const m=r[o-d-1],y=i[s-d-1];if(Yh(n.mapping.get(m),y))p=!0;else if(!Vu(m,y))break}return{equalityFactor:f+d,foundMappedChild:p}},mU=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 en&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},gU=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=mU(t),s=e.map(d=>({insert:d.text,attributes:Object.assign({},r,tD(d.marks,n))})),{insert:o,remove:c,index:f}=W8(i,s.map(d=>d.insert).join(""));t.delete(f,c),t.insert(f,o),t.applyDelta(s.map(d=>({retain:d.insert.length,attributes:d.attributes})))},yU=/(.*)(--[a-zA-Z0-9+/=]{8})$/,hx=t=>{var e;return((e=yU.exec(t))==null?void 0:e[1])??t},bU=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(hx(r),t[r]));return n},tD=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Mi(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${lU(r.toJSON())}`:r.type.name]=r.attrs}}),n},Eb=(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(),y=n.attrs;for(const b in y)y[b]!==null?m[b]!==y[b]&&b!=="ychange"&&e.setAttribute(b,y[b]):e.removeAttribute(b);for(const b in m)y[b]===void 0&&e.removeAttribute(b)}const i=am(n),s=i.length,o=e.toArray(),c=o.length,f=ss(s,c);let d=0,p=0;for(;d<f;d++){const m=o[d],y=i[d];if(!Yh(r.mapping.get(m),y))if(Vu(m,y))r.mapping.set(m,y);else break}for(;p+d<f;p++){const m=o[c-p-1],y=i[s-p-1];if(!Yh(r.mapping.get(m),y))if(Vu(m,y))r.mapping.set(m,y);else break}t.transact(()=>{for(;c-d-p>0&&s-d-p>0;){const y=o[d],b=i[d],S=o[c-p-1],v=i[s-p-1];if(y instanceof Fn&&b instanceof Array)eD(y,b)||gU(y,b,r),d+=1;else{let k=y instanceof An&&Tb(y,b),C=S instanceof An&&Tb(S,v);if(k&&C){const U=YE(y,b,r),z=YE(S,v,r);U.foundMappedChild&&!z.foundMappedChild?C=!1:!U.foundMappedChild&&z.foundMappedChild||U.equalityFactor<z.equalityFactor?k=!1:C=!1}k?(Eb(t,y,b,r),d+=1):C?(Eb(t,S,v,r),p+=1):(r.mapping.delete(e.get(d)),e.delete(d,1),e.insert(d,[Cb(b,r)]),d+=1)}}const m=c-d-p;if(c===1&&s===0&&o[0]instanceof Fn?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):m>0&&(e.slice(d,d+m).forEach(y=>r.mapping.delete(y)),e.delete(d,m)),d+p<s){const y=[];for(let b=d;b<s-p;b++)y.push(Cb(i[b],r));e.insert(d,y)}},Lt)},Tb=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let iu=null;const xU=()=>{const t=iu;iu=null,t.forEach((e,n)=>{const r=n.state.tr,i=Lt.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},SU=(t,e,n)=>{iu||(iu=new Map,X1(0,xU)),Mi(iu,t,qr).set(e,n)},Kh=(t,e,n)=>{if(t===0)return u0(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 Fn){if(r._length>=t)return u0(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 Bu(r._item===null?null:r._item.id,r._item===null?Lu(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 Bu(r._item===null?null:r._item.id,r._item===null?Lu(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 Ln();if(t===0&&r.constructor!==Fn&&r!==e)return wU(r._item.parent,r._item)}return u0(e,e._length,e.length===0?-1:0)},wU=(t,e)=>{let n=null,r=null;return t._item===null?r=Lu(t):n=Be(t._item.id.client,t._item.id.clock),new Bu(n,r,e.id)},ga=(t,e,n,r)=>{const i=bb(n,t);if(i===null||i.type!==e&&!Iu(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Fn)o=i.index;else if(s._item===null||!s._item.deleted){let c=s._first,f=0;for(;f<s._length&&f<i.index&&c!==null;){if(!c.deleted){const d=c.content.type;f++,d instanceof Fn?o+=d._length:o+=r.get(d).nodeSize}c=c.right}o+=1}for(;s!==e&&s._item!==null;){const c=s._item.parent;if(c._item===null||!c._item.deleted){o+=1;let f=c._first;for(;f!==null;){const d=f.content.type;if(d===s)break;f.deleted||(d instanceof Fn?o+=d._length:o+=r.get(d).nodeSize),f=f.right}}s=c}return o-1};function vU(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Fn)i=r.toDelta().map(o=>{const c={type:"text",text:o.insert};return o.attributes&&(c.marks=Object.keys(o.attributes).map(f=>{const d=o.attributes[f],m={type:hx(f)};return Object.keys(d)&&(m.attrs=d),m})),c});else if(r instanceof An){i={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(i.attrs=s);const o=r.toArray();o.length&&(i.content=o.map(n).flat())}else Ln();return i};return{type:"doc",content:e.map(n)}}const kU=(t,e,n)=>t!==e,CU=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},nD=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),EU=/^#[0-9a-fA-F]{6}$/,KE=(t,e,n,r,i)=>{const s=Lt.getState(t),o=s.doc,c=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?xt.create(t.doc,[]):(e.getStates().forEach((f,d)=>{if(n(o.clientID,d,f)&&f.cursor!=null){const p=f.user||{};p.color==null?p.color="#ffa500":EU.test(p.color)||console.warn("A user uses an unsupported color format",p),p.name==null&&(p.name=`User: ${d}`);let m=ga(o,s.type,Yl(f.cursor.anchor),s.binding.mapping),y=ga(o,s.type,Yl(f.cursor.head),s.binding.mapping);if(m!==null&&y!==null){const b=ni(t.doc.content.size-1,0);m=ss(m,b),y=ss(y,b),c.push(Xt.widget(y,()=>r(p,d),{key:d+"",side:10}));const S=ss(m,y),v=ni(m,y);c.push(Xt.inline(S,v,i(p,d),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),xt.create(t.doc,c))},TU=(t,{awarenessStateFilter:e=kU,cursorBuilder:n=CU,selectionBuilder:r=nD,getSelection:i=o=>o.selection}={},s="cursor")=>new Ct({key:Hd,state:{init(o,c){return KE(c,t,e,n,r)},apply(o,c,f,d){const p=Lt.getState(d),m=o.getMeta(Hd);return p&&p.isChangeOrigin||m&&m.awarenessUpdated?KE(d,t,e,n,r):c.map(o.mapping,o.doc)}},props:{decorations:o=>Hd.getState(o)},view:o=>{const c=()=>{o.docView&&SU(o,Hd,{awarenessUpdated:!0})},f=()=>{const d=Lt.getState(o.state),p=t.getLocalState()||{};if(o.hasFocus()){const m=i(o.state),y=Kh(m.anchor,d.type,d.binding.mapping),b=Kh(m.head,d.type,d.binding.mapping);(p.cursor==null||!zE(Yl(p.cursor.anchor),y)||!zE(Yl(p.cursor.head),b))&&t.setLocalStateField(s,{anchor:y,head:b})}else p.cursor!=null&&ga(d.doc,d.type,Yl(p.cursor.anchor),d.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),o.dom.addEventListener("focusin",f),o.dom.addEventListener("focusout",f),{update:f,destroy:()=>{o.dom.removeEventListener("focusin",f),o.dom.removeEventListener("focusout",f),t.off("change",c),t.setLocalStateField(s,null)}}}}),AU=t=>{var e,n;return((n=(e=bi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},MU=t=>{var e,n;return((n=(e=bi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},OU=new Set(["paragraph"]),_U=(t,e)=>!(t instanceof mt)||!(t.content instanceof si)||!(t.content.type instanceof ll||t.content.type instanceof An&&e.has(t.content.type.nodeName))||t.content.type._length===0,DU=({protectedNodes:t=OU,trackedOrigins:e=[],undoManager:n=null}={})=>new Ct({key:bi,state:{init:(r,i)=>{const s=Lt.getState(i),o=n||new __(s.type,{trackedOrigins:new Set([Lt].concat(e)),deleteFilter:c=>_U(c,t),captureTransaction:c=>c.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const c=Lt.getState(o).binding,f=i.undoManager,d=f.undoStack.length>0,p=f.redoStack.length>0;return c?{undoManager:f,prevSel:kb(c,s),hasUndoOps:d,hasRedoOps:p}:d!==i.hasUndoOps||p!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:f.undoStack.length>0,hasRedoOps:f.redoStack.length>0}):i}},view:r=>{const i=Lt.getState(r.state),s=bi.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const c=i.binding;c&&o.meta.set(c,bi.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const c=i.binding;c&&(c.beforeTransactionSelection=o.meta.get(c)||c.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),RU=Qt.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),bi.getState(e).undoManager.undoStack.length===0?!1:n?AU(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),bi.getState(e).undoManager.redoStack.length===0?!1:n?MU(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=DU(this.options.yUndoOptions),r=n.spec.view;n.spec.view=o=>{const{undoManager:c}=bi.getState(o.state);c.restore&&(c.restore(),c.restore=()=>{});const f=r?r(o):void 0;return{destroy:()=>{const d=c.trackedOrigins.has(c),p=c._observers;c.restore=()=>{d&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=p},f!=null&&f.destroy&&f.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=cU(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const o=vU(e);if(o.content.length===0)return;this.editor.schema.nodeFromJSON(o).check()}catch(o){return this.editor.emit("contentError",{error:o,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 Ct({key:new Nt("filterInvalidContent"),filterTransaction:()=>{var o;return this.storage.isDisabled&&((o=e.doc)===null||o===void 0||o.destroy()),!0}})].filter(Boolean)}}),GE=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),ZE=()=>null,NU=Qt.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:nD,onUpdate:ZE}},onCreate(){if(this.options.onUpdate!==ZE&&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[TU((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=GE(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=GE(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),zU=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,LU=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,IU=Ci.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Xl({find:zU,type:this.type})]},addPasteRules(){return[rl({find:LU,type:this.type})]}}),BU="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",jU="ελ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",Ab="numeric",Mb="ascii",Ob="alpha",su="asciinumeric",Zc="alphanumeric",_b="domain",rD="emoji",UU="scheme",HU="slashscheme",p0="whitespace";function VU(t,e){return t in e||(e[t]=[]),e[t]}function jl(t,e,n){e[Ab]&&(e[su]=!0,e[Zc]=!0),e[Mb]&&(e[su]=!0,e[Ob]=!0),e[su]&&(e[Zc]=!0),e[Ob]&&(e[Zc]=!0),e[Zc]&&(e[_b]=!0),e[rD]&&(e[_b]=!0);for(const r in e){const i=VU(r,n);i.indexOf(t)<0&&i.push(t)}}function PU(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function nr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}nr.groups={};nr.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||nr.groups;let i;return e&&e.j?i=e:(i=new nr(e),n&&r&&jl(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 o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||nr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,c=i.go(t);if(c?(o=new nr,Object.assign(o.j,c.j),o.jr.push.apply(o.jr,c.jr),o.jd=c.jd,o.t=c.t):o=new nr,s){if(r)if(o.t&&typeof o.t=="string"){const f=Object.assign(PU(o.t,r),n);jl(s,f,r)}else n&&jl(s,n,r);o.t=s}return i.j[t]=o,o}};const Fe=(t,e,n,r,i)=>t.ta(e,n,r,i),Ut=(t,e,n,r,i)=>t.tr(e,n,r,i),WE=(t,e,n,r,i)=>t.ts(e,n,r,i),oe=(t,e,n,r,i)=>t.tt(e,n,r,i),Qi="WORD",Db="UWORD",iD="ASCIINUMERICAL",sD="ALPHANUMERICAL",Pu="LOCALHOST",Rb="TLD",Nb="UTLD",dh="SCHEME",na="SLASH_SCHEME",px="NUM",zb="WS",mx="NL",lu="OPENBRACE",ou="CLOSEBRACE",Gh="OPENBRACKET",Zh="CLOSEBRACKET",Wh="OPENPAREN",Jh="CLOSEPAREN",Xh="OPENANGLEBRACKET",Qh="CLOSEANGLEBRACKET",ep="FULLWIDTHLEFTPAREN",tp="FULLWIDTHRIGHTPAREN",np="LEFTCORNERBRACKET",rp="RIGHTCORNERBRACKET",ip="LEFTWHITECORNERBRACKET",sp="RIGHTWHITECORNERBRACKET",lp="FULLWIDTHLESSTHAN",op="FULLWIDTHGREATERTHAN",ap="AMPERSAND",cp="APOSTROPHE",up="ASTERISK",Vs="AT",fp="BACKSLASH",dp="BACKTICK",hp="CARET",qs="COLON",gx="COMMA",pp="DOLLAR",hi="DOT",mp="EQUALS",yx="EXCLAMATION",Br="HYPHEN",au="PERCENT",gp="PIPE",yp="PLUS",bp="POUND",cu="QUERY",bx="QUOTE",lD="FULLWIDTHMIDDLEDOT",xx="SEMI",pi="SLASH",uu="TILDE",xp="UNDERSCORE",oD="EMOJI",Sp="SYM";var aD=Object.freeze({__proto__:null,ALPHANUMERICAL:sD,AMPERSAND:ap,APOSTROPHE:cp,ASCIINUMERICAL:iD,ASTERISK:up,AT:Vs,BACKSLASH:fp,BACKTICK:dp,CARET:hp,CLOSEANGLEBRACKET:Qh,CLOSEBRACE:ou,CLOSEBRACKET:Zh,CLOSEPAREN:Jh,COLON:qs,COMMA:gx,DOLLAR:pp,DOT:hi,EMOJI:oD,EQUALS:mp,EXCLAMATION:yx,FULLWIDTHGREATERTHAN:op,FULLWIDTHLEFTPAREN:ep,FULLWIDTHLESSTHAN:lp,FULLWIDTHMIDDLEDOT:lD,FULLWIDTHRIGHTPAREN:tp,HYPHEN:Br,LEFTCORNERBRACKET:np,LEFTWHITECORNERBRACKET:ip,LOCALHOST:Pu,NL:mx,NUM:px,OPENANGLEBRACKET:Xh,OPENBRACE:lu,OPENBRACKET:Gh,OPENPAREN:Wh,PERCENT:au,PIPE:gp,PLUS:yp,POUND:bp,QUERY:cu,QUOTE:bx,RIGHTCORNERBRACKET:rp,RIGHTWHITECORNERBRACKET:sp,SCHEME:dh,SEMI:xx,SLASH:pi,SLASH_SCHEME:na,SYM:Sp,TILDE:uu,TLD:Rb,UNDERSCORE:xp,UTLD:Nb,UWORD:Db,WORD:Qi,WS:zb});const Wi=/[a-z]/,Vc=new RegExp("\\p{L}","u"),m0=new RegExp("\\p{Emoji}","u"),Ji=/\d/,g0=/\s/,JE="\r",y0=`
162
- `,FU="️",$U="‍",b0="";let Vd=null,Pd=null;function qU(t=[]){const e={};nr.groups=e;const n=new nr;Vd==null&&(Vd=XE(BU)),Pd==null&&(Pd=XE(jU)),oe(n,"'",cp),oe(n,"{",lu),oe(n,"}",ou),oe(n,"[",Gh),oe(n,"]",Zh),oe(n,"(",Wh),oe(n,")",Jh),oe(n,"<",Xh),oe(n,">",Qh),oe(n,"(",ep),oe(n,")",tp),oe(n,"「",np),oe(n,"」",rp),oe(n,"『",ip),oe(n,"』",sp),oe(n,"<",lp),oe(n,">",op),oe(n,"&",ap),oe(n,"*",up),oe(n,"@",Vs),oe(n,"`",dp),oe(n,"^",hp),oe(n,":",qs),oe(n,",",gx),oe(n,"$",pp),oe(n,".",hi),oe(n,"=",mp),oe(n,"!",yx),oe(n,"-",Br),oe(n,"%",au),oe(n,"|",gp),oe(n,"+",yp),oe(n,"#",bp),oe(n,"?",cu),oe(n,'"',bx),oe(n,"/",pi),oe(n,";",xx),oe(n,"~",uu),oe(n,"_",xp),oe(n,"\\",fp),oe(n,"・",lD);const r=Ut(n,Ji,px,{[Ab]:!0});Ut(r,Ji,r);const i=Ut(r,Wi,iD,{[su]:!0}),s=Ut(r,Vc,sD,{[Zc]:!0}),o=Ut(n,Wi,Qi,{[Mb]:!0});Ut(o,Ji,i),Ut(o,Wi,o),Ut(i,Ji,i),Ut(i,Wi,i);const c=Ut(n,Vc,Db,{[Ob]:!0});Ut(c,Wi),Ut(c,Ji,s),Ut(c,Vc,c),Ut(s,Ji,s),Ut(s,Wi),Ut(s,Vc,s);const f=oe(n,y0,mx,{[p0]:!0}),d=oe(n,JE,zb,{[p0]:!0}),p=Ut(n,g0,zb,{[p0]:!0});oe(n,b0,p),oe(d,y0,f),oe(d,b0,p),Ut(d,g0,p),oe(p,JE),oe(p,y0),Ut(p,g0,p),oe(p,b0,p);const m=Ut(n,m0,oD,{[rD]:!0});oe(m,"#"),Ut(m,m0,m),oe(m,FU,m);const y=oe(m,$U);oe(y,"#"),Ut(y,m0,m);const b=[[Wi,o],[Ji,i]],S=[[Wi,null],[Vc,c],[Ji,s]];for(let v=0;v<Vd.length;v++)Is(n,Vd[v],Rb,Qi,b);for(let v=0;v<Pd.length;v++)Is(n,Pd[v],Nb,Db,S);jl(Rb,{tld:!0,ascii:!0},e),jl(Nb,{utld:!0,alpha:!0},e),Is(n,"file",dh,Qi,b),Is(n,"mailto",dh,Qi,b),Is(n,"http",na,Qi,b),Is(n,"https",na,Qi,b),Is(n,"ftp",na,Qi,b),Is(n,"ftps",na,Qi,b),jl(dh,{scheme:!0,ascii:!0},e),jl(na,{slashscheme:!0,ascii:!0},e),t=t.sort((v,k)=>v[0]>k[0]?1:-1);for(let v=0;v<t.length;v++){const k=t[v][0],U=t[v][1]?{[UU]:!0}:{[HU]:!0};k.indexOf("-")>=0?U[_b]=!0:Wi.test(k)?Ji.test(k)?U[su]=!0:U[Mb]=!0:U[Ab]=!0,WE(n,k,k,U)}return WE(n,"localhost",Pu,{ascii:!0}),n.jd=new nr(Sp),{start:n,tokens:Object.assign({groups:e},aD)}}function cD(t,e){const n=YU(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let c=t,f=null,d=0,p=null,m=-1,y=-1;for(;o<r&&(f=c.go(n[o]));)c=f,c.accepts()?(m=0,y=0,p=c):m>=0&&(m+=n[o].length,y++),d+=n[o].length,s+=n[o].length,o++;s-=m,o-=y,d-=m,i.push({t:p.t,v:e.slice(s-d,s),s:s-d,e:s})}return i}function YU(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Is(t,e,n,r,i){let s;const o=e.length;for(let c=0;c<o-1;c++){const f=e[c];t.j[f]?s=t.j[f]:(s=new nr(r),s.jr=i.slice(),t.j[f]=s),t=s}return s=new nr(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function XE(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 o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Fu={defaultProtocol:"http",events:null,format:QE,formatHref:QE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sx(t,e=null){let n=Object.assign({},Fu);t&&(n=Object.assign(n,t instanceof Sx?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}Sx.prototype={o:Fu,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]:Fu[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 QE(t){return t}function uD(t,e){this.t="token",this.v=t,this.tk=e}uD.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=Fu.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),o={},c=t.get("className",n,e),f=t.get("target",n,e),d=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),f&&(o.target=f),d&&(o.rel=d),p&&Object.assign(o,p),{tagName:i,attributes:o,content:s,eventListeners:m}}};function cm(t,e){class n extends uD{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 eT=cm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),tT=cm("text"),KU=cm("nl"),Fd=cm("url",{isLink:!0,toHref(t=Fu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Pu&&t[1].t===qs}}),Ir=t=>new nr(t);function GU({groups:t}){const e=t.domain.concat([ap,up,Vs,fp,dp,hp,pp,mp,Br,px,au,gp,yp,bp,pi,Sp,uu,xp]),n=[cp,qs,gx,hi,yx,au,cu,bx,xx,Xh,Qh,lu,ou,Zh,Gh,Wh,Jh,ep,tp,np,rp,ip,sp,lp,op],r=[ap,cp,up,fp,dp,hp,pp,mp,Br,lu,ou,au,gp,yp,bp,cu,pi,Sp,uu,xp],i=Ir(),s=oe(i,uu);Fe(s,r,s),Fe(s,t.domain,s);const o=Ir(),c=Ir(),f=Ir();Fe(i,t.domain,o),Fe(i,t.scheme,c),Fe(i,t.slashscheme,f),Fe(o,r,s),Fe(o,t.domain,o);const d=oe(o,Vs);oe(s,Vs,d),oe(c,Vs,d),oe(f,Vs,d);const p=oe(s,hi);Fe(p,r,s),Fe(p,t.domain,s);const m=Ir();Fe(d,t.domain,m),Fe(m,t.domain,m);const y=oe(m,hi);Fe(y,t.domain,m);const b=Ir(eT);Fe(y,t.tld,b),Fe(y,t.utld,b),oe(d,Pu,b);const S=oe(m,Br);oe(S,Br,S),Fe(S,t.domain,m),Fe(b,t.domain,m),oe(b,hi,y),oe(b,Br,S);const v=oe(b,qs);Fe(v,t.numeric,eT);const k=oe(o,Br),C=oe(o,hi);oe(k,Br,k),Fe(k,t.domain,o),Fe(C,r,s),Fe(C,t.domain,o);const U=Ir(Fd);Fe(C,t.tld,U),Fe(C,t.utld,U),Fe(U,t.domain,o),Fe(U,r,s),oe(U,hi,C),oe(U,Br,k),oe(U,Vs,d);const z=oe(U,qs),re=Ir(Fd);Fe(z,t.numeric,re);const F=Ir(Fd),O=Ir();Fe(F,e,F),Fe(F,n,O),Fe(O,e,F),Fe(O,n,O),oe(U,pi,F),oe(re,pi,F);const L=oe(c,qs),J=oe(f,qs),ce=oe(J,pi),ie=oe(ce,pi);Fe(c,t.domain,o),oe(c,hi,C),oe(c,Br,k),Fe(f,t.domain,o),oe(f,hi,C),oe(f,Br,k),Fe(L,t.domain,F),oe(L,pi,F),oe(L,cu,F),Fe(ie,t.domain,F),Fe(ie,e,F),oe(ie,pi,F);const ue=[[lu,ou],[Gh,Zh],[Wh,Jh],[Xh,Qh],[ep,tp],[np,rp],[ip,sp],[lp,op]];for(let G=0;G<ue.length;G++){const[ee,ne]=ue[G],Z=oe(F,ee);oe(O,ee,Z),oe(Z,ne,F);const I=Ir(Fd);Fe(Z,e,I);const Y=Ir();Fe(Z,n),Fe(I,e,I),Fe(I,n,Y),Fe(Y,e,I),Fe(Y,n,Y),oe(I,ne,F),oe(Y,ne,F)}return oe(i,Pu,U),oe(i,mx,KU),{start:i,tokens:aD}}function ZU(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let c=t,f=null,d=null,p=0,m=null,y=-1;for(;i<r&&!(f=c.go(n[i].t));)o.push(n[i++]);for(;i<r&&(d=f||c.go(n[i].t));)f=null,c=d,c.accepts()?(y=0,m=c):y>=0&&y++,i++,p++;if(y<0)i-=p,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(x0(tT,e,o)),o=[]),i-=y,p-=y;const b=m.t,S=n.slice(i-p,i);s.push(x0(b,e,S))}}return o.length>0&&s.push(x0(tT,e,o)),s}function x0(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 WU=typeof console<"u"&&console&&console.warn||(()=>{}),JU="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Dt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function XU(){return nr.groups={},Dt.scanner=null,Dt.parser=null,Dt.tokenQueue=[],Dt.pluginQueue=[],Dt.customSchemes=[],Dt.initialized=!1,Dt}function nT(t,e=!1){if(Dt.initialized&&WU(`linkifyjs: already initialized - will not register custom scheme "${t}" ${JU}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
163
- 1. Must only contain digits, lowercase ASCII letters or "-"
164
- 2. Cannot start or end with "-"
165
- 3. "-" cannot repeat`);Dt.customSchemes.push([t,e])}function QU(){Dt.scanner=qU(Dt.customSchemes);for(let t=0;t<Dt.tokenQueue.length;t++)Dt.tokenQueue[t][1]({scanner:Dt.scanner});Dt.parser=GU(Dt.scanner.tokens);for(let t=0;t<Dt.pluginQueue.length;t++)Dt.pluginQueue[t][1]({scanner:Dt.scanner,parser:Dt.parser});return Dt.initialized=!0,Dt}function wx(t){return Dt.initialized||QU(),ZU(Dt.parser.start,t,cD(Dt.scanner.start,t))}wx.scan=cD;function fD(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 Sx(n),i=wx(t),s=[];for(let o=0;o<i.length;o++){const c=i[o];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}const vx="[\0-   ᠎ -\u2029  ]",eH=new RegExp(vx),tH=new RegExp(`${vx}$`),nH=new RegExp(vx,"g");function rH(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function iH(t){return new Ct({key:new Nt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,c=p6(n.doc,[...e]);if(w6(c).forEach(({newRange:d})=>{const p=g6(r.doc,d,b=>b.isTextblock);let m,y;if(p.length>1)m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(d.from,d.to," "," ");if(!tH.test(b))return;m=p[0],y=r.doc.textBetween(m.pos,d.to,void 0," ")}if(m&&y){const b=y.split(eH).filter(Boolean);if(b.length<=0)return!1;const S=b[b.length-1],v=m.pos+y.lastIndexOf(S);if(!S)return!1;const k=wx(S).map(C=>C.toObject(t.defaultProtocol));if(!rH(k))return!1;k.filter(C=>C.isLink).map(C=>({...C,from:v+C.start+1,to:v+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{I1(C.from,C.to,r.doc).some(U=>U.mark.type===t.type)||o.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!o.steps.length)return o}})}function sH(t){return new Ct({key:new Nt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const c=[];for(;o.nodeName!=="DIV";)c.push(o),o=o.parentNode;if(!c.find(y=>y.nodeName==="A"))return!1;const f=CO(e.state,t.type.name),d=r.target,p=(i=d==null?void 0:d.href)!==null&&i!==void 0?i:f.href,m=(s=d==null?void 0:d.target)!==null&&s!==void 0?s:f.target;return d&&p?(window.open(p,m),!0):!1}}})}function lH(t){return new Ct({key:new Nt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const f=fD(c,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!f?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function Dl(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(nH,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const oH=Ci.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"){nT(t);return}nT(t.scheme,t.optionalSlashes)})},onDestroy(){XU()},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)=>!!Dl(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=>!!Dl(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=>!!Dl(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Pt(this.options.HTMLAttributes,t),0]:["a",Pt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Dl(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=>!!Dl(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[rl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=fD(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Dl(o,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(iH({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Dl(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(sH({type:this.type})),this.options.linkOnPaste&&t.push(lH({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),aH=Qt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ct({key:new Nt("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((o,c)=>{const f=r>=c&&r<=c+o.nodeSize,d=!o.isLeaf&&Zp(o);if((f||!this.options.showOnlyCurrent)&&d){const p=[this.options.emptyNodeClass];s&&p.push(this.options.emptyEditorClass);const m=Xt.node(c,c+o.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:c,hasAnchor:f}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),xt.create(t,i)}}})]}});let Lb,Ib;if(typeof WeakMap<"u"){let t=new WeakMap;Lb=e=>t.get(e),Ib=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Lb=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Ib=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Vt=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,o=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;o<this.height&&this.map[e+this.width*c]==n;c++)o++;return{left:r,top:i,right:s,bottom:o}}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:o}=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:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:c,top:f,bottom:d}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,f),right:Math.max(r,c),bottom:Math.max(s,d)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const c=(t+1)*this.width;for(;o<c&&this.map[o]<i;)o++;return o==c?s-1:this.map[o]}i=s}}static get(t){return Lb(t)||Ib(t,cH(t))}};function cH(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=uH(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let d=0,p=e*n;d<p;d++)r[d]=0;for(let d=0,p=0;d<n;d++){const m=t.child(d);p++;for(let S=0;;S++){for(;i<r.length&&r[i]!=0;)i++;if(S==m.childCount)break;const v=m.child(S),{colspan:k,rowspan:C,colwidth:U}=v.attrs;for(let z=0;z<C;z++){if(z+d>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:p,n:C-z});break}const re=i+z*e;for(let F=0;F<k;F++){r[re+F]==0?r[re+F]=p:(s||(s=[])).push({type:"collision",row:d,pos:p,n:k-F});const O=U&&U[F];if(O){const L=(re+F)%e*2,J=o[L];J==null||J!=O&&o[L+1]==1?(o[L]=O,o[L+1]=1):J==O&&o[L+1]++}}}i+=k,p+=v.nodeSize}const y=(d+1)*e;let b=0;for(;i<y;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:d,n:b}),p++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Vt(e,n,r,s);let f=!1;for(let d=0;!f&&d<o.length;d+=2)o[d]!=null&&o[d+1]<n&&(f=!0);return f&&fH(c,o,t),c}function uH(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 o=0;o<r;o++){const c=t.child(o);for(let f=0;f<c.childCount;f++){const d=c.child(f);o+d.attrs.rowspan>r&&(s+=d.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const c=i.child(o);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function fH(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 o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let c=null;const f=o.attrs;for(let d=0;d<f.colspan;d++){const p=e[(i+d)%t.width*2];p!=null&&(!f.colwidth||f.colwidth[d]!=p)&&((c||(c=dH(f)))[d]=p)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function dH(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function In(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Ys=new Nt("selectingCells");function ro(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 hH(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 li(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 um(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=ro(e.$head)||pH(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function pH(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 Bb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function mH(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function kx(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function dD(t,e,n){const r=t.node(-1),i=Vt.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function io(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 hD(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 gH(t,e,n){const r=In(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var At=class es extends De{constructor(e,n=e){const r=e.node(-1),i=Vt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),f=i.cellsInRect(o).filter(p=>p!=n.pos-s);f.unshift(n.pos-s);const d=f.map(p=>{const m=r.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const y=s+p+1;return new yM(c.resolve(y),c.resolve(y+m.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Bb(r)&&Bb(i)&&kx(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?es.rowSelection(r,i):s&&this.isColSelection()?es.colSelection(r,i):new es(r,i)}return Te.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Vt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let f=i.top;f<i.bottom;f++){const d=[];for(let p=f*n.width+i.left,m=i.left;m<i.right;m++,p++){const y=n.map[p];if(s[y])continue;s[y]=!0;const b=n.findCell(y);let S=e.nodeAt(y);if(!S)throw new RangeError(`No cell with offset ${y} found`);const v=i.left-b.left,k=b.right-i.right;if(v>0||k>0){let C=S.attrs;if(v>0&&(C=io(C,0,v)),k>0&&(C=io(C,C.colspan-k,k)),b.left<i.left){if(S=S.type.createAndFill(C),!S)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else S=S.type.create(C,S.content)}if(b.top<i.top||b.bottom>i.bottom){const C={...S.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?S=S.type.createAndFill(C):S=S.type.create(C,S.content)}d.push(S)}o.push(e.child(f).copy(Q.from(d)))}const c=this.isColSelection()&&this.isRowSelection()?e:o;return new he(Q.from(c),1,1)}replace(e,n=he.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:c,$to:f}=i[o],d=e.mapping.slice(r);e.replace(d.map(c.pos),d.map(f.pos),o?he.empty:n)}const s=De.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new he(Q.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Vt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}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=Vt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),c=i.findCell(n.pos-s),f=e.node(0);return o.top<=c.top?(o.top>0&&(e=f.resolve(s+i.map[o.left])),c.bottom<i.height&&(n=f.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=f.resolve(s+i.map[c.left])),o.bottom<i.height&&(e=f.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new es(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Vt.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 o=i+this.$anchorCell.nodeAfter.attrs.colspan,c=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof es&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Vt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),c=i.findCell(n.pos-s),f=e.node(0);return o.left<=c.left?(o.left>0&&(e=f.resolve(s+i.map[o.top*i.width])),c.right<i.width&&(n=f.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=f.resolve(s+i.map[c.top*i.width])),o.right<i.width&&(e=f.resolve(s+i.map[i.width*(o.top+1)-1]))),new es(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new es(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new es(e.resolve(n),e.resolve(r))}getBookmark(){return new yH(this.$anchorCell.pos,this.$headCell.pos)}};At.prototype.visible=!1;De.jsonID("cell",At);var yH=class pD{constructor(e,n){this.anchor=e,this.head=n}map(e){return new pD(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&&kx(n,r)?new At(n,r):De.near(r,1)}};function bH(t){if(!(t.selection instanceof At))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Xt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),xt.create(t.doc,e)}function xH({$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 SH({$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 wH(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof Ce&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=At.create(i,r.from);else if(o=="row"){const c=i.resolve(r.from+1);s=At.rowSelection(c,c)}else if(!n){const c=Vt.get(r.node),f=r.from+1,d=f+c.map[c.width*c.height-1];s=At.create(i,f+1,d)}}else r instanceof Te&&xH(r)?s=Te.create(i,r.from):r instanceof Te&&SH(r)&&(s=Te.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const vH=new Nt("fix-tables");function mD(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,c=0;o<s;o++){const f=e.child(o);for(let d=c,p=Math.min(i,o+3);d<p;d++)if(t.child(d)==f){c=d+1,n+=f.nodeSize;continue e}r(f,n),c<i&&t.child(c).sameMarkup(f)?mD(t.child(c),f,n+1,r):f.nodesBetween(0,f.content.size,r,n+1),n+=f.nodeSize}}function gD(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=kH(t,i,s,n))};return e?e.doc!=t.doc&&mD(e.doc,t.doc,0,r):t.doc.descendants(r),n}function kH(t,e,n,r){const i=Vt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let f=0;f<i.height;f++)s.push(0);for(let f=0;f<i.problems.length;f++){const d=i.problems[f];if(d.type=="collision"){const p=e.nodeAt(d.pos);if(!p)continue;const m=p.attrs;for(let y=0;y<m.rowspan;y++)s[d.row+y]+=d.n;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,io(m,m.colspan-d.n,d.n))}else if(d.type=="missing")s[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const p=e.nodeAt(d.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const p=e.nodeAt(d.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...p.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const p=r.mapping.map(n);r.delete(p,p+e.nodeSize)}}let o,c;for(let f=0;f<s.length;f++)s[f]&&(o==null&&(o=f),c=f);for(let f=0,d=n+1;f<i.height;f++){const p=e.child(f),m=d+p.nodeSize,y=s[f];if(y>0){let b="cell";p.firstChild&&(b=p.firstChild.type.spec.tableRole);const S=[];for(let k=0;k<y;k++){const C=In(t.schema)[b].createAndFill();C&&S.push(C)}const v=(f==0||o==f-1)&&c==f?d+1:m-1;r.insert(r.mapping.map(v),S)}d=m}return r.setMeta(vH,{fixTables:!0})}function Oi(t){const e=t.selection,n=um(t),r=n.node(-1),i=n.start(-1),s=Vt.get(r);return{...e instanceof At?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function yD(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;gH(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const c=o*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const f=e.map[c],d=r.nodeAt(f);t.setNodeMarkup(t.mapping.map(n+f),null,hD(d.attrs,i-e.colCount(f))),o+=d.attrs.rowspan-1}else{const f=s==null?In(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,d=e.positionAt(o,i,r);t.insert(t.mapping.map(n+d),f.createAndFill())}}return t}function CH(t,e){if(!li(t))return!1;if(e){const n=Oi(t);e(yD(t.tr,n,n.left))}return!0}function EH(t,e){if(!li(t))return!1;if(e){const n=Oi(t);e(yD(t.tr,n,n.right))}return!0}function TH(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const c=o*e.width+i,f=e.map[c],d=n.nodeAt(f),p=d.attrs;if(i>0&&e.map[c-1]==f||i<e.width-1&&e.map[c+1]==f)t.setNodeMarkup(t.mapping.slice(s).map(r+f),null,io(p,i-e.colCount(f)));else{const m=t.mapping.slice(s).map(r+f);t.delete(m,m+d.nodeSize)}o+=p.rowspan}}function AH(t,e){if(!li(t))return!1;if(e){const n=Oi(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;TH(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=Vt.get(s)}e(r)}return!0}function MH(t,e,n){var r;const i=In(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function bD(t,{map:e,tableStart:n,table:r},i){let s=n;for(let d=0;d<i;d++)s+=r.child(d).nodeSize;const o=[];let c=i>0?-1:0;MH(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let d=0,p=e.width*i;d<e.width;d++,p++)if(i>0&&i<e.height&&e.map[p]==e.map[p-e.width]){const m=e.map[p],y=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...y,rowspan:y.rowspan+1}),d+=y.colspan-1}else{var f;const m=c==null?In(r.type.schema).cell:(f=r.nodeAt(e.map[p+c*e.width]))===null||f===void 0?void 0:f.type,y=m==null?void 0:m.createAndFill();y&&o.push(y)}return t.insert(s,In(r.type.schema).row.create(null,o)),t}function OH(t,e){if(!li(t))return!1;if(e){const n=Oi(t);e(bD(t.tr,n,n.top))}return!0}function _H(t,e){if(!li(t))return!1;if(e){const n=Oi(t);e(bD(t.tr,n,n.bottom))}return!0}function DH(t,{map:e,table:n,tableStart:r},i){let s=0;for(let d=0;d<i;d++)s+=n.child(d).nodeSize;const o=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,o+r);const f=new Set;for(let d=0,p=i*e.width;d<e.width;d++,p++){const m=e.map[p];if(!f.has(m)){if(f.add(m),i>0&&m==e.map[p-e.width]){const y=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...y,rowspan:y.rowspan-1}),d+=y.colspan-1}else if(i<e.height&&m==e.map[p+e.width]){const y=n.nodeAt(m),b=y.attrs,S=y.type.create({...b,rowspan:y.attrs.rowspan-1},y.content),v=e.positionAt(i+1,d,n);t.insert(t.mapping.slice(c).map(r+v),S),d+=b.colspan-1}}}}function RH(t,e){if(!li(t))return!1;if(e){const n=Oi(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;DH(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=Vt.get(n.table)}e(r)}return!0}function rT(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function NH({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let f=r.top;f<r.bottom;f++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[c]==n[c+1])return!0;s+=t,c+=t}for(let f=r.left;f<r.right;f++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function iT(t,e){const n=t.selection;if(!(n instanceof At)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Oi(t),{map:i}=r;if(NH(i,r))return!1;if(e){const s=t.tr,o={};let c=Q.empty,f,d;for(let p=r.top;p<r.bottom;p++)for(let m=r.left;m<r.right;m++){const y=i.map[p*i.width+m],b=r.table.nodeAt(y);if(!(o[y]||!b))if(o[y]=!0,f==null)f=y,d=b;else{rT(b)||(c=c.append(b.content));const S=s.mapping.map(y+r.tableStart);s.delete(S,S+b.nodeSize)}}if(f==null||d==null)return!0;if(s.setNodeMarkup(f+r.tableStart,null,{...hD(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const p=f+1+d.content.size,m=rT(d)?f+1:p;s.replaceWith(m+r.tableStart,p+r.tableStart,c)}s.setSelection(new At(s.doc.resolve(f+r.tableStart))),e(s)}return!0}function sT(t,e){const n=In(t.schema);return zH(({node:r})=>n[r.type.spec.tableRole])(t,e)}function zH(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof At){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=hH(r.$from),!i)return!1;s=(o=ro(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const f=[],d=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const p=Oi(e),m=e.tr;for(let b=0;b<p.right-p.left;b++)f.push(d?{...c,colwidth:d&&d[b]?[d[b]]:null}:c);let y;for(let b=p.top;b<p.bottom;b++){let S=p.map.positionAt(b,p.left,p.table);b==p.top&&(S+=i.nodeSize);for(let v=p.left,k=0;v<p.right;v++,k++)v==p.left&&b==p.top||m.insert(y=m.mapping.map(S+p.tableStart,1),t({node:i,row:b,col:v}).createAndFill(f[k]))}m.setNodeMarkup(s,t({node:i,row:p.top,col:p.left}),f[0]),r instanceof At&&m.setSelection(new At(m.doc.resolve(r.$anchorCell.pos),y?m.doc.resolve(y):void 0)),n(m)}return!0}}function LH(t,e){return function(n,r){if(!li(n))return!1;const i=um(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof At?n.selection.forEachCell((o,c)=>{o.attrs[t]!==e&&s.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function IH(t){return function(e,n){if(!li(e))return!1;if(n){const r=In(e.schema),i=Oi(e),s=e.tr,o=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=o.map(f=>i.table.nodeAt(f));for(let f=0;f<o.length;f++)c[f].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[f],r.cell,c[f].attrs);if(s.steps.length===0)for(let f=0;f<o.length;f++)s.setNodeMarkup(i.tableStart+o[f],r.header_cell,c[f].attrs);n(s)}return!0}}function lT(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 $u(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?IH(t):function(n,r){if(!li(n))return!1;if(r){const i=In(n.schema),s=Oi(n),o=n.tr,c=lT("row",s,i),f=lT("column",s,i),d=(t==="column"?c:t==="row"&&f)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:s.map.height}:t=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?f?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(y=>{const b=y+s.tableStart,S=o.doc.nodeAt(b);S&&o.setNodeMarkup(b,m,S.attrs)}),r(o)}return!0}}$u("row",{useDeprecatedLogic:!0});$u("column",{useDeprecatedLogic:!0});const BH=$u("cell",{useDeprecatedLogic:!0});function jH(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),o=s.lastChild;if(o)return i-1-o.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 oT(t){return function(e,n){if(!li(e))return!1;const r=jH(um(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Te.between(i,mH(i))).scrollIntoView())}return!0}}function UH(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 $d(t,e){const n=t.selection;if(!(n instanceof At))return!1;if(e){const r=t.tr,i=In(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new he(i,0,0))}),r.docChanged&&e(r)}return!0}function HH(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,o=i.type.schema,c=[];if(s=="row")for(let f=0;f<e.childCount;f++){let d=e.child(f).content;const p=f?0:Math.max(0,n-1),m=f<e.childCount-1?0:Math.max(0,r-1);(p||m)&&(d=jb(In(o).row,new he(d,p,m)).content),c.push(d)}else if(s=="cell"||s=="header_cell")c.push(n||r?jb(In(o).row,new he(e,n,r)).content:e);else return null;return VH(o,c)}function VH(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:c,colspan:f}=s.child(o).attrs;for(let d=i;d<i+c;d++)n[d]=(n[d]||0)+f}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(Q.empty),n[i]<r){const s=In(t).cell.createAndFill(),o=[];for(let c=n[i];c<r;c++)o.push(s);e[i]=e[i].append(Q.from(o))}return{height:e.length,width:r,rows:e}}function jb(t,e){const n=t.createAndFill();return new m1(n).replace(0,n.content.size,e).doc}function PH({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let c=0;c<n.length;c++){const f=n[c],d=[];for(let p=s[c]||0,m=0;p<r;m++){let y=f.child(m%f.childCount);p+y.attrs.colspan>r&&(y=y.type.createChecked(io(y.attrs,y.attrs.colspan,p+y.attrs.colspan-r),y.content)),d.push(y),p+=y.attrs.colspan;for(let b=1;b<y.attrs.rowspan;b++)s[c+b]=(s[c+b]||0)+y.attrs.colspan}o.push(Q.from(d))}n=o,t=r}if(e!=i){const s=[];for(let o=0,c=0;o<i;o++,c++){const f=[],d=n[c%e];for(let p=0;p<d.childCount;p++){let m=d.child(p);o+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),f.push(m)}s.push(Q.from(f))}n=s,e=i}return{width:t,height:e,rows:n}}function FH(t,e,n,r,i,s,o){const c=t.doc.type.schema,f=In(c);let d,p;if(i>e.width)for(let m=0,y=0;m<e.height;m++){const b=n.child(m);y+=b.nodeSize;const S=[];let v;b.lastChild==null||b.lastChild.type==f.cell?v=d||(d=f.cell.createAndFill()):v=p||(p=f.header_cell.createAndFill());for(let k=e.width;k<i;k++)S.push(v);t.insert(t.mapping.slice(o).map(y-1+r),S)}if(s>e.height){const m=[];for(let S=0,v=(e.height-1)*e.width;S<Math.max(e.width,i);S++){const k=S>=e.width?!1:n.nodeAt(e.map[v+S]).type==f.header_cell;m.push(k?p||(p=f.header_cell.createAndFill()):d||(d=f.cell.createAndFill()))}const y=f.row.create(null,Q.from(m)),b=[];for(let S=e.height;S<s;S++)b.push(y);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),b)}return!!(d||p)}function aT(t,e,n,r,i,s,o,c){if(o==0||o==e.height)return!1;let f=!1;for(let d=i;d<s;d++){const p=o*e.width+d,m=e.map[p];if(e.map[p-e.width]==m){f=!0;const y=n.nodeAt(m),{top:b,left:S}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...y.attrs,rowspan:o-b}),t.insert(t.mapping.slice(c).map(e.positionAt(o,S,n)),y.type.createAndFill({...y.attrs,rowspan:b+y.attrs.rowspan-o})),d+=y.attrs.colspan-1}}return f}function cT(t,e,n,r,i,s,o,c){if(o==0||o==e.width)return!1;let f=!1;for(let d=i;d<s;d++){const p=d*e.width+o,m=e.map[p];if(e.map[p-1]==m){f=!0;const y=n.nodeAt(m),b=e.colCount(m),S=t.mapping.slice(c).map(m+r);t.setNodeMarkup(S,null,io(y.attrs,o-b,y.attrs.colspan-(o-b))),t.insert(S+y.nodeSize,y.type.createAndFill(io(y.attrs,0,o-b))),d+=y.attrs.rowspan-1}}return f}function uT(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Vt.get(s);const{top:c,left:f}=r,d=f+i.width,p=c+i.height,m=t.tr;let y=0;function b(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");o=Vt.get(s),y=m.mapping.maps.length}FH(m,o,s,n,d,p,y)&&b(),aT(m,o,s,n,f,d,c,y)&&b(),aT(m,o,s,n,f,d,p,y)&&b(),cT(m,o,s,n,c,p,f,y)&&b(),cT(m,o,s,n,c,p,d,y)&&b();for(let S=c;S<p;S++){const v=o.positionAt(S,f,s),k=o.positionAt(S,d,s);m.replace(m.mapping.slice(y).map(v+n),m.mapping.slice(y).map(k+n),new he(i.rows[S-c],0,0))}b(),m.setSelection(new At(m.doc.resolve(n+o.positionAt(c,f,s)),m.doc.resolve(n+o.positionAt(p-1,d-1,s)))),e(m)}const $H=T1({ArrowLeft:qd("horiz",-1),ArrowRight:qd("horiz",1),ArrowUp:qd("vert",-1),ArrowDown:qd("vert",1),"Shift-ArrowLeft":Yd("horiz",-1),"Shift-ArrowRight":Yd("horiz",1),"Shift-ArrowUp":Yd("vert",-1),"Shift-ArrowDown":Yd("vert",1),Backspace:$d,"Mod-Backspace":$d,Delete:$d,"Mod-Delete":$d});function hh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function qd(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof At)return hh(n,r,De.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=xD(i,t,e);if(o==null)return!1;if(t=="horiz")return hh(n,r,De.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(o),f=dD(c,t,e);let d;return f?d=De.near(f,1):e<0?d=De.near(n.doc.resolve(c.before(-1)),-1):d=De.near(n.doc.resolve(c.after(-1)),1),hh(n,r,d)}}}function Yd(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof At)o=s;else{const f=xD(i,t,e);if(f==null)return!1;o=new At(n.doc.resolve(f))}const c=dD(o.$headCell,t,e);return c?hh(n,r,new At(o.$anchorCell,c)):!1}}function qH(t,e){const n=t.state.doc,r=ro(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new At(r))),!0):!1}function YH(t,e,n){if(!li(t.state))return!1;let r=HH(n);const i=t.state.selection;if(i instanceof At){r||(r={width:1,height:1,rows:[Q.from(jb(In(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),c=Vt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=PH(r,c.right-c.left,c.bottom-c.top),uT(t.state,t.dispatch,o,c,r),!0}else if(r){const s=um(t.state),o=s.start(-1);return uT(t.state,t.dispatch,o,Vt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function KH(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=fT(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof At)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=ro(t.state.selection.$anchor))!=null&&((n=S0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(f,d){let p=S0(t,d);const m=Ys.getState(t.state)==null;if(!p||!kx(f,p))if(m)p=f;else return;const y=new At(f,p);if(m||!t.state.selection.eq(y)){const b=t.state.tr.setSelection(y);m&&b.setMeta(Ys,f.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),Ys.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ys,-1))}function c(f){const d=f,p=Ys.getState(t.state);let m;if(p!=null)m=t.state.doc.resolve(p);else if(fT(t,d.target)!=r&&(m=S0(t,e),!m))return o();m&&s(m,d)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function xD(t,e,n){if(!(t.state.selection instanceof Te))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 o=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function fT(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function S0(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&&ro(t.state.doc.resolve(r))||ro(t.state.doc.resolve(i))}var GH=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")),Ub(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,Ub(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Ub(t,e,n,r,i,s){let o=0,c=!0,f=e.firstChild;const d=t.firstChild;if(d){for(let m=0,y=0;m<d.childCount;m++){const{colspan:b,colwidth:S}=d.child(m).attrs;for(let v=0;v<b;v++,y++){const k=i==y?s:S&&S[v],C=k?k+"px":"";if(o+=k||r,k||(c=!1),f)f.style.width!=C&&(f.style.width=C),f=f.nextSibling;else{const U=document.createElement("col");U.style.width=C,e.appendChild(U)}}}for(;f;){var p;const m=f.nextSibling;(p=f.parentNode)===null||p===void 0||p.removeChild(f),f=m}c?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const wr=new Nt("tableColumnResizing");function ZH({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=GH,lastColumnResizable:i=!0}={}){const s=new Ct({key:wr,state:{init(o,c){var f;const d=(f=s.spec)===null||f===void 0||(f=f.props)===null||f===void 0?void 0:f.nodeViews,p=In(c.schema).table.name;return r&&d&&(d[p]=(m,y)=>new r(m,n,y)),new WH(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=wr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{JH(o,c,t,i)},mouseleave:o=>{XH(o)},mousedown:(o,c)=>{QH(o,c,e,n)}},decorations:o=>{const c=wr.getState(o);if(c&&c.activeHandle>-1)return i9(o,c.activeHandle)},nodeViews:{}}});return s}var WH=class ph{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(wr);if(r&&r.setHandle!=null)return new ph(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ph(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Bb(e.doc.resolve(i))||(i=-1),new ph(i,n.dragging)}return n}};function JH(t,e,n,r){if(!t.editable)return;const i=wr.getState(t.state);if(i&&!i.dragging){const s=t9(e.target);let o=-1;if(s){const{left:c,right:f}=s.getBoundingClientRect();e.clientX-c<=n?o=dT(t,e,"left",n):f-e.clientX<=n&&(o=dT(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),f=c.node(-1),d=Vt.get(f),p=c.start(-1);if(d.colCount(c.pos-p)+c.nodeAfter.attrs.colspan-1==d.width-1)return}SD(t,o)}}}function XH(t){if(!t.editable)return;const e=wr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&SD(t,-1)}function QH(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=wr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),f=e9(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(wr,{setDragging:{startX:e.clientX,startWidth:f}}));function d(m){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",p);const y=wr.getState(t.state);y!=null&&y.dragging&&(n9(t,y.activeHandle,hT(y.dragging,m,n)),t.dispatch(t.state.tr.setMeta(wr,{setDragging:null})))}function p(m){if(!m.which)return d(m);const y=wr.getState(t.state);if(y&&y.dragging){const b=hT(y.dragging,m,n);pT(t,y.activeHandle,b,r)}}return pT(t,o.activeHandle,f,r),s.addEventListener("mouseup",d),s.addEventListener("mousemove",p),e.preventDefault(),!0}function e9(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let f=0;f<n;f++)r[f]&&(o-=r[f],c--);return o/c}function t9(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function dT(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:o}=s,c=ro(t.state.doc.resolve(o));if(!c)return-1;if(n=="right")return c.pos;const f=Vt.get(c.node(-1)),d=c.start(-1),p=f.map.indexOf(c.pos-d);return p%f.width==0?-1:d+f.map[p-1]}function hT(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function SD(t,e){t.dispatch(t.state.tr.setMeta(wr,{setHandle:e}))}function n9(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Vt.get(i),o=r.start(-1),c=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,f=t.state.tr;for(let d=0;d<s.height;d++){const p=d*s.width+c;if(d&&s.map[p]==s.map[p-s.width])continue;const m=s.map[p],y=i.nodeAt(m).attrs,b=y.colspan==1?0:c-s.colCount(m);if(y.colwidth&&y.colwidth[b]==n)continue;const S=y.colwidth?y.colwidth.slice():r9(y.colspan);S[b]=n,f.setNodeMarkup(o+m,null,{...y,colwidth:S})}f.docChanged&&t.dispatch(f)}function pT(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),c=Vt.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let f=t.domAtPos(i.start(-1)).node;for(;f&&f.nodeName!="TABLE";)f=f.parentNode;f&&Ub(s,f.firstChild,f,r,c,n)}function r9(t){return Array(t).fill(0)}function i9(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return xt.empty;const s=Vt.get(i),o=r.start(-1),c=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let d=0;d<s.height;d++){const p=c+d*s.width;if((c==s.width-1||s.map[p]!=s.map[p+1])&&(d==0||s.map[p]!=s.map[p-s.width])){var f;const m=s.map[p],y=o+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((f=wr.getState(t))===null||f===void 0)&&f.dragging&&n.push(Xt.node(o+m,o+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(Xt.widget(y,b))}}return xt.create(t.doc,n)}function s9({allowTableNodeSelection:t=!1}={}){return new Ct({key:Ys,state:{init(){return null},apply(e,n){const r=e.getMeta(Ys);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:bH,handleDOMEvents:{mousedown:KH},createSelectionBetween(e){return Ys.getState(e.state)!=null?e.state.selection:null},handleTripleClick:qH,handleKeyDown:$H,handlePaste:YH},appendTransaction(e,n,r){return wH(r,gD(r,n),t)}})}function Hb(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function mT(t,e,n,r,i,s){var o;let c=0,f=!0,d=e.firstChild;const p=t.firstChild;if(p!==null)for(let m=0,y=0;m<p.childCount;m+=1){const{colspan:b,colwidth:S}=p.child(m).attrs;for(let v=0;v<b;v+=1,y+=1){const k=i===y?s:S&&S[v],C=k?`${k}px`:"";if(c+=k||r,k||(f=!1),d){if(d.style.width!==C){const[U,z]=Hb(r,k);d.style.setProperty(U,z)}d=d.nextSibling}else{const U=document.createElement("col"),[z,re]=Hb(r,k);U.style.setProperty(z,re),e.appendChild(U)}}}for(;d;){const m=d.nextSibling;(o=d.parentNode)===null||o===void 0||o.removeChild(d),d=m}f?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class l9{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")),mT(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,mT(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function o9(t,e,n,r){let i=0,s=!0;const o=[],c=t.firstChild;if(!c)return{};for(let m=0,y=0;m<c.childCount;m+=1){const{colspan:b,colwidth:S}=c.child(m).attrs;for(let v=0;v<b;v+=1,y+=1){const k=n===y?r:S&&S[v];i+=k||e,k||(s=!1);const[C,U]=Hb(e,k);o.push(["col",{style:`${C}: ${U}`}])}}const f=s?`${i}px`:"",d=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:f,tableMinWidth:d}}function gT(t,e){return t.createAndFill()}function a9(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 c9(t,e,n,r,i){const s=a9(t),o=[],c=[];for(let d=0;d<n;d+=1){const p=gT(s.cell);if(p&&c.push(p),r){const m=gT(s.header_cell);m&&o.push(m)}}const f=[];for(let d=0;d<e;d+=1)f.push(s.row.createChecked(null,r&&d===0?o:c));return s.table.createChecked(null,f)}function u9(t){return t instanceof At}const Kd=({editor:t})=>{const{selection:e}=t.state;if(!u9(e))return!1;let n=0;const r=kO(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},f9=pn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:l9,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}=o9(t,this.options.cellMinWidth),s=["table",Pt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=c9(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Te.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>CH(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>EH(t,e),deleteColumn:()=>({state:t,dispatch:e})=>AH(t,e),addRowBefore:()=>({state:t,dispatch:e})=>OH(t,e),addRowAfter:()=>({state:t,dispatch:e})=>_H(t,e),deleteRow:()=>({state:t,dispatch:e})=>RH(t,e),deleteTable:()=>({state:t,dispatch:e})=>UH(t,e),mergeCells:()=>({state:t,dispatch:e})=>iT(t,e),splitCell:()=>({state:t,dispatch:e})=>sT(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>$u("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>$u("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>BH(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>iT(t,e)?!0:sT(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>LH(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>oT(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>oT(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&gD(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=At.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:Kd,"Mod-Backspace":Kd,Delete:Kd,"Mod-Delete":Kd}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[ZH({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],s9({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:$e(xe(t,"tableRole",e))}}}),d9=pn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Pt(this.options.HTMLAttributes,t),0]}}),h9=pn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Pt(this.options.HTMLAttributes,t),0]}}),p9=pn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Pt(this.options.HTMLAttributes,t),0]}}),w0=t=>t,Si=t=>t;function wD(t){return t?t+1:0}function wp(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const o=t.child(s),c=r+1,f=o.type.name==="heading"?wD(o.attrs.level||1):0,d=o.textContent.length,p=f+d;if(n+p>e){const m=e-n,y=Math.max(0,m-f);return Si(c+Math.min(y,d))}if(n+=p,r+=o.nodeSize,s<i-1&&(n+=1,n>e))return Si(c+d)}return Si(t.content.size)}function vp(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const o=t.child(s),c=r+1,f=o.type.name==="heading"?wD(o.attrs.level||1):0,d=o.textContent.length,p=c+d;if(e<=p){if(e<=c)return w0(n+f);const m=e-c;return w0(n+f+Math.min(m,d))}n+=f+d,r+=o.nodeSize,s<i-1&&(n+=1)}return w0(n)}function yT(t,e,n){let r=0;const i=Math.min(t.childCount,e.length);for(let s=0;s<i;s++){const o=e.get(s),c=t.child(s),f=r+1;if(o instanceof An){let d=0;for(let p=0;p<o.length;p++){const m=o.get(p);if(m instanceof Fn){if(m===n.type)return Si(f+Math.min(d+n.index,c.textContent.length));d+=m.length}}}r+=c.nodeSize}return null}function m9(t,e,n){let r,i;try{const f=Yl(n.fromRel),d=Yl(n.toRel);r=bb(f,t),i=bb(d,t)}catch(f){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",f),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),o=yT(e,s,r),c=yT(e,s,i);return o===null||c===null?null:{from:o,to:c}}function kp(t,e,n){if(t.relRange&&n){const r=m9(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:wp(e,t.range.from),to:wp(e,t.range.to),method:"flat"}:null}function vD(t,e){return{from:vp(t,e.from),to:vp(t,e.to)}}const Gd=new Nt("tandemAnnotations");function bT(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const o=s;if(o.status!=="pending"||!o.range&&!o.relRange)return;const c=kp(o,t,n);if(!c)return;o.relRange&&c.method==="flat"&&console.warn("[annotation] relRange-equipped annotation %s fell back to flat offsets",o.id);const{from:f,to:d}=c;if(f>=d||f<0||d>i)return;let p={};switch(o.type){case"highlight":{const m=o.color||"yellow",y=bu[m]||bu.yellow;p={class:`tandem-highlight tandem-highlight--${m}`,style:`background: ${y}; border-radius: 2px; padding: 1px 0;`,"data-annotation-id":o.id,"aria-label":`Highlight annotation (${m})`};break}case"comment":p={class:"tandem-comment",style:"border-bottom: 2px dashed #3b82f6; padding-bottom: 1px;","data-annotation-id":o.id,"aria-label":"Comment annotation"};break;case"suggestion":p={class:"tandem-suggestion",style:"background: rgba(139, 92, 246, 0.15); text-decoration: underline wavy #8b5cf6; text-underline-offset: 3px;","data-annotation-id":o.id,"aria-label":"Suggestion annotation"};break;case"question":p={class:"tandem-question",style:"background: rgba(99, 102, 241, 0.12); border-bottom: 2px solid #6366f1; padding-bottom: 1px;","data-annotation-id":o.id,"aria-label":"Question annotation"};break;case"flag":p={class:"tandem-flag",style:"background: rgba(239, 68, 68, 0.12); border-bottom: 2px solid #ef4444; padding-bottom: 1px;","data-annotation-id":o.id,"aria-label":"Flag annotation"};break;default:return}try{r.push(Xt.inline(f,d,p))}catch(m){if(!(m instanceof RangeError))throw m}}),xt.create(t,r)}const g9=Qt.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(oa);return[new Ct({key:Gd,state:{init(n,r){return bT(r.doc,e,t)},apply(n,r,i,s){return n.getMeta(Gd)?bT(s.doc,e,t):n.docChanged?r.map(n.mapping,n.doc):r}},props:{decorations(n){return Gd.getState(n)}},view(n){const r=()=>{const i=n.state.tr.setMeta(Gd,!0);n.dispatch(i)};return e.observe(r),{destroy(){e.unobserve(r)}}}})]}}),Zd=new Nt("tandemAwareness");function xT(t,e){if(e===null||e<0)return xt.empty;const n=[];let r=0;return t.forEach((i,s)=>{r===e&&n.push(Xt.node(s,s+i.nodeSize,{class:"tandem-claude-focus",style:"background: rgba(99, 102, 241, 0.1); border-left: 3px solid rgba(99, 102, 241, 0.4); padding-left: 8px; transition: background 0.3s ease, border-color 0.3s ease;"})),r++}),xt.create(t,n)}const y9=Qt.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(BA),n=t.getMap(jA);return[new Ct({key:Zd,state:{init(r,i){const s=e.get("claude");return xT(i.doc,(s==null?void 0:s.focusParagraph)??null)},apply(r,i,s,o){if(r.getMeta(Zd)){const c=e.get("claude");return xT(o.doc,(c==null?void 0:c.focusParagraph)??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return Zd.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(Zd,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new Ct({key:new Nt("tandemUserAwareness"),view(){let r=null,i=null,s=null,o=!1,c=-1;return{update(f,d){const{state:p}=f;if(!p.selection.eq(d.selection)){const m=vD(p.doc,{from:Si(p.selection.from),to:Si(p.selection.to)});if(p.selection.from===p.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const y=p.doc.textBetween(p.selection.from,p.selection.to,`
166
- `),b=y.length>200?y.slice(0,197)+"...":y;s&&clearTimeout(s),s=setTimeout(()=>{s=null,n.set("selection",{...m,selectedText:b,timestamp:Date.now()})},150)}}p.doc!==d.doc&&(c=p.selection.from,o=!0,i||(i=setTimeout(()=>{i=null,o&&n.set("activity",{isTyping:!0,cursor:c,lastEdit:Date.now()})},200)),r&&clearTimeout(r),r=setTimeout(()=>{o=!1,n.set("activity",{isTyping:!1,cursor:f.state.selection.from,lastEdit:Date.now()})},WN))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function b9({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s}){const o=vI({extensions:[EB.configure({history:!1}),IU.configure({multicolor:!0}),oH.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),aH.configure({placeholder:"Open a document with Claude to get started..."}),f9.configure({resizable:!0}),d9,h9,p9,RU.configure({document:t}),NU.configure({provider:e,user:{name:(()=>{var f;try{return((f=localStorage.getItem(P0))==null?void 0:f.trim())||Jc}catch{return Jc}})(),color:"#f59e0b"}}),g9.configure({ydoc:t}),y9.configure({ydoc:t})],editorProps:{attributes:{class:"tandem-editor",style:"outline: none; min-height: 500px; font-size: 16px; line-height: 1.6;"}}},[t,e]);R.useEffect(()=>{o&&o.setEditable(!n)},[o,n]),R.useEffect(()=>(s==null||s(o),()=>s==null?void 0:s(null)),[o,s]),R.useEffect(()=>{if(!o)return;const f=o.view.dom;f.querySelectorAll(".tandem-annotation-active").forEach(d=>{d.classList.remove("tandem-annotation-active")}),i&&r&&f.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(d=>{d.classList.add("tandem-annotation-active")})},[o,i,r]);const c=r?"tandem-review-dimmed":"";return T.jsxs("div",{className:c,children:[T.jsx(dI,{editor:o}),T.jsx("style",{children:`
167
- .tandem-editor h1 { font-size: 2em; font-weight: 700; margin: 0.67em 0; }
168
- .tandem-editor h2 { font-size: 1.5em; font-weight: 600; margin: 0.75em 0; }
169
- .tandem-editor h3 { font-size: 1.17em; font-weight: 600; margin: 0.83em 0; }
170
- .tandem-editor p { margin: 0.5em 0; }
171
- .tandem-editor ul, .tandem-editor ol { padding-left: 1.5em; }
172
- .tandem-editor table { border-collapse: collapse; width: 100%; margin: 1em 0; }
173
- .tandem-editor td, .tandem-editor th { border: 1px solid #ddd; padding: 8px; }
174
- .tandem-editor th { background: #f5f5f5; font-weight: 600; }
175
- .tandem-editor blockquote {
176
- border-left: 3px solid #e5e7eb;
177
- margin: 0.5em 0;
178
- padding-left: 1em;
179
- color: #6b7280;
180
- }
181
- .collaboration-cursor__caret {
182
- position: relative;
183
- border-left: 2px solid;
184
- border-right: none;
185
- margin-left: -1px;
186
- }
187
- .collaboration-cursor__label {
188
- position: absolute;
189
- top: -1.4em;
190
- left: -1px;
191
- font-size: 12px;
192
- white-space: nowrap;
193
- padding: 0 4px;
194
- border-radius: 3px 3px 3px 0;
195
- color: white;
196
- }
197
- .ProseMirror-focused { outline: none; }
198
- .ProseMirror p.is-empty::before {
199
- content: attr(data-placeholder);
200
- color: #adb5bd;
201
- pointer-events: none;
202
- float: left;
203
- height: 0;
204
- }
205
-
206
- /* Annotation decorations */
207
- .tandem-highlight { cursor: pointer; }
208
- .tandem-highlight:hover { filter: brightness(0.95); }
209
- .tandem-comment { cursor: pointer; }
210
- .tandem-comment:hover { border-bottom-style: solid; }
211
- .tandem-suggestion { cursor: pointer; }
212
-
213
- /* Review mode dimming — grays out text, keeps annotated spans readable */
214
- .tandem-review-dimmed .ProseMirror {
215
- color: #9ca3af;
216
- transition: color 0.2s;
217
- }
218
- .tandem-review-dimmed .tandem-highlight,
219
- .tandem-review-dimmed .tandem-comment,
220
- .tandem-review-dimmed .tandem-suggestion {
221
- color: #1f2937;
222
- }
223
- .tandem-review-dimmed .tandem-annotation-active {
224
- outline: 2px solid #6366f1;
225
- outline-offset: 1px;
226
- border-radius: 2px;
227
- }
228
-
229
- /* Claude focus paragraph */
230
- .tandem-claude-focus {
231
- position: relative;
232
- }
233
- .tandem-claude-focus::before {
234
- content: '';
235
- position: absolute;
236
- left: -24px;
237
- top: 0;
238
- bottom: 0;
239
- width: 3px;
240
- background: rgba(99, 102, 241, 0.6);
241
- border-radius: 2px;
242
- animation: tandem-gutter-pulse 2s ease-in-out infinite;
243
- }
244
- @keyframes tandem-gutter-pulse {
245
- 0%, 100% { opacity: 0.4; }
246
- 50% { opacity: 1; }
247
- }
248
- `})]})}const x9={comment:"#3b82f6",suggestion:"#8b5cf6",question:"#6366f1",flag:"#ef4444"};function S9(t){return t.color?bu[t.color]||"#e5e7eb":x9[t.type]||"#e5e7eb"}function ST(t){try{const e=JSON.parse(t);if(typeof e.newText=="string")return{newText:e.newText,reason:e.reason||""}}catch{}return null}const wT=an.memo(function({annotation:e,isReviewTarget:n,onAccept:r,onDismiss:i,onUndo:s,onEdit:o,undoable:c,onClick:f}){const d=S9(e),p=e.status==="pending",[m,y]=R.useState(!1),[b,S]=R.useState(""),[v,k]=R.useState(""),[C,U]=R.useState(""),z=e.type==="suggestion";function re(){if(z){const G=ST(e.content);G?(k(G.newText),U(G.reason)):(k(e.content),U(""))}else S(e.content);y(!0)}function F(){const G=z?JSON.stringify({newText:v,reason:C}):b;o==null||o(e.id,G),y(!1)}function O(){y(!1)}function L(G){G.key==="Escape"&&(G.stopPropagation(),O())}const J={width:"100%",padding:"4px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",resize:"vertical",fontFamily:"inherit",minHeight:"40px",boxSizing:"border-box"},ce={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"#9ca3af",cursor:"pointer",lineHeight:1},ie=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",ue=`${e.type} annotation${ie?": "+ie:""}, ${e.status}`;return T.jsxs("div",{onClick:f,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":ue,"aria-current":n?"true":void 0,style:{padding:"8px 10px",marginBottom:"6px",borderLeft:`3px solid ${d}`,background:n?"#eef2ff":"white",borderRadius:"0 4px 4px 0",fontSize:"13px",opacity:p?1:.6,cursor:f?"pointer":"default",outline:n?"2px solid #6366f1":"none",transition:"background 0.15s, outline 0.15s"},children:[T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[T.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[e.type,!p&&T.jsx("span",{style:{marginLeft:"6px",fontSize:"10px",color:e.status==="accepted"?"#16a34a":"#dc2626",fontWeight:600},children:e.status}),p&&o&&!n&&!m&&T.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:G=>{G.stopPropagation(),re()},style:ce,title:"Edit annotation",children:"✎"})]}),T.jsxs("span",{style:{fontSize:"11px",color:"#9ca3af",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&T.jsx("span",{style:{fontStyle:"italic",fontSize:"10px",color:"#b0b0b0"},children:"(edited)"}),e.author==="claude"?"Claude":e.author==="import"?"Imported":"You"]})]}),e.textSnapshot&&T.jsx("div",{"data-testid":`annotation-snippet-${e.id}`,style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid #d1d5db",color:"#6b7280",fontSize:"12px",fontStyle:"italic",backgroundColor:"#f9fafb",borderRadius:"2px"},children:e.textSnapshot.length>80?e.textSnapshot.slice(0,77)+"...":e.textSnapshot}),m?T.jsxs("div",{style:{marginTop:"4px"},onClick:G=>G.stopPropagation(),children:[z?T.jsxs(T.Fragment,{children:[T.jsx("label",{style:{fontSize:"11px",color:"#6b7280",display:"block",marginBottom:"2px"},children:"Replacement text"}),T.jsx("textarea",{"data-testid":`edit-newtext-${e.id}`,value:v,onChange:G=>k(G.target.value),onKeyDown:L,style:J,autoFocus:!0}),T.jsx("label",{style:{fontSize:"11px",color:"#6b7280",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),T.jsx("textarea",{"data-testid":`edit-reason-${e.id}`,value:C,onChange:G=>U(G.target.value),onKeyDown:L,style:J})]}):T.jsx("textarea",{"data-testid":`edit-text-${e.id}`,value:b,onChange:G=>S(G.target.value),onKeyDown:L,style:J,autoFocus:!0}),T.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[T.jsx("button",{"data-testid":`edit-save-btn-${e.id}`,onClick:G=>{G.stopPropagation(),F()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#f0fdf4",color:"#166534",cursor:"pointer"},children:"Save"}),T.jsx("button",{"data-testid":`edit-cancel-btn-${e.id}`,onClick:G=>{G.stopPropagation(),O()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fff",color:"#6b7280",cursor:"pointer"},children:"Cancel"})]})]}):T.jsx("p",{style:{margin:0,color:"#4b5563",lineHeight:"1.4"},children:e.type==="suggestion"?(()=>{const G=ST(e.content);return G?G.reason||G.newText:e.content})():e.content||"(no note)"}),p&&!m&&(r||i)&&T.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[r&&T.jsx("button",{"data-testid":`accept-btn-${e.id}`,onClick:G=>{G.stopPropagation(),r(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:z?"#f0fdf4":"#eef2ff",color:z?"#166534":"#1e40af",cursor:"pointer"},children:z?"Accept":"Acknowledge"}),i&&T.jsx("button",{"data-testid":`dismiss-btn-${e.id}`,onClick:G=>{G.stopPropagation(),i(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",background:"#fef2f2",color:"#991b1b",cursor:"pointer"},children:"Dismiss"})]}),!p&&c&&s&&T.jsx("div",{style:{marginTop:"4px"},children:T.jsx("button",{"data-testid":"undo-btn",onClick:G=>{G.stopPropagation(),s(e.id)},style:{padding:"1px 6px",fontSize:"11px",border:"none",background:"none",color:"#6366f1",cursor:"pointer",textDecoration:"underline"},children:"Undo"})})]})}),qu=`http://localhost:${c1}/api`;function w9(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 v9(t){return t.toLowerCase().endsWith(".docx")}async function kD(t){if(v9(t.name)){const e=await t.arrayBuffer();return w9(e)}return t.text()}function k9({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=R.useState(!1);if(e!=="docx")return null;const s=t.filter(d=>d.status==="accepted"),o=t.filter(d=>d.status==="pending"),c=s.length===0||r;async function f(){if(c||!n)return;let d=`Apply ${s.length} change(s) as tracked revisions?
249
-
250
- The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
251
-
252
- Your original file will be backed up.`;if(o.length>0&&(d+=`
253
-
254
- ⚠ ${o.length} annotation(s) are still pending review and will not be applied.`),!!confirm(d)){i(!0);try{const p=await fetch(`${qu}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await p.json().catch(b=>(console.error("[ApplyChanges] Failed to parse response JSON:",b),null));if(!p.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${p.status}).`);return}const y=m==null?void 0:m.data;if(y){const b=[`Applied ${y.applied??0} tracked change(s).`];y.rejected>0&&b.push(`${y.rejected} could not be applied.`),y.backupPath&&b.push(`
255
- Backup saved to:
256
- ${y.backupPath}`),alert(b.join(" "))}else alert("Changes applied successfully.")}catch(p){console.error("[ApplyChanges] Request failed:",p),alert(p instanceof TypeError?"Could not reach the server.":`Apply failed: ${p instanceof Error?p.message:String(p)}`)}finally{i(!1)}}}return T.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:f,disabled:c,title:s.length===0?"No accepted suggestions to apply":void 0,style:{width:"100%",padding:"6px 12px",fontSize:"12px",fontWeight:500,border:"1px solid #bfdbfe",borderRadius:"4px",background:c?"#f3f4f6":"#2563eb",color:c?"#9ca3af":"white",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}function v0({value:t,onChange:e,options:n}){return T.jsx("select",{value:t,onChange:r=>e(r.target.value),style:{padding:"2px 4px",fontSize:"11px",border:"1px solid #e5e7eb",borderRadius:"3px",background:"#fff",color:"#374151",cursor:"pointer"},children:n.map(r=>T.jsx("option",{value:r.value,children:r.label},r.value))})}function C9(t,e){R.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])}const Wd={padding:"2px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"3px",cursor:"pointer"};function E9(t,e,n){if(t.type!=="suggestion")return!1;let r;try{r=JSON.parse(t.content).newText}catch{return console.warn("[SidePanel] Malformed suggestion content for",t.id),!1}if(typeof r!="string")return!1;const i=kp(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 T9({annotations:t,editor:e,ydoc:n,heldCount:r=0,interruptionMode:i,onModeChange:s,activeDocFormat:o,documentId:c,reviewMode:f,onToggleReviewMode:d,onExitReviewMode:p,activeAnnotationId:m,onActiveAnnotationChange:y}){const[b,S]=R.useState("all"),[v,k]=R.useState("all"),[C,U]=R.useState("all"),[z,re]=R.useState(0),F=R.useRef(0),[O,L]=R.useState(null),J=R.useRef(O);J.current=O;const ce=R.useRef(null),[ie,ue]=R.useState(new Set),G=R.useRef(null),ee=R.useRef(new Map);R.useEffect(()=>{const le=ee.current;return()=>{for(const je of le.values())clearTimeout(je)}},[]);const ne=R.useRef(n),Z=R.useRef(e);ne.current=n,Z.current=e;const{filtered:I,pending:Y,resolved:me,allPending:de}=R.useMemo(()=>{const le=[],je=[];for(const j of t){j.status==="pending"&&je.push(j);const se=b==="all"||j.type===b,ve=v==="all"||j.author===v,Ae=C==="all"||j.status===C;se&&ve&&Ae&&le.push(j)}const Pe=le.filter(j=>j.status==="pending"),St=le.filter(j=>j.status!=="pending");return{filtered:le,pending:Pe,resolved:St,allPending:je}},[t,b,v,C]),M=de,_=R.useRef(M);_.current=M;function H(le,je){const Pe=ne.current;if(!Pe)return;const St=Pe.getMap(oa),j=St.get(le);if(!j)return;if(St.set(le,{...j,status:je}),je==="accepted"&&Z.current&&!E9(j,Z.current,ne.current)){St.set(le,{...j,status:"pending"});return}G.current=le,ue(Ae=>new Set(Ae).add(le));const se=ee.current.get(le);se&&clearTimeout(se);const ve=setTimeout(()=>{ee.current.delete(le),ue(Ae=>{const Xe=new Set(Ae);return Xe.delete(le),Xe}),G.current===le&&(G.current=null)},1e4);ee.current.set(le,ve)}function A(le){const je=ne.current;if(!je)return;const Pe=je.getMap(oa),St=Pe.get(le);if(!St||St.status==="pending")return;if(St.status==="accepted"&&St.type==="suggestion"&&Z.current)try{const{newText:se}=JSON.parse(St.content),ve=St.textSnapshot;if(typeof se=="string"&&typeof ve=="string"){const Ae=kp(St,Z.current.state.doc,je);if(!Ae){console.warn(`[undo] Cannot resolve range for annotation ${le}, skipping`);return}if(Z.current.state.doc.textBetween(Ae.from,Ae.to)!==se){console.warn(`[undo] Text changed since accept for annotation ${le}, skipping`);return}Z.current.chain().focus().deleteRange({from:Ae.from,to:Ae.to}).insertContentAt(Ae.from,ve).run()}}catch(se){console.warn(`[undo] Failed to revert text for annotation ${le}:`,se);return}Pe.set(le,{...St,status:"pending"});const j=ee.current.get(le);j&&(clearTimeout(j),ee.current.delete(le)),ue(se=>{const ve=new Set(se);return ve.delete(le),ve}),G.current===le&&(G.current=null)}function te(le){H(le,"accepted")}function pe(le){H(le,"dismissed")}function ge(le){A(le)}function _e(le,je){const Pe=ne.current;if(!Pe)return;const St=Pe.getMap(oa),j=St.get(le);j&&St.set(le,{...j,content:je,editedAt:Date.now()})}function Ge(){for(const le of Y)H(le.id,"accepted");L(null)}function qe(){for(const le of Y)H(le.id,"dismissed");L(null)}const dt=R.useCallback(le=>{const je=Z.current;if(!je)return;const Pe=kp(le,je.state.doc,ne.current);if(!Pe)return;je.chain().focus().setTextSelection({from:Pe.from,to:Pe.to}).run();const St=je.view.domAtPos(Pe.from),j=St.node instanceof HTMLElement?St.node:St.node.parentElement;j==null||j.scrollIntoView({behavior:"smooth",block:"center"})},[]),Me=R.useCallback(le=>{const je=_.current;if(je.length===0)return;let Pe=F.current;Pe=le==="next"?(Pe+1)%je.length:(Pe-1+je.length)%je.length,F.current=Pe,re(Pe),dt(je[Pe])},[dt]),Ze=R.useCallback(()=>{const le=_.current;if(le.length===0)return;const je=le[F.current];je&&H(je.id,"accepted")},[]),Mt=R.useCallback(()=>{const le=_.current;if(le.length===0)return;const je=le[F.current];je&&H(je.id,"dismissed")},[]),zt=R.useRef(!1);R.useEffect(()=>{f&&!zt.current&&M.length>0&&(F.current=0,re(0),dt(M[0])),zt.current=f},[f,M,dt]),R.useEffect(()=>{var le;f&&M.length>0?y(((le=M[z])==null?void 0:le.id)??null):y(null)},[f,z,M,y]);const Mn=R.useCallback(()=>{const je=_.current[F.current];je&&dt(je),p()},[dt,p]),Kn=R.useCallback(()=>{const le=G.current;le&&A(le)},[]),ar=R.useCallback(()=>{J.current?L(null):p()},[p]),Gr=R.useMemo(()=>({onToggleReviewMode:d,onExitReviewMode:p,navigateReview:Me,acceptCurrent:Ze,dismissCurrent:Mt,scrollToCurrentAndExit:Mn,cancelBulkOrExit:ar,undoLast:Kn}),[d,p,Me,Ze,Mt,Mn,ar,Kn]);C9(f,Gr),R.useEffect(()=>{var le;O&&((le=ce.current)==null||le.focus())},[O]),R.useEffect(()=>{L(null)},[Y.length]),R.useEffect(()=>{if(f&&F.current>=M.length){const le=Math.max(0,M.length-1);F.current=le,re(le)}},[f,M.length]),R.useEffect(()=>{f&&M.length===0&&p()},[f,M.length,p]);const Zr=R.useRef(null),Cr=b!=="all"||v!=="all"||C!=="all",Un=f&&M.length>0?M[z]:null;return T.jsxs("div",{style:{width:"100%",background:"#fafafa",display:"flex",flexDirection:"column",overflowY:"auto"},children:[r>0&&T.jsxs("div",{style:{padding:"6px 16px",background:"#fef3c7",borderBottom:"1px solid #fde68a",fontSize:"12px",color:"#92400e",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[T.jsxs("span",{children:[r," annotation",r!==1?"s":""," held"]}),T.jsx("button",{onClick:()=>s==null?void 0:s("all"),style:{fontSize:"11px",padding:"1px 8px",border:"1px solid #fbbf24",borderRadius:"4px",background:"#fff",color:"#92400e",cursor:"pointer",fontWeight:500},children:"Show all"})]}),T.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e5e7eb"},children:T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[T.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",de.length>0&&T.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"#6366f1",color:"white",borderRadius:"10px"},children:de.length})]}),T.jsxs("span",{"aria-live":"polite",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)"},children:[de.length," pending annotation",de.length!==1?"s":""]}),de.length>0&&T.jsx("button",{"data-testid":"review-mode-btn",onClick:d,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":f,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${f?"#6366f1":"#d1d5db"}`,borderRadius:"3px",background:f?"#eef2ff":"#fff",color:f?"#6366f1":"#6b7280",cursor:"pointer",fontWeight:f?600:400},children:f?"Exit Review":"Review"})]})}),f&&M.length>0&&T.jsxs("div",{style:{padding:"8px 16px",background:"#eef2ff",borderBottom:"1px solid #e5e7eb",fontSize:"12px",color:"#4338ca"},children:[T.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",z+1," / ",M.length]}),T.jsx("div",{style:{color:"#6366f1"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),T.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[T.jsx(v0,{value:b,onChange:le=>S(le),options:[{value:"all",label:"All types"},{value:"highlight",label:"Highlights"},{value:"comment",label:"Comments"},{value:"suggestion",label:"Suggestions"},{value:"question",label:"Questions"},{value:"flag",label:"Flags"}]}),T.jsx(v0,{value:v,onChange:le=>k(le),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),T.jsx(v0,{value:C,onChange:le=>U(le),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),Cr&&T.jsx("button",{onClick:()=>{var le;S("all"),k("all"),U("all"),(le=Zr.current)==null||le.scrollTo({top:0})},style:{background:"none",border:"none",color:"#6366f1",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]}),T.jsx("div",{style:{padding:"4px 16px 0"},children:T.jsx(k9,{annotations:t,activeDocFormat:o,documentId:c})}),Y.length>1&&T.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",gap:"6px",alignItems:"center"},children:O?(()=>{const le=O==="accept";return T.jsxs(T.Fragment,{children:[T.jsxs("span",{style:{fontSize:"11px",color:"#374151"},children:[le?"Acknowledge":"Dismiss"," ",Y.length===de.length?`${Y.length} annotations?`:`${Y.length} of ${de.length} pending?`]}),T.jsx("button",{ref:ce,onClick:le?Ge:qe,style:{...Wd,background:le?"#f0fdf4":"#fef2f2",color:le?"#166534":"#991b1b",fontWeight:600},children:"Confirm"}),T.jsx("button",{onClick:()=>L(null),style:{...Wd,background:"#fff",color:"#6b7280"},children:"Cancel"})]})})():T.jsxs(T.Fragment,{children:[T.jsxs("button",{onClick:()=>L("accept"),style:{...Wd,background:"#f0fdf4",color:"#166534"},children:["Acknowledge All (",Y.length,")"]}),T.jsx("button",{onClick:()=>L("dismiss"),style:{...Wd,background:"#fef2f2",color:"#991b1b"},children:"Dismiss All"})]})}),T.jsx("div",{ref:Zr,style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:I.length===0?T.jsx("p",{role:"status",style:{fontSize:"13px",color:"#9ca3af",marginTop:"8px"},children:Cr?"No annotations match filters.":"No annotations yet. Open a document to get started."}):T.jsxs(T.Fragment,{children:[Y.map(le=>{const je=(Un==null?void 0:Un.id)===le.id;return T.jsx(wT,{annotation:le,isReviewTarget:je,onAccept:te,onDismiss:pe,onEdit:_e,onClick:()=>dt(le)},le.id)}),me.length>0&&T.jsxs("details",{style:{marginTop:"12px"},children:[T.jsxs("summary",{style:{fontSize:"12px",color:"#9ca3af",cursor:"pointer"},children:[me.length," resolved"]}),T.jsx("div",{role:"list","aria-label":"Resolved annotations",children:me.map(le=>T.jsx(wT,{annotation:le,onUndo:ge,undoable:ie.has(le.id),onClick:()=>dt(le)},le.id))})]})]})})]})}function A9(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const M9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_9={};function vT(t,e){return(_9.jsx?O9:M9).test(t)}const D9=/[ \t\n\f\r]/g;function R9(t){return typeof t=="object"?t.type==="text"?kT(t.value):!1:kT(t)}function kT(t){return t.replace(D9,"")===""}class uf{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}uf.prototype.normal={};uf.prototype.property={};uf.prototype.space=void 0;function CD(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new uf(n,r,e)}function Vb(t){return t.toLowerCase()}class or{constructor(e,n){this.attribute=n,this.property=e}}or.prototype.attribute="";or.prototype.booleanish=!1;or.prototype.boolean=!1;or.prototype.commaOrSpaceSeparated=!1;or.prototype.commaSeparated=!1;or.prototype.defined=!1;or.prototype.mustUseProperty=!1;or.prototype.number=!1;or.prototype.overloadedBoolean=!1;or.prototype.property="";or.prototype.spaceSeparated=!1;or.prototype.space=void 0;let N9=0;const Ve=ao(),Wt=ao(),Pb=ao(),ae=ao(),Et=ao(),ya=ao(),yr=ao();function ao(){return 2**++N9}const Fb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Wt,commaOrSpaceSeparated:yr,commaSeparated:ya,number:ae,overloadedBoolean:Pb,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),k0=Object.keys(Fb);class Cx extends or{constructor(e,n,r,i){let s=-1;if(super(e,n),CT(this,"space",i),typeof r=="number")for(;++s<k0.length;){const o=k0[s];CT(this,k0[s],(r&Fb[o])===Fb[o])}}}Cx.prototype.defined=!0;function CT(t,e,n){n&&(t[e]=n)}function $a(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Cx(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[Vb(r)]=r,n[Vb(s.attribute)]=r}return new uf(e,n,t.space)}const ED=$a({properties:{ariaActiveDescendant:null,ariaAtomic:Wt,ariaAutoComplete:null,ariaBusy:Wt,ariaChecked:Wt,ariaColCount:ae,ariaColIndex:ae,ariaColSpan:ae,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Wt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Wt,ariaFlowTo:Et,ariaGrabbed:Wt,ariaHasPopup:null,ariaHidden:Wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:ae,ariaLive:null,ariaModal:Wt,ariaMultiLine:Wt,ariaMultiSelectable:Wt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:ae,ariaPressed:Wt,ariaReadOnly:Wt,ariaRelevant:null,ariaRequired:Wt,ariaRoleDescription:Et,ariaRowCount:ae,ariaRowIndex:ae,ariaRowSpan:ae,ariaSelected:Wt,ariaSetSize:ae,ariaSort:null,ariaValueMax:ae,ariaValueMin:ae,ariaValueNow:ae,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function TD(t,e){return e in t?t[e]:e}function AD(t,e){return TD(t,e.toLowerCase())}const z9=$a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ya,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Et,autoFocus:Ve,autoPlay:Ve,blocking:Et,capture:null,charSet:null,checked:Ve,cite:null,className:Et,cols:ae,colSpan:null,content:null,contentEditable:Wt,controls:Ve,controlsList:Et,coords:ae|ya,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:Pb,draggable:Wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Et,height:ae,hidden:Pb,high:ae,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Et,itemRef:Et,itemScope:Ve,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:ae,manifest:null,max:null,maxLength:ae,media:null,method:null,min:null,minLength:ae,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:ae,pattern:null,ping:Et,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Et,required:Ve,reversed:Ve,rows:ae,rowSpan:ae,sandbox:Et,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:ae,sizes:null,slot:null,span:ae,spellCheck:Wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ae,step:null,style:null,tabIndex:ae,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Wt,width:ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:ae,borderColor:null,bottomMargin:ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:ae,leftMargin:ae,link:null,longDesc:null,lowSrc:null,marginHeight:ae,marginWidth:ae,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:ae,rules:null,scheme:null,scrolling:Wt,standby:null,summary:null,text:null,topMargin:ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:ae,security:null,unselectable:null},space:"html",transform:AD}),L9=$a({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:yr,accentHeight:ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ae,amplitude:ae,arabicForm:null,ascent:ae,attributeName:null,attributeType:null,azimuth:ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ae,by:null,calcMode:null,capHeight:ae,className:Et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ae,diffuseConstant:ae,direction:null,display:null,dur:null,divisor:ae,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:ae,enableBackground:null,end:null,event:null,exponent:ae,externalResourcesRequired:null,fill:null,fillOpacity:ae,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:ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ae,horizOriginX:ae,horizOriginY:ae,id:null,ideographic:ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ae,k:ae,k1:ae,k2:ae,k3:ae,k4:ae,kernelMatrix:yr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ae,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:ae,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:ae,overlineThickness:ae,paintOrder:null,panose1:null,path:null,pathLength:ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ae,pointsAtY:ae,pointsAtZ:ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:yr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:yr,rev:yr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:yr,requiredFeatures:yr,requiredFonts:yr,requiredFormats:yr,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:ae,specularExponent:ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ae,strikethroughThickness:ae,string:null,stroke:null,strokeDashArray:yr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ae,strokeOpacity:ae,strokeWidth:null,style:null,surfaceScale:ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:yr,tabIndex:ae,tableValues:null,target:null,targetX:ae,targetY:ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:yr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ae,underlineThickness:ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ae,values:null,vAlphabetic:ae,vMathematical:ae,vectorEffect:null,vHanging:ae,vIdeographic:ae,version:null,vertAdvY:ae,vertOriginX:ae,vertOriginY:ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:TD}),MD=$a({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()}}),OD=$a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:AD}),_D=$a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),I9={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"},B9=/[A-Z]/g,ET=/-[a-z]/g,j9=/^data[-\w.:]+$/i;function U9(t,e){const n=Vb(e);let r=e,i=or;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&j9.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(ET,V9);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!ET.test(s)){let o=s.replace(B9,H9);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Cx}return new i(r,e)}function H9(t){return"-"+t.toLowerCase()}function V9(t){return t.charAt(1).toUpperCase()}const P9=CD([ED,z9,MD,OD,_D],"html"),Ex=CD([ED,L9,MD,OD,_D],"svg");function F9(t){return t.join(" ").trim()}var Xo={},C0,TT;function $9(){if(TT)return C0;TT=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
257
- `,d="/",p="*",m="",y="comment",b="declaration";function S(k,C){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];C=C||{};var U=1,z=1;function re(ne){var Z=ne.match(e);Z&&(U+=Z.length);var I=ne.lastIndexOf(f);z=~I?ne.length-I:z+ne.length}function F(){var ne={line:U,column:z};return function(Z){return Z.position=new O(ne),ce(),Z}}function O(ne){this.start=ne,this.end={line:U,column:z},this.source=C.source}O.prototype.content=k;function L(ne){var Z=new Error(C.source+":"+U+":"+z+": "+ne);if(Z.reason=ne,Z.filename=C.source,Z.line=U,Z.column=z,Z.source=k,!C.silent)throw Z}function J(ne){var Z=ne.exec(k);if(Z){var I=Z[0];return re(I),k=k.slice(I.length),Z}}function ce(){J(n)}function ie(ne){var Z;for(ne=ne||[];Z=ue();)Z!==!1&&ne.push(Z);return ne}function ue(){var ne=F();if(!(d!=k.charAt(0)||p!=k.charAt(1))){for(var Z=2;m!=k.charAt(Z)&&(p!=k.charAt(Z)||d!=k.charAt(Z+1));)++Z;if(Z+=2,m===k.charAt(Z-1))return L("End of comment missing");var I=k.slice(2,Z-2);return z+=2,re(I),k=k.slice(Z),z+=2,ne({type:y,comment:I})}}function G(){var ne=F(),Z=J(r);if(Z){if(ue(),!J(i))return L("property missing ':'");var I=J(s),Y=ne({type:b,property:v(Z[0].replace(t,m)),value:I?v(I[0].replace(t,m)):m});return J(o),Y}}function ee(){var ne=[];ie(ne);for(var Z;Z=G();)Z!==!1&&(ne.push(Z),ie(ne));return ne}return ce(),ee()}function v(k){return k?k.replace(c,m):m}return C0=S,C0}var AT;function q9(){if(AT)return Xo;AT=1;var t=Xo&&Xo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=n;const e=t($9());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,e.default)(r),c=typeof i=="function";return o.forEach(f=>{if(f.type!=="declaration")return;const{property:d,value:p}=f;c?i(d,p,f):p&&(s=s||{},s[d]=p)}),s}return Xo}var Pc={},MT;function Y9(){if(MT)return Pc;MT=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(d){return!d||n.test(d)||t.test(d)},o=function(d,p){return p.toUpperCase()},c=function(d,p){return"".concat(p,"-")},f=function(d,p){return p===void 0&&(p={}),s(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(i,c):d=d.replace(r,c),d.replace(e,o))};return Pc.camelCase=f,Pc}var Fc,OT;function K9(){if(OT)return Fc;OT=1;var t=Fc&&Fc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(q9()),n=Y9();function r(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(c,f){c&&f&&(o[(0,n.camelCase)(c,s)]=f)}),o}return r.default=r,Fc=r,Fc}var G9=K9();const Z9=Lp(G9),DD=RD("end"),Tx=RD("start");function RD(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 W9(t){const e=Tx(t),n=DD(t);if(e&&n)return{start:e,end:n}}function fu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?_T(t.position):"start"in t||"end"in t?_T(t):"line"in t||"column"in t?$b(t):""}function $b(t){return DT(t&&t.line)+":"+DT(t&&t.column)}function _T(t){return $b(t&&t.start)+"-"+$b(t&&t.end)}function DT(t){return t&&typeof t=="number"?t:1}class jn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!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&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?s.ruleId=r:(s.source=r.slice(0,f),s.ruleId=r.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){const f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=fu(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=o&&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}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const Ax={}.hasOwnProperty,J9=new Map,X9=/[A-Z]/g,Q9=new Set(["table","tbody","thead","tfoot","tr"]),eV=new Set(["td","th"]),ND="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function tV(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=cV(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=aV(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"?Ex:P9,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=zD(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function zD(t,e,n){if(e.type==="element")return nV(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return rV(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return sV(t,e,n);if(e.type==="mdxjsEsm")return iV(t,e);if(e.type==="root")return lV(t,e,n);if(e.type==="text")return oV(t,e)}function nV(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Ex,t.schema=i),t.ancestors.push(e);const s=ID(t,e.tagName,!1),o=uV(t,e);let c=Ox(t,e);return Q9.has(e.tagName)&&(c=c.filter(function(f){return typeof f=="string"?!R9(f):!0})),LD(t,o,s,e),Mx(o,c),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function rV(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)}Yu(t,e.position)}function iV(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Yu(t,e.position)}function sV(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Ex,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:ID(t,e.name,!0),o=fV(t,e),c=Ox(t,e);return LD(t,o,s,e),Mx(o,c),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function lV(t,e,n){const r={};return Mx(r,Ox(t,e)),t.create(e,t.Fragment,r,n)}function oV(t,e){return e.value}function LD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Mx(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function aV(t,e,n){return r;function r(i,s,o,c){const d=Array.isArray(o.children)?n:e;return c?d(s,o,c):d(s,o)}}function cV(t,e){return n;function n(r,i,s,o){const c=Array.isArray(s.children),f=Tx(r);return e(i,s,o,c,{columnNumber:f?f.column-1:void 0,fileName:t,lineNumber:f?f.line:void 0},void 0)}}function uV(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Ax.call(e.properties,i)){const s=dV(t,i,e.properties[i]);if(s){const[o,c]=s;t.tableCellAlignToStyle&&o==="align"&&typeof c=="string"&&eV.has(e.tagName)?r=c:n[o]=c}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function fV(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 o=s.expression;o.type;const c=o.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Yu(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 Yu(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Ox(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:J9;for(;++r<e.children.length;){const s=e.children[r];let o;if(t.passKeys){const f=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(f){const d=i.get(f)||0;o=f+"-"+d,i.set(f,d+1)}}const c=zD(t,s,o);c!==void 0&&n.push(c)}return n}function dV(t,e,n){const r=U9(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?A9(n):F9(n)),r.property==="style"){let i=typeof n=="object"?n:hV(t,String(n));return t.stylePropertyNameCase==="css"&&(i=pV(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?I9[r.property]||r.property:r.attribute,n]}}function hV(t,e){try{return Z9(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new jn("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=ND+"#cannot-parse-style-attribute",i}}function ID(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const c=vT(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=o}else r=vT(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Ax.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Yu(t)}function Yu(t,e){const n=new jn("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=ND+"#cannot-handle-mdx-estrees-without-createevaluater",n}function pV(t){const e={};let n;for(n in t)Ax.call(t,n)&&(e[mV(n)]=t[n]);return e}function mV(t){let e=t.replace(X9,gV);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function gV(t){return"-"+t.toLowerCase()}const E0={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"]},yV={};function bV(t,e){const n=yV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return BD(t,r,i)}function BD(t,e,n){if(xV(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 RT(t.children,e,n)}return Array.isArray(t)?RT(t,e,n):""}function RT(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=BD(t[i],e,n);return r.join("")}function xV(t){return!!(t&&typeof t=="object")}const NT=document.createElement("i");function _x(t){const e="&"+t+";";NT.innerHTML=e;const n=NT.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ai(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Ur(t,e){return t.length>0?(Ai(t,t.length,0,e),t):e}const zT={}.hasOwnProperty;function SV(t){const e={};let n=-1;for(;++n<t.length;)wV(e,t[n]);return e}function wV(t,e){let n;for(n in e){const i=(zT.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){zT.call(i,o)||(i[o]=[]);const c=s[o];vV(i[o],Array.isArray(c)?c:c?[c]:[])}}}function vV(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ai(t,0,0,r)}function jD(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 gi=dl(/[A-Za-z]/),vr=dl(/[\dA-Za-z]/),kV=dl(/[#-'*+\--9=?A-Z^-~]/);function qb(t){return t!==null&&(t<32||t===127)}const Yb=dl(/\d/),CV=dl(/[\dA-Fa-f]/),EV=dl(/[!-/:-@[-`{-~]/);function Re(t){return t!==null&&t<-2}function lr(t){return t!==null&&(t<0||t===32)}function ft(t){return t===-2||t===-1||t===32}const TV=dl(new RegExp("\\p{P}|\\p{S}","u")),AV=dl(/\s/);function dl(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function qa(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";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))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const c=t.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(o=String.fromCharCode(s,c),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Tt(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(f){return ft(f)?(t.enter(n),c(f)):e(f)}function c(f){return ft(f)&&s++<i?(t.consume(f),c):(t.exit(n),e(f))}}const MV={tokenize:OV};function OV(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),Tt(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const f=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,o(c)}function o(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Re(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),o)}}const _V={tokenize:DV},LT={tokenize:RV};function DV(t){const e=this,n=[];let r=0,i,s,o;return c;function c(z){if(r<n.length){const re=n[r];return e.containerState=re[1],t.attempt(re[0].continuation,f,d)(z)}return d(z)}function f(z){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&U();const re=e.events.length;let F=re,O;for(;F--;)if(e.events[F][0]==="exit"&&e.events[F][1].type==="chunkFlow"){O=e.events[F][1].end;break}C(r);let L=re;for(;L<e.events.length;)e.events[L][1].end={...O},L++;return Ai(e.events,F+1,0,e.events.slice(re)),e.events.length=L,d(z)}return c(z)}function d(z){if(r===n.length){if(!i)return y(z);if(i.currentConstruct&&i.currentConstruct.concrete)return S(z);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(LT,p,m)(z)}function p(z){return i&&U(),C(r),y(z)}function m(z){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,S(z)}function y(z){return e.containerState={},t.attempt(LT,b,S)(z)}function b(z){return r++,n.push([e.currentConstruct,e.containerState]),y(z)}function S(z){if(z===null){i&&U(),C(0),t.consume(z);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(z)}function v(z){if(z===null){k(t.exit("chunkFlow"),!0),C(0),t.consume(z);return}return Re(z)?(t.consume(z),k(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(z),v)}function k(z,re){const F=e.sliceStream(z);if(re&&F.push(null),z.previous=s,s&&(s.next=z),s=z,i.defineSkip(z.start),i.write(F),e.parser.lazy[z.start.line]){let O=i.events.length;for(;O--;)if(i.events[O][1].start.offset<o&&(!i.events[O][1].end||i.events[O][1].end.offset>o))return;const L=e.events.length;let J=L,ce,ie;for(;J--;)if(e.events[J][0]==="exit"&&e.events[J][1].type==="chunkFlow"){if(ce){ie=e.events[J][1].end;break}ce=!0}for(C(r),O=L;O<e.events.length;)e.events[O][1].end={...ie},O++;Ai(e.events,J+1,0,e.events.slice(L)),e.events.length=O}}function C(z){let re=n.length;for(;re-- >z;){const F=n[re];e.containerState=F[1],F[0].exit.call(e,t)}n.length=z}function U(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function RV(t,e,n){return Tt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function IT(t){if(t===null||lr(t)||AV(t))return 1;if(TV(t))return 2}function Dx(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 Kb={name:"attention",resolveAll:NV,tokenize:zV};function NV(t,e){let n=-1,r,i,s,o,c,f,d,p;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;f=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},y={...t[n][1].start};BT(m,-f),BT(y,f),o={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:f>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:y},s={type:f>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:f>1?"strong":"emphasis",start:{...o.start},end:{...c.end}},t[r][1].end={...o.start},t[n][1].start={...c.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=Ur(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=Ur(d,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),d=Ur(d,Dx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=Ur(d,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(p=2,d=Ur(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):p=0,Ai(t,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function zV(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=IT(r);let s;return o;function o(f){return s=f,t.enter("attentionSequence"),c(f)}function c(f){if(f===s)return t.consume(f),c;const d=t.exit("attentionSequence"),p=IT(f),m=!p||p===2&&i||n.includes(f),y=!i||i===2&&p||n.includes(r);return d._open=!!(s===42?m:m&&(i||!y)),d._close=!!(s===42?y:y&&(p||!m)),e(f)}}function BT(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const LV={name:"autolink",tokenize:IV};function IV(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 gi(b)?(t.consume(b),o):b===64?n(b):d(b)}function o(b){return b===43||b===45||b===46||vr(b)?(r=1,c(b)):d(b)}function c(b){return b===58?(t.consume(b),r=0,f):(b===43||b===45||b===46||vr(b))&&r++<32?(t.consume(b),c):(r=0,d(b))}function f(b){return b===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):b===null||b===32||b===60||qb(b)?n(b):(t.consume(b),f)}function d(b){return b===64?(t.consume(b),p):kV(b)?(t.consume(b),d):n(b)}function p(b){return vr(b)?m(b):n(b)}function m(b){return b===46?(t.consume(b),r=0,p):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):y(b)}function y(b){if((b===45||vr(b))&&r++<63){const S=b===45?y:m;return t.consume(b),S}return n(b)}}const fm={partial:!0,tokenize:BV};function BV(t,e,n){return r;function r(s){return ft(s)?Tt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Re(s)?e(s):n(s)}}const UD={continuation:{tokenize:UV},exit:HV,name:"blockQuote",tokenize:jV};function jV(t,e,n){const r=this;return i;function i(o){if(o===62){const c=r.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return ft(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function UV(t,e,n){const r=this;return i;function i(o){return ft(o)?Tt(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(UD,e,n)(o)}}function HV(t){t.exit("blockQuote")}const HD={name:"characterEscape",tokenize:VV};function VV(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 EV(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const VD={name:"characterReference",tokenize:PV};function PV(t,e,n){const r=this;let i=0,s,o;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),f}function f(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),s=31,o=vr,p(m))}function d(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=CV,p):(t.enter("characterReferenceValue"),s=7,o=Yb,p(m))}function p(m){if(m===59&&i){const y=t.exit("characterReferenceValue");return o===vr&&!_x(r.sliceSerialize(y))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(m)&&i++<s?(t.consume(m),p):n(m)}}const jT={partial:!0,tokenize:$V},UT={concrete:!0,name:"codeFenced",tokenize:FV};function FV(t,e,n){const r=this,i={partial:!0,tokenize:F};let s=0,o=0,c;return f;function f(O){return d(O)}function d(O){const L=r.events[r.events.length-1];return s=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,c=O,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===c?(o++,t.consume(O),p):o<3?n(O):(t.exit("codeFencedFenceSequence"),ft(O)?Tt(t,m,"whitespace")(O):m(O))}function m(O){return O===null||Re(O)?(t.exit("codeFencedFence"),r.interrupt?e(O):t.check(jT,v,re)(O)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(O))}function y(O){return O===null||Re(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(O)):ft(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Tt(t,b,"whitespace")(O)):O===96&&O===c?n(O):(t.consume(O),y)}function b(O){return O===null||Re(O)?m(O):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(O))}function S(O){return O===null||Re(O)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(O)):O===96&&O===c?n(O):(t.consume(O),S)}function v(O){return t.attempt(i,re,k)(O)}function k(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),C}function C(O){return s>0&&ft(O)?Tt(t,U,"linePrefix",s+1)(O):U(O)}function U(O){return O===null||Re(O)?t.check(jT,v,re)(O):(t.enter("codeFlowValue"),z(O))}function z(O){return O===null||Re(O)?(t.exit("codeFlowValue"),U(O)):(t.consume(O),z)}function re(O){return t.exit("codeFenced"),e(O)}function F(O,L,J){let ce=0;return ie;function ie(Z){return O.enter("lineEnding"),O.consume(Z),O.exit("lineEnding"),ue}function ue(Z){return O.enter("codeFencedFence"),ft(Z)?Tt(O,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Z):G(Z)}function G(Z){return Z===c?(O.enter("codeFencedFenceSequence"),ee(Z)):J(Z)}function ee(Z){return Z===c?(ce++,O.consume(Z),ee):ce>=o?(O.exit("codeFencedFenceSequence"),ft(Z)?Tt(O,ne,"whitespace")(Z):ne(Z)):J(Z)}function ne(Z){return Z===null||Re(Z)?(O.exit("codeFencedFence"),L(Z)):J(Z)}}}function $V(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const T0={name:"codeIndented",tokenize:YV},qV={partial:!0,tokenize:KV};function YV(t,e,n){const r=this;return i;function i(d){return t.enter("codeIndented"),Tt(t,s,"linePrefix",5)(d)}function s(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?f(d):Re(d)?t.attempt(qV,o,f)(d):(t.enter("codeFlowValue"),c(d))}function c(d){return d===null||Re(d)?(t.exit("codeFlowValue"),o(d)):(t.consume(d),c)}function f(d){return t.exit("codeIndented"),e(d)}}function KV(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Re(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Tt(t,s,"linePrefix",5)(o)}function s(o){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(o):Re(o)?i(o):n(o)}}const GV={name:"codeText",previous:WV,resolve:ZV,tokenize:JV};function ZV(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 WV(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JV(t,e,n){let r=0,i,s;return o;function o(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),r++,c):(t.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),f):m===96?(s=t.enter("codeTextSequence"),i=0,p(m)):Re(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),f):(t.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||Re(m)?(t.exit("codeTextData"),f(m)):(t.consume(m),d)}function p(m){return m===96?(t.consume(m),i++,p):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",d(m))}}class XV{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&&$c(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),$c(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$c(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);$c(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);$c(this.left,n.reverse())}}}function $c(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 PD(t){const e={};let n=-1,r,i,s,o,c,f,d;const p=new XV(t);for(;++n<p.length;){for(;n in e;)n=e[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,s=0,s<f.length&&f[s][1].type==="lineEndingBlank"&&(s+=2),s<f.length&&f[s][1].type==="content"))for(;++s<f.length&&f[s][1].type!=="content";)f[s][1].type==="chunkText"&&(f[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,QV(p,n)),n=e[n],d=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=p.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return Ai(t,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function QV(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const c=o.events,f=[],d={};let p,m,y=-1,b=n,S=0,v=0;const k=[v];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(p=r.sliceStream(b),b.next||p.push(null),m&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(p),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++y<c.length;)c[y][0]==="exit"&&c[y-1][0]==="enter"&&c[y][1].type===c[y-1][1].type&&c[y][1].start.line!==c[y][1].end.line&&(v=y+1,k.push(v),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(o.events=[],b?(b._tokenizer=void 0,b.previous=void 0):k.pop(),y=k.length;y--;){const C=c.slice(k[y],k[y+1]),U=s.pop();f.push([U,U+C.length-1]),t.splice(U,2,C)}for(f.reverse(),y=-1;++y<f.length;)d[S+f[y][0]]=S+f[y][1],S+=f[y][1]-f[y][0]-1;return d}const e7={resolve:n7,tokenize:r7},t7={partial:!0,tokenize:i7};function n7(t){return PD(t),t}function r7(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):Re(c)?t.check(t7,o,s)(c):(t.consume(c),i)}function s(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function o(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function i7(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Tt(t,s,"linePrefix")}function s(o){if(o===null||Re(o))return n(o);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(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function FD(t,e,n,r,i,s,o,c,f){const d=f||Number.POSITIVE_INFINITY;let p=0;return m;function m(C){return C===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(C),t.exit(s),y):C===null||C===32||C===41||qb(C)?n(C):(t.enter(r),t.enter(o),t.enter(c),t.enter("chunkString",{contentType:"string"}),v(C))}function y(C){return C===62?(t.enter(s),t.consume(C),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),b(C))}function b(C){return C===62?(t.exit("chunkString"),t.exit(c),y(C)):C===null||C===60||Re(C)?n(C):(t.consume(C),C===92?S:b)}function S(C){return C===60||C===62||C===92?(t.consume(C),b):b(C)}function v(C){return!p&&(C===null||C===41||lr(C))?(t.exit("chunkString"),t.exit(c),t.exit(o),t.exit(r),e(C)):p<d&&C===40?(t.consume(C),p++,v):C===41?(t.consume(C),p--,v):C===null||C===32||C===40||qb(C)?n(C):(t.consume(C),C===92?k:v)}function k(C){return C===40||C===41||C===92?(t.consume(C),v):v(C)}}function $D(t,e,n,r,i,s){const o=this;let c=0,f;return d;function d(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),p}function p(b){return c>999||b===null||b===91||b===93&&!f||b===94&&!c&&"_hiddenFootnoteSupport"in o.parser.constructs?n(b):b===93?(t.exit(s),t.enter(i),t.consume(b),t.exit(i),t.exit(r),e):Re(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),p):(t.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Re(b)||c++>999?(t.exit("chunkString"),p(b)):(t.consume(b),f||(f=!ft(b)),b===92?y:m)}function y(b){return b===91||b===92||b===93?(t.consume(b),c++,m):m(b)}}function qD(t,e,n,r,i,s){let o;return c;function c(y){return y===34||y===39||y===40?(t.enter(r),t.enter(i),t.consume(y),t.exit(i),o=y===40?41:y,f):n(y)}function f(y){return y===o?(t.enter(i),t.consume(y),t.exit(i),t.exit(r),e):(t.enter(s),d(y))}function d(y){return y===o?(t.exit(s),f(o)):y===null?n(y):Re(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),Tt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===o||y===null||Re(y)?(t.exit("chunkString"),d(y)):(t.consume(y),y===92?m:p)}function m(y){return y===o||y===92?(t.consume(y),p):p(y)}}function du(t,e){let n;return r;function r(i){return Re(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ft(i)?Tt(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const s7={name:"definition",tokenize:o7},l7={partial:!0,tokenize:a7};function o7(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),o(b)}function o(b){return $D.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"),f):n(b)}function f(b){return lr(b)?du(t,d)(b):d(b)}function d(b){return FD(t,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return t.attempt(l7,m,m)(b)}function m(b){return ft(b)?Tt(t,y,"whitespace")(b):y(b)}function y(b){return b===null||Re(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function a7(t,e,n){return r;function r(c){return lr(c)?du(t,i)(c):n(c)}function i(c){return qD(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return ft(c)?Tt(t,o,"whitespace")(c):o(c)}function o(c){return c===null||Re(c)?e(c):n(c)}}const c7={name:"hardBreakEscape",tokenize:u7};function u7(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Re(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const f7={name:"headingAtx",resolve:d7,tokenize:h7};function d7(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"},Ai(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function h7(t,e,n){let r=0;return i;function i(p){return t.enter("atxHeading"),s(p)}function s(p){return t.enter("atxHeadingSequence"),o(p)}function o(p){return p===35&&r++<6?(t.consume(p),o):p===null||lr(p)?(t.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(t.enter("atxHeadingSequence"),f(p)):p===null||Re(p)?(t.exit("atxHeading"),e(p)):ft(p)?Tt(t,c,"whitespace")(p):(t.enter("atxHeadingText"),d(p))}function f(p){return p===35?(t.consume(p),f):(t.exit("atxHeadingSequence"),c(p))}function d(p){return p===null||p===35||lr(p)?(t.exit("atxHeadingText"),c(p)):(t.consume(p),d)}}const p7=["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"],HT=["pre","script","style","textarea"],m7={concrete:!0,name:"htmlFlow",resolveTo:b7,tokenize:x7},g7={partial:!0,tokenize:w7},y7={partial:!0,tokenize:S7};function b7(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 x7(t,e,n){const r=this;let i,s,o,c,f;return d;function d(A){return p(A)}function p(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),m}function m(A){return A===33?(t.consume(A),y):A===47?(t.consume(A),s=!0,v):A===63?(t.consume(A),i=3,r.interrupt?e:M):gi(A)?(t.consume(A),o=String.fromCharCode(A),k):n(A)}function y(A){return A===45?(t.consume(A),i=2,b):A===91?(t.consume(A),i=5,c=0,S):gi(A)?(t.consume(A),i=4,r.interrupt?e:M):n(A)}function b(A){return A===45?(t.consume(A),r.interrupt?e:M):n(A)}function S(A){const te="CDATA[";return A===te.charCodeAt(c++)?(t.consume(A),c===te.length?r.interrupt?e:G:S):n(A)}function v(A){return gi(A)?(t.consume(A),o=String.fromCharCode(A),k):n(A)}function k(A){if(A===null||A===47||A===62||lr(A)){const te=A===47,pe=o.toLowerCase();return!te&&!s&&HT.includes(pe)?(i=1,r.interrupt?e(A):G(A)):p7.includes(o.toLowerCase())?(i=6,te?(t.consume(A),C):r.interrupt?e(A):G(A)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):s?U(A):z(A))}return A===45||vr(A)?(t.consume(A),o+=String.fromCharCode(A),k):n(A)}function C(A){return A===62?(t.consume(A),r.interrupt?e:G):n(A)}function U(A){return ft(A)?(t.consume(A),U):ie(A)}function z(A){return A===47?(t.consume(A),ie):A===58||A===95||gi(A)?(t.consume(A),re):ft(A)?(t.consume(A),z):ie(A)}function re(A){return A===45||A===46||A===58||A===95||vr(A)?(t.consume(A),re):F(A)}function F(A){return A===61?(t.consume(A),O):ft(A)?(t.consume(A),F):z(A)}function O(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),f=A,L):ft(A)?(t.consume(A),O):J(A)}function L(A){return A===f?(t.consume(A),f=null,ce):A===null||Re(A)?n(A):(t.consume(A),L)}function J(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||lr(A)?F(A):(t.consume(A),J)}function ce(A){return A===47||A===62||ft(A)?z(A):n(A)}function ie(A){return A===62?(t.consume(A),ue):n(A)}function ue(A){return A===null||Re(A)?G(A):ft(A)?(t.consume(A),ue):n(A)}function G(A){return A===45&&i===2?(t.consume(A),I):A===60&&i===1?(t.consume(A),Y):A===62&&i===4?(t.consume(A),_):A===63&&i===3?(t.consume(A),M):A===93&&i===5?(t.consume(A),de):Re(A)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(g7,H,ee)(A)):A===null||Re(A)?(t.exit("htmlFlowData"),ee(A)):(t.consume(A),G)}function ee(A){return t.check(y7,ne,H)(A)}function ne(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),Z}function Z(A){return A===null||Re(A)?ee(A):(t.enter("htmlFlowData"),G(A))}function I(A){return A===45?(t.consume(A),M):G(A)}function Y(A){return A===47?(t.consume(A),o="",me):G(A)}function me(A){if(A===62){const te=o.toLowerCase();return HT.includes(te)?(t.consume(A),_):G(A)}return gi(A)&&o.length<8?(t.consume(A),o+=String.fromCharCode(A),me):G(A)}function de(A){return A===93?(t.consume(A),M):G(A)}function M(A){return A===62?(t.consume(A),_):A===45&&i===2?(t.consume(A),M):G(A)}function _(A){return A===null||Re(A)?(t.exit("htmlFlowData"),H(A)):(t.consume(A),_)}function H(A){return t.exit("htmlFlow"),e(A)}}function S7(t,e,n){const r=this;return i;function i(o){return Re(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function w7(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(fm,e,n)}}const v7={name:"htmlText",tokenize:k7};function k7(t,e,n){const r=this;let i,s,o;return c;function c(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),f}function f(M){return M===33?(t.consume(M),d):M===47?(t.consume(M),F):M===63?(t.consume(M),z):gi(M)?(t.consume(M),J):n(M)}function d(M){return M===45?(t.consume(M),p):M===91?(t.consume(M),s=0,S):gi(M)?(t.consume(M),U):n(M)}function p(M){return M===45?(t.consume(M),b):n(M)}function m(M){return M===null?n(M):M===45?(t.consume(M),y):Re(M)?(o=m,Y(M)):(t.consume(M),m)}function y(M){return M===45?(t.consume(M),b):m(M)}function b(M){return M===62?I(M):M===45?y(M):m(M)}function S(M){const _="CDATA[";return M===_.charCodeAt(s++)?(t.consume(M),s===_.length?v:S):n(M)}function v(M){return M===null?n(M):M===93?(t.consume(M),k):Re(M)?(o=v,Y(M)):(t.consume(M),v)}function k(M){return M===93?(t.consume(M),C):v(M)}function C(M){return M===62?I(M):M===93?(t.consume(M),C):v(M)}function U(M){return M===null||M===62?I(M):Re(M)?(o=U,Y(M)):(t.consume(M),U)}function z(M){return M===null?n(M):M===63?(t.consume(M),re):Re(M)?(o=z,Y(M)):(t.consume(M),z)}function re(M){return M===62?I(M):z(M)}function F(M){return gi(M)?(t.consume(M),O):n(M)}function O(M){return M===45||vr(M)?(t.consume(M),O):L(M)}function L(M){return Re(M)?(o=L,Y(M)):ft(M)?(t.consume(M),L):I(M)}function J(M){return M===45||vr(M)?(t.consume(M),J):M===47||M===62||lr(M)?ce(M):n(M)}function ce(M){return M===47?(t.consume(M),I):M===58||M===95||gi(M)?(t.consume(M),ie):Re(M)?(o=ce,Y(M)):ft(M)?(t.consume(M),ce):I(M)}function ie(M){return M===45||M===46||M===58||M===95||vr(M)?(t.consume(M),ie):ue(M)}function ue(M){return M===61?(t.consume(M),G):Re(M)?(o=ue,Y(M)):ft(M)?(t.consume(M),ue):ce(M)}function G(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),i=M,ee):Re(M)?(o=G,Y(M)):ft(M)?(t.consume(M),G):(t.consume(M),ne)}function ee(M){return M===i?(t.consume(M),i=void 0,Z):M===null?n(M):Re(M)?(o=ee,Y(M)):(t.consume(M),ee)}function ne(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||lr(M)?ce(M):(t.consume(M),ne)}function Z(M){return M===47||M===62||lr(M)?ce(M):n(M)}function I(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),e):n(M)}function Y(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),me}function me(M){return ft(M)?Tt(t,de,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):de(M)}function de(M){return t.enter("htmlTextData"),o(M)}}const Rx={name:"labelEnd",resolveAll:A7,resolveTo:M7,tokenize:O7},C7={tokenize:_7},E7={tokenize:D7},T7={tokenize:R7};function A7(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&&Ai(t,0,t.length,n),t}function M7(t,e){let n=t.length,r=0,i,s,o,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(o){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"&&(o=n);const f={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},p={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return c=[["enter",f,e],["enter",d,e]],c=Ur(c,t.slice(s+1,s+r+3)),c=Ur(c,[["enter",p,e]]),c=Ur(c,Dx(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),c=Ur(c,[["exit",p,e],t[o-2],t[o-1],["exit",d,e]]),c=Ur(c,t.slice(o+1)),c=Ur(c,[["exit",f,e]]),Ai(t,s,t.length,c),t}function O7(t,e,n){const r=this;let i=r.events.length,s,o;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(y){return s?s._inactive?m(y):(o=r.parser.defined.includes(ba(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(y),t.exit("labelMarker"),t.exit("labelEnd"),f):n(y)}function f(y){return y===40?t.attempt(C7,p,o?p:m)(y):y===91?t.attempt(E7,p,o?d:m)(y):o?p(y):m(y)}function d(y){return t.attempt(T7,p,m)(y)}function p(y){return e(y)}function m(y){return s._balanced=!0,n(y)}}function _7(t,e,n){return r;function r(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),i}function i(m){return lr(m)?du(t,s)(m):s(m)}function s(m){return m===41?p(m):FD(t,o,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return lr(m)?du(t,f)(m):p(m)}function c(m){return n(m)}function f(m){return m===34||m===39||m===40?qD(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function d(m){return lr(m)?du(t,p)(m):p(m)}function p(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function D7(t,e,n){const r=this;return i;function i(c){return $D.call(r,t,s,o,"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 o(c){return n(c)}}function R7(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 N7={name:"labelStartImage",resolveAll:Rx.resolveAll,tokenize:z7};function z7(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"),o):n(c)}function o(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):e(c)}}const L7={name:"labelStartLink",resolveAll:Rx.resolveAll,tokenize:I7};function I7(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const A0={name:"lineEnding",tokenize:B7};function B7(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Tt(t,e,"linePrefix")}}const mh={name:"thematicBreak",tokenize:j7};function j7(t,e,n){let r=0,i;return s;function s(d){return t.enter("thematicBreak"),o(d)}function o(d){return i=d,c(d)}function c(d){return d===i?(t.enter("thematicBreakSequence"),f(d)):r>=3&&(d===null||Re(d))?(t.exit("thematicBreak"),e(d)):n(d)}function f(d){return d===i?(t.consume(d),r++,f):(t.exit("thematicBreakSequence"),ft(d)?Tt(t,c,"whitespace")(d):c(d))}}const tr={continuation:{tokenize:P7},exit:$7,name:"list",tokenize:V7},U7={partial:!0,tokenize:q7},H7={partial:!0,tokenize:F7};function V7(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,o=0;return c;function c(b){const S=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Yb(b)){if(r.containerState.type||(r.containerState.type=S,t.enter(S,{_container:!0})),S==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(mh,n,d)(b):d(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),f(b)}return n(b)}function f(b){return Yb(b)&&++o<10?(t.consume(b),f):(!r.interrupt||o<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),d(b)):n(b)}function d(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(fm,r.interrupt?n:p,t.attempt(U7,y,m))}function p(b){return r.containerState.initialBlankLine=!0,s++,y(b)}function m(b){return ft(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function P7(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(fm,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Tt(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!ft(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(H7,e,o)(c))}function o(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Tt(t,t.attempt(tr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function F7(t,e,n){const r=this;return Tt(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function $7(t){t.exit(this.containerState.type)}function q7(t,e,n){const r=this;return Tt(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!ft(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const VT={name:"setextUnderline",resolveTo:Y7,tokenize:K7};function Y7(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 o={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",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function K7(t,e,n){const r=this;let i;return s;function s(d){let p=r.events.length,m;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){m=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),i=d,o(d)):n(d)}function o(d){return t.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===i?(t.consume(d),c):(t.exit("setextHeadingLineSequence"),ft(d)?Tt(t,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Re(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const G7={tokenize:Z7};function Z7(t){const e=this,n=t.attempt(fm,r,t.attempt(this.parser.constructs.flowInitial,i,Tt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(e7,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 W7={resolveAll:KD()},J7=YD("string"),X7=YD("text");function YD(t){return{resolveAll:KD(t==="text"?Q7:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,c);return o;function o(p){return d(p)?s(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),f}function f(p){return d(p)?(n.exit("data"),s(p)):(n.consume(p),f)}function d(p){if(p===null)return!0;const m=i[p];let y=-1;if(m)for(;++y<m.length;){const b=m[y];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function KD(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 Q7(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,o=-1,c=0,f;for(;s--;){const d=i[s];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)c++,o--;if(o)break;o=-1}else if(d===-2)f=!0,c++;else if(d!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const d={type:n===t.length||f||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const eP={42:tr,43:tr,45:tr,48:tr,49:tr,50:tr,51:tr,52:tr,53:tr,54:tr,55:tr,56:tr,57:tr,62:UD},tP={91:s7},nP={[-2]:T0,[-1]:T0,32:T0},rP={35:f7,42:mh,45:[VT,mh],60:m7,61:VT,95:mh,96:UT,126:UT},iP={38:VD,92:HD},sP={[-5]:A0,[-4]:A0,[-3]:A0,33:N7,38:VD,42:Kb,60:[LV,v7],91:L7,92:[c7,HD],93:Rx,95:Kb,96:GV},lP={null:[Kb,W7]},oP={null:[42,95]},aP={null:[]},cP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:oP,contentInitial:tP,disable:aP,document:eP,flow:rP,flowInitial:nP,insideSpan:lP,string:iP,text:sP},Symbol.toStringTag,{value:"Module"}));function uP(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 o=[],c=[];const f={attempt:L(F),check:L(O),consume:U,enter:z,exit:re,interrupt:L(O,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:S,parser:t,previous:null,sliceSerialize:y,sliceStream:b,write:m};let p=e.tokenize.call(d,f);return e.resolveAll&&s.push(e),d;function m(ue){return o=Ur(o,ue),k(),o[o.length-1]!==null?[]:(J(e,0),d.events=Dx(s,d.events,d),d.events)}function y(ue,G){return dP(b(ue),G)}function b(ue){return fP(o,ue)}function S(){const{_bufferIndex:ue,_index:G,line:ee,column:ne,offset:Z}=r;return{_bufferIndex:ue,_index:G,line:ee,column:ne,offset:Z}}function v(ue){i[ue.line]=ue.column,ie()}function k(){let ue;for(;r._index<o.length;){const G=o[r._index];if(typeof G=="string")for(ue=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ue&&r._bufferIndex<G.length;)C(G.charCodeAt(r._bufferIndex));else C(G)}}function C(ue){p=p(ue)}function U(ue){Re(ue)?(r.line++,r.column=1,r.offset+=ue===-3?2:1,ie()):ue!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=ue}function z(ue,G){const ee=G||{};return ee.type=ue,ee.start=S(),d.events.push(["enter",ee,d]),c.push(ee),ee}function re(ue){const G=c.pop();return G.end=S(),d.events.push(["exit",G,d]),G}function F(ue,G){J(ue,G.from)}function O(ue,G){G.restore()}function L(ue,G){return ee;function ee(ne,Z,I){let Y,me,de,M;return Array.isArray(ne)?H(ne):"tokenize"in ne?H([ne]):_(ne);function _(ge){return _e;function _e(Ge){const qe=Ge!==null&&ge[Ge],dt=Ge!==null&&ge.null,Me=[...Array.isArray(qe)?qe:qe?[qe]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return H(Me)(Ge)}}function H(ge){return Y=ge,me=0,ge.length===0?I:A(ge[me])}function A(ge){return _e;function _e(Ge){return M=ce(),de=ge,ge.partial||(d.currentConstruct=ge),ge.name&&d.parser.constructs.disable.null.includes(ge.name)?pe():ge.tokenize.call(G?Object.assign(Object.create(d),G):d,f,te,pe)(Ge)}}function te(ge){return ue(de,M),Z}function pe(ge){return M.restore(),++me<Y.length?A(Y[me]):I}}}function J(ue,G){ue.resolveAll&&!s.includes(ue)&&s.push(ue),ue.resolve&&Ai(d.events,G,d.events.length-G,ue.resolve(d.events.slice(G),d)),ue.resolveTo&&(d.events=ue.resolveTo(d.events,d))}function ce(){const ue=S(),G=d.previous,ee=d.currentConstruct,ne=d.events.length,Z=Array.from(c);return{from:ne,restore:I};function I(){r=ue,d.previous=G,d.currentConstruct=ee,d.events.length=ne,c=Z,ie()}}function ie(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function fP(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const c=o[0];typeof c=="string"?o[0]=c.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function dP(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
258
- `;break}case-3:{o=`\r
259
- `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function hP(t){const r={constructs:SV([cP,...(t||{}).extensions||[]]),content:i(MV),defined:[],document:i(_V),flow:i(G7),lazy:{},string:i(J7),text:i(X7)};return r;function i(s){return o;function o(c){return uP(r,s,c)}}}function pP(t){for(;!PD(t););return t}const PT=/[\0\t\n\r]/g;function mP(){let t=1,e="",n=!0,r;return i;function i(s,o,c){const f=[];let d,p,m,y,b;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),m=0,e="",n&&(s.charCodeAt(0)===65279&&m++,n=void 0);m<s.length;){if(PT.lastIndex=m,d=PT.exec(s),y=d&&d.index!==void 0?d.index:s.length,b=s.charCodeAt(y),!d){e=s.slice(m);break}if(b===10&&m===y&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),m<y&&(f.push(s.slice(m,y)),t+=y-m),b){case 0:{f.push(65533),t++;break}case 9:{for(p=Math.ceil(t/4)*4,f.push(-2);t++<p;)f.push(-1);break}case 10:{f.push(-4),t=1;break}default:r=!0,t=1}m=y+1}return c&&(r&&f.push(-5),e&&f.push(e),f.push(null)),f}}const gP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yP(t){return t.replace(gP,bP)}function bP(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return jD(n.slice(s?2:1),s?16:10)}return _x(n)||t}const GD={}.hasOwnProperty;function xP(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),SP(n)(pP(hP(n).document().write(mP()(t,e,!0))))}function SP(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Zr),autolinkProtocol:ce,autolinkEmail:ce,atxHeading:s(Mn),blockQuote:s(dt),characterEscape:ce,characterReference:ce,codeFenced:s(Me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Me,o),codeText:s(Ze,o),codeTextData:ce,data:ce,codeFlowValue:ce,definition:s(Mt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(zt),hardBreakEscape:s(Kn),hardBreakTrailing:s(Kn),htmlFlow:s(ar,o),htmlFlowData:ce,htmlText:s(ar,o),htmlTextData:ce,image:s(Gr),label:o,link:s(Zr),listItem:s(Un),listItemValue:y,listOrdered:s(Cr,m),listUnordered:s(Cr),paragraph:s(le),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Mn),strong:s(je),thematicBreak:s(St)},exit:{atxHeading:f(),atxHeadingSequence:F,autolink:f(),autolinkEmail:qe,autolinkProtocol:Ge,blockQuote:f(),characterEscapeValue:ie,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:ge,characterReference:_e,codeFenced:f(k),codeFencedFence:v,codeFencedFenceInfo:b,codeFencedFenceMeta:S,codeFlowValue:ie,codeIndented:f(C),codeText:f(Z),codeTextData:ie,data:ie,definition:f(),definitionDestinationString:re,definitionLabelString:U,definitionTitleString:z,emphasis:f(),hardBreakEscape:f(G),hardBreakTrailing:f(G),htmlFlow:f(ee),htmlFlowData:ie,htmlText:f(ne),htmlTextData:ie,image:f(Y),label:de,labelText:me,lineEnding:ue,link:f(I),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:te,resourceDestinationString:M,resourceTitleString:_,resource:H,setextHeading:f(J),setextHeadingLineSequence:L,setextHeadingText:O,strong:f(),thematicBreak:f()}};ZD(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(j){let se={type:"root",children:[]};const ve={stack:[se],tokenStack:[],config:e,enter:c,exit:d,buffer:o,resume:p,data:n},Ae=[];let Xe=-1;for(;++Xe<j.length;)if(j[Xe][1].type==="listOrdered"||j[Xe][1].type==="listUnordered")if(j[Xe][0]==="enter")Ae.push(Xe);else{const On=Ae.pop();Xe=i(j,On,Xe)}for(Xe=-1;++Xe<j.length;){const On=e[j[Xe][0]];GD.call(On,j[Xe][1].type)&&On[j[Xe][1].type].call(Object.assign({sliceSerialize:j[Xe][2].sliceSerialize},ve),j[Xe][1])}if(ve.tokenStack.length>0){const On=ve.tokenStack[ve.tokenStack.length-1];(On[1]||FT).call(ve,void 0,On[0])}for(se.position={start:Bs(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Bs(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},Xe=-1;++Xe<e.transforms.length;)se=e.transforms[Xe](se)||se;return se}function i(j,se,ve){let Ae=se-1,Xe=-1,On=!1,Ne,it,lt,It;for(;++Ae<=ve;){const nt=j[Ae];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?Xe++:Xe--,It=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(Ne&&!It&&!Xe&&!lt&&(lt=Ae),It=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:It=void 0}if(!Xe&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||Xe===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(Ne){let Er=Ae;for(it=void 0;Er--;){const cr=j[Er];if(cr[1].type==="lineEnding"||cr[1].type==="lineEndingBlank"){if(cr[0]==="exit")continue;it&&(j[it][1].type="lineEndingBlank",On=!0),cr[1].type="lineEnding",it=Er}else if(!(cr[1].type==="linePrefix"||cr[1].type==="blockQuotePrefix"||cr[1].type==="blockQuotePrefixWhitespace"||cr[1].type==="blockQuoteMarker"||cr[1].type==="listItemIndent"))break}lt&&(!it||lt<it)&&(Ne._spread=!0),Ne.end=Object.assign({},it?j[it][1].start:nt[1].end),j.splice(it||Ae,0,["exit",Ne,nt[2]]),Ae++,ve++}if(nt[1].type==="listItemPrefix"){const Er={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};Ne=Er,j.splice(Ae,0,["enter",Er,nt[2]]),Ae++,ve++,lt=void 0,It=!0}}}return j[se][1]._spread=On,ve}function s(j,se){return ve;function ve(Ae){c.call(this,j(Ae),Ae),se&&se.call(this,Ae)}}function o(){this.stack.push({type:"fragment",children:[]})}function c(j,se,ve){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([se,ve||void 0]),j.position={start:Bs(se.start),end:void 0}}function f(j){return se;function se(ve){j&&j.call(this,ve),d.call(this,ve)}}function d(j,se){const ve=this.stack.pop(),Ae=this.tokenStack.pop();if(Ae)Ae[0].type!==j.type&&(se?se.call(this,j,Ae[0]):(Ae[1]||FT).call(this,j,Ae[0]));else throw new Error("Cannot close `"+j.type+"` ("+fu({start:j.start,end:j.end})+"): it’s not open");ve.position.end=Bs(j.end)}function p(){return bV(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(j){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function b(){const j=this.resume(),se=this.stack[this.stack.length-1];se.lang=j}function S(){const j=this.resume(),se=this.stack[this.stack.length-1];se.meta=j}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const j=this.resume(),se=this.stack[this.stack.length-1];se.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const j=this.resume(),se=this.stack[this.stack.length-1];se.value=j.replace(/(\r?\n|\r)$/g,"")}function U(j){const se=this.resume(),ve=this.stack[this.stack.length-1];ve.label=se,ve.identifier=ba(this.sliceSerialize(j)).toLowerCase()}function z(){const j=this.resume(),se=this.stack[this.stack.length-1];se.title=j}function re(){const j=this.resume(),se=this.stack[this.stack.length-1];se.url=j}function F(j){const se=this.stack[this.stack.length-1];if(!se.depth){const ve=this.sliceSerialize(j).length;se.depth=ve}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function L(j){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function ce(j){const ve=this.stack[this.stack.length-1].children;let Ae=ve[ve.length-1];(!Ae||Ae.type!=="text")&&(Ae=Pe(),Ae.position={start:Bs(j.start),end:void 0},ve.push(Ae)),this.stack.push(Ae)}function ie(j){const se=this.stack.pop();se.value+=this.sliceSerialize(j),se.position.end=Bs(j.end)}function ue(j){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=se.children[se.children.length-1];ve.position.end=Bs(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(se.type)&&(ce.call(this,j),ie.call(this,j))}function G(){this.data.atHardBreak=!0}function ee(){const j=this.resume(),se=this.stack[this.stack.length-1];se.value=j}function ne(){const j=this.resume(),se=this.stack[this.stack.length-1];se.value=j}function Z(){const j=this.resume(),se=this.stack[this.stack.length-1];se.value=j}function I(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=se,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 se=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=se,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function me(j){const se=this.sliceSerialize(j),ve=this.stack[this.stack.length-2];ve.label=yP(se),ve.identifier=ba(se).toLowerCase()}function de(){const j=this.stack[this.stack.length-1],se=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Ae=j.children;ve.children=Ae}else ve.alt=se}function M(){const j=this.resume(),se=this.stack[this.stack.length-1];se.url=j}function _(){const j=this.resume(),se=this.stack[this.stack.length-1];se.title=j}function H(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function te(j){const se=this.resume(),ve=this.stack[this.stack.length-1];ve.label=se,ve.identifier=ba(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function pe(j){this.data.characterReferenceType=j.type}function ge(j){const se=this.sliceSerialize(j),ve=this.data.characterReferenceType;let Ae;ve?(Ae=jD(se,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=_x(se);const Xe=this.stack[this.stack.length-1];Xe.value+=Ae}function _e(j){const se=this.stack.pop();se.position.end=Bs(j.end)}function Ge(j){ie.call(this,j);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(j)}function qe(j){ie.call(this,j);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(j)}function dt(){return{type:"blockquote",children:[]}}function Me(){return{type:"code",lang:null,meta:null,value:""}}function Ze(){return{type:"inlineCode",value:""}}function Mt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function zt(){return{type:"emphasis",children:[]}}function Mn(){return{type:"heading",depth:0,children:[]}}function Kn(){return{type:"break"}}function ar(){return{type:"html",value:""}}function Gr(){return{type:"image",title:null,url:"",alt:null}}function Zr(){return{type:"link",title:null,url:"",children:[]}}function Cr(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function Un(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function le(){return{type:"paragraph",children:[]}}function je(){return{type:"strong",children:[]}}function Pe(){return{type:"text",value:""}}function St(){return{type:"thematicBreak"}}}function Bs(t){return{line:t.line,column:t.column,offset:t.offset}}function ZD(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?ZD(t,r):wP(t,r)}}function wP(t,e){let n;for(n in e)if(GD.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 FT(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+fu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+fu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+fu({start:e.start,end:e.end})+") is still open")}function vP(t){const e=this;e.parser=n;function n(r){return xP(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function kP(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 CP(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
260
- `}]}function EP(t,e){const n=e.value?e.value+`
261
- `:"",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 TP(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function AP(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function MP(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=qa(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,c=t.footnoteCounts.get(r);c===void 0?(c=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,c+=1,t.footnoteCounts.set(r,c);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return t.patch(e,d),t.applyData(e,d)}function OP(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 _P(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function WD(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 o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function DP(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return WD(t,e);const i={src:qa(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 RP(t,e){const n={src:qa(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 NP(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 zP(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return WD(t,e);const i={href:qa(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 LP(t,e){const n={href:qa(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 IP(t,e,n){const r=t.all(e),i=n?BP(n):JD(e),s={},o=[];if(typeof e.checked=="boolean"){const p=r[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(i||c!==0||p.type!=="element"||p.tagName!=="p")&&o.push({type:"text",value:`
262
- `}),p.type==="element"&&p.tagName==="p"&&!i?o.push(...p.children):o.push(p)}const f=r[r.length-1];f&&(i||f.type!=="element"||f.tagName!=="p")&&o.push({type:"text",value:`
263
- `});const d={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,d),t.applyData(e,d)}function BP(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=JD(n[r])}return e}function JD(t){const e=t.spread;return e??t.children.length>1}function jP(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 o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.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 UP(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function HP(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function VP(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function PP(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=Tx(e.children[1]),f=DD(e.children[e.children.length-1]);c&&f&&(o.position={start:c,end:f}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function FP(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,c=o?o.length:e.children.length;let f=-1;const d=[];for(;++f<c;){const m=e.children[f],y={},b=o?o[f]:void 0;b&&(y.align=b);let S={type:"element",tagName:s,properties:y,children:[]};m&&(S.children=t.all(m),t.patch(m,S),S=t.applyData(m,S)),d.push(S)}const p={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,p),t.applyData(e,p)}function $P(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const $T=9,qT=32;function qP(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(YT(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(YT(e.slice(i),i>0,!1)),s.join("")}function YT(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===$T||s===qT;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===$T||s===qT;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function YP(t,e){const n={type:"text",value:qP(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function KP(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const GP={blockquote:kP,break:CP,code:EP,delete:TP,emphasis:AP,footnoteReference:MP,heading:OP,html:_P,imageReference:DP,image:RP,inlineCode:NP,linkReference:zP,link:LP,listItem:IP,list:jP,paragraph:UP,root:HP,strong:VP,table:PP,tableCell:$P,tableRow:FP,text:YP,thematicBreak:KP,toml:Jd,yaml:Jd,definition:Jd,footnoteDefinition:Jd};function Jd(){}const XD=-1,dm=0,hu=1,Cp=2,Nx=3,zx=4,Lx=5,Ix=6,QD=7,e2=8,KT=typeof self=="object"?self:globalThis,ZP=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case dm:case XD:return n(o,i);case hu:{const c=n([],i);for(const f of o)c.push(r(f));return c}case Cp:{const c=n({},i);for(const[f,d]of o)c[r(f)]=r(d);return c}case Nx:return n(new Date(o),i);case zx:{const{source:c,flags:f}=o;return n(new RegExp(c,f),i)}case Lx:{const c=n(new Map,i);for(const[f,d]of o)c.set(r(f),r(d));return c}case Ix:{const c=n(new Set,i);for(const f of o)c.add(r(f));return c}case QD:{const{name:c,message:f}=o;return n(new KT[c](f),i)}case e2:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:c}=new Uint8Array(o);return n(new DataView(c),o)}}return n(new KT[s](o),i)};return r},GT=t=>ZP(new Map,t)(0),Qo="",{toString:WP}={},{keys:JP}=Object,qc=t=>{const e=typeof t;if(e!=="object"||!t)return[dm,e];const n=WP.call(t).slice(8,-1);switch(n){case"Array":return[hu,Qo];case"Object":return[Cp,Qo];case"Date":return[Nx,Qo];case"RegExp":return[zx,Qo];case"Map":return[Lx,Qo];case"Set":return[Ix,Qo];case"DataView":return[hu,n]}return n.includes("Array")?[hu,n]:n.includes("Error")?[QD,n]:[Cp,n]},Xd=([t,e])=>t===dm&&(e==="function"||e==="symbol"),XP=(t,e,n,r)=>{const i=(o,c)=>{const f=r.push(o)-1;return n.set(c,f),f},s=o=>{if(n.has(o))return n.get(o);let[c,f]=qc(o);switch(c){case dm:{let p=o;switch(f){case"bigint":c=e2,p=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+f);p=null;break;case"undefined":return i([XD],o)}return i([c,p],o)}case hu:{if(f){let y=o;return f==="DataView"?y=new Uint8Array(o.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(o)),i([f,[...y]],o)}const p=[],m=i([c,p],o);for(const y of o)p.push(s(y));return m}case Cp:{if(f)switch(f){case"BigInt":return i([f,o.toString()],o);case"Boolean":case"Number":case"String":return i([f,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const p=[],m=i([c,p],o);for(const y of JP(o))(t||!Xd(qc(o[y])))&&p.push([s(y),s(o[y])]);return m}case Nx:return i([c,o.toISOString()],o);case zx:{const{source:p,flags:m}=o;return i([c,{source:p,flags:m}],o)}case Lx:{const p=[],m=i([c,p],o);for(const[y,b]of o)(t||!(Xd(qc(y))||Xd(qc(b))))&&p.push([s(y),s(b)]);return m}case Ix:{const p=[],m=i([c,p],o);for(const y of o)(t||!Xd(qc(y)))&&p.push(s(y));return m}}const{message:d}=o;return i([c,{name:f,message:d}],o)};return s},ZT=(t,{json:e,lossy:n}={})=>{const r=[];return XP(!(e||n),!!e,new Map,r)(t),r},Ep=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?GT(ZT(t,e)):structuredClone(t):(t,e)=>GT(ZT(t,e));function QP(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 eF(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function tF(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||QP,r=t.options.footnoteBackLabel||eF,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let f=-1;for(;++f<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[f]);if(!d)continue;const p=t.all(d),m=String(d.identifier).toUpperCase(),y=qa(m.toLowerCase());let b=0;const S=[],v=t.footnoteCounts.get(m);for(;v!==void 0&&++b<=v;){S.length>0&&S.push({type:"text",value:" "});let U=typeof n=="string"?n:n(f,b);typeof U=="string"&&(U={type:"text",value:U}),S.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,b),className:["data-footnote-backref"]},children:Array.isArray(U)?U:[U]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const U=k.children[k.children.length-1];U&&U.type==="text"?U.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...S)}else p.push(...S);const C={type:"element",tagName:"li",properties:{id:e+"fn-"+y},children:t.wrap(p,!0)};t.patch(d,C),c.push(C)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Ep(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
264
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
265
- `}]}}const t2=(function(t){if(t==null)return sF;if(typeof t=="function")return hm(t);if(typeof t=="object")return Array.isArray(t)?nF(t):rF(t);if(typeof t=="string")return iF(t);throw new Error("Expected function, string, or object as test")});function nF(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=t2(t[n]);return hm(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function rF(t){const e=t;return hm(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function iF(t){return hm(e);function e(n){return n&&n.type===t}}function hm(t){return e;function e(n,r,i){return!!(lF(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function sF(){return!0}function lF(t){return t!==null&&typeof t=="object"&&"type"in t}const n2=[],oF=!0,WT=!1,aF="skip";function cF(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=t2(i),o=r?-1:1;c(t,void 0,[])();function c(f,d,p){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=n2,S,v,k;if((!e||s(f,d,p[p.length-1]||void 0))&&(b=uF(n(f,p)),b[0]===WT))return b;if("children"in f&&f.children){const C=f;if(C.children&&b[0]!==aF)for(v=(r?C.children.length:-1)+o,k=p.concat(C);v>-1&&v<C.children.length;){const U=C.children[v];if(S=c(U,v,k)(),S[0]===WT)return S;v=typeof S[1]=="number"?S[1]:v+o}}return b}}}function uF(t){return Array.isArray(t)?t:typeof t=="number"?[oF,t]:t==null?n2:[t]}function r2(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),cF(t,s,c,i);function c(f,d){const p=d[d.length-1],m=p?p.children.indexOf(f):void 0;return o(f,m,p)}}const Gb={}.hasOwnProperty,fF={};function dF(t,e){const n=e||fF,r=new Map,i=new Map,s=new Map,o={...GP,...n.handlers},c={all:d,applyData:pF,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:f,options:n,patch:hF,wrap:gF};return r2(t,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?r:i,y=String(p.identifier).toUpperCase();m.has(y)||m.set(y,p)}}),c;function f(p,m){const y=p.type,b=c.handlers[y];if(Gb.call(c.handlers,y)&&b)return b(c,p,m);if(c.options.passThrough&&c.options.passThrough.includes(y)){if("children"in p){const{children:v,...k}=p,C=Ep(k);return C.children=c.all(p),C}return Ep(p)}return(c.options.unknownHandler||mF)(c,p,m)}function d(p){const m=[];if("children"in p){const y=p.children;let b=-1;for(;++b<y.length;){const S=c.one(y[b],p);if(S){if(b&&y[b-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=JT(S.value)),!Array.isArray(S)&&S.type==="element")){const v=S.children[0];v&&v.type==="text"&&(v.value=JT(v.value))}Array.isArray(S)?m.push(...S):m.push(S)}}}return m}}function hF(t,e){t.position&&(e.position=W9(t))}function pF(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 o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,Ep(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function mF(t,e){const n=e.data||{},r="value"in e&&!(Gb.call(n,"hProperties")||Gb.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 gF(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
266
- `});++r<t.length;)r&&n.push({type:"text",value:`
267
- `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
268
- `}),n}function JT(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function XT(t,e){const n=dF(t,e),r=n.one(t,void 0),i=tF(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
269
- `},i),s}function yF(t,e){return t&&"run"in t?async function(n,r){const i=XT(n,{file:r,...e});await t.run(i,r)}:function(n,r){return XT(n,{file:r,...t||e})}}function QT(t){if(t)throw t}var M0,eA;function bF(){if(eA)return M0;eA=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},s=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var p=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!m)return!1;var y;for(y in d);return typeof y>"u"||t.call(d,y)},o=function(d,p){n&&p.name==="__proto__"?n(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},c=function(d,p){if(p==="__proto__")if(t.call(d,p)){if(r)return r(d,p).value}else return;return d[p]};return M0=function f(){var d,p,m,y,b,S,v=arguments[0],k=1,C=arguments.length,U=!1;for(typeof v=="boolean"&&(U=v,v=arguments[1]||{},k=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});k<C;++k)if(d=arguments[k],d!=null)for(p in d)m=c(v,p),y=c(d,p),v!==y&&(U&&y&&(s(y)||(b=i(y)))?(b?(b=!1,S=m&&i(m)?m:[]):S=m&&s(m)?m:{},o(v,{name:p,newValue:f(U,S,y)})):typeof y<"u"&&o(v,{name:p,newValue:y}));return v},M0}var xF=bF();const O0=Lp(xF);function Zb(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 SF(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);c(null,...i);function c(f,...d){const p=t[++s];let m=-1;if(f){o(f);return}for(;++m<i.length;)(d[m]===null||d[m]===void 0)&&(d[m]=i[m]);i=d,p?wF(p,c)(...d):o(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function wF(t,e){let n;return r;function r(...o){const c=t.length>o.length;let f;c&&o.push(i);try{f=t.apply(this,o)}catch(d){const p=d;if(c&&n)throw p;return i(p)}c||(f&&f.then&&typeof f.then=="function"?f.then(s,i):f instanceof Error?i(f):s(f))}function i(o,...c){n||(n=!0,e(o,...c))}function s(o){i(null,o)}}const mi={basename:vF,dirname:kF,extname:CF,join:EF,sep:"/"};function vF(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ff(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 o=-1,c=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),c>-1&&(t.codePointAt(i)===e.codePointAt(c--)?c<0&&(r=i):(c=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function kF(t){if(ff(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 CF(t){ff(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const c=t.codePointAt(e);if(c===47){if(o){r=e+1;break}continue}n<0&&(o=!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 EF(...t){let e=-1,n;for(;++e<t.length;)ff(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":TF(n)}function TF(t){ff(t);const e=t.codePointAt(0)===47;let n=AF(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function AF(t,e){let n="",r=0,i=-1,s=0,o=-1,c,f;for(;++o<=t.length;){if(o<t.length)c=t.codePointAt(o);else{if(c===47)break;c=47}if(c===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else c===46&&s>-1?s++:s=-1}return n}function ff(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const MF={cwd:OF};function OF(){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 _F(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 DF(t)}function DF(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 _0=["history","path","basename","stem","extname","dirname"];class i2{constructor(e){let n;e?Wb(e)?n={path:e}:typeof e=="string"||RF(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":MF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<_0.length;){const s=_0[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)_0.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?mi.basename(this.path):void 0}set basename(e){R0(e,"basename"),D0(e,"basename"),this.path=mi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?mi.dirname(this.path):void 0}set dirname(e){tA(this.basename,"dirname"),this.path=mi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?mi.extname(this.path):void 0}set extname(e){if(D0(e,"extname"),tA(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=mi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Wb(e)&&(e=_F(e)),R0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?mi.basename(this.path,this.extname):void 0}set stem(e){R0(e,"stem"),D0(e,"stem"),this.path=mi.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 jn(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 D0(t,e){if(t&&t.includes(mi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+mi.sep+"`")}function R0(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function tA(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function RF(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const NF=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),zF={}.hasOwnProperty;class Bx extends NF{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=SF()}copy(){const e=new Bx;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?(L0("data",this.frozen),this.namespace[e]=n,this):zF.call(this.namespace,e)&&this.namespace[e]||void 0:e?(L0("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=Qd(e),r=this.parser||this.Parser;return N0("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),N0("process",this.parser||this.Parser),z0("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const c=Qd(e),f=r.parse(c);r.run(f,c,function(p,m,y){if(p||!m||!y)return d(p);const b=m,S=r.stringify(b,y);BF(S)?y.value=S:y.result=S,d(p,y)});function d(p,m){p||!m?o(p):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),N0("processSync",this.parser||this.Parser),z0("processSync",this.compiler||this.Compiler),this.process(e,i),rA("processSync","process",n),r;function i(s,o){n=!0,QT(s),r=o}}run(e,n,r){nA(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(o,c){const f=Qd(n);i.run(e,f,d);function d(p,m,y){const b=m||e;p?c(p):o?o(b):r(void 0,b,y)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),rA("runSync","run",r),i;function s(o,c){QT(o),i=c,r=!0}}stringify(e,n){this.freeze();const r=Qd(n),i=this.compiler||this.Compiler;return z0("stringify",i),nA(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(L0("use",this.frozen),e!=null)if(typeof e=="function")f(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(d){if(typeof d=="function")f(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...m]=d;f(p,m)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(d.plugins),d.settings&&(i.settings=O0(!0,i.settings,d.settings))}function c(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const m=d[p];s(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function f(d,p){let m=-1,y=-1;for(;++m<r.length;)if(r[m][0]===d){y=m;break}if(y===-1)r.push([d,...p]);else if(p.length>0){let[b,...S]=p;const v=r[y][1];Zb(v)&&Zb(b)&&(b=O0(!0,v,b)),r[y]=[d,b,...S]}}}}const LF=new Bx().freeze();function N0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function z0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function L0(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 nA(t){if(!Zb(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function rA(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Qd(t){return IF(t)?t:new i2(t)}function IF(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function BF(t){return typeof t=="string"||jF(t)}function jF(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const UF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",iA=[],sA={allowDangerousHtml:!0},HF=/^(https?|ircs?|mailto|xmpp)$/i,VF=[{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 PF(t){const e=FF(t),n=$F(t);return qF(e.runSync(e.parse(n),n),t)}function FF(t){const e=t.rehypePlugins||iA,n=t.remarkPlugins||iA,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...sA}:sA;return LF().use(vP).use(n).use(yF,r).use(e)}function $F(t){const e=t.children||"",n=new i2;return typeof e=="string"&&(n.value=e),n}function qF(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,c=e.unwrapDisallowed,f=e.urlTransform||YF;for(const p of VF)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+UF+p.id,void 0);return r2(t,d),tV(t,{Fragment:T.Fragment,components:i,ignoreInvalidStyle:!0,jsx:T.jsx,jsxs:T.jsxs,passKeys:!0,passNode:!0});function d(p,m,y){if(p.type==="raw"&&y&&typeof m=="number")return o?y.children.splice(m,1):y.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let b;for(b in E0)if(Object.hasOwn(E0,b)&&Object.hasOwn(p.properties,b)){const S=p.properties[b],v=E0[b];(v===null||v.includes(p.tagName))&&(p.properties[b]=f(String(S||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(p,m,y)),b&&y&&typeof m=="number")return c&&p.children?y.children.splice(m,1,...p.children):y.children.splice(m,1),m}}}function YF(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||HF.test(t.slice(0,e))?t:""}function s2(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function KF(){return s2("ann")}function GF(){return s2("msg")}const ZF={width:"5px",height:"5px",borderRadius:"50%",background:u1},WF=[0,.2,.4];function JF({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:o,capturedAnchor:c,onCapturedAnchorChange:f}){const[d,p]=R.useState([]),[m,y]=R.useState(""),b=R.useRef(null),S=R.useRef(null);R.useEffect(()=>{if(!t)return;const O=t.getMap(Xk),L=()=>{const J=[];O.forEach(ce=>{J.push(ce)}),J.sort((ce,ie)=>ce.timestamp-ie.timestamp||ce.id.localeCompare(ie.id)),p(J)};return O.observe(L),L(),()=>O.unobserve(L)},[t]);const v=R.useRef(!1);R.useEffect(()=>{var O;if(!i&&v.current){v.current=!1;return}v.current=!!i,(O=b.current)==null||O.scrollIntoView({behavior:"smooth"})},[d,i]),R.useEffect(()=>{var O;o&&((O=b.current)==null||O.scrollIntoView({behavior:"smooth"}))},[o]);const k=R.useCallback(()=>{if(!t||!m.trim())return;const O=t.getMap(Xk),L={id:GF(),author:"user",text:m.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};O.set(L.id,L),y(""),f(null)},[t,m,n,c,f]),C=R.useCallback(O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),k())},[k]),U=R.useCallback((O,L)=>{if(!(!e||L&&L!==n))try{const J=wp(e.state.doc,O.from),ce=wp(e.state.doc,O.to);e.chain().focus().setTextSelection({from:J,to:ce}).scrollIntoView().run()}catch(J){console.warn("[ChatPanel] Could not scroll to anchor:",J instanceof Error?J.message:J)}},[e,n]),z=O=>{if(!O)return null;const L=r.find(J=>J.id===O);return(L==null?void 0:L.fileName)??null},re=d.filter(O=>O.author==="claude"&&!O.read).length,F=R.useCallback(async()=>{try{await fetch("/api/chat",{method:"DELETE"})}catch(O){console.warn("[ChatPanel] Failed to clear chat:",O)}},[]);return T.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"#fafafa",flex:1,minHeight:0},children:[T.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e5e7eb",fontWeight:600,fontSize:"14px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Chat",T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[re>0&&T.jsx("span",{style:{background:"#6366f1",color:"white",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:re}),d.length>0&&T.jsx("button",{onClick:F,title:"Clear chat history","data-testid":"clear-chat-btn",style:{background:"none",border:"none",cursor:"pointer",color:"#9ca3af",fontSize:"13px",padding:"2px 4px",lineHeight:1},children:"Clear"})]})]}),T.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[d.length===0&&T.jsx("div",{style:{color:"#9ca3af",fontSize:"13px",textAlign:"center",marginTop:"24px"},children:"No messages yet. Select text and send a message to Claude."}),d.map(O=>T.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:O.author==="user"?"#eef2ff":"#ffffff",border:"1px solid "+(O.author==="user"?"#c7d2fe":"#e5e7eb"),fontSize:"13px"},children:[T.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[T.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:O.author==="claude"?"#6366f1":"#374151",textTransform:"uppercase"},children:O.author}),O.documentId&&T.jsx("span",{style:{fontSize:"10px",color:"#6b7280",background:"#f3f4f6",padding:"1px 6px",borderRadius:"4px"},children:z(O.documentId)??O.documentId}),T.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",marginLeft:"auto"},children:new Date(O.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),O.anchor&&T.jsxs("div",{onClick:()=>U(O.anchor,O.documentId),style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid #c7d2fe",background:"#f5f3ff",fontSize:"12px",color:"#4338ca",cursor:"pointer",borderRadius:"0 4px 4px 0",maxHeight:"60px",overflow:"hidden"},title:"Click to scroll to this text",children:[O.anchor.textSnapshot.slice(0,80),O.anchor.textSnapshot.length>80?"...":""]}),O.author==="claude"?T.jsx("div",{className:"chat-markdown",children:T.jsx(PF,{children:O.text})}):T.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:O.text})]},O.id)),i&&T.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:u1,display:"flex",alignItems:"center",gap:"8px"},children:[T.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:WF.map(O=>T.jsx("span",{style:{...ZF,animation:`tandem-typing-bounce 1.2s ease-in-out ${O}s infinite`}},O))}),T.jsx("span",{children:s??"Claude is thinking..."})]}),T.jsx("div",{ref:b})]}),c&&T.jsxs("div",{style:{padding:"4px 12px",background:"#eef2ff",borderTop:"1px solid #c7d2fe",fontSize:"11px",color:"#4338ca",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[T.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),T.jsx("button",{onClick:()=>f(null),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",fontSize:"14px"},children:"x"})]}),T.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid #e5e7eb",display:"flex",gap:"8px"},children:[T.jsx("textarea",{ref:S,value:m,onChange:O=>y(O.target.value),onKeyDown:C,placeholder:"Message Claude...",rows:2,style:{flex:1,padding:"8px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"13px",resize:"none",outline:"none",fontFamily:"inherit"}}),T.jsx("button",{onClick:k,disabled:!m.trim(),style:{padding:"8px 12px",background:m.trim()?"#6366f1":"#d1d5db",color:"white",border:"none",borderRadius:"6px",cursor:m.trim()?"pointer":"default",fontSize:"13px",fontWeight:500,alignSelf:"flex-end"},children:"Send"})]}),T.jsx("style",{children:`
270
- @keyframes tandem-typing-bounce {
271
- 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
272
- 30% { transform: translateY(-4px); opacity: 1; }
273
- }
274
- `})]})}const XF=[{value:"all",label:"All",title:"Show all annotations immediately"},{value:"urgent-only",label:"Urgent",title:"Show flags, questions, and explicitly urgent annotations"},{value:"paused",label:"Paused",title:"Hold all new annotations"}],QF=2e3;function e$({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:o,documentCount:c=0,interruptionMode:f,onModeChange:d,heldCount:p,widthMode:m,onToggleWidthMode:y}){const[b,S]=R.useState(()=>{var ie;try{return((ie=localStorage.getItem(P0))==null?void 0:ie.trim())||Jc}catch{return Jc}}),[v,k]=R.useState(b),C=()=>{const ie=v.trim()||Jc;S(ie),k(ie);try{localStorage.setItem(P0,ie)}catch{}},[U,z]=R.useState(!1),[re,F]=R.useState(0),O=R.useRef(t);R.useEffect(()=>{const ie=O.current;if(O.current=t,t&&!ie){z(!0);const ue=setTimeout(()=>z(!1),QF);return()=>clearTimeout(ue)}},[t]),R.useEffect(()=>{if(r==null){F(0);return}F(Math.floor((Date.now()-r)/1e3));const ie=setInterval(()=>{F(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(ie)},[r]);const L=e==="connecting",J=t?"#22c55e":L?"#eab308":"#ef4444";let ce;if(U)ce="Reconnected";else if(e==="connected")ce="Connected";else if(e==="connecting"){const ie=["Reconnecting…"];if(n>0||re>0){const ue=[];n>0&&ue.push(`attempt ${n}`),re>0&&ue.push(`${re}s`),ie.push(`(${ue.join(", ")})`)}ce=ie.join(" ")}else ce="Disconnected — check that the server is running";return T.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 16px",height:"28px",borderTop:"1px solid #e5e7eb",background:"#fafafa",fontSize:"12px",color:"#6b7280",userSelect:"none"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[T.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:J,display:"inline-block",animation:L?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),T.jsx("span",{children:ce}),c>0&&T.jsxs("span",{style:{color:"#9ca3af"},children:[c," doc",c!==1?"s":""," open"]})]}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[p>0&&T.jsxs("span",{style:{padding:"1px 6px",fontSize:"10px",fontWeight:600,color:"#92400e",background:"#fef3c7",borderRadius:"9999px"},children:[p," held"]}),T.jsx("div",{style:{display:"flex",border:"1px solid #d1d5db",borderRadius:"4px",overflow:"hidden"},children:XF.map(({value:ie,label:ue,title:G})=>T.jsx("button",{title:G,onClick:()=>d(ie),style:{padding:"1px 8px",fontSize:"11px",border:"none",cursor:"pointer",background:f===ie?"#6366f1":"transparent",color:f===ie?"#fff":"#6b7280",fontWeight:f===ie?600:400,borderRight:ie!=="paused"?"1px solid #d1d5db":"none"},children:ue},ie))}),T.jsx("button",{title:m==="reading"?"Switch to full width layout":"Switch to narrow reading width layout","aria-label":"Toggle reading width","aria-pressed":m==="reading",onClick:y,style:{padding:"1px 8px",fontSize:"11px",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",background:m==="reading"?"#6366f1":"transparent",color:m==="reading"?"#fff":"#6b7280",fontWeight:m==="reading"?600:400},children:"Reading Width"})]}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"#9ca3af"},children:[T.jsx("span",{children:"You:"}),T.jsx("input",{"data-testid":"user-name-input",type:"text",value:v,onChange:ie=>k(ie.target.value),onBlur:C,onKeyDown:ie=>{ie.key==="Enter"&&ie.currentTarget.blur(),ie.key==="Escape"&&(k(b),ie.currentTarget.blur())},"aria-label":"Display name",title:"Your display name (updates on next tab switch or refresh)",maxLength:40,style:{background:"transparent",border:"none",borderBottom:"1px solid #e5e7eb",color:"#6b7280",fontSize:"11px",width:"80px",outline:"none",padding:"0 2px"}})]}),o&&T.jsx("span",{style:{padding:"1px 8px",fontSize:"11px",fontWeight:600,color:"#92400e",background:"#fef3c7",borderRadius:"9999px",border:"1px solid #fde68a"},children:"Review Only"}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[T.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:u1,opacity:s?1:.4,display:"inline-block",transition:"opacity 0.3s ease",animation:s?"tandem-status-pulse 1.5s ease-in-out infinite":"none"}}),T.jsx("span",{style:{transition:"color 0.3s ease",color:s?"#4b5563":"#9ca3af"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),T.jsx("style",{children:`
275
- @keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
276
- @keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
277
- `})]})}function vn({label:t,ariaLabel:e,shortcut:n,disabled:r,active:i,onMouseDown:s,onClick:o,style:c}){let f="1px solid #e5e7eb",d="#fff",p="#374151";r?(d="#f9fafb",p="#9ca3af"):i&&(f="1px solid #818cf8",d="#eef2ff",p="#4338ca");const m=e??(typeof t=="string"?t:void 0),y=m??"";return T.jsx("button",{type:"button",disabled:r,title:n?`${y} (${n})`:y,"aria-label":m,onMouseDown:s,onClick:o,style:{padding:"4px 10px",fontSize:"13px",borderRadius:"4px",cursor:r?"not-allowed":"pointer",...c,border:f,background:d,color:p},children:t})}function I0({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:o,submitLabel:c,borderColor:f,canSubmit:d,secondaryInput:p}){return T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[T.jsx("input",{ref:t,type:"text",value:e,onChange:m=>n(m.target.value),onKeyDown:r,placeholder:o,style:{padding:"3px 8px",fontSize:"13px",border:`1px solid ${f}`,borderRadius:"4px",outline:"none",width:"200px"}}),p,T.jsx(vn,{label:c,disabled:!d,onClick:i}),T.jsx(vn,{label:"Cancel",disabled:!1,onClick:s})]})}const t$=T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[T.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),T.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),T.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),T.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),T.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),T.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),n$=T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[T.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),T.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),T.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),T.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),T.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),T.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),r$=T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[T.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),T.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),T.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),T.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),i$=T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[T.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),T.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),s$=T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[T.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),T.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),l2=[1,2,3],l$={1:700,2:600,3:500};function o$(t){for(const e of l2)if(t.isActive("heading",{level:e}))return e;return null}function Xi(t){return e=>{e.preventDefault(),t()}}function a$({editor:t,disabled:e}){var S,v;const[,n]=R.useState(0),[r,i]=R.useState(!1),s=R.useRef(null);if(R.useEffect(()=>{if(!t)return;const k=()=>{t.isDestroyed||n(C=>C+1)};return t.on("transaction",k),()=>{t.off("transaction",k)}},[t]),R.useEffect(()=>{if(!r)return;function k(C){s.current&&!s.current.contains(C.target)&&i(!1)}return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[r]),!t)return null;const c=!t.isEditable||!!e,f=bi.getState(t.state),d=!c&&(((S=f==null?void 0:f.undoManager)==null?void 0:S.undoStack.length)??0)>0,p=!c&&(((v=f==null?void 0:f.undoManager)==null?void 0:v.redoStack.length)??0)>0,m=o$(t);function y(k){return C=>{C.preventDefault(),!(!t||t.isDestroyed)&&(t.chain().focus().toggleHeading({level:k}).run(),i(!1))}}const b=m?`H${m}`:"H";return T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[T.jsx(vn,{label:i$,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!d,onMouseDown:Xi(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),T.jsx(vn,{label:s$,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!p,onMouseDown:Xi(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),T.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),T.jsx(vn,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Xi(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),T.jsx(vn,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Xi(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),T.jsx(vn,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Xi(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),T.jsx(vn,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Xi(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),T.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:k=>{k.key==="Escape"&&i(!1)},children:[T.jsx(vn,{label:b,disabled:c,active:m!==null,onMouseDown:k=>{k.preventDefault(),i(C=>!C)},style:{minWidth:"30px"}}),r&&T.jsx("div",{role:"menu","aria-label":"Heading level",style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"4px",display:"flex",flexDirection:"column",gap:"2px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:l2.map(k=>T.jsxs("button",{type:"button",role:"menuitem",onMouseDown:y(k),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===k?"#eef2ff":"transparent",color:m===k?"#4338ca":"#374151",cursor:"pointer",textAlign:"left",fontWeight:l$[k],whiteSpace:"nowrap"},children:["Heading ",k]},k))})]}),T.jsx("div",{style:{width:"1px",height:"16px",background:"#e5e7eb",margin:"0 2px"}}),T.jsx(vn,{label:t$,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Xi(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),T.jsx(vn,{label:n$,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Xi(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),T.jsx(vn,{label:r$,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Xi(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}const c$=[{value:"yellow",label:"Yellow"},{value:"red",label:"Red"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"purple",label:"Purple"}];function u$({editor:t,ydoc:e}){const[n,r]=R.useState(!1),[i,s]=R.useState("yellow"),[o,c]=R.useState(!1),[f,d]=R.useState("idle"),[p,m]=R.useState(""),[y,b]=R.useState(""),S=R.useRef(null),v=R.useRef(null),k=R.useRef(null),C=R.useRef(null),U=R.useRef(null);R.useEffect(()=>{if(!t)return;const de=t;function M(){const{from:_,to:H}=de.state.selection,A=_!==H;r(te=>te===A?te:A)}return t.on("selectionUpdate",M),()=>{t.off("selectionUpdate",M)}},[t]),R.useEffect(()=>{if(f==="idle")return;const M={comment:v,suggest:k,askClaude:C}[f];M.current&&M.current.focus()},[f]),R.useEffect(()=>{if(!o)return;function de(M){U.current&&!U.current.contains(M.target)&&c(!1)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[o]);function z(de,M,_){if(!t||!e)return;const H=S.current??t.state.selection,{from:A,to:te}=H;if(A===te)return;const pe=vp(t.state.doc,Si(A)),ge=vp(t.state.doc,Si(te)),_e=KF(),Ge={id:_e,author:"user",type:de,range:{from:pe,to:ge},content:M,status:"pending",timestamp:Date.now(),..._?{color:_}:{}};e.getMap(oa).set(_e,Ge),S.current=null}function re(){if(!t)return;const{from:de,to:M}=t.state.selection;S.current={from:de,to:M}}function F(){S.current=null,t==null||t.chain().focus().run()}const O=f!=="idle";function L(de){de.preventDefault(),z("highlight","",i)}function J(de){de.preventDefault(),c(M=>!M)}function ce(de){s(de),c(!1)}const ie=R.useCallback(de=>M=>{M.preventDefault(),re(),d(de),m(""),b("")},[t]),ue=R.useMemo(()=>ie("comment"),[ie]),G=R.useMemo(()=>ie("suggest"),[ie]),ee=R.useMemo(()=>ie("askClaude"),[ie]);function ne(){d("idle"),m(""),b(""),F()}function Z(){if(!p.trim()){ne();return}switch(f){case"comment":z("comment",p.trim());break;case"suggest":z("suggestion",JSON.stringify({newText:p.trim(),reason:y.trim()}));break;case"askClaude":z("question",p.trim());break}d("idle"),m(""),b(""),t==null||t.chain().focus().run()}function I(de){de.key==="Enter"?(de.preventDefault(),Z()):de.key==="Escape"&&ne()}function Y(de){de.preventDefault(),z("flag","")}const me=t&&e&&n;return T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",userSelect:"none"},children:[T.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"#6366f1",letterSpacing:"-0.02em"},children:"Tandem"}),T.jsx("div",{style:{width:"1px",height:"20px",background:"#e5e7eb",margin:"0 8px"}}),T.jsx(a$,{editor:t,disabled:O}),T.jsx("div",{style:{width:"1px",height:"20px",background:"#e5e7eb",margin:"0 8px"}}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[T.jsx(vn,{label:"Highlight",disabled:!me||O,onMouseDown:L,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),T.jsx("button",{disabled:!me||O,onMouseDown:J,title:"Choose highlight color",style:{padding:"4px 6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"0 4px 4px 0",background:!me||O?"#f9fafb":"#fff",cursor:!me||O?"not-allowed":"pointer",display:"flex",alignItems:"center"},children:T.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:bu[i],border:"1px solid rgba(0,0,0,0.15)"}})}),o&&T.jsx("div",{ref:U,style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"6px",display:"flex",gap:"4px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:c$.map(({value:de,label:M})=>T.jsx("button",{title:M,onClick:()=>ce(de),style:{width:"24px",height:"24px",borderRadius:"4px",border:de===i?"2px solid #374151":"1px solid rgba(0,0,0,0.15)",background:bu[de],cursor:"pointer",padding:0}},de))})]}),T.jsx(vn,{label:"Comment",disabled:!me||O,onMouseDown:ue}),f==="comment"&&T.jsx(I0,{inputRef:v,value:p,onChange:m,onKeyDown:I,onSubmit:Z,onCancel:ne,placeholder:"Add a comment...",submitLabel:"Add",borderColor:"#3b82f6",canSubmit:!!p.trim()}),T.jsx(vn,{label:"Suggest",disabled:!me||O,onMouseDown:G}),f==="suggest"&&T.jsx(I0,{inputRef:k,value:p,onChange:m,onKeyDown:I,onSubmit:Z,onCancel:ne,placeholder:"Replacement text...",submitLabel:"Suggest",borderColor:"#8b5cf6",canSubmit:!!p.trim(),secondaryInput:T.jsx("input",{type:"text",value:y,onChange:de=>b(de.target.value),onKeyDown:I,placeholder:"Reason (optional)",style:{padding:"3px 8px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",outline:"none",width:"140px"}})}),T.jsx(vn,{label:"Flag",disabled:!me||O,onMouseDown:Y}),T.jsx(vn,{label:"Ask Claude",shortcut:"Ctrl+Shift+A",disabled:!me||O,onMouseDown:ee}),f==="askClaude"&&T.jsx(I0,{inputRef:C,value:p,onChange:m,onKeyDown:I,onSubmit:Z,onCancel:ne,placeholder:"Ask about this text...",submitLabel:"Ask",borderColor:"#6366f1",canSubmit:!!p.trim()}),T.jsx("div",{style:{flex:1}}),T.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"Review Mode"})]})}function f$(t,e,n=tz){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function d$(){try{const t=localStorage.getItem(f1);if(!t)return[];const e=JSON.parse(t);return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}catch{return[]}}function h$(t){try{localStorage.setItem(f1,JSON.stringify(t))}catch{}}function p$(){try{localStorage.removeItem(f1)}catch{}}function m$({onClose:t}){const[e,n]=R.useState("path"),[r,i]=R.useState(""),[s,o]=R.useState(null),[c,f]=R.useState(!1),[d,p]=R.useState(!1),m=R.useRef(null),[y,b]=R.useState(d$),S=R.useCallback(F=>{b(O=>{const L=f$(O,F);return h$(L),L})},[]),v=R.useCallback(()=>{p$(),b([])},[]),k=R.useCallback(async F=>{if(!c){o(null),f(!0);try{const O=await fetch(`${qu}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:F})}),L=await O.json();if(!O.ok){o(L.message??"Failed to open file");return}S(F),t()}catch(O){console.error("FileOpenDialog: path open failed",O),O instanceof SyntaxError?o("Server returned an unexpected response"):O instanceof TypeError?o("Unexpected response format"):o("Cannot reach server. Is it running?")}finally{f(!1)}}},[c,t,S]),C=R.useCallback(()=>{r.trim()&&k(r.trim())},[r,k]),U=R.useCallback(async F=>{if(!c){o(null),f(!0);try{const O=await kD(F),L=await fetch(`${qu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:F.name,content:O})}),J=await L.json();if(!L.ok){o(J.message??"Failed to upload file");return}t()}catch(O){console.error("FileOpenDialog: upload failed",O),O instanceof SyntaxError?o("Server returned an unexpected response"):O instanceof TypeError?o("Unexpected response format"):o("Cannot reach server. Is it running?")}finally{f(!1)}}},[c,t]),z=R.useCallback(F=>{F.preventDefault(),p(!1);const O=F.dataTransfer.files[0];O&&U(O)},[U]),re=R.useCallback(F=>{var L;const O=(L=F.target.files)==null?void 0:L[0];O&&U(O)},[U]);return T.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:F=>{F.target===F.currentTarget&&t()},onKeyDown:F=>{F.key==="Escape"&&t()},children:T.jsxs("div",{style:{background:"#fff",borderRadius:"8px",boxShadow:"0 8px 30px rgba(0,0,0,0.15)",width:"440px",padding:"20px"},"data-testid":"file-open-dialog",children:[T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[T.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"#111827"},children:"Open File"}),T.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"#9ca3af"},children:"×"})]}),T.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[T.jsx("button",{onClick:()=>n("path"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"4px",cursor:"pointer",background:e==="path"?"#6366f1":"#fff",color:e==="path"?"#fff":"#374151"},children:"File Path"}),T.jsx("button",{onClick:()=>n("upload"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"4px",cursor:"pointer",background:e==="upload"?"#6366f1":"#fff",color:e==="upload"?"#fff":"#374151"},children:"Upload"})]}),e==="path"?T.jsxs("div",{children:[T.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:F=>i(F.target.value),onKeyDown:F=>{F.key==="Enter"&&C()},style:{width:"100%",padding:"8px 10px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",boxSizing:"border-box"},"data-testid":"file-path-input"}),T.jsx("button",{onClick:C,disabled:c||!r.trim(),style:{marginTop:"10px",width:"100%",padding:"8px",fontSize:"13px",fontWeight:500,border:"none",borderRadius:"4px",cursor:c?"wait":"pointer",background:c?"#9ca3af":"#6366f1",color:"#fff",opacity:r.trim()?1:.5},"data-testid":"file-open-submit",children:c?"Opening...":"Open"}),y.length>0&&T.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[T.jsx("span",{style:{fontSize:"11px",color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),T.jsx("button",{"data-testid":"clear-recent-files",onClick:v,type:"button",style:{background:"none",border:"none",color:"#9ca3af",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),T.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:y.map((F,O)=>{const L=F.split(/[/\\]/),J=L.pop()??F,ce=L.join("/")||"/";return T.jsxs("button",{type:"button","data-testid":`recent-file-${O}`,onClick:()=>{i(F),k(F)},style:{background:"none",border:"none",padding:"6px 8px",borderRadius:"4px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"1px"},onMouseEnter:ie=>{ie.currentTarget.style.background="#f3f4f6"},onMouseLeave:ie=>{ie.currentTarget.style.background="transparent"},children:[T.jsx("span",{style:{fontSize:"13px",color:"#111827"},children:J}),T.jsx("span",{style:{fontSize:"11px",color:"#9ca3af",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:ce})]},F)})})]})]}):T.jsxs("div",{onDragOver:F=>{F.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:z,onClick:()=>{var F;return(F=m.current)==null?void 0:F.click()},style:{border:`2px dashed ${d?"#6366f1":"#d1d5db"}`,borderRadius:"6px",padding:"32px 16px",textAlign:"center",cursor:c?"wait":"pointer",background:d?"#eef2ff":"#f9fafb",transition:"border-color 0.15s, background 0.15s"},"data-testid":"file-upload-zone",children:[T.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:re,style:{display:"none"}}),T.jsx("div",{style:{fontSize:"13px",color:"#6b7280"},children:c?"Uploading...":"Drop a file here or click to browse"}),T.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&T.jsx("div",{style:{marginTop:"10px",padding:"8px 10px",fontSize:"12px",color:"#991b1b",background:"#fef2f2",borderRadius:"4px",border:"1px solid #fecaca"},"data-testid":"file-open-error",children:s})]})})}function g$(t){const[e,n]=R.useState(!1),r=R.useRef(0),i=R.useRef(null);return R.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,o=s.getXmlFragment("default"),c=s.getMap(th);let f=!1;const d=setTimeout(()=>{f=!0,i.current=c.get(Qk)??0,r.current=0,n(!1)},500),p=()=>{f&&(r.current++,n(!0))};o.observeDeep(p);const m=()=>{if(!f)return;const y=c.get(Qk);y!==void 0&&y!==i.current&&(i.current=y,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(d),o.unobserveDeep(p),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const y$={md:"M",txt:"T",html:"H",docx:"W"};function b$({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:o,onDrop:c,onDragEnd:f,onDragLeave:d,dropIndicator:p,onKeyDown:m}){const y=g$(t);return T.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=>o(b,t.id),onDrop:b=>c(b,t.id),onDragEnd:f,onDragLeave:d,onKeyDown:b=>m(b,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"#fff":"transparent",color:e?"#111827":"#6b7280",borderTop:e?"2px solid #6366f1":"2px solid transparent",borderBottom:e?"1px solid #fff":"1px solid transparent",borderLeft:p==="left"?"2px solid #6366f1":"2px solid transparent",borderRight:p==="right"?"2px solid #6366f1":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[y&&T.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"#f59e0b",fontSize:"10px"},children:"●"}),T.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"#6366f1":"#9ca3af",width:"14px",textAlign:"center"},children:y$[t.format]||"?"}),T.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&&T.jsx("span",{style:{fontSize:"9px",color:"#92400e",background:"#fef3c7",padding:"0 3px",borderRadius:"2px"},children:"RO"}),T.jsx("button",{onClick:b=>{b.stopPropagation(),r(t.id)},onDragOver:b=>{b.stopPropagation(),b.preventDefault()},onDrop:b=>{b.stopPropagation(),b.preventDefault()},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",lineHeight:1,color:"#9ca3af",padding:"0 2px",borderRadius:"2px"},onMouseEnter:b=>b.currentTarget.style.color="#ef4444",onMouseLeave:b=>b.currentTarget.style.color="#9ca3af",title:"Close document",children:"×"})]})}const Jb="tandem-tab-scroll-hide";function x$(){return T.jsx("style",{children:`
278
- .${Jb} {
279
- scrollbar-width: none;
280
- -ms-overflow-style: none;
281
- }
282
- .${Jb}::-webkit-scrollbar {
283
- display: none;
284
- }
285
- `})}const o2={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",minWidth:"28px",background:"linear-gradient(to right, #f3f4f6 70%, transparent)",border:"none",cursor:"pointer",fontSize:"12px",color:"#6b7280",padding:0,zIndex:1},S$={...o2,background:"linear-gradient(to left, #f3f4f6 70%, transparent)"};function w$({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i}){const[s,o]=R.useState(!1),c=R.useRef(new Set);R.useEffect(()=>{const ee=new Set(t.map(ne=>ne.id));for(const ne of c.current)ee.has(ne)||c.current.delete(ne)},[t]);const f=R.useCallback(ee=>{c.current.has(ee)||(c.current.add(ee),r(ee))},[r]),d=R.useRef(null),[p,m]=R.useState(!1),[y,b]=R.useState(!1),[S,v]=R.useState(null),[k,C]=R.useState(null);function U(){v(null),C(null)}const z=R.useCallback(()=>{const ee=d.current;ee&&(m(ee.scrollLeft>0),b(ee.scrollLeft+ee.clientWidth<ee.scrollWidth-1))},[]);R.useEffect(()=>{const ee=d.current;if(!ee)return;z(),ee.addEventListener("scroll",z,{passive:!0});const ne=new ResizeObserver(z);return ne.observe(ee),()=>{ee.removeEventListener("scroll",z),ne.disconnect()}},[z]),R.useEffect(()=>{z()},[t.length,z]),R.useEffect(()=>{if(!e||!d.current)return;const ee=d.current.querySelector(`[data-testid="tab-${e}"]`);ee&&ee.scrollIntoView({inline:"nearest",block:"nearest",behavior:"smooth"})},[e]),R.useEffect(()=>{U()},[t.length]);const re=R.useCallback((ee,ne)=>{v(ne),ee.dataTransfer.setData("text/plain",ne),ee.dataTransfer.effectAllowed="move"},[]),F=R.useCallback((ee,ne)=>{if(ee.preventDefault(),!S||S===ne){C(null);return}const Z=ee.currentTarget.getBoundingClientRect(),I=Z.left+Z.width/2,Y=ee.clientX<I?"left":"right";C({id:ne,side:Y})},[S]),O=R.useCallback((ee,ne)=>{ee.preventDefault();const Z=ee.dataTransfer.getData("text/plain");if(Z&&Z!==ne&&i){const I=ee.currentTarget.getBoundingClientRect(),Y=I.left+I.width/2,me=ee.clientX<Y?"left":"right";i(Z,ne,me)}U()},[i]),L=R.useCallback(()=>{U()},[]),J=R.useCallback(()=>{C(null)},[]),ce=R.useCallback((ee,ne)=>{if(!ee.altKey||!i||ee.key!=="ArrowLeft"&&ee.key!=="ArrowRight")return;ee.preventDefault();const Z=t.findIndex(I=>I.id===ne);Z!==-1&&(ee.key==="ArrowLeft"&&Z>0?i(ne,t[Z-1].id):ee.key==="ArrowRight"&&Z<t.length-1&&i(t[Z+1].id,ne))},[t,i]),ie=R.useCallback(()=>{var ee;(ee=d.current)==null||ee.scrollBy({left:-150,behavior:"smooth"})},[]),ue=R.useCallback(()=>{var ee;(ee=d.current)==null||ee.scrollBy({left:150,behavior:"smooth"})},[]),G=t.length<=1;return T.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"#f3f4f6",borderBottom:"1px solid #e5e7eb",minHeight:"32px"},children:[T.jsx(x$,{}),p&&T.jsx("button",{"data-testid":"tab-scroll-left",onClick:ie,style:o2,title:"Scroll tabs left",children:"◀"}),T.jsx("div",{ref:d,"data-testid":"tab-scroll-container",className:Jb,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",padding:"0 4px"},children:t.map(ee=>T.jsx(b$,{tab:ee,isActive:ee.id===e,onSwitch:n,onClose:f,draggable:!G,onDragStart:re,onDragOver:F,onDrop:O,onDragEnd:L,onDragLeave:J,dropIndicator:(k==null?void 0:k.id)===ee.id?k.side:null,onKeyDown:ce},ee.id))}),y&&T.jsx("button",{"data-testid":"tab-scroll-right",onClick:ue,style:S$,title:"Scroll tabs right",children:"▶"}),T.jsx("button",{onClick:()=>o(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid #d1d5db",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"#6b7280",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:ee=>{ee.currentTarget.style.color="#6366f1",ee.currentTarget.style.borderColor="#6366f1"},onMouseLeave:ee=>{ee.currentTarget.style.color="#6b7280",ee.currentTarget.style.borderColor="#d1d5db"},children:"+"}),s&&T.jsx(m$,{onClose:()=>o(!1)})]})}function v$({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return T.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:T.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"32px 40px",maxWidth:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)",textAlign:"center"},onClick:s=>s.stopPropagation(),children:[T.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),T.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"#111827"},children:"Review Complete"}),T.jsx("p",{style:{margin:"0 0 20px",color:"#6b7280",fontSize:"14px"},children:"All annotations have been resolved."}),T.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[T.jsxs("div",{children:[T.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"#16a34a"},children:t}),T.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Accepted"})]}),T.jsx("div",{style:{width:"1px",background:"#e5e7eb"}}),T.jsxs("div",{children:[T.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"#dc2626"},children:e}),T.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Dismissed"})]}),T.jsx("div",{style:{width:"1px",background:"#e5e7eb"}}),T.jsxs("div",{children:[T.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"#6366f1"},children:[i,"%"]}),T.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Accept rate"})]})]}),T.jsx("button",{onClick:r,style:{padding:"8px 24px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",background:"#6366f1",color:"white",cursor:"pointer"},children:"Done"})]})})}const k$=[{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:"Dismiss annotation"},{keys:["Z"],description:"Undo last accept/dismiss"},{keys:["E"],description:"Examine (scroll & exit)"},{keys:["Escape"],description:"Exit review mode"}]},{title:"Chat",rows:[{keys:["Enter"],description:"Send message"}]},{title:"General",rows:[{keys:["?"],description:"Show / hide this help"}]}];function C$({open:t,onClose:e}){return R.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?T.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:T.jsxs("div",{style:{backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:"8px",boxShadow:"0 8px 32px rgba(0,0,0,0.18)",padding:"24px 28px 20px",width:"480px",maxWidth:"90vw",maxHeight:"80vh",overflowY:"auto",position:"relative"},onClick:n=>n.stopPropagation(),children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[T.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"#1a1a1a"},children:"Keyboard Shortcuts"}),T.jsx("button",{type:"button",onClick:e,"aria-label":"Close help","data-testid":"help-modal-close",style:{background:"none",border:"none",cursor:"pointer",fontSize:"18px",color:"#666",lineHeight:1,padding:"2px 6px",borderRadius:"4px"},children:"✕"})]}),k$.map(n=>T.jsxs("div",{style:{marginBottom:"18px"},children:[T.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"#888",marginBottom:"6px"},children:n.title}),T.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:T.jsx("tbody",{children:n.rows.map(r=>T.jsxs("tr",{children:[T.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:T.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>T.jsxs("span",{children:[T.jsx("kbd",{style:{display:"inline-block",padding:"1px 6px",fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"#f5f5f5",border:"1px solid #d4d4d4",borderBottom:"2px solid #bbb",borderRadius:"4px",color:"#333",lineHeight:"1.5"},children:i}),s<r.keys.length-1&&T.jsx("span",{style:{color:"#aaa",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),T.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"#444",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),T.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid #f0f0f0",fontSize:"11px",color:"#aaa",textAlign:"center"},children:["Press"," ",T.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"#f5f5f5",border:"1px solid #ddd",borderRadius:"3px"},children:"?"})," ","or"," ",T.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"#f5f5f5",border:"1px solid #ddd",borderRadius:"3px"},children:"Esc"})," ","to close"]})]})}):null}const lA="tandem:reviewOnlyBannerDismissed";function E$({visible:t,documentId:e}){const[n,r]=R.useState(()=>{try{return localStorage.getItem(lA)==="true"}catch{return!1}}),[i,s]=R.useState(!1),[o,c]=R.useState(null);if(!t||n)return null;async function f(){if(!(!e||i)){s(!0),c(null);try{const d=await fetch(`${qu}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!d.ok){const p=await d.json().catch(()=>null);c((p==null?void 0:p.message)??`Conversion failed (HTTP ${d.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return T.jsxs("div",{"data-testid":"review-only-banner",style:{padding:"8px 16px",backgroundColor:"#eff6ff",borderBottom:"1px solid #bfdbfe",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"13px",color:"#1e40af",gap:"12px"},children:[T.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[o&&T.jsx("span",{style:{color:"#dc2626",fontSize:"12px",maxWidth:"200px"},children:o}),e&&T.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:f,disabled:i,style:{background:"#2563eb",border:"none",color:"white",cursor:i?"default":"pointer",fontWeight:500,fontSize:"12px",padding:"4px 10px",borderRadius:"4px",whiteSpace:"nowrap",opacity:i?.6:1},children:i?"Converting…":"Convert to Markdown"}),T.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(lA,"true")}catch{}r(!0)},style:{background:"none",border:"none",color:"#1e40af",cursor:"pointer",fontWeight:500,fontSize:"13px",padding:"2px 8px",whiteSpace:"nowrap"},children:"Dismiss"})]})]})}const T$={error:"#ef4444",warning:"#f59e0b",info:"#6366f1"};function A$({toasts:t,onDismiss:e}){return t.length===0?null:T.jsxs(T.Fragment,{children:[T.jsx("style",{children:`
286
- @keyframes tandem-toast-slide-in {
287
- from {
288
- opacity: 0;
289
- transform: translateX(40px);
290
- }
291
- to {
292
- opacity: 1;
293
- transform: translateX(0);
294
- }
295
- }
296
- `}),T.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=>T.jsx(M$,{toast:n,onDismiss:e},n.id))})]})}function M$({toast:t,onDismiss:e}){const n=T$[t.severity],r=t.severity==="info"?"status":"alert";return T.jsxs("div",{role:r,"data-testid":`toast-${t.id}`,style:{pointerEvents:"auto",background:"white",borderRadius:6,borderLeft:`4px solid ${n}`,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)",padding:"10px 32px 10px 12px",position:"relative",animation:"tandem-toast-slide-in 0.2s ease-out",fontSize:13,lineHeight:1.4,color:"#1f2937"},children:[T.jsx("span",{children:t.message}),t.count>1&&T.jsxs("span",{"data-testid":`toast-count-${t.id}`,style:{marginLeft:6,fontSize:11,fontWeight:600,color:n,background:`${n}18`,padding:"1px 5px",borderRadius:8},children:["×",t.count]}),T.jsx("button",{"data-testid":`toast-dismiss-${t.id}`,onClick:()=>e(t.id),style:{position:"absolute",top:6,right:6,border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#9ca3af",lineHeight:1,padding:"2px 4px"},"aria-label":"Dismiss notification",children:"×"})]})}const O$=[{title:"Review an annotation",text:"Open the side panel and accept or dismiss one of the highlighted annotations. Try Review Mode (Ctrl+Shift+R) for keyboard shortcuts."},{title:"Ask a question",text:"Select text and click Ask Claude (Ctrl+Shift+A), or type in the Chat panel."},{title:"Make an edit",text:"Click in the document and type something. All changes sync in real-time."},{title:"You're ready!",text:"You've learned the basics. Press ? anytime to see keyboard shortcuts."}],eh=3;function _$({currentStep:t,onNext:e,onDismiss:n}){const r=O$[t];if(!r)return null;const i=t>=eh;return T.jsxs("div",{"data-testid":"onboarding-tutorial",style:{position:"fixed",bottom:48,left:24,zIndex:900,maxWidth:340,background:"white",borderLeft:"4px solid #6366f1",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08)",padding:"16px 20px",fontFamily:"inherit"},children:[!i&&T.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:eh},(s,o)=>T.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:o<=t?"#6366f1":"#e5e7eb",transition:"background 0.2s"}},o))}),T.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#1f2937",marginBottom:6},children:r.title}),T.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"#4b5563",marginBottom:i?0:14},children:r.text}),!i&&T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[T.jsxs("span",{style:{fontSize:11,color:"#9ca3af"},children:["Step ",t+1," of ",eh]}),T.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[T.jsx("button",{"data-testid":"tutorial-dismiss-btn",onClick:n,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"#9ca3af",padding:0,textDecoration:"underline"},children:"Dismiss tutorial"}),T.jsx("button",{"data-testid":"tutorial-next-btn",onClick:e,style:{padding:"4px 12px",fontSize:12,border:"1px solid #d1d5db",borderRadius:4,background:"white",color:"#374151",cursor:"pointer",fontWeight:500},children:t===eh-1?"Done":"Next"})]})]})]})}var ct;(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 o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of s)o[c]=i[c];return t.objectValues(o)},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 o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},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(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ct||(ct={}));var oA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(oA||(oA={}));const Se=ct.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ps=t=>{switch(typeof t){case"undefined":return Se.undefined;case"string":return Se.string;case"number":return Number.isNaN(t)?Se.nan:Se.number;case"boolean":return Se.boolean;case"function":return Se.function;case"bigint":return Se.bigint;case"symbol":return Se.symbol;case"object":return Array.isArray(t)?Se.array:t===null?Se.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Se.promise:typeof Map<"u"&&t instanceof Map?Se.map:typeof Set<"u"&&t instanceof Set?Se.set:typeof Date<"u"&&t instanceof Date?Se.date:Se.object;default:return Se.unknown}},fe=ct.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 as 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 o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,f=0;for(;f<o.path.length;){const d=o.path[f];f===o.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(o))):c[d]=c[d]||{_errors:[]},c=c[d],f++}}};return i(this),r}static assert(e){if(!(e instanceof as))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ct.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()}}as.create=t=>new as(t);const Xb=(t,e)=>{let n;switch(t.code){case fe.invalid_type:t.received===Se.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ct.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${ct.joinValues(t.keys,", ")}`;break;case fe.invalid_union:n="Invalid input";break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ct.joinValues(t.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${ct.joinValues(t.options)}, received '${t.received}'`;break;case fe.invalid_arguments:n="Invalid function arguments";break;case fe.invalid_return_type:n="Invalid function return type";break;case fe.invalid_date:n="Invalid date";break;case fe.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}"`:ct.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case fe.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 fe.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 fe.custom:n="Invalid input";break;case fe.invalid_intersection_types:n="Intersection results could not be merged";break;case fe.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case fe.not_finite:n="Number must be finite";break;default:n=e.defaultError,ct.assertNever(t)}return{message:n}};let D$=Xb;function R$(){return D$}const N$=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const f=r.filter(d=>!!d).slice().reverse();for(const d of f)c=d(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function ye(t,e){const n=R$(),r=N$({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Xb?void 0:Xb].filter(i=>!!i)});t.common.issues.push(r)}class kr{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 Le;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,o=await i.value;r.push({key:s,value:o})}return kr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Le;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const Le=Object.freeze({status:"aborted"}),Wc=t=>({status:"dirty",value:t}),Kr=t=>({status:"valid",value:t}),aA=t=>t.status==="aborted",cA=t=>t.status==="dirty",Da=t=>t.status==="valid",Tp=t=>typeof Promise<"u"&&t instanceof Promise;var ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ke||(ke={}));class ol{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 uA=(t,e)=>{if(Da(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 as(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:(o,c)=>{const{message:f}=t;return o.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:f??n??c.defaultError}},description:i}}class st{get description(){return this._def.description}_getType(e){return Ps(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ps(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new kr,ctx:{common:e.parent.common,data:e.data,parsedType:Ps(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Tp(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:Ps(e)},i=this._parseSync({data:e,path:r.path,parent:r});return uA(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:Ps(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Da(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=>Da(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:Ps(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Tp(i)?i:Promise.resolve(i));return uA(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 o=e(i),c=()=>s.addIssue({code:fe.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(c(),!1)):o?!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 Na({schema:this,typeName:Ie.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 tl.create(this,this._def)}nullable(){return za.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wi.create(this)}promise(){return _p.create(this,this._def)}or(e){return Mp.create([this,e],this._def)}and(e){return Op.create(this,e,this._def)}transform(e){return new Na({...Ke(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new e1({...Ke(this._def),innerType:this,defaultValue:n,typeName:Ie.ZodDefault})}brand(){return new nq({typeName:Ie.ZodBranded,type:this,...Ke(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new t1({...Ke(this._def),innerType:this,catchValue:n,typeName:Ie.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return jx.create(this,e)}readonly(){return n1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const z$=/^c[^\s-]{8,}$/i,L$=/^[0-9a-z]+$/,I$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,B$=/^[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,j$=/^[a-z0-9_-]{21}$/i,U$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,H$=/^[-+]?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)?)??$/,V$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,P$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let B0;const F$=/^(?:(?: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])$/,$$=/^(?:(?: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])$/,q$=/^(([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]))$/,Y$=/^(([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])$/,K$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,G$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,a2="((\\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])))",Z$=new RegExp(`^${a2}$`);function c2(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 W$(t){return new RegExp(`^${c2(t)}$`)}function J$(t){let e=`${a2}T${c2(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 X$(t,e){return!!((e==="v4"||!e)&&F$.test(t)||(e==="v6"||!e)&&q$.test(t))}function Q$(t,e){if(!U$.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 eq(t,e){return!!((e==="v4"||!e)&&$$.test(t)||(e==="v6"||!e)&&Y$.test(t))}class Ul extends st{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Se.string){const s=this._getOrReturnCtx(e);return ye(s,{code:fe.invalid_type,expected:Se.string,received:s.parsedType}),Le}const r=new kr;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:fe.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:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(i=this._getOrReturnCtx(e,i),o?ye(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&ye(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")V$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"email",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")B0||(B0=new RegExp(P$,"u")),B0.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"emoji",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")B$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"uuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")j$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"nanoid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")z$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"cuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")L$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"cuid2",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")I$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"ulid",code:fe.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:fe.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:fe.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:fe.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:fe.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:fe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?J$(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{code:fe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Z$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{code:fe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?W$(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{code:fe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?H$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"duration",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?X$(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"ip",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Q$(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"jwt",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?eq(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"cidr",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?K$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"base64",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?G$.test(e.data)||(i=this._getOrReturnCtx(e,i),ye(i,{validation:"base64url",code:fe.invalid_string,message:s.message}),r.dirty()):ct.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:fe.invalid_string,...ke.errToObj(r)})}_addCheck(e){return new Ul({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ke.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ke.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ke.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ke.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,...ke.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,...ke.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ke.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ke.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ke.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ke.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ke.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ke.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ke.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ke.errToObj(n)})}nonempty(e){return this.min(1,ke.errToObj(e))}trim(){return new Ul({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ul({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ul({...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}}Ul.create=t=>new Ul({checks:[],typeName:Ie.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ke(t)});function tq(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(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}class Ku extends st{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)!==Se.number){const s=this._getOrReturnCtx(e);return ye(s,{code:fe.invalid_type,expected:Se.number,received:s.parsedType}),Le}let r;const i=new kr;for(const s of this._def.checks)s.kind==="int"?ct.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ye(r,{code:fe.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:fe.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:fe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?tq(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ye(r,{code:fe.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:fe.not_finite,message:s.message}),i.dirty()):ct.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ke.toString(n))}setLimit(e,n,r,i){return new Ku({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(e){return new Ku({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.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"&&ct.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)}}Ku.create=t=>new Ku({checks:[],typeName:Ie.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ke(t)});class Gu extends st{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)!==Se.bigint)return this._getInvalidInput(e);let r;const i=new kr;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:fe.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:fe.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:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ct.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ye(n,{code:fe.invalid_type,expected:Se.bigint,received:n.parsedType}),Le}gte(e,n){return this.setLimit("min",e,!0,ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ke.toString(n))}setLimit(e,n,r,i){return new Gu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(e){return new Gu({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ke.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}}Gu.create=t=>new Gu({checks:[],typeName:Ie.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ke(t)});class fA extends st{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Se.boolean){const r=this._getOrReturnCtx(e);return ye(r,{code:fe.invalid_type,expected:Se.boolean,received:r.parsedType}),Le}return Kr(e.data)}}fA.create=t=>new fA({typeName:Ie.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ke(t)});class Ap extends st{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Se.date){const s=this._getOrReturnCtx(e);return ye(s,{code:fe.invalid_type,expected:Se.date,received:s.parsedType}),Le}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return ye(s,{code:fe.invalid_date}),Le}const r=new kr;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:fe.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:fe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ct.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ap({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ke.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ke.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}}Ap.create=t=>new Ap({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ie.ZodDate,...Ke(t)});class dA extends st{_parse(e){if(this._getType(e)!==Se.symbol){const r=this._getOrReturnCtx(e);return ye(r,{code:fe.invalid_type,expected:Se.symbol,received:r.parsedType}),Le}return Kr(e.data)}}dA.create=t=>new dA({typeName:Ie.ZodSymbol,...Ke(t)});class hA extends st{_parse(e){if(this._getType(e)!==Se.undefined){const r=this._getOrReturnCtx(e);return ye(r,{code:fe.invalid_type,expected:Se.undefined,received:r.parsedType}),Le}return Kr(e.data)}}hA.create=t=>new hA({typeName:Ie.ZodUndefined,...Ke(t)});class pA extends st{_parse(e){if(this._getType(e)!==Se.null){const r=this._getOrReturnCtx(e);return ye(r,{code:fe.invalid_type,expected:Se.null,received:r.parsedType}),Le}return Kr(e.data)}}pA.create=t=>new pA({typeName:Ie.ZodNull,...Ke(t)});class mA extends st{constructor(){super(...arguments),this._any=!0}_parse(e){return Kr(e.data)}}mA.create=t=>new mA({typeName:Ie.ZodAny,...Ke(t)});class gA extends st{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Kr(e.data)}}gA.create=t=>new gA({typeName:Ie.ZodUnknown,...Ke(t)});class al extends st{_parse(e){const n=this._getOrReturnCtx(e);return ye(n,{code:fe.invalid_type,expected:Se.never,received:n.parsedType}),Le}}al.create=t=>new al({typeName:Ie.ZodNever,...Ke(t)});class yA extends st{_parse(e){if(this._getType(e)!==Se.undefined){const r=this._getOrReturnCtx(e);return ye(r,{code:fe.invalid_type,expected:Se.void,received:r.parsedType}),Le}return Kr(e.data)}}yA.create=t=>new yA({typeName:Ie.ZodVoid,...Ke(t)});class wi extends st{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Se.array)return ye(n,{code:fe.invalid_type,expected:Se.array,received:n.parsedType}),Le;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(o||c)&&(ye(n,{code:o?fe.too_big:fe.too_small,minimum:c?i.exactLength.value:void 0,maximum:o?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:fe.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:fe.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((o,c)=>i.type._parseAsync(new ol(n,o,n.path,c)))).then(o=>kr.mergeArray(r,o));const s=[...n.data].map((o,c)=>i.type._parseSync(new ol(n,o,n.path,c)));return kr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new wi({...this._def,minLength:{value:e,message:ke.toString(n)}})}max(e,n){return new wi({...this._def,maxLength:{value:e,message:ke.toString(n)}})}length(e,n){return new wi({...this._def,exactLength:{value:e,message:ke.toString(n)}})}nonempty(e){return this.min(1,e)}}wi.create=(t,e)=>new wi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...Ke(e)});function ra(t){if(t instanceof rn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=tl.create(ra(r))}return new rn({...t._def,shape:()=>e})}else return t instanceof wi?new wi({...t._def,type:ra(t.element)}):t instanceof tl?tl.create(ra(t.unwrap())):t instanceof za?za.create(ra(t.unwrap())):t instanceof so?so.create(t.items.map(e=>ra(e))):t}class rn extends st{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=ct.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Se.object){const d=this._getOrReturnCtx(e);return ye(d,{code:fe.invalid_type,expected:Se.object,received:d.parsedType}),Le}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof al&&this._def.unknownKeys==="strip"))for(const d in i.data)o.includes(d)||c.push(d);const f=[];for(const d of o){const p=s[d],m=i.data[d];f.push({key:{status:"valid",value:d},value:p._parse(new ol(i,m,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof al){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of c)f.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(d==="strict")c.length>0&&(ye(i,{code:fe.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of c){const m=i.data[p];f.push({key:{status:"valid",value:p},value:d._parse(new ol(i,m,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of f){const m=await p.key,y=await p.value;d.push({key:m,value:y,alwaysSet:p.alwaysSet})}return d}).then(d=>kr.mergeObjectSync(r,d)):kr.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return ke.errToObj,new rn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ke.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new rn({...this._def,unknownKeys:"strip"})}passthrough(){return new rn({...this._def,unknownKeys:"passthrough"})}extend(e){return new rn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new rn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ie.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new rn({...this._def,catchall:e})}pick(e){const n={};for(const r of ct.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new rn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of ct.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new rn({...this._def,shape:()=>n})}deepPartial(){return ra(this)}partial(e){const n={};for(const r of ct.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new rn({...this._def,shape:()=>n})}required(e){const n={};for(const r of ct.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof tl;)s=s._def.innerType;n[r]=s}return new rn({...this._def,shape:()=>n})}keyof(){return u2(ct.objectKeys(this.shape))}}rn.create=(t,e)=>new rn({shape:()=>t,unknownKeys:"strip",catchall:al.create(),typeName:Ie.ZodObject,...Ke(e)});rn.strictCreate=(t,e)=>new rn({shape:()=>t,unknownKeys:"strict",catchall:al.create(),typeName:Ie.ZodObject,...Ke(e)});rn.lazycreate=(t,e)=>new rn({shape:t,unknownKeys:"strip",catchall:al.create(),typeName:Ie.ZodObject,...Ke(e)});class Mp extends st{_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 o=s.map(c=>new as(c.ctx.common.issues));return ye(n,{code:fe.invalid_union,unionErrors:o}),Le}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const f of r){const d={...n,common:{...n.common,issues:[]},parent:null},p=f._parseSync({data:n.data,path:n.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=o.map(f=>new as(f));return ye(n,{code:fe.invalid_union,unionErrors:c}),Le}}get options(){return this._def.options}}Mp.create=(t,e)=>new Mp({options:t,typeName:Ie.ZodUnion,...Ke(e)});function Qb(t,e){const n=Ps(t),r=Ps(e);if(t===e)return{valid:!0,data:t};if(n===Se.object&&r===Se.object){const i=ct.objectKeys(e),s=ct.objectKeys(t).filter(c=>i.indexOf(c)!==-1),o={...t,...e};for(const c of s){const f=Qb(t[c],e[c]);if(!f.valid)return{valid:!1};o[c]=f.data}return{valid:!0,data:o}}else if(n===Se.array&&r===Se.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],c=e[s],f=Qb(o,c);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return n===Se.date&&r===Se.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Op extends st{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(aA(s)||aA(o))return Le;const c=Qb(s.value,o.value);return c.valid?((cA(s)||cA(o))&&n.dirty(),{status:n.value,value:c.data}):(ye(r,{code:fe.invalid_intersection_types}),Le)};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,o])=>i(s,o)):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}))}}Op.create=(t,e,n)=>new Op({left:t,right:e,typeName:Ie.ZodIntersection,...Ke(n)});class so extends st{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Se.array)return ye(r,{code:fe.invalid_type,expected:Se.array,received:r.parsedType}),Le;if(r.data.length<this._def.items.length)return ye(r,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Le;!this._def.rest&&r.data.length>this._def.items.length&&(ye(r,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,c)=>{const f=this._def.items[c]||this._def.rest;return f?f._parse(new ol(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>kr.mergeArray(n,o)):kr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new so({...this._def,rest:e})}}so.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new so({items:t,typeName:Ie.ZodTuple,rest:null,...Ke(e)})};class bA extends st{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!==Se.map)return ye(r,{code:fe.invalid_type,expected:Se.map,received:r.parsedType}),Le;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([c,f],d)=>({key:i._parse(new ol(r,c,r.path,[d,"key"])),value:s._parse(new ol(r,f,r.path,[d,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const f of o){const d=await f.key,p=await f.value;if(d.status==="aborted"||p.status==="aborted")return Le;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(d.value,p.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const f of o){const d=f.key,p=f.value;if(d.status==="aborted"||p.status==="aborted")return Le;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(d.value,p.value)}return{status:n.value,value:c}}}}bA.create=(t,e,n)=>new bA({valueType:e,keyType:t,typeName:Ie.ZodMap,...Ke(n)});class Zu extends st{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Se.set)return ye(r,{code:fe.invalid_type,expected:Se.set,received:r.parsedType}),Le;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ye(r,{code:fe.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:fe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(f){const d=new Set;for(const p of f){if(p.status==="aborted")return Le;p.status==="dirty"&&n.dirty(),d.add(p.value)}return{status:n.value,value:d}}const c=[...r.data.values()].map((f,d)=>s._parse(new ol(r,f,r.path,d)));return r.common.async?Promise.all(c).then(f=>o(f)):o(c)}min(e,n){return new Zu({...this._def,minSize:{value:e,message:ke.toString(n)}})}max(e,n){return new Zu({...this._def,maxSize:{value:e,message:ke.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Zu.create=(t,e)=>new Zu({valueType:t,minSize:null,maxSize:null,typeName:Ie.ZodSet,...Ke(e)});class xA extends st{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})}}xA.create=(t,e)=>new xA({getter:t,typeName:Ie.ZodLazy,...Ke(e)});class SA extends st{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ye(n,{received:n.data,code:fe.invalid_literal,expected:this._def.value}),Le}return{status:"valid",value:e.data}}get value(){return this._def.value}}SA.create=(t,e)=>new SA({value:t,typeName:Ie.ZodLiteral,...Ke(e)});function u2(t,e){return new Ra({values:t,typeName:Ie.ZodEnum,...Ke(e)})}class Ra extends st{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ye(n,{expected:ct.joinValues(r),received:n.parsedType,code:fe.invalid_type}),Le}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:fe.invalid_enum_value,options:r}),Le}return Kr(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 Ra.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ra.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ra.create=u2;class wA extends st{_parse(e){const n=ct.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Se.string&&r.parsedType!==Se.number){const i=ct.objectValues(n);return ye(r,{expected:ct.joinValues(i),received:r.parsedType,code:fe.invalid_type}),Le}if(this._cache||(this._cache=new Set(ct.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=ct.objectValues(n);return ye(r,{received:r.data,code:fe.invalid_enum_value,options:i}),Le}return Kr(e.data)}get enum(){return this._def.values}}wA.create=(t,e)=>new wA({values:t,typeName:Ie.ZodNativeEnum,...Ke(e)});class _p extends st{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Se.promise&&n.common.async===!1)return ye(n,{code:fe.invalid_type,expected:Se.promise,received:n.parsedType}),Le;const r=n.parsedType===Se.promise?n.data:Promise.resolve(n.data);return Kr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_p.create=(t,e)=>new _p({type:t,typeName:Ie.ZodPromise,...Ke(e)});class Na extends st{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.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:o=>{ye(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return Le;const f=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return f.status==="aborted"?Le:f.status==="dirty"||n.value==="dirty"?Wc(f.value):f});{if(n.value==="aborted")return Le;const c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?Le:c.status==="dirty"||n.value==="dirty"?Wc(c.value):c}}if(i.type==="refinement"){const o=c=>{const f=i.refinement(c,s);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Le:(c.status==="dirty"&&n.dirty(),o(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"?Le:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Da(o))return Le;const c=i.transform(o.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(o=>Da(o)?Promise.resolve(i.transform(o.value,s)).then(c=>({status:n.value,value:c})):Le);ct.assertNever(i)}}Na.create=(t,e,n)=>new Na({schema:t,typeName:Ie.ZodEffects,effect:e,...Ke(n)});Na.createWithPreprocess=(t,e,n)=>new Na({schema:e,effect:{type:"preprocess",transform:t},typeName:Ie.ZodEffects,...Ke(n)});class tl extends st{_parse(e){return this._getType(e)===Se.undefined?Kr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tl.create=(t,e)=>new tl({innerType:t,typeName:Ie.ZodOptional,...Ke(e)});class za extends st{_parse(e){return this._getType(e)===Se.null?Kr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}za.create=(t,e)=>new za({innerType:t,typeName:Ie.ZodNullable,...Ke(e)});class e1 extends st{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Se.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}e1.create=(t,e)=>new e1({innerType:t,typeName:Ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ke(e)});class t1 extends st{_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 Tp(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new as(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new as(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}t1.create=(t,e)=>new t1({innerType:t,typeName:Ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ke(e)});class vA extends st{_parse(e){if(this._getType(e)!==Se.nan){const r=this._getOrReturnCtx(e);return ye(r,{code:fe.invalid_type,expected:Se.nan,received:r.parsedType}),Le}return{status:"valid",value:e.data}}}vA.create=t=>new vA({typeName:Ie.ZodNaN,...Ke(t)});class nq extends st{_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 jx extends st{_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"?Le:s.status==="dirty"?(n.dirty(),Wc(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"?Le: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 jx({in:e,out:n,typeName:Ie.ZodPipeline})}}class n1 extends st{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Da(i)&&(i.value=Object.freeze(i.value)),i);return Tp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}n1.create=(t,e)=>new n1({innerType:t,typeName:Ie.ZodReadonly,...Ke(e)});var Ie;(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"})(Ie||(Ie={}));al.create;wi.create;Mp.create;Op.create;so.create;const oi=Ra.create;_p.create;tl.create;za.create;oi(["highlight","comment","suggestion","overlay","question","flag"]);oi(["pending","accepted","dismissed"]);oi(["normal","urgent"]);const rq=oi(["all","urgent-only","paused"]);oi(["yellow","red","green","blue","purple"]);oi(["info","warning","error","success"]);oi(["user","claude","import"]);oi(["accept","dismiss"]);oi(["markdown","json"]);oi(["md","txt","html","docx"]);oi(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);function iq(t,e){return t.status!=="pending"||e==="all"?!0:e==="urgent-only"?t.priority==="urgent"||t.type==="flag"||t.type==="question":!1}function sq(t,e){return R.useMemo(()=>{const n=[];let r=0;for(const i of t)iq(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function lq(){const[t,e]=R.useState(!1),n=R.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=R.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=R.useCallback(async s=>{if(e(!1),!s.dataTransfer.files.length)return;s.preventDefault();const o=s.dataTransfer.files[0],c=await kD(o);try{const f=await fetch(`${qu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:o.name,content:c})});if(!f.ok){const d=await f.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",f.status,d.message??d.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function oq(){const[t,e]=R.useState([]),n=R.useRef(new Map),r=R.useCallback((o,c)=>{const f=n.current.get(o);f&&clearTimeout(f);const d=eC[c]??eC.info,p=setTimeout(()=>{e(m=>m.filter(y=>y.id!==o)),n.current.delete(o)},d);n.current.set(o,p)},[]),i=R.useCallback(o=>{const c=n.current.get(o);c&&(clearTimeout(c),n.current.delete(o))},[]),s=R.useCallback(o=>{e(c=>c.filter(f=>f.id!==o)),i(o)},[i]);return R.useEffect(()=>{const o=`http://localhost:${c1}/api/notify-stream`,c=new EventSource(o);return c.onmessage=f=>{let d;try{d=JSON.parse(f.data)}catch{console.warn("[useNotifications] Malformed SSE data:",f.data);return}e(p=>{if(d.dedupKey){const b=p.findIndex(S=>S.dedupKey===d.dedupKey);if(b!==-1){const S=p[b];i(S.id);const v={...d,count:S.count+1},k=[...p];return k[b]=v,r(v.id,v.severity),k}}const m={...d,count:1},y=[...p,m];for(;y.length>nz;){const b=y.shift();i(b.id)}return r(m.id,m.severity),y})},c.onerror=()=>{c.readyState===EventSource.CLOSED&&console.warn("[useNotifications] EventSource permanently closed. Notifications will not be delivered. Is the server running?")},()=>{c.close();for(const f of n.current.values())clearTimeout(f);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function aq(t){const[e,n]=R.useState(!1),[r,i]=R.useState(null),s=R.useRef(0),{pendingCount:o,acceptedCount:c,dismissedCount:f}=R.useMemo(()=>{let p=0,m=0,y=0;for(const b of t)b.status==="pending"?p++:b.status==="accepted"?m++:b.status==="dismissed"&&y++;return{pendingCount:p,acceptedCount:m,dismissedCount:y}},[t]);R.useEffect(()=>{const p=c+f;s.current>0&&o===0&&p>0&&(i({accepted:c,dismissed:f,total:p}),n(!0)),s.current=o},[o,c,f]);const d=R.useCallback(()=>{n(!1)},[]);return{pendingCount:o,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:d}}function kA(t,e){const n=new Set(e),r=t.filter(o=>n.has(o)),i=new Set(r),s=e.filter(o=>!i.has(o));return[...r,...s]}function cq(t,e,n,r,i="left"){const s=t.filter(m=>r.has(m)),o=s.indexOf(e),c=s.indexOf(n);if(o===-1||c===-1)return s;const f=[...s];f.splice(o,1);const d=f.indexOf(n),p=i==="right"?d+1:d;return f.splice(p,0,e),f}function uq(t){const[e,n]=R.useState([]),r=R.useMemo(()=>{const o=new Map(t.map(d=>[d.id,d])),c=t.map(d=>d.id);return kA(e,c).map(d=>o.get(d)).filter(Boolean)},[t,e]),i=R.useMemo(()=>t.map(o=>o.id),[t]);R.useEffect(()=>{n(o=>{const c=kA(o,i);return o.length===c.length&&o.every((f,d)=>f===c[d])?o:c})},[i]);const s=R.useCallback(function(c,f,d="left"){if(c===f)return;const p=new Set(i);n(m=>cq(m,c,f,p,d))},[i]);return{orderedTabs:r,reorder:s}}function fq(){try{return localStorage.getItem(UA)==="true"}catch{return!1}}function CA(){try{localStorage.setItem(UA,"true")}catch{}}function dq(t,e,n){const[r,i]=R.useState(fq),[s,o]=R.useState(0),c=R.useRef(0),d=!r&&n==="welcome.md";R.useEffect(()=>{if(!d||s!==0)return;const b=t.filter(v=>v.id.startsWith(rz));if(b.length===0)return;b.some(v=>v.status!=="pending")&&(c.current=Date.now(),o(1))},[d,s,t]),R.useEffect(()=>{if(!d||s!==1)return;t.some(S=>S.author==="user")&&(c.current=Date.now(),o(2))},[d,s,t]);const p=e.current;R.useEffect(()=>{if(!d||s!==2||!p)return;const b=()=>{Date.now()-c.current<2e3||p.isFocused&&(c.current=Date.now(),o(3))};return p.on("update",b),()=>{p.off("update",b)}},[d,s,p]),R.useEffect(()=>{if(!d||s!==3)return;const b=setTimeout(()=>{CA(),i(!0)},3e3);return()=>clearTimeout(b)},[d,s]);const m=R.useCallback(()=>{CA(),i(!0)},[]),y=R.useCallback(()=>{c.current=Date.now(),o(b=>Math.min(b+1,3))},[]);return{tutorialActive:d,currentStep:s,dismissTutorial:m,nextStep:y}}const hq=Math.floor,pq=(t,e)=>t<e?t:e,mq=(t,e)=>t>e?t:e,f2=128,gh=127,gq=Number.MAX_SAFE_INTEGER,yq=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},Wu=typeof TextEncoder<"u"?new TextEncoder:null,bq=t=>Wu.encode(t),xq=Wu?bq:yq;let pu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});pu&&pu.decode(new Uint8Array).length===1&&(pu=null);const Dp=(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},pm=(t,e)=>{for(;e>gh;)Dp(t,f2|gh&e),e=hq(e/128);Dp(t,gh&e)},r1=new Uint8Array(3e4),Sq=r1.length/3,wq=(t,e)=>{if(e.length<Sq){const n=Wu.encodeInto(e,r1).written||0;pm(t,n);for(let r=0;r<n;r++)Dp(t,r1[r])}else Eq(t,xq(e))},vq=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;pm(t,r);for(let i=0;i<r;i++)Dp(t,n.codePointAt(i))},kq=Wu&&Wu.encodeInto?wq:vq,Cq=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=pq(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(mq(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},Eq=(t,e)=>{pm(t,e.byteLength),Cq(t,e)},d2=t=>new Error(t),Tq=d2("Unexpected end of array"),Aq=d2("Integer out of Range"),Mq=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Oq=t=>Mq(t,Ux(t)),EA=t=>t.arr[t.pos++],Ux=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&gh)*n,n*=128,i<f2)return e;if(e>gq)throw Aq}throw Tq},_q=t=>{let e=Ux(t);if(e===0)return"";{let n=String.fromCodePoint(EA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(EA(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))}},Dq=t=>pu.decode(Oq(t)),TA=pu?Dq:_q;var xa;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(xa||(xa={}));const Rq=(t,e)=>{pm(t,xa.Token),kq(t,e)},Nq=(t,e,n,r)=>{switch(Ux(t)){case xa.Token:{e();break}case xa.PermissionDenied:{n(TA(t));break}case xa.Authenticated:{r(TA(t));break}}},AA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var i1;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(i1||(i1={}));function zq(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 j0(t){return new Promise(e=>setTimeout(e,t))}function Lq(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 Iq(t,e){const n=zq(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const f=n[c];if(!Number.isInteger(f)||f<0)throw new Error(`Value for ${c} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(n.delay<n.minDelay)throw new Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);const r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||Lq;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const f=new Error("Attempt aborted");throw f.code="ATTEMPT_ABORTED",f}const c=async f=>{if(n.handleError&&await n.handleError(f,r,n),r.aborted||r.attemptsRemaining===0)throw f;r.attemptNum++;const d=i(r,n);return d&&await j0(d),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((f,d)=>{const p=setTimeout(()=>{if(n.handleTimeout)try{f(n.handleTimeout(r,n))}catch(m){d(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",d(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(p),f(m)}).catch(m=>{clearTimeout(p),c(m).then(f).catch(d)})}):t(r,n).catch(c)}const o=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(o&&await j0(o),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await j0(c)}return s()}const h2=Math.floor,Bq=(t,e)=>t<e?t:e,jq=(t,e)=>t>e?t:e,Uq=64,Rp=128,Hq=63,mu=127,p2=Number.MAX_SAFE_INTEGER,Vq=()=>new Set,Pq=Array.from,Fq=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},Ju=typeof TextEncoder<"u"?new TextEncoder:null,$q=t=>Ju.encode(t),qq=Ju?$q:Fq;let gu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});gu&&gu.decode(new Uint8Array).length===1&&(gu=null);class Yq{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Hx=()=>new Yq,m2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Vx=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},Np=(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},Nn=(t,e)=>{for(;e>mu;)Np(t,Rp|mu&e),e=h2(e/128);Np(t,mu&e)},s1=new Uint8Array(3e4),Kq=s1.length/3,Gq=(t,e)=>{if(e.length<Kq){const n=Ju.encodeInto(e,s1).written||0;Nn(t,n);for(let r=0;r<n;r++)Np(t,s1[r])}else Ya(t,qq(e))},Zq=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Nn(t,r);for(let i=0;i<r;i++)Np(t,n.codePointAt(i))},cs=Ju&&Ju.encodeInto?Gq:Zq,Wq=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=Bq(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(jq(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},Ya=(t,e)=>{Nn(t,e.byteLength),Wq(t,e)},g2=t=>new Error(t),y2=g2("Unexpected end of array"),b2=g2("Integer out of Range");class Jq{constructor(e){this.arr=e,this.pos=0}}const x2=t=>new Jq(t),Xq=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},mm=t=>Xq(t,Kl(t)),MA=t=>t.arr[t.pos++],Kl=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<Rp)return e;if(e>p2)throw b2}throw y2},Qq=t=>{let e=t.arr[t.pos++],n=e&Hq,r=64;const i=(e&Uq)>0?-1:1;if((e&Rp)===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<Rp)return i*n;if(n>p2)throw b2}throw y2},eY=t=>{let e=Kl(t);if(e===0)return"";{let n=String.fromCodePoint(MA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(MA(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))}},tY=t=>gu.decode(mm(t)),Xu=gu?tY:eY,nY=t=>{const e=t.pos,n=Xu(t);return t.pos=e,n},La=Date.now,U0=()=>new Map,rY=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class iY{constructor(){this._observers=U0()}on(e,n){rY(this._observers,e,Vq).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 Pq((this._observers.get(e)||U0()).values()).forEach(r=>r(...n))}destroy(){this._observers=U0()}}const sY=Object.keys,OA=t=>sY(t).length,lY=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),oY=(t,e)=>t===e,yu=(t,e)=>{if(t==null||e==null)return oY(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)||!yu(t.get(n),e.get(n)))return!1;break}case Object:if(OA(t)!==OA(e))return!1;for(const n in t)if(!lY(t,n)||!yu(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(!yu(t[n],e[n]))return!1;break;default:return!1}return!0},H0=3e4;class aY extends iY{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=La();this.getLocalState()!==null&&H0/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&H0<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&yh(this,r,"timeout")},h2(H0/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:La()});const o=[],c=[],f=[],d=[];e===null?d.push(n):s==null?e!=null&&o.push(n):(c.push(n),yu(s,e)||f.push(n)),(o.length>0||f.length>0||d.length>0)&&this.emit("change",[{added:o,updated:f,removed:d},"local"]),this.emit("update",[{added:o,updated:c,removed:d},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const yh=(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 o=t.meta.get(s);t.meta.set(s,{clock:o.clock+1,lastUpdated:La()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},l1=(t,e,n=t.states)=>{const r=e.length,i=Hx();Nn(i,r);for(let s=0;s<r;s++){const o=e[s],c=n.get(o)||null,f=t.meta.get(o).clock;Nn(i,o),Nn(i,f),cs(i,JSON.stringify(c))}return Vx(i)},cY=(t,e,n)=>{const r=x2(e),i=La(),s=[],o=[],c=[],f=[],d=Kl(r);for(let p=0;p<d;p++){const m=Kl(r);let y=Kl(r);const b=JSON.parse(Xu(r)),S=t.meta.get(m),v=t.states.get(m),k=S===void 0?0:S.clock;(k<y||k===y&&b===null&&t.states.has(m))&&(b===null?m===t.clientID&&t.getLocalState()!=null?y++:t.states.delete(m):t.states.set(m,b),t.meta.set(m,{clock:y,lastUpdated:i}),S===void 0&&b!==null?s.push(m):S!==void 0&&b===null?f.push(m):b!==null&&(yu(b,v)||c.push(m),o.push(m)))}(s.length>0||c.length>0||f.length>0)&&t.emit("change",[{added:s,updated:c,removed:f},n]),(s.length>0||o.length>0||f.length>0)&&t.emit("update",[{added:s,updated:o,removed:f},n])};class S2{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 o1{constructor(e){this.data=e,this.encoder=Hx(),this.decoder=x2(new Uint8Array(this.data))}peekVarString(){return nY(this.decoder)}readVarUint(){return Kl(this.decoder)}readVarString(){return Xu(this.decoder)}readVarUint8Array(){return mm(this.decoder)}writeVarUint(e){return Nn(this.encoder,e)}writeVarString(e){return cs(this.encoder,e)}writeVarUint8Array(e){return Ya(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 Vn;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(Vn||(Vn={}));class co{constructor(){this.encoder=Hx()}get(e){return e.encoder}toUint8Array(){return Vx(this.encoder)}}class uY extends co{constructor(){super(...arguments),this.type=kn.CLOSE,this.description="Ask the server to close the connection"}get(e){return cs(this.encoder,e.documentName),Nn(this.encoder,this.type),this.encoder}}class fY extends S2{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=Vn.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=Vn.Connected,this.emit("status",{status:Vn.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===Vn.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===Vn.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(uY,{documentName:e.configuration.name}),this.configuration.providerMap.delete(e.configuration.name))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===Vn.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:Iq(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:o=>{(!this.shouldConnect||i)&&o.abort()}}).catch(o=>{if(o&&o.code!=="ATTEMPT_ABORTED")throw o}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,n}attachWebSocketListeners(e,n){const{identifier:r}=e,i=d=>this.emit("message",d),s=d=>this.emit("close",{event:d}),o=d=>this.emit("open",d),c=d=>{n(d)};this.webSocketHandlers[r]={message:i,close:s,open:o,error:c};const f=this.webSocketHandlers[e.identifier];Object.keys(f).forEach(d=>{e.addEventListener(d,f[d])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,n[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,n),this.webSocket=r,this.status=Vn.Connecting,this.emit("status",{status:Vn.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=La();const i=new o1(e.data).peekVarString();(n=this.configuration.providerMap.get(i))===null||n===void 0||n.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=Vn.Connected,this.emit("status",{status:Vn.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===Vn.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=La()-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)===i1.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=Vn.Disconnected,this.emit("status",{status:Vn.Disconnected}),this.emit("disconnect",{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit("destroy"),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const w2=0,Px=1,v2=2,dY=(t,e)=>{Nn(t,w2);const n=V5(e);Ya(t,n)},hY=(t,e,n)=>{Nn(t,Px),Ya(t,B5(e,n))},pY=(t,e,n)=>hY(e,n,mm(t)),k2=(t,e,n)=>{try{z5(e,mm(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},mY=(t,e)=>{Nn(t,v2),Ya(t,e)},gY=k2,yY=(t,e,n,r)=>{const i=Kl(t);switch(i){case w2:pY(t,e,n);break;case Px:k2(t,n,r);break;case v2:gY(t,n,r);break;default:throw new Error("Unknown message type")}return i};class bY{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(Xu(r.decoder));break;case kn.SyncStatus:this.applySyncStatusMessage(e,Qq(r.decoder)===1);break;case kn.CLOSE:const o={code:1e3,reason:Xu(r.decoder),target:e.configuration.websocketProvider.webSocket,type:"close"};e.onClose(),e.configuration.onClose({event:o}),e.forwardClose({event:o});break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}r.length()>s+1&&e.send(co,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(kn.Sync);const i=yY(r.decoder,r.encoder,e.document,e);n&&i===Px&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;cY(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;Nq(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(l1(e.awareness,Array.from(e.awareness.getStates().keys())))}}class xY{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return Vx(this.encoder)}send(e){e==null||e.send(this.create())}}class SY extends co{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 cs(this.encoder,e.documentName),Nn(this.encoder,this.type),Rq(this.encoder,e.token),this.encoder}}class _A extends co{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");cs(this.encoder,e.documentName),Nn(this.encoder,this.type);let n;return e.states===void 0?n=l1(e.awareness,e.clients):n=l1(e.awareness,e.clients,e.states),Ya(this.encoder,n),this.encoder}}class wY extends co{constructor(){super(...arguments),this.type=kn.Stateless,this.description="A stateless message"}get(e){var n;return cs(this.encoder,e.documentName),Nn(this.encoder,this.type),cs(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class DA extends co{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 cs(this.encoder,e.documentName),Nn(this.encoder,this.type),dY(this.encoder,e.document),this.encoder}}class vY extends co{constructor(){super(...arguments),this.type=kn.Sync,this.description="A document update"}get(e){return cs(this.encoder,e.documentName),Nn(this.encoder,this.type),mY(this.encoder,e.update),this.encoder}}class kY extends Error{constructor(){super(...arguments),this.code=1001}}class RA extends S2{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 aY(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("unsyncedChanges",this.configuration.onUnsyncedChanges),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),(n=this.awareness)===null||n===void 0||n.on("update",()=>{this.emit("awarenessUpdate",{states:AA(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:AA(this.awareness.getStates())})}),this.document.on("update",this.boundDocumentUpdateHandler),(i=this.awareness)===null||i===void 0||i.on("update",this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval=="number"&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new fY(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&(this.unsyncedChanges-=1),this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(DA,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&yh(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(wY,{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(SY,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(vY,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(_A,{awareness:this.awareness,clients:s,documentName:this.configuration.name})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit("synced",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn("HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn("HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}async onOpen(e){this.isAuthenticated=!1,this.emit("open",{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(DA,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(_A,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new xY(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new o1(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new o1(e.data)}),new bY(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&yh(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&&(yh(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 kY(`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 CY(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function EY(){var M;const[t,e]=R.useState([]),[n,r]=R.useState(null),[i,s]=R.useState(!1),[o,c]=R.useState("connecting"),[f,d]=R.useState(0),[p,m]=R.useState(null),[y,b]=R.useState([]),[S,v]=R.useState(null),[k,C]=R.useState(!1),[U,z]=R.useState(!1),[re,F]=R.useState(!1),[O,L]=R.useState(!1),J=R.useRef(null),ce=R.useRef(!1),ie=R.useRef(null),ue=R.useRef(null),G=R.useRef([]);G.current=t;const ee=R.useRef(new Set),ne=R.useRef(new Map);for(const _ of t)ee.current.delete(_.id),ne.current.delete(_.id);const Z=R.useRef(new Map),I=R.useRef(new Map),Y=R.useRef(void 0),me=R.useCallback(_=>{const{ydoc:H}=_,A=H.getMap(oa),te=()=>{const Ze=[];A.forEach(Mt=>{Ze.push(Mt)}),b(Ze)};A.observe(te),te();const pe=H.getMap(BA);let ge=null,_e=!1;const Ge=()=>{const Ze=pe.get("claude"),Mt=(Ze==null?void 0:Ze.status)??null,zt=(Ze==null?void 0:Ze.active)??!1;Mt!==ge&&(ge=Mt,v(Mt)),zt!==_e&&(_e=zt,C(zt))};pe.observe(Ge),Ge();const qe=H.getMap(th);let dt=!1;const Me=()=>{const Ze=qe.get("readOnly")===!0;Ze!==dt&&(dt=Ze,z(Ze))};return qe.observe(Me),Me(),()=>{A.unobserve(te),pe.unobserve(Ge),qe.unobserve(Me)}},[]);Y.current=(_,H)=>{var qe,dt;const A=G.current,te=new Set(A.map(Me=>Me.id)),pe=new Set(_.map(Me=>Me.id));for(const[Me,Ze]of ne.current)pe.has(Me)||((qe=I.current.get(Me))==null||qe(),I.current.delete(Me),Ze.provider.destroy(),Ze.ydoc.destroy(),ne.current.delete(Me),ee.current.delete(Me));const ge=CY(_,te,ee.current),_e=[];for(const Me of ge){ee.current.add(Me.id);const Ze=new Ti,Mt=new RA({url:`ws://localhost:${Zk}`,name:Me.id,document:Ze});ne.current.set(Me.id,{ydoc:Ze,provider:Mt});const zt=Ze.getMap(th),Mn=()=>{var Gr;const Kn=zt.get("openDocuments"),ar=zt.get("activeDocumentId");Kn&&((Gr=Y.current)==null||Gr.call(Y,Kn,ar??null))};zt.observe(Mn),I.current.set(Me.id,()=>zt.unobserve(Mn)),_e.push({...Me,ydoc:Ze,provider:Mt})}const Ge=A.filter(Me=>!pe.has(Me.id));for(const Me of Ge){const Ze=Z.current.get(Me.id);Ze&&(Ze.cleanup(),Z.current.delete(Me.id)),(dt=I.current.get(Me.id))==null||dt(),I.current.delete(Me.id),ee.current.delete(Me.id),ne.current.delete(Me.id),Me.provider.destroy(),Me.ydoc.destroy()}e(Me=>[...Me.filter(Mt=>pe.has(Mt.id)),..._e]),H!==null&&r(Me=>Me===null||!pe.has(Me)?H:Ge.length>0&&H===Me?Me:H)},R.useEffect(()=>{const _=new Ti,H=new RA({url:`ws://localhost:${Zk}`,name:ez,document:_});return ie.current={ydoc:_,provider:H},H.on("status",({status:A})=>{s(A==="connected"),c(A),A==="connected"?(ce.current=!0,d(0),m(null)):A==="disconnected"?m(te=>te??Date.now()):A==="connecting"&&(ce.current&&d(te=>te+1),m(te=>te??Date.now()))}),F(!0),()=>{H.destroy(),_.destroy(),ie.current=null}},[]),R.useEffect(()=>{if(!ie.current)return;const _=ie.current.ydoc.getMap(th),H=()=>{var ge;const A=_.get("generationId");A&&ue.current&&A!==ue.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),L(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>L(!1),5e3)),A&&(ue.current=A);const te=_.get("openDocuments"),pe=_.get("activeDocumentId");te&&((ge=Y.current)==null||ge.call(Y,te,pe??null))};return _.observe(H),H(),()=>{_.unobserve(H),J.current&&clearTimeout(J.current)}},[]),R.useEffect(()=>{for(const H of Z.current.values())H.cleanup();Z.current.clear();const _=G.current.find(H=>H.id===n);if(_){const H=me(_);Z.current.set(_.id,{cleanup:H})}else b([]),v(null),C(!1),z(!1)},[n,me]);const de=R.useCallback(_=>{r(H=>{if(H!==_)return H;const A=G.current,te=A.findIndex(ge=>ge.id===_),pe=A.filter(ge=>ge.id!==_);return pe.length===0?null:pe[Math.min(te,pe.length-1)].id}),fetch(`http://localhost:${c1}/api/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:_})}).then(H=>{H.ok||console.warn("[Tandem] Server rejected close:",H.status)}).catch(H=>{console.warn("[Tandem] Failed to close document on server:",H)})},[]);return{tabs:t,activeTabId:n,setActiveTabId:r,handleTabClose:de,connected:i,connectionStatus:o,reconnectAttempts:f,disconnectedSince:p,annotations:y,claudeStatus:S,claudeActive:k,readOnly:U,bootstrapYdoc:((M=ie.current)==null?void 0:M.ydoc)??null,ready:re,serverRestarted:O}}function TY({connected:t,claudeActive:e}){const[n,r]=R.useState(!1);return R.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),JN);return()=>clearTimeout(i)},[t]),T.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"#9ca3af",gap:"8px"},children:n?T.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):T.jsxs(T.Fragment,{children:[T.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&T.jsx("span",{style:{fontSize:"0.85em",color:"#b0b8c4"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}function AY({onDismiss:t}){return T.jsxs("div",{style:{padding:"8px 16px",background:"#fef2f2",borderBottom:"1px solid #fca5a5",fontSize:"13px",color:"#991b1b",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"12px"},children:[T.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),T.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"#991b1b",fontSize:"16px",lineHeight:1,padding:"0 4px"},"aria-label":"Dismiss connection banner",children:"\\u00d7"})]})}const NA=200,zA=600,MY=300,LA="tandem-panel-width",OY=740;function _Y(){var On;const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:o,disconnectedSince:c,annotations:f,claudeStatus:d,claudeActive:p,readOnly:m,bootstrapYdoc:y,ready:b,serverRestarted:S}=EY(),{orderedTabs:v,reorder:k}=uq(t),[C,U]=R.useState(()=>{try{const Ne=localStorage.getItem(Jk);return rq.safeParse(Ne).success?Ne:Wk}catch{return Wk}});R.useEffect(()=>{try{localStorage.setItem(Jk,C)}catch{}},[C]);const z=(On=t.find(Ne=>Ne.id===e))==null?void 0:On.ydoc;R.useEffect(()=>{if(!z)return;z.getMap(jA).set("interruptionMode",C)},[C,z]);const[re,F]=R.useState(!1),[O,L]=R.useState(!1);R.useEffect(()=>{if(c==null){F(!1),L(!1);return}const Ne=Date.now()-c,it=XN-Ne;if(it<=0){F(!0);return}const lt=setTimeout(()=>F(!0),it);return()=>clearTimeout(lt)},[c]);const{visibleAnnotations:J,heldCount:ce}=sq(f,C),ie=R.useMemo(()=>t.map(Ne=>({id:Ne.id,fileName:Ne.fileName})),[t]),{toasts:ue,dismiss:G}=oq(),{fileDragOver:ee,handleEditorDragOver:ne,handleEditorDragLeave:Z,handleEditorDrop:I}=lq(),{pendingCount:Y,showReviewSummary:me,reviewSummaryData:de,dismissReviewSummary:M}=aq(f),[_,H]=R.useState(!1),[A,te]=R.useState(!1),[pe,ge]=R.useState(!1),[_e,Ge]=R.useState(null),[qe,dt]=R.useState(!1),[Me,Ze]=R.useState(null),Mt=R.useRef(null),zt=R.useCallback(Ne=>{Mt.current=Ne},[]),[Mn,Kn]=R.useState(()=>{try{const Ne=localStorage.getItem(LA);if(Ne){const it=parseInt(Ne,10);if(Number.isFinite(it))return Math.max(NA,Math.min(zA,it))}}catch{}return MY}),[ar,Gr]=R.useState(()=>{try{return localStorage.getItem(tC)==="reading"?"reading":"full"}catch{return"full"}}),Zr=R.useCallback(()=>{Gr(Ne=>{const it=Ne==="reading"?"full":"reading";try{localStorage.setItem(tC,it)}catch{}return it})},[]),Cr=R.useRef(Mn);Cr.current=Mn;const Un=R.useRef(null);R.useEffect(()=>()=>{Un.current&&(document.removeEventListener("mousemove",Un.current.move),document.removeEventListener("mouseup",Un.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]);const le=R.useCallback(Ne=>{Ne.preventDefault();const it=Ne.clientX,lt=Cr.current;let It=lt;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const nt=cr=>{It=Math.max(NA,Math.min(zA,lt-(cr.clientX-it))),Kn(It)},Er=()=>{document.removeEventListener("mousemove",nt),document.removeEventListener("mouseup",Er),Un.current=null,document.body.style.userSelect="",document.body.style.cursor="";try{localStorage.setItem(LA,String(It))}catch{}};Un.current={move:nt,up:Er},document.addEventListener("mousemove",nt),document.addEventListener("mouseup",Er)},[]);R.useEffect(()=>{Y>=QN&&!_&&te(!0),Y===0&&te(!1)},[Y,_]);const je=R.useCallback(()=>{H(Ne=>!Ne),te(!1)},[]),Pe=R.useCallback(()=>{H(!1),te(!1)},[]),St=R.useCallback(()=>{if(pe)return;const Ne=Mt.current;if(!Ne)return;const{from:it,to:lt}=Ne.state.selection;if(it===lt)return;const It=vD(Ne.state.doc,{from:Si(it),to:Si(lt)}),nt=Ne.state.doc.textBetween(it,lt,`
297
- `);Ze({...It,textSnapshot:nt.length>200?nt.slice(0,197)+"...":nt})},[pe]);R.useEffect(()=>{const Ne=it=>{if(it.key!=="?")return;const lt=it.target;lt.tagName==="INPUT"||lt.tagName==="TEXTAREA"||lt.isContentEditable||dt(It=>!It)};return window.addEventListener("keydown",Ne),()=>window.removeEventListener("keydown",Ne)},[]);const j=t.find(Ne=>Ne.id===e),{tutorialActive:se,currentStep:ve,dismissTutorial:Ae,nextStep:Xe}=dq(f,Mt,j==null?void 0:j.fileName);return b?T.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[S&&T.jsx("div",{style:{padding:"8px 16px",background:"#fef3c7",borderBottom:"1px solid #fbbf24",fontSize:"13px",color:"#92400e",textAlign:"center"},children:"Server restarted — refreshing documents"}),re&&!O&&T.jsx(AY,{onDismiss:()=>L(!0)}),T.jsx(u$,{editor:Mt.current,ydoc:(j==null?void 0:j.ydoc)??null}),T.jsx(w$,{tabs:v,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:k}),A&&!_&&T.jsxs("div",{style:{padding:"8px 16px",background:"#eef2ff",borderBottom:"1px solid #c7d2fe",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",color:"#4338ca"},children:[T.jsxs("span",{children:[Y," annotations pending review."]}),T.jsxs("div",{style:{display:"flex",gap:"8px"},children:[T.jsx("button",{onClick:je,style:{padding:"3px 10px",fontSize:"12px",border:"1px solid #6366f1",borderRadius:"4px",background:"#6366f1",color:"white",cursor:"pointer",fontWeight:500},children:"Review in sequence"}),T.jsx("button",{onClick:()=>te(!1),style:{padding:"3px 10px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"4px",background:"white",color:"#6b7280",cursor:"pointer"},children:"Dismiss"})]})]}),T.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[T.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:ee?"2px dashed #6366f1":"2px solid transparent",background:ee?"#eef2ff":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:ne,onDragLeave:Z,onDrop:I,children:[T.jsx(E$,{visible:(j==null?void 0:j.readOnly)===!0&&(j==null?void 0:j.format)==="docx",documentId:j==null?void 0:j.id}),T.jsx("div",{style:{maxWidth:ar==="reading"?`${OY}px`:void 0,margin:ar==="reading"?"0 auto":void 0},children:j?T.jsx(b9,{ydoc:j.ydoc,provider:j.provider,readOnly:m,reviewMode:_,activeAnnotationId:_e,onEditorReady:zt},j.id):T.jsx(TY,{connected:i,claudeActive:p})})]}),T.jsx("div",{"data-testid":"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",tabIndex:0,onMouseDown:le,style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:Ne=>{Ne.currentTarget.style.background="#d1d5db"},onMouseLeave:Ne=>{Ne.currentTarget.style.background="transparent"}}),T.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Mn}px`,borderLeft:"1px solid #e5e7eb"},children:[T.jsxs("div",{style:{display:"flex",borderBottom:"1px solid #e5e7eb",background:"#f9fafb"},children:[T.jsx("button",{onClick:()=>ge(!1),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:pe?400:600,border:"none",borderBottom:pe?"none":"2px solid #6366f1",background:"transparent",cursor:"pointer",color:pe?"#6b7280":"#6366f1"},children:"Annotations"}),T.jsx("button",{onMouseDown:St,onClick:()=>ge(!0),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:pe?600:400,border:"none",borderBottom:pe?"2px solid #6366f1":"none",background:"transparent",cursor:"pointer",color:pe?"#6366f1":"#6b7280"},children:"Chat"})]}),T.jsx("div",{style:{display:pe?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:T.jsx(JF,{ctrlYdoc:y,editor:Mt.current,activeDocId:e,openDocs:ie,claudeActive:p,claudeStatus:d,visible:pe,capturedAnchor:Me,onCapturedAnchorChange:Ze})}),T.jsx("div",{style:{display:pe?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:T.jsx(T9,{annotations:J,editor:Mt.current,ydoc:(j==null?void 0:j.ydoc)??null,heldCount:ce,interruptionMode:C,onModeChange:U,activeDocFormat:j==null?void 0:j.format,documentId:j==null?void 0:j.id,reviewMode:_,onToggleReviewMode:je,onExitReviewMode:Pe,activeAnnotationId:_e,onActiveAnnotationChange:Ge})})]})]}),T.jsx(e$,{connected:i,connectionStatus:s,reconnectAttempts:o,disconnectedSince:c,claudeStatus:d,claudeActive:p,readOnly:m,documentCount:t.length,interruptionMode:C,onModeChange:U,heldCount:ce,widthMode:ar,onToggleWidthMode:Zr}),me&&de&&T.jsx(v$,{accepted:de.accepted,dismissed:de.dismissed,total:de.total,onDismiss:M}),T.jsx(C$,{open:qe,onClose:()=>dt(!1)}),T.jsx(A$,{toasts:ue,onDismiss:G}),se&&T.jsx(_$,{currentStep:ve,onNext:Xe,onDismiss:Ae})]}):T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"#9ca3af"},children:"Connecting..."})}const DY=GN.createRoot(document.getElementById("root"));DY.render(T.jsx(an.StrictMode,{children:T.jsx(ZN,{children:T.jsx(_Y,{})})}));